diff --git a/web/app/components/workflow/nodes/tool/components/input-var-list.tsx b/web/app/components/workflow/nodes/tool/components/input-var-list.tsx index 4933e6460b..a612c5e11f 100644 --- a/web/app/components/workflow/nodes/tool/components/input-var-list.tsx +++ b/web/app/components/workflow/nodes/tool/components/input-var-list.tsx @@ -65,7 +65,7 @@ const InputVarList: FC = ({ }) onChange(newValue) } - }, [value, onChange]) + }, [value, onChange, isSupportConstantValue]) return (
diff --git a/web/app/components/workflow/nodes/tool/use-config.ts b/web/app/components/workflow/nodes/tool/use-config.ts index e3163172a1..5355c8c7a3 100644 --- a/web/app/components/workflow/nodes/tool/use-config.ts +++ b/web/app/components/workflow/nodes/tool/use-config.ts @@ -84,14 +84,18 @@ const useConfig = (id: string, payload: ToolNodeType) => { if (!currTool) return const inputsWithDefaultValue = produce(inputs, (draft) => { - draft.tool_configurations = addDefaultValue(tool_configurations, toolSettingSchema) - draft.tool_parameters = toolInputVarSchema.map((item: any) => { - return { - variable: item.variable, - variable_type: VarType.static, - value: '', - } - }) + if (!draft.tool_configurations || Object.keys(draft.tool_configurations).length === 0) + draft.tool_configurations = addDefaultValue(tool_configurations, toolSettingSchema) + + if (!draft.tool_parameters || draft.tool_parameters.length === 0) { + draft.tool_parameters = toolInputVarSchema.map((item: any) => { + return { + variable: item.variable, + variable_type: VarType.static, + value: '', + } + }) + } }) setInputs(inputsWithDefaultValue) // eslint-disable-next-line react-hooks/exhaustive-deps