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