diff --git a/web/app/components/workflow/hooks/use-workflow.ts b/web/app/components/workflow/hooks/use-workflow.ts index 11c58e5a1b..82dbbbc386 100644 --- a/web/app/components/workflow/hooks/use-workflow.ts +++ b/web/app/components/workflow/hooks/use-workflow.ts @@ -8,6 +8,7 @@ import { import { getLayoutByDagre } from '../utils' import type { Node } from '../types' import { BlockEnum } from '../types' +import { SUPPORT_OUTPUT_VARS_NODE } from '../constants' import { useStore as useAppStore } from '@/app/components/app/store' export const useIsChatMode = () => { @@ -105,13 +106,7 @@ export const useWorkflow = () => { const length = list.length if (length && list.some(item => item.data.type === BlockEnum.Start)) { return list.reverse().filter((item) => { - if (item.data.type === BlockEnum.IfElse) - return false - - if (item.data.type === BlockEnum.QuestionClassifier) - return false - - return true + return SUPPORT_OUTPUT_VARS_NODE.includes(item.data.type) }) } diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx index eb309847a7..ec7f8a3945 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx +++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx @@ -25,13 +25,6 @@ type Props = { onChange: (value: ValueSelector) => void } -// const toShowVarType = (type: string) => { -// if (['text-input', 'paragraph', 'select', 'url'].includes(type)) -// return 'String' - -// return type.charAt(0).toUpperCase() + type.substring(1) -// } - export const getNodeInfoById = (nodes: any, id: string) => { return nodes.find((node: any) => node.id === id) } @@ -45,15 +38,12 @@ const VarReferencePicker: FC = ({ onChange, }) => { const { getTreeLeafNodes, getBeforeNodesInSameBranch } = useWorkflow() - // console.log(getBeforeNodesInSameBranch(nodeId), getTreeLeafNodes()) const availableNodes = getBeforeNodesInSameBranch(nodeId) const outputVars = toNodeOutputVars(availableNodes) - // console.log(outputVars) const [open, setOpen] = useState(false) const hasValue = value.length > 0 const outputVarNodeId = hasValue ? value[0] : '' const outputVarNode = hasValue ? getNodeInfoById(availableNodes, outputVarNodeId)?.data : null - // console.log(hasValue, value, outputVarNode) const varName = hasValue ? value[value.length - 1] : '' const getVarType = () => {