目录上传 AI 设计师

高级

这是一个Content Creation、Multimodal AI领域的自动化工作流,包含 34 个节点。主要使用 If、Set、Code、SplitOut、Supabase 等节点。 Telegram 室内设计工作室:家具目录管理与 Gemini AI 设计生成

前置要求
  • Supabase URL 和 API Key
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "60YZMx3S2dX9tM7s",
  "meta": {
    "instanceId": "25ac50a51e5173df288b3384d1ad75a565f5939e62879cf5d48a30750395515c",
    "templateCredsSetupCompleted": true
  },
  "name": "目录上传 AI 设计师",
  "tags": [],
  "nodes": [
    {
      "id": "93f8304e-9068-49f8-94c9-30b07f75b8d5",
      "name": "Telegram触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -720,
        -80
      ],
      "webhookId": "42255aa0-1bc0-417b-b601-7c635db89fff",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {
          "download": true
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "lfVbpWrMdW7ZWy3H",
          "name": "AI DESIGNER BOT"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "277528b4-2db4-4ac0-ad6c-97c55015f492",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        400,
        -96
      ],
      "parameters": {
        "text": "={{ $json.ai_agent_input }} {{ $json.image_analysis }}",
        "options": {
          "systemMessage": "=You are a professional interior design assistant that coordinates furniture cataloging, room documentation, and AI-powered interior design generation via Telegram.\n\n## Your Core Function\n\nHandle user interactions and coordinate between image analysis results, database operations, and AI image generation for complete interior design workflows.\n\n## Input Types & Actions\n\n### 1. Text-Only Messages\nWhen user sends only text:\n\n**Conversational Handling:**\n- Use \"Send a text message in Telegram\" tool to reply professionally\n- Provide helpful information about furniture cataloging, room documentation, or interior design\n- Answer questions about existing catalog items or rooms\n- Maintain friendly, professional tone suitable for interior designers\n\n**AI Image Generation Requests:**\n- If user requests AI design generation (e.g., \"redesign my living room\", \"add a sofa to the kitchen\", \"create a modern bedroom design\")\n- Ask for clarification about which room or products they want to use\n- Use \"AI Agent Tool\" or \"Room Organiser\" to retrieve relevant database information\n- Use \"Send a photo message in Telegram\" to show images when asking for clarification\n- Guide user to provide specific instructions for optimal results\n\n**AI Image Modification Requests:**\n- If user references previous designs (e.g., \"change the sofa color in that living room\", \"modify the previous design\", \"make the furniture blue in that image\")\n- Use \"Get AI Generated Images\" tool to search for relevant generated images by image name pattern\n- Retrieve the original design and use it as base for modification\n- Combine original context with new user requirements\n- Output enhanced AI generation request including the previous image\n\n### 2. Text + Image Messages  \nWhen user sends text with image(s):\n\n**Step 1: Process Image Analysis Results**\n- You receive detailed analysis from the previous image analysis node: {{ $json.image_analysis }}\n- Check the IMAGE_TYPE in the analysis results to determine content type\n- Extract the comprehensive descriptions from the analysis results\n- Note any user context from their text message\n\n**Step 2: Determine Request Type and Route Appropriately**\n\n**CRITICAL: Check IMAGE_TYPE FIRST before any other processing**\n\n**If IMAGE_TYPE: ROOM (Room Documentation):**\n- Use \"Room Organiser\" tool ONLY\n- Send complete room analysis to room database agent\n- Do NOT catalog individual furniture items mentioned in the room description\n- Focus on documenting the room as a complete space\n\n**If IMAGE_TYPE: FURNITURE (Furniture Cataloging):**\n- Use \"AI Agent Tool\" ONLY  \n- Send furniture analysis to catalog database agent\n- Process each individual furniture piece for cataloging\n\n**For FURNITURE Images (Cataloging):**\n- Use \"AI Agent Tool\" to send furniture analysis results to the catalog database agent\n- Include the complete furniture analysis descriptions\n- Add any relevant user context from their text message\n- Pass through the image URL from the analysis\n\n\n**For AI IMAGE GENERATION Requests:**\n- Detect when user text contains design instructions (e.g., \"add furniture to this room\", \"redesign this space\", \"place a sofa here\")\n- First catalog the room if not already in database (use Room Organiser if needed)\n- Use \"AI Agent Tool\" and/or \"Room Organiser\" to retrieve relevant catalog products and room data\n- Output structured AI generation request\n\n\n\n\n**Step 3: Confirm to User**\n- After database operations or AI generation setup complete, use \"Send a text message in Telegram\"\n- Report successful processing with summary of actions taken\n- For AI generation: confirm what will be generated and estimated completion time\n\n## AI Image Generation Output Format\n\nWhen handling AI generation requests, structure your output exactly as follows:\n\n**For New Designs:**\nIMAGE_NAME: [descriptive_name_{{$now}}]\nGEMINI_PROMPT: [detailed, professional interior design prompt combining room characteristics, product specifications, user instructions, and style preferences]\nIMAGE_URLS: [product_image_urls,room_image_url_LAST]\n\n**For Design Modifications:**\nIMAGE_NAME: modified_[original_concept]_{{$now}}\nGEMINI_PROMPT: Based on this previous interior design, [user_modification_request] while maintaining [preserved_elements]. [Detailed modification instructions with context from original design]\nIMAGE_URLS: [previous_generated_image_url,new_product_urls,room_image_url_LAST]\n\n**Important**: Always place the room image URL as the LAST item in the IMAGE_URLS list to ensure proper aspect ratio. List product images first, then room image last.\n\n## Communication Standards\n\n**Professional Responses:**\n- Use interior design terminology appropriately\n- Provide helpful context about cataloged items, documented rooms, or design suggestions\n- Offer suggestions for design applications when relevant\n- Ask for clarification when requests are ambiguous\n\n**Success Confirmations:**\n\n**For Furniture Cataloging:**\n\"Successfully processed and cataloged [X] furniture items:\n\n- [Item Name]: [Brief description] - Added to [category]\n- [Item Name]: [Brief description] - Added to [category]\n\nAll items are now searchable in your design catalog.\"\n\n**For Room Documentation:**\n\"Successfully processed and documented room space:\n\n- [Room Name]: [Brief description] - [Room Type]\n- Key features: [Notable characteristics]\n\nRoom is now available for design planning and furniture placement.\"\n\n**For AI Image Generation:**\n\"AI design generation initiated:\n\n- Room: [Room details]\n- Requested changes: [User instructions]\n- Products included: [Product list]\n\nYour custom interior design will be generated shortly.\"\n\n**For AI Image Modifications:**\n\"AI design modification initiated:\n\n- Base design: [Original image reference]\n- Requested changes: [User modifications]\n- New elements: [Additional products/changes]\n\nYour updated interior design will be generated shortly.\"\n\n## Tool Usage\n\n- **Send a text message in Telegram**: For all user communications and confirmations\n- **AI Agent Tool**: Furniture analysis to catalog database agent OR retrieve catalog products for AI generation\n- **Room Organiser**: Room analysis to room database agent OR retrieve room data for AI generation\n- **Get AI Generated Images**: Search and retrieve previously generated designs for modifications\n- **Send a photo message in Telegram**: When showing users images for clarification\n\n## Enhanced Processing Flow\n\n**Text Only:** \n- Conversational → Reply with \"Send a text message in Telegram\"\n- AI Generation Request → Retrieve data + Output structured AI generation format\n- AI Modification Request → Search previous designs + Output enhanced AI generation format\n\n**Text + Image with Furniture:** \n- Image Analysis Results → \"AI Agent Tool\" → \"Send a text message in Telegram\"\n\n**Text + Image with Room:** \n- Image Analysis Results → \"Room Organiser\" → \"Send a text message in Telegram\"\n\n**Text + Image with AI Generation Request:**\n- Catalog room (if needed) → Retrieve relevant data → Output AI generation format → \"Send a text message in Telegram\"\n\n## Request Type Detection Logic\n\n**Catalog/Room Storage Requests:**\n1. Look for \"IMAGE_TYPE: FURNITURE\" → Route to AI Agent Tool for cataloging\n2. Look for \"IMAGE_TYPE: ROOM\" → Route to Room Organiser for documentation\n3. User text focuses on cataloging, documentation, or adding to database\n\n**AI Generation Requests:**\n- User text contains design instructions: \"add\", \"place\", \"redesign\", \"create\", \"generate\", \"design\"\n- User asks for interior modifications, furniture placement, or room transformations\n- User references specific products from catalog for placement in rooms\n\n**AI Modification Requests:**\n- User references previous designs: \"change\", \"modify\", \"update\", \"alter\" + references to past images\n- User mentions \"that design\", \"previous\", \"earlier\", specific room names from generated images\n- User wants to edit or enhance existing AI-generated designs\n\n**Conversational Requests:**\n- General questions about interior design\n- Requests for information about existing catalog or rooms\n- Clarification needs or help requests\n\n## Clarification and Image Sharing\n\n**When to Ask for Clarification:**\n- User requests AI generation but doesn't specify which room or products\n- Multiple similar items exist in catalog and user request is ambiguous\n- User references \"my living room\" but multiple rooms of that type exist\n- User mentions modifying a design but reference is unclear\n\n**When to Send Images:**\n- Use \"Send a photo message in Telegram\" with HTTP URLs when showing options\n- Show room images when asking \"Which room did you mean?\"\n- Show product images when asking \"Which sofa would you like to use?\"\n- Show generated images when asking \"Which design would you like to modify?\"\n\n## Error Handling\n\n**Analysis Issues:**\n- If image analysis fails or is unclear, inform user of specific limitations\n- Provide guidance on image quality or content requirements\n- Offer to retry with different images\n\n**Database Retrieval Issues:**\n- If no matching rooms or products found, inform user and suggest alternatives\n- If no previous generated images found for modification, suggest new generation instead\n- Offer to help catalog new items if needed\n\n**AI Generation Issues:**\n- If user request is too vague, ask for specific details about desired changes\n- If conflicting style requirements, ask for clarification on priorities\n- If technical requirements unclear, guide user through specification process\n\n**Routing Uncertainties:**\n- If IMAGE_TYPE is ambiguous, use best judgment based on analysis content and user text\n- Note any uncertainties in user communication\n- Suggest clarification if needed for optimal processing\n\nKeep responses helpful, professional, and focused on successful catalog management, room documentation, and AI-powered interior design generation and modification."
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "97df08a3-3e31-4375-b3b5-1ab0af1863bf",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        96,
        304
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "gpt-4.1"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "nZjLTX0A48x7wSu9",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "978fe3d6-d3d6-47de-bf97-910de02d7343",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        624
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 240,
        "content": "目录组织工具"
      },
      "typeVersion": 1
    },
    {
      "id": "55eba1e9-eae8-4ea8-a5ce-bcb005887379",
      "name": "创建目录行",
      "type": "n8n-nodes-base.supabaseTool",
      "position": [
        272,
        688
      ],
      "parameters": {
        "tableId": "catalog_products",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "product_name",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues1_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "product_type",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues2_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "category",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues3_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "style",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues4_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "design_era",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues5_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "primary_color",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues6_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "materials",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues7_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "size_category",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues8_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "room_types",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues9_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "ai_description",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues10_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "image_url",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues11_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "brand",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues12_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "tags",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues13_Field_Value', ``, 'string') }}"
            }
          ]
        }
      },
      "credentials": {
        "supabaseApi": {
          "id": "INAaloBoLdeMSmlC",
          "name": "AI DESIGNER"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "11aa5aec-4f0e-4918-8a2b-8d785d72b454",
      "name": "获取多个目录行",
      "type": "n8n-nodes-base.supabaseTool",
      "position": [
        432,
        688
      ],
      "parameters": {
        "limit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}",
        "tableId": "catalog_products",
        "operation": "getAll",
        "filterType": "none"
      },
      "credentials": {
        "supabaseApi": {
          "id": "INAaloBoLdeMSmlC",
          "name": "AI DESIGNER"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "88cc6ce6-f8af-4bc3-aeae-91c8964d17e4",
      "name": "在 Telegram 中发送文本消息",
      "type": "n8n-nodes-base.telegramTool",
      "position": [
        864,
        208
      ],
      "webhookId": "3b966e07-25d8-418d-8b16-e3415355fc5b",
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', ``, 'string') }}",
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "lfVbpWrMdW7ZWy3H",
          "name": "AI DESIGNER BOT"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2de93749-84b7-4d25-84e3-60bf582544c9",
      "name": "在 Telegram 中发送图片消息",
      "type": "n8n-nodes-base.telegramTool",
      "position": [
        1008,
        208
      ],
      "webhookId": "5207e04c-f854-4238-930c-db08b1adde64",
      "parameters": {
        "file": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Photo', ``, 'string') }}",
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "operation": "sendPhoto",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "lfVbpWrMdW7ZWy3H",
          "name": "AI DESIGNER BOT"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ab9d74ba-e878-47d3-9085-3760725087d4",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        128
      ],
      "parameters": {
        "color": 5,
        "width": 320,
        "height": 240,
        "content": "Telegram 文本和图片发送工具"
      },
      "typeVersion": 1
    },
    {
      "id": "c3afb95d-324e-43c1-a916-943a5e50dbf3",
      "name": "AI 代理工具",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        192,
        400
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
        "options": {
          "systemMessage": "You are a specialized database operations agent for furniture catalog management.\n\n## Your Function\n\nReceive detailed furniture analysis from the main agent and create precise database entries in Supabase.\n\n## Input Processing\n\nYou receive:\n- Complete furniture analysis descriptions from image processing\n- Image URLs for database storage\n- Any additional user context from the main agent\n\n## Database Schema (catalog_products table)\n\n### Required Fields:\n- **product_name**: Descriptive name from analysis\n- **product_type**: Specific type (sofa, chair, coffee_table, dining_table, lamp, etc.)\n- **category**: Broad category (seating, tables, storage, lighting, decor)\n- **style**: Design style (modern, traditional, scandinavian, industrial, minimalist)\n- **primary_color**: Dominant color from analysis\n- **materials**: Material composition (fabric, leather, wood_oak, wood_walnut, metal, glass)\n- **size_category**: small, medium, or large\n- **room_types**: Compatible rooms (comma-separated, no spaces)\n- **ai_description**: Professional description from analysis\n- **image_url**: Public URL from upload\n\n### Optional Fields:\n- **design_era**: When identified (mid_century, contemporary, classic, art_deco)\n- **brand**: When visible or mentioned\n- **tags**: Search keywords (comma-separated, no spaces)\n\n## Critical Formatting Rules\n\n### Comma-Separated Fields (NO SPACES):\n- **room_types**: \"living_room,office,bedroom\"\n- **tags**: \"sofa,modern,upholstered,oak,contemporary\"\n- **materials**: \"fabric,wood_oak,metal\"\n\n### Standardized Values:\n- **Room Types**: living_room, bedroom, dining_room, office, kitchen, bathroom, lounge, family_room\n- **Categories**: seating, tables, storage, lighting, decor, bedroom_furniture\n- **Size Categories**: small, medium, large\n\n## Processing Protocol\n\n1. **Parse Analysis**: Extract furniture details from provided analysis\n2. **Format Data**: Convert to proper database field format\n3. **Generate Tags**: Create comprehensive search tags from all attributes\n4. **Create Entries**: Use \"Create Catalogue Row\" tool for each furniture item\n5. **Validate**: Ensure all required fields are populated\n\n## Database Operations\n\n**For Each Furniture Item:**\n- Extract all relevant data from analysis\n- Format according to database requirements  \n- Generate appropriate tags including: product_type, style, color, materials, room_types\n- Create individual database entry using \"Create Catalogue Row\"\n- Never combine multiple furniture pieces into one entry\n\n## Response Format\nDatabase Operations Complete:\nSuccessfully cataloged [X] items:\n\n[Product Name] - [Category]\n[Product Name] - [Category]\n\n[Any issues or special notes]\nReady for user confirmation.\n\n## Quality Standards\n\n- Use exact image URLs provided\n- Maintain professional naming conventions\n- Ensure searchable, descriptive product names\n- Create high-quality catalog data for interior design professionals\n- Process each distinct furniture piece as separate database entry"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3f7709d1-2a14-40e0-9ce0-a13b215a4d87",
      "name": "HTTP请求1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -400,
        144
      ],
      "parameters": {
        "url": "=https://raeojxaquatmtzgxqqdx.supabase.co/storage/v1/object/catalog-images/{{$now}}-{{$binary.data.fileName}}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "={{ $binary.data.mimeType }}"
            },
            {
              "name": "x-upsert",
              "value": "true"
            }
          ]
        },
        "inputDataFieldName": "data",
        "nodeCredentialType": "supabaseApi"
      },
      "credentials": {
        "supabaseApi": {
          "id": "INAaloBoLdeMSmlC",
          "name": "AI DESIGNER"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e38ec86b-67dd-4931-b271-924233c8f66a",
      "name": "JavaScript 代码",
      "type": "n8n-nodes-base.code",
      "position": [
        -272,
        144
      ],
      "parameters": {
        "jsCode": "// Extract the file key from the upload response\nconst uploadResponse = $input.first().json;\nconst fileKey = uploadResponse.Key;\n\n// Construct the public URL\nconst publicUrl = `https://raeojxaquatmtzgxqqdx.supabase.co/storage/v1/object/public/${fileKey}`;\n\nreturn {\n  json: {\n    ...uploadResponse,\n    publicUrl: publicUrl,\n    // Keep original message data for the AI Agent\n    originalMessage: $('Telegram Trigger').first().json.message\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "640d9829-3484-4c88-8ec7-b2513a7180b1",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        -512,
        -80
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4496c393-77ad-4407-9e3d-cf12423e96b0",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ Object.keys($binary).length > 0 }}",
              "rightValue": "false"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "f5974e74-562e-4466-b43a-0f97e8809cf5",
      "name": "分析图片",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -112,
        144
      ],
      "parameters": {
        "text": "You are a specialized image analysis agent for interior design workflows. You analyze images and determine whether they contain individual furniture pieces for cataloging or room spaces for design planning.\n\n## Your Function\n\nAnalyze uploaded images to identify the primary subject and provide appropriate detailed analysis for either furniture cataloging or room documentation.\n\n## Analysis Protocol\n\n### 1. Image Type Detection\n**First, determine the primary subject:**\n- **FURNITURE**: Image shows individual furniture pieces with clear product focus (catalog-style photos, isolated items, close-ups of specific furniture)\n- **ROOM**: Image shows interior spaces, room views, architectural contexts, or multiple furniture pieces in a living environment\n\n### 2. Image Assessment\n- Examine image quality and clarity\n- Identify the primary subject matter\n- Note any partial or unclear elements\n- Assess lighting and angle for accurate analysis\n\n## FURNITURE ANALYSIS (When image type = FURNITURE)\n\n### Furniture Identification (Per Item)\n\n**Product Identification:**\n- Product name (specific and descriptive: \"Mid-Century Walnut Coffee Table\")\n- Product type (sofa, chair, coffee_table, dining_table, lamp, bookshelf, etc.)\n- Category (seating, tables, storage, lighting, decor, bedroom_furniture)\n\n**Style Classification:**\n- Style (modern, traditional, scandinavian, industrial, bohemian, minimalist, contemporary)\n- Design era (mid_century, contemporary, classic, art_deco, vintage, transitional)\n\n**Physical Properties:**\n- Primary color (dominant color accurately described)\n- Secondary colors (if significant)\n- Materials (fabric, leather, wood_oak, wood_walnut, metal_chrome, glass, marble, etc.)\n- Size category (small, medium, large based on visual proportions and context)\n\n**Professional Assessment:**\n- Room compatibility (living_room, bedroom, dining_room, office, kitchen, bathroom, lounge)\n- Professional description (detailed 2-3 sentence analysis of design and features)\n- Brand identification (if visible logos, distinctive design signatures, or mentioned in context)\n- Condition assessment (new, vintage, distressed, restored - if determinable)\n\n### Furniture Output Format\nIMAGE_TYPE: FURNITURE\nAnalyzed [X] furniture items in the provided image(s):\nITEM [NUMBER]:\nProduct Name: [Specific, professional name]\nProduct Type: [Exact furniture type]\nCategory: [Broad category]\nStyle: [Design style]\nDesign Era: [When determinable]\nPrimary Color: [Dominant color]\nMaterials: [Material composition]\nSize Category: [small/medium/large]\nRoom Types: [Compatible rooms, comma-separated]\nProfessional Description: [2-3 sentences about design, features, and use]\nBrand: [If visible or determinable]\nSpecial Notes: [Any unique features, condition notes, or user-specified details]\nAnalysis complete. Ready for catalog entry processing.\n\n## ROOM ANALYSIS (When image type = ROOM)\n\n### Room Identification\n\n**Basic Room Information:**\n- Room name (descriptive: \"Modern Living Room\", \"Master Bedroom\", \"Kitchen Dining Area\")\n- Room type (living_room, bedroom, kitchen, bathroom, office, dining_room, family_room, lounge)\n- Room size (small, medium, large based on visual scale and proportions)\n\n**Style & Design Analysis:**\n- Style (modern, traditional, scandinavian, industrial, minimalist, contemporary, transitional)\n- Design era (mid_century, contemporary, classic, art_deco, vintage)\n- Color palette (dominant colors and color scheme observed)\n\n**Physical Characteristics:**\n- Lighting type (natural, artificial, mixed, dim, bright)\n- Architectural features (high_ceilings, exposed_beams, fireplace, built_ins, crown_molding)\n- Flooring type (hardwood, carpet, tile, concrete, laminate, stone)\n\n**Content & Context:**\n- Existing furniture (brief list of major furniture pieces visible)\n- Professional description (detailed 2-3 sentence room analysis including atmosphere, design approach, and functionality)\n\n### Room Output Format\nIMAGE_TYPE: ROOM\nAnalyzed room space in the provided image:\nRoom Name: [Descriptive room name]\nRoom Type: [Specific room type]\nRoom Size: [small/medium/large]\nStyle: [Design style]\nDesign Era: [When determinable]\nColor Palette: [Dominant colors and scheme]\nLighting Type: [Lighting characteristics]\nArchitectural Features: [Notable architectural elements]\nFlooring Type: [Floor material/type]\nExisting Furniture: [Major pieces visible]\nProfessional Description: [2-3 sentences about room design, atmosphere, and functionality]\nAnalysis complete. Ready for room entry processing.\n\n## Context Integration\nUse provided user text context for:\n- Style preferences or specific requirements mentioned\n- Room designations or intended use specified\n- Brand mentions or special features to focus on\n- Multiple item identification guidance\n\n## Quality Standards\n\n**Accuracy Requirements:**\n- Be precise with furniture and interior design terminology\n- Use professional language appropriate for interior designers\n- Provide confident assessments based on visual evidence\n- Note uncertainties clearly when details are unclear\n\n**Professional Analysis:**\n- Focus on design elements that matter to interior designers\n- Include scale, proportion, and style context\n- Consider commercial vs. residential applications\n- Mention design versatility and applications\n\n## Error Handling\n\n**Unclear Images:**\n- Report what can be identified with confidence\n- Note specific limitations (lighting, angle, partial view)\n- Suggest improvements for better analysis\n\n**Ambiguous Content:**\n- If unclear whether furniture or room, default to the most prominent subject\n- Note alternative interpretations when uncertain\n- Ask for clarification on ambiguous content\n\n**No Clear Subject:**\n- Report if neither furniture nor room space is clearly visible\n- Suggest image requirements for successful analysis\n- Offer guidance on proper image capture\n\n## Important Notes\n\n- Always start response with IMAGE_TYPE declaration\n- Process each distinct furniture piece as separate analysis in furniture mode\n- Maintain consistency in terminology across all analyses\n- Focus on commercially relevant details for interior design workflows\n- Integrate user context throughout analysis\n- Provide actionable information for appropriate database entry creation",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "chatgpt-4o-latest",
          "cachedResultName": "CHATGPT-4O-LATEST"
        },
        "options": {},
        "resource": "image",
        "imageUrls": "={{ $json.publicUrl }}",
        "operation": "analyze"
      },
      "credentials": {
        "openAiApi": {
          "id": "nZjLTX0A48x7wSu9",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "d7a9ee9d-af69-4dff-b3ea-8da587384624",
      "name": "编辑字段",
      "type": "n8n-nodes-base.set",
      "position": [
        32,
        144
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0d3435d7-8061-42df-96a4-b0da4428d5fd",
              "name": "ai_agent_input",
              "type": "string",
              "value": "={{ $('Code in JavaScript').first().json }}"
            },
            {
              "id": "a8c121c7-e4e1-4926-a4c7-de390a37201c",
              "name": "image_analysis",
              "type": "string",
              "value": "={{ $json.content }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "01bc993b-54f3-4917-96c6-2179f6c37c1e",
      "name": "编辑字段1",
      "type": "n8n-nodes-base.set",
      "position": [
        32,
        -96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cb13a753-b818-4021-b6b3-fde0022adda4",
              "name": "=ai_agent_input",
              "type": "string",
              "value": "={{ $('Telegram Trigger').first().json.message.text }}"
            },
            {
              "id": "955ae98a-b14b-45a1-90d7-699699798c06",
              "name": "=image_analysis",
              "type": "string",
              "value": "null"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "75b82717-01f8-4c42-8df4-56c478534551",
      "name": "房间组织器",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        672,
        400
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
        "options": {
          "systemMessage": "You are a specialized database operations agent for room space management. You must correctly parse room analysis data and map each field to the exact correct database column.\n\n## Your Function\n\nReceive room analysis from the main agent and create precise database entries with correct field mapping.\n\n## Critical Field Mapping Instructions\n\nYou will receive room analysis in this format:\nIMAGE_TYPE: ROOM\nAnalyzed room space in the provided image:\nRoom Name: [value]\nRoom Type: [value]\nRoom Size: [value]\nStyle: [value]\nDesign Era: [value]\nColor Palette: [value]\nLighting Type: [value]\nArchitectural Features: [value]\nFlooring Type: [value]\nExisting Furniture: [value]\nProfessional Description: [value]\n\n**EXACT FIELD MAPPING - FOLLOW PRECISELY:**\n\n### Required Database Fields:\n- **room_name** ← Extract from \"Room Name: [value]\"\n- **room_type** ← Extract from \"Room Type: [value]\" \n- **room_size** ← Extract from \"Room Size: [value]\"\n- **style** ← Extract from \"Style: [value]\"\n- **color_palette** ← Extract from \"Color Palette: [value]\"\n- **ai_description** ← Extract from \"Professional Description: [value]\"\n- **image_url** ← Extract from the image URL provided separately in the input data\n\n### Optional Database Fields:\n- **design_era** ← Extract from \"Design Era: [value]\" (if present)\n- **lighting_type** ← Extract from \"Lighting Type: [value]\" (if present)\n- **architectural_features** ← Extract from \"Architectural Features: [value]\" (if present)\n- **flooring_type** ← Extract from \"Flooring Type: [value]\" (if present)\n- **existing_furniture** ← Extract from \"Existing Furniture: [value]\" (if present)\n- **tags** ← Generate from room characteristics (comma-separated, no spaces)\n\n## Data Extraction Protocol\n\n**Step 1: Parse Analysis Text**\n- Locate each \"FieldName: [value]\" pair in the room analysis\n- Extract the exact value after the colon and space\n- Do NOT mix up field contents\n\n**Step 2: Handle Image URL**\n- The image URL will be provided separately in the input data structure\n- Look for URL pattern: \"https://raeojxaquatmtzgxqqdx.supabase.co/storage/v1/object/public/...\"\n- Assign this URL to the **image_url** field\n\n**Step 3: Generate Tags**\n- Combine: room_type, style, key characteristics from color_palette, lighting_type, flooring_type\n- Example: \"living_room,minimalist,white_walls,natural_light,hardwood\"\n- Format: comma-separated with no spaces\n\n## Example Correct Mapping\n\n**Input Analysis:**\nRoom Name: Empty Minimalist Room with Natural Light\nRoom Type: living_room\nRoom Size: medium\nStyle: minimalist\nDesign Era: contemporary\nColor Palette: white walls, light natural wood flooring, green accents\nLighting Type: natural\nArchitectural Features: large window, flat ceiling, clean lines\nFlooring Type: hardwood\nExisting Furniture: none\nProfessional Description: This medium-sized, minimalist room features white walls...\n\n**Correct Database Mapping:**\n- room_name: \"Empty Minimalist Room with Natural Light\"\n- room_type: \"living_room\"\n- room_size: \"medium\"  \n- style: \"minimalist\"\n- design_era: \"contemporary\"\n- color_palette: \"white walls, light natural wood flooring, green accents\"\n- lighting_type: \"natural\"\n- architectural_features: \"large window, flat ceiling, clean lines\"\n- flooring_type: \"hardwood\"\n- existing_furniture: \"none\"\n- ai_description: \"This medium-sized, minimalist room features white walls...\"\n- image_url: [the actual URL from input data]\n- tags: \"living_room,minimalist,natural_light,hardwood,contemporary\"\n\n## Database Operations\n\n**Use \"Create Room Row\" tool with exact field mapping:**\n1. Parse the room analysis text carefully\n2. Extract each field value precisely \n3. Map to correct database column\n4. Include image URL from input data\n5. Generate appropriate tags\n6. Create single database entry\n\n## Critical Rules\n\n**DO NOT:**\n- Mix up field contents between database columns\n- Put image URLs in wrong fields\n- Put descriptions in wrong fields\n- Scramble the field mapping\n\n**DO:**\n- Follow the exact field mapping instructions above\n- Extract values precisely from analysis text\n- Use the provided image URL correctly\n- Generate meaningful search tags\n\n## Response Format\nDatabase Operations Complete:\nSuccessfully cataloged room space:\n\n[Room Name] - [Room Type] - [Style]\n\nRoom entry created with:\n\nSize: [room_size]\nStyle: [style]\nImage URL: [confirm URL was stored]\n\nReady for user confirmation.\n\n## Validation Checklist\n\nBefore creating database entry, verify:\n- ✓ room_name contains the room name (not description)\n- ✓ image_url contains the actual image URL (not \"none\")\n- ✓ ai_description contains the professional description (not color info)\n- ✓ color_palette contains color information (not description)\n- ✓ Each field contains appropriate content type\n\nFollow these instructions exactly to ensure correct database storage."
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b2d9680d-29a5-4b79-8c2f-a00f398abfcc",
      "name": "创建房间行",
      "type": "n8n-nodes-base.supabaseTool",
      "position": [
        736,
        688
      ],
      "parameters": {
        "tableId": "rooms",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "room_name",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues0_Field_Value', `Extract from \"Room Name:\" in analysis. Should be a descriptive title like \"Empty Minimalist Room with Natural Light\" or \"Modern Living Room\". NOT the professional description.`, 'string') }}"
            },
            {
              "fieldId": "room_type",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues1_Field_Value', `Extract from \"Room Type:\" in analysis. Single value like \"living_room\", \"bedroom\", \"kitchen\", \"office\". Use underscore format.`, 'string') }}"
            },
            {
              "fieldId": "room_size",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues2_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "style",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues3_Field_Value', `Extract from \"Style:\" in analysis. Single design style like \"minimalist\", \"modern\", \"traditional\", \"scandinavian\".`, 'string') }}"
            },
            {
              "fieldId": "design_era",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues4_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "color_palette",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues5_Field_Value', `Extract from \"Color Palette:\" in analysis. Describes dominant colors and color scheme like \"white walls, light wood flooring, green accents\". NOT the description.`, 'string') }}"
            },
            {
              "fieldId": "lighting_type",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues6_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "architectural_features",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues7_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "flooring_type",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues8_Field_Value', ``, 'string') }}"
            },
            {
              "fieldId": "existing_furniture",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues9_Field_Value', `Extract from \"Existing Furniture:\" in analysis. List major pieces visible or \"none\" for empty rooms. NOT architectural features.`, 'string') }}"
            },
            {
              "fieldId": "ai_description",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues10_Field_Value', `Extract from \"Professional Description:\" in analysis. This is the 2-3 sentence detailed room analysis paragraph. NOT color information or room name.`, 'string') }}"
            },
            {
              "fieldId": "image_url",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues11_Field_Value', `Extract the full image URL from input data (starts with https://raeojxaquatmtzgxqqdx.supabase.co/storage/). This is the direct link to the uploaded room photo, NOT from the analysis text.`, 'string') }}"
            },
            {
              "fieldId": "tags",
              "fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues12_Field_Value', ``, 'string') }}"
            }
          ]
        }
      },
      "credentials": {
        "supabaseApi": {
          "id": "INAaloBoLdeMSmlC",
          "name": "AI DESIGNER"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "54b9cb1d-bc07-48b6-b572-7c5dd3828ad1",
      "name": "获取多个房间行",
      "type": "n8n-nodes-base.supabaseTool",
      "position": [
        896,
        688
      ],
      "parameters": {
        "limit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}",
        "tableId": "rooms",
        "operation": "getAll",
        "filterType": "none"
      },
      "credentials": {
        "supabaseApi": {
          "id": "INAaloBoLdeMSmlC",
          "name": "AI DESIGNER"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8e2d045a-8c52-4bc1-b4fd-b82e18206874",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        624
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 240,
        "content": "房间组织工具"
      },
      "typeVersion": 1
    },
    {
      "id": "f3e5c0d7-e703-400e-9e16-e2aac6b2299c",
      "name": "OpenAI 聊天",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        576,
        576
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "gpt-4.1"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "nZjLTX0A48x7wSu9",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c3abddbd-77ed-4b2d-bcec-bddeaa14fc5c",
      "name": "OpenAI 聊天",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        112,
        576
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "gpt-4.1"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "nZjLTX0A48x7wSu9",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "633faf88-0aa1-4729-a9ef-5968660cd674",
      "name": "条件判断1",
      "type": "n8n-nodes-base.if",
      "position": [
        752,
        -96
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "2cfddbba-5fc1-4705-9717-bbf69bb16d6e",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": "GEMINI_PROMPT:"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c4184ed4-3a1d-4596-8cd9-6eab1752e196",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1312,
        -208
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "message.content.image_urls_array"
      },
      "typeVersion": 1
    },
    {
      "id": "bd4190d2-ad07-4356-b1d2-0428f2e7eeae",
      "name": "二进制解码器",
      "type": "n8n-nodes-base.code",
      "position": [
        1696,
        -144
      ],
      "parameters": {
        "jsCode": "// n8n Function node: aggregate images and create Nano Banana API payload\nconst items = $input.all();\nconst images = [];\nlet baseData = {};\n\n// Loop through all incoming items\nfor (let i = 0; i < items.length; i++) {\n  const item = items[i];\n\n  // Copy shared metadata from first item\n  // Handle the new AI node output structure\n  if (i === 0) {\n    // The data structure from Split Out maintains the original structure\n    const content = item.json.message?.content || item.json; // Fallback for old structure\n    baseData = {\n      image_name: content.image_name,\n      gemini_prompt: content.gemini_prompt,\n      image_urls: content.image_urls,\n      original_output: content.original_output || 'Generated by AI node',\n    };\n  }\n\n  // Extract binary data and convert to inline_data format\n  if (item.binary && item.binary.data) {\n    images.push({\n      inline_data: {\n        mime_type: item.binary.data.mimeType || 'image/jpeg',\n        data: item.binary.data.data // Already base64 in n8n\n      }\n    });\n  }\n}\n\n// Create the complete Nano Banana API payload\nconst nanoBananaPayload = {\n  contents: [{\n    parts: [\n      {\n        text: baseData.gemini_prompt\n      },\n      ...images\n    ]\n  }],\n  generationConfig: {\n    maxOutputTokens: 1290\n  }\n};\n\n// Return single aggregated item with API-ready payload\nreturn [{\n  json: {\n    ...baseData,\n    nano_banana_payload: nanoBananaPayload,\n    // Keep individual images for debugging if needed\n    images_debug: images,\n    images_count: images.length\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "04dcfc1b-e1d6-41dd-8f50-a1ac9fb0c13b",
      "name": "Nanobanana 调用器",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1904,
        -144
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "json"
            }
          },
          "allowUnauthorizedCerts": false
        },
        "jsonBody": "={{ $json.nano_banana_payload }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "axbN8qcNQbNlcjzr",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "80901e90-45a2-4265-88df-7405d9bc7460",
      "name": "生成 AI 图像",
      "type": "n8n-nodes-base.code",
      "position": [
        2112,
        -144
      ],
      "parameters": {
        "jsCode": "// Extract base64 image from Nano Banana response - UPDATED for text+image response\nconst response = $input.first().json;\n\ntry {\n  // Find the part that contains inlineData (image)\n  const parts = response.body.candidates[0].content.parts;\n  const imagePart = parts.find(part => part.inlineData);\n  \n  if (!imagePart) {\n    throw new Error(\"No image found in response\");\n  }\n\n  const imageData = imagePart.inlineData.data;\n  const mimeType = imagePart.inlineData.mimeType;\n  const imageName = $input.first().json.image_name || 'generated_image';\n\n  // Also extract the text description if you want it\n  const textPart = parts.find(part => part.text);\n  const description = textPart ? textPart.text : '';\n\n  console.log(\"Successfully extracted image data, size:\", imageData.length);\n\n  return [{\n    json: {\n      image_name: imageName,\n      mime_type: mimeType,\n      description: description, // Nano Banana's description of what it created\n      success: true\n    },\n    binary: {\n      data: {\n        data: imageData,\n        mimeType: mimeType,\n        fileName: `${imageName}.png`\n      }\n    }\n  }];\n} catch (error) {\n  console.log(\"Error extracting image:\", error.message);\n  return [{\n    json: {\n      error: error.message,\n      response_structure: response.body\n    }\n  }];\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "f0b5dd71-815b-4e7f-9368-0366b7164f41",
      "name": "生成图像保存",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2304,
        16
      ],
      "parameters": {
        "url": "=https://raeojxaquatmtzgxqqdx.supabase.co/storage/v1/object/catalog-images/{{ $('gfd').first().json.image_name }}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "={{ $('Gen AI Image').first().json.mime_type }}"
            },
            {
              "name": "x-upsert",
              "value": "true"
            }
          ]
        },
        "inputDataFieldName": "data",
        "nodeCredentialType": "supabaseApi"
      },
      "credentials": {
        "supabaseApi": {
          "id": "INAaloBoLdeMSmlC",
          "name": "AI DESIGNER"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b7dc6f8f-085b-46dc-a2a3-00fd48521ae8",
      "name": "发送图片消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2320,
        -176
      ],
      "webhookId": "91dff277-efaa-4998-95f9-a06d9c432fae",
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {
          "caption": "={{ $('Output Organiser').first().json.message.content.image_name }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "lfVbpWrMdW7ZWy3H",
          "name": "AI DESIGNER BOT"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2f9e88fe-5f64-496f-af9c-72030316bbbb",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        144
      ],
      "parameters": {
        "color": 4,
        "height": 208,
        "content": "AI 生成图像工具"
      },
      "typeVersion": 1
    },
    {
      "id": "c0511074-499c-4bbb-970e-6404738bb3fb",
      "name": "获取 AI 生成图像",
      "type": "n8n-nodes-base.supabaseTool",
      "position": [
        496,
        192
      ],
      "parameters": {
        "limit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}",
        "tableId": "ai_generated_images",
        "operation": "getAll",
        "filterType": "none"
      },
      "credentials": {
        "supabaseApi": {
          "id": "INAaloBoLdeMSmlC",
          "name": "AI DESIGNER"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2efcf9b2-6809-49dc-8741-513ad7608272",
      "name": "二进制下载器",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1488,
        -144
      ],
      "parameters": {
        "url": "={{ $json[\"message.content.image_urls_array\"] }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "d34b345d-29dc-4e12-95dd-8e1fa6eb95d7",
      "name": "创建 AI 图像行",
      "type": "n8n-nodes-base.supabase",
      "position": [
        2528,
        16
      ],
      "parameters": {
        "tableId": "ai_generated_images",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "image_name",
              "fieldValue": "={{ $('gfd').first().json.image_name }}"
            },
            {
              "fieldId": "image_url",
              "fieldValue": "=https://raeojxaquatmtzgxqqdx.supabase.co/storage/v1/object/public/{{ $('Gen Image Save').first().json.Key }}"
            },
            {
              "fieldId": "original_prompt",
              "fieldValue": "={{ $('gfd').first().json.gemini_prompt }}"
            },
            {
              "fieldId": "ai_description",
              "fieldValue": "={{ $('Nanobanana Caller').first().json.body.candidates[0].content.parts[0].text }}"
            }
          ]
        }
      },
      "credentials": {
        "supabaseApi": {
          "id": "INAaloBoLdeMSmlC",
          "name": "AI DESIGNER"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "23a55f49-d703-44bf-be68-632f9a6c0ca3",
      "name": "输出组织器",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1072,
        -144
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=**Input Text to Process:**\n{{ $json.output }}\n\nExtract the following structured data from the provided text and return it as a clean JSON object:\n\n**Required Fields:**\n\n1. **image_name**: Extract the value after \"IMAGE_NAME:\" (single line)\n2. **gemini_prompt**: Extract the complete text after \"GEMINI_PROMPT:\" (may span multiple lines, stop at \"IMAGE_URLS:\")\n3. **image_urls_array**: Extract all URLs from the \"IMAGE_URLS:\" section as an array of strings\n4. **image_urls**: Join all URLs with commas as a single string\n\n**Instructions:**\n- Look for the structured section that starts with \"IMAGE_NAME:\"\n- The GEMINI_PROMPT can be very long and span multiple lines\n- The IMAGE_URLS section contains URLs in a format like `[url1,url2]` - extract each URL as a separate array element\n- Remove any brackets, quotes, or extra whitespace from URLs\n- Only include valid HTTP/HTTPS URLs\n- If any field is not found, return an empty string or empty array\n\n**Expected Output Format:**\n```json\n{\n  \"image_name\": \"extracted_image_name_here\",\n  \"gemini_prompt\": \"extracted_prompt_text_here\",\n  \"image_urls_array\": [\"url1\", \"url2\"],\n  \"image_urls\": \"url1,url2\"\n}\n```\n\n"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "nZjLTX0A48x7wSu9",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1ffe7301-bf11-4305-bf6b-6f36f70ae69e",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Output Organiser",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Binary Downloader",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat": {
      "ai_languageModel": [
        [
          {
            "node": "Room Organiser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI chat": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent Tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gen AI Image": {
      "main": [
        [
          {
            "node": "Send a photo message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Gen Image Save",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Analyze image": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Binary Decoder": {
      "main": [
        [
          {
            "node": "Nanobanana Caller",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gen Image Save": {
      "main": [
        [
          {
            "node": "Create AI Image row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Room Organiser": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create Room Row": {
      "ai_tool": [
        [
          {
            "node": "Room Organiser",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Output Organiser": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Binary Downloader": {
      "main": [
        [
          {
            "node": "Binary Decoder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nanobanana Caller": {
      "main": [
        [
          {
            "node": "Gen AI Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Many Room Rows": {
      "ai_tool": [
        [
          {
            "node": "Room Organiser",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create Catalogue Row": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Tool",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Send a photo message": {
      "main": [
        []
      ]
    },
    "Get AI Generated Images": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Many Catalogue Rows": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Tool",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Send a text message in Telegram": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Send a photo message in Telegram": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个高级难度的工作流,适用于Content Creation、Multimodal AI等场景。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

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

工作流信息
难度等级
高级
节点数量34
分类2
节点类型15
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 上查看 →

分享此工作流