diff --git a/main/xiaozhi-server/core/connection.py b/main/xiaozhi-server/core/connection.py index 14a920607..a852defd3 100644 --- a/main/xiaozhi-server/core/connection.py +++ b/main/xiaozhi-server/core/connection.py @@ -27,9 +27,9 @@ from config.private_config import PrivateConfig from core.auth import AuthMiddleware, AuthenticationError from core.utils.auth_code_gen import AuthCodeGenerator from core.mcp.manager import MCPManager - +from datetime import datetime TAG = __name__ - +logger = setup_logging() auto_import_modules("plugins_func.functions") @@ -370,6 +370,8 @@ class ConnectionHandler: # 处理最后剩余的文本 full_text = "".join(response_message) + + logger.bind(tag=TAG).info(f"deviceId: {self.conn.private_config.device_id},datetime: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")},模型回复: {full_text}") remaining_text = full_text[processed_chars:] if remaining_text: segment_text = get_string_no_punctuation_or_emoji(remaining_text) diff --git a/main/xiaozhi-server/core/handle/receiveAudioHandle.py b/main/xiaozhi-server/core/handle/receiveAudioHandle.py index f798739ab..55f831ac9 100644 --- a/main/xiaozhi-server/core/handle/receiveAudioHandle.py +++ b/main/xiaozhi-server/core/handle/receiveAudioHandle.py @@ -3,7 +3,7 @@ import time from core.utils.util import remove_punctuation_and_length from core.handle.sendAudioHandle import send_stt_message from core.handle.intentHandler import handle_user_intent - +from datetime import datetime TAG = __name__ logger = setup_logging() @@ -38,7 +38,7 @@ async def handleAudioMessage(conn, audio): text, file_path = await conn.asr.speech_to_text( conn.asr_audio, conn.session_id ) - logger.bind(tag=TAG).info(f"识别文本: {text}") + logger.bind(tag=TAG).info(f"deviceId: {conn.private_config.device_id},datetime: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")},用户说: {text}") text_len, _ = remove_punctuation_and_length(text) if text_len > 0: await startToChat(conn, text)