流式传输

This commit is contained in:
yinsx
2025-12-25 15:36:35 +08:00
parent e56f47076c
commit 14bfdcbf51
19 changed files with 1191 additions and 65 deletions

View File

@ -55,6 +55,23 @@ python api.py
}
```
### POST /text-to-blendshapes/stream
**说明:** 使用 NDJSON 流式返回,便于边收边播放。
**响应:** 每行一个 JSON 对象,`type` 字段取值如下:
- `status` - 阶段提示
- `frame` - 单帧数据
- `end` - 完成信息
- `error` - 错误信息
**示例:**
```json
{"type":"status","stage":"tts","message":"Generating audio"}
{"type":"frame","frame":{"timeCode":0.0,"blendShapes":{"JawOpen":0.1}}}
{"type":"end","frames":900,"audio_path":"...","csv_path":"..."}
```
## 文件说明
- `tts_service.py` - 文字转音频服务