- Add users.language_preference (Alembic 0018, default zh); capture at signup/SMS only; expose on auth and profile APIs - Lite English prompts for chat and memoir; localized stage labels and agent names (Life Echo / 岁月知己) - Tencent TTS: language-aware synthesis, ModelType=1 for 501004, English chunking - WebSocket pipeline: emit all AGENT_RESPONSE segments when TTS cancels; INFO logs for tts_this_turn and TTS decisions; on-demand TTS logging - Expo: device language on auth, i18n tiers/agent name, [SPLIT] streaming UX fixes - Tests for migration, prompts, pipeline, router tts_this_turn, reply segments Co-authored-by: Cursor <cursoragent@cursor.com>
16 lines
427 B
Python
16 lines
427 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'. Adapters that natively detect language may ignore it.
|
|
"""
|
|
...
|