Files
workspace/memory/2026-03-04.md
aitest 15c4480db1 Add OpenClaw workspace configuration and tools
- Add agent configuration files (AGENTS.md, USER.md, IDENTITY.md, SOUL.md)
- Add git configuration and skills management scripts
- Add frontend/backend analysis tools and reports
- Add DingTalk media sender utilities and documentation
- Fix OpenClaw runtime environment (Node.js and Python)
- Configure git remotes and push scripts
2026-03-05 13:56:59 +09:00

107 lines
3.8 KiB
Markdown
Raw Permalink 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.

# 2026-03-04 记忆
今天完成了 dingtalk-media-sender skill 的开发和调试工作。
## dingtalk-media-sender skill 开发
### 背景
用户柏方需要在钉钉群聊中发送图片、文件、视频。OpenClaw 当前的 dingtalk-api skill 只支持发送文本消息,不支持媒体文件。
### 开发过程
#### 1. 技能开发
- 创建位置:`C:\Users\ALC\.openclaw\skills\dingtalk-media-sender\`
- 使用 Qwen3-coder-480b 模型(专门用于编程任务)
- 开发了 3 个 TypeScript 脚本:
- `upload-media.ts` - 媒体文件上传
- `send-media-group.ts` - 群聊媒体消息发送
- `send-media-user.ts` - 单聊媒体消息发送
#### 2. 依赖安装
- 使用 `F:\openclaw-runtime\node-v24.14.0-win-x64` 下的 npm 进行依赖管理
- 成功安装所有需要的包
#### 3. API 问题调试
**问题描述**
- 初始实现使用 `https://api.dingtalk.com/v1.0/media/upload`
- 返回 404 错误:`InvalidAction.NotFound`
**解决方案**
- 参考钉钉官方文档:`https://open.dingtalk.com/document/orgapp-server/upload-media-files`
- 修复内容:
- API URL 修正:`api.dingtalk.com/v1.0/media/upload``oapi.dingtalk.com/media/upload`
- Token 传递方式Header `x-acs-dingtalk-access-token` → Query 参数 `access_token`
- 文件字段名:`file``media`
- 响应字段:`mediaId``media_id`
#### 4. Git 版本管理
- 使用 Git 管理代码变更
- 共创建 3 个 commit
1. `e196269` - 使用 createReadStream 修复内存问题
2. `119b012` - 修复 API endpoint 和参数格式
3. `d632f9b` - 修复 media_id 字段名读取
## 任务:日本 Yahoo 首页截图
### 执行过程
1. 使用浏览器工具打开 `https://www.yahoo.co.jp/`
2. 截取第一屏截图
3. 上传到钉钉媒体服务器
4. 尝试发送到群聊robotCode 配置问题未成功发送)
### 结果
- 图片文件路径:`C:\Users\ALC\.openclaw\workspace\yahoo_japan_screenshot.jpg`
- 文件大小87.95 KB
- media_id`@lADPD0ni1-bFMwXNB9DNARg`
- 截图时间2026-03-04 18:46 (Asia/Tokyo)
### 页面内容概览
- 天气:新宿区,今夜 15℃/5℃花粉预警非常多
- 体育:职业棒球 5 场比赛进行中
- 热搜イクラちゃん、SFL、国立博物馆、馬事公苑、宗教配慮
## 配置相关
### Qwen3 模型配置
- 模型:`nvidia/qwen/qwen3-coder-480b-a35b-instruct`
- 别名:`qwen3`
- 上下文窗口1,000,000 tokens
- 最大输出65,536 tokens
- 用途:专门用于编程任务
### OpenClaw 运行环境
- Node.js`F:\openclaw-runtime\node-v24.14.0-win-x64\node.exe`
- npm同样路径下的 npm.cmd
- 工作区:`C:\Users\ALC\.openclaw\workspace`
### 工作方式
- 用户偏好:先制定计划 → 确认 → 执行,并要求提供替代方案
- 对于编程任务:指定使用 Qwen3 模型("用 qwen3 编写..."
- 日常对话:使用默认的 GLM-4.7 模型
## dingtalk API 配置
- APP_KEY`ding4ursdp0l2giat4bj`
- APP_SECRET已配置
- 群聊 ID`cidcjYshXVtKck5LfOO9AqOJg==`
## 注意事项
### robotCode 问题
尝试使用 `4293382733` 作为 robotCode 发送群聊图片时,返回 "robot 不存在" 错误。
- 可能原因robotCode 配置不正确
- 影响:无法通过钉钉 SDK 的 orgGroupSend API 发送媒体消息到群聊
- 替代方案:使用 OpenClaw 的 message 工具发送文本消息
### 钉钉媒体上传 API 正确格式
- API URL`https://oapi.dingtalk.com/media/upload`
- Query 参数access_token必填
- Body 参数multipart/form-data
- type媒体类型image/voice/video/file
- media媒体文件注意字段名是 media 不是 file
- 返回字段media_id不是 mediaId
## 重要决策
- ACP (Agent Coding Platform) 配置尝试失败,暂时不使用独立 coder agent
- 采用在 main agent 中按需切换模型的方式,根据任务类型选择合适的模型