feat: port quality, escalation, KB version, site-map KB, experiments and metrics
This commit is contained in:
+35
-3
@@ -191,7 +191,7 @@ docker exec crmnew-postgres psql -U crmnew -d bridge -tAc \
|
||||
预期:
|
||||
|
||||
```
|
||||
367 | 296 | 71
|
||||
594 | 523 | 71
|
||||
```
|
||||
|
||||
然后把测试环境 `.env` 的 `RAG_PG_URL` 指向该库,例如:
|
||||
@@ -233,12 +233,19 @@ node scripts/sync-kb-online.js --local-only --force
|
||||
- 需要 `RAG_PG_URL` 指向目标库
|
||||
- 需要 `EMB_*`(DashScope embedding)
|
||||
- 旧的 `kb_docs` 会备份为 `kb_docs_v<timestamp>`
|
||||
- `bridge/kb/11-site-map.md` 目前是静态类目地图,不随官网自动更新
|
||||
- `bridge/kb/11-site-map.md` 可用 `node scripts/build-site-kb.js` 从官网 sitemap 重新生成,再重建索引
|
||||
|
||||
#### 全量商品页站点地图
|
||||
#### 全量商品页站点地图 / KB 类目页
|
||||
|
||||
```bash
|
||||
# 商品页 URL 落库
|
||||
node scripts/build-site-map.js www us
|
||||
|
||||
# 生成 kb/11-site-map.md(类目 Q/A)
|
||||
node scripts/build-site-kb.js
|
||||
|
||||
# 重建索引(本地模式)
|
||||
node scripts/sync-kb-online.js --local-only --force
|
||||
```
|
||||
|
||||
### 6.4 RPC 隧道(仅本地开发)
|
||||
@@ -359,6 +366,31 @@ node scripts/quality-alert.js 1 --dry-run
|
||||
|
||||
---
|
||||
|
||||
### 7.7 质量/观测
|
||||
|
||||
```bash
|
||||
# Prometheus 指标
|
||||
curl -s http://127.0.0.1:4100/metrics | head
|
||||
|
||||
# RAG 检索评测
|
||||
RAG_PG_URL=postgres://...@127.0.0.1:5440/bridge node scripts/eval-retrieval.js
|
||||
|
||||
# KB 备份列表 / 回滚
|
||||
RAG_PG_URL=postgres://...@127.0.0.1:5440/bridge node scripts/kb-version.js list
|
||||
RAG_PG_URL=postgres://...@127.0.0.1:5440/bridge node scripts/kb-version.js rollback kb_docs_v...
|
||||
```
|
||||
|
||||
质量相关已补齐:
|
||||
|
||||
- Citation Checker + hallucination flag
|
||||
- `flywheel_samples` 失败样本(LLM 预标注)
|
||||
- RAG reranker
|
||||
- 三级升级 + 连续失败计数
|
||||
- 语言硬约束
|
||||
- 完整会话 Note 挂商机
|
||||
- A/B 实验分流
|
||||
- Prometheus `/metrics`
|
||||
|
||||
## 8. 监控与告警
|
||||
|
||||
### 质量告警 cron
|
||||
|
||||
+4
-1
@@ -51,10 +51,13 @@ LIBREDESK_WEBHOOK_ID=1
|
||||
- [x] 上下文摘要/压缩(>24 条,保留最近 16 条)
|
||||
- [x] Prompt 注入防护(消息检测 + 工具结果信任边界)
|
||||
- [x] 全量商品页站点地图(www 32,691 / us 22,625,商品页 32,051/22,305)
|
||||
- [x] Hybrid RAG:text_tsv/parent_id/chunk_type,296 parent + 71 child,向量+全文+RRF+父块扩展
|
||||
- [x] Hybrid RAG:text_tsv/parent_id/chunk_type,523 parent + 71 child,向量+全文+RRF+父块扩展
|
||||
- [x] 购买意向 post-LLM 追问兜底(产品+数量触发,缺公司/联系方式时多语言硬追问)
|
||||
- [x] 商机补齐:内容指纹去重、跨渠道复用/同步、阶段推进、CRM 故障 fail-closed
|
||||
- [x] 在线 FAQ/KB 同步(不依赖旧 bridge,`sync-kb-online.js`)
|
||||
- [x] Citation Checker / 幻觉标记 / 飞轮样本
|
||||
- [x] RAG reranker / 三级升级 / 语言硬约束 / 完整会话 Note
|
||||
- [x] KB 版本列表/回滚、sitemap 类目 KB、A/B 实验、Prometheus /metrics
|
||||
- [x] `search_email_history`:已验证客户邮件历史,强制按 verified email scope
|
||||
- [x] 发送前输出护栏:句子级自动重写 + URL 白名单 + 价格/库存数字必须有工具证据
|
||||
- [x] Email/WhatsApp 人工接管:Wholesale Support 团队 + assign_team 规则(AI 不再分配)
|
||||
|
||||
@@ -61,6 +61,13 @@ bash scripts/rebuild-kb-index.sh
|
||||
bash scripts/import-kb-snapshot.sh
|
||||
# 或指定目标库:TARGET_PG_DB=products bash scripts/import-kb-snapshot.sh
|
||||
|
||||
# 从 sitemap 生成类目 KB
|
||||
node scripts/build-site-kb.js
|
||||
|
||||
# KB 备份列表 / 回滚
|
||||
RAG_PG_URL=postgres://crmnew:<password>@127.0.0.1:5440/bridge node scripts/kb-version.js list
|
||||
RAG_PG_URL=postgres://crmnew:<password>@127.0.0.1:5440/bridge node scripts/kb-version.js rollback kb_docs_v...
|
||||
|
||||
# 在线 FAQ 同步 + 重建 KB(不依赖旧 bridge)
|
||||
# 宿主机执行时 RAG_PG_URL 用 127.0.0.1:5440/bridge
|
||||
RAG_PG_URL=postgres://crmnew:<password>@127.0.0.1:5440/bridge node scripts/sync-kb-online.js
|
||||
@@ -73,6 +80,9 @@ bash scripts/export-kb-snapshot.sh
|
||||
# 全量商品页站点地图(官网 sitemap → bridge 库)
|
||||
node scripts/build-site-map.js www us
|
||||
|
||||
# Prometheus 指标
|
||||
curl -s http://127.0.0.1:4100/metrics
|
||||
|
||||
# AI 质量日报(最近 24 小时;可传小时数)
|
||||
node scripts/quality-report.js 24
|
||||
|
||||
@@ -84,6 +94,9 @@ node scripts/quality-alert.js 1 --dry-run
|
||||
# 离线回归评测(确定性逻辑,不调 LLM)
|
||||
node scripts/eval-offline.js
|
||||
|
||||
# RAG 检索评测
|
||||
RAG_PG_URL=postgres://... node scripts/eval-retrieval.js
|
||||
|
||||
# 真实模型离线评测(fake LibreDesk,不写真实会话;会调 LLM/RPC)
|
||||
node scripts/eval-live.js
|
||||
|
||||
|
||||
Reference in New Issue
Block a user