From 09dee652397b58942d48cfbc5fed14496853b30f Mon Sep 17 00:00:00 2001 From: 3030332422 <3030332422@qq.com> Date: Thu, 6 Nov 2025 16:42:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86LLM?= =?UTF-8?q?=E5=9C=A8=E5=B7=A5=E5=85=B7=E8=B0=83=E7=94=A8=E6=97=B6=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=A2=AB=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=E8=A6=86?= =?UTF-8?q?=E7=9B=96=E7=9A=84=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/connection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/xiaozhi-server/core/connection.py b/main/xiaozhi-server/core/connection.py index 92043e9b..5c7baeae 100644 --- a/main/xiaozhi-server/core/connection.py +++ b/main/xiaozhi-server/core/connection.py @@ -798,9 +798,9 @@ class ConnectionHandler: if tools_call is not None and len(tools_call) > 0: tool_call_flag = True - if tools_call[0].id is not None: + if tools_call[0].id is not None and tools_call[0].id != "": function_id = tools_call[0].id - if tools_call[0].function.name is not None: + if tools_call[0].function.name is not None and tools_call[0].function.name != "": function_name = tools_call[0].function.name if tools_call[0].function.arguments is not None: function_arguments += tools_call[0].function.arguments From b6ba06ec974d7ff5f1239ee9ec8d6e90e2af206d Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Sat, 8 Nov 2025 10:08:02 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=EF=BC=9A=E6=97=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=99=BA=E6=8E=A7=E5=8F=B0=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E6=B2=A1=E6=9C=89=E5=8C=85=E5=90=AB"prompt=5Ftemplate?= =?UTF-8?q?"=E9=85=8D=E7=BD=AE=E4=BC=9A=E5=AF=BC=E8=87=B4self.config.get("?= =?UTF-8?q?prompt=5Ftemplate",=20"agent-base-prompt.txt")=E4=B8=80?= =?UTF-8?q?=E7=9B=B4=E4=B8=BANone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/utils/prompt_manager.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/main/xiaozhi-server/core/utils/prompt_manager.py b/main/xiaozhi-server/core/utils/prompt_manager.py index 1e247d07..5e3cb890 100644 --- a/main/xiaozhi-server/core/utils/prompt_manager.py +++ b/main/xiaozhi-server/core/utils/prompt_manager.py @@ -66,7 +66,9 @@ class PromptManager: def _load_base_template(self): """加载基础提示词模板""" try: - template_path = self.config.get("prompt_template", "agent-base-prompt.txt") + template_path = self.config.get("prompt_template", None) + if not template_path: + template_path = "agent-base-prompt.txt" cache_key = f"prompt_template:{template_path}" # 先从缓存获取 @@ -117,8 +119,12 @@ class PromptManager: def _get_current_time_info(self) -> tuple: """获取当前时间信息""" - from .current_time import get_current_date, get_current_weekday, get_current_lunar_date - + from .current_time import ( + get_current_date, + get_current_weekday, + get_current_lunar_date, + ) + today_date = get_current_date() today_weekday = get_current_weekday() lunar_date = get_current_lunar_date() + "\n" @@ -192,9 +198,7 @@ class PromptManager: try: # 获取最新的时间信息(不缓存) - today_date, today_weekday, lunar_date = ( - self._get_current_time_info() - ) + today_date, today_weekday, lunar_date = self._get_current_time_info() # 获取缓存的上下文信息 local_address = "" @@ -226,7 +230,8 @@ class PromptManager: emojiList=EMOJI_List, device_id=device_id, client_ip=client_ip, - *args, **kwargs + *args, + **kwargs, ) device_cache_key = f"device_prompt:{device_id}" self.cache_manager.set(