From 7a832951dfc53e187a97e732051b5e7216505966 Mon Sep 17 00:00:00 2001 From: yinpeng <2291314224@qq.com> Date: Sun, 15 Dec 2024 13:39:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=92=8C=E6=89=A7=E8=A1=8C=E7=BB=93=E6=9E=9C=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/chat_service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/chat_service.py b/app/services/chat_service.py index 01244aa..9027f0e 100644 --- a/app/services/chat_service.py +++ b/app/services/chat_service.py @@ -145,7 +145,7 @@ class ChatService: if tools is None: tools = [] - if settings.TOOLS_CODE_EXECUTION_ENABLED: + if settings.TOOLS_CODE_EXECUTION_ENABLED and not model.endswith("-search"): tools.append({"code_execution": {}}) if model.endswith("-search"): tools.append({"googleSearch": {}}) @@ -295,8 +295,8 @@ class ChatService: return f"""\n```{language}\n{code}\n```\n""" - def format_execution_result(result_data: dict) -> str: + def format_execution_result(self, result_data: dict) -> str: """格式化执行结果输出""" outcome = result_data.get("outcome", "") output = result_data.get("output", "").strip() - return f"""\n【执行结果】\n{output}\n""" + return f"""\n【执行结果】\noutcome: {outcome}\noutput: {output}\n"""