{ "name": "GenerateNote", "description": "生成小红书图文笔记", "variables": { "add_note_img_center_pos": "", "pic_thumb_img_center_pos": "", "select_pic_img_center_pos": "", "ocr_pos_pick_from_album": "", "ocr_pos_next_1": "", "ocr_pos_next_2": "", "ocr_pos_publish": "", "article-prompt": "健康减脂:科学饮食与运动习惯,适合做小红书笔记", "article": "", "img-prompt-json": "", "img-prompt-arr": [], "img-prompt": "" }, "execute": [ { "type": "fun", "method": "remove-folder", "inVars": [ "tmp" ], "outVars": [] }, { "type": "fun", "method": "persist-read", "inVars": [ "add_note_img_center_pos" ], "outVars": [ "{add_note_img_center_pos}" ] }, { "type": "fun", "method": "persist-read", "inVars": [ "ocr_pos_pick_from_album" ], "outVars": [ "{ocr_pos_pick_from_album}" ] }, { "type": "fun", "method": "persist-read", "inVars": [ "select_pic_img_center_pos" ], "outVars": [ "{select_pic_img_center_pos}" ] }, { "type": "fun", "method": "persist-read", "inVars": [ "ocr_pos_next_1" ], "outVars": [ "{ocr_pos_next_1}" ] }, { "type": "fun", "method": "persist-read", "inVars": [ "ocr_pos_next_2" ], "outVars": [ "{ocr_pos_next_2}" ] }, { "type": "fun", "method": "persist-read", "inVars": [ "ocr_pos_publish" ], "outVars": [ "{ocr_pos_publish}" ] }, { "type": "echo", "inVars": [ "开始生成小红书图文笔记" ] }, { "type": "fun", "method": "text2text", "inVars": [ "根据以下主题写一篇小红书风格的图文稿件,要求:长文,至少 500 字,绝对不能超过900字。分段清晰、吸引人、适当使用 emoji、适合发笔记。只输出稿件正文,不要标题。主题:{{article-prompt}}", "" ], "outVars": [ "{article}" ] }, { "type": "fun", "method": "text2text", "inVars": [ "根据:{article}的内容,为配图给出两个搜图用关键词(短语即可)。严格只输出一行 JSON 数组,元素恰好 2 个字符串,除此之外不要任何字符。规则:只用英文半角双引号 \" 包裹每个元素,元素内不要用双引号;不要用中文引号「」或 “”;不要 markdown、不要代码块、不要换行。示例:[\"健康饮食 沙拉\",\"运动 瑜伽\"]" ], "outVars": [ "{img-prompt-json}" ] }, { "type": "fun", "method": "json-to-arr", "inVars": [ "{img-prompt-json}" ], "outVars": [ "{img-prompt-arr}" ] }, { "type": "echo", "inVars": [ "开始下载配图" ] }, { "type": "for", "indexVariable": "{idx}", "array": "{img-prompt-arr}", "body": [ { "type": "echo", "inVars": [ "[配图 {idx}] 尝试按关键词下载 tmp/pic{idx}.png" ] }, { "type": "try", "continueAfterFail": true, "try": [ { "type": "echo", "inVars": [ "[配图 {idx}] download-img:关键词 {img-prompt-arr}[{idx}]" ] }, { "type": "fun", "method": "download-img", "inVars": [ "{img-prompt-arr}[{idx}]", "tmp/pic{idx}.png" ], "outVars": [] } ], "fail": [ { "type": "echo", "inVars": [ "[配图 {idx}] 下载失败,AI 生成备用 prompt" ] }, { "type": "fun", "method": "text2text", "inVars": [ "根据:{article}的内容,为配图给出一个图片的 prompt(简短关键词或短语),不要 URL、不要 JSON、不要引号,只输出一个 prompt。" ], "outVars": [ "{img-prompt}" ] }, { "type": "echo", "inVars": [ "[配图 {idx}] download-img:备用 prompt" ] }, { "type": "fun", "method": "download-img", "inVars": [ "{img-prompt}", "tmp/pic{idx}.png" ], "outVars": [] } ], "success": [] }, { "type": "echo", "inVars": [ "[配图 {idx}] adb:发送图片到设备" ] }, { "type": "fun", "method": "adb-send-img-to-device", "inVars": [ "tmp/pic{idx}.png" ], "outVars": [] } ] }, { "type": "echo", "inVars": [ "步骤:点击添加笔记" ] }, { "type": "if", "condition": "{add_note_img_center_pos} == ''", "then": [ { "type": "echo", "inVars": [ "步骤:无缓存,ai计算图片中心点" ] }, { "type": "fun", "method": "img-center-point-location", "inVars": [ "添加笔记.png" ], "outVars": [ "{add_note_img_center_pos}" ] }, { "type": "fun", "method": "persist-save", "inVars": [ "add_note_img_center_pos", "{add_note_img_center_pos}" ], "outVars": [] } ], "else": [] }, { "type": "fun", "method": "adb-click", "inVars": [ "{add_note_img_center_pos}" ], "outVars": [] }, { "type": "if", "condition": "{ocr_pos_pick_from_album} == ''", "then": [ { "type": "echo", "inVars": [ "步骤:无缓存,OCR 识别「从相册选择」" ] }, { "type": "fun", "method": "ocr", "inVars": [ "从相册选择" ], "outVars": [ "{ocr_pos_pick_from_album}" ] }, { "type": "fun", "method": "persist-save", "inVars": [ "ocr_pos_pick_from_album", "{ocr_pos_pick_from_album}" ], "outVars": [] } ], "else": [] }, { "type": "fun", "method": "adb-click", "inVars": [ "{ocr_pos_pick_from_album}" ], "outVars": [] }, { "type": "for", "indexVariable": "{idx}", "array": "{img-prompt-arr}", "body": [ { "type": "fun", "method": "persist-read", "inVars": [ "img_center_tmp_pic_{idx}" ], "outVars": [ "{pic_thumb_img_center_pos}" ] }, { "type": "echo", "inVars": [ "开始选择配图 pic{idx}.png" ] }, { "type": "if", "condition": "{pic_thumb_img_center_pos} == ''", "then": [ { "type": "echo", "inVars": [ "[配图 {idx}] 无缓存,识图计算缩略图中心" ] }, { "type": "fun", "method": "img-center-point-location", "inVars": [ "tmp/pic{idx}.png" ], "outVars": [ "{pic_thumb_img_center_pos}" ] }, { "type": "fun", "method": "persist-save", "inVars": [ "img_center_tmp_pic_{idx}", "{pic_thumb_img_center_pos}" ], "outVars": [] } ], "else": [] }, { "type": "fun", "method": "adb-click", "inVars": [ "{pic_thumb_img_center_pos}" ], "outVars": [] }, { "type": "delay", "value": "1s" }, { "type": "if", "condition": "{select_pic_img_center_pos} == ''", "then": [ { "type": "echo", "inVars": [ "[配图 {idx}] 无缓存,识图计算「选中图片」中心" ] }, { "type": "fun", "method": "img-center-point-location", "inVars": [ "选中图片.png" ], "outVars": [ "{select_pic_img_center_pos}" ] }, { "type": "fun", "method": "persist-save", "inVars": [ "select_pic_img_center_pos", "{select_pic_img_center_pos}" ], "outVars": [] } ], "else": [] }, { "type": "echo", "inVars": [ "步骤:点击确认选中" ] }, { "type": "fun", "method": "adb-click", "inVars": [ "{select_pic_img_center_pos}" ], "outVars": [] }, { "type": "delay", "value": "1s" }, { "type": "fun", "method": "adb-keyevent", "inVars": [ "4" ], "outVars": [] }, { "type": "delay", "value": "1s" } ] }, { "type": "if", "condition": "{ocr_pos_next_1} == ''", "then": [ { "type": "echo", "inVars": [ "步骤:无缓存,OCR 识别「下一步」(1)" ] }, { "type": "fun", "method": "ocr", "inVars": [ "下一步" ], "outVars": [ "{ocr_pos_next_1}" ] }, { "type": "fun", "method": "persist-save", "inVars": [ "ocr_pos_next_1", "{ocr_pos_next_1}" ], "outVars": [] } ], "else": [] }, { "type": "fun", "method": "adb-click", "inVars": [ "{ocr_pos_next_1}" ], "outVars": [] }, { "type": "if", "condition": "{ocr_pos_next_2} == ''", "then": [ { "type": "echo", "inVars": [ "步骤:无缓存,OCR 识别「下一步」(2)" ] }, { "type": "fun", "method": "ocr", "inVars": [ "下一步" ], "outVars": [ "{ocr_pos_next_2}" ] }, { "type": "fun", "method": "persist-save", "inVars": [ "ocr_pos_next_2", "{ocr_pos_next_2}" ], "outVars": [] } ], "else": [] }, { "type": "fun", "method": "adb-click", "inVars": [ "{ocr_pos_next_2}" ], "outVars": [] }, { "type": "fun", "method": "adb-input", "inVars": [ "{article}" ], "outVars": [] }, { "type": "if", "condition": "{ocr_pos_publish} == ''", "then": [ { "type": "echo", "inVars": [ "步骤:无缓存,OCR 识别「发布」" ] }, { "type": "fun", "method": "ocr", "inVars": [ "发布" ], "outVars": [ "{ocr_pos_publish}" ] }, { "type": "fun", "method": "persist-save", "inVars": [ "ocr_pos_publish", "{ocr_pos_publish}" ], "outVars": [] } ], "else": [] }, { "type": "fun", "method": "adb-click", "inVars": [ "{ocr_pos_publish}" ], "outVars": [] }, { "type": "echo", "inVars": [ "流程结束" ] } ] }