@tbox.cn/app-module-customer-service 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
# module-customer-service —— 集成指引(AI 助手用)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- 服务槽清单:见 `tbox.module.json` 的 `contributes.services`(demand 侧,含 title/description meta)。
|
|
3
|
+
本模块为商圈业务模块(服务政策 FAQ 知识检索、转述作答与转人工承接)。服务槽、接口清单、接入依赖与可选降级见本包
|
|
4
|
+
`INTEGRATION.md`(真源);结构事实(槽位/必选性)见本包 `tbox.module.json`。
|
|
6
5
|
|
|
7
6
|
## 自定义 API 对接(AI 集成)
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
本模块 Port 接口为 adapter 的实现契约(输入 `ServiceAdapterInput`:config/instanceId/credentialRef)。
|
|
8
|
+
见本包 `INTEGRATION.md`(接入语义真源);实施落点与流程见应用根 `INTEGRATION.md`
|
|
9
|
+
与 `packages/provider-custom/INTEGRATION.md`。
|
|
12
10
|
|
|
13
11
|
## 真实厂商接入
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
见本包 `INTEGRATION.md`;官方 provider 包形态用 `tbox-app new provider <name>` 骨架
|
|
14
|
+
(应用态 `packages/provider-<id>` local 形态 / 仓库态 `modules/provider-<id>` 发布形态)。
|
package/INTEGRATION.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# INTEGRATION —— module-customer-service(客服问答)接入指引
|
|
2
|
+
|
|
3
|
+
> 本模块**零服务槽声明**(无 consumes/owns)——不走「自定义 API」内联声明流程;接入面 =
|
|
4
|
+
> knowledge 知识库资源绑定。本文件只写该绑定面事实。
|
|
5
|
+
|
|
6
|
+
## 接入面(知识库资源绑定)
|
|
7
|
+
|
|
8
|
+
- 声明资源:`customer-service-faq-kb`(FAQ 政策库)与 `knowledge-assistance-kb`(辅助
|
|
9
|
+
知识库)——供给写在 `config/integrations.json` 顶层 `modules.module-customer-service.resources`
|
|
10
|
+
(`{ type: 'knowledge', datasetId 或 ref, topK?, scoreThreshold? }`;ref 经同目录
|
|
11
|
+
knowledge.json 台账展开)。
|
|
12
|
+
- 缺失降级:未绑定资源 → 回退占位数据集(召回必然为空)+ warn;knowledge 客户端构造
|
|
13
|
+
失败(如平台 API Key 未配置)→ 空 FAQ。验收判据 = 政策问题命中真实知识库内容。
|
|
14
|
+
- 联系电话(contactPhone)来自 mall-directory 服务(module-mall-core 部署实例数据)——
|
|
15
|
+
非知识库面。
|
|
16
|
+
|
|
17
|
+
## 身份语义
|
|
18
|
+
|
|
19
|
+
- 客服域**无主体语义**:检索不带 userId;mallId 仅用于联系电话解析。
|
package/dist/server/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { CustomerServiceQueryPort } from '@tbox.cn/app-contracts-mall';
|
|
|
17
17
|
interface CustomerServicePorts {
|
|
18
18
|
customerService: CustomerServiceQueryPort;
|
|
19
19
|
}
|
|
20
|
-
/** mall-directory
|
|
20
|
+
/** mall-directory 服务消费接口(模板注册,deployment.malls 单一来源;模块只依赖此结构类型) */
|
|
21
21
|
interface MallDirectoryService {
|
|
22
22
|
contactPhone(mallId: string): string | undefined;
|
|
23
23
|
}
|
|
@@ -54,14 +54,14 @@ declare const serverModule: {
|
|
|
54
54
|
relevanceScore: zod.ZodNumber;
|
|
55
55
|
referenceUrl: zod.ZodOptional<zod.ZodString>;
|
|
56
56
|
}, "strip", zod.ZodTypeAny, {
|
|
57
|
-
question: string;
|
|
58
57
|
answer: string;
|
|
58
|
+
question: string;
|
|
59
59
|
relevanceScore: number;
|
|
60
60
|
category?: string | undefined;
|
|
61
61
|
referenceUrl?: string | undefined;
|
|
62
62
|
}, {
|
|
63
|
-
question: string;
|
|
64
63
|
answer: string;
|
|
64
|
+
question: string;
|
|
65
65
|
relevanceScore: number;
|
|
66
66
|
category?: string | undefined;
|
|
67
67
|
referenceUrl?: string | undefined;
|
|
@@ -71,25 +71,25 @@ declare const serverModule: {
|
|
|
71
71
|
}, "strip", zod.ZodTypeAny, {
|
|
72
72
|
query: string;
|
|
73
73
|
faqs: {
|
|
74
|
-
question: string;
|
|
75
74
|
answer: string;
|
|
75
|
+
question: string;
|
|
76
76
|
relevanceScore: number;
|
|
77
77
|
category?: string | undefined;
|
|
78
78
|
referenceUrl?: string | undefined;
|
|
79
79
|
}[];
|
|
80
|
-
contactPhone?: string | undefined;
|
|
81
80
|
noResultsReason?: string | undefined;
|
|
81
|
+
contactPhone?: string | undefined;
|
|
82
82
|
}, {
|
|
83
83
|
query: string;
|
|
84
84
|
faqs: {
|
|
85
|
-
question: string;
|
|
86
85
|
answer: string;
|
|
86
|
+
question: string;
|
|
87
87
|
relevanceScore: number;
|
|
88
88
|
category?: string | undefined;
|
|
89
89
|
referenceUrl?: string | undefined;
|
|
90
90
|
}[];
|
|
91
|
-
contactPhone?: string | undefined;
|
|
92
91
|
noResultsReason?: string | undefined;
|
|
92
|
+
contactPhone?: string | undefined;
|
|
93
93
|
}>>;
|
|
94
94
|
};
|
|
95
95
|
skills: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/app-module-customer-service",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "商圈客服承接模块:服务政策 FAQ 知识检索(命中正文作答/无结果联系客服卡)。",
|
|
6
6
|
"exports": {
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tbox.cn/app-contracts": "0.
|
|
23
|
-
"@tbox.cn/app-contracts-mall": "0.
|
|
24
|
-
"@tbox.cn/app-agent-sdk-client": "0.1.
|
|
25
|
-
"@tbox.cn/app-agent-sdk-server": "0.
|
|
22
|
+
"@tbox.cn/app-contracts": "0.13.0",
|
|
23
|
+
"@tbox.cn/app-contracts-mall": "0.13.0",
|
|
24
|
+
"@tbox.cn/app-agent-sdk-client": "0.1.6",
|
|
25
|
+
"@tbox.cn/app-agent-sdk-server": "0.2.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"zod": "3.25.76",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"tsup.config.ts",
|
|
51
51
|
"README.md",
|
|
52
52
|
"LICENSE",
|
|
53
|
-
"AGENTS.md"
|
|
53
|
+
"AGENTS.md",
|
|
54
|
+
"INTEGRATION.md"
|
|
54
55
|
],
|
|
55
56
|
"engines": {
|
|
56
57
|
"node": ">=20.0.0"
|
package/src/server/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* module-customer-service
|
|
2
|
+
* module-customer-service 服务端入口(双端自注册闭环——见模块 AGENTS.md 与 INTEGRATION.md)。
|
|
3
3
|
* - 1 卡声明(key = cardType)+ 1 工具 + FAQ silent preTool;
|
|
4
4
|
* - register 只注册不解析(resolveCustomerServicePorts 仅 execute 内调用);
|
|
5
|
-
* -
|
|
5
|
+
* - 模块级单例:工具实例顶层创建,register 幂等。
|
|
6
6
|
* 2026-08-31 客服模块拆分:自 module-shopping-guide 迁入(FAQ 工具/卡/preTool/本地知识库域)。
|
|
7
7
|
*/
|
|
8
8
|
import type {
|
|
@@ -25,7 +25,7 @@ let moduleCtx: ServerContext | undefined;
|
|
|
25
25
|
const tools = createCustomerServiceTools({ getCtx: () => moduleCtx! });
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* FAQ
|
|
28
|
+
* FAQ 静默前置工具(/):客服 FAQ 检索 = silent preTool。
|
|
29
29
|
* - silent:不发前端事件、不落 inputs.preTools,仅本轮 reminder 数据块注入;
|
|
30
30
|
* - routing always(2026-09-03 v3):每轮进 decide——词表路由的召回面追不上语言("电影院能带外食吗"
|
|
31
31
|
* 类 FAQ 价值问句词面永远缺),FAQ 检索轻量+空返无害,宁多勿漏;
|
|
@@ -17,7 +17,7 @@ export interface CustomerServicePorts {
|
|
|
17
17
|
customerService: CustomerServiceQueryPort;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
/** mall-directory
|
|
20
|
+
/** mall-directory 服务消费接口(模板注册,deployment.malls 单一来源;模块只依赖此结构类型) */
|
|
21
21
|
export interface MallDirectoryService {
|
|
22
22
|
contactPhone(mallId: string): string | undefined;
|
|
23
23
|
}
|
|
@@ -40,7 +40,7 @@ const MODULE_ID = 'module-customer-service';
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* 占位等值回退(无 app-config 服务/缺资源键时——模块单测与未装配环境不破坏,离线零行为变化)。
|
|
43
|
-
* 真实 datasetId 由 integrations.json modules 节(create --config-dir 注入)提供;哨兵常量与 smoke
|
|
43
|
+
* 真实 datasetId 由 integrations.json modules 节(create --config-dir 注入)提供;哨兵常量与 smoke 共用。
|
|
44
44
|
*/
|
|
45
45
|
const DEFAULT_FAQ_RESOURCE: ResolvedResource = { type: 'knowledge', datasetId: KNOWLEDGE_PLACEHOLDER_DATASET_IDS[0] };
|
|
46
46
|
const DEFAULT_KB_RESOURCE: ResolvedResource = { type: 'knowledge', datasetId: KNOWLEDGE_PLACEHOLDER_DATASET_IDS[1] };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 客服承接 1
|
|
2
|
+
* 客服承接 1 工具(字符串化 inputSchema——仅 string / map<string,string>)。
|
|
3
3
|
* customer-service-faq:FAQ 命中返回知识条目(作答素材——正文直接作答);无结果同样仅返回
|
|
4
4
|
* summary(正文如实说明)——客服域零出卡(2026-09-02:联系客服引导卡下线,转人工走正文话术)。
|
|
5
5
|
* 自 shopping-guide 模块迁入(2026-08-31 客服模块拆分)。
|