diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx index 114d849d50..8ee9698745 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx +++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx @@ -23,7 +23,9 @@ const VarReferencePopup: FC = ({ searchBoxClassName='mt-1' vars={vars} onChange={onChange} - itemWidth={itemWidth} /> + itemWidth={itemWidth} + isSupportFileVar + /> ) } diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx index ab71c959d5..9c2cba6e41 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx +++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx @@ -25,6 +25,7 @@ type ObjectChildrenProps = { onChange: (value: ValueSelector, item: Var) => void onHovering?: (value: boolean) => void itemWidth?: number + isSupportFileVar?: boolean } type ItemProps = { @@ -35,6 +36,7 @@ type ItemProps = { onChange: (value: ValueSelector, item: Var) => void onHovering?: (value: boolean) => void itemWidth?: number + isSupportFileVar?: boolean } const Item: FC = ({ @@ -45,6 +47,7 @@ const Item: FC = ({ onChange, onHovering, itemWidth, + isSupportFileVar, }) => { const isFile = itemData.type === VarType.file const isObj = ([VarType.object, VarType.file].includes(itemData.type) && itemData.children && itemData.children.length > 0) @@ -79,6 +82,9 @@ const Item: FC = ({ }, [isHovering]) const handleChosen = (e: React.MouseEvent) => { e.stopPropagation() + if (!isSupportFileVar && isFile) + return + if (isSys || isEnv || isChatVar) { // system variable | environment variable | conversation variable onChange([...objPath, ...itemData.variable.split('.')], itemData) } @@ -135,6 +141,7 @@ const Item: FC = ({ onChange={onChange} onHovering={setIsChildrenHovering} itemWidth={itemWidth} + isSupportFileVar={isSupportFileVar} /> )} {isFile && ( @@ -147,6 +154,7 @@ const Item: FC = ({ onChange={onChange} onHovering={setIsChildrenHovering} itemWidth={itemWidth} + isSupportFileVar={isSupportFileVar} /> )} @@ -162,6 +170,7 @@ const ObjectChildren: FC = ({ onChange, onHovering, itemWidth, + isSupportFileVar, }) => { const currObjPath = objPath const itemRef = useRef(null) @@ -206,6 +215,7 @@ const ObjectChildren: FC = ({ itemData={v} onChange={onChange} onHovering={setIsChildrenHovering} + isSupportFileVar={isSupportFileVar} /> )) } @@ -217,6 +227,7 @@ type Props = { hideSearch?: boolean searchBoxClassName?: string vars: NodeOutPutVar[] + isSupportFileVar?: boolean onChange: (value: ValueSelector, item: Var) => void itemWidth?: number maxHeightClass?: string @@ -225,6 +236,7 @@ const VarReferenceVars: FC = ({ hideSearch, searchBoxClassName, vars, + isSupportFileVar, onChange, itemWidth, maxHeightClass, @@ -299,6 +311,7 @@ const VarReferenceVars: FC = ({ itemData={v} onChange={onChange} itemWidth={itemWidth} + isSupportFileVar={isSupportFileVar} /> ))} )) diff --git a/web/app/components/workflow/nodes/if-else/components/condition-add.tsx b/web/app/components/workflow/nodes/if-else/components/condition-add.tsx index ec1851c30d..344e986305 100644 --- a/web/app/components/workflow/nodes/if-else/components/condition-add.tsx +++ b/web/app/components/workflow/nodes/if-else/components/condition-add.tsx @@ -64,6 +64,7 @@ const ConditionAdd = ({