feat: add DashScope bidirectional streaming TTS adapter
Quality gate / backend (push) Canceled after 0s
Quality gate / frontend (push) Canceled after 0s

This commit is contained in:
Xin Wang
2026-10-28 13:53:43 +08:00
parent cc0d80a3a4
commit 7b048d0e83
7 changed files with 420 additions and 5 deletions
+11 -2
View File
@@ -137,7 +137,7 @@ def create_llm(cfg: AssistantConfig):
def create_tts(cfg: AssistantConfig):
"""CosyVoice 等,走 OpenAI 兼容的 /v1/audio/speech。"""
"""根据资源的协议创建独立 TTS 服务。"""
voice = _require(cfg.voice, "TTS voice")
if cfg.tts_interface_type == "xfyun-super-tts":
return XfyunSuperTTSService(
@@ -171,7 +171,16 @@ def create_tts(cfg: AssistantConfig):
push_stop_frames=True,
stop_frame_timeout_s=WEBSOCKET_TTS_STOP_FRAME_TIMEOUT_S,
)
if cfg.tts_interface_type not in {"openai-tts", "dashscope-tts"}:
if cfg.tts_interface_type == "dashscope-tts":
from services.pipecat.dashscope_tts import DashScopeTTSService
return DashScopeTTSService(
api_key=_require(cfg.tts_api_key, "TTS apiKey"),
model=_require(cfg.tts_model, "TTS modelId"),
voice=voice,
url=_require(cfg.tts_base_url, "TTS apiUrl"),
)
if cfg.tts_interface_type != "openai-tts":
raise ValueError(f"不支持的 TTS 接口类型: {cfg.tts_interface_type}")
# Pipecat 默认只接受 OpenAI 官方音色。OpenAI 兼容服务常使用自定义 voice id,