fix(tts): gate auto reply by ENABLE_TTS; allow on-demand and manual playback

- 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>
This commit is contained in:
Kevin
2026-05-11 17:15:02 +08:00
parent ccdc4e4277
commit 93be60f74c
7 changed files with 101 additions and 17 deletions

View File

@@ -115,7 +115,8 @@ async def _send_tts_audio(
settings.enable_tts,
settings.tts_provider,
)
if not settings.enable_tts:
# enable_tts仅禁用「助手回复自动生成 TTS」want_tts 路径用户点喇叭manual=True仍可合成。
if not manual and not settings.enable_tts:
logger.info(
"pipeline._send_tts_audio result conversation_id={} chunk_index={} ok=False "
"url_set=False audio_bytes_len=0 reason=enable_tts_false",
@@ -269,14 +270,6 @@ async def handle_tts_request_on_demand(
settings.enable_tts,
settings.tts_provider,
)
if not settings.enable_tts:
logger.info(
"pipeline.handle_tts_request_on_demand result ok=False reason=未开启语音合成 "
"conversation_id={} assistant_message_id={}",
conversation_id,
assistant_message_id,
)
return False, "未开启语音合成"
conv = await db.get(Conversation, conversation_id)
if not conv or conv.user_id != user_id or conv.deleted_at is not None: