mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 01:23:55 +08:00
fix: 修复聊天记录上报排序错乱的问题
This commit is contained in:
@@ -120,12 +120,12 @@ def enqueue_tts_report(conn: "ConnectionHandler", text, opus_data):
|
||||
try:
|
||||
# 使用连接对象的队列,传入文本和二进制数据而非文件路径
|
||||
if conn.chat_history_conf == 2:
|
||||
conn.report_queue.put((2, text, opus_data, int(time.time())))
|
||||
conn.report_queue.put((2, text, opus_data, int(time.time() * 1000)))
|
||||
conn.logger.bind(tag=TAG).debug(
|
||||
f"TTS数据已加入上报队列: {conn.device_id}, 音频大小: {len(opus_data)} "
|
||||
)
|
||||
else:
|
||||
conn.report_queue.put((2, text, None, int(time.time())))
|
||||
conn.report_queue.put((2, text, None, int(time.time() * 1000)))
|
||||
conn.logger.bind(tag=TAG).debug(
|
||||
f"TTS数据已加入上报队列: {conn.device_id}, 不上报音频"
|
||||
)
|
||||
@@ -149,7 +149,7 @@ def enqueue_tool_report(conn: "ConnectionHandler", tool_name: str, tool_input: d
|
||||
return
|
||||
|
||||
try:
|
||||
timestamp = int(time.time())
|
||||
timestamp = int(time.time() * 1000)
|
||||
|
||||
# 构建工具调用内容
|
||||
if report_tool_call:
|
||||
@@ -187,12 +187,12 @@ def enqueue_asr_report(conn: "ConnectionHandler", text, opus_data):
|
||||
try:
|
||||
# 使用连接对象的队列,传入文本和二进制数据而非文件路径
|
||||
if conn.chat_history_conf == 2:
|
||||
conn.report_queue.put((1, text, opus_data, int(time.time())))
|
||||
conn.report_queue.put((1, text, opus_data, int(time.time() * 1000)))
|
||||
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())))
|
||||
conn.report_queue.put((1, text, None, int(time.time() * 1000)))
|
||||
conn.logger.bind(tag=TAG).debug(
|
||||
f"ASR数据已加入上报队列: {conn.device_id}, 不上报音频"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user