{
  "name": "Vorlux AI | ComfyUI Style Transfer",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "style-transfer",
        "options": {
          "responseMode": "lastNode"
        }
      },
      "id": "webhook",
      "name": "Style Transfer Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        220,
        300
      ]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const data = $input.first().json.body || $input.first().json;\nreturn [{ json: { imageUrl: data.imageUrl || data.image, style: data.style || 'vorlux-brand', prompt: 'apply ' + (data.style || 'vorlux-brand') + ' style, maintain composition, enhance colors, professional finish', strength: data.strength || 0.7 } }];"
      },
      "id": "prepare",
      "name": "Prepare Transfer",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://host.docker.internal:3010/api/comfyui",
        "method": "POST",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ prompt: $json.prompt, inputImage: $json.imageUrl, strength: $json.strength, mode: 'img2img' }) }}",
        "options": {
          "timeout": 120000
        }
      },
      "id": "transfer",
      "name": "Apply Style Transfer",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        700,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://host.docker.internal:3010/api/assets/upload",
        "method": "POST",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ imageUrl: $json.url || $json.imageUrl, category: 'styled-images', style: $('Prepare Transfer').first().json.style }) }}",
        "options": {
          "timeout": 15000
        }
      },
      "id": "save",
      "name": "Save Styled Image",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        940,
        300
      ]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "return [{ json: { success: true, style: $('Prepare Transfer').first().json.style, outputUrl: $json.url || $json.assetUrl } }];"
      },
      "id": "response",
      "name": "Response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1180,
        300
      ]
    }
  ],
  "connections": {
    "Style Transfer Webhook": {
      "main": [
        [
          {
            "node": "Prepare Transfer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Transfer": {
      "main": [
        [
          {
            "node": "Apply Style Transfer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apply Style Transfer": {
      "main": [
        [
          {
            "node": "Save Styled Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Styled Image": {
      "main": [
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}