Merge pull request #6434 from a61995987/fix-修正shell工具未正确应用工具调用超时的问题
Fix 修正shell工具未正确应用工具调用超时的问题
This commit is contained in:
@@ -58,7 +58,16 @@ 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(
|
||||
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)}"
|
||||
|
||||
Reference in New Issue
Block a user