diff --git a/web/frontend/src/components/config/config-page.tsx b/web/frontend/src/components/config/config-page.tsx index ee24aafaa..24a719d86 100644 --- a/web/frontend/src/components/config/config-page.tsx +++ b/web/frontend/src/components/config/config-page.tsx @@ -155,6 +155,11 @@ export function ConfigPage() { "Max tool iterations", { min: 1 }, ) + const toolFeedbackMaxArgsLength = parseIntField( + form.toolFeedbackMaxArgsLength, + "Tool feedback max args length", + { min: 0 }, + ) const summarizeMessageThreshold = parseIntField( form.summarizeMessageThreshold, "Summarize message threshold", @@ -203,6 +208,10 @@ export function ConfigPage() { defaults: { workspace, restrict_to_workspace: form.restrictToWorkspace, + tool_feedback: { + enabled: form.toolFeedbackEnabled, + max_args_length: toolFeedbackMaxArgsLength, + }, max_tokens: maxTokens, context_window: contextWindow, max_tool_iterations: maxToolIterations, diff --git a/web/frontend/src/components/config/config-sections.tsx b/web/frontend/src/components/config/config-sections.tsx index d938a93d4..5482b0a35 100644 --- a/web/frontend/src/components/config/config-sections.tsx +++ b/web/frontend/src/components/config/config-sections.tsx @@ -93,6 +93,33 @@ export function AgentDefaultsSection({ } /> + + onFieldChange("toolFeedbackEnabled", checked) + } + /> + + {form.toolFeedbackEnabled && ( + + + onFieldChange("toolFeedbackMaxArgsLength", e.target.value) + } + /> + + )} + export interface CoreConfigForm { workspace: string restrictToWorkspace: boolean + toolFeedbackEnabled: boolean + toolFeedbackMaxArgsLength: string execEnabled: boolean allowRemote: boolean enableDenyPatterns: boolean @@ -63,6 +65,8 @@ export const DM_SCOPE_OPTIONS = [ export const EMPTY_FORM: CoreConfigForm = { workspace: "", restrictToWorkspace: true, + toolFeedbackEnabled: true, + toolFeedbackMaxArgsLength: "300", execEnabled: true, allowRemote: true, enableDenyPatterns: true, @@ -124,6 +128,7 @@ export function buildFormFromConfig(config: unknown): CoreConfigForm { const tools = asRecord(root.tools) const cron = asRecord(tools.cron) const exec = asRecord(tools.exec) + const toolFeedback = asRecord(defaults.tool_feedback) return { workspace: asString(defaults.workspace) || EMPTY_FORM.workspace, @@ -131,6 +136,14 @@ export function buildFormFromConfig(config: unknown): CoreConfigForm { defaults.restrict_to_workspace === undefined ? EMPTY_FORM.restrictToWorkspace : asBool(defaults.restrict_to_workspace), + toolFeedbackEnabled: + toolFeedback.enabled === undefined + ? EMPTY_FORM.toolFeedbackEnabled + : asBool(toolFeedback.enabled), + toolFeedbackMaxArgsLength: asNumberString( + toolFeedback.max_args_length, + EMPTY_FORM.toolFeedbackMaxArgsLength, + ), execEnabled: exec.enabled === undefined ? EMPTY_FORM.execEnabled diff --git a/web/frontend/src/i18n/locales/en.json b/web/frontend/src/i18n/locales/en.json index 0ff2beb25..66e39ad0e 100644 --- a/web/frontend/src/i18n/locales/en.json +++ b/web/frontend/src/i18n/locales/en.json @@ -396,6 +396,10 @@ "workspace_hint": "Base directory for agent file operations.", "restrict_workspace": "Restrict to Workspace", "restrict_workspace_hint": "Only allow file operations inside workspace.", + "tool_feedback_enabled": "Tool Feedback", + "tool_feedback_enabled_hint": "Send a short tool-call preview into the current chat before each tool execution.", + "tool_feedback_max_args_length": "Tool Feedback Args Preview Length", + "tool_feedback_max_args_length_hint": "Maximum number of argument characters shown in each tool feedback message. Set to 0 to use the default.", "exec_enabled": "Allow Commands", "exec_enabled_hint": "Enable or disable command execution for the app. When disabled, no command requests will run.", "allow_remote": "Allow Remote Commands", diff --git a/web/frontend/src/i18n/locales/zh.json b/web/frontend/src/i18n/locales/zh.json index fc1f007ae..65f2a5548 100644 --- a/web/frontend/src/i18n/locales/zh.json +++ b/web/frontend/src/i18n/locales/zh.json @@ -396,6 +396,10 @@ "workspace_hint": "智能体执行文件读写操作时使用的基础目录。", "restrict_workspace": "限制工作目录访问", "restrict_workspace_hint": "仅允许在工作目录内执行文件操作。", + "tool_feedback_enabled": "工具反馈", + "tool_feedback_enabled_hint": "在每次执行工具前,先向当前会话发送一条简短的工具调用预览。", + "tool_feedback_max_args_length": "工具反馈参数预览长度", + "tool_feedback_max_args_length_hint": "每条工具反馈消息中展示的参数字符上限。设为 0 时使用默认值。", "exec_enabled": "允许命令执行", "exec_enabled_hint": "控制应用是否允许执行命令。关闭后,所有命令请求都不会执行。", "allow_remote": "允许远程命令执行",