OpenClaw 是一个强大的 AI 助手平台,支持多种聊天软件集成,可以通过命令行、网页界面或聊天软件与 AI 进行交互。

经过一番折腾,咱也算是玩上了。但感觉使用场景有限,更多玩法和可能性还需社区进一步迭代。


安装与初始化

  • 使用一键安装脚本:
1
curl -fsSL https://openclaw.ai/install.sh | bash
  • 初始化配置
1
openclaw onboard

基本使用

  • 启动和管理主程序
1
2
3
4
5
6
7
8
9
10
11
# 启动 gateway
openclaw gateway start

# 重启 gateway
openclaw gateway restart

# 停止 gateway
openclaw gateway stop

# 查看运行状态
openclaw gateway status
  • 使用 TUI(终端用户界面)进行对话
1
openclaw tui
  • 启动网页版 Dashboard
1
openclaw dashboard
  • 查看和修改配置
1
2
3
4
5
# 交互式配置向导
openclaw config

# 交互式配置凭证和设备
openclaw configure
  • 状态检查和健康诊断
1
2
3
4
5
6
7
8
# 显示频道健康状态和最近会话
openclaw status

# 获取 gateway 健康状态
openclaw health

# 健康检查和快速修复
openclaw doctor
  • 查看日志
1
openclaw logs
  • 插件管理
1
2
# 列出已安装的插件
openclaw plugins list
  • 频道管理
1
2
# 查看频道状态
openclaw channels status
  • 会话管理
1
2
# 列出存储的对话会话
openclaw sessions
  • 更新工具
1
openclaw update
  • 管理聊天软件登录
1
2
3
4
5
# 退出当前登录的聊天软件
openclaw channels logout

# 登录到 channel
openclaw channels login

配置联网搜索

OpenClaw 支持通过 Brave Search API 进行联网搜索。

1
openclaw configure --section web

系统会提示您输入 Brave API 密钥,输入后保存即可。

  • 配置完成后重启 OpenClaw 服务
1
openclaw gateway restart

之后 OpenClaw 就可以使用 web_search 工具进行联网搜索了。


飞书集成

  1. 安装飞书插件
1
openclaw plugins install @m1heng-clawd/feishu
  1. 去飞书开放平台的开发者后台:https://open.feishu.cn/app
  • 创建企业自建应用
  • 权限管理 - 开通权限/批量导入权限
  • 发布一个版本 1.0.0
  • 在“凭证与基础信息”中找到 App ID 和 App Secret 并复制
  1. 在终端中输入:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    # 配置 APP ID
    openclaw config set channels.feishu.appId "你的APP ID"

    # 配置 APP Secret
    openclaw config set channels.feishu.appSecret "你的APP Secret"

    # 开启飞书 channel 并设置连接方式为 websocket
    openclaw config set channels.feishu.enabled true
    openclaw config set channels.feishu.connectionMode websocket

    # 重启 OpenClaw
    openclaw gateway restart
  2. 在飞书开发者平台继续进行相关设置

  • 修改事件订阅方式:长连接
  • 添加事件:接受消息v2.0
  • 发布一个版本 1.0.1
  1. 发飞书消息后,openclaw 会提示
    1
    2
    OpenClaw: access not configured. Your Feishu user id: ou_79712b82a98a8a86a18fbcf9bd906906 Pairing  
    code: TBA2Z5VQ Ask the bot owner to approve with: openclaw pairing approve feishu TBA2Z5VQ
    在终端中再输入以下命令即可
    1
    openclaw pairing approve feishu TBA2Z5VQ

常见问题

  • Gateway 连接失败:即使是 loopback 本地绑定,OpenClaw 也要求配置认证 token
1
2
3
4
5
# 生成并设置认证 token
openclaw config set gateway.auth.token "$(openssl rand -hex 32)"

# 重启 gateway
openclaw gateway restart

参考资料