8
n8n 中文网amn8n.com

使用OpenAI GPT和图像生成创建食物表情符号图标

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 9 个节点。主要使用 Set, FormTrigger, GoogleDrive, OpenAi 等节点。 使用OpenAI GPT和图像生成创建食物表情符号图标

前置要求
  • Google Drive API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "a09b543763e855b68b4ed52d00ba35f11887d45eaf642b193f6d127dc1c99de2",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "1dbacde4-6cb5-46c1-8542-57803ecce72d",
      "name": "触发器:食物表情表单提交",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -180,
        -400
      ],
      "webhookId": "b831ae2a-64bc-4444-8034-1974477655fd",
      "parameters": {
        "options": {},
        "formTitle": "Submit a food item",
        "formFields": {
          "values": [
            {
              "fieldLabel": "What food emoji would you like to generate?",
              "placeholder": "a green apple",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Enter a food name (e.g. avocado, donut) to generate a 400×400-pixel 3D emoji 🥑"
      },
      "typeVersion": 2.2
    },
    {
      "id": "586fb2f5-0190-4118-a0d5-1aff2ad54eab",
      "name": "准备样式-JSON 提示",
      "type": "n8n-nodes-base.set",
      "position": [
        60,
        -400
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b6d8f708-9e12-4002-8800-0c32b7fe27ee",
              "name": "=json_generator",
              "type": "string",
              "value": "=Given the food item: \"{{ $json['What food emoji would you like to generate?'] }}\", generate a JSON object describing how it should be styled as a 3D-rendered emoji-style icon suitable for use in a digital food icon set. The style should be modern, playful, and semi-realistic, with a transparent background and a 400x400 pixel size.\n\nThe JSON should include these sections:\n\n- form (shape, outline, detail)\n\n- lighting (gloss, shadow, detail)\n\n- texture (surface, detail)\n\n- background (type, detail)\n\n- color_handling (strategy, look, detail)\n\n- color_palette (detail)\n\nAdapt each parameter thoughtfully based on the physical properties and personality of the given food item."
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b1baad14-1ac6-42ca-9c4c-90aec4e3581d",
      "name": "LLM:生成样式-JSON",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        260,
        -400
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "={{ $json.json_generator }}"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "wOiJt6W2EFdWAN1S",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "b120e2ce-b91b-4b8b-a869-e3fc7c5dcf11",
      "name": "图像生成:渲染食物表情图标",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        600,
        -400
      ],
      "parameters": {
        "model": "gpt-image-1",
        "prompt": "=Generate a 3D-rendered emoji-style digital icon of a {{ $('Trigger: Food Emoji Form Submission').item.json['What food emoji would you like to generate?'] }}, designed with the following visual specifications:\n{{ $json.message.content.toJsonString() }}\n\nRender the icon centered in a 400x400 pixel square, isolated on a transparent background, with no props or text. The result should look like a high-quality digital food emoji: slightly exaggerated, clean, friendly, and polished — consistent with a modern mobile icon set.\n",
        "options": {},
        "resource": "image"
      },
      "credentials": {
        "openAiApi": {
          "id": "wOiJt6W2EFdWAN1S",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "0b04e850-a174-46f6-b9df-28a81eae24cb",
      "name": "保存到 Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        820,
        -400
      ],
      "parameters": {
        "name": "={{ $('Trigger: Food Emoji Form Submission').item.json['What food emoji would you like to generate?'] }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        },
        "inputDataFieldName": "=data"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "sZRn5ArVlryJuorg",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "420a9a11-a714-4489-bb9d-4c8398244a83",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -260,
        -520
      ],
      "parameters": {
        "height": 340,
        "content": "## | 输入:信息收集表单"
      },
      "typeVersion": 1
    },
    {
      "id": "79e68bf4-aeb1-46cd-a18c-e0ed9ac9ecb5",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        -520
      ],
      "parameters": {
        "color": 4,
        "width": 720,
        "height": 340,
        "content": "## | 步骤 1:生成图像"
      },
      "typeVersion": 1
    },
    {
      "id": "7eb01630-14cf-4782-a6d0-a5f7d5a06bab",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        -520
      ],
      "parameters": {
        "color": 5,
        "height": 340,
        "content": "## | 步骤 2:上传到 Google Drive"
      },
      "typeVersion": 1
    },
    {
      "id": "80517e7d-8511-42b5-9e24-774c22e0a2fe",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -260,
        -140
      ],
      "parameters": {
        "color": 7,
        "width": 1280,
        "height": 380,
        "content": "## 🚀 设置要求"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "LLM: Generate Style‑JSON": {
      "main": [
        [
          {
            "node": "Image‑Gen: Render Food Emoji Icon",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Style‑JSON Prompt": {
      "main": [
        [
          {
            "node": "LLM: Generate Style‑JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image‑Gen: Render Food Emoji Icon": {
      "main": [
        [
          {
            "node": "Save to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger: Food Emoji Form Submission": {
      "main": [
        [
          {
            "node": "Prepare Style‑JSON Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量9
分类2
节点类型5
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Adnan

Adnan

@adnan

Information Security, Governance, Risk and Compliance Leader

外部链接
在 n8n.io 查看

分享此工作流