From e35906bb1447b60b4836587d824b488698e12b14 Mon Sep 17 00:00:00 2001 From: xiaoen <2768753269@qq.com> Date: Fri, 13 Mar 2026 15:16:57 +0800 Subject: [PATCH] feat(config): expose context_window in example config and web UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add context_window to config.example.json, the web configuration page (form model, input field, save handler), and i18n strings (en/zh). The field is optional — leaving it empty falls back to the 4x max_tokens heuristic. --- config/config.example.json | 1 + web/frontend/src/components/config/config-page.tsx | 4 ++++ .../src/components/config/config-sections.tsx | 14 ++++++++++++++ web/frontend/src/components/config/form-model.ts | 3 +++ web/frontend/src/i18n/locales/en.json | 2 ++ web/frontend/src/i18n/locales/zh.json | 2 ++ 6 files changed, 26 insertions(+) diff --git a/config/config.example.json b/config/config.example.json index 094aa46df..20c10e60d 100644 --- a/config/config.example.json +++ b/config/config.example.json @@ -5,6 +5,7 @@ "restrict_to_workspace": true, "model_name": "gpt-5.4", "max_tokens": 8192, + "context_window": 131072, "temperature": 0.7, "max_tool_iterations": 20, "summarize_message_threshold": 20, diff --git a/web/frontend/src/components/config/config-page.tsx b/web/frontend/src/components/config/config-page.tsx index cbce7d27e..dc6797749 100644 --- a/web/frontend/src/components/config/config-page.tsx +++ b/web/frontend/src/components/config/config-page.tsx @@ -144,6 +144,9 @@ export function ConfigPage() { const maxTokens = parseIntField(form.maxTokens, "Max tokens", { min: 1, }) + const contextWindow = form.contextWindow.trim() + ? parseIntField(form.contextWindow, "Context window", { min: 1 }) + : undefined const maxToolIterations = parseIntField( form.maxToolIterations, "Max tool iterations", @@ -171,6 +174,7 @@ export function ConfigPage() { workspace, restrict_to_workspace: form.restrictToWorkspace, max_tokens: maxTokens, + context_window: contextWindow, max_tool_iterations: maxToolIterations, summarize_message_threshold: summarizeMessageThreshold, summarize_token_percent: summarizeTokenPercent, diff --git a/web/frontend/src/components/config/config-sections.tsx b/web/frontend/src/components/config/config-sections.tsx index dfbe22fc3..825d882b7 100644 --- a/web/frontend/src/components/config/config-sections.tsx +++ b/web/frontend/src/components/config/config-sections.tsx @@ -114,6 +114,20 @@ export function AgentDefaultsSection({ /> + + onFieldChange("contextWindow", e.target.value)} + placeholder="131072" + /> + +