process.json 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. {
  2. "name": "WeChatAIChating",
  3. "description": "微信AI陪聊",
  4. "variables": {
  5. "turn": 1,
  6. "relationBg": "",
  7. "chatArea": "",
  8. "chatHistoryMessage": "",
  9. "currentChatMessage": "",
  10. "lastHistoryMessage": "",
  11. "lastChatMessage": "",
  12. "lastChatRole": "",
  13. "lastHistoryChatMessage": "",
  14. "lastHistoryChatRole": "",
  15. "aiReply": "",
  16. "aiCallBack":0,
  17. "sendBtnPos": "",
  18. "newChatMessage": ""
  19. },
  20. "execute": [
  21. {
  22. "type": "schedule",
  23. "condition":
  24. {
  25. "interval": "1s",
  26. "repeat": 2
  27. },
  28. "interval":
  29. [
  30. {
  31. "type": "echo",
  32. "value": "==第 {{turn}} 轮=="
  33. },
  34. {
  35. "type": "set",
  36. "variable": "{turn}",
  37. "value": "{turn} + 1"
  38. },
  39. {
  40. "type":"if",
  41. "condition": "{chatArea}==\"\"",
  42. "ture":
  43. [
  44. {
  45. "type": "image-region-location",
  46. "inVars": ["ScreenShot.jpg","ChatArea.png"],
  47. "outVars": ["{chatArea}"]
  48. },
  49. {
  50. "type": "echo",
  51. "value": "坐标: {{chatArea}}"
  52. }
  53. ]
  54. },
  55. {
  56. "type": "ocr-chat",
  57. "inVars": ["(242,242,242)","(114,220,106)","{chatArea}"],
  58. "outVars": ["{currentChatMessage}"]
  59. },
  60. {
  61. "type": "log",
  62. "value": "当前聊天内容:{{currentChatMessage}}"
  63. },
  64. {
  65. "type": "read-txt",
  66. "inVars": ["history/chat-history.txt"],
  67. "outVars": ["{chatHistoryMessage}"]
  68. },
  69. {
  70. "type": "read-txt",
  71. "inVars": ["history/bg.txt"],
  72. "outVars": ["{relationBg}"]
  73. },
  74. {
  75. "type": "log",
  76. "value": "背景内容:{{relationBg}}"
  77. },
  78. {
  79. "type": "if",
  80. "condition": "{relationBg}==\"\"",
  81. "ture":
  82. [
  83. {
  84. "type": "if",
  85. "condition": "{chatHistoryMessage}==\"\"",
  86. "ture":
  87. [
  88. {
  89. "type": "ai-generate",
  90. "prompt": "根据聊天记录:{{currentChatMessage}},推理出我与聊天好友的关系背景,用一句话描述出来",
  91. "inVars": [],
  92. "outVars": ["{relationBg}","{aiCallBack}"]
  93. }
  94. ],
  95. "false":
  96. [
  97. {
  98. "type": "ai-generate",
  99. "prompt": "根据聊天记录:{{chatHistoryMessage}},推理出我与聊天好友的关系背景,用一句话描述出来",
  100. "inVars": [],
  101. "outVars": ["{relationBg}","{aiCallBack}"]
  102. }
  103. ]
  104. },
  105. {
  106. "type": "while",
  107. "condition": "1 == aiCallBack",
  108. "ture":
  109. [
  110. ]
  111. },
  112. {
  113. "type": "set",
  114. "variable": "{aiCallBack}",
  115. "value": "0"
  116. },
  117. {
  118. "type": "log",
  119. "value": "==AI生成关系背景==:{{relationBg}}"
  120. },
  121. {
  122. "type": "save-txt",
  123. "inVars": ["{relationBg}","history/bg.txt"],
  124. "outVars": []
  125. }
  126. ]
  127. },
  128. {
  129. "type": "read-last-message",
  130. "inVars": ["{currentChatMessage}"],
  131. "outVars": ["{lastChatMessage}","{lastChatRole}"]
  132. },
  133. {
  134. "type": "log",
  135. "value": "当前最后一条消息:{{lastChatMessage}}({{lastChatRole}})"
  136. },
  137. {
  138. "type": "read-last-message",
  139. "inVars": ["{chatHistoryMessage}"],
  140. "outVars": ["{lastHistoryChatMessage}","{lastHistoryChatRole}"]
  141. },
  142. {
  143. "type": "log",
  144. "value": "==历史最后一条消息:{{lastHistoryChatMessage}}({{lastHistoryChatRole}})=="
  145. },
  146. {
  147. "type": "if",
  148. "condition": "{lastChatMessage} != {lastHistoryChatMessage}",
  149. "ture":
  150. [
  151. {
  152. "type": "log",
  153. "value":"AI自动回复流程开始=="
  154. },
  155. {
  156. "type": "if",
  157. "condition": "{lastChatRole} == \"friend\"",
  158. "ture":
  159. [
  160. {
  161. "type": "ai-generate",
  162. "prompt": "根据我们背景关系描述:{{relationBg}},以及我们的聊天记录:{{lastChatMessage}},帮我做出适合回复,不要给建议,直接给一条你认为最好的回复信息,回复信息字数要符合微信聊天习惯",
  163. "inVars": [],
  164. "outVars": ["{aiReply}","{aiCallBack}"]
  165. },
  166. {
  167. "type": "while",
  168. "condition": "1 == aiCallBack",
  169. "ture":
  170. [
  171. ]
  172. },
  173. {
  174. "type": "set",
  175. "variable": "{aiCallBack}",
  176. "value": "0"
  177. },
  178. {
  179. "type": "adb",
  180. "method": "input",
  181. "inVars": ["{aiReply}"]
  182. },
  183. {
  184. "type": "if",
  185. "condition": "{sendBtnPos} == \"\"",
  186. "ture":
  187. [
  188. {
  189. "type": "image-center-location",
  190. "inVars": ["微信聊天界面的发送按钮定位图.png"],
  191. "outVars": ["{sendBtnPos}"]
  192. }
  193. ]
  194. },
  195. {
  196. "type": "adb",
  197. "method": "click",
  198. "inVars": ["{sendBtnPos}"]
  199. }
  200. ]
  201. },
  202. {
  203. "type":"smart-chat-append",
  204. "inVars": ["{chatHistoryMessage}","{currentChatMessage}"],
  205. "outVars": ["{newChatMessage}"]
  206. },
  207. {
  208. "type": "save-txt",
  209. "inVars": ["{newChatMessage}","history/chat-history.txt"],
  210. "outVars": []
  211. }
  212. ]
  213. }
  214. ]
  215. }
  216. ]
  217. }