Files
tw/config/README.md

93 lines
2.6 KiB
Markdown
Executable File
Raw Permalink 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` 接口,按上述格式返回在线名单。
---
## system_inquiry_rules.json
按店铺识别“系统客服询单”消息(非普通买家咨询),并配置处理策略。
```json
{
"enabled": true,
"default_action": "silent",
"default_reply": "您好,这边已收到询单消息,稍后由人工客服跟进处理。",
"sender_keywords": ["系统客服", "官方客服", "平台客服", "机器人客服"],
"message_keywords": ["询单", "代客咨询", "平台代问", "系统代发"],
"shops": {
"test_shop": {
"enabled": true,
"action": "reply",
"reply": "收到,已登记,稍后人工给您回。",
"sender_keywords": ["系统客服"],
"message_keywords": ["询单"]
}
}
}
```
- `action` 支持: `silent` / `reply` / `transfer`
- `shops.<acc_id>` 可覆盖全局规则(店铺维度)