From 3cc6b8a17a84e75614eff59bb906c5e9c12f34bd Mon Sep 17 00:00:00 2001 From: Theresa <63280168+sd0ric4@users.noreply.github.com> Date: Mon, 12 May 2025 18:18:05 +0800 Subject: [PATCH] fix: improve handling of interactive node responses in workflow dispatch (#4786) * fix: improve handling of interactive node responses in workflow dispatch * fix: simplify interactive response handling in dispatch functions --- .../core/workflow/dispatch/agent/runTool/index.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/packages/service/core/workflow/dispatch/agent/runTool/index.ts b/packages/service/core/workflow/dispatch/agent/runTool/index.ts index 3f63c4171..b80b84df7 100644 --- a/packages/service/core/workflow/dispatch/agent/runTool/index.ts +++ b/packages/service/core/workflow/dispatch/agent/runTool/index.ts @@ -47,6 +47,7 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise< query, requestOrigin, chatConfig, + lastInteractive, runningUserInfo, externalProvider, params: { @@ -85,18 +86,7 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise< }); // Check interactive entry - const interactiveResponse = (() => { - const lastHistory = chatHistories[chatHistories.length - 1]; - if (isEntry && lastHistory?.obj === ChatRoleEnum.AI) { - const lastValue = lastHistory.value[lastHistory.value.length - 1]; - if ( - lastValue?.type === ChatItemValueTypeEnum.interactive && - lastValue.interactive?.toolParams - ) { - return lastValue.interactive; - } - } - })(); + const interactiveResponse = lastInteractive; props.node.isEntry = false; const hasReadFilesTool = toolNodes.some( (item) => item.flowNodeType === FlowNodeTypeEnum.readFiles