diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index f7913e47..e445e1c6 100644 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -1332,8 +1332,9 @@ export default { }, allowedTools: { label: 'Allowed Tools', - desc: 'Select tools the Agent can use (at least one)', - placeholder: 'Select tools...' + desc: 'Tools currently enabled for the Agent', + placeholder: 'Select tools...', + empty: 'No tools configured' }, systemPrompt: { label: 'System Prompt', diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index 4cb6eee8..a5b39c38 100644 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -1196,8 +1196,9 @@ export default { }, allowedTools: { label: 'Разрешённые инструменты', - desc: 'Выберите инструменты, которые может использовать Agent (минимум один)', - placeholder: 'Выберите инструменты...' + desc: 'Список инструментов, доступных Agent', + placeholder: 'Выберите инструменты...', + empty: 'Инструменты не настроены' }, systemPrompt: { label: 'Системный промпт', diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 0637ee7c..305a3880 100644 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -1336,8 +1336,9 @@ export default { }, allowedTools: { label: "允许的工具", - desc: "选择 Agent 可以使用的工具,至少选择一个", + desc: "当前 Agent 可使用的工具列表", placeholder: "请选择工具...", + empty: "尚未配置任何工具", }, systemPrompt: { label: "系统 Prompt", diff --git a/frontend/src/views/settings/AgentSettings.vue b/frontend/src/views/settings/AgentSettings.vue index 8e0e1a53..eb3ed24f 100644 --- a/frontend/src/views/settings/AgentSettings.vue +++ b/frontend/src/views/settings/AgentSettings.vue @@ -88,29 +88,30 @@ -
+

{{ $t('agentSettings.allowedTools.desc') }}

-
- - +
+
- {{ tool.label }} - - + {{ tool.label }} + + {{ tool.description }} + +
+
+

+ {{ $t('agentSettings.allowedTools.empty') }} +

@@ -161,7 +162,6 @@
@@ -838,6 +838,16 @@ const loadingModels = ref(false) const availableTools = ref([]) // 可用占位符列表 const availablePlaceholders = ref([]) +const displayAllowedTools = computed(() => { + return localAllowedTools.value.map(name => { + const detail = availableTools.value.find(tool => tool.name === name) + return { + name, + label: detail?.label || name, + description: detail?.description || '' + } + }) +}) // 配置加载状态 const loadingConfig = ref(false) @@ -1269,24 +1279,6 @@ const handleTemperatureChange = async (value: number) => { } } -// 处理允许工具变化 -const handleAllowedToolsChange = async (value: string[]) => { - // 如果正在初始化,不触发保存 - if (isInitializing.value) return - - try { - const config = buildAgentConfigPayload({ allowed_tools: value }) - await updateAgentConfig(config) - settingsStore.updateAgentConfig({ allowedTools: value }) - MessagePlugin.success(t('agentSettings.toasts.toolsUpdated')) - } catch (error) { - console.error('保存工具配置失败:', error) - MessagePlugin.error(getErrorMessage(error)) - // 回滚 - localAllowedTools.value = settingsStore.agentConfig.allowedTools - } -} - // 切换是否启用自定义 Prompt const handleUseCustomPromptToggle = async (value: boolean) => { if (isInitializing.value) return @@ -2220,27 +2212,43 @@ const handleConversationRerankModelChange = async (value: string) => { width: 100%; } -.system-prompt-variant-tabs :deep(.t-tabs__nav-wrap) { - border-bottom: 1px solid #e5e7eb; - margin-bottom: 8px; +.allowed-tools-display { + width: 100%; } -.system-prompt-variant-tabs :deep(.t-tabs__nav-item) { - padding: 4px 12px 10px; +.allowed-tool-list { + display: flex; + flex-wrap: wrap; + gap: 12px; +} + +.allowed-tool-chip { + background: #f5f7fa; + border: 1px solid #e5e7eb; + border-radius: 8px; + padding: 10px 12px; + min-width: 180px; + display: flex; + flex-direction: column; + gap: 4px; +} + +.allowed-tool-label { font-size: 13px; - color: #666; - border-bottom: 2px solid transparent; - transition: color 0.2s ease, border-color 0.2s ease; -} - -.system-prompt-variant-tabs :deep(.t-tabs__nav-item.t-is-active) { - color: #1d2129; - border-bottom-color: #07C05F; font-weight: 600; + color: #1d2129; } -.system-prompt-variant-tabs :deep(.t-tabs__bar) { - display: none; +.allowed-tool-desc { + font-size: 12px; + color: #666; + line-height: 1.4; +} + +.allowed-tools-empty { + margin: 0; + font-size: 12px; + color: #999; } .prompt-textarea-readonly {