Refactor voice websocket documentation to clarify input handling and remove deprecated sections. Updated the demo process to indicate that image uploads are no longer required, streamlining user interaction with the voice service.
This commit is contained in:
@@ -33,7 +33,7 @@ sequenceDiagram
|
||||
Note over Client,Server: 可选:固定开场白 / FastGPT opener / LLM 生成问候
|
||||
loop 会话中
|
||||
Client->>Server: input.audio (binary 或 JSON)
|
||||
Client->>Server: input.text / input.image / response.cancel
|
||||
Client->>Server: input.text
|
||||
Server-->>Client: input.transcript.* / response.text.* / response.audio.*
|
||||
Server-->>Client: response.state(若启用状态标签)
|
||||
end
|
||||
@@ -122,40 +122,7 @@ sequenceDiagram
|
||||
}
|
||||
```
|
||||
|
||||
注意:文本输入**不会**以 `input.transcript.final` 回显,客户端需自行在 UI 中展示用户消息(Demo 即如此处理)。
|
||||
|
||||
### `input.image`
|
||||
|
||||
上传相机/图片并附带可选说明文本,供多模态 LLM 使用。
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "input.image",
|
||||
"image": "<base64>",
|
||||
"mime_type": "image/jpeg",
|
||||
"width": 1920,
|
||||
"height": 1080,
|
||||
"text": "Answer using this camera image.",
|
||||
"append_to_context": true
|
||||
}
|
||||
```
|
||||
|
||||
约束:
|
||||
|
||||
- 支持 `image/jpeg`、`image/png`、`image/webp`
|
||||
- 单张最大 8 MB
|
||||
- `width`、`height` 必须为正整数
|
||||
- 支持 `data:image/jpeg;base64,...` 格式(会自动剥离前缀)
|
||||
|
||||
### `response.cancel`
|
||||
|
||||
取消当前 bot 回复(等价于打断 TTS / LLM 流)。
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "response.cancel"
|
||||
}
|
||||
```
|
||||
注意:文本输入**不会**以 `input.transcript.final` 回显,客户端需自行在 UI 中展示用户消息(Demo 即如此处理)。Demo 的相机步骤通过发送 `input.text`(如 `【拍摄完成】`)完成,不上传图片帧。
|
||||
|
||||
## 服务端 → 客户端
|
||||
|
||||
@@ -256,7 +223,7 @@ Demo 根据状态码展示拍照引导(如 `2000`–`2015` 等车险场景状
|
||||
|
||||
- **chatId**:同一 ID 用于 LLM(如 FastGPT)多轮上下文;连接时可写在 URL 或 `session.start` 中。
|
||||
- **语音回合**:VAD + 静音超时判定用户说完;说完后触发 STT 最终转写与 LLM。
|
||||
- **打断**:用户说话、`input.text`(`interrupt: true`)或 `response.cancel` 可打断 bot;被打断的助手文本在 `response.text.final` 中带 `interrupted: true`。
|
||||
- **打断**:用户说话或 `input.text`(`interrupt: true`)可打断 bot;被打断的助手文本在 `response.text.final` 中带 `interrupted: true`。
|
||||
- **空闲超时**:长时间无活动会断开(`session.inactivity_timeout_sec`,默认 60 秒);可配置空闲提示语。
|
||||
- **开场白**:由 `agent.greeting_mode` 控制(`fixed` / `fastgpt_opener` / `generated` 等)。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user