feat: 增加 shell 工具自定义超时配置
This commit is contained in:
@@ -58,7 +58,10 @@ class ExecuteShellTool(FunctionTool):
|
||||
context.context.event.unified_msg_origin,
|
||||
)
|
||||
try:
|
||||
result = await sb.shell.exec(command, background=background, env=env)
|
||||
config = context.context.context.get_config()
|
||||
timeout = config.get("provider_settings", {}).get("shell_call_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)}"
|
||||
|
||||
@@ -118,6 +118,7 @@ DEFAULT_CONFIG = {
|
||||
"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
|
||||
@@ -2542,6 +2543,9 @@ CONFIG_METADATA_2 = {
|
||||
"tool_call_timeout": {
|
||||
"type": "int",
|
||||
},
|
||||
"shell_call_timeout": {
|
||||
"type": "int",
|
||||
},
|
||||
"tool_schema_mode": {
|
||||
"type": "string",
|
||||
},
|
||||
@@ -3284,6 +3288,13 @@ CONFIG_METADATA_3 = {
|
||||
"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",
|
||||
|
||||
@@ -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)"
|
||||
},
|
||||
|
||||
@@ -307,6 +307,9 @@
|
||||
"max_agent_step": {
|
||||
"description": "工具调用轮数上限"
|
||||
},
|
||||
"shell_call_timeout": {
|
||||
"description": "Shell 调用超时时间(秒)"
|
||||
},
|
||||
"tool_call_timeout": {
|
||||
"description": "工具调用超时时间(秒)"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user