- Pipeline: skip _send_tts_audio only for non-manual when ENABLE_TTS=false; remove enable_tts early return from handle_tts_request_on_demand. - Tencent TTS: PrimaryLanguage/chunking follow user language preference only. - Expo: let manual tts_audio bypass late-segment playback gate after interrupt. - Docs: clarify ENABLE_TTS vs tts_request in api/.env.example and TTSProvider port. - Tests: add manual bypass cases; adjust pipeline language tests for en+Chinese text. Co-authored-by: Cursor <cursoragent@cursor.com>
16 lines
479 B
Python
16 lines
479 B
Python
"""TTSProvider port — 文字转语音能力契约。"""
|
|
|
|
from typing import Protocol, runtime_checkable
|
|
|
|
|
|
@runtime_checkable
|
|
class TTSProvider(Protocol):
|
|
async def synthesize(
|
|
self, text: str, voice: str = "alloy", *, language: str = "zh"
|
|
) -> bytes:
|
|
"""Convert text to speech audio bytes.
|
|
|
|
language: 'zh' or 'en' — 调用方应使用用户语言偏好(与正文语种无关);各 adapter 按自身能力解释。
|
|
"""
|
|
...
|