提示词添加车辆预先提取和手机号多次拼接输入

This commit is contained in:
Xin Wang
2026-02-03 17:33:45 +08:00
parent 34848dd6a0
commit 87e616ab55
7 changed files with 4779 additions and 1 deletions

56
docs/chat-stream-mode.md Normal file
View File

@@ -0,0 +1,56 @@
# /chat 流式响应模式说明
## 接口地址
```
POST http://localhost:8000/chat?stream=true
```
## 请求参数
| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| sessionId | string | 是 | 会话 ID |
| timeStamp | string | 是 | 时间戳 |
| text | string | 是 | 用户输入文本 |
| stream | bool | 否 | 设为 true 启用流式响应 |
## SSE 事件类型
| 事件类型 | 说明 | 数据格式 |
|----------|------|----------|
| `stage_code` | 阶段状态码 | `{"nextStageCode": "0000", "nextStage": "结束通话"}` |
| `text_delta` | 流式文本片段 | `{"text": "您好..."}` |
| `done` | 流式结束 | `{"status": "completed"}` |
| `error` | 错误信息 | `{"msg": "错误描述", "code": "500"}` |
## 状态码映射
| 状态码 | 含义 |
|--------|------|
| 0000 | 结束通话 |
| 0001 | 转接人工 |
| 0002 | 语义无法识别转接人工 |
| 0003 | 有人伤转接人工 |
| 1001 | 未准备好通话 |
| 1002 | 通话中 |
| 2000 | 进入单车拍照 |
| ... | ... |
## 示例
### 请求
```bash
python examples/stream_chat.py session-001 "发生了交通事故"
```
### 响应
```
Status: 200
--------------------------------------------------
[stage_code] {"nextStageCode": "1002", "nextStage": "通话中"}
[text_delta] {"text": "您好,请问发生了什么情况?"}
[done] {"status": "completed"}
```