fix: extend run_command foreground timeout limit to 120s
This commit is contained in:
parent
070d77c070
commit
d541d9bd30
@ -10,7 +10,7 @@ MAX_UPLOAD_SIZE = 50 * 1024 * 1024
|
||||
|
||||
# 执行超时
|
||||
CODE_EXECUTION_TIMEOUT = 60
|
||||
TERMINAL_COMMAND_TIMEOUT = 30
|
||||
TERMINAL_COMMAND_TIMEOUT = 120
|
||||
SEARCH_MAX_RESULTS = 10
|
||||
|
||||
# 自动修复与工具调用限制(None 表示不限制)
|
||||
|
||||
@ -614,14 +614,14 @@ class MainTerminalToolsDefinitionMixin:
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "run_command",
|
||||
"description": "执行一次性终端命令,适合查看文件信息(file/ls/stat/iconv 等)、转换编码或调用 CLI 工具。禁止启动交互式程序。必须提供 timeout。前台模式(run_in_background=false,默认)上限60秒,超时会打断;后台模式(run_in_background=true)上限3600秒,会先等待5秒返回已有输出并继续在后台运行,完成后由系统通知。",
|
||||
"description": "执行一次性终端命令,适合查看文件信息(file/ls/stat/iconv 等)、转换编码或调用 CLI 工具。禁止启动交互式程序。必须提供 timeout。前台模式(run_in_background=false,默认)上限120秒,超时会打断;后台模式(run_in_background=true)上限3600秒,会先等待5秒返回已有输出并继续在后台运行,完成后由系统通知。",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": self._inject_intent({
|
||||
"command": {"type": "string", "description": "终端命令"},
|
||||
"timeout": {
|
||||
"type": "number",
|
||||
"description": "超时时长(秒),必填。前台最大60;后台最大3600。"
|
||||
"description": "超时时长(秒),必填。前台最大120;后台最大3600。"
|
||||
},
|
||||
"run_in_background": {
|
||||
"type": "boolean",
|
||||
|
||||
@ -1182,10 +1182,10 @@ class MainTerminalToolsExecutionMixin:
|
||||
"success": False,
|
||||
"error": "timeout 参数必填且需大于0"
|
||||
}
|
||||
elif float(timeout_value) > 60:
|
||||
elif float(timeout_value) > 120:
|
||||
result = {
|
||||
"success": False,
|
||||
"error": "前台模式下 timeout 最大为 60 秒"
|
||||
"error": "前台模式下 timeout 最大为 120 秒"
|
||||
}
|
||||
else:
|
||||
result = await self.terminal_ops.run_command(
|
||||
|
||||
@ -314,7 +314,7 @@ class TerminalOperator:
|
||||
"return_code": -1
|
||||
}
|
||||
|
||||
# 默认10s,上限30s
|
||||
# 默认10s,上限由 TERMINAL_COMMAND_TIMEOUT 控制
|
||||
timeout = self._clamp_timeout(timeout, default=10, max_limit=TERMINAL_COMMAND_TIMEOUT)
|
||||
|
||||
print(f"{OUTPUT_FORMATS['terminal']} 执行命令: {command}")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user