feat: add DashScope bidirectional streaming TTS adapter
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user