From 6bc19ab08271dfb9a614c7b12cc44e75ab275ce1 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Sun, 28 Dec 2025 21:46:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=9F=E4=B8=80=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=8D=E5=B9=B6=E4=BC=98=E5=8C=96=E6=99=BA?= =?UTF-8?q?=E8=83=BD=E4=BD=93=E9=80=89=E6=8B=A9=E5=99=A8=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将系统提示词从分离的网络搜索开/关状态合并为统一提示词,使用 {{web_search_status}} 占位符动态控制行为 - 重构智能体选择器,从简单tooltip升级为内容丰富的popup,显示智能体详细信息、类型和能力 - 新增FAQ优先策略配置,支持FAQ答案优先于普通文档 - 优化知识库选择逻辑,智能体切换时自动同步配置的知识库 - 更新相关接口类型定义和国际化文本 --- frontend/src/api/agent/index.ts | 3 +- frontend/src/api/system/index.ts | 3 +- frontend/src/components/AgentSelector.vue | 210 +++++-- frontend/src/components/Input-field.vue | 60 +- frontend/src/i18n/locales/en-US.ts | 43 +- frontend/src/i18n/locales/zh-CN.ts | 43 +- frontend/src/stores/settings.ts | 12 +- frontend/src/views/agent/AgentEditorModal.vue | 519 ++++++++++++------ frontend/src/views/settings/AgentSettings.vue | 132 ++--- internal/agent/prompts.go | 137 ++--- internal/application/service/agent_service.go | 2 +- .../service/chat_pipline/into_chat_message.go | 71 ++- .../service/chat_pipline/rerank.go | 16 + internal/application/service/session.go | 130 ++--- internal/handler/session/qa.go | 2 + internal/handler/tenant.go | 79 ++- internal/models/chat/remote_api.go | 4 - internal/types/agent.go | 37 +- internal/types/chat_manage.go | 9 + internal/types/custom_agent.go | 293 +++++++++- internal/types/interfaces/session.go | 2 + 21 files changed, 1198 insertions(+), 609 deletions(-) diff --git a/frontend/src/api/agent/index.ts b/frontend/src/api/agent/index.ts index 927daa63..71254f59 100644 --- a/frontend/src/api/agent/index.ts +++ b/frontend/src/api/agent/index.ts @@ -4,8 +4,7 @@ import { get, post, put, del } from "../../utils/request"; export interface CustomAgentConfig { // ===== 基础设置 ===== agent_mode?: 'quick-answer' | 'smart-reasoning'; // 运行模式:quick-answer=RAG模式, smart-reasoning=ReAct Agent模式 - system_prompt?: string; // 系统提示词(普通模式,或Agent模式网络搜索关闭时) - system_prompt_web_enabled?: string; // Agent模式网络搜索开启时的系统提示词 + system_prompt?: string; // 统一系统提示词(使用 {{web_search_status}} 占位符动态控制行为) context_template?: string; // 上下文模板(普通模式) // ===== 模型设置 ===== diff --git a/frontend/src/api/system/index.ts b/frontend/src/api/system/index.ts index 934cc8f5..9063b6f6 100644 --- a/frontend/src/api/system/index.ts +++ b/frontend/src/api/system/index.ts @@ -29,8 +29,7 @@ export interface AgentConfig { allowed_tools: string[] temperature: number knowledge_bases?: string[] - system_prompt_web_enabled?: string // Custom system prompt when web search is enabled - system_prompt_web_disabled?: string // Custom system prompt when web search is disabled + system_prompt?: string // Unified system prompt (uses {{web_search_status}} placeholder) available_tools?: ToolDefinition[] // GET 响应中包含,POST/PUT 不需要 available_placeholders?: PlaceholderDefinition[] // GET 响应中包含,POST/PUT 不需要 } diff --git a/frontend/src/components/AgentSelector.vue b/frontend/src/components/AgentSelector.vue index 701da0ae..17629a94 100644 --- a/frontend/src/components/AgentSelector.vue +++ b/frontend/src/components/AgentSelector.vue @@ -20,12 +20,13 @@
{{ $t('agent.builtinAgents') }}
-
-
+ +
{{ $t('agent.customAgents') }}
-
-
+ +
@@ -94,7 +150,7 @@