From 286b5100ae3d2fe4339f56fe6d4b5e272210daa2 Mon Sep 17 00:00:00 2001
From: hit-cxf <2024111082@stu.hit.edu.cn>
Date: Mon, 06 Apr 2026 22:26:59 +0800
Subject: [PATCH] 添加微信发送图片的方法
---
aigc-director/references/send_message/wechat.md | 100 ++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 85 insertions(+), 15 deletions(-)
diff --git a/aigc-director/references/send_message/wechat.md b/aigc-director/references/send_message/wechat.md
index ce8abcb..20fcfcf 100644
--- a/aigc-director/references/send_message/wechat.md
+++ b/aigc-director/references/send_message/wechat.md
@@ -18,22 +18,92 @@
- 详情2
```
-## 示例
+---
-❌ 错误(Markdown 表格,微信不显示):
-```
-| 选项 | 说明 |
-|------|------|
-| A | xxx |
-| B | yyy |
+## 微信发送图片/视频指南
+
+### 使用方法
+
+通过 OpenClaw 的 `message` 工具发送图片或视频到微信。
+
+#### 方法一:使用 `filePath` 参数(推荐)
+
+```python
+message(
+ action="send",
+ filePath="/absolute/path/to/image.png"
+)
```
-✅ 正确(缩进编号列表):
+#### 方法二:使用 `media` 参数
+
+```python
+message(
+ action="send",
+ media="/absolute/path/to/video.mp4"
+)
```
-1. 选项A:xxx
- - 详情1
- - 详情2
-2. 选项B:yyy
- - 详情1
- - 详情2
-```
\ No newline at end of file
+
+### ⚠️ 重要提醒
+
+1. **必须使用绝对路径**
+ * ✅ 正确:`/Users/xinfanchen/image.png`
+ * ❌ 错误:`./image.png` 或 `image.png`
+2. **CDN 上传可能失败**
+ * 错误信息:`CDN upload server error: status 500`
+ * 解决方案:重试几次,或更换图片尝试。
+3. **单次发送数量**
+ * 建议一次发送 1-3 张图片/视频。
+ * 大量文件建议通过循环分批发送。
+
+### 示例代码
+
+#### 发送多张图片(循环示例)
+
+```python
+import os
+
+image_dir = "/path/to/images"
+for filename in os.listdir(image_dir):
+ if filename.endswith(".png"):
+ image_path = os.path.join(image_dir, filename)
+ message(
+ action="send",
+ filePath=image_path
+ )
+```
+
+#### 带文字说明发送
+
+**必须分两步执行**(先发文字,再发多媒体):
+
+```python
+# 1. 先发送文字说明
+message(
+ action="send",
+ message="这是角色设计图:"
+)
+
+# 2. 再发送图片
+message(
+ action="send",
+ filePath="/path/to/image.png"
+)
+```
+
+---
+
+## 常见错误与解决方法
+
+| 错误信息 | 原因 | 解决方法 |
+| :--- | :--- | :--- |
+| `CDN upload server error: status 500` | CDN 服务瞬时问题 | 等待后重试,或尝试压缩图片/更换格式 |
+| `File not found` | 提供的路径不正确 | 检查是否使用了**绝对路径**且文件确实存在 |
+| `requires target` | 缺少目标用户 | 确保在工具调用中通过 `to` 参数指定了接收者 |
+
+---
+
+## 相关工具
+
+* **message**: 发送消息和媒体文件(图片、视频、文件)。
+* **tts**: 文字转语音,生成的音频文件同样可以通过 `filePath` 发送。
\ No newline at end of file
--
Gitblit v1.8.0