From 659c470eba542383987aad227b7f918100f131fa Mon Sep 17 00:00:00 2001
From: wangzhibo <wangzhibo@shsening.com>
Date: 星期五, 11 九月 2026 15:09:05 +0800
Subject: [PATCH] 小智终端 5种 场景模式 OK
---
xiaozhi-esp32-server/main/xiaozhi-server/core/handle/reportHandle.py | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/xiaozhi-esp32-server/main/xiaozhi-server/core/handle/reportHandle.py b/xiaozhi-esp32-server/main/xiaozhi-server/core/handle/reportHandle.py
index 15beb47..100094d 100644
--- a/xiaozhi-esp32-server/main/xiaozhi-server/core/handle/reportHandle.py
+++ b/xiaozhi-esp32-server/main/xiaozhi-server/core/handle/reportHandle.py
@@ -22,7 +22,8 @@
TAG = __name__
-async def report(conn: "ConnectionHandler", chat_type, text, audio_data, report_time):
+async def report(conn: "ConnectionHandler", chat_type, text, audio_data, report_time,
+ task_instance_id=None, step_index=None):
"""鎵ц鑱婂ぉ璁板綍涓婃姤鎿嶄綔
Args:
@@ -43,6 +44,13 @@
wav_data = None
else:
wav_data = None
+ if wav_data and chat_type == 2:
+ try:
+ from core.audio_archive import archive_wav
+
+ archive_wav(conn, wav_data, kind="tts")
+ except Exception:
+ pass
# 鎵ц寮傛涓婃姤
await manage_report(
mac_address=conn.device_id,
@@ -51,6 +59,8 @@
content=text,
audio=wav_data,
report_time=report_time,
+ task_instance_id=task_instance_id,
+ step_index=step_index,
)
except Exception as e:
conn.logger.bind(tag=TAG).error(f"鑱婂ぉ璁板綍涓婃姤澶辫触: {e}")
@@ -224,7 +234,7 @@
conn.logger.bind(tag=TAG).error(f"鍔犲叆宸ュ叿涓婃姤闃熷垪澶辫触: {e}")
-def enqueue_asr_report(conn: "ConnectionHandler", text, opus_data):
+def enqueue_asr_report(conn: "ConnectionHandler", text, opus_data, task_instance_id=None, step_index=None):
"""灏咥SR鏁版嵁鍔犲叆涓婃姤闃熷垪
Args:
@@ -239,12 +249,12 @@
try:
# 浣跨敤杩炴帴瀵硅薄鐨勯槦鍒楋紝浼犲叆鏂囨湰鍜屼簩杩涘埗鏁版嵁鑰岄潪鏂囦欢璺緞
if conn.chat_history_conf == 2:
- conn.report_queue.put((1, text, opus_data, int(time.time() * 1000)))
+ conn.report_queue.put((1, text, opus_data, int(time.time() * 1000), task_instance_id, step_index))
conn.logger.bind(tag=TAG).debug(
f"ASR鏁版嵁宸插姞鍏ヤ笂鎶ラ槦鍒�: {conn.device_id}, 闊抽澶у皬: {len(opus_data)} "
)
else:
- conn.report_queue.put((1, text, None, int(time.time() * 1000)))
+ conn.report_queue.put((1, text, None, int(time.time() * 1000), task_instance_id, step_index))
conn.logger.bind(tag=TAG).debug(
f"ASR鏁版嵁宸插姞鍏ヤ笂鎶ラ槦鍒�: {conn.device_id}, 涓嶄笂鎶ラ煶棰�"
)
--
Gitblit v1.9.1