From 78a85bf847be2ee32ca5154e52ac46f03cf25667 Mon Sep 17 00:00:00 2001 From: heheer Date: Mon, 28 Oct 2024 15:37:00 +0800 Subject: [PATCH] fix: optimize tool node check in workflow (#3002) * fix: optimize tool node check in workflow * comment --- projects/app/src/web/core/workflow/utils.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/projects/app/src/web/core/workflow/utils.ts b/projects/app/src/web/core/workflow/utils.ts index 9e416f36794a..b44982da788c 100644 --- a/projects/app/src/web/core/workflow/utils.ts +++ b/projects/app/src/web/core/workflow/utils.ts @@ -352,8 +352,16 @@ export const checkWorkflowNodeAndConnection = ({ return [data.nodeId]; } - // check empty node(not edge) - const hasEdge = edges.some( + // filter tools node edge + const edgeFilted = edges.filter( + (edge) => + !( + data.flowNodeType === FlowNodeTypeEnum.tools && + edge.sourceHandle === NodeOutputKeyEnum.selectedTools + ) + ); + // check node has edge + const hasEdge = edgeFilted.some( (edge) => edge.source === data.nodeId || edge.target === data.nodeId ); if (!hasEdge) {