fix: 修复聊天记录上报排序错乱的问题

This commit is contained in:
3030332422
2026-04-20 11:00:04 +08:00
parent bacf4cd5e8
commit b209de36f5
2 changed files with 6 additions and 6 deletions
@@ -52,7 +52,7 @@ public class AgentChatHistoryBizServiceImpl implements AgentChatHistoryBizServic
public Boolean report(AgentChatHistoryReportDTO report) { public Boolean report(AgentChatHistoryReportDTO report) {
String macAddress = report.getMacAddress(); String macAddress = report.getMacAddress();
Byte chatType = report.getChatType(); Byte chatType = report.getChatType();
Long reportTimeMillis = null != report.getReportTime() ? report.getReportTime() * 1000 Long reportTimeMillis = null != report.getReportTime() ? report.getReportTime()
: System.currentTimeMillis(); : System.currentTimeMillis();
log.info("小智设备聊天上报请求: macAddress={}, type={} reportTime={}", macAddress, chatType, reportTimeMillis); log.info("小智设备聊天上报请求: macAddress={}, type={} reportTime={}", macAddress, chatType, reportTimeMillis);
@@ -120,12 +120,12 @@ def enqueue_tts_report(conn: "ConnectionHandler", text, opus_data):
try: try:
# 使用连接对象的队列,传入文本和二进制数据而非文件路径 # 使用连接对象的队列,传入文本和二进制数据而非文件路径
if conn.chat_history_conf == 2: 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( conn.logger.bind(tag=TAG).debug(
f"TTS数据已加入上报队列: {conn.device_id}, 音频大小: {len(opus_data)} " f"TTS数据已加入上报队列: {conn.device_id}, 音频大小: {len(opus_data)} "
) )
else: 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( conn.logger.bind(tag=TAG).debug(
f"TTS数据已加入上报队列: {conn.device_id}, 不上报音频" f"TTS数据已加入上报队列: {conn.device_id}, 不上报音频"
) )
@@ -149,7 +149,7 @@ def enqueue_tool_report(conn: "ConnectionHandler", tool_name: str, tool_input: d
return return
try: try:
timestamp = int(time.time()) timestamp = int(time.time() * 1000)
# 构建工具调用内容 # 构建工具调用内容
if report_tool_call: if report_tool_call:
@@ -187,12 +187,12 @@ def enqueue_asr_report(conn: "ConnectionHandler", text, opus_data):
try: try:
# 使用连接对象的队列,传入文本和二进制数据而非文件路径 # 使用连接对象的队列,传入文本和二进制数据而非文件路径
if conn.chat_history_conf == 2: 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( conn.logger.bind(tag=TAG).debug(
f"ASR数据已加入上报队列: {conn.device_id}, 音频大小: {len(opus_data)} " f"ASR数据已加入上报队列: {conn.device_id}, 音频大小: {len(opus_data)} "
) )
else: 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( conn.logger.bind(tag=TAG).debug(
f"ASR数据已加入上报队列: {conn.device_id}, 不上报音频" f"ASR数据已加入上报队列: {conn.device_id}, 不上报音频"
) )