Files
tw/config/README.md
jimi c39840fe15 feat: 添加 AI Agent 对话测试工具 + 代码优化
主要变更:

- 新增 tests/test_ai_chat.py: AI Agent 对话测试工具

- 优化 core/pydantic_ai_agent.py 和 db/chat_log_db.py

- 清理归档文件,更新文档

Made-with: Cursor
2026-02-28 16:19:35 +08:00

65 lines
1.8 KiB
Markdown
Executable File
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.
# 配置文件说明
## transfer_groups.json
店铺 → 转接分组映射静态。不同店铺acc_id对应不同客服分组。
```json
{
"default": "20252916034",
"小威哥1216": "20252916034",
"另一店铺": "12345678"
}
```
- **default**:未配置的店铺使用的默认分组 ID
- **其他 key**:店铺 `acc_id`
- **value**:该店铺转接时使用的分组 ID
---
## 设计师派单SQLite
同一设计师在不同店铺对应不同 group_id转人工时按需查询在线状态从在线设计师中轮询派单。
### 数据库
路径: `db/designer_roster_db/roster.db`
| 表 | 说明 |
|---|------|
| `designers` | 设计师name, wechat_user_id|
| `designer_shops` | 设计师在某店铺的 group_id同一人不同店铺不同分组|
| `designer_online` | 在线状态(转人工时按需查询外部 API 同步)|
### 初始化数据
```bash
python scripts/init_designer_roster.py example # 写入示例
python scripts/init_designer_roster.py list # 查看当前数据
```
### 在线查询 API
`.env` 中配置 `DESIGNER_ROSTER_API`(如 `http://huichang.online:8001/online`)。
**接口**: GET返回格式
```json
{
"online_count": 2,
"online_users": ["lz", "ZuoWei"],
"update_time": "2026-02-26 16:30:00"
}
```
| 字段 | 必填 | 说明 |
|------|------|------|
| `online_users` | 是 | 当前在线设计师名单,对应 `wechat_user_id` |
**调用时机**: 转人工时按需 GET 一次,不轮询。无人在线时回退到 `transfer_groups.json` 静态配置,并发企微「谁在线啊」提醒。
### 对接方要求(外部 AI 服务)
对端需实现:企微群消息 → 解析「上线」/「下线」→ 存库 → 提供 GET `/online` 接口,按上述格式返回在线名单。