fix: Chat triggers don't work with the new partial execution flow (#11952)

This commit is contained in:
Danny Martini
2024-12-04 15:33:46 +01:00
committed by GitHub
parent 0e26f58ae6
commit 2b6a72f128
11 changed files with 360 additions and 80 deletions

View File

@@ -150,6 +150,7 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
let { runData: newRunData } = consolidatedData;
let executedNode: string | undefined;
let triggerToStartFrom: IStartRunData['triggerToStartFrom'];
if (
startNodeNames.length === 0 &&
'destinationNode' in options &&
@@ -157,14 +158,16 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
) {
executedNode = options.destinationNode;
startNodeNames.push(options.destinationNode);
} else if ('triggerNode' in options && 'nodeData' in options) {
} else if (options.triggerNode && options.nodeData) {
startNodeNames.push(
...workflow.getChildNodes(options.triggerNode as string, NodeConnectionType.Main, 1),
...workflow.getChildNodes(options.triggerNode, NodeConnectionType.Main, 1),
);
newRunData = {
[options.triggerNode as string]: [options.nodeData],
} as IRunData;
newRunData = { [options.triggerNode]: [options.nodeData] };
executedNode = options.triggerNode;
triggerToStartFrom = {
name: options.triggerNode,
data: options.nodeData,
};
}
// If the destination node is specified, check if it is a chat node or has a chat parent
@@ -258,6 +261,7 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
// data to use and what to ignore.
runData: partialExecutionVersion.value === 1 ? (runData ?? undefined) : newRunData,
startNodes,
triggerToStartFrom,
};
if ('destinationNode' in options) {
startRunData.destinationNode = options.destinationNode;