From c2e50814372e78fe132f8d7af2fbd10c60016a18 Mon Sep 17 00:00:00 2001 From: Harry Date: Thu, 8 Jan 2026 12:16:18 +0800 Subject: [PATCH] feat(llm-panel): collapse panel with advanced settings and max iterations - Introduced a collapsible section for advanced settings in the LLM panel. - Added Max Iterations component with conditional rendering based on the new hideMaxIterations prop. - Updated context field and vision configuration to be part of the advanced settings. - Added new translation key for advanced settings in the workflow localization file. --- .../nodes/llm/components/tools/index.tsx | 12 ++- .../components/workflow/nodes/llm/panel.tsx | 92 +++++++++++-------- web/i18n/en-US/workflow.json | 1 + 3 files changed, 64 insertions(+), 41 deletions(-) diff --git a/web/app/components/workflow/nodes/llm/components/tools/index.tsx b/web/app/components/workflow/nodes/llm/components/tools/index.tsx index 2eb4fd5869..285eab86a9 100644 --- a/web/app/components/workflow/nodes/llm/components/tools/index.tsx +++ b/web/app/components/workflow/nodes/llm/components/tools/index.tsx @@ -10,11 +10,13 @@ type ToolsProps = { nodeId: string tools?: ToolValue[] maxIterations?: number + hideMaxIterations?: boolean } const Tools = ({ nodeId, tools = [], maxIterations = 10, + hideMaxIterations = false, }: ToolsProps) => { const { t } = useTranslation() const { @@ -42,10 +44,12 @@ const Tools = ({ onChange={handleToolsChange} supportCollapse /> - + {!hideMaxIterations && ( + + )} ) } diff --git a/web/app/components/workflow/nodes/llm/panel.tsx b/web/app/components/workflow/nodes/llm/panel.tsx index 9d336d25b4..63c59d29dc 100644 --- a/web/app/components/workflow/nodes/llm/panel.tsx +++ b/web/app/components/workflow/nodes/llm/panel.tsx @@ -10,6 +10,7 @@ import Switch from '@/app/components/base/switch' import Toast from '@/app/components/base/toast' import Tooltip from '@/app/components/base/tooltip' import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' +import { FieldCollapse } from '@/app/components/workflow/nodes/_base/components/collapse' import Field from '@/app/components/workflow/nodes/_base/components/field' import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars' import Editor from '@/app/components/workflow/nodes/_base/components/prompt/editor' @@ -23,6 +24,8 @@ import ConfigPrompt from './components/config-prompt' import ReasoningFormatConfig from './components/reasoning-format-config' import StructureOutput from './components/structure-output' import Tools from './components/tools' +import MaxIterations from './components/tools/max-iterations' +import { useNodeTools } from './components/tools/use-node-tools' import useConfig from './use-config' const i18nPrefix = 'nodes.llm' @@ -67,6 +70,10 @@ const Panel: FC> = ({ handleReasoningFormatChange, } = useConfig(id, data) + const { + handleMaxIterationsChange, + } = useNodeTools(id) + const model = inputs.model const handleModelChange = useCallback((model: { @@ -118,26 +125,6 @@ const Panel: FC> = ({ /> - {/* knowledge */} - - <> - - {shouldShowContextTip && ( -
{t(`${i18nPrefix}.notSetContextInPromptTip`, { ns: 'workflow' })}
- )} - -
- {/* Prompt */} {model.name && ( > = ({ nodeId={id} tools={inputs.tools} maxIterations={inputs.max_iterations} + hideMaxIterations /> - {/* Vision: GPT4-vision and so on */} - + {/* Advanced Settings - 折叠区 */} + +
+ {/* Context */} + + <> + + {shouldShowContextTip && ( +
{t(`${i18nPrefix}.notSetContextInPromptTip`, { ns: 'workflow' })}
+ )} + +
- {/* Reasoning Format */} - + {/* Vision: GPT4-vision and so on */} + + + {/* Max Iterations */} + + + {/* Reasoning Format */} + +
+