docs:添加火山双向流式TTS+声音克隆配置教程

This commit is contained in:
rainv123
2025-09-04 16:37:28 +08:00
committed by ruoyemuzimi
parent b3a6ae2441
commit 67e07c916e
2 changed files with 35 additions and 13 deletions
@@ -462,21 +462,14 @@ class TTSProvider(TTSProviderBase):
logger.bind(tag=TAG).debug(
f"推送数据到队列里面帧数~~{len(opus_datas)}"
)
if is_first_sentence:
first_sentence_segment_count += 1
if first_sentence_segment_count <= 6:
self.tts_audio_queue.put(
(SentenceType.MIDDLE, opus_datas, None)
)
else:
opus_datas_cache.extend(opus_datas)
else:
# 后续句子缓存
opus_datas_cache.extend(opus_datas)
# 优化:对于第一句话,不进行缓存,立即推送到队列
self.tts_audio_queue.put(
(SentenceType.MIDDLE, opus_datas, None)
)
elif res.optional.event == EVENT_TTSSentenceEnd:
logger.bind(tag=TAG).info(f"句子语音生成成功:{self.tts_text}")
if not is_first_sentence or first_sentence_segment_count > 10:
# 发送缓存的数据
# 优化:如果有缓存的数据,立即发送
if opus_datas_cache:
self.tts_audio_queue.put(
(SentenceType.MIDDLE, opus_datas_cache, None)
)