{
  "name": "Vorlux AI | ComfyUI Avatar Generator",
  "active": false,
  "nodes": [
    { "parameters": { "httpMethod": "POST", "path": "generate-avatar", "options": { "responseMode": "lastNode" } }, "id": "webhook", "name": "Avatar Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [220, 300] },
    { "parameters": { "mode": "runOnceForAllItems", "jsCode": "const data = $input.first().json.body || $input.first().json;\nconst username = data.username || 'user';\nconst style = data.style || 'anime';\nconst styles = {\n  anime: 'anime portrait avatar, vibrant colors, detailed eyes, clean lineart',\n  pixel: 'pixel art avatar, retro gaming style, 8-bit aesthetic',\n  realistic: 'photorealistic portrait, professional headshot style',\n  abstract: 'abstract geometric avatar, modern art style, bold shapes'\n};\nreturn [{ json: { username, userId: data.userId, prompt: styles[style] || styles.anime, width: 512, height: 512, style } }];" }, "id": "build-prompt", "name": "Build Avatar Prompt", "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, width: $json.width, height: $json.height, steps: 25 }) }}", "options": { "timeout": 120000 } }, "id": "generate", "name": "Generate Avatar", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [700, 300] },
    { "parameters": { "url": "http://host.docker.internal:3010/api/tools/upload-avatar", "method": "POST", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ userId: $('Build Avatar Prompt').first().json.userId, imageUrl: $json.url || $json.imageUrl, username: $('Build Avatar Prompt').first().json.username }) }}", "options": { "timeout": 15000 } }, "id": "upload", "name": "Set User Avatar", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [940, 300] },
    { "parameters": { "mode": "runOnceForAllItems", "jsCode": "return [{ json: { success: true, username: $('Build Avatar Prompt').first().json.username, style: $('Build Avatar Prompt').first().json.style } }];" }, "id": "response", "name": "Response", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [1180, 300] }
  ],
  "connections": {
    "Avatar Webhook": { "main": [[{ "node": "Build Avatar Prompt", "type": "main", "index": 0 }]] },
    "Build Avatar Prompt": { "main": [[{ "node": "Generate Avatar", "type": "main", "index": 0 }]] },
    "Generate Avatar": { "main": [[{ "node": "Set User Avatar", "type": "main", "index": 0 }]] },
    "Set User Avatar": { "main": [[{ "node": "Response", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" }
}
