From 015b57bfe78b730ae3c9a9810ec6c030921d166c Mon Sep 17 00:00:00 2001 From: mlogclub Date: Fri, 26 Jun 2026 18:27:54 +0800 Subject: [PATCH] refactor: update AIAgent handoff and fallback modes terminology for clarity --- internal/models/models.go | 6 ++-- internal/pkg/enums/im.go | 6 ++-- internal/pkg/i18nx/locales/zh-CN.yml | 4 +-- .../config-workbench-copy.test.mjs | 21 ++++++++++++ .../_components/config-workbench.tsx | 16 +++++----- web/lib/generated/enums.ts | 6 ++-- web/messages/zh-CN.json | 32 +++++++++---------- 7 files changed, 56 insertions(+), 35 deletions(-) create mode 100644 web/app/dashboard/ai-agents/_components/config-workbench-copy.test.mjs diff --git a/internal/models/models.go b/internal/models/models.go index 3051186..30dbb85 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -518,9 +518,9 @@ type AIAgent struct { WelcomeMessage string `gorm:"type:text"` // WelcomeMessage 为该 Agent 的欢迎语或首响模板。 ReplyTimeoutSeconds int `gorm:"type:int;not null;default:180"` // ReplyTimeoutSeconds 为异步自动回复超时秒数。 TeamIDs string `gorm:"type:varchar(500);not null;default:''"` // TeamIDs 为转人工时可路由的客服组ID列表,多个之间使用逗号分隔。 - HandoffMode enums.AIAgentHandoffMode `gorm:"type:int;not null;default:1"` // HandoffMode 为转人工模式,如进入待接入池、进入默认客服组待接入池。 - FallbackMode enums.AIAgentFallbackMode `gorm:"type:int;not null;default:1"` // FallbackMode 为知识库未命中时的兜底策略。 - FallbackMessage string `gorm:"type:text"` // FallbackMessage 为兜底回复文案。 + HandoffMode enums.AIAgentHandoffMode `gorm:"type:int;not null;default:1"` // HandoffMode 为转人工执行方式,如进入待接入池、进入默认客服组待接入池。 + FallbackMode enums.AIAgentFallbackMode `gorm:"type:int;not null;default:1"` // FallbackMode 为知识不足时的回复策略。 + FallbackMessage string `gorm:"type:text"` // FallbackMessage 为知识不足回复文案。 KnowledgeIDs string `gorm:"type:varchar(500);not null;default:''"` // KnowledgeIDs 为绑定的知识库ID列表,按顺序表示优先级。 SkillIDs string `gorm:"type:varchar(500);not null;default:''"` // SkillIDs 为绑定的技能ID列表,按顺序表示允许路由的范围。 AllowedMCPTools string `gorm:"type:text"` // AllowedMCPTools 为允许 direct tool 路由的 MCP 工具白名单配置JSON。 diff --git a/internal/pkg/enums/im.go b/internal/pkg/enums/im.go index 4b7b8ad..8d2b427 100644 --- a/internal/pkg/enums/im.go +++ b/internal/pkg/enums/im.go @@ -208,7 +208,7 @@ var AIAgentHandoffModeValues = []AIAgentHandoffMode{ var aiAgentHandoffModeLabelMap = map[AIAgentHandoffMode]string{ AIAgentHandoffModeWaitPool: "进入待接入池", AIAgentHandoffModeDefaultTeamPool: "进入默认客服组待接入池", - AIAgentHandoffModeAIHoldAndNotify: "AI托底并提醒人工", + AIAgentHandoffModeAIHoldAndNotify: "AI继续接待并提醒人工", } func GetAIAgentHandoffModeLabel(mode AIAgentHandoffMode) string { @@ -228,8 +228,8 @@ var AIAgentFallbackModeValues = []AIAgentFallbackMode{ } var aiAgentFallbackModeLabelMap = map[AIAgentFallbackMode]string{ - AIAgentFallbackModeNoAnswer: "直接声明无答案", - AIAgentFallbackModeSuggestRetry: "建议补充信息", + AIAgentFallbackModeNoAnswer: "直接说明知识不足", + AIAgentFallbackModeSuggestRetry: "引导用户补充信息", } func GetAIAgentFallbackModeLabel(mode AIAgentFallbackMode) string { diff --git a/internal/pkg/i18nx/locales/zh-CN.yml b/internal/pkg/i18nx/locales/zh-CN.yml index 5174b8d..f4d3cc2 100644 --- a/internal/pkg/i18nx/locales/zh-CN.yml +++ b/internal/pkg/i18nx/locales/zh-CN.yml @@ -119,7 +119,7 @@ error.e0119: "会话已关闭" error.e0120: "会话未分配客服,暂不允许发送消息" error.e0121: "会话筛选项不合法" error.e0122: "供应商不能为空" -error.e0123: "兜底策略不合法" +error.e0123: "知识不足回复策略不合法" error.e0124: "公司不存在" error.e0125: "公司名称不能为空" error.e0126: "公司名称已存在" @@ -332,7 +332,7 @@ error.e0332: "请选择要移动的FAQ" error.e0333: "请选择要移动的文档" error.e0334: "负责人不存在" error.path.invalid: "路径参数错误" -error.e0336: "转人工模式不合法" +error.e0336: "转人工执行方式不合法" error.e0337: "通知不存在" error.e0338: "邮箱已存在" error.e0339: "配置名称不能为空" diff --git a/web/app/dashboard/ai-agents/_components/config-workbench-copy.test.mjs b/web/app/dashboard/ai-agents/_components/config-workbench-copy.test.mjs new file mode 100644 index 0000000..e068caf --- /dev/null +++ b/web/app/dashboard/ai-agents/_components/config-workbench-copy.test.mjs @@ -0,0 +1,21 @@ +import assert from "node:assert/strict" +import test from "node:test" +import { readFile } from "node:fs/promises" + +const configWorkbenchSource = await readFile(new URL("./config-workbench.tsx", import.meta.url), "utf8") +const zhMessagesSource = await readFile(new URL("../../../../messages/zh-CN.json", import.meta.url), "utf8") + +test("AI Agent workflow-era policy copy separates handoff execution from knowledge fallback", () => { + const combinedSource = `${configWorkbenchSource}\n${zhMessagesSource}` + + assert.match(combinedSource, /转人工执行方式/) + assert.match(combinedSource, /知识不足回复策略/) + assert.match(combinedSource, /知识不足回复文案/) + assert.match(combinedSource, /AI继续接待并提醒人工/) + assert.match(combinedSource, /直接说明知识不足/) + assert.match(combinedSource, /引导用户补充信息/) + + assert.doesNotMatch(configWorkbenchSource, /转人工模式/) + assert.doesNotMatch(configWorkbenchSource, /兜底策略/) + assert.doesNotMatch(configWorkbenchSource, /兜底文案/) +}) diff --git a/web/app/dashboard/ai-agents/_components/config-workbench.tsx b/web/app/dashboard/ai-agents/_components/config-workbench.tsx index decfab0..9337539 100644 --- a/web/app/dashboard/ai-agents/_components/config-workbench.tsx +++ b/web/app/dashboard/ai-agents/_components/config-workbench.tsx @@ -278,14 +278,14 @@ export function AIAgentConfigWorkbench({ () => [ { value: String(AIAgentHandoffMode.WaitPool), label: "进入待接入池" }, { value: String(AIAgentHandoffMode.DefaultTeamPool), label: "进入默认客服组待接入池" }, - { value: String(AIAgentHandoffMode.AIHoldAndNotify), label: "AI托底并提醒人工" }, + { value: String(AIAgentHandoffMode.AIHoldAndNotify), label: "AI继续接待并提醒人工" }, ], [] ) const fallbackModeOptions = useMemo( () => [ - { value: String(AIAgentFallbackMode.NoAnswer), label: "直接声明无答案" }, - { value: String(AIAgentFallbackMode.SuggestRetry), label: "建议补充信息" }, + { value: String(AIAgentFallbackMode.NoAnswer), label: "直接说明知识不足" }, + { value: String(AIAgentFallbackMode.SuggestRetry), label: "引导用户补充信息" }, ], [] ) @@ -652,11 +652,11 @@ export function AIAgentConfigWorkbench({ {activeSection === "basic" ? (
- - + + - - + +
setSelectedTeamIds((current) => current.filter((item) => item !== id))} /> - +