Flux AI 文生图与 Google Drive 存储及 Sheets 日志记录
中级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 15 个节点。主要使用 If, Code, FormTrigger, GoogleDrive, HttpRequest 等节点。 使用 Flux AI 进行文生图,集成 Google Drive 存储和 Sheets 日志记录
前置要求
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752"
},
"nodes": [
{
"id": "5ce3fec1-830d-4814-aff0-c2fbe34aeb6e",
"name": "表单提交时",
"type": "n8n-nodes-base.formTrigger",
"position": [
-1280,
40
],
"webhookId": "34937e21-14cc-40c7-adf9-d0d0cd0b6a33",
"parameters": {
"options": {},
"formTitle": "Text To Image Flux AI",
"formFields": {
"values": [
{
"fieldType": "textarea",
"fieldLabel": "Prompt",
"placeholder": "A photograph of a \"Mateen\" Sommer Edition energy drink can, suspended in mid-air against a cool, gradient backdrop. The sleek silver can prominently displays the vibrant \"Neo hair lotion\" flavor, adorned with dynamic blue and white graphics and heavily frosted with condensation. Surrounding the can is a swirling cloud of frosty vapor composed of irregularly shaped, shimmering ice cubes, illuminated by a focused spotlight that highlights the can's metallic sheen. Soft, diffused lighting emphasizes the crispness of the energy drink and creates a refreshing atmosphere, setting it against a backdrop shifting from deep indigo to a lighter sky blue.",
"requiredField": true
}
]
},
"formDescription": "Add prompt to generate desired image"
},
"typeVersion": 2.2
},
{
"id": "21190262-f358-4d1f-8341-f6e785aec8d0",
"name": "HTTP 请求",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueErrorOutput",
"position": [
-1060,
40
],
"parameters": {
"url": "https://text-to-image-generator-flux.p.rapidapi.com/flux.php",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "prompt",
"value": "={{ $json.Prompt }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "x-rapidapi-host",
"value": "text-to-image-generator-flux.p.rapidapi.com"
},
{
"name": "x-rapidapi-key",
"value": "your key"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "bad3b411-7f24-42c9-8561-5ec659561c72",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
-560,
-120
],
"parameters": {
"jsCode": "const base64String = $input.first().json.image_base64;\nconsole.log(base64String);\n// If it includes a prefix like 'data:image/jpeg;base64,', split it\nconst cleanedBase64 = base64String.includes(\",\")\n ? base64String.split(\",\")[1]\n : base64String;\n\nreturn [\n {\n binary: {\n data: {\n data: Buffer.from(cleanedBase64, 'base64'),\n mimeType: 'image/jpeg', // or image/png depending on the format\n fileName: 'output.jpg'\n }\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "5d9f952e-88c4-4007-8c12-56e25b05194c",
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
-180,
280
],
"parameters": {
"columns": {
"value": {
"Image": "={{ $binary.data.fileName }}",
"Prompt": "={{ $('On form submission').item.json.Prompt }}",
"Generated Date": "={{ $('On form submission').item.json.submittedAt }}"
},
"schema": [
{
"id": "Prompt",
"type": "string",
"display": true,
"required": false,
"displayName": "Prompt",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Image",
"type": "string",
"display": true,
"required": false,
"displayName": "Image",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Generated Date",
"type": "string",
"display": true,
"required": false,
"displayName": "Generated Date",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/19RkfJHHLt15sIwaeN5Fgrd4BuVTacA0_mYP-gPcBVao/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "qUtlCnYpk7bXXaYp",
"name": "Google Sheets account 3"
}
},
"typeVersion": 4.6
},
{
"id": "9bcc807e-7e28-425b-a721-10c238502fc0",
"name": "Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
-240,
-120
],
"parameters": {
"name": "=ok{{ $binary.data.fileName }}",
"driveId": {
"__rl": true,
"mode": "url",
"value": ""
},
"options": {},
"folderId": {
"__rl": true,
"mode": "url",
"value": ""
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "qUtlCnYpk7bXXaYp",
"name": "Google Sheets account 3"
}
},
"typeVersion": 3
},
{
"id": "0bd277e7-e5d5-4695-bd4c-656fc921aea1",
"name": "条件判断",
"type": "n8n-nodes-base.if",
"position": [
-880,
400
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "205d9270-aa0e-4864-bbb6-c67206eda0a2",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.error }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "2a72cd55-a8f1-4fe3-b632-d704afd4bce1",
"name": "Google Sheets5",
"type": "n8n-nodes-base.googleSheets",
"position": [
-520,
480
],
"parameters": {
"columns": {
"value": {
"Base64": "={{ $json.error }}",
"Prompt": "={{ $json.Prompt }}"
},
"schema": [
{
"id": "Prompt",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Prompt",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "drive path",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "drive path",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Generated Date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Generated Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Base64",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Base64",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"Prompt"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mT6GkDE1_tcPzv6K1h9jHWyEVsg4d7Pj0UR1te3rGlg/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "qUtlCnYpk7bXXaYp",
"name": "Google Sheets account 3"
}
},
"typeVersion": 4.6
},
{
"id": "e5880625-4059-485e-a2ef-b0eed85992bb",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2340,
-520
],
"parameters": {
"width": 740,
"height": 1020,
"content": "# 🎨 使用 Flux AI 的 AI 图像生成器"
},
"typeVersion": 1
},
{
"id": "b59714dd-74ea-4c7a-819e-0d64c188a2f5",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1360,
-160
],
"parameters": {
"height": 320,
"content": "### 1. 📝 表单提交时"
},
"typeVersion": 1
},
{
"id": "6b953a64-3f26-4e7e-9580-947f4a7d503d",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1080,
-160
],
"parameters": {
"height": 320,
"content": "### 2. 🌐 HTTP 请求 — Flux AI API"
},
"typeVersion": 1
},
{
"id": "50588ad0-9f4b-4e90-ab90-9e0ae8f83595",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
-340
],
"parameters": {
"height": 380,
"content": "### 3. 🧪 代码节点 — Base64 解码器"
},
"typeVersion": 1
},
{
"id": "9b412619-0589-4dbb-a601-8322bb571a6e",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-300,
-320
],
"parameters": {
"height": 360,
"content": "### 4. 📁 Google Drive"
},
"typeVersion": 1
},
{
"id": "b2913804-5555-4a30-b713-94236188a28e",
"name": "便利贴5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-240,
100
],
"parameters": {
"height": 340,
"content": "### 5. 📊 Google Sheets — 成功日志"
},
"typeVersion": 1
},
{
"id": "7fd8d0b3-d6f2-445a-810b-558ed33e1084",
"name": "便签 6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-920,
200
],
"parameters": {
"height": 320,
"content": "### 6. ⚠️ 条件节点 — 错误检测"
},
"typeVersion": 1
},
{
"id": "25e8bc2c-bf70-452c-bd7d-45052d9f85d6",
"name": "便签 7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-580,
300
],
"parameters": {
"height": 340,
"content": "### 7. 📉 Google Sheets — 错误日志"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"If": {
"main": [
[
{
"node": "Google Sheets5",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Google Sheets",
"type": "main",
"index": 0
},
{
"node": "Google Drive",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
],
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"On form submission": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用 Sora GPT、Google Drive 和 Sheets 生成并存储 AI 图像
使用 Sora GPT、Google Drive 和 Sheets 生成并存储 AI 图像
Code
Form Trigger
Google Drive
+3
11 节点Sk developer
内容创作
追踪网站流量与反向链接
使用 Ahref API 和 Google Sheets 追踪网站流量与反向链接
If
Set
Code
+5
19 节点Sk developer
内容创作
IMDB视频自动下载器(含Google Drive上传和邮件提醒)
IMDB视频自动下载器(含Google Drive上传和邮件提醒)
If
Wait
Email Send
+4
19 节点Sk developer
内容创作
使用 RapidAPI 和 Google Sheets 的自动抄袭检测与邮件报告
使用 RapidAPI 和 Google Sheets 的自动抄袭检测与邮件报告
If
Code
Email Send
+4
19 节点Sk developer
内容创作
WordPress博客自动化专业版(深度研究)v2.1市场
使用GPT-4o、Perplexity AI和多语言支持自动化SEO优化的博客创建
If
Set
Xml
+27
125 节点Daniel Ng
内容创作
使用RapidAPI将LinkedIn视频转换为MP4并存储到Google Drive和Sheets
使用RapidAPI将LinkedIn视频转换为MP4并存储到Google Drive和Sheets
If
Wait
Form Trigger
+4
16 节点Sk developer
内容创作