|
@@ -0,0 +1,118 @@
|
|
|
|
|
+{
|
|
|
|
|
+ "name": "wechat-auto-reply",
|
|
|
|
|
+ "displayName": "微信自动应答",
|
|
|
|
|
+ "description": "定时轮询新消息,根据来源(个人/群聊)分类处理,生成智能回复并发送。",
|
|
|
|
|
+ "version": "1.0.0",
|
|
|
|
|
+
|
|
|
|
|
+ "trigger": {
|
|
|
|
|
+ "type": "polling",
|
|
|
|
|
+ "intervalSeconds": 10,
|
|
|
|
|
+ "description": "每10秒轮询一次新消息"
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ "state": {
|
|
|
|
|
+ "lastCheckTime": {
|
|
|
|
|
+ "type": "string",
|
|
|
|
|
+ "description": "上次检查的时间戳(ISO),用于增量拉取",
|
|
|
|
|
+ "default": ""
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ "stages": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "id": "check-online",
|
|
|
|
|
+ "name": "检查在线状态",
|
|
|
|
|
+ "skill": "wechat-check-online",
|
|
|
|
|
+ "input": {},
|
|
|
|
|
+ "onFailure": "stop",
|
|
|
|
|
+ "condition": "每次轮询的第一步",
|
|
|
|
|
+ "expect": { "data": true }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "id": "fetch-new-messages",
|
|
|
|
|
+ "name": "增量拉取新消息",
|
|
|
|
|
+ "skill": "wechat-get-messages",
|
|
|
|
|
+ "input": {
|
|
|
|
|
+ "since": "{{state.lastCheckTime}}",
|
|
|
|
|
+ "direction": "received",
|
|
|
|
|
+ "limit": 50
|
|
|
|
|
+ },
|
|
|
|
|
+ "output": {
|
|
|
|
|
+ "messages": "data",
|
|
|
|
|
+ "description": "收到的新消息数组"
|
|
|
|
|
+ },
|
|
|
|
|
+ "postAction": "更新 state.lastCheckTime 为当前时间"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "id": "classify-and-reply",
|
|
|
|
|
+ "name": "分类处理并回复",
|
|
|
|
|
+ "type": "forEach",
|
|
|
|
|
+ "items": "{{stages.fetch-new-messages.output.messages}}",
|
|
|
|
|
+ "filter": {
|
|
|
|
|
+ "description": "过滤掉系统消息和自己发的消息",
|
|
|
|
|
+ "conditions": [
|
|
|
|
|
+ "item.type != 'system'",
|
|
|
|
|
+ "item.direction == 'received'"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "steps": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "id": "classify-source",
|
|
|
|
|
+ "name": "判断消息来源",
|
|
|
|
|
+ "type": "condition",
|
|
|
|
|
+ "rules": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "if": "item.fromWxid ends with '@chatroom'",
|
|
|
|
|
+ "then": { "sourceType": "group", "replyTo": "item.fromWxid" }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "else": true,
|
|
|
|
|
+ "then": { "sourceType": "personal", "replyTo": "item.fromWxid" }
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "id": "generate-reply",
|
|
|
|
|
+ "name": "AI生成回复内容",
|
|
|
|
|
+ "type": "llm",
|
|
|
|
|
+ "systemPrompt": "你是一个微信智能助手。请根据用户发来的消息生成简短、友好的回复。如果是群聊消息,回复要简洁。如果无法理解内容,回复"收到,稍后回复您"。不要回复系统消息、表情、图片等非文字内容。",
|
|
|
|
|
+ "userPrompt": "来源类型: {{classify-source.sourceType}}\n发送者: {{item.nickName}} ({{item.fromWxid}})\n消息类型: {{item.type}}\n消息内容: {{item.content}}\n\n请生成回复:",
|
|
|
|
|
+ "output": { "replyContent": "llm_response" }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "id": "send-reply",
|
|
|
|
|
+ "name": "发送回复",
|
|
|
|
|
+ "skill": "wechat-send-text",
|
|
|
|
|
+ "input": {
|
|
|
|
|
+ "toWxid": "{{classify-source.replyTo}}",
|
|
|
|
|
+ "content": "{{generate-reply.replyContent}}"
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+
|
|
|
|
|
+ "replyRules": {
|
|
|
|
|
+ "description": "回复策略规则(龙虾参考)",
|
|
|
|
|
+ "personalChat": {
|
|
|
|
|
+ "description": "个人私聊",
|
|
|
|
|
+ "behavior": "收到文字消息后,用AI生成个性化回复;收到图片/语音/视频等仅回复确认。",
|
|
|
|
|
+ "examples": [
|
|
|
|
|
+ { "received": "你好", "reply": "你好!有什么可以帮你的吗?" },
|
|
|
|
|
+ { "received": "[图片]", "reply": "收到图片,我看看~" },
|
|
|
|
|
+ { "received": "明天几点开会", "reply": "让我帮你查一下,稍等。" }
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "groupChat": {
|
|
|
|
|
+ "description": "群聊",
|
|
|
|
|
+ "behavior": "仅在被@或关键词触发时回复,避免刷屏。回复简洁。",
|
|
|
|
|
+ "triggerKeywords": ["@助手", "@bot", "帮我", "请问"],
|
|
|
|
|
+ "examples": [
|
|
|
|
|
+ { "received": "@助手 明天天气怎么样", "reply": "明天多云转晴,适合出行!" },
|
|
|
|
|
+ { "received": "随便聊天", "reply": null, "note": "不回复,不相关" }
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "ignoreTypes": ["system", "emoji", "location", "video", "voice"],
|
|
|
|
|
+ "ignoreWxids": ["weixin", "fmessage", "medianote", "gh_"]
|
|
|
|
|
+ }
|
|
|
|
|
+}
|