mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-05-30 20:59:45 +08:00
添加代码执行和执行结果处理功能
This commit is contained in:
@@ -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", "")
|
||||
|
||||
Reference in New Issue
Block a user