feat: Add LLM call timeout configuration to agent frontend

- 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)
This commit is contained in:
wizardchen
2026-04-28 17:21:17 +08:00
committed by lyingbug
parent 29a65cc250
commit b1fc0e18d9
4 changed files with 34 additions and 0 deletions
+2
View File
@@ -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
+6
View File
@@ -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',
+6
View File
@@ -3662,6 +3662,12 @@ export default {
selectDesc: "选择要启用的 MCP 服务",
selectPlaceholder: "选择 MCP 服务",
},
llmCallTimeout: {
label: "LLM 调用超时",
desc: "单次 LLM 调用的最大等待时间(秒),超过此时间后调用将被中止",
hint: "0 表示无限等待(不推荐)",
placeholder: "输入秒数,建议范围 60-600",
},
imageUpload: {
navLabel: "多模态",
sectionTitle: "多模态配置",
@@ -748,6 +748,25 @@
</div>
</div>
<!-- LLM 调用超时时间 -->
<div class="setting-row">
<div class="setting-info">
<label>{{ $t('agentEditor.llmCallTimeout.label') }}</label>
<p class="desc">{{ $t('agentEditor.llmCallTimeout.desc') }}</p>
<p class="desc-hint">{{ $t('agentEditor.llmCallTimeout.hint') }}</p>
</div>
<div class="setting-control">
<t-input-number
v-model="formData.config.llm_call_timeout"
:min="0"
:max="600"
theme="column"
:placeholder="$t('agentEditor.llmCallTimeout.placeholder')"
clearable
/>
</div>
</div>
<!-- MCP 服务选择 -->
<div class="setting-row">
<div class="setting-info">
@@ -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 服务设置