diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts index 9526f77f69..98e6b5ed9a 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts +++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts @@ -152,7 +152,12 @@ const formatItem = (item: any, isChatMode: boolean, filterVar: (payload: Var, se export const toNodeOutputVars = (nodes: any[], isChatMode: boolean, filterVar = (_payload: Var, _selector: ValueSelector) => true): NodeOutPutVar[] => { const res = nodes .filter(node => SUPPORT_OUTPUT_VARS_NODE.includes(node.data.type)) - .map(node => formatItem(node, isChatMode, filterVar)) + .map((node) => { + return { + ...formatItem(node, isChatMode, filterVar), + isStartNode: node.data.type === BlockEnum.Start, + } + }) .filter(item => item.vars.length > 0) return res } diff --git a/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts b/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts index 37755fddb6..42d8cce551 100644 --- a/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts +++ b/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts @@ -62,9 +62,12 @@ const useOneStepRun = ({ const allOutputVars = toNodeOutputVars(getBeforeNodesInSameBranch(id), isChatMode) const getVar = (valueSelector: ValueSelector): Var | undefined => { let res: Var | undefined - const targetVar = allOutputVars.find(v => v.nodeId === valueSelector[0]) + const isSystem = valueSelector[0] === 'sys' + const targetVar = isSystem ? allOutputVars.find(item => !!item.isStartNode) : allOutputVars.find(v => v.nodeId === valueSelector[0]) if (!targetVar) return undefined + if (isSystem) + return targetVar.vars.find(item => item.variable.split('.')[1] === valueSelector[1]) let curr: any = targetVar.vars valueSelector.slice(1).forEach((key, i) => { diff --git a/web/app/components/workflow/nodes/http/panel.tsx b/web/app/components/workflow/nodes/http/panel.tsx index b7f749e886..0a214d142a 100644 --- a/web/app/components/workflow/nodes/http/panel.tsx +++ b/web/app/components/workflow/nodes/http/panel.tsx @@ -160,7 +160,7 @@ const Panel: FC> = ({ /> diff --git a/web/app/components/workflow/types.ts b/web/app/components/workflow/types.ts index 20cd9946d0..67e20139b7 100644 --- a/web/app/components/workflow/types.ts +++ b/web/app/components/workflow/types.ts @@ -157,6 +157,7 @@ export type NodeOutPutVar = { nodeId: string title: string vars: Var[] + isStartNode?: boolean } export type Block = {