From 1d57e75d28bc1da8632e0dd5e11d998ba6c1936e Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Sun, 8 Jun 2025 11:59:06 +0800 Subject: [PATCH] =?UTF-8?q?update:=E5=8D=95=E6=B5=81=E5=BC=8Ftts=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E8=AE=B0=E5=BD=95=E4=B8=8A=E6=8A=A5=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/core/providers/tts/linkerai.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main/xiaozhi-server/core/providers/tts/linkerai.py b/main/xiaozhi-server/core/providers/tts/linkerai.py index 69127e8a..7493764f 100644 --- a/main/xiaozhi-server/core/providers/tts/linkerai.py +++ b/main/xiaozhi-server/core/providers/tts/linkerai.py @@ -173,6 +173,8 @@ class TTSProvider(TTSProviderBase): self.pcm_buffer.clear() opus_datas_cache = [] + self.tts_audio_queue.put((SentenceType.FIRST, [], text)) + # 兼容 iter_chunked / iter_chunks / iter_any async for chunk in resp.content.iter_any(): data = chunk[0] if isinstance(chunk, (list, tuple)) else chunk @@ -193,7 +195,7 @@ class TTSProvider(TTSProviderBase): if opus: if self.segment_count < 10: # 前10个片段直接发送 self.tts_audio_queue.put( - (SentenceType.MIDDLE, opus, text) + (SentenceType.MIDDLE, opus, None) ) self.segment_count += 1 else: @@ -208,7 +210,7 @@ class TTSProvider(TTSProviderBase): if self.segment_count < 10: # 前10个片段直接发送 # 直接发送 self.tts_audio_queue.put( - (SentenceType.MIDDLE, opus, text) + (SentenceType.MIDDLE, opus, None) ) self.segment_count += 1 else: @@ -219,7 +221,7 @@ class TTSProvider(TTSProviderBase): # 如果不是前10个片段,发送缓存的数据 if self.segment_count >= 10 and opus_datas_cache: self.tts_audio_queue.put( - (SentenceType.MIDDLE, opus_datas_cache, text) + (SentenceType.MIDDLE, opus_datas_cache, None) ) # 如果是最后一段,输出音频获取完毕