fix: 优化

This commit is contained in:
Sakura-RanChen
2025-09-02 14:34:26 +08:00
parent c3c2e7c28e
commit b9df6d4ad2
3 changed files with 54 additions and 14 deletions
@@ -2,7 +2,7 @@ import json
import time
import asyncio
from core.utils import textUtils
from core.utils.util import audio_to_data_stream
from core.utils.util import audio_to_data
from core.providers.tts.dto.dto import SentenceType
TAG = __name__
@@ -120,12 +120,7 @@ async def send_tts_message(conn, state, text=None):
stop_tts_notify_voice = conn.config.get(
"stop_tts_notify_voice", "config/assets/tts_notify.mp3"
)
# 获取音频数据
audios = []
def handle_audio_frame(frame_data):
audios.append(frame_data)
audio_to_data_stream(stop_tts_notify_voice, is_opus=True, callback=handle_audio_frame)
audios = audio_to_data(stop_tts_notify_voice, is_opus=True)
await sendAudio(conn, audios)
# 清除服务端讲话状态
conn.clearSpeakStatus()