From bdd8597f696494c0de82c606b652682ae5805c1b Mon Sep 17 00:00:00 2001 From: CGD <3030332422@qq.com> Date: Fri, 16 May 2025 14:33:37 +0800 Subject: [PATCH] =?UTF-8?q?update:=E5=9C=A8=E8=AF=86=E5=88=AB=E5=88=B0cont?= =?UTF-8?q?inue=5Fchat=E6=84=8F=E5=9B=BE=E6=97=B6=EF=BC=8C=E6=B8=85?= =?UTF-8?q?=E7=90=86=E5=AF=B9=E8=AF=9D=E5=8E=86=E5=8F=B2=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E8=B0=83=E7=94=A8=E7=9B=B8=E5=85=B3=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/providers/intent/intent_llm/intent_llm.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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 195d058a..2a3e023f 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 @@ -218,6 +218,15 @@ class IntentProvider(IntentProviderBase): f"llm 识别到意图: {function_name}, 参数: {function_args}" ) + # 如果是继续聊天,清理工具调用相关的历史消息 + if function_name == "continue_chat": + # 保留非工具相关的消息 + clean_history = [ + msg for msg in conn.dialogue.dialogue + if msg.role not in ["tool", "function"] + ] + conn.dialogue.dialogue = clean_history + # 添加到缓存 self.intent_cache[cache_key] = { "intent": intent,