@wanji_dsh/dsh-sales 0.11.1 → 0.11.3

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/README.md CHANGED
@@ -109,6 +109,8 @@ See [the Chinese setup and recovery guide](README.zh.md#langfuse真实-host-知
109
109
 
110
110
  ## CRM dual-product profile tools
111
111
 
112
+ The installed plugin defaults to production CRM at `https://group.wanjivip.com/crm`; no separate CRM address setup is required. Explicit `crmBaseUrl` configuration or `WANJI_SALES_CRM_BASE_URL` can select another environment; existing overrides are preserved on upgrade. Model services and credentials remain managed by DSH.
113
+
112
114
  The Host also registers `crm_get_customer_profile` and `crm_read_profile_evidence`. Agents can build ERP procurement context from CRM facts and recordings with exact source quotations. DSH owns speech/text services and credentials; this plugin selects and calls them. Demo conversations remain fixtures; WeChat and final reply generation are separate stages. See the [CRM integration contract](docs/crm-profile-tool.md). CRM uses `crmRequestTimeoutMs` (default 120000); knowledge retrieval retains `requestTimeoutMs` (default 30000).
113
115
 
114
116
  Profile tool schemaVersion is now 2.0: separate ERP/Wanjitang profiles, channel/role evidence, per-call history and unresolved claims. Consumers must migrate to the new contract.
package/README.zh.md CHANGED
@@ -34,6 +34,10 @@ DeepSeek Harness 内的销售辅助工作台。插件在左侧菜单注册“销
34
34
 
35
35
  工作区自动选择并开启微信同步,回复区不显示技能工作区和刷新控件;支持页内暂停/重连、按任务确认初始化或重启、客户搜索、历史分页、图片/语音随可见消息自动加载、CRM显式绑定、独立草稿编辑与复制。语音显示播放器,由用户点击播放;未入库媒体显示中文同步状态,失败可重试。真实历史、草稿及已处理状态保存在私有消息库;新消息使旧Agent稿失效,人工编辑保留并提示复核。复制不会发送消息。
36
36
 
37
+ ## 日志收集
38
+
39
+ 遇到安装、登录、微信同步、知识库或上传问题时,按[销售助手日志收集](docs/diagnostics.zh.md)复现并收集对应日志。
40
+
37
41
  ## 构建与安装
38
42
 
39
43
  需要 Node.js 24.9 或更新版本。上游开发基于Harness 0.2.2-rc.1;本机额外在安装应用实际携带的0.2.2-alpha.2 SDK上验证了工具执行与路由,支持范围为 `>=0.2.2-alpha.2 <0.3.0`。
@@ -75,6 +79,22 @@ npm run build --workspace @wanji_dsh/dsh-sales
75
79
 
76
80
  为 `wanji-sales` 行设置 `config.knowledgeBaseIds`,与 WeKnora 的目标范围一致。当前测试库是代码中的唯一测试允许目标;单独指向该库时,连接设置的“独立知识库”行可打开测试页。其他库、空配置、`environment: production` 或 `knowledgeTestEnabled: false` 均关闭入口,Host 同时拒绝 `search`、`read`、`cases` 和 `evaluation`。普通连接状态检查继续可用。
77
81
 
82
+ ## 生产知识库与 Langfuse
83
+
84
+ 生产 Host 使用两个独立的检索密钥,分别从 `WANJI_SALES_WEKNORA_REPLY_API_KEY` 和 `WANJI_SALES_WEKNORA_MATERIALS_API_KEY` 读取。将生产片段合入现有 profile,避免同一工具前缀重复注册,并保留已有的 CRM 和模型设置。片段开启销售回复的过滤检索和独立素材检索,关闭知识库测试和评测。更新现有 profile 时同步替换两条 WeKnora 工具配置,保留各自的知识库范围。生产 API 基址为 `https://wanjidazi.com/sales-kb/api/v1`。[生产 profile 片段](config/production.cordis.yml)
85
+
86
+ 生产销售问答与知识库调用追踪在设置 `WANJI_SALES_PRODUCTION_LANGFUSE_CONFIG` 后开启。检索记录包含调用耗时、库 ID、脱敏查询和命中摘要。该变量指向 Host 私有 JSON 配置的绝对路径。Windows 和 macOS 均可通过 Host 私有环境变量 `WANJI_SALES_LANGFUSE_REDACTION_KEY` 提供至少 32 字符的独立随机脱敏密钥。macOS 也可使用配置内的 `redactionKeyFile`,文件权限为 0600,父目录权限为 0700。
87
+
88
+ 项目 API 凭据由 Host 的 `WANJI_SALES_LANGFUSE_PUBLIC_KEY` 和 `WANJI_SALES_LANGFUSE_SECRET_KEY` 提供,macOS 也可使用钥匙串的 `wanji-langfuse-api-production`。项目沿用迁移配置中的 ID `wanji-sales-test`,独立生产队列只投递到当前生产目标,追踪环境标记为 `production`。[生产 Langfuse 配置示例](config/langfuse.production.example.json)
89
+
90
+ 从仓库根目录执行只读检查。命令检查服务版本、项目 API 凭据及项目匹配,输出不包含密钥。
91
+
92
+ ```sh
93
+ node plugins/sales-assistant/scripts/langfuse-target.mjs check-production
94
+ ```
95
+
96
+ ## 测试页配置与行为
97
+
78
98
  可选配置:`knowledgeBaseName`(显示名)、`toolPrefix`(默认 `weknora`)、`toolVersion`(已安装检索插件的版本,当前官方版为 `0.1.0`;未提供时快照比较不可用)、`maxResults`(默认 8,最大 8)、`requestTimeoutMs`(默认 30000,最大 120000)。`expectedDocuments` 将八个用例的稳定来源 key 映射到本次导入的文档 ID;未配置时用例只记录结果,不计算命中率。ID 映射从部署导入回执取得,不靠模型判断标题。
79
99
 
80
100
  测试页支持真实连接检查、查询、原文分页、相关性评价、顺序执行八个用例和 JSON 导出。排名按返回片段首次出现的 `knowledge_id` 去重;首篇与前三篇命中率只计已配置预期来源的用例,请求失败计未命中。分数是工具原始排序分数。原文文本按普通文本显示;不执行文档中的 HTML 或指令。
@@ -155,7 +175,7 @@ langfuseConfigFile: /Users/imac/.config/wanji-sales/langfuse.json
155
175
  node plugins/sales-assistant/scripts/langfuse-target.mjs check
156
176
  ```
157
177
 
158
- 未来切线上时,在共享 JSON 中补全 `targets.remote` 的 HTTPS 地址、项目 ID、独立 `wanji-langfuse-api-remote` 引用,并在本机钥匙串创建对应条目。线上需兼容已验证的 Langfuse v4 API。先等正在运行的知识库批次结束,再执行:
178
+ 为测试评测使用独立的远程 Langfuse 时,在共享 JSON 中补全 `targets.remote` 的 HTTPS 地址、项目 ID、独立 `wanji-langfuse-api-remote` 引用,并在本机钥匙串创建对应条目。线上需兼容已验证的 Langfuse v4 API。先等正在运行的知识库批次结束,再执行:
159
179
 
160
180
  ```sh
161
181
  node plugins/sales-assistant/scripts/langfuse-target.mjs switch remote
@@ -169,10 +189,12 @@ Langfuse 专用队列在 `~/.local/state/wanji-sales/langfuse/`,每个事件
169
189
 
170
190
  原离线脚本 `scripts/langfuse-evaluate.py` 现在通过同一解析器读取活动目标和 Keychain,切换配置后直接使用新目标;它仍是独立离线实验入口。真实业务验收使用桌面销售助手的“知识库测试”,批次名为 `harness-tool-<WeKnora 批次 ID>`。私有解析命令 `resolve` 仅供脚本进程间调用,输出含凭据,不要在终端手动运行或记录其输出。API 密钥不写入插件、文档或网页静态资源。本机登录页默认填充由本机专用端点提供,密码文件不进入 Git,见[本地登录说明](docs/langfuse-local.md#访问与登录)。
171
191
 
172
- 2026-11-13 本机验收:固定 v4 题集的真实 Host 批次完成 20/20,Langfuse 收到 20 个实验条目与 160 个评分,逐题核对原始片段和权威指标一致,队列清零。辅助标注仍待业务人工确认。线上地址尚未配置;切换、断线补传和错误项目保护使用隔离 HTTP 接收器验证。
192
+ 2026-11-13 本机验收:固定 v4 题集的真实 Host 批次完成 20/20,Langfuse 收到 20 个实验条目与 160 个评分,逐题核对原始片段和权威指标一致,队列清零。辅助标注仍待业务人工确认。当时的切换、断线补传和错误项目保护使用隔离 HTTP 接收器验证。
173
193
 
174
194
  ## CRM 双产品客户画像工具
175
195
 
196
+ 安装插件即默认连接生产 CRM(`https://group.wanjivip.com/crm`),无需额外配置 CRM 地址。需要测试环境时可显式设置 `crmBaseUrl` 或 `WANJI_SALES_CRM_BASE_URL`;升级保留已有覆盖配置。语音和文本模型服务仍由 DSH 统一管理。
197
+
176
198
  Host 另行注册 `crm_get_customer_profile` 与 `crm_read_profile_evidence`,供 Agent 根据 CRM 基本资料和录音生成带原文证据的双产品采购画像。语音和文本服务统一由 DSH 管理,本插件只选择并调用服务。早期演示页使用模拟商家和真实Flash生成;当前会话主界面使用本机微信真实历史。
177
199
 
178
200
  完整参数、结果与配置见 [CRM 工具对接文档](docs/crm-profile-tool.zh.md)。CRM 的下载/转写时限使用 `crmRequestTimeoutMs`(默认 120000);知识检索继续使用原有 `requestTimeoutMs`(默认 30000),两者独立。
@@ -0,0 +1,11 @@
1
+ {
2
+ "enabled": true,
3
+ "activeTarget": "production",
4
+ "targets": {
5
+ "production": {
6
+ "baseUrl": "https://wanjidazi.com/langfuse",
7
+ "projectId": "wanji-sales-test",
8
+ "credentialsRef": "wanji-langfuse-api-production"
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,36 @@
1
+ # Merge into the production profile. Keep only one row per tool prefix.
2
+ - insert:
3
+ - id: weknora
4
+ name: '@wxg-prc-cpg/dsh-weknora'
5
+ config:
6
+ baseUrl: https://wanjidazi.com/sales-kb/api/v1
7
+ apiKey: !!js process.env.WANJI_SALES_WEKNORA_REPLY_API_KEY
8
+ tenantId: '10000'
9
+ knowledgeBaseIds: [3e6f197b-30a5-41bb-8c2b-228e47026762]
10
+ toolPrefix: weknora
11
+ tools: { listKnowledgeBases: true, search: true, readDocument: true, ask: false, evaluation: false }
12
+ - id: weknora-materials
13
+ name: '@wxg-prc-cpg/dsh-weknora'
14
+ config:
15
+ baseUrl: https://wanjidazi.com/sales-kb/api/v1
16
+ apiKey: !!js process.env.WANJI_SALES_WEKNORA_MATERIALS_API_KEY
17
+ tenantId: '10000'
18
+ knowledgeBaseIds: [1f93aee2-6d66-42d7-8b7a-b5fe5d094550]
19
+ toolPrefix: weknora_materials
20
+ tools: { listKnowledgeBases: true, search: true, readDocument: true, ask: false, evaluation: false }
21
+ - id: wanji-sales
22
+ config:
23
+ environment: production
24
+ knowledgeTestEnabled: false
25
+ draftKnowledgeEnabled: true
26
+ agentKnowledgeTracing: !!js Boolean(process.env.WANJI_SALES_PRODUCTION_LANGFUSE_CONFIG)
27
+ knowledgeBaseIds: [3e6f197b-30a5-41bb-8c2b-228e47026762]
28
+ toolPrefix: weknora
29
+ materialRetrievalEnabled: true
30
+ materialKnowledgeBaseIds: [1f93aee2-6d66-42d7-8b7a-b5fe5d094550]
31
+ materialToolPrefix: weknora_materials
32
+ materialKnowledgeBaseId: 1f93aee2-6d66-42d7-8b7a-b5fe5d094550
33
+ materialAssetBaseUrl: https://im-wanji.oss-cn-shanghai.aliyuncs.com/wanji_dazi/knowledge-assets/production/materials/
34
+ materialMetadata: !!js "process.env.WANJI_SALES_WEKNORA_MATERIALS_API_KEY ? { apiKey: process.env.WANJI_SALES_WEKNORA_MATERIALS_API_KEY, tenantId: '10000' } : undefined"
35
+ salesQuestionTracing: !!js Boolean(process.env.WANJI_SALES_PRODUCTION_LANGFUSE_CONFIG)
36
+ langfuseConfigFile: !!js process.env.WANJI_SALES_PRODUCTION_LANGFUSE_CONFIG
package/dist/client.js CHANGED
@@ -7456,9 +7456,16 @@ function CompanyIdentityPanel({ rpc, t, disabled }) {
7456
7456
  const res = await rpc.call("/api", COMPANY_IDENTITY_ENDPOINT, payload, controller.signal);
7457
7457
  if (controller.signal.aborted) return;
7458
7458
  if (!res.ok || !res.value || typeof res.value !== "object" || !("status" in res.value)) throw Error("company identity unavailable");
7459
- setView(res.value);
7459
+ const identity = res.value;
7460
+ setView(identity);
7460
7461
  setFailed(false);
7461
7462
  if (payload.operation === "bind") {
7463
+ if (identity.status === "awaiting" && !identity.verificationCode) {
7464
+ try {
7465
+ window.open(identity.authorizeUrl, "_blank", "noopener,noreferrer");
7466
+ } catch {
7467
+ }
7468
+ }
7462
7469
  setAlias("");
7463
7470
  setPhone("");
7464
7471
  }
@@ -9952,15 +9959,15 @@ var zh = {
9952
9959
  companyModelUnavailable: "\u8EAB\u4EFD\u5DF2\u9A8C\u8BC1\uFF0C\u516C\u53F8\u6A21\u578B\u901A\u9053\u6682\u4E0D\u53EF\u7528",
9953
9960
  companyUnbind: "\u89E3\u9664\u7ED1\u5B9A",
9954
9961
  companyCancel: "\u53D6\u6D88\u7ED1\u5B9A",
9955
- companyAwaiting: "\u6253\u5F00\u9A8C\u8BC1\u9875\u9762\uFF0C\u6309\u63D0\u793A\u5B8C\u6210\u9489\u9489\u672C\u4EBA\u9A8C\u8BC1\u3002",
9962
+ companyAwaiting: "\u8BF7\u5728\u6D4F\u89C8\u5668\u5B8C\u6210\u9489\u9489\u6388\u6743\uFF0C\u7ED1\u5B9A\u72B6\u6001\u4F1A\u81EA\u52A8\u66F4\u65B0\u3002",
9956
9963
  companyPairingCode: "\u914D\u5BF9\u7801",
9957
- companyVerify: "\u6253\u5F00\u9489\u9489\u9A8C\u8BC1",
9964
+ companyVerify: "\u6253\u5F00\u9489\u9489\u767B\u5F55",
9958
9965
  companyHint: "\u4E07\u673A\u4F01\u4E1A\u6210\u5458\u7ED1\u5B9A\u672C\u4EBA\u7684\u9489\u9489\u8D26\u53F7\u540E\uFF0C\u5373\u53EF\u4F7F\u7528\u516C\u53F8\u6A21\u578B\u3002",
9959
9966
  companyIneligible: "\u672A\u80FD\u9A8C\u8BC1\u5F53\u524D\u8D26\u53F7\u7684\u4E07\u673A\u4F01\u4E1A\u6210\u5458\u8EAB\u4EFD\u3002",
9960
9967
  companyAliasOptional: "\u82B1\u540D\uFF08\u9009\u586B\uFF09",
9961
9968
  companyPhoneOptional: "\u624B\u673A\u53F7\uFF08\u9009\u586B\uFF09",
9962
- companyContinue: "\u53D1\u8D77\u9489\u9489\u9A8C\u8BC1",
9963
- companyBindingFailed: "\u5C1A\u672A\u53D6\u5F97\u914D\u5BF9\u7801\u3002\u8BF7\u68C0\u67E5\u516C\u53F8\u7ED1\u5B9A\u670D\u52A1\u540E\u91CD\u8BD5\u3002",
9969
+ companyContinue: "\u4F7F\u7528\u9489\u9489\u767B\u5F55",
9970
+ companyBindingFailed: "\u672A\u80FD\u53D1\u8D77\u9489\u9489\u767B\u5F55\uFF0C\u8BF7\u91CD\u8BD5\u3002",
9964
9971
  companyRetryHint: "\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u516C\u53F8\u8EAB\u4EFD\uFF0C\u8BF7\u91CD\u8BD5\u3002",
9965
9972
  companyChecking: "\u6B63\u5728\u68C0\u67E5\u516C\u53F8\u8EAB\u4EFD\u2026",
9966
9973
  companyUnavailable: "\u516C\u53F8\u8EAB\u4EFD\u670D\u52A1\u5C1A\u672A\u63A5\u5165\u3002",
@@ -10281,15 +10288,15 @@ var en = {
10281
10288
  companyModelUnavailable: "Identity verified. The company model is temporarily unavailable.",
10282
10289
  companyUnbind: "Unlink account",
10283
10290
  companyCancel: "Cancel linking",
10284
- companyAwaiting: "Open the verification page and follow the DingTalk instructions.",
10291
+ companyAwaiting: "Authorize in DingTalk. Your company identity will update automatically.",
10285
10292
  companyPairingCode: "Pairing code",
10286
- companyVerify: "Open DingTalk verification",
10293
+ companyVerify: "Open DingTalk sign-in",
10287
10294
  companyHint: "Wanji employees can link their own DingTalk account to use the company model.",
10288
10295
  companyIneligible: "We could not verify this account\u2019s Wanji membership.",
10289
10296
  companyAliasOptional: "Display name (optional)",
10290
10297
  companyPhoneOptional: "Mobile number (optional)",
10291
- companyContinue: "Start DingTalk verification",
10292
- companyBindingFailed: "The company service did not issue a pairing code. Please try again.",
10298
+ companyContinue: "Sign in with DingTalk",
10299
+ companyBindingFailed: "DingTalk sign-in could not start. Try again.",
10293
10300
  companyRetryHint: "Company identity could not be verified. Try again.",
10294
10301
  companyChecking: "Checking company identity\u2026",
10295
10302
  companyUnavailable: "The company identity service is not connected.",