diff --git a/web/app/components/base/prompt-editor/plugins/component-picker.tsx b/web/app/components/base/prompt-editor/plugins/component-picker.tsx index 1e8ab2d8ee..0faa499bd4 100644 --- a/web/app/components/base/prompt-editor/plugins/component-picker.tsx +++ b/web/app/components/base/prompt-editor/plugins/component-picker.tsx @@ -229,6 +229,7 @@ const ComponentPicker: FC = ({ { workflowVariableShow && !!workflowVariables?.length && ( 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 b646accc3c..b6129f23f8 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 @@ -184,12 +184,14 @@ const ObjectChildren: FC = ({ } type Props = { + hideSearch?: boolean searchBoxClassName?: string vars: NodeOutPutVar[] onChange: (value: ValueSelector) => void itemWidth?: number } const VarReferenceVars: FC = ({ + hideSearch, searchBoxClassName, vars, onChange, @@ -214,29 +216,35 @@ const VarReferenceVars: FC = ({ // max-h-[300px] overflow-y-auto todo: use portal to handle long list return ( <> -
e.stopPropagation()} - > - - setSearchText(e.target.value)} - autoFocus - /> - { - searchText && ( -
setSearchText('')} - > - -
- ) - } -
+ { + !hideSearch && ( +
e.stopPropagation()} + > + + + setSearchText(e.target.value)} + autoFocus + /> + { + searchText && ( +
setSearchText('')} + > + +
+ ) + } +
+ ) + } + {filteredVars.length > 0 ?
diff --git a/web/app/components/workflow/nodes/answer/panel.tsx b/web/app/components/workflow/nodes/answer/panel.tsx index 60ffa4e09d..b98bcfcaac 100644 --- a/web/app/components/workflow/nodes/answer/panel.tsx +++ b/web/app/components/workflow/nodes/answer/panel.tsx @@ -3,13 +3,9 @@ import React from 'react' import { useTranslation } from 'react-i18next' import useConfig from './use-config' import type { AnswerNodeType } from './types' -import VarList from '@/app/components/workflow/nodes/_base/components/variable/var-list' -import Field from '@/app/components/workflow/nodes/_base/components/field' -import AddButton from '@/app/components/base/button/add-button' -import Split from '@/app/components/workflow/nodes/_base/components/split' import Editor from '@/app/components/workflow/nodes/_base/components/prompt/editor' import type { NodePanelProps } from '@/app/components/workflow/types' - +import useAvailableVarList from '@/app/components/workflow/nodes/_base/hooks/use-available-var-list' const i18nPrefix = 'workflow.nodes.answer' const Panel: FC> = ({ @@ -21,29 +17,17 @@ const Panel: FC> = ({ const { readOnly, inputs, - handleVarListChange, - handleAddVariable, handleAnswerChange, filterVar, } = useConfig(id, data) + const availableVarList = useAvailableVarList(id, { + onlyLeafNodeVar: false, + filterVar, + }) + return (
- : undefined - } - > - - - = ({ onlyLeafNodeVar: false, filterVar, }) - // console.log('availableVarList', availableVarList) const handleChatModePromptChange = useCallback((index: number) => { return (prompt: string) => { @@ -172,6 +171,7 @@ const ConfigPrompt: FC = ({ isChatApp={isChatApp} isShowContext={isShowContext} hasSetBlockStatus={hasSetBlockStatus} + nodesOutputVars={availableVarList} />
)}