Files
ai-video-fullstack/docs/integrations.mdx
Xin Wang 774825593d feat(qwen-audio): add Alibaba Cloud Qwen-Audio Realtime service integration
- Introduced Qwen-Audio Realtime service for speech-to-speech processing in Pipecat.
- Updated interface catalog to include Qwen-Audio Realtime capabilities.
- Enhanced model resource testing to support new service.
- Added configuration options for audio sample rates and turn detection modes.
- Updated documentation to reflect integration details and usage instructions.
2026-07-21 15:57:43 +08:00

60 lines
2.3 KiB
Plaintext
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.
---
title: 对接说明
description: 模型服务、外部 Agent 与实时语音通道的接入方式。
icon: plug
---
# 对接说明
## 模型服务
优先通过「组件库 / 模型资源」接入。接口定义会动态给出表单字段,凭证写入 `secrets`,普通参数写入 `values`。
| 场景 | 推荐接口类型 |
| --- | --- |
| 通用大模型、转写、合成、向量 | `openai-llm`、`openai-asr`、`openai-tts`、`openai-embedding` |
| 端到端实时语音 | `stepfun-realtime` 或 `qwen-audio-realtime` |
| 讯飞语音 | `xfyun-asr`、`xfyun-tts`、`xfyun-super-tts` |
讯飞接入需要将 `appId`、`apiKey`、`apiSecret` 写入 `secrets`WebSocket 地址及音色等参数写入 `values`。
### Qwen-Audio Realtime
在「组件库 / 模型资源」中新建 `Alibaba Cloud Qwen-Audio Realtime` 资源:
- WebSocket URL 必须包含百炼业务空间 ID例如 `wss://<WorkspaceId>.cn-beijing.maas.aliyuncs.com/api-ws/v1/realtime`。
- API Key 填写该业务空间可用的百炼密钥。
- MVP 支持 `server_vad` 与 `smart_turn`;前者可以调整 VAD 阈值和静音时长。
- 当前模型固定使用 16 kHz 单声道 PCM 输入、24 kHz 单声道 PCM 输出,管线会自动匹配采样率。
保存前可使用「测试连接」验证鉴权、地域、业务空间 ID 和模型是否匹配。
## 外部 Agent
创建助手时选择 Dify、FastGPT 或 OpenCode
- Dify填写服务地址和 API Key。
- FastGPT额外填写应用 ID。
- OpenCode填写服务地址、API Key 和可选提示词。
外部 Agent 的上下文、知识库和工具由对方服务处理。
## 实时语音通道
| 通道 | 地址 | 适用场景 |
| --- | --- | --- |
| WebRTC 信令 | `ws(s)://<host>/ws/voice` | 浏览器低延迟语音与视频输入。 |
| 裸音频 WebSocket | `ws(s)://<host>/ws/stream` | 服务端、话务网关或自定义客户端。 |
两个通道均使用管理员登录 Cookie 鉴权。推荐仅传 `assistant_id`,让服务端解析模型密钥;`inline_config` 仅用于调试。
### WebSocket 音频流启动
连接 `/ws/stream` 后,先发送一条文本 JSON再发送二进制音频帧
```json
{"assistant_id":"asst_xxx"}
```
WebRTC 在公网环境通常需要 TURN。设置 `TURN_URLS` 和 `TURN_SECRET` 后,可通过 `GET /api/webrtc/ice-servers` 获取浏览器 ICE 配置。