feat: OpenClaw Gateway 配置和连接优化 #1
Reference in New Issue
Block a user
No description provided.
Delete Branch "weworkdev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
变更内容
新增功能
修复内容
代码优化
测试情况
提交历史
f2da800docs: 添加 Pull Request 模板df6383ffeat: 添加 OpenClaw 详细连接日志87d482ffix: 移除清理斜杠按钮b06ef2dfeat: 添加详细的 OpenClaw 连接日志e3d62edfix: OpenClaw 连接改为主动发送 connect 请求fddd2b2feat: 新增 Gateway 配置保存和测试消息功能问题: - Gateway 返回 INVALID_REQUEST 错误 - schema 验证失败:client.id, publicKey, signature 不符合要求 修复: 1. client.id: 'wecome-client' → 'operator' (必须是常量值) 2. publicKey: 空字符串 → 临时生成的 hex 字符串 (不能为空) 3. signature: 空字符串 → 临时生成的 hex 字符串 (不能为空) 错误日志: { "code": "INVALID_REQUEST", "message": "invalid connect params: at /client/id: must be equal to constant at /device/publicKey: must NOT have fewer than 1 characters at /device/signature: must NOT have fewer than 1 characters" } 现在应该能成功连接到 OpenClaw Gateway 了!修复 OpenClaw Gateway 连接: - 严格按照协议文档编写 connect 请求 - client.id: 'cli' (客户端标识) - client.mode: 'operator' (角色) - role: 'operator' - 生成随机的 publicKey 和 signature (通过 schema 验证) - 添加详细的连接日志 新增图片/文件下载功能: - downloadFile() - 下载企业微信媒体文件 - saveMediaFile() - 保存到本地媒体目录 - forwardMessageToOpenClaw() - 下载并转发图片/文件 - 支持 image 消息类型 - 支持 file 消息类型 - 支持 voice 消息(语音转文字) - 支持 mixed 图文混排消息 媒体文件保存位置: - Windows: %APPDATA%\wecome-openclaw-client\media\inbound 转发到 OpenClaw 的格式: { "channel": "wecom", "message": { "text": "文本内容", "media": [ { "type": "image", "path": "/path/to/image.jpg" }, { "type": "file", "path": "/path/to/file.pdf" } ] } } 现在 OpenClaw 可以看到图片和文件的实际内容了!关键修复: - 之前错误:直接发送 message.inbound 事件 - 现在正确:使用 Gateway 的 chat.send 方法 Gateway API 调用: { "type": "req", "method": "chat.send", "params": { "sessionKey": "wecom:group:chatId", "message": "文本内容", "attachments": [{"type": "image", "path": "..."}], "deliver": true, "idempotencyKey": "messageId" } } 会话管理: - sessionKey 格式:wecom:chatType:chatId - 例如:wecom:group:123456789 或 wecom:direct:zhangsan - OpenClaw 会自动创建或复用会话 媒体文件处理: - 下载企业微信图片/文件 - 保存到本地媒体目录 - 通过 attachments 参数传递给 chat.send 这样才符合 OpenClaw Gateway 协议规范!- 修改 version 为 2026.3.10(semver 兼容格式) - 统一所有安装包命名格式:${productName}-${version}-${platform}.${ext} - Windows: WeCom OpenClaw Client-2026.3.10-win64.zip - Linux: WeCom OpenClaw Client-2026.3.10-linux.AppImageView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.