From 9bad1d663057813c998c963477e1987b19cdc805 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 11 Jun 2025 14:21:51 +0800 Subject: [PATCH] chore: child node can not single run --- .../workflow/nodes/_base/components/node-control.tsx | 3 ++- .../components/panel-operator/panel-operator-popup.tsx | 6 ++++-- .../nodes/_base/components/workflow-panel/index.tsx | 3 ++- .../workflow/nodes/assigner/use-single-run-form-params.ts | 1 - web/app/components/workflow/utils/workflow.ts | 5 ++++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/web/app/components/workflow/nodes/_base/components/node-control.tsx b/web/app/components/workflow/nodes/_base/components/node-control.tsx index 86cfb9bc1a..55d3280c4c 100644 --- a/web/app/components/workflow/nodes/_base/components/node-control.tsx +++ b/web/app/components/workflow/nodes/_base/components/node-control.tsx @@ -36,6 +36,7 @@ const NodeControl: FC = ({ setOpen(newOpen) }, []) + const isChildNode = !!(data.isInIteration || data.isInLoop) return (
= ({ onClick={e => e.stopPropagation()} > { - canRunBySingle(data.type) && ( + canRunBySingle(data.type, isChildNode) && (
{ diff --git a/web/app/components/workflow/nodes/_base/components/panel-operator/panel-operator-popup.tsx b/web/app/components/workflow/nodes/_base/components/panel-operator/panel-operator-popup.tsx index 28d7358ddb..b079c7b5e0 100644 --- a/web/app/components/workflow/nodes/_base/components/panel-operator/panel-operator-popup.tsx +++ b/web/app/components/workflow/nodes/_base/components/panel-operator/panel-operator-popup.tsx @@ -83,14 +83,16 @@ const PanelOperatorPopup = ({ const link = useNodeHelpLink(data.type) + const isChildNode = !!(data.isInIteration || data.isInLoop) + return (
{ - (showChangeBlock || canRunBySingle(data.type)) && ( + (showChangeBlock || canRunBySingle(data.type, isChildNode)) && ( <>
{ - canRunBySingle(data.type) && ( + canRunBySingle(data.type, isChildNode) && (
= ({ saveStateToHistory(WorkflowHistoryEvent.NodeDescriptionChange) }, [handleNodeDataUpdateWithSyncDraft, id, saveStateToHistory]) - const isSupportSingleRun = canRunBySingle(data.type) + const isChildNode = !!(data.isInIteration || data.isInLoop) + const isSupportSingleRun = canRunBySingle(data.type, isChildNode) const appDetail = useAppStore(state => state.appDetail) const { diff --git a/web/app/components/workflow/nodes/assigner/use-single-run-form-params.ts b/web/app/components/workflow/nodes/assigner/use-single-run-form-params.ts index 0139bf024b..c6d483a3ee 100644 --- a/web/app/components/workflow/nodes/assigner/use-single-run-form-params.ts +++ b/web/app/components/workflow/nodes/assigner/use-single-run-form-params.ts @@ -29,7 +29,6 @@ const useSingleRunFormParams = ({ && item.operation !== WriteMode.removeFirst && item.operation !== WriteMode.removeLast && !writeModeTypesNum.includes(item.operation) }).map(item => item.value as ValueSelector) - console.log(vars) const forms = useMemo(() => { const varInputs = varSelectorsToVarInputs(vars) diff --git a/web/app/components/workflow/utils/workflow.ts b/web/app/components/workflow/utils/workflow.ts index 6c82492bf4..93c0d38d4b 100644 --- a/web/app/components/workflow/utils/workflow.ts +++ b/web/app/components/workflow/utils/workflow.ts @@ -19,7 +19,10 @@ import { import type { IterationNodeType } from '../nodes/iteration/types' import type { LoopNodeType } from '../nodes/loop/types' -export const canRunBySingle = (nodeType: BlockEnum) => { +export const canRunBySingle = (nodeType: BlockEnum, isChildNode: boolean) => { + // child node means in iteration or loop. Set value to iteration(or loop) may cause variable not exit problem in backend. + if(isChildNode && nodeType === BlockEnum.Assigner) + return false return nodeType === BlockEnum.LLM || nodeType === BlockEnum.KnowledgeRetrieval || nodeType === BlockEnum.Code