feat(web): Tool feedback on UI (#1933)

* feat(web): tool feedback

* feat(web): tool feedback

* fix test
This commit is contained in:
Mauro
2026-03-24 02:19:51 +01:00
committed by GitHub
parent 69cf9342e1
commit aa3300c1bd
5 changed files with 57 additions and 0 deletions
@@ -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,
@@ -93,6 +93,33 @@ export function AgentDefaultsSection({
}
/>
<SwitchCardField
label={t("pages.config.tool_feedback_enabled")}
hint={t("pages.config.tool_feedback_enabled_hint")}
layout="setting-row"
checked={form.toolFeedbackEnabled}
onCheckedChange={(checked) =>
onFieldChange("toolFeedbackEnabled", checked)
}
/>
{form.toolFeedbackEnabled && (
<Field
label={t("pages.config.tool_feedback_max_args_length")}
hint={t("pages.config.tool_feedback_max_args_length_hint")}
layout="setting-row"
>
<Input
type="number"
min={0}
value={form.toolFeedbackMaxArgsLength}
onChange={(e) =>
onFieldChange("toolFeedbackMaxArgsLength", e.target.value)
}
/>
</Field>
)}
<Field
label={t("pages.config.max_tokens")}
hint={t("pages.config.max_tokens_hint")}
@@ -3,6 +3,8 @@ export type JsonRecord = Record<string, unknown>
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
+4
View File
@@ -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",
+4
View File
@@ -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": "允许远程命令执行",