feat: port quality, escalation, KB version, site-map KB, experiments and metrics

This commit is contained in:
wangliang
2026-10-23 11:41:09 +08:00
parent 81b49c9350
commit b778570045
33 changed files with 2446 additions and 344 deletions
+35 -3
View File
@@ -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