process.json 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. {
  2. "name": "GenerateNote",
  3. "description": "生成小红书图文笔记",
  4. "variables": {
  5. "add_note_img_center_pos": "",
  6. "pic_thumb_img_center_pos": "",
  7. "select_pic_img_center_pos": "",
  8. "ocr_pos_pick_from_album": "",
  9. "ocr_pos_next_1": "",
  10. "ocr_pos_next_2": "",
  11. "ocr_pos_publish": "",
  12. "article-prompt": "健康减脂:科学饮食与运动习惯,适合做小红书笔记",
  13. "article": "",
  14. "img-prompt-json": "",
  15. "img-prompt-arr": [],
  16. "img-prompt": ""
  17. },
  18. "execute": [
  19. {
  20. "type": "fun",
  21. "method": "remove-folder",
  22. "inVars": [
  23. "tmp"
  24. ],
  25. "outVars": []
  26. },
  27. {
  28. "type": "fun",
  29. "method": "persist-read",
  30. "inVars": [
  31. "add_note_img_center_pos"
  32. ],
  33. "outVars": [
  34. "{add_note_img_center_pos}"
  35. ]
  36. },
  37. {
  38. "type": "fun",
  39. "method": "persist-read",
  40. "inVars": [
  41. "ocr_pos_pick_from_album"
  42. ],
  43. "outVars": [
  44. "{ocr_pos_pick_from_album}"
  45. ]
  46. },
  47. {
  48. "type": "fun",
  49. "method": "persist-read",
  50. "inVars": [
  51. "select_pic_img_center_pos"
  52. ],
  53. "outVars": [
  54. "{select_pic_img_center_pos}"
  55. ]
  56. },
  57. {
  58. "type": "fun",
  59. "method": "persist-read",
  60. "inVars": [
  61. "ocr_pos_next_1"
  62. ],
  63. "outVars": [
  64. "{ocr_pos_next_1}"
  65. ]
  66. },
  67. {
  68. "type": "fun",
  69. "method": "persist-read",
  70. "inVars": [
  71. "ocr_pos_next_2"
  72. ],
  73. "outVars": [
  74. "{ocr_pos_next_2}"
  75. ]
  76. },
  77. {
  78. "type": "fun",
  79. "method": "persist-read",
  80. "inVars": [
  81. "ocr_pos_publish"
  82. ],
  83. "outVars": [
  84. "{ocr_pos_publish}"
  85. ]
  86. },
  87. {
  88. "type": "echo",
  89. "inVars": [
  90. "开始生成小红书图文笔记"
  91. ]
  92. },
  93. {
  94. "type": "fun",
  95. "method": "text2text",
  96. "inVars": [
  97. "根据以下主题写一篇小红书风格的图文稿件,要求:长文,至少 500 字,绝对不能超过900字。分段清晰、吸引人、适当使用 emoji、适合发笔记。只输出稿件正文,不要标题。主题:{{article-prompt}}",
  98. ""
  99. ],
  100. "outVars": [
  101. "{article}"
  102. ]
  103. },
  104. {
  105. "type": "fun",
  106. "method": "text2text",
  107. "inVars": [
  108. "根据:{article}的内容,为配图给出两个搜图用关键词(短语即可)。严格只输出一行 JSON 数组,元素恰好 2 个字符串,除此之外不要任何字符。规则:只用英文半角双引号 \" 包裹每个元素,元素内不要用双引号;不要用中文引号「」或 “”;不要 markdown、不要代码块、不要换行。示例:[\"健康饮食 沙拉\",\"运动 瑜伽\"]"
  109. ],
  110. "outVars": [
  111. "{img-prompt-json}"
  112. ]
  113. },
  114. {
  115. "type": "fun",
  116. "method": "json-to-arr",
  117. "inVars": [
  118. "{img-prompt-json}"
  119. ],
  120. "outVars": [
  121. "{img-prompt-arr}"
  122. ]
  123. },
  124. {
  125. "type": "echo",
  126. "inVars": [
  127. "开始下载配图"
  128. ]
  129. },
  130. {
  131. "type": "for",
  132. "indexVariable": "{idx}",
  133. "array": "{img-prompt-arr}",
  134. "body": [
  135. {
  136. "type": "echo",
  137. "inVars": [
  138. "[配图 {idx}] 尝试按关键词下载 tmp/pic{idx}.png"
  139. ]
  140. },
  141. {
  142. "type": "try",
  143. "continueAfterFail": true,
  144. "try": [
  145. {
  146. "type": "echo",
  147. "inVars": [
  148. "[配图 {idx}] download-img:关键词 {img-prompt-arr}[{idx}]"
  149. ]
  150. },
  151. {
  152. "type": "fun",
  153. "method": "download-img",
  154. "inVars": [
  155. "{img-prompt-arr}[{idx}]",
  156. "tmp/pic{idx}.png"
  157. ],
  158. "outVars": []
  159. }
  160. ],
  161. "fail": [
  162. {
  163. "type": "echo",
  164. "inVars": [
  165. "[配图 {idx}] 下载失败,AI 生成备用 prompt"
  166. ]
  167. },
  168. {
  169. "type": "fun",
  170. "method": "text2text",
  171. "inVars": [
  172. "根据:{article}的内容,为配图给出一个图片的 prompt(简短关键词或短语),不要 URL、不要 JSON、不要引号,只输出一个 prompt。"
  173. ],
  174. "outVars": [
  175. "{img-prompt}"
  176. ]
  177. },
  178. {
  179. "type": "echo",
  180. "inVars": [
  181. "[配图 {idx}] download-img:备用 prompt"
  182. ]
  183. },
  184. {
  185. "type": "fun",
  186. "method": "download-img",
  187. "inVars": [
  188. "{img-prompt}",
  189. "tmp/pic{idx}.png"
  190. ],
  191. "outVars": []
  192. }
  193. ],
  194. "success": []
  195. },
  196. {
  197. "type": "echo",
  198. "inVars": [
  199. "[配图 {idx}] adb:发送图片到设备"
  200. ]
  201. },
  202. {
  203. "type": "fun",
  204. "method": "adb-send-img-to-device",
  205. "inVars": [
  206. "tmp/pic{idx}.png"
  207. ],
  208. "outVars": []
  209. }
  210. ]
  211. },
  212. {
  213. "type": "echo",
  214. "inVars": [
  215. "步骤:点击添加笔记"
  216. ]
  217. },
  218. {
  219. "type": "if",
  220. "condition": "{add_note_img_center_pos} == ''",
  221. "then": [
  222. {
  223. "type": "echo",
  224. "inVars": [
  225. "步骤:无缓存,ai计算图片中心点"
  226. ]
  227. },
  228. {
  229. "type": "fun",
  230. "method": "img-center-point-location",
  231. "inVars": [
  232. "添加笔记.png"
  233. ],
  234. "outVars": [
  235. "{add_note_img_center_pos}"
  236. ]
  237. },
  238. {
  239. "type": "fun",
  240. "method": "persist-save",
  241. "inVars": [
  242. "add_note_img_center_pos",
  243. "{add_note_img_center_pos}"
  244. ],
  245. "outVars": []
  246. }
  247. ],
  248. "else": []
  249. },
  250. {
  251. "type": "fun",
  252. "method": "adb-click",
  253. "inVars": [
  254. "{add_note_img_center_pos}"
  255. ],
  256. "outVars": []
  257. },
  258. {
  259. "type": "if",
  260. "condition": "{ocr_pos_pick_from_album} == ''",
  261. "then": [
  262. {
  263. "type": "echo",
  264. "inVars": [
  265. "步骤:无缓存,OCR 识别「从相册选择」"
  266. ]
  267. },
  268. {
  269. "type": "fun",
  270. "method": "ocr",
  271. "inVars": [
  272. "从相册选择"
  273. ],
  274. "outVars": [
  275. "{ocr_pos_pick_from_album}"
  276. ]
  277. },
  278. {
  279. "type": "fun",
  280. "method": "persist-save",
  281. "inVars": [
  282. "ocr_pos_pick_from_album",
  283. "{ocr_pos_pick_from_album}"
  284. ],
  285. "outVars": []
  286. }
  287. ],
  288. "else": []
  289. },
  290. {
  291. "type": "fun",
  292. "method": "adb-click",
  293. "inVars": [
  294. "{ocr_pos_pick_from_album}"
  295. ],
  296. "outVars": []
  297. },
  298. {
  299. "type": "for",
  300. "indexVariable": "{idx}",
  301. "array": "{img-prompt-arr}",
  302. "body": [
  303. {
  304. "type": "fun",
  305. "method": "persist-read",
  306. "inVars": [
  307. "img_center_tmp_pic_{idx}"
  308. ],
  309. "outVars": [
  310. "{pic_thumb_img_center_pos}"
  311. ]
  312. },
  313. {
  314. "type": "echo",
  315. "inVars": [
  316. "开始选择配图 pic{idx}.png"
  317. ]
  318. },
  319. {
  320. "type": "if",
  321. "condition": "{pic_thumb_img_center_pos} == ''",
  322. "then": [
  323. {
  324. "type": "echo",
  325. "inVars": [
  326. "[配图 {idx}] 无缓存,识图计算缩略图中心"
  327. ]
  328. },
  329. {
  330. "type": "fun",
  331. "method": "img-center-point-location",
  332. "inVars": [
  333. "tmp/pic{idx}.png"
  334. ],
  335. "outVars": [
  336. "{pic_thumb_img_center_pos}"
  337. ]
  338. },
  339. {
  340. "type": "fun",
  341. "method": "persist-save",
  342. "inVars": [
  343. "img_center_tmp_pic_{idx}",
  344. "{pic_thumb_img_center_pos}"
  345. ],
  346. "outVars": []
  347. }
  348. ],
  349. "else": []
  350. },
  351. {
  352. "type": "fun",
  353. "method": "adb-click",
  354. "inVars": [
  355. "{pic_thumb_img_center_pos}"
  356. ],
  357. "outVars": []
  358. },
  359. {
  360. "type": "delay",
  361. "value": "1s"
  362. },
  363. {
  364. "type": "if",
  365. "condition": "{select_pic_img_center_pos} == ''",
  366. "then": [
  367. {
  368. "type": "echo",
  369. "inVars": [
  370. "[配图 {idx}] 无缓存,识图计算「选中图片」中心"
  371. ]
  372. },
  373. {
  374. "type": "fun",
  375. "method": "img-center-point-location",
  376. "inVars": [
  377. "选中图片.png"
  378. ],
  379. "outVars": [
  380. "{select_pic_img_center_pos}"
  381. ]
  382. },
  383. {
  384. "type": "fun",
  385. "method": "persist-save",
  386. "inVars": [
  387. "select_pic_img_center_pos",
  388. "{select_pic_img_center_pos}"
  389. ],
  390. "outVars": []
  391. }
  392. ],
  393. "else": []
  394. },
  395. {
  396. "type": "echo",
  397. "inVars": [
  398. "步骤:点击确认选中"
  399. ]
  400. },
  401. {
  402. "type": "fun",
  403. "method": "adb-click",
  404. "inVars": [
  405. "{select_pic_img_center_pos}"
  406. ],
  407. "outVars": []
  408. },
  409. {
  410. "type": "delay",
  411. "value": "1s"
  412. },
  413. {
  414. "type": "fun",
  415. "method": "adb-keyevent",
  416. "inVars": [
  417. "4"
  418. ],
  419. "outVars": []
  420. },
  421. {
  422. "type": "delay",
  423. "value": "1s"
  424. }
  425. ]
  426. },
  427. {
  428. "type": "if",
  429. "condition": "{ocr_pos_next_1} == ''",
  430. "then": [
  431. {
  432. "type": "echo",
  433. "inVars": [
  434. "步骤:无缓存,OCR 识别「下一步」(1)"
  435. ]
  436. },
  437. {
  438. "type": "fun",
  439. "method": "ocr",
  440. "inVars": [
  441. "下一步"
  442. ],
  443. "outVars": [
  444. "{ocr_pos_next_1}"
  445. ]
  446. },
  447. {
  448. "type": "fun",
  449. "method": "persist-save",
  450. "inVars": [
  451. "ocr_pos_next_1",
  452. "{ocr_pos_next_1}"
  453. ],
  454. "outVars": []
  455. }
  456. ],
  457. "else": []
  458. },
  459. {
  460. "type": "fun",
  461. "method": "adb-click",
  462. "inVars": [
  463. "{ocr_pos_next_1}"
  464. ],
  465. "outVars": []
  466. },
  467. {
  468. "type": "if",
  469. "condition": "{ocr_pos_next_2} == ''",
  470. "then": [
  471. {
  472. "type": "echo",
  473. "inVars": [
  474. "步骤:无缓存,OCR 识别「下一步」(2)"
  475. ]
  476. },
  477. {
  478. "type": "fun",
  479. "method": "ocr",
  480. "inVars": [
  481. "下一步"
  482. ],
  483. "outVars": [
  484. "{ocr_pos_next_2}"
  485. ]
  486. },
  487. {
  488. "type": "fun",
  489. "method": "persist-save",
  490. "inVars": [
  491. "ocr_pos_next_2",
  492. "{ocr_pos_next_2}"
  493. ],
  494. "outVars": []
  495. }
  496. ],
  497. "else": []
  498. },
  499. {
  500. "type": "fun",
  501. "method": "adb-click",
  502. "inVars": [
  503. "{ocr_pos_next_2}"
  504. ],
  505. "outVars": []
  506. },
  507. {
  508. "type": "fun",
  509. "method": "adb-input",
  510. "inVars": [
  511. "{article}"
  512. ],
  513. "outVars": []
  514. },
  515. {
  516. "type": "if",
  517. "condition": "{ocr_pos_publish} == ''",
  518. "then": [
  519. {
  520. "type": "echo",
  521. "inVars": [
  522. "步骤:无缓存,OCR 识别「发布」"
  523. ]
  524. },
  525. {
  526. "type": "fun",
  527. "method": "ocr",
  528. "inVars": [
  529. "发布"
  530. ],
  531. "outVars": [
  532. "{ocr_pos_publish}"
  533. ]
  534. },
  535. {
  536. "type": "fun",
  537. "method": "persist-save",
  538. "inVars": [
  539. "ocr_pos_publish",
  540. "{ocr_pos_publish}"
  541. ],
  542. "outVars": []
  543. }
  544. ],
  545. "else": []
  546. },
  547. {
  548. "type": "fun",
  549. "method": "adb-click",
  550. "inVars": [
  551. "{ocr_pos_publish}"
  552. ],
  553. "outVars": []
  554. },
  555. {
  556. "type": "echo",
  557. "inVars": [
  558. "流程结束"
  559. ]
  560. }
  561. ]
  562. }