From b1fc0e18d9d444b318df91945a8485f222214548 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Tue, 28 Apr 2026 15:08:24 +0800 Subject: [PATCH] feat: Add LLM call timeout configuration to agent frontend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add llm_call_timeout field to CustomAgentConfig TypeScript interface - Add thinking field to CustomAgentConfig (for extended thinking support) - Add UI control (number input) in AgentEditorModal for timeout configuration - Range: 0-600 seconds (0 = use global default) - Supports 60-600 seconds recommended range - Add i18n translations in Chinese (zh-CN) and English (en-US) - Label: "LLM 调用超时" / "LLM Call Timeout" - Description with explanation of timeout behavior - Hint about default and unlimited wait implications - Placeholder with recommended range - Initialize llm_call_timeout: 0 in formData (uses global default) This completes the frontend support for per-agent LLM timeout configuration that was previously missing. The setting integrates with the existing three-tier configuration hierarchy: 1. Per-agent config (llm_call_timeout in custom_agents table) 2. Global config (agent.llm_call_timeout in config.yaml) 3. Hardcoded default (120 seconds) --- frontend/src/api/agent/index.ts | 2 ++ frontend/src/i18n/locales/en-US.ts | 6 ++++++ frontend/src/i18n/locales/zh-CN.ts | 6 ++++++ frontend/src/views/agent/AgentEditorModal.vue | 20 +++++++++++++++++++ 4 files changed, 34 insertions(+) diff --git a/frontend/src/api/agent/index.ts b/frontend/src/api/agent/index.ts index 330e685f..bad055d8 100644 --- a/frontend/src/api/agent/index.ts +++ b/frontend/src/api/agent/index.ts @@ -23,9 +23,11 @@ export interface CustomAgentConfig { rerank_model_id?: string; // ReRank 模型 ID temperature?: number; max_completion_tokens?: number; // 最大生成token数(普通模式) + thinking?: boolean; // 是否启用思考模式(支持扩展思考的模型) // ===== Agent模式设置 ===== max_iterations?: number; // 最大迭代次数 + llm_call_timeout?: number; // LLM调用超时时间(秒) allowed_tools?: string[]; // 允许的工具 reflection_enabled?: boolean; // 是否启用反思 // MCP服务选择模式:all=全部启用的MCP服务, selected=指定服务, none=不使用MCP diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index d6e7b6e7..76f19a90 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -3664,6 +3664,12 @@ export default { selectDesc: 'Select MCP services to enable', selectPlaceholder: 'Select MCP services', }, + llmCallTimeout: { + label: "LLM Call Timeout", + desc: "Maximum waiting time for a single LLM call (seconds). Call will be terminated if this time is exceeded", + hint: "0 means unlimited wait (not recommended)", + placeholder: "Enter seconds, recommended range 60-600", + }, imageUpload: { navLabel: 'Multimodal', sectionTitle: 'Multimodal Configuration', diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 79a6861a..954be566 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -3662,6 +3662,12 @@ export default { selectDesc: "选择要启用的 MCP 服务", selectPlaceholder: "选择 MCP 服务", }, + llmCallTimeout: { + label: "LLM 调用超时", + desc: "单次 LLM 调用的最大等待时间(秒),超过此时间后调用将被中止", + hint: "0 表示无限等待(不推荐)", + placeholder: "输入秒数,建议范围 60-600", + }, imageUpload: { navLabel: "多模态", sectionTitle: "多模态配置", diff --git a/frontend/src/views/agent/AgentEditorModal.vue b/frontend/src/views/agent/AgentEditorModal.vue index 110ee77d..3aaeb2e1 100644 --- a/frontend/src/views/agent/AgentEditorModal.vue +++ b/frontend/src/views/agent/AgentEditorModal.vue @@ -748,6 +748,25 @@ + +
+
+ +

{{ $t('agentEditor.llmCallTimeout.desc') }}

+

{{ $t('agentEditor.llmCallTimeout.hint') }}

+
+
+ +
+
+
@@ -1797,6 +1816,7 @@ const defaultFormData = { thinking: false, // 默认禁用思考模式 // Agent模式设置 max_iterations: 10, + llm_call_timeout: 120, // 120 seconds allowed_tools: [] as string[], reflection_enabled: false, // MCP 服务设置