返回首页

微信 AI 机器人 — OpenClaw 方案

在已安装 Jerry OpenClaw Bridge 的基础上,增加微信聊天功能。

微信 OpenClaw Claude Opus GPT-5.4

能做什么?

通过微信语音或打字与 AI 对话,随时随地完成工作:

  • 语音下达开发任务 — 走路、开车时语音发消息,AI 自动编写代码、修 Bug
  • 随时问答 — 技术方案讨论、代码审查、知识检索
  • 文档翻译与写作 — 发一段文字,AI 帮你翻译、润色、总结
  • 数据分析 — 发截图或数据,AI 帮你分析解读
  • 团队共享 — 多人发消息给同一个机器人,共用 Copilot 额度

发挥你的想象力 — 任何能用文字或语音描述的任务,都可以交给 AI。

前提

开始之前,请确认以下组件(一键安装脚本会自动处理):

  • Node.js ≥ 22(macOS 推荐 brew install node@22,Linux 参考 nodejs.org
  • GitHub Copilot CLI(已登录)
  • Jerry OpenClaw Bridge(已激活、已运行)
  • OpenClaw ≥ 2026.4.1(通过 npm install -g openclaw@latest 安装,旧版会导致微信插件模块加载失败)
如果使用 Homebrew 安装的 Node.js 和 npm,请确保 OpenClaw 也通过同一个 npm 安装,避免插件路径冲突。安装脚本会自动检测并处理此问题。
提示:一键安装脚本 会自动安装系统级 Node.js + OpenClaw + Gateway,并检测版本冲突。推荐直接使用一键安装完成所有配置。

一键安装

以下命令自动完成所有配置(Node.js、OpenClaw、Copilot CLI、Jerry Bridge、微信插件):

macOS / Linux:

$curl -fsSL https://mcp-ai-jerry.pages.dev/install-wechat-bot.sh | bash

Windows (PowerShell):

⚠️ 必须以「管理员身份」运行 PowerShell(开始菜单 → 右键 PowerShell → 以管理员身份运行),否则 winget 安装 Node.js、注册计划任务等步骤会失败。

>irm https://mcp-ai-jerry.pages.dev/install-wechat-bot.ps1 | iex

Windows 版同样自动安装 Node.js、OpenClaw、Copilot CLI、Jerry Bridge、微信插件并配置开机自启。

测试机器人

一键安装脚本已自动完成 微信插件安装扫码登录Gateway 后台服务。安装完成后,用微信号给机器人发一条消息即可测试。

需要重新扫码?(如微信掉线)执行:
$openclaw channels login --channel openclaw-weixin
注意:需要先完成激活,命令:
$jerry-openclaw activate -k 激活码
否则无法收到 AI 回复。

微信中的命令

命令说明
/opus / /opus45切换到 Claude Opus 4.5(3x,需 Pro 以上)
/opus47切换到 Claude Opus 4.7(仅 Pro+,7.5x;启动失败自动降级到 Sonnet 4.6 → 4.5 → 4 → GPT-5.4)
/sonnet切换到 Claude Sonnet 4.6
/haiku切换到 Claude Haiku 4.5(快速)
/gpt / /gpt54切换到 GPT-5.4
/gpt5.5 / /gpt55切换到 GPT-5.5(仅 Pro+;不可用时自动降级到 GPT-5.4)
/codex切换到 GPT-5.3 Codex
/gpt52切换到 GPT-5.2
/mini切换到 GPT-5.4 Mini(快速)
/auto切换到 Copilot Auto(显式自动选模,遇到 latest 周限额时推荐)
/default切换回本地 Copilot 默认配置(不显式指定模型)
/reset /新对话重置当前对话
/restart-time N设置每日自动重启时间(0-23),默认关闭
/restart-time off关闭每日自动重启
/model /模型查看当前使用的模型
/help /帮助显示帮助信息
提示:直接发送普通消息即可与 AI 对话,无需任何前缀。斜杠命令仅用于切换模型和管理会话。

服务管理命令

Jerry 微信机器人由两个服务组成:Jerry Bridge(AI 模型桥接,端口 18802)和 OpenClaw Gateway(消息网关,端口 18789)。

macOS(launchd) — 点击展开

服务名:com.jerry.openclaw-bridgeai.openclaw.gateway

操作命令
查看状态launchctl list | grep -E "jerry|openclaw"
停止 Bridgelaunchctl bootout gui/$(id -u)/com.jerry.openclaw-bridge
启动 Bridgelaunchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.jerry.openclaw-bridge.plist
重启 Bridgelaunchctl bootout gui/$(id -u)/com.jerry.openclaw-bridge ; launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.jerry.openclaw-bridge.plist
停止 Gatewaylaunchctl bootout gui/$(id -u)/ai.openclaw.gateway
启动 Gatewaylaunchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.openclaw.gateway.plist
重启 Gatewaylaunchctl bootout gui/$(id -u)/ai.openclaw.gateway ; launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.openclaw.gateway.plist
禁用开机启动launchctl disable gui/$(id -u)/com.jerry.openclaw-bridge
恢复开机启动launchctl enable gui/$(id -u)/com.jerry.openclaw-bridge
查看日志tail -f /tmp/jerry-bridge.log
Gateway 日志tail -f ~/.openclaw/logs/gateway.log
健康检查curl -s http://127.0.0.1:18802/health
提示:bootout 是停止 + 卸载(KeepAlive 不会自动重启);如果只想暂停但下次登录仍自启,用 bootout 即可,要永久禁用需加 disable
Linux(systemd) — 点击展开

服务名:jerry-openclaw(用户级或系统级取决于安装方式)

操作用户级(非 root 安装)系统级(root 安装)
查看状态systemctl --user status jerry-openclawsudo systemctl status jerry-openclaw
停止systemctl --user stop jerry-openclawsudo systemctl stop jerry-openclaw
启动systemctl --user start jerry-openclawsudo systemctl start jerry-openclaw
重启systemctl --user restart jerry-openclawsudo systemctl restart jerry-openclaw
禁用自启systemctl --user disable jerry-openclawsudo systemctl disable jerry-openclaw
启用自启systemctl --user enable jerry-openclawsudo systemctl enable jerry-openclaw
查看日志journalctl --user -u jerry-openclaw -ftail -f /tmp/jerry-bridge.log

Gateway 管理:openclaw gateway start / openclaw gateway stop

Windows(计划任务 + PowerShell) — 点击展开

任务名:JerryOpenClawBridge

操作PowerShell 命令
查看状态Get-ScheduledTask -TaskName "JerryOpenClawBridge" | Select State
停止 BridgeStop-Process -Name jerry-openclaw -Force -ErrorAction SilentlyContinue
启动 BridgeStart-ScheduledTask -TaskName "JerryOpenClawBridge"
重启 BridgeStop-Process -Name jerry-openclaw -Force -ErrorAction SilentlyContinue; Start-ScheduledTask -TaskName "JerryOpenClawBridge"
启动 GatewayStart-Process openclaw -ArgumentList 'gateway','run' -WindowStyle Hidden
停止 Gatewayopenclaw gateway stop
重新扫码登录openclaw channels login --channel openclaw-weixin
禁用自启Disable-ScheduledTask -TaskName "JerryOpenClawBridge"
启用自启Enable-ScheduledTask -TaskName "JerryOpenClawBridge"
卸载任务Unregister-ScheduledTask -TaskName "JerryOpenClawBridge" -Confirm:$false
查看 Bridge 日志Get-Content $env:TEMP\jerry-bridge.log -Tail 50 -Wait
查看错误日志Get-Content $env:TEMP\jerry-bridge.err.log -Tail 50
健康检查curl.exe http://127.0.0.1:18802/health

一键升级

升级到最新版 Bridge,不影响 Copilot CLI 登录、激活码、OpenClaw 配置和微信网关:

macOS / Linux:

$curl -fsSL https://mcp-ai-jerry.pages.dev/update-openclaw.sh | bash

Windows (PowerShell):

PS>irm https://mcp-ai-jerry.pages.dev/update-openclaw.ps1 | iex

脚本会自动下载对应平台二进制、替换旧版、重启后台服务。耗时约 10 秒。

完全卸载

一键卸载(macOS / Linux):

$curl -fsSL https://mcp-ai-jerry.pages.dev/uninstall-wechat-bot.sh | bash

一键卸载(Windows):

⚠️ 必须以「管理员身份」运行 PowerShell(开始菜单 → 右键 PowerShell → 以管理员身份运行),否则计划任务删除会失败。

PS>irm https://mcp-ai-jerry.pages.dev/uninstall-wechat-bot.ps1 | iex

卸载 Jerry Bridge + OpenClaw + 微信插件 + Gateway 服务,不影响 Copilot CLI 和登录状态。

手动卸载命令(点击展开)

macOS:

# 停止并移除服务
launchctl bootout gui/$(id -u)/com.jerry.openclaw-bridge 2>/dev/null
rm ~/Library/LaunchAgents/com.jerry.openclaw-bridge.plist
openclaw gateway stop 2>/dev/null
# 删除二进制
rm ~/.local/bin/jerry-openclaw

Linux:

# 用户级
systemctl --user stop jerry-openclaw
systemctl --user disable jerry-openclaw
rm ~/.config/systemd/user/jerry-openclaw.service
systemctl --user daemon-reload
openclaw gateway stop 2>/dev/null
rm ~/.local/bin/jerry-openclaw

Windows (PowerShell):

Stop-Process -Name jerry-openclaw -Force -ErrorAction SilentlyContinue
Unregister-ScheduledTask -TaskName "JerryOpenClawBridge" -Confirm:$false
Remove-Item "$env:LOCALAPPDATA\jerry-openclaw" -Recurse -Force

常见问题

openclaw channels login 卡住没反应 / Maximum call stack size exceeded?

通常是 Node.js 版本太旧或安装方式不兼容。请按以下步骤修复:

# 1. 确保 Node.js ≥ 22
brew install node@22        # macOS
# 或 Linux: curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash - && sudo apt install -y nodejs

# 2. 卸载 Homebrew 版 OpenClaw(如果有的话)
brew uninstall openclaw 2>/dev/null

# 3. 用 npm 重装 OpenClaw
npm install -g openclaw@latest

# 4. 重装微信插件
rm -rf ~/.openclaw/extensions/openclaw-weixin
openclaw plugins install @tencent-weixin/openclaw-weixin

# 5. 重新登录
openclaw channels login --channel openclaw-weixin
终端看不清二维码 / 二维码无法扫描?

登录时终端会同时输出一个 浏览器链接(形如 https://liteapp.weixin.qq.com/q/...),可以复制到浏览器打开后再用微信扫码,也可以直接把这个链接发给微信好友代扫。

微信掉线了怎么办?

运行 openclaw channels login --channel openclaw-weixin 重新扫码。

出现“Copilot 进程意外退出”或一直显示“等待 Jerry 服务器启动...”怎么办?

先直接重新发送上一条消息。如果只是 Copilot 子进程异常退出,Jerry Bridge 会在下一条消息时自动重新拉起它。

如果 Bridge 当前没有卡住,建议发送 /reset,再发送正常消息。/reset 会清掉当前 Copilot/Jerry 会话,是推荐的手动恢复方式。

但如果机器人回复的已经是“正在忙:等待 Jerry 服务器启动...”,说明当前请求还卡在 Jerry 启动阶段,新的聊天命令会先被 busy 状态挡住,这时 /reset 往往也不会立刻生效。

遇到这种情况,不要继续在微信里反复发命令,应该直接重启 Jerry Bridge 和 OpenClaw Gateway:

macOS:

launchctl bootout gui/$(id -u)/com.jerry.openclaw-bridge
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.jerry.openclaw-bridge.plist
launchctl bootout gui/$(id -u)/ai.openclaw.gateway
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.openclaw.gateway.plist

Linux:

# 非 root 安装(用户级 systemd)
systemctl --user restart jerry-openclaw

# root 安装(系统级 systemd)
sudo systemctl restart jerry-openclaw

# Gateway
openclaw gateway restart

Windows(PowerShell):

Stop-Process -Name jerry-openclaw -Force -ErrorAction SilentlyContinue
Start-ScheduledTask -TaskName "JerryOpenClawBridge"
openclaw gateway restart

如果 openclaw gateway restart 失败,再执行 openclaw gateway installopenclaw gateway start 重新装回后台服务。更多状态查看和日志命令见服务管理

可以用 WhatsApp 代替微信吗?

可以,WhatsApp 更稳定。安装插件 openclaw plugins install @openclaw/whatsapp,然后 openclaw channels login --channel whatsapp 扫码即可。