From 88f567c25e0e0e2e78802e2b04f788fbd069ed73 Mon Sep 17 00:00:00 2001 From: yinpeng <2291314224@qq.com> Date: Sun, 15 Dec 2024 12:41:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/services/chat_service.py b/app/services/chat_service.py index 6668ada..01244aa 100644 --- a/app/services/chat_service.py +++ b/app/services/chat_service.py @@ -80,8 +80,12 @@ class ChatService: text = parts[0].get("text") elif "executableCode" in parts[0]: text = self.format_code_block(parts[0]["executableCode"]) + elif "codeExecution" in parts[0]: + text = self.format_code_block(parts[0]["codeExecution"]) elif "executableCodeResult" in parts[0]: text = self.format_execution_result(parts[0]["executableCodeResult"]) + elif "codeExecutionResult" in parts[0]: + text = self.format_execution_result(parts[0]["codeExecutionResult"]) else: text = "" @@ -291,7 +295,6 @@ class ChatService: return f"""\n```{language}\n{code}\n```\n""" - def format_execution_result(result_data: dict) -> str: """格式化执行结果输出""" outcome = result_data.get("outcome", "")