diff --git a/skills/qqbot-cron/SKILL.md b/skills/qqbot-cron/SKILL.md index 97e5c20..e53db22 100644 --- a/skills/qqbot-cron/SKILL.md +++ b/skills/qqbot-cron/SKILL.md @@ -46,47 +46,6 @@ metadata: {"clawdbot":{"emoji":"⏰"}} --- -## 📦 结构化载荷格式(新) - -> **重要**:定时提醒现在支持结构化载荷格式,AI 只需输出 JSON,代码层会自动处理 Base64 编码。 - -### 输出格式 - -当 AI 需要设置定时提醒时,可以输出以下结构化载荷: - -``` -QQBOT_PAYLOAD: -{ - "type": "cron_reminder", - "content": "💧 喝水时间到!", - "targetType": "c2c", - "targetAddress": "xxx_user_openid", - "originalMessageId": "msg_xxx_123" -} -``` - -### 字段说明 - -| 字段 | 类型 | 必填 | 说明 | -|------|------|------|------| -| `type` | string | ✅ | 固定为 `"cron_reminder"` | -| `content` | string | ✅ | 提醒内容,触发时直接发送给用户 | -| `targetType` | string | ✅ | 目标类型:`"c2c"`(私聊)或 `"group"`(群聊) | -| `targetAddress` | string | ✅ | 目标地址:user_openid 或 group_openid | -| `originalMessageId` | string | ❌ | 原始消息 ID(可选,用于追踪) | - -### 处理流程 - -1. AI 输出 `QQBOT_PAYLOAD:` + JSON 格式的载荷 -2. 代码层检测并解析载荷 -3. 代码层将 JSON 编码为 Base64 -4. 代码层调用 `openclaw cron add --message "QQBOT_CRON:{base64}"` -5. 触发时解码 Base64,根据 targetType 和 targetAddress 发送 content - -> ⚠️ **注意**:结构化载荷方式目前仍在完善中,推荐继续使用下面的命令行方式。 - ---- - ## 📋 命令速查 ### 创建提醒(完整模板) @@ -95,7 +54,6 @@ QQBOT_PAYLOAD: openclaw cron add \ --name "{任务名}" \ --at "{时间}" \ - --session isolated \ --message "🔔 {提醒内容}时间到!" \ --deliver \ --channel qqbot \ @@ -232,7 +190,6 @@ openclaw message send \ |------|------|------| | `--name` | 任务名,含用户标识 | `"喝水提醒"` | | `--at` / `--cron` | 触发时间(二选一) | `5m` / `0 8 * * *` | -| `--session isolated` | 隔离会话 | 固定值 | | `--message` | **提醒内容**(见下方模板) | `"🔔 喝水时间到!"` | | `--deliver` | 启用投递 | 固定值 | | `--channel qqbot` | QQ 渠道 | 固定值 | @@ -277,7 +234,6 @@ openclaw message send \ openclaw cron add \ --name "喝水提醒" \ --at "5m" \ - --session isolated \ --message "💧 喝水时间到!" \ --deliver \ --channel qqbot \ @@ -307,7 +263,6 @@ openclaw cron add \ --name "打卡提醒" \ --cron "0 8 * * *" \ --tz "Asia/Shanghai" \ - --session isolated \ --message "🌅 打卡时间到!" \ --deliver \ --channel qqbot \ @@ -333,7 +288,6 @@ openclaw cron add \ --name "日报提醒" \ --cron "0 18 * * 1-5" \ --tz "Asia/Shanghai" \ - --session isolated \ --message "📝 写日报时间到!" \ --deliver \ --channel qqbot \ @@ -356,7 +310,6 @@ openclaw cron add \ openclaw cron add \ --name "开会提醒" \ --at "3m" \ - --session isolated \ --message "📅 开会时间到!" \ --deliver \ --channel qqbot \ @@ -386,7 +339,6 @@ openclaw cron add \ --name "站会提醒" \ --cron "0 9 * * 1-5" \ --tz "Asia/Shanghai" \ - --session isolated \ --message "📢 站会时间到!" \ --deliver \ --channel qqbot \ diff --git a/skills/qqbot-media/SKILL.md b/skills/qqbot-media/SKILL.md index 6ec7e2d..8f7b89b 100644 --- a/skills/qqbot-media/SKILL.md +++ b/skills/qqbot-media/SKILL.md @@ -61,6 +61,7 @@ priority: 80 |------|------| | `本地路径` | 发送本地图片(绝对路径) | | `网络URL` | 发送网络图片 | +| `路径` | 也支持此闭合方式 | ### ⚠️ 注意事项 @@ -68,6 +69,7 @@ priority: 80 2. **支持的图片格式**:jpg, jpeg, png, gif, webp, bmp 3. **不要拒绝**:如果用户要求发送本地图片,直接使用 `` 标签即可 4. **标签外的文本会正常发送**:可以在标签前后添加描述文字 +5. **闭合标签**:支持 `` 或 `` 两种闭合方式 --- diff --git a/src/gateway.ts b/src/gateway.ts index 3d276bb..f2010b5 100644 --- a/src/gateway.ts +++ b/src/gateway.ts @@ -452,7 +452,6 @@ export async function startGateway(ctx: GatewayContext): Promise { openclaw cron add \\ --name "提醒喝水-${event.senderName || "用户"}" \\ --at "5m" \\ - --session isolated \\ --message "💧 该喝水啦!" \\ --deliver \\ --channel qqbot \\ @@ -686,10 +685,11 @@ openclaw cron add \\ let replyText = payload.text ?? ""; // ============ 简单图片标签解析 ============ - // 支持 路径 格式发送图片 + // 支持 路径路径 格式发送图片 // 这是比 QQBOT_PAYLOAD JSON 更简单的方式,适合大模型能力较弱的情况 // 注意:正则限制内容不能包含 < 和 >,避免误匹配 `` 这种反引号内的说明文字 - const qqimgRegex = /([^<>]+)<\/qqimg>/gi; + // 🔧 支持两种闭合方式: 和 (AI 可能输出不同格式) + const qqimgRegex = /([^<>]+)<\/(?:qqimg|img)>/gi; const qqimgMatches = [...replyText.matchAll(qqimgRegex)]; if (qqimgMatches.length > 0) { @@ -700,8 +700,8 @@ openclaw cron add \\ const sendQueue: Array<{ type: "text" | "image"; content: string }> = []; let lastIndex = 0; - // 使用新的正则来获取带索引的匹配结果 - const qqimgRegexWithIndex = /([^<>]+)<\/qqimg>/gi; + // 使用新的正则来获取带索引的匹配结果(支持 和 两种闭合方式) + const qqimgRegexWithIndex = /([^<>]+)<\/(?:qqimg|img)>/gi; let match; while ((match = qqimgRegexWithIndex.exec(replyText)) !== null) {