Files
libredesk/docs/E2E-livechat.md
T
wangliang 39986f10f2 初始化 LibreDesk 本地实例部署仓库
- docker compose 部署:app / db / redis / tls(nginx) / bridge-tools,宿主端口错开避免与本机服务冲突
- bridge-tools 内联进仓库(compose build 路径改为 ./bridge-tools),仓库自包含可部署
- 部署说明 README、crm-new 对照与 bridge-tools 方案文档、备份与隧道脚本
- .gitignore 排除 .env、config.toml、uploads/、tls 私钥/证书、backups/、logs/
2026-10-29 13:24:13 +08:00

41 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Live Chat 端到端验证(2026-10-28)
环境:LibreDesk v2.9.1(https://192.168.31.61:9443)+ bridge-tools(4 个 AI 工具)
Inbox:Website(livechat,uuid `81b679b0-33fb-4796-9f83-dcc0f43231cc`)
自动化:新会话 → 分配给 Yehwang Assistant(user_id=2)
## 验证流程与结果
| 步骤 | 结果 |
| --- | --- |
| 1. widget 匿名发起会话(`POST /api/v1/widget/chat/conversations/init`,第一条消息=退货政策) | 200,会话创建 |
| 2. 自动化规则触发 | 会话 assigned_user_id=2(Yehwang Assistant) |
| 3. AI 自动回复 | 约 5 秒返回,内容与知识库一致(非质量问题不退,质量问题 7 天内),带 sources |
| 4. 访客问订单状态 | AI 要求邮箱验证 |
| 5. 访客给邮箱 | AI 调用 `set_contact_email` + `send_email_verification`(OTP 走 163 SMTP) |
| 6. 从 Redis 取码(`ai:otp:pending:<uuid>`)并回复 | AI 调用 `check_email_verification`,验证通过 |
| 7. 重试 `search_orders` | bridge-tools 日志:`tool=search_orders verified=true ok=true`;回复「没有找到该邮箱的订单」 |
| 8. 会话状态 | Open,contact email 已更新 |
## 发现的问题(已处理)
在第 4 步之前,模型曾自行声称「已把验证码发到 example@example.com」——这是一个**编造的邮箱和编造的动作**(当时联系人的邮箱为空)。
已在 assistant instructions 里加护栏:
> Never invent or assume the customer's email address: ask for it. Only say a verification code or email was sent after the send_email_verification tool succeeds.
仍建议上线前用真实客户跑一轮回归,重点看「无邮箱时是否会索要邮箱」以及「是否只在工具成功后声称已发送」。
## 复现命令
widget 匿名发起:
```bash
curl -sk -X POST https://localhost:9443/api/v1/widget/chat/conversations/init \
-H 'Host: 192.168.31.61:9443' -H 'Content-Type: application/json' \
-H 'X-Libredesk-Inbox-ID: 81b679b0-33fb-4796-9f83-dcc0f43231cc' \
-d '{"message":"What is your return policy?"}'
```
发送后续消息需 `Authorization: Bearer <session_token>` + `X-Libredesk-Inbox-ID`。