Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
)
timeout = config.get("provider_settings", {}).get("shell_call_timeout", 30)
# 将timeout转为int
timeout = int(timeout)

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)}"
11 changes: 11 additions & 0 deletions astrbot/core/config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"reachability_check": False,
"max_agent_step": 30,
"tool_call_timeout": 60,
"shell_call_timeout": 30,
"tool_schema_mode": "full",
"llm_safety_mode": True,
"safety_mode_strategy": "system_prompt", # TODO: llm judge
Expand Down Expand Up @@ -2542,6 +2543,9 @@ class ChatProviderTemplate(TypedDict):
"tool_call_timeout": {
"type": "int",
},
"shell_call_timeout": {
"type": "int",
},
"tool_schema_mode": {
"type": "string",
},
Expand Down Expand Up @@ -3284,6 +3288,13 @@ class ChatProviderTemplate(TypedDict):
"provider_settings.agent_runner_type": "local",
},
},
"provider_settings.shell_call_timeout": {
"description": "Shell 工具调用超时时间(秒)",
"type": "int",
"condition": {
"provider_settings.agent_runner_type": "local",
},
},
"provider_settings.tool_call_timeout": {
"description": "工具调用超时时间(秒)",
"type": "int",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@
"max_agent_step": {
"description": "Maximum Tool Call Rounds"
},
"shell_call_timeout": {
"description": "Shell Call Timeout (s)"
},
"tool_call_timeout": {
"description": "Tool Call Timeout (seconds)"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@
"max_agent_step": {
"description": "工具调用轮数上限"
},
"shell_call_timeout": {
"description": "Shell 调用超时时间(秒)"
},
"tool_call_timeout": {
"description": "工具调用超时时间(秒)"
},
Expand Down