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