Skip to content
11 changes: 10 additions & 1 deletion astrbot/core/computer/tools/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,16 @@ async def call(
context.context.event.unified_msg_origin,
)
try:
result = await sb.shell.exec(command, background=background, env=env)
config = context.context.context.get_config(
umo=context.context.event.unified_msg_origin
)
try:
timeout = int(config.get("provider_settings", {}).get("tool_call_timeout", 30))
except (ValueError, TypeError):
timeout = 30
result = await sb.shell.exec(
command, background=background, env=env, timeout=timeout
)
return json.dumps(result)
except Exception as e:
return f"Error executing command: {str(e)}"