fix: update prompt timeouts and pip mirror

This commit is contained in:
JOJO 2026-01-06 16:35:11 +08:00
parent 60e63595a6
commit a089cdd853
3 changed files with 58 additions and 40 deletions

View File

@ -1249,22 +1249,22 @@ class MainTerminal:
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
tools = [
{
"type": "function",
"function": {
"name": "sleep",
"description": "等待指定的秒数。用于等待长时间操作完成,如安装包、编译、服务启动等。当终端或进程需要时间完成操作时使用",
"parameters": {
"type": "object",
"properties": self._inject_intent({
"seconds": {
"type": "number",
"description": "等待的秒数,可以是小数(如2.5秒。建议范围0.5-30秒"
},
"reason": {
"type": "string",
"description": "等待的原因说明(可选)"
}
{
"type": "function",
"function": {
"name": "sleep",
"description": "等待指定的秒数,用于短暂延迟/节奏控制(例如让终端产生更多输出、或在两次快照之间留出间隔)。命令是否完成必须用 terminal_snapshot 确认;需要控制命令最长运行时间请使用 run_command/terminal_input 的 timeout",
"parameters": {
"type": "object",
"properties": self._inject_intent({
"seconds": {
"type": "number",
"description": "等待的秒数,可以是小数(如0.2秒。建议范围0.1-10秒"
},
"reason": {
"type": "string",
"description": "等待的原因说明(可选)"
}
}),
"required": ["seconds"]
}
@ -1490,16 +1490,16 @@ class MainTerminal:
}
}
},
{
"type": "function",
"function": {
"name": "terminal_input",
"description": "向活动终端发送命令或输入。禁止启动会占用终端界面的程序python/node/nano/vim 等);如遇卡死请结合 terminal_snapshot 并使用 terminal_reset 恢复。必须提供 timeout,超时仅终止当前命令,终端保持可用",
"parameters": {
"type": "object",
"properties": self._inject_intent({
"command": {
"type": "string",
{
"type": "function",
"function": {
"name": "terminal_input",
"description": "向活动终端发送命令或输入。禁止启动会占用终端界面的程序python/node/nano/vim 等);如遇卡死请结合 terminal_snapshot 并使用 terminal_reset 恢复。必须提供 timeout;一旦超时,当前命令**一定会被打断**且无法继续执行(需要重新运行),终端会话本身保持可用。若不确定上一条命令是否结束,先用 terminal_snapshot 确认后再继续输入",
"parameters": {
"type": "object",
"properties": self._inject_intent({
"command": {
"type": "string",
"description": "要执行的命令或发送的输入"
},
"session_name": {
@ -1631,13 +1631,13 @@ class MainTerminal:
},
{
"type": "function",
"function": {
"name": "run_python",
"description": "执行一次性 Python 脚本,可用于处理二进制或非 UTF-8 文件(如 Excel、Word、PDF、图片或进行数据分析与验证。必须提供 timeout最长60秒超时会尝试中断并返回已捕获输出。",
"parameters": {
"type": "object",
"properties": self._inject_intent({
"code": {"type": "string", "description": "Python代码"},
"function": {
"name": "run_python",
"description": "执行一次性 Python 脚本,可用于处理二进制或非 UTF-8 文件(如 Excel、Word、PDF、图片或进行数据分析与验证。必须提供 timeout最长60秒一旦超时,脚本会被打断且无法继续执行(需要重新运行),并返回已捕获输出。",
"parameters": {
"type": "object",
"properties": self._inject_intent({
"code": {"type": "string", "description": "Python代码"},
"timeout": {
"type": "number",
"description": "超时时长必填最大60"
@ -1649,13 +1649,13 @@ class MainTerminal:
},
{
"type": "function",
"function": {
"name": "run_command",
"description": "执行一次性终端命令适合查看文件信息file/ls/stat/iconv 等)、转换编码或调用 CLI 工具。禁止启动交互式程序;对已聚焦文件仅允许使用 grep -n 等定位命令。必须提供 timeout最长30秒,超时会尝试中断并返回已捕获输出输出超过10000字符将被截断或拒绝。",
"parameters": {
"type": "object",
"properties": self._inject_intent({
"command": {"type": "string", "description": "终端命令"},
"function": {
"name": "run_command",
"description": "执行一次性终端命令适合查看文件信息file/ls/stat/iconv 等)、转换编码或调用 CLI 工具。禁止启动交互式程序;对已聚焦文件仅允许使用 grep -n 等定位命令。必须提供 timeout最长30秒;一旦超时,命令**一定会被打断**且无法继续执行(需要重新运行),并返回已捕获输出输出超过10000字符将被截断或拒绝。",
"parameters": {
"type": "object",
"properties": self._inject_intent({
"command": {"type": "string", "description": "终端命令"},
"timeout": {
"type": "number",
"description": "超时时长必填最大30"

View File

@ -121,6 +121,15 @@
- 不要在终端里启动 python、node、vim 这类会占用界面的程序
- 如果终端卡住了,用 terminal_reset 重启
**⏱️ 时间/超时/状态确认(硬性规则)**
- 需要控制“命令最多跑多久”,请使用 `run_command` / `terminal_input` 的 `timeout` 参数;一旦超时,命令**一定会被打断**、无法继续执行(需要重新运行)。
- 禁止凭感觉判断“我觉得下载/编译应该已经完成了/还没完成”;必须使用 `terminal_snapshot` 获取终端快照来确认真实情况。
- 若不确定某终端里**上一条命令是否已结束**,禁止在**同一终端**继续输入任何内容(可能导致终端彻底卡死);应先用 `terminal_snapshot` 检查,或在**其他终端会话**里用 `ps/pgrep/ls` 等命令验证后再继续操作。
**🐍 pip 安装依赖(默认清华镜像)**
- 使用 pip 下载/安装时,默认加镜像参数:`pip install <包> -i https://pypi.tuna.tsinghua.edu.cn/simple`
- 安装 requirements`pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple`
## 常用命令示例
### 文件查看

View File

@ -141,6 +141,15 @@
- 不要在终端里启动 python、node、vim 这类会占用界面的程序
- 如果终端卡住了,用 terminal_reset 重启
**⏱️ 时间/超时/状态确认(硬性规则)**
- 需要控制“命令最多跑多久”,请使用 `run_command` / `terminal_input` 的 `timeout` 参数;一旦超时,命令**一定会被打断**、无法继续执行(需要重新运行)。
- 禁止凭感觉判断“我觉得下载/编译应该已经完成了/还没完成”;必须使用 `terminal_snapshot` 获取终端快照来确认真实情况。
- 若不确定某终端里**上一条命令是否已结束**,禁止在**同一终端**继续输入任何内容(可能导致终端彻底卡死);应先用 `terminal_snapshot` 检查,或在**其他终端会话**里用 `ps/pgrep/ls` 等命令验证后再继续操作。
**🐍 pip 安装依赖(默认清华镜像)**
- 使用 pip 下载/安装时,默认加镜像参数:`pip install <包> -i https://pypi.tuna.tsinghua.edu.cn/simple`
- 安装 requirements`pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple`
## 常用命令示例
### 文件查看