From 618be6d10850768e1fb1e4fefc45c4dd86ea5791 Mon Sep 17 00:00:00 2001 From: 3030332422 <3030332422@qq.com> Date: Thu, 17 Jul 2025 16:08:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?update:=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/core/connection.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/xiaozhi-server/core/connection.py b/main/xiaozhi-server/core/connection.py index 98bc87ed..fbe292a0 100644 --- a/main/xiaozhi-server/core/connection.py +++ b/main/xiaozhi-server/core/connection.py @@ -497,6 +497,11 @@ class ConnectionHandler: self.config["selected_module"]["LLM"] = private_config["selected_module"][ "LLM" ] + if private_config.get("VLLM", None) is not None: + self.config["VLLM"] = private_config["VLLM"] + self.config["selected_module"]["VLLM"] = private_config["selected_module"][ + "VLLM" + ] if private_config.get("Memory", None) is not None: init_memory = True self.config["Memory"] = private_config["Memory"] From f037f4c7de8aac92e0c89caea23974c3ef77262c Mon Sep 17 00:00:00 2001 From: 3030332422 <3030332422@qq.com> Date: Fri, 18 Jul 2025 11:34:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=A3=B0=E7=BA=B9?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E5=9C=BA=E6=99=AF=E4=B8=8B=E7=9A=84=E6=84=8F?= =?UTF-8?q?=E5=9B=BE=E8=AF=86=E5=88=AB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/core/handle/intentHandler.py | 10 ++++++++++ main/xiaozhi-server/core/handle/sendAudioHandle.py | 3 +++ 2 files changed, 13 insertions(+) diff --git a/main/xiaozhi-server/core/handle/intentHandler.py b/main/xiaozhi-server/core/handle/intentHandler.py index ccff094c..81911f55 100644 --- a/main/xiaozhi-server/core/handle/intentHandler.py +++ b/main/xiaozhi-server/core/handle/intentHandler.py @@ -13,6 +13,16 @@ TAG = __name__ async def handle_user_intent(conn, text): + # 预处理输入文本,处理可能的JSON格式 + try: + if text.strip().startswith('{') and text.strip().endswith('}'): + parsed_data = json.loads(text) + if isinstance(parsed_data, dict) and "content" in parsed_data: + text = parsed_data["content"] # 提取content用于意图分析 + conn.current_speaker = parsed_data.get("speaker") # 保留说话人信息 + except (json.JSONDecodeError, TypeError): + pass + # 检查是否有明确的退出命令 filtered_text = remove_punctuation_and_length(text)[1] if await check_direct_exit(conn, filtered_text): diff --git a/main/xiaozhi-server/core/handle/sendAudioHandle.py b/main/xiaozhi-server/core/handle/sendAudioHandle.py index 486e6d90..730a71a7 100644 --- a/main/xiaozhi-server/core/handle/sendAudioHandle.py +++ b/main/xiaozhi-server/core/handle/sendAudioHandle.py @@ -146,6 +146,9 @@ async def send_stt_message(conn, text): if isinstance(parsed_data, dict) and "content" in parsed_data: # 如果是包含说话人信息的JSON格式,只显示content部分 display_text = parsed_data["content"] + # 保存说话人信息到conn对象 + if "speaker" in parsed_data: + conn.current_speaker = parsed_data["speaker"] except (json.JSONDecodeError, TypeError): # 如果不是JSON格式,直接使用原始文本 display_text = text