Files
wecome-openclaw-client/README.md
徐总 9cce1e76fc feat: 初始版本 - 企业微信 OpenClaw 图形配置客户端
- 基于 Electron + React 的跨平台桌面应用
- 支持多 Bot ID 和 Secret 配置
- 双 WebSocket 长连接(企业微信 + OpenClaw Gateway)
- 图形化配置界面,实时连接状态显示
- 自动重连机制
- 支持 Windows/macOS/Linux 打包

技术栈:
- Electron 28
- React 18
- @wecom/aibot-node-sdk
- electron-store 配置持久化
2026-03-09 20:30:56 +08:00

176 lines
4.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# WeCom OpenClaw Client
企业微信智能机器人图形配置客户端 - 基于 Electron 的跨平台桌面应用
## 功能特性
-**图形化配置界面** - 直观的 UI 配置 Bot ID 和 Secret
-**多 Bot 支持** - 支持配置多个企业微信智能机器人
-**双 WebSocket 长连接**
- 企业微信 WebSocket (wss://openws.work.weixin.qq.com)
- OpenClaw Gateway WebSocket
-**跨平台** - 支持 Windows、macOS、Linux
-**自动重连** - 断线自动重连机制
-**实时日志** - 连接状态和消息日志实时显示
## 技术栈
- **Electron** - 跨平台桌面应用框架
- **React** - 前端 UI 框架
- **@wecom/aibot-node-sdk** - 企业微信智能机器人 SDK
- **ws** - WebSocket 客户端
- **electron-store** - 配置持久化存储
## 快速开始
### 1. 克隆项目
```bash
git clone http://192.168.1.191:23000/toncent/wecome-openclaw-client.git
cd wecome-openclaw-client
```
### 2. 安装依赖
```bash
# 安装主项目依赖
npm install
# 安装渲染进程依赖
cd renderer
npm install
cd ..
```
### 3. 开发模式运行
```bash
npm start
```
应用会在开发模式下启动,自动打开窗口并支持热重载。
### 4. 构建发布版本
```bash
# 构建所有平台
npm run build
# 仅构建 Windows
npm run dist:win
# 仅构建 macOS
npm run dist:mac
# 仅构建 Linux
npm run dist:linux
```
构建产物在 `dist/` 目录。
## 配置说明
### 企业微信机器人配置
1. 登录 [企业微信管理后台](https://work.weixin.qq.com/)
2. 进入「应用管理」->「智能机器人」
3. 创建或选择机器人开启「API 模式」并选择「长连接」
4. 获取 BotID 和 Secret
5. 在客户端中添加机器人配置
### OpenClaw Gateway 配置
- **默认地址**: `ws://localhost:18789`
- **Token**: 如果 Gateway 启用了认证,需要填写 Token
- Token 可在 `~/.openclaw/openclaw.json` 中配置
## 项目结构
```
wecome-openclaw-client/
├── electron/ # Electron 主进程
│ ├── main.js # 主进程入口
│ └── preload.js # 预加载脚本
├── renderer/ # React 渲染进程
│ ├── public/
│ │ └── index.html
│ └── src/
│ ├── App.js # 主组件
│ ├── index.js # 入口文件
│ └── index.css # 样式
├── resources/ # 应用资源(图标等)
├── package.json
└── README.md
```
## WebSocket 协议
### 企业微信长连接
基于 [@wecom/aibot-node-sdk](https://www.npmjs.com/package/@wecom/aibot-node-sdk)
- 连接地址:`wss://openws.work.weixin.qq.com`
- 订阅命令:`aibot_subscribe`
- 心跳间隔30 秒
- 文档https://developer.work.weixin.qq.com/document/path/101463
### OpenClaw Gateway 协议
- 连接地址:`ws://localhost:18789` (可配置)
- 协议版本3
- 角色operator
- 文档https://docs.openclaw.ai/zh-CN/gateway/protocol
## 开发指南
### 添加新功能
1. **主进程功能** - 在 `electron/main.js` 中添加 IPC 处理器
2. **渲染进程 UI** - 在 `renderer/src/App.js` 中添加组件
3. **IPC 通信** - 在 `electron/preload.js` 中暴露 API
### 调试
开发模式下会自动打开 DevTools可以
- 查看 Console 日志
- 调试 React 组件
- 监控网络请求
### 打包配置
`package.json``build` 字段配置:
- 应用信息名称、ID 等)
- 各平台打包选项
- 文件包含规则
## 常见问题
### Q: 连接企业微信失败?
A: 检查 BotID 和 Secret 是否正确,确保在企业微信后台开启了长连接模式。
### Q: OpenClaw 连接失败?
A: 确保 OpenClaw Gateway 已启动 (`openclaw gateway start`),检查地址和 Token。
### Q: 配置保存在哪里?
A: 配置保存在系统标准位置:
- Windows: `%APPDATA%\wecome-openclaw-client\config.json`
- macOS: `~/Library/Application Support/wecome-openclaw-client/config.json`
- Linux: `~/.config/wecome-openclaw-client/config.json`
## 更新日志
### v1.0.0 (2026-03-09)
- 初始版本发布
- 支持多 Bot 配置
- 双 WebSocket 长连接
- 跨平台支持
## 许可证
MIT License
## 联系方式
- 项目地址http://192.168.1.191:23000/toncent/wecome-openclaw-client.git
- 技术支持sales@toncent.com.cn