mirror of
https://github.com/n8n-io/n8n.git
synced 2025-11-20 17:46:34 +00:00
"fix" chat trigger
This commit is contained in:
parent
3748a184dd
commit
3f52b704e2
@ -104,10 +104,9 @@ export class WorkflowExecutionService {
|
||||
// - check the chat trigger, as it's probably a fourth type of payload
|
||||
// - find out if we need to register a webhook during PartialManualExecutionToDestination
|
||||
// - figure out where to do the OffloadingManualExecutionsInQueueMode changes
|
||||
console.log('payload', payload);
|
||||
function isFullManualExecutionFromTriggerPayload(
|
||||
payload: WorkflowRequest.ManualRunPayload,
|
||||
): payload is WorkflowRequest.FullManualExecutionFromTriggerPayload {
|
||||
): payload is WorkflowRequest.FullManualExecutionFromKnownTriggerPayload {
|
||||
if (!('destinationNode' in payload)) {
|
||||
return true;
|
||||
}
|
||||
@ -116,7 +115,7 @@ export class WorkflowExecutionService {
|
||||
|
||||
function isFullManualExecutionToDestinationPayload(
|
||||
payload: WorkflowRequest.ManualRunPayload,
|
||||
): payload is WorkflowRequest.FullManualExecutionToDestinationPayload {
|
||||
): payload is WorkflowRequest.FullManualExecutionFromUnknownTriggerPayload {
|
||||
if ('destinationNode' in payload && !('runData' in payload)) {
|
||||
return true;
|
||||
}
|
||||
@ -135,16 +134,16 @@ export class WorkflowExecutionService {
|
||||
// For manual testing always set to not active
|
||||
payload.workflowData.active = false;
|
||||
|
||||
// TODO: fix this on the FE
|
||||
if ('triggerToStartFrom' in payload) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
||||
delete (payload as any).runData;
|
||||
}
|
||||
|
||||
console.log('payload', payload);
|
||||
|
||||
if (isPartialManualExecutionToDestination(payload)) {
|
||||
console.log('isPartialManualExecutionToDestination');
|
||||
// prerequisites:
|
||||
//
|
||||
// TODO:
|
||||
// 1. find out if the destinationNode is connected to a trigger with runData
|
||||
// - otherwise this will be a FullManualExecutionToDestinationPayload instead
|
||||
//
|
||||
// 2. make sure the destinationNode is not a trigger
|
||||
// - otherwise this is a FullManualExecutionToDestinationPayload instead
|
||||
|
||||
// If the destination node is a trigger, then per definition this
|
||||
// is not a partial execution and thus we can ignore the run data.
|
||||
@ -159,7 +158,7 @@ export class WorkflowExecutionService {
|
||||
workflowData: payload.workflowData,
|
||||
destinationNode: payload.destinationNode,
|
||||
agentRequest: payload.agentRequest,
|
||||
} satisfies WorkflowRequest.FullManualExecutionToDestinationPayload;
|
||||
} satisfies WorkflowRequest.FullManualExecutionFromUnknownTriggerPayload;
|
||||
} else {
|
||||
console.log('prerequisitesAreGiven');
|
||||
const executionId = await this.workflowRunner.run({
|
||||
|
||||
@ -28,21 +28,20 @@ export declare namespace WorkflowRequest {
|
||||
uiContext?: string;
|
||||
}>;
|
||||
|
||||
// 1. Full Manual Execution from Trigger
|
||||
type FullManualExecutionFromTriggerPayload = {
|
||||
// 1. Full Manual Execution from Known Trigger
|
||||
type FullManualExecutionFromKnownTriggerPayload = {
|
||||
workflowData: IWorkflowBase;
|
||||
destinationNode: string;
|
||||
triggerToStartFrom?: { name: string; data?: ITaskData };
|
||||
agentRequest?: AiAgentRequest;
|
||||
};
|
||||
// 2. Full Manual Execution to Destination
|
||||
type FullManualExecutionToDestinationPayload = {
|
||||
// 2. Full Manual Execution from Unknown Trigger
|
||||
type FullManualExecutionFromUnknownTriggerPayload = {
|
||||
workflowData: IWorkflowBase;
|
||||
destinationNode: string;
|
||||
agentRequest?: AiAgentRequest;
|
||||
};
|
||||
|
||||
// There could also be an edge case for the chat node where the triggerToStartFrom with data and the destinationNode exists.
|
||||
|
||||
// 3. Partial Manual Execution to Destination
|
||||
type PartialManualExecutionToDestination = {
|
||||
workflowData: IWorkflowBase;
|
||||
@ -53,8 +52,8 @@ export declare namespace WorkflowRequest {
|
||||
};
|
||||
|
||||
type ManualRunPayload =
|
||||
| FullManualExecutionFromTriggerPayload
|
||||
| FullManualExecutionToDestinationPayload
|
||||
| FullManualExecutionFromKnownTriggerPayload
|
||||
| FullManualExecutionFromUnknownTriggerPayload
|
||||
| PartialManualExecutionToDestination;
|
||||
|
||||
type Create = AuthenticatedRequest<{}, {}, CreateUpdatePayload>;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user