From 407e87341661a3e648b7b5d723d9bb9a3c3c81ed Mon Sep 17 00:00:00 2001 From: lizhongxiang Date: Thu, 27 Feb 2025 20:00:01 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E9=83=A8=E7=BD=B2=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/handle/audioHandle.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/core/handle/audioHandle.py b/core/handle/audioHandle.py index 6c5769f44..13c81181d 100644 --- a/core/handle/audioHandle.py +++ b/core/handle/audioHandle.py @@ -155,20 +155,13 @@ async def sendAudioMessageStream(conn, audios_queue, duration, text): last_duration = 0 opus_datas, duration = conn.tts.wav_to_opus_data_audio(conn,audio_data_chunke_data) conn.tts_duration = duration + last_duration + 0.5 - ops_buff.append(opus_datas) - if len(ops_buff) > 1: - for opus_packets_1 in ops_buff: - for opus_packet in opus_packets_1: - await conn.websocket.send(opus_packet) - ops_buff=[] + for opus_packet in opus_datas: + await conn.websocket.send(opus_packet) print(f"已获取音频数据,长度为 {len(audio_data_chunke_data)},总长度为 {len(audio_data_chunke_data)}") start_time = time.time() # 更新获取数据的时间 except Exception as e: print(f"发生错误: {e}") traceback.print_exc() # 打印错误堆栈 - for opus_packets_1 in ops_buff: - for opus_packet in opus_packets_1: - await conn.websocket.send(opus_packet) if conn.llm_finish_task and text == conn.tts_last_text: stop_duration = conn.tts_duration + 0.5