8
n8n 中文网amn8n.com

AI 厨师

中级

这是一个Miscellaneous, AI Chatbot, Multimodal AI领域的自动化工作流,包含 12 个节点。主要使用 Set, Telegram, HttpRequest, ConvertToFile, Agent 等节点。 通过 Telegram 机器人生成自定义食谱和餐厅风格美食图片

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "Qhd5ZE0WdsOiFQqj",
  "meta": {
    "instanceId": "a419abc01bb0423bd41f1b0c0b1dc4e0a3c69d0074efa38bd450d30bc82d13ad",
    "templateCredsSetupCompleted": true
  },
  "name": "AI 厨师",
  "tags": [],
  "nodes": [
    {
      "id": "525c226c-d024-4e37-8052-a2b3a0996bf1",
      "name": "OpenRouter 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        48,
        240
      ],
      "parameters": {
        "model": "openai/gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "9hdN4saNpFu3PPCh",
          "name": "Ai chef"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1bd83992-eb8c-4aea-8888-878cd67f8a50",
      "name": "窗口缓冲记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        208,
        240
      ],
      "parameters": {
        "sessionKey": "={{ $json.message.chat.id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 200
      },
      "typeVersion": 1.3
    },
    {
      "id": "77562a10-731c-4c6a-a938-5f61c8e74266",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        0,
        0
      ],
      "webhookId": "e7c9b1ad-f1ce-4ce5-a23e-63e9fd24b9e1",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "OxDi4W0V8EvRRA2F",
          "name": "AI Chef Assistant"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "dfc79eec-88ac-4c6f-b189-4c07f782c0fa",
      "name": "发送文本消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        512,
        0
      ],
      "webhookId": "e8c60f4d-74e3-4875-934a-043cf5e5815e",
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "OxDi4W0V8EvRRA2F",
          "name": "AI Chef Assistant"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a09f687d-3943-4787-a19e-5163be6bdf75",
      "name": "Nano 🍌",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        0
      ],
      "parameters": {
        "url": "https://openrouter.ai/api/v1/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"google/gemini-2.5-flash-image-preview:free\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"Generate a photorealistic image of {{ $json.output }}\"\n        }\n      ]\n    }\n  ]\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer $OPENROUTER_API_KEY"
            }
          ]
        },
        "nodeCredentialType": "openRouterApi"
      },
      "credentials": {
        "openRouterApi": {
          "id": "7pnW2IfzgeEN8qVd",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a51cdb6b-d997-4f6a-a75a-12f6e249a680",
      "name": "编辑字段",
      "type": "n8n-nodes-base.set",
      "position": [
        1248,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6355ac9e-1f4c-42a3-8167-8bb8298cd369",
              "name": "data",
              "type": "string",
              "value": "={{ $json.choices[0].message.images[0].image_url.url }}"
            },
            {
              "id": "dc98bc1c-4048-4fcb-80c5-73dc99b78ddd",
              "name": "base",
              "type": "string",
              "value": "={{ $json.choices[0].message.images[0].image_url.url.split(',')[1] }}"
            },
            {
              "id": "8033a47e-f50c-43ae-b404-99d0fb5cf4eb",
              "name": "mime",
              "type": "string",
              "value": "={{ $json.choices[0].message.images[0].image_url.url.split(';')[0].split(':')[1] }}"
            },
            {
              "id": "0e516163-02cc-4242-ba70-ac2bce94d2dd",
              "name": "fileName",
              "type": "string",
              "value": ".png"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bf15ba16-f228-4df1-a5f2-48dd3eceb2af",
      "name": "转换为文件",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1152,
        240
      ],
      "parameters": {
        "options": {},
        "operation": "toBinary",
        "sourceProperty": "base"
      },
      "typeVersion": 1.1
    },
    {
      "id": "0b449fab-316d-4379-88cc-5ff4136149e0",
      "name": "OpenRouter 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        592,
        272
      ],
      "parameters": {
        "model": "openai/gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "9hdN4saNpFu3PPCh",
          "name": "Ai chef"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d02178f2-962f-4dcd-978a-fffa8564ae1c",
      "name": "发送图片消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1360,
        240
      ],
      "webhookId": "358204d7-18d1-4486-bbc7-b75abdd0bd97",
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "OxDi4W0V8EvRRA2F",
          "name": "AI Chef Assistant"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "24ceeec0-77af-441b-b479-62a3608effd8",
      "name": "AI 食谱",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        208,
        0
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "You are a friendly and professional Virtual Chef Assistant. \nYour role is to help users with cooking, recipes, meal planning, food substitutions, nutrition tips, and step-by-step cooking guidance.  \n\nGuidelines:\n- Always reply in a clear, simple, and conversational tone.  \n- Suggest recipes based on available ingredients, dietary preferences, or cuisine styles.  \n- Provide step-by-step cooking instructions when asked.  \n- Offer ingredient substitutions if something is missing.  \n- Give nutrition advice when relevant, but do not provide medical advice.  \n- Be creative, encouraging, and make cooking feel fun and easy.  \n- If the user asks for meal plans, suggest balanced options (breakfast, lunch, dinner, snacks).  \n- If the user asks general questions about food or cooking techniques, explain in an easy-to-understand way.  \n- Do not provide unsafe cooking practices or harmful instructions.  \n\nYour personality:\n- Warm, supportive, and encouraging like a personal chef.  \n- Use a mix of professional cooking knowledge and friendly conversation.  \n- Adapt tone depending on user: beginner = simple steps, experienced = more advanced techniques."
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "9d5b6784-261d-41a7-8f51-87298625ec2e",
      "name": "餐厅风格摆盘提示",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        688,
        0
      ],
      "parameters": {
        "text": "={{ $('AI Recipe').item.json.output }}",
        "options": {
          "systemMessage": "You are an expert AI prompt generator for text-to-image models. \nYour task is to read the recipe text provided and generate a single, clear, and detailed prompt suitable for a photorealistic image generation AI. \nDo not explain the recipe, do not add extra commentary, and do not output anything else except the image prompt. \n\nFocus only on visual details:\n- How the dish looks on a plate\n- Plating style and arrangement\n- Colors, textures, garnishes\n- Lighting and perspective\n- Use only plates and dishware typically found in professional restaurants (white ceramic, slate, glass, or elegant serving dishes)\n- Make it look like a high-end restaurant presentation\n\nThe output should be concise, a single paragraph of text, fully descriptive, ready to feed directly into an image generation model and output should be in English."
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "3a28861d-d7cb-490a-b8a5-aa48c0846a43",
      "name": "便利贴",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        -272
      ],
      "parameters": {
        "width": 496,
        "height": 464,
        "content": "## AI 厨师机器人 - 食谱+美食图片生成器"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4c3ecc19-e40d-4dfd-ba47-4c66aaade24e",
  "connections": {
    "AI Recipe": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nano 🍌": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Send a photo message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Recipe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a text message": {
      "main": [
        [
          {
            "node": "Restaurant-Style Plating prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Recipe",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Recipe",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Restaurant-Style Plating prompt",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Restaurant-Style Plating prompt": {
      "main": [
        [
          {
            "node": "Nano 🍌",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 杂项, AI 聊天机器人, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流