Fix long audio bug (#158)

* update:异步生成音频

* update:优化LLM断句

---------

Co-authored-by: hrz <1710360675@qq.com>
This commit is contained in:
欣南科技
2025-03-01 01:54:55 +08:00
committed by GitHub
co-authored by hrz
parent 2c88a36f32
commit b94842c312
8 changed files with 73 additions and 234 deletions
+3 -2
View File
@@ -4,7 +4,7 @@ import random
import difflib
import re
import traceback
from core.handle.sendAudioHandle import sendAudioMessage, send_stt_message
from core.handle.sendAudioHandle import send_stt_message
TAG = __name__
logger = setup_logging()
@@ -102,7 +102,8 @@ class MusicHandler:
conn.tts_last_text = selected_music
conn.llm_finish_task = True
opus_packets, duration = conn.tts.wav_to_opus_data(music_path)
await sendAudioMessage(conn, opus_packets, duration, selected_music)
conn.audio_play_queue.put((opus_packets, selected_music))
except Exception as e:
logger.bind(tag=TAG).error(f"播放音乐失败: {str(e)}")