From 8e949370600a192221ff26414e09934a501c71de Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Fri, 11 Apr 2025 15:50:36 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20gemini=20=E6=97=B6=EF=BC=8C=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E6=95=B0=E5=B7=A5=E5=85=B7=E8=B0=83=E7=94=A8=E4=BC=9A?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E8=B0=83=E7=94=A8=E5=B7=B2=E7=BB=8F=E5=9C=A8?= =?UTF-8?q?=E8=BF=87=E5=8E=BB=E4=BC=9A=E8=AF=9D=E4=B8=AD=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E8=BF=87=E7=9A=84=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes: #863 #1150 --- astrbot/core/provider/entities.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/astrbot/core/provider/entities.py b/astrbot/core/provider/entities.py index 99824fd0..d0a9d30a 100644 --- a/astrbot/core/provider/entities.py +++ b/astrbot/core/provider/entities.py @@ -212,9 +212,9 @@ class LLMResponse: role: str, completion_text: str = "", result_chain: MessageChain = None, - tools_call_args: List[Dict[str, any]] = [], - tools_call_name: List[str] = [], - tools_call_ids: List[str] = [], + tools_call_args: List[Dict[str, any]] = None, + tools_call_name: List[str] = None, + tools_call_ids: List[str] = None, raw_completion: ChatCompletion = None, _new_record: Dict[str, any] = None, is_chunk: bool = False, @@ -229,6 +229,13 @@ class LLMResponse: tools_call_name (List[str], optional): 工具调用名称. Defaults to None. raw_completion (ChatCompletion, optional): 原始响应, OpenAI 格式. Defaults to None. """ + if tools_call_args is None: + tools_call_args = [] + if tools_call_name is None: + tools_call_name = [] + if tools_call_ids is None: + tools_call_ids = [] + self.role = role self.completion_text = completion_text self.result_chain = result_chain