From 38d22ff92ea70c6cf86a4c5cd00989aab832b766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=BD=AE?= Date: Mon, 1 Dec 2025 16:18:53 +0800 Subject: [PATCH] =?UTF-8?q?final=5Fmessages=20=E7=A7=BB=E9=99=A4=20tool=5F?= =?UTF-8?q?call=20=E5=92=8C=20tool=5Fresponse=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/fastapi_utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/utils/fastapi_utils.py b/utils/fastapi_utils.py index 0f2eb5b..cf42257 100644 --- a/utils/fastapi_utils.py +++ b/utils/fastapi_utils.py @@ -267,13 +267,14 @@ def process_messages(messages: List[Dict], language: Optional[str] = None) -> Li assistant_msg = {"role": ASSISTANT} if assistant_content.strip(): assistant_msg["content"] = assistant_content.strip() - if function_calls: - # 如果有多个 function_call,只取第一个(兼容原有逻辑) - assistant_msg["function_call"] = function_calls[0] + + # 如果有多个 function_call,只取第一个(兼容原有逻辑) + # if function_calls: + # assistant_msg["function_call"] = function_calls[0] final_messages.append(assistant_msg) # 添加所有 tool_responses 作为 function 消息 - final_messages.extend(tool_responses) + # final_messages.extend(tool_responses) else: # 非 assistant 消息或不包含 [TOOL_RESPONSE] 的消息直接添加 final_messages.append(msg)