diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx index 18b54a2212..885cd2c30b 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx +++ b/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx @@ -41,16 +41,16 @@ const VarList: FC = ({ const handleVarReferenceChange = useCallback((index: number) => { return (value: ValueSelector | string, varKindType: VarKindType) => { const newList = produce(list, (draft) => { - if (!isSupportConstantValue || varKindType === VarKindType.selector) { + if (!isSupportConstantValue || varKindType === VarKindType.variable) { draft[index].value_selector = value as ValueSelector if (isSupportConstantValue) - draft[index].variable_type = VarKindType.selector + draft[index].variable_type = VarKindType.variable if (!draft[index].variable) draft[index].variable = value[value.length - 1] } else { - draft[index].variable_type = VarKindType.static + draft[index].variable_type = VarKindType.constant draft[index].value_selector = value as ValueSelector draft[index].value = value as string } @@ -85,7 +85,7 @@ const VarList: FC = ({ readonly={readonly} isShowNodeName className='grow' - value={item.variable_type === VarKindType.static ? (item.value || '') : (item.value_selector || [])} + value={item.variable_type === VarKindType.constant ? (item.value || '') : (item.value_selector || [])} isSupportConstantValue={isSupportConstantValue} onChange={handleVarReferenceChange(index)} defaultVarKindType={item.variable_type} diff --git a/web/app/components/workflow/nodes/end/node.tsx b/web/app/components/workflow/nodes/end/node.tsx index 1bd4ab72c0..15bdb00e30 100644 --- a/web/app/components/workflow/nodes/end/node.tsx +++ b/web/app/components/workflow/nodes/end/node.tsx @@ -2,7 +2,7 @@ import type { FC } from 'react' import React from 'react' import type { EndNodeType } from './types' import type { NodeProps, ValueSelector, Variable } from '@/app/components/workflow/types' -import { toNodeOutputVars } from '@/app/components/workflow/nodes/_base/components/variable/utils' +import { isSystemVar, toNodeOutputVars } from '@/app/components/workflow/nodes/_base/components/variable/utils' import { useIsChatMode, useWorkflow, @@ -21,8 +21,12 @@ const Node: FC> = ({ const isChatMode = useIsChatMode() const outputVars = toNodeOutputVars(availableNodes, isChatMode) + const startNode = availableNodes.find((node: any) => { + return node.data.type === BlockEnum.Start + }) + const getNode = (id: string) => { - return availableNodes.find(node => node.id === id) + return availableNodes.find(node => node.id === id) || startNode } const getVarType = (nodeId: string, value: ValueSelector) => { @@ -31,10 +35,11 @@ const Node: FC> = ({ return 'undefined' let type: VarType = VarType.string - let curr: any = targetVar.vars; + let curr: any = targetVar.vars + const isSystem = isSystemVar(value); (value).slice(1).forEach((key, i) => { const isLast = i === value.length - 2 - curr = curr.find((v: any) => v.variable === key) + curr = curr.find((v: any) => v.variable === isSystem ? `sys.${key}` : key) if (isLast) { type = curr.type } @@ -55,14 +60,15 @@ const Node: FC> = ({
{filteredOutputs.map(({ value_selector }, index) => { const node = getNode(value_selector[0]) - const varName = value_selector[value_selector.length - 1] + const isSystem = isSystemVar(value_selector) + const varName = isSystem ? `sys.${value_selector[value_selector.length - 1]}` : value_selector[value_selector.length - 1] return (
{node?.data.title}