编辑
2025-09-01
工具问题记录
00

目录

参考图
效果
卡佩托 - 拳击手角色,拳头巨大,表情凶狠的搏击选手形象
素材读取方式
过程记录
待办
工作流

参考图

image.png

效果

这是前后对比

卡佩托 - 拳击手角色,拳头巨大,表情凶狠的搏击选手形象

image.pngimage.png

素材读取方式

  1. 通过 agent 分镜后,根据每个场景去细分需要的素材,调用 fastgpt 知识库去获取对应素材
  2. 素材不存在则调用通过 「图生图」 生成对应的素材,上传至 google drive
  3. 将链接回传给 agent ,最后再调用 banana 组装分镜

过程记录

创建素材可能失败,需要增加重传/升级成付费?

待办

新生成的素材上传至本地知识库

工作流

  1. 生图传图
json
{ "nodes": [ { "parameters": { "method": "POST", "url": "https://openrouter.ai/api/v1/chat/completions", "authentication": "predefinedCredentialType", "nodeCredentialType": "openRouterApi", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"model\": \"google/gemini-2.5-flash-image-preview:free\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": {{ JSON.stringify($json.content) }}\n }\n ]\n}", "options": {} }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ -1504, 224 ], "id": "5dd5b7f1-bfb8-4d02-abc3-f4851b6fc060", "name": "HTTP Request1", "credentials": { "httpHeaderAuth": { "id": "rFYHDH4fk1VIIdXM", "name": "google api key" }, "openRouterApi": { "id": "kwErHHX3g6C7eq6o", "name": "OpenRouter account" } } }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 }, "conditions": [ { "id": "e6ee6bb2-87d1-4789-b5c2-ccc27fceefe1", "leftValue": "={{ !!$json?.choices?.[0]?.message?.images?.[0]?.image_url?.url }}", "rightValue": "", "operator": { "type": "boolean", "operation": "true", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ -1280, 224 ], "id": "f4cd11ed-c774-4591-bca4-5ea91d8eddbe", "name": "If" }, { "parameters": { "jsCode": "const sceneTitle = $('Code6').first().json.content[$('Code6').first().json.content?.length - 1].text\n\nreturn [\n {\n json: {\n data:$input.first().json.choices[0].message.images[0].image_url.url.split(\",\")[1], // 去掉 data:image/png;base64, 前缀\n fileName:`${sceneTitle}.jpeg`\n }\n }\n];" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ -1056, 160 ], "id": "5871d911-40f6-4397-b28d-b5e54834bece", "name": "Code4" }, { "parameters": { "jsCode": "// 假设你的 base64 在 json.data\nconst base64 = $json.data; \n\nreturn [\n {\n binary: {\n data: {\n data: Buffer.from(base64, 'base64'), // 转成二进制\n mimeType: 'image/jpeg',\n fileName:$json.fileName,\n }\n }\n }\n];\n" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ -832, 160 ], "id": "413cadf4-28fe-463c-955b-ab382c214013", "name": "Code5" }, { "parameters": {}, "type": "n8n-nodes-base.noOp", "typeVersion": 1, "position": [ -1952, 32 ], "id": "b5fb067c-cbc7-4804-8944-e4735853db52", "name": "No Operation, do nothing" }, { "parameters": {}, "type": "n8n-nodes-base.merge", "typeVersion": 3.2, "position": [ -160, 304 ], "id": "a1f4dc24-639a-4c63-b776-58b7c9fadeea", "name": "Merge" }, { "parameters": { "name": "={{ $binary.data.fileName }}", "driveId": { "__rl": true, "mode": "list", "value": "My Drive" }, "folderId": { "__rl": true, "value": "root", "mode": "list", "cachedResultName": "/ (Root folder)", "cachedResultUrl": "https://drive.google.com/drive" }, "options": {} }, "type": "n8n-nodes-base.googleDrive", "typeVersion": 3, "position": [ -384, 160 ], "id": "2b43b996-8ca0-4eb1-a3fa-76f6b4549b67", "name": "Upload file", "credentials": { "googleDriveOAuth2Api": { "id": "ZpIdB1GDR3CTUSKi", "name": "Google Drive account" } } }, { "parameters": { "options": {} }, "type": "n8n-nodes-base.splitInBatches", "typeVersion": 3, "position": [ -2176, 224 ], "id": "723467e5-8483-4b89-9e15-1c623a823e3d", "name": "Loop Over Items" }, { "parameters": { "workflowId": { "__rl": true, "value": "B1RdaROPeQSEZIXK", "mode": "list", "cachedResultName": "get image binary" }, "workflowInputs": { "mappingMode": "defineBelow", "value": {}, "matchingColumns": [], "schema": [], "attemptToConvertTypes": false, "convertFieldsToString": true }, "options": {} }, "type": "n8n-nodes-base.executeWorkflow", "typeVersion": 1.2, "position": [ -1952, 224 ], "name": "Call get image binary", "id": "b63c8c2c-8316-4a88-b843-8ba98a1776a7" }, { "parameters": { "inputSource": "passthrough" }, "type": "n8n-nodes-base.executeWorkflowTrigger", "typeVersion": 1.1, "position": [ -3088, 224 ], "id": "7cddbde0-1ef6-45fe-aab5-5126cf946375", "name": "When Executed by Another Workflow" }, { "parameters": { "model": "deepseek-reasoner", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek", "typeVersion": 1, "position": [ -2864, 448 ], "id": "d65014f3-3e6e-4377-97fb-41b1e78c774f", "name": "DeepSeek Chat Model", "credentials": { "deepSeekApi": { "id": "qBpjoKzwzWCwA8r1", "name": "DeepSeek account" } } }, { "parameters": {}, "type": "@n8n/n8n-nodes-langchain.toolThink", "typeVersion": 1.1, "position": [ -2736, 448 ], "id": "40256790-c76e-4161-9b8c-d1187273c20d", "name": "Think" }, { "parameters": { "jsonSchemaExample": "\n{\n\"content\": \n[\n{\n\"type\": \n\"text\",\n\"text\": \n\"绘制下述图片\"\n}\n]\n}\n" }, "type": "@n8n/n8n-nodes-langchain.outputParserStructured", "typeVersion": 1.3, "position": [ -2608, 448 ], "id": "51422001-13e3-489f-b632-f5529efe56cd", "name": "Structured Output Parser" }, { "parameters": { "promptType": "define", "text": "={{$input.item.json.query}}", "hasOutputParser": true, "options": { "systemMessage": "# 介绍\n你是一个数据处理助手,需要输出一个数组,数组内单个数据代表一个缺失的图片资源" } }, "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 2.2, "position": [ -2816, 224 ], "id": "b9f152ee-12f6-4ff1-b2a8-b13d61f9a075", "name": "AI Agent" }, { "parameters": { "jsCode": "\n\nreturn $input.first().json.output.content.map(a=>{\n return {\n content: [\n {\n type:'image_url',\n image_url:\"https://drive.google.com/file/d/1iwIWh1P5Wbg2wKbFyYujZAPFvqdUU8Nr/view?usp=drive_link\"\n },\n {\n type:'text',\n text:'参考这个图片的画风,手法,保证协调性,生成符合下面描述的图片'\n },\n {\n type:'text',\n text:a.text\n }\n ]\n }\n})" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ -2400, 224 ], "id": "234a2e79-1ed9-4f6b-8ff6-b81a6897bc9c", "name": "deal" }, { "parameters": { "jsCode": "\nreturn $input.all();" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ -1728, 224 ], "id": "c856a0ac-8e8b-40ea-9066-beba6ee8eb89", "name": "Code6" }, { "parameters": { "operation": "write", "fileName": "=/home/node/{{ $binary.data.fileName }}", "options": {} }, "type": "n8n-nodes-base.readWriteFile", "typeVersion": 1, "position": [ -608, 160 ], "id": "5aed558b-c272-419a-a401-5d2df0aaae22", "name": "Read/Write Files from Disk", "disabled": true } ], "connections": { "HTTP Request1": { "main": [ [ { "node": "If", "type": "main", "index": 0 } ] ] }, "If": { "main": [ [ { "node": "Code4", "type": "main", "index": 0 } ], [ { "node": "Merge", "type": "main", "index": 0 } ] ] }, "Code4": { "main": [ [ { "node": "Code5", "type": "main", "index": 0 } ] ] }, "Code5": { "main": [ [ { "node": "Read/Write Files from Disk", "type": "main", "index": 0 } ] ] }, "Merge": { "main": [ [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "Upload file": { "main": [ [ { "node": "Merge", "type": "main", "index": 1 } ] ] }, "Loop Over Items": { "main": [ [ { "node": "No Operation, do nothing", "type": "main", "index": 0 } ], [ { "node": "Call get image binary", "type": "main", "index": 0 } ] ] }, "Call get image binary": { "main": [ [ { "node": "Code6", "type": "main", "index": 0 } ] ] }, "When Executed by Another Workflow": { "main": [ [ { "node": "AI Agent", "type": "main", "index": 0 } ] ] }, "DeepSeek Chat Model": { "ai_languageModel": [ [ { "node": "AI Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "Think": { "ai_tool": [ [ { "node": "AI Agent", "type": "ai_tool", "index": 0 } ] ] }, "Structured Output Parser": { "ai_outputParser": [ [ { "node": "AI Agent", "type": "ai_outputParser", "index": 0 } ] ] }, "AI Agent": { "main": [ [ { "node": "deal", "type": "main", "index": 0 } ] ] }, "deal": { "main": [ [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "Code6": { "main": [ [ { "node": "HTTP Request1", "type": "main", "index": 0 } ] ] }, "Read/Write Files from Disk": { "main": [ [ { "node": "Upload file", "type": "main", "index": 0 } ] ] } }, "pinData": { "When Executed by Another Workflow": [ { "query": "我需要生成以下缺失的资源:\n\n1. 卡佩托 - 拳击手角色,拳头巨大,表情凶狠的搏击选手形象\n2. 罗曼 - 包厢内品红酒的富豪角色,穿着考究,表情阴狠\n3. 阎王夫人 - 穿着旗袍的优雅女性角色,高跟鞋,有撒娇表情\n4. 拉斯维加斯搏击会馆场景 - 灯光璀璨的搏击场馆,观众席座无虚席\n5. 擂台场景 - 标准的拳击擂台,有绳圈\n6. 地府阎罗殿场景 - 阴暗的地府场景,有高台王座\n7. 空间通道场景 - 光芒四射的空间传送通道" } ] }, "meta": { "templateCredsSetupCompleted": true, "instanceId": "b3a8e0e1f9ab1bfe3a36f231f676f78bb30a519d2b21e6c530c0eee8ebb4a5d0" } }
  1. 主工作流
json
{ "nodes": [ { "parameters": { "options": {} }, "type": "@n8n/n8n-nodes-langchain.chatTrigger", "typeVersion": 1.3, "position": [ -880, -16 ], "id": "321baa16-8944-4d65-91c8-89288f9c3c79", "name": "When chat message received", "webhookId": "d791356b-743d-4e0c-81ff-1ff72522e029" }, { "parameters": {}, "type": "@n8n/n8n-nodes-langchain.toolThink", "typeVersion": 1.1, "position": [ 416, 208 ], "id": "a23c35c4-240f-4d14-a000-4297fe397643", "name": "Think" }, { "parameters": { "content": "简单分镜并匹配所有用到的资源", "height": 144, "width": 736, "color": 3 }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -96, 64 ], "id": "c2f58c5b-3e70-4184-a7db-ef576b9bb39a", "name": "Sticky Note" }, { "parameters": { "content": "细化分镜内容,补帧和镜头细节", "height": 144, "width": 256, "color": 3 }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 1056, 80 ], "id": "13d3fa49-f002-4022-b97b-8ecd907039fd", "name": "Sticky Note1" }, { "parameters": { "content": "配置音频", "height": 144, "width": 176, "color": 3 }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 1568, 80 ], "id": "fb61239a-478d-451c-9279-596fa733f7fc", "name": "Sticky Note2" }, { "parameters": { "model": "deepseek-reasoner", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek", "typeVersion": 1, "position": [ 288, 208 ], "id": "5264a647-8a56-4a44-8a70-82c30579ce3b", "name": "DeepSeek Chat Model2", "credentials": { "deepSeekApi": { "id": "qBpjoKzwzWCwA8r1", "name": "DeepSeek account" } } }, { "parameters": {}, "type": "@n8n/n8n-nodes-langchain.toolThink", "typeVersion": 1.1, "position": [ -528, 112 ], "id": "0448eae0-26ae-40d9-9643-05a68d1bfe1a", "name": "Think3" }, { "parameters": { "model": "deepseek-reasoner", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek", "typeVersion": 1, "position": [ -656, 112 ], "id": "50abb4c9-8977-4313-ac58-a9be61d7ad4a", "name": "DeepSeek Chat Model4", "credentials": { "deepSeekApi": { "id": "qBpjoKzwzWCwA8r1", "name": "DeepSeek account" } } }, { "parameters": { "model": "deepseek-reasoner", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek", "typeVersion": 1, "position": [ -304, 208 ], "id": "192e651c-40bc-4c10-b493-6b3dd006842c", "name": "DeepSeek Chat Model5", "credentials": { "deepSeekApi": { "id": "qBpjoKzwzWCwA8r1", "name": "DeepSeek account" } } }, { "parameters": { "endpointUrl": "http://host.docker.internal:3005/nxUFnUE2XPLURTmLvujspyN1/sse", "include": "selected", "includeTools": [ "get_source_url" ], "options": {} }, "type": "@n8n/n8n-nodes-langchain.mcpClientTool", "typeVersion": 1.1, "position": [ -176, 208 ], "id": "3b7c5e93-ea1c-475b-9403-8f21357832c1", "name": "MCP Client1" }, { "parameters": {}, "type": "@n8n/n8n-nodes-langchain.toolThink", "typeVersion": 1.1, "position": [ -48, 208 ], "id": "d2661174-6735-4455-a5d7-f968411d83c3", "name": "Think4" }, { "parameters": { "options": { "systemMessage": "# 介绍\n你的功能将小说章节拆分为适合定格动画的分镜头(每个分镜至少 1-2 句,描述清晰动作和场景,主要人物表情,分镜数量不限制)。输出 JSON 格式。\n## 输出格式如下\n[\n {\"scene\": 1, \"description\": \"主角走进昏暗的森林,树叶在风中摇曳\"},\n {\"scene\": 2, \"description\": \"他抬头望见一只猫头鹰栖息在树枝上\"},\n ...\n]" } }, "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 2.2, "position": [ -656, -128 ], "id": "94691abd-580d-47b0-8775-cac2b83e0365", "name": "分镜", "onError": "continueRegularOutput" }, { "parameters": { "promptType": "define", "text": "={{ $input.item }}", "options": { "systemMessage": "# 介绍\n你的功能是调用 tool 获取对应的图片url,只需要获取对应的主体,比如获取方源的角色资源,而不是获取方源的(喜,怒,哀,乐)资源。找资源前先看之前是否找过,如果同一个资源没找到,跳过这一个,你应该只需要分析一次,然后得到一个列表去调用tools获取资源,最终整合,没有的资源需要调用generate_missing_source去生成,包括但不仅限于背景,人物,特效等。\n\n# tools\nget_source_url: 通过询问xx的图片链接是什么获取url,没匹配上或者链接不完整就“缺失”,工具支持批量查询,比如“主角的图片链接是什么?路西法的图片链接是什么?阎王的图片链接是什么?”能得到三个图片链接,所以只允许调用一次\ngenerate_missing_source:最多调用一次, 汇总缺失的资源,调用该工具生成对应资源,调用示例:\n{\n\"content\": \n[\n{\n\"type\": \n\"text\",\n\"text\": \n\"这是参考图片\"\n}\n{\n\"type\": \n\"image_url\",\n\"image_url\":{\n \"url\":\"https://xxx\"\n}\n\n},\n{\n\"type\": \n\"text\",\n\"text\": \n\"你需要参考这个图片绘制一个xxx的东西\"\n}\n]\n}\n# 要求\n调用工具generate_missing_source时需要传递对象\n# 输出\n将你匹配上的资源输出, google drive的资源要获取https://drive.google.com/uc?id=1A_mhq_UvysNNPwLj2FnDsz_p7nOrpXGL&export=download 这种,也就是对应字段webContentLink", "maxIterations": 10 } }, "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 2.2, "position": [ -192, -16 ], "id": "8da6cfbc-6d33-41c8-87d6-b0278765b963", "name": "获取图片素材", "alwaysOutputData": true, "retryOnFail": false }, { "parameters": { "promptType": "define", "text": "=资源:{{JSON.stringify($input.item)}}\n分镜:{{ JSON.stringify($('分镜').item) }}", "hasOutputParser": true, "options": { "systemMessage": "# 概述\n整合资源和分镜\n# 输出内容\n以JSON的格式输出内容,将资源整合进分镜内,并在外层保留所有用到的资源及说明\n参考:\n{\n \"scenes\":[],\n \"source\":[]\n}", "returnIntermediateSteps": true } }, "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 2.2, "position": [ 352, -16 ], "id": "ebfb26f2-6dd3-4238-b91d-198a3047f111", "name": "加工", "retryOnFail": false, "onError": "continueRegularOutput" }, { "parameters": { "jsonSchemaExample": "{\n \"scenes\":[{\"scene\": 1, \"description\": \"拉斯维加斯搏击比赛现场,主持人在擂台上介绍比赛,观众席传来嘘声和扔来的瓶罐\", \"image\": [{\n \"descrip\":\"刘备的角色参考图\",\n \"url\":\"https://www.ssss.com\"\n }]\n }],\n \"sources\":[{\n \"descrip\":\"刘备的角色参考图\",\n \"url\":\"https://www.ssss.com\"\n },{\n \"descrip\":\"锦州背景图\",\n \"url\":\"https://www.ssss.com\"\n }]\n}" }, "type": "@n8n/n8n-nodes-langchain.outputParserStructured", "typeVersion": 1.3, "position": [ 544, 208 ], "id": "b88a062a-8280-4e61-9b12-bae91db71816", "name": "Structured Output Parser" }, { "parameters": { "jsCode": "const {scenes} = $json.output;\n\nreturn scenes.map(a=>{\n const item = a;\n const content = [];\n item.image.forEach(img=>{\n if(img.url !== 'missing_resource'){\n content.push({\n \"type\":\"text\",\n \"text\": `下面是${img.descrip}的相关图片`\n })\n content.push({\n \"type\":\"image_url\",\n \"image_url\":img.url\n })\n }\n\n })\n content.push({\n \"type\":\"text\",\n \"text\": `绘制下述场景${item.description}`\n})\n return {\n content\n }\n})" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 752, -16 ], "id": "d2f42a3c-428d-4640-8717-ae4e7704dcfc", "name": "Code" }, { "parameters": { "options": {} }, "type": "n8n-nodes-base.splitInBatches", "typeVersion": 3, "position": [ 976, -16 ], "id": "92dc7622-0c91-419d-9cec-666edfcb7a32", "name": "Loop Over Items" }, { "parameters": { "jsCode": "\nreturn $json.content" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1200, -160 ], "id": "7df6c3e0-6e87-46e2-9ed0-9388ef3d7136", "name": "Code1", "disabled": true }, { "parameters": { "jsCode": "\nreturn $input.all();" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ -880, -384 ], "id": "d0cb0bd7-84f8-4fce-b050-d93db68fea7b", "name": "Code2" }, { "parameters": { "jsCode": "\nreturn [\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景拉斯维加斯会馆内,主持人在擂台上介绍比赛,观众席座无虚席\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景观众向台上扔瓶罐和烟嘴,主持人惊慌失措地躲避飞来的物品\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景主持人擦着汗介绍两位选手:不死血龙齐灭和狂野雄狮卡佩托\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景全场灯光突然黯淡,只有两个通道口留下聚光灯照射\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景齐灭身穿红色短裤从左边通道跑出,抓住绳圈空翻上台\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景齐灭在台上表演连环腿,对着观众大喊要求分一半赌金\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景观众席沸腾,支持者欢呼,反对者发出倒彩声\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景卡佩托从右边通道走出,展示巨大的拳头,主持人夸张描述\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景主持人宣布无规则比赛规则和最后5分钟下注时间\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是路西法的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://huiji-thumb.huijistatic.com/gbf/uploads/thumb/c/c3/\"\n },\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景顶棚钢架上,堕天使路西法和阎王坐着观战,表情轻松\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是路西法的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://huiji-thumb.huijistatic.com/gbf/uploads/thumb/c/c3/\"\n },\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景两位神灵讨论比赛,路西法狡辩自己选手实力\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是路西法的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://huiji-thumb.huijistatic.com/gbf/uploads/thumb/c/c3/\"\n },\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景阎王提议打赌,路西法拿出堕落天使之剑和光明灵玉\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是路西法的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://huiji-thumb.huijistatic.com/gbf/uploads/thumb/c/c3/\"\n },\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景两人手掌对碰立下众神誓言,完成赌约\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景擂台上比赛激烈进行,齐灭使出组合拳逼退卡佩托\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景主持人兴奋解说,齐灭将卡佩托逼到擂台角落\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景包廂内罗曼品着红酒,看到比赛情况手抖洒出酒\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景罗曼转身质问保鏢是否下药成功,表情阴狠\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景保鏢紧张回答药效即将发作,内心祈祷不要出错\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景齐灭准备高段侧踢终结比赛,突然身体摇晃无力\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景卡佩托抓住机会开始猛烈反击,拳头重重砸向齐灭头部\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景齐灭视线被鲜血模糊,无力抵抗,逐渐失去意识\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"下面是路西法的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://huiji-thumb.huijistatic.com/gbf/uploads/thumb/c/c3/\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景顶棚上阎王愤怒大骂,掐指算出真相质问路西法\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是路西法的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://huiji-thumb.huijistatic.com/gbf/uploads/thumb/c/c3/\"\n },\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景路西法得意微笑,提醒阎王履行刷马桶的赌约\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是路西法的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://huiji-thumb.huijistatic.com/gbf/uploads/thumb/c/c3/\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景路西法展开黑色羽翼,扔出光明灵玉后消失\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景阎王愤怒握紧光明灵玉,捏法决收走齐灭灵魂\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景地府阎罗殿内,齐灭灵魂出现,迷茫打量阴森环境\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景阎王坐在王座上发怒,用噬魂波惩罚齐灭\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景齐灭痛苦抽搐,跪拜认错,心中担忧母亲病情\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景高跟鞋声响起,阎王夫人穿着时尚旗袍登场\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景夫人嘟嘴抱怨首饰丢失,扭着阎王耳朵要求寻找\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景阎王无奈答应,转向齐灭命令他去找首饰\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景阎王用地狱黑炎精母给齐灭灌输黑暗魔力\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景阎王再用光明灵玉灌输光明魔力,两股力量冲突\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景齐灭痛苦挣扎,体内两股魔力激烈碰撞\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"下面是齐灭的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c11df1913d444742762d0f60365fe?x-bce-process=image/format,f_auto/quality,Q_70/resize,m_lfit,limit_1,w_536\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景阎王划开空间通道,一脚将抽搐的齐灭踢进去\"\n }\n ]\n },\n {\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"下面是阎王的相关图片\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0odRJpAUaZft0jGmWff1q-7652Hkg2OLOUw&s\"\n },\n {\n \"type\": \"text\",\n \"text\": \"绘制下述场景阎王威胁齐灭尽快找到首饰,否则下18层地狱\"\n }\n ]\n }\n]" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ -656, 320 ], "id": "36e5fc40-877a-49ac-a4b6-84723d3c5299", "name": "Code3" }, { "parameters": { "workflowId": { "__rl": true, "value": "B1RdaROPeQSEZIXK", "mode": "list", "cachedResultName": "get image binary" }, "workflowInputs": { "mappingMode": "defineBelow", "value": {}, "matchingColumns": [], "schema": [], "attemptToConvertTypes": false, "convertFieldsToString": true }, "options": {} }, "type": "n8n-nodes-base.executeWorkflow", "typeVersion": 1.2, "position": [ 1424, -160 ], "name": "Call get image binary", "id": "a3d806fd-d9ca-43f8-a537-099c39be4d2e" }, { "parameters": { "method": "POST", "url": "https://openrouter.ai/api/v1/chat/completions", "authentication": "predefinedCredentialType", "nodeCredentialType": "openRouterApi", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"model\": \"google/gemini-2.5-flash-image-preview:free\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": {{ JSON.stringify($json.content) }}\n }\n ]\n}", "options": {} }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1872, -160 ], "id": "6fbeb1f2-d3c7-4e97-a006-e59c585b6bf5", "name": "HTTP Request1", "credentials": { "httpHeaderAuth": { "id": "rFYHDH4fk1VIIdXM", "name": "google api key" }, "openRouterApi": { "id": "D436dQhODHIoWKuv", "name": "github-open-router" } } }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 }, "conditions": [ { "id": "e6ee6bb2-87d1-4789-b5c2-ccc27fceefe1", "leftValue": "={{ !!$json?.choices?.[0]?.message?.images?.[0]?.image_url?.url }}", "rightValue": "", "operator": { "type": "boolean", "operation": "true", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ 2096, -96 ], "id": "f59bb618-2b53-4203-b47e-83978567342b", "name": "If" }, { "parameters": { "operation": "write", "fileName": "=/home/node/{{ $input.item.binary.data.fileName }}", "dataPropertyName": "=data", "options": {} }, "type": "n8n-nodes-base.readWriteFile", "typeVersion": 1, "position": [ 2768, -16 ], "id": "a0f04a38-3b48-49ca-9ae9-30cadefb1303", "name": "Read/Write Files from Disk" }, { "parameters": { "jsCode": "const sceneTitle = $('Code6').first().json.content.find(a=>a.type === 'text').text\n\nreturn [\n {\n json: {\n data:$input.first().json.choices[0].message.images[0].image_url.url.split(\",\")[1], // 去掉 data:image/png;base64, 前缀\n fileName:`${sceneTitle}.jpeg`\n }\n }\n];" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 2320, -96 ], "id": "39db2454-5c6a-40d5-bfbb-1687b1e03ab0", "name": "Code4" }, { "parameters": { "jsCode": "// 假设你的 base64 在 json.data\nconst base64 = $json.data; \n\nreturn [\n {\n binary: {\n data: {\n data: Buffer.from(base64, 'base64'), // 转成二进制\n mimeType: 'image/jpeg',\n fileName:$json.fileName,\n }\n }\n }\n];\n" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 2544, -96 ], "id": "6d70147d-e712-47e0-b4bb-504f41934f4a", "name": "Code5" }, { "parameters": { "jsCode": "\n\nreturn $input.all();" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1648, -160 ], "id": "b6f77070-af9d-4a42-8585-879340018e74", "name": "Code6" }, { "parameters": { "description": "=当有素材缺失时,需要调用该工具补充,入参参考:\n\n{\n\"content\": \n[\n{\n\"type\": \n\"text\",\n\"text\": \n\"这是参考图片\"\n}\n{\n\"type\": \n\"image_url\",\n\"image_url\":{\n \"url\":\"https://xxx\"\n}\n\n},\n{\n\"type\": \n\"text\",\n\"text\": \n\"你需要参考这个图片绘制一个xxx的东西\"\n}\n]\n}", "workflowId": { "__rl": true, "value": "BXRqR4rT8OCIEcTS", "mode": "list", "cachedResultName": "generate image and upload drive" }, "workflowInputs": { "mappingMode": "defineBelow", "value": {}, "matchingColumns": [], "schema": [ { "id": "content", "displayName": "content", "required": false, "defaultMatch": false, "display": true, "canBeUsedToMatch": true, "type": "object", "removed": false } ], "attemptToConvertTypes": false, "convertFieldsToString": false } }, "type": "@n8n/n8n-nodes-langchain.toolWorkflow", "typeVersion": 2.2, "position": [ 80, 208 ], "id": "b89a5098-f843-4859-9254-9890400897e3", "name": "generate missing source" } ], "connections": { "When chat message received": { "main": [ [ { "node": "分镜", "type": "main", "index": 0 } ] ] }, "Think": { "ai_tool": [ [ { "node": "加工", "type": "ai_tool", "index": 0 } ] ] }, "DeepSeek Chat Model2": { "ai_languageModel": [ [ { "node": "加工", "type": "ai_languageModel", "index": 0 } ] ] }, "Think3": { "ai_tool": [ [ { "node": "分镜", "type": "ai_tool", "index": 0 } ] ] }, "DeepSeek Chat Model4": { "ai_languageModel": [ [ { "node": "分镜", "type": "ai_languageModel", "index": 0 } ] ] }, "DeepSeek Chat Model5": { "ai_languageModel": [ [ { "node": "获取图片素材", "type": "ai_languageModel", "index": 0 } ] ] }, "MCP Client1": { "ai_tool": [ [ { "node": "获取图片素材", "type": "ai_tool", "index": 0 } ] ] }, "Think4": { "ai_tool": [ [ { "node": "获取图片素材", "type": "ai_tool", "index": 0 } ] ] }, "分镜": { "main": [ [ { "node": "获取图片素材", "type": "main", "index": 0 } ] ] }, "获取图片素材": { "main": [ [ { "node": "加工", "type": "main", "index": 0 } ] ] }, "加工": { "main": [ [ { "node": "Code", "type": "main", "index": 0 } ] ] }, "Structured Output Parser": { "ai_outputParser": [ [ { "node": "加工", "type": "ai_outputParser", "index": 0 } ] ] }, "Code": { "main": [ [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "Loop Over Items": { "main": [ [], [ { "node": "Code1", "type": "main", "index": 0 } ] ] }, "Code1": { "main": [ [ { "node": "Call get image binary", "type": "main", "index": 0 } ] ] }, "Code2": { "main": [ [] ] }, "Code3": { "main": [ [] ] }, "Call get image binary": { "main": [ [ { "node": "Code6", "type": "main", "index": 0 } ] ] }, "HTTP Request1": { "main": [ [ { "node": "If", "type": "main", "index": 0 } ] ] }, "If": { "main": [ [ { "node": "Code4", "type": "main", "index": 0 } ], [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "Read/Write Files from Disk": { "main": [ [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "Code4": { "main": [ [ { "node": "Code5", "type": "main", "index": 0 } ] ] }, "Code5": { "main": [ [ { "node": "Read/Write Files from Disk", "type": "main", "index": 0 } ] ] }, "Code6": { "main": [ [ { "node": "HTTP Request1", "type": "main", "index": 0 } ] ] }, "generate missing source": { "ai_tool": [ [ { "node": "获取图片素材", "type": "ai_tool", "index": 0 } ] ] } }, "pinData": {}, "meta": { "templateCredsSetupCompleted": true, "instanceId": "b3a8e0e1f9ab1bfe3a36f231f676f78bb30a519d2b21e6c530c0eee8ebb4a5d0" } }
  1. 将数组中的 url 转为 base64 - binary
json
{ "nodes": [ { "parameters": { "options": {} }, "type": "n8n-nodes-base.splitInBatches", "typeVersion": 3, "position": [ 2064, 768 ], "id": "974943b0-6d6c-404d-87af-4d9a762177ef", "name": "Loop Over Items1" }, { "parameters": { "inputSource": "passthrough" }, "id": "62acbd99-a2f7-4171-b999-98cd05ca2f56", "typeVersion": 1.1, "name": "Start", "type": "n8n-nodes-base.executeWorkflowTrigger", "position": [ 1616, 768 ], "alwaysOutputData": true }, { "parameters": { "jsCode": "\n\nreturn $json.content;" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1840, 768 ], "id": "76a3b315-99ba-4adf-aa4a-b4a2a2de4b57", "name": "Code" }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 }, "conditions": [ { "id": "cae94cb7-980d-4a8d-9378-b5697d9c274d", "leftValue": "={{ $json.type }}", "rightValue": "=image_url", "operator": { "type": "string", "operation": "equals", "name": "filter.operator.equals" } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ 2512, 768 ], "id": "6c611caa-d9b0-4901-8d76-8f777bc51300", "name": "If" }, { "parameters": { "url": "={{ $json.image_url }}", "options": {} }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 2960, 944 ], "id": "09c1a363-6e64-45c6-9527-20eec9f47cbb", "name": "HTTP Request", "onError": "continueRegularOutput" }, { "parameters": { "jsCode": "\nreturn $json" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 2288, 768 ], "id": "41e6a2ee-3499-48b7-89ac-81e18adfa0b9", "name": "href" }, { "parameters": { "jsCode": "\nreturn {\n ...$('href').item.json,\n image_url:{\n url:`data:image/jpeg;base64,${$input.item.binary.data.data}`\n }\n}" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 3632, 752 ], "id": "d040d733-f3e2-432a-a739-14622729a158", "name": "fill base64" }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 }, "conditions": [ { "id": "0088135e-dcd5-476c-a3b7-808f0b8997f6", "leftValue": "={{ !!$input.item.binary.data.data }}", "rightValue": "", "operator": { "type": "boolean", "operation": "true", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ 3408, 848 ], "id": "ff3617d9-9193-42ac-b3e9-56190f6f8cd6", "name": "If1" }, { "parameters": { "numberInputs": 3 }, "type": "n8n-nodes-base.merge", "typeVersion": 3.2, "position": [ 3856, 832 ], "id": "bb548872-98c2-41ef-ac1f-d50fce0628fd", "name": "Merge" }, { "parameters": {}, "type": "n8n-nodes-base.noOp", "typeVersion": 1, "position": [ 2512, 576 ], "id": "643c70fb-04b8-4f57-a762-3c06993a6504", "name": "No Operation, do nothing" }, { "parameters": { "jsCode": "\nreturn {\n content: $input.all().map(a=>a.json)\n}" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 2288, 576 ], "id": "21c51fac-8f2a-43f0-ac0f-97810259f968", "name": "Code1" }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 }, "conditions": [ { "id": "c223ac9a-3db9-4ae1-acfe-9b4d616bc1cd", "leftValue": "={{$json.image_url}}", "rightValue": "google", "operator": { "type": "string", "operation": "contains" } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ 2736, 848 ], "id": "13c46678-57c9-4eb8-9a12-0aff49e5a1d0", "name": "If2" }, { "parameters": { "operation": "download", "fileId": { "__rl": true, "value": "={{$json.image_url}}", "mode": "url" }, "options": {} }, "type": "n8n-nodes-base.googleDrive", "typeVersion": 3, "position": [ 2960, 752 ], "id": "73a4c8fe-c230-4871-8b74-3f7ecc0b4f2c", "name": "Download file", "credentials": { "googleDriveOAuth2Api": { "id": "ZpIdB1GDR3CTUSKi", "name": "Google Drive account" } } }, { "parameters": {}, "type": "n8n-nodes-base.merge", "typeVersion": 3.2, "position": [ 3184, 848 ], "id": "adef9e20-558b-4755-9700-c42a47623f53", "name": "Merge1" } ], "connections": { "Loop Over Items1": { "main": [ [ { "node": "Code1", "type": "main", "index": 0 } ], [ { "node": "href", "type": "main", "index": 0 } ] ] }, "Start": { "main": [ [ { "node": "Code", "type": "main", "index": 0 } ] ] }, "Code": { "main": [ [ { "node": "Loop Over Items1", "type": "main", "index": 0 } ] ] }, "If": { "main": [ [ { "node": "If2", "type": "main", "index": 0 } ], [ { "node": "Merge", "type": "main", "index": 2 } ] ] }, "HTTP Request": { "main": [ [ { "node": "Merge1", "type": "main", "index": 1 } ] ] }, "href": { "main": [ [ { "node": "If", "type": "main", "index": 0 } ] ] }, "fill base64": { "main": [ [ { "node": "Merge", "type": "main", "index": 0 } ] ] }, "If1": { "main": [ [ { "node": "fill base64", "type": "main", "index": 0 } ], [ { "node": "Merge", "type": "main", "index": 1 } ] ] }, "Merge": { "main": [ [ { "node": "Loop Over Items1", "type": "main", "index": 0 } ] ] }, "Code1": { "main": [ [ { "node": "No Operation, do nothing", "type": "main", "index": 0 } ] ] }, "If2": { "main": [ [ { "node": "Download file", "type": "main", "index": 0 } ], [ { "node": "HTTP Request", "type": "main", "index": 0 } ] ] }, "Download file": { "main": [ [ { "node": "Merge1", "type": "main", "index": 0 } ] ] }, "Merge1": { "main": [ [ { "node": "If1", "type": "main", "index": 0 } ] ] } }, "pinData": {}, "meta": { "templateCredsSetupCompleted": true, "instanceId": "b3a8e0e1f9ab1bfe3a36f231f676f78bb30a519d2b21e6c530c0eee8ebb4a5d0" } }
如果对你有用的话,可以打赏哦
打赏
ali pay
wechat pay

本文作者:beq

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

湘ICP备2025129656号-1