diff --git a/web/app/components/workflow/nodes/assigner/node.tsx b/web/app/components/workflow/nodes/assigner/node.tsx index 2dd1ead4f8..ae42065e2d 100644 --- a/web/app/components/workflow/nodes/assigner/node.tsx +++ b/web/app/components/workflow/nodes/assigner/node.tsx @@ -4,7 +4,7 @@ import { useNodes } from 'reactflow' import { useTranslation } from 'react-i18next' import NodeVariableItem from '../variable-assigner/components/node-variable-item' import type { AssignerNodeType } from './types' -import { isConversationVar, isENV, isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils' +import { isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils' import { BlockEnum, type Node, type NodeProps } from '@/app/components/workflow/types' const i18nPrefix = 'workflow.nodes.assigner' @@ -38,18 +38,13 @@ const NodeComponent: FC> = ({ if (!variable || variable.length === 0) return null const isSystem = isSystemVar(variable) - const isEnv = isENV(variable) - const isChatVar = isConversationVar(variable) const node = isSystem ? nodes.find(node => node.data.type === BlockEnum.Start) : nodes.find(node => node.id === variable[0]) - const varName = isSystem ? `sys.${variable[variable.length - 1]}` : variable.slice(1).join('.') return ( ) @@ -63,19 +58,13 @@ const NodeComponent: FC> = ({ if (!variable || variable.length === 0) return null const isSystem = isSystemVar(variable) - const isEnv = isENV(variable) - const isChatVar = isConversationVar(variable) - const node = isSystem ? nodes.find(node => node.data.type === BlockEnum.Start) : nodes.find(node => node.id === variable[0]) - const varName = isSystem ? `sys.${variable[variable.length - 1]}` : variable.slice(1).join('.') return (
diff --git a/web/app/components/workflow/nodes/document-extractor/node.tsx b/web/app/components/workflow/nodes/document-extractor/node.tsx index 6b1d4343be..660e2ebb18 100644 --- a/web/app/components/workflow/nodes/document-extractor/node.tsx +++ b/web/app/components/workflow/nodes/document-extractor/node.tsx @@ -4,7 +4,7 @@ import { useNodes } from 'reactflow' import { useTranslation } from 'react-i18next' import NodeVariableItem from '../variable-assigner/components/node-variable-item' import type { DocExtractorNodeType } from './types' -import { isConversationVar, isENV, isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils' +import { isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils' import { BlockEnum, type Node, type NodeProps } from '@/app/components/workflow/types' const i18nPrefix = 'workflow.nodes.docExtractor' @@ -21,18 +21,13 @@ const NodeComponent: FC> = ({ return null const isSystem = isSystemVar(variable) - const isEnv = isENV(variable) - const isChatVar = isConversationVar(variable) const node = isSystem ? nodes.find(node => node.data.type === BlockEnum.Start) : nodes.find(node => node.id === variable[0]) - const varName = isSystem ? `sys.${variable[variable.length - 1]}` : variable.slice(1).join('.') return (
{t(`${i18nPrefix}.inputVar`)}
diff --git a/web/app/components/workflow/nodes/list-operator/node.tsx b/web/app/components/workflow/nodes/list-operator/node.tsx index 4c3596fd3b..8120c8e402 100644 --- a/web/app/components/workflow/nodes/list-operator/node.tsx +++ b/web/app/components/workflow/nodes/list-operator/node.tsx @@ -4,7 +4,7 @@ import { useNodes } from 'reactflow' import { useTranslation } from 'react-i18next' import NodeVariableItem from '../variable-assigner/components/node-variable-item' import type { ListFilterNodeType } from './types' -import { isConversationVar, isENV, isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils' +import { isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils' import { BlockEnum, type Node, type NodeProps } from '@/app/components/workflow/types' const i18nPrefix = 'workflow.nodes.listFilter' @@ -21,18 +21,13 @@ const NodeComponent: FC> = ({ return null const isSystem = isSystemVar(variable) - const isEnv = isENV(variable) - const isChatVar = isConversationVar(variable) const node = isSystem ? nodes.find(node => node.data.type === BlockEnum.Start) : nodes.find(node => node.id === variable[0]) - const varName = isSystem ? `sys.${variable[variable.length - 1]}` : variable.slice(1).join('.') return (
{t(`${i18nPrefix}.inputVar`)}
diff --git a/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx b/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx index e6984b98e0..c5bc9399b0 100644 --- a/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx +++ b/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx @@ -19,7 +19,7 @@ import { import { filterVar } from '../utils' import AddVariable from './add-variable' import NodeVariableItem from './node-variable-item' -import { isConversationVar, isENV, isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils' +import { isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils' import cn from '@/utils/classnames' import { isExceptionVariable } from '@/app/components/workflow/utils' @@ -124,9 +124,6 @@ const NodeGroupItem = ({ { !!item.variables.length && item.variables.map((variable = [], index) => { const isSystem = isSystemVar(variable) - const isEnv = isENV(variable) - const isChatVar = isConversationVar(variable) - const node = isSystem ? nodes.find(node => node.data.type === BlockEnum.Start) : nodes.find(node => node.id === variable[0]) const varName = isSystem ? `sys.${variable[variable.length - 1]}` : variable.slice(1).join('.') const isException = isExceptionVariable(varName, node?.data.type) @@ -134,11 +131,9 @@ const NodeGroupItem = ({ return ( ) diff --git a/web/app/components/workflow/nodes/variable-assigner/components/node-variable-item.tsx b/web/app/components/workflow/nodes/variable-assigner/components/node-variable-item.tsx index f5d05aae26..81286e21f8 100644 --- a/web/app/components/workflow/nodes/variable-assigner/components/node-variable-item.tsx +++ b/web/app/components/workflow/nodes/variable-assigner/components/node-variable-item.tsx @@ -9,13 +9,13 @@ import { Line3 } from '@/app/components/base/icons/src/public/common' import { Variable02 } from '@/app/components/base/icons/src/vender/solid/development' import { BubbleX, Env } from '@/app/components/base/icons/src/vender/line/others' import Badge from '@/app/components/base/badge' -import type { Node } from '@/app/components/workflow/types' +import type { Node, ValueSelector } from '@/app/components/workflow/types' +import { isConversationVar, isENV, isRagVariableVar, isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils' +import { InputField } from '@/app/components/base/icons/src/vender/pipeline' type NodeVariableItemProps = { - isEnv: boolean - isChatVar: boolean node: Node - varName: string + variable: ValueSelector writeMode?: string showBorder?: boolean className?: string @@ -25,10 +25,8 @@ type NodeVariableItemProps = { const i18nPrefix = 'workflow.nodes.assigner' const NodeVariableItem = ({ - isEnv, - isChatVar, node, - varName, + variable, writeMode, showBorder, className, @@ -36,6 +34,12 @@ const NodeVariableItem = ({ }: NodeVariableItemProps) => { const { t } = useTranslation() + const isSystem = isSystemVar(variable) + const isEnv = isENV(variable) + const isChatVar = isConversationVar(variable) + const isRagVar = isRagVariableVar(variable) + const varName = isSystem ? `sys.${variable[variable.length - 1]}` : variable.slice(1).join('.') + const VariableIcon = useMemo(() => { if (isEnv) { return ( @@ -49,6 +53,12 @@ const NodeVariableItem = ({ ) } + if(isRagVar) { + return ( + + ) + } + return ( ) - }, [isEnv, isChatVar, isException]) + }, [isEnv, isChatVar, isRagVar, isException]) const VariableName = useMemo(() => { return (