| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- {
- "name": "WeChatAIChating",
- "description": "微信AI陪聊",
- "variables": {
- "turn": 1,
- "relationBg": "",
- "chatArea": "",
- "chatHistoryMessage": "",
- "currentChatMessage": "",
- "lastHistoryMessage": "",
- "lastChatMessage": "",
- "lastChatRole": "",
- "lastHistoryChatMessage": "",
- "lastHistoryChatRole": "",
- "aiReply": "",
- "aiCallBack":0,
- "sendBtnPos": "",
- "newChatMessage": ""
- },
- "execute": [
- {
- "type": "schedule",
- "condition":
- {
- "interval": "1s",
- "repeat": 2
- },
- "interval":
- [
- {
- "type": "echo",
- "value": "==第 {{turn}} 轮=="
- },
- {
- "type": "set",
- "variable": "{turn}",
- "value": "{turn} + 1"
- },
- {
- "type":"if",
- "condition": "{chatArea}==\"\"",
- "ture":
- [
- {
- "type": "fun",
- "method": "img-bounding-box-location",
- "inVars": ["ScreenShot.jpg","ChatArea.png"],
- "outVars": ["{chatArea}"]
- },
- {
- "type": "echo",
- "value": "坐标: {{chatArea}}"
- }
- ]
- },
- {
- "type": "fun",
- "method": "ocr-chat",
- "inVars": ["(242,242,242)","(114,220,106)","{chatArea}"],
- "outVars": ["{currentChatMessage}"]
- },
- {
- "type": "log",
- "value": "当前聊天内容:{{currentChatMessage}}"
- },
- {
- "type": "fun",
- "method": "read-txt",
- "inVars": ["history/chat-history.txt"],
- "outVars": ["{chatHistoryMessage}"]
- },
- {
- "type": "fun",
- "method": "read-txt",
- "inVars": ["history/bg.txt"],
- "outVars": ["{relationBg}"]
- },
- {
- "type": "log",
- "value": "背景内容:{{relationBg}}"
- },
- {
- "type": "if",
- "condition": "{relationBg}==\"\"",
- "ture":
- [
-
- {
- "type": "if",
- "condition": "{chatHistoryMessage}==\"\"",
- "ture":
- [
- {
- "type": "fun",
- "method": "ai-generate",
- "prompt": "根据聊天记录:{{currentChatMessage}},推理出我与聊天好友的关系背景,用一句话描述出来",
- "inVars": [],
- "outVars": ["{relationBg}","{aiCallBack}"]
- }
- ],
- "false":
- [
- {
- "type": "fun",
- "method": "ai-generate",
- "prompt": "根据聊天记录:{{chatHistoryMessage}},推理出我与聊天好友的关系背景,用一句话描述出来",
- "inVars": [],
- "outVars": ["{relationBg}","{aiCallBack}"]
- }
- ]
- },
- {
- "type": "while",
- "condition": "1 == aiCallBack",
- "ture":
- [
-
- ]
- },
- {
- "type": "set",
- "variable": "{aiCallBack}",
- "value": "0"
- },
- {
- "type": "log",
- "value": "==AI生成关系背景==:{{relationBg}}"
- },
- {
- "type": "fun",
- "method": "save-txt",
- "inVars": ["{relationBg}","history/bg.txt"],
- "outVars": []
- }
- ]
- },
- {
- "type": "fun",
- "method": "read-last-message",
- "inVars": ["{currentChatMessage}"],
- "outVars": ["{lastChatMessage}","{lastChatRole}"]
- },
- {
- "type": "log",
- "value": "当前最后一条消息:{{lastChatMessage}}({{lastChatRole}})"
- },
- {
- "type": "fun",
- "method": "read-last-message",
- "inVars": ["{chatHistoryMessage}"],
- "outVars": ["{lastHistoryChatMessage}","{lastHistoryChatRole}"]
- },
- {
- "type": "log",
- "value": "==历史最后一条消息:{{lastHistoryChatMessage}}({{lastHistoryChatRole}})=="
- },
- {
- "type": "if",
- "condition": "{lastChatMessage} != {lastHistoryChatMessage}",
- "ture":
- [
- {
- "type": "log",
- "value":"AI自动回复流程开始=="
- },
- {
- "type": "if",
- "condition": "{lastChatRole} == \"friend\"",
- "ture":
- [
- {
- "type": "fun",
- "method": "ai-generate",
- "prompt": "根据我们背景关系描述:{{relationBg}},以及我们的聊天记录:{{lastChatMessage}},帮我做出适合回复,不要给建议,直接给一条你认为最好的回复信息,回复信息字数要符合微信聊天习惯",
- "inVars": [],
- "outVars": ["{aiReply}","{aiCallBack}"]
- },
- {
- "type": "while",
- "condition": "1 == aiCallBack",
- "ture":
- [
-
- ]
- },
- {
- "type": "set",
- "variable": "{aiCallBack}",
- "value": "0"
- },
- {
- "type": "adb",
- "method": "input",
- "inVars": ["{aiReply}"]
- },
- {
- "type": "if",
- "condition": "{sendBtnPos} == \"\"",
- "ture":
- [
- {
- "type": "fun",
- "method": "img-center-point-location",
- "inVars": ["微信聊天界面的发送按钮定位图.png"],
- "outVars": ["{sendBtnPos}"]
- }
- ]
- },
- {
- "type": "adb",
- "method": "click",
- "inVars": ["{sendBtnPos}"]
- }
- ]
- },
- {
- "type": "fun",
- "method": "smart-chat-append",
- "inVars": ["{chatHistoryMessage}","{currentChatMessage}"],
- "outVars": ["{newChatMessage}"]
- },
- {
- "type": "fun",
- "method": "save-txt",
- "inVars": ["{newChatMessage}","history/chat-history.txt"],
- "outVars": []
- }
- ]
- }
- ]
- }
- ]
- }
|