From a8c6c7cb36688d36ea63574a58662da0305314ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A3=E5=8D=97=E7=A7=91=E6=8A=80?= Date: Wed, 12 Mar 2025 12:46:29 +0800 Subject: [PATCH] =?UTF-8?q?update:=E4=BC=98=E5=8C=96=E6=97=A0=E6=84=8F?= =?UTF-8?q?=E5=9B=BE=E8=AF=86=E5=88=AB=E7=9A=84=E6=97=A5=E5=BF=97=E8=BE=93?= =?UTF-8?q?=E5=87=BA=20(#295)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: hrz <1710360675@qq.com> --- main/xiaozhi-server/core/connection.py | 2 -- main/xiaozhi-server/core/handle/intentHandler.py | 3 --- .../core/providers/intent/intent_llm/intent_llm.py | 7 ++++--- main/xiaozhi-server/core/websocket_server.py | 2 ++ 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/main/xiaozhi-server/core/connection.py b/main/xiaozhi-server/core/connection.py index 65696403..0ff1ac0e 100644 --- a/main/xiaozhi-server/core/connection.py +++ b/main/xiaozhi-server/core/connection.py @@ -95,8 +95,6 @@ class ConnectionHandler: if self.config["selected_module"]["Intent"] == 'function_call': self.use_function_call_mode = True - self.logger.bind(tag=TAG).info(f"use_function_call_mode:{self.use_function_call_mode}") - async def handle_connection(self, ws): try: # 获取并验证headers diff --git a/main/xiaozhi-server/core/handle/intentHandler.py b/main/xiaozhi-server/core/handle/intentHandler.py index da0f5c91..d651cc05 100644 --- a/main/xiaozhi-server/core/handle/intentHandler.py +++ b/main/xiaozhi-server/core/handle/intentHandler.py @@ -93,8 +93,6 @@ async def handle_user_intent(conn, text): # 使用支持function calling的聊天方法,不再进行意图分析 return False - logger.bind(tag=TAG).info(f"分析用户意图: {text}") - # 使用LLM进行意图分析 intent = await analyze_intent_with_llm(conn, text) @@ -126,7 +124,6 @@ async def analyze_intent_with_llm(conn, text): dialogue = conn.dialogue try: intent_result = await conn.intent.detect_intent(dialogue.dialogue, text) - logger.bind(tag=TAG).info(f"意图识别结果: {intent_result}") # 尝试解析JSON结果 try: diff --git a/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py b/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py index 191f73df..198fa59f 100644 --- a/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py +++ b/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py @@ -38,6 +38,7 @@ class IntentProvider(IntentProviderBase): return prompt async def detect_intent(self, dialogue_history: List[Dict], text:str) -> str: + logger.bind(tag=TAG).info(f"分析用户意图: {text}") if not self.llm: raise ValueError("LLM provider not set") @@ -55,6 +56,6 @@ class IntentProvider(IntentProviderBase): system_prompt=self.promot, user_prompt=user_prompt ) - - logger.bind(tag=TAG).info(f"Detected intent: {intent}") - return intent.strip() + intent_result = intent.strip() + logger.bind(tag=TAG).info(f"意图识别结果: {intent_result}") + return intent_result diff --git a/main/xiaozhi-server/core/websocket_server.py b/main/xiaozhi-server/core/websocket_server.py index 14d16497..9bb2963f 100644 --- a/main/xiaozhi-server/core/websocket_server.py +++ b/main/xiaozhi-server/core/websocket_server.py @@ -65,6 +65,8 @@ class WebSocketServer: server_config = self.config["server"] host = server_config["ip"] port = server_config["port"] + selected_module = self.config.get("selected_module") + self.logger.bind(tag=TAG).info(f"selected_module: {selected_module}") self.logger.bind(tag=TAG).info("Server is running at ws://{}:{}", get_local_ip(), port) self.logger.bind(tag=TAG).info("=======上面的地址是websocket协议地址,请勿用浏览器访问=======")