From f30720f99bbdff05e286fb7f0cfa2f20647ff52d Mon Sep 17 00:00:00 2001 From: wizardchen Date: Fri, 7 Nov 2025 16:40:53 +0800 Subject: [PATCH] feat: Enhance agent settings navigation and error handling in UI components - Introduced a new method to handle navigation to agent settings, improving code organization and reusability. - Updated tooltip content in the agent mode button to include a link for quick access to agent settings. - Enhanced error handling in the KnowledgeBase component to provide actionable links for VLM configuration errors. - Added initial section handling in the KnowledgeBaseEditorModal for improved user experience during knowledge base editing. --- frontend/src/components/Input-field.vue | 35 ++++++++++++---- frontend/src/components/ModelEditorDialog.vue | 22 +++++----- frontend/src/components/UserMenu.vue | 4 -- frontend/src/components/menu.vue | 33 ++++++++++++++- frontend/src/stores/ui.ts | 10 ++++- .../initialization/InitializationContent.vue | 2 +- .../src/views/knowledge/KnowledgeBase.vue | 20 ++++++++++ .../knowledge/KnowledgeBaseEditorModal.vue | 9 +++++ frontend/src/views/settings/AgentSettings.vue | 40 +++++++++---------- internal/application/service/agent_service.go | 6 ++- 10 files changed, 133 insertions(+), 48 deletions(-) diff --git a/frontend/src/components/Input-field.vue b/frontend/src/components/Input-field.vue index 665bfbbf..609fab72 100644 --- a/frontend/src/components/Input-field.vue +++ b/frontend/src/components/Input-field.vue @@ -100,6 +100,15 @@ const onKeydown = (val: string, event: { e: { preventDefault(): unknown; keyCode } } +const handleGoToAgentSettings = () => { + // 使用 uiStore 打开设置并跳转到 agent 部分 + uiStore.openSettings('agent'); + // 如果当前不在设置页面,导航到设置页面 + if (route.path !== '/platform/settings') { + router.push('/platform/settings'); + } +} + const toggleAgentMode = () => { // 如果要启用 Agent,先检查是否就绪 // 注意:isAgentReady 是从 store 中计算的,需要确保 store 中的配置是最新的 @@ -114,12 +123,7 @@ const toggleAgentMode = () => { href: '#', onClick: (e: Event) => { e.preventDefault(); - // 使用 uiStore 打开设置并跳转到 agent 部分 - uiStore.openSettings('agent'); - // 如果当前不在设置页面,导航到设置页面 - if (route.path !== '/platform/settings') { - router.push('/platform/settings'); - } + handleGoToAgentSettings(); }, style: 'color: #07C05F; text-decoration: none; font-weight: 500; cursor: pointer; white-space: nowrap; flex-shrink: 0;', onMouseenter: (e: Event) => { @@ -169,9 +173,26 @@ onBeforeRouteUpdate((to, from, next) => {
+
@@ -642,14 +642,14 @@ watch(() => formData.value.modelName, async (newValue, oldValue) => { // 处理下载逻辑 if (newValue.startsWith('__download__')) { - // 提取模型名称 - const modelName = newValue.replace('__download__', '') - - // 重置选择(避免显示 __download__ 前缀) - formData.value.modelName = '' - - // 开始下载 - await startDownload(modelName) + // 提取模型名称 + const modelName = newValue.replace('__download__', '') + + // 重置选择(避免显示 __download__ 前缀) + formData.value.modelName = '' + + // 开始下载 + await startDownload(modelName) return } diff --git a/frontend/src/components/UserMenu.vue b/frontend/src/components/UserMenu.vue index 5020c88b..17069c52 100644 --- a/frontend/src/components/UserMenu.vue +++ b/frontend/src/components/UserMenu.vue @@ -24,10 +24,6 @@ Ollama
-