feat: add online FAQ/KB sync without old bridge
This commit is contained in:
+33
-1
@@ -191,7 +191,7 @@ docker exec crmnew-postgres psql -U crmnew -d bridge -tAc \
|
||||
预期:
|
||||
|
||||
```
|
||||
361 | 292 | 69
|
||||
367 | 296 | 71
|
||||
```
|
||||
|
||||
然后把测试环境 `.env` 的 `RAG_PG_URL` 指向该库,例如:
|
||||
@@ -203,6 +203,38 @@ RAG_PG_URL=postgres://crmnew:<password>@postgres:5432/bridge
|
||||
> 快照文件:`deploy/seeds/kb_docs.sql.gz`(只包含 `kb_docs` 知识库,不含邮件/客户数据)
|
||||
> 当前环境如需重新生成:`bash scripts/export-kb-snapshot.sh`
|
||||
|
||||
#### 在线 FAQ 同步(不依赖旧 bridge)
|
||||
|
||||
测试/生产如果网络可以访问官网 FAQ,可直接:
|
||||
|
||||
```bash
|
||||
# 在宿主机执行时,RAG_PG_URL 用宿主机可达地址
|
||||
RAG_PG_URL=postgres://crmnew:<password>@127.0.0.1:5440/bridge \
|
||||
node scripts/sync-kb-online.js
|
||||
|
||||
# 如果脚本跑在 bridge 容器内,则用容器内地址
|
||||
# RAG_PG_URL=postgres://crmnew:<password>@postgres:5432/bridge
|
||||
```
|
||||
|
||||
建议 cron 每周一次:
|
||||
|
||||
```cron
|
||||
0 3 * * 1 cd /home/dev/code/crm-new && RAG_PG_URL=... node scripts/sync-kb-online.js
|
||||
```
|
||||
|
||||
如果官网抓取被 WAF 拦截,可先用本地源文件重建:
|
||||
|
||||
```bash
|
||||
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` 目前是静态类目地图,不随官网自动更新
|
||||
|
||||
#### 全量商品页站点地图
|
||||
|
||||
```bash
|
||||
|
||||
+2
-1
@@ -51,9 +51,10 @@ 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,292 parent + 69 child,向量+全文+RRF+父块扩展
|
||||
- [x] Hybrid RAG:text_tsv/parent_id/chunk_type,296 parent + 71 child,向量+全文+RRF+父块扩展
|
||||
- [x] 购买意向 post-LLM 追问兜底(产品+数量触发,缺公司/联系方式时多语言硬追问)
|
||||
- [x] 商机补齐:内容指纹去重、跨渠道复用/同步、阶段推进、CRM 故障 fail-closed
|
||||
- [x] 在线 FAQ/KB 同步(不依赖旧 bridge,`sync-kb-online.js`)
|
||||
- [x] `search_email_history`:已验证客户邮件历史,强制按 verified email scope
|
||||
- [x] 发送前输出护栏:句子级自动重写 + URL 白名单 + 价格/库存数字必须有工具证据
|
||||
- [x] Email/WhatsApp 人工接管:Wholesale Support 团队 + assign_team 规则(AI 不再分配)
|
||||
|
||||
@@ -61,6 +61,12 @@ bash scripts/rebuild-kb-index.sh
|
||||
bash scripts/import-kb-snapshot.sh
|
||||
# 或指定目标库:TARGET_PG_DB=products bash scripts/import-kb-snapshot.sh
|
||||
|
||||
# 在线 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
|
||||
# 仅用本地 bridge/kb 重建
|
||||
node scripts/sync-kb-online.js --local-only --force
|
||||
|
||||
# 从当前环境重新生成快照(可选)
|
||||
bash scripts/export-kb-snapshot.sh
|
||||
|
||||
|
||||
Reference in New Issue
Block a user