mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-15 17:30:13 +08:00
fix: remove 'boxlite' option from booter and handle error in PythonTool execution
This commit is contained in:
@@ -3,8 +3,7 @@
|
||||
"description": "Select booter to initialize the sandbox environment.",
|
||||
"type": "string",
|
||||
"options": [
|
||||
"shipyard-bay",
|
||||
"boxlite"
|
||||
"shipyard-bay"
|
||||
],
|
||||
"default": "shipyard-bay"
|
||||
},
|
||||
|
||||
@@ -35,11 +35,17 @@ class PythonTool(FunctionTool):
|
||||
try:
|
||||
result = await sb.python.exec(code, silent=silent)
|
||||
output = result.get("output", {})
|
||||
error = result.get("error", "")
|
||||
images: list[dict] = output.get("images", [])
|
||||
text: str = output.get("text", "")
|
||||
|
||||
resp = mcp.types.CallToolResult(content=[])
|
||||
|
||||
if error:
|
||||
resp.content.append(
|
||||
mcp.types.TextContent(type="text", text=f"error: {error}")
|
||||
)
|
||||
|
||||
if images:
|
||||
for img in images:
|
||||
resp.content.append(
|
||||
|
||||
Reference in New Issue
Block a user