TUI 是 OpenClaw 的终端聊天界面,支持 Gateway 模式和本地嵌入模式。

快速启动

# Gateway 模式
openclaw gateway          # 先启动 Gateway
openclaw tui              # 连接本地 Gateway
 
# 远程 Gateway
openclaw tui --url ws://<host>:<port> --token <gateway-token>
 
# 本地模式(无 Gateway)
openclaw chat             # 或 openclaw tui --local

openclaw chat、openclaw terminal 是 openclaw tui --local 的别名。

界面布局

  • Header:连接 URL、当前 agent、当前 session
  • Chat log:用户消息、助手回复、系统通知、工具卡片
  • Status line:连接/运行状态
  • Footer:连接状态 + agent + session + model + 功能开关 + token 计数
  • Input:带自动补全的文本编辑器

键盘快捷键

快捷键功能
Enter发送消息
Esc中止活跃运行
Ctrl+C清空输入(按两次退出)
Ctrl+L模型选择器
Ctrl+GAgent 选择器
Ctrl+PSession 选择器
Ctrl+O切换工具输出展开
Ctrl+T切换思考可见性

Slash 命令

/agent <id>    /session <key>    /model <provider/model>
/think <level> /fast <on|off>    /verbose <on|off>
/new           /reset            /abort
/deliver <on|off>

本地 Shell 命令

以 ! 前缀运行本地 shell 命令(每 session 提示一次授权):

!openclaw config file
!openclaw config validate
!openclaw doctor

配置修复工作流

openclaw chat
# 在 TUI 中:
# 1. 询问 agent 检查配置
# 2. 用 !openclaw config validate 验证
# 3. 用 openclaw config set 应用修改
# 4. 用 !openclaw doctor --fix 执行自动修复

选项

选项说明
--local使用本地嵌入 agent 运行时
--url <url>Gateway WebSocket URL
--token <token>Gateway token
--session <key>Session 键(默认 main)
--deliver开启回复投递(默认关闭)
--history-limit <n>加载历史条数(默认 200)

相关页面