feat(i18n): persist language preference and thread through chat, memoir, TTS

- 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>
This commit is contained in:
Kevin
2026-05-11 16:16:49 +08:00
parent 5ce29aad64
commit ccdc4e4277
64 changed files with 3233 additions and 208 deletions

View File

@@ -163,7 +163,13 @@ class Settings(BaseSettings):
enable_tts: bool = True
tts_provider: str = "tencent"
openai_api_key: str = ""
tts_voice_type: int = 502001 # Tencent 音色 ID见 https://cloud.tencent.com/document/product/1073/92668
# 501004 = 月华腾讯云大模型音色支持中英混合PrimaryLanguage=1/2 均可)。
# 调用 TextToVoice 时必须配合 ModelType=1详见 https://cloud.tencent.com/document/api/1073/37995
# 与音色清单 https://cloud.tencent.com/document/product/1073/92668
tts_voice_type: int = 501004
# 英文场景默认同样使用 501004月华大模型音色原生支持中英混合
# 因此无需另配独立英文音色;如需切换英文专用音色请显式覆盖此项。
tts_voice_type_en: int = 501004
tts_codec: str = "mp3"
# ── WeChat Pay ───────────────────────────────────────────