n8n-nodes-comfyui-all 2.4.5 → 2.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +504 -185
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,17 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/n8n-nodes-comfyui-all)
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## 📖 Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Overview](#-overview)
|
|
10
|
+
- [Installation](#-installation)
|
|
11
|
+
- [Nodes Comparison](#-nodes-comparison)
|
|
12
|
+
- [Quick Start](#-quick-start)
|
|
13
|
+
- [ComfyUI Tool Node](#-comfyui-tool-node)
|
|
14
|
+
- [ComfyUI Node](#-comfyui-node)
|
|
15
|
+
- [Advanced Usage](#-advanced-usage)
|
|
16
|
+
- [Troubleshooting](#-troubleshooting)
|
|
17
|
+
- [Configuration Reference](#-configuration-reference)
|
|
18
|
+
|
|
19
|
+
## 🎯 Overview
|
|
20
|
+
|
|
21
|
+
This package provides two specialized nodes for integrating ComfyUI with n8n:
|
|
22
|
+
|
|
23
|
+
### 🌟 Key Features
|
|
8
24
|
|
|
9
25
|
- 🎨 **Universal Workflow Support** - Works with any ComfyUI workflow in API format
|
|
10
|
-
- 🔄 **Dynamic Parameters** - Override workflow parameters
|
|
26
|
+
- 🔄 **Dynamic Parameters** - Override workflow parameters at runtime
|
|
11
27
|
- 🎬 **Multi-Modal Support** - Supports images and videos for both input and output
|
|
12
|
-
- 🤖 **AI Agent Ready** -
|
|
13
|
-
- **ComfyUI Tool** - Optimized for AI Agent workflows (URL-based image input)
|
|
14
|
-
- **ComfyUI** - Full-featured node for standard workflows (binary & URL support)
|
|
28
|
+
- 🤖 **AI Agent Ready** - Optimized nodes for AI Agent and standard workflows
|
|
15
29
|
- 📊 **Flexible Configuration** - JSON mode or single parameter mode
|
|
16
|
-
-
|
|
17
|
-
|
|
30
|
+
- 🏷️ **Customizable Output** - Flexible output format (URLs or binary data)
|
|
31
|
+
|
|
32
|
+
---
|
|
18
33
|
|
|
19
34
|
## 📦 Installation
|
|
20
35
|
|
|
@@ -34,286 +49,590 @@ npm install n8n-nodes-comfyui-all
|
|
|
34
49
|
|
|
35
50
|
Or via n8n interface: **Settings** → **Community Nodes** → **Install** → `n8n-nodes-comfyui-all`
|
|
36
51
|
|
|
37
|
-
> Restart n8n after installation
|
|
52
|
+
> ⚠️ **Restart n8n after installation**
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 🔍 Nodes Comparison
|
|
57
|
+
|
|
58
|
+
### Quick Reference
|
|
59
|
+
|
|
60
|
+
| Feature | ComfyUI Tool 🤖 | ComfyUI 🔧 |
|
|
61
|
+
|---------|----------------|------------|
|
|
62
|
+
| **Primary Use Case** | AI Agent Workflows | Standard Workflows |
|
|
63
|
+
| **Image Input** | URL only | Binary or URL |
|
|
64
|
+
| **Binary Output** | ❌ No | ✅ Yes |
|
|
65
|
+
| **URL Output** | ✅ Yes | ✅ Yes |
|
|
66
|
+
| **Parameter Overrides** | ✅ Yes | ✅ Yes (Advanced) |
|
|
67
|
+
| **LLM Context** | ✅ Lightweight (URLs only) | ⚠️ Not optimized |
|
|
68
|
+
| **Node Configuration** | Simple | Advanced |
|
|
69
|
+
|
|
70
|
+
### Which Node Should I Use?
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
74
|
+
│ Your Scenario │
|
|
75
|
+
└─────────────────────────────────────────────────────────────┘
|
|
76
|
+
│
|
|
77
|
+
┌───────────────┴───────────────┐
|
|
78
|
+
│ │
|
|
79
|
+
Using AI Agent? Standard Workflow?
|
|
80
|
+
│ │
|
|
81
|
+
▼ ▼
|
|
82
|
+
┌───────────────┐ ┌──────────────┐
|
|
83
|
+
│ ComfyUI Tool │ │ ComfyUI │
|
|
84
|
+
└───────────────┘ └──────────────┘
|
|
85
|
+
│ │
|
|
86
|
+
Image Input: URL Image Input:
|
|
87
|
+
• Binary
|
|
88
|
+
• URL
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### Use ComfyUI Tool When:
|
|
92
|
+
- ✅ Building AI Agent workflows
|
|
93
|
+
- ✅ Integrating with chat interfaces
|
|
94
|
+
- ✅ Processing images from URLs
|
|
95
|
+
- ✅ Minimizing LLM token usage
|
|
96
|
+
- ✅ Need simple URL-based configuration
|
|
97
|
+
|
|
98
|
+
#### Use ComfyUI Node When:
|
|
99
|
+
- ✅ Building standard n8n workflows
|
|
100
|
+
- ✅ Processing binary data from previous nodes
|
|
101
|
+
- ✅ Working with file uploads/webhooks
|
|
102
|
+
- ✅ Need advanced parameter configuration
|
|
103
|
+
- ✅ Want binary output for further processing
|
|
104
|
+
|
|
105
|
+
---
|
|
38
106
|
|
|
39
107
|
## 🚀 Quick Start
|
|
40
108
|
|
|
41
|
-
###
|
|
109
|
+
### Prerequisites
|
|
110
|
+
|
|
111
|
+
- ✅ ComfyUI server running (default: `http://127.0.0.1:8188`)
|
|
112
|
+
- ✅ n8n instance (version 2.x or higher)
|
|
113
|
+
- ✅ Basic understanding of ComfyUI workflows
|
|
42
114
|
|
|
43
|
-
-
|
|
44
|
-
- n8n instance (version 2.x or higher)
|
|
115
|
+
### 3-Step Setup
|
|
45
116
|
|
|
46
|
-
|
|
117
|
+
#### 1. Create Your Workflow in ComfyUI
|
|
47
118
|
|
|
48
|
-
|
|
49
|
-
|
|
119
|
+
```
|
|
120
|
+
In ComfyUI:
|
|
121
|
+
1. Design your workflow
|
|
122
|
+
2. Click "Save (API Format)"
|
|
50
123
|
3. Copy the generated JSON
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### 2. Add Node to n8n
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
In n8n:
|
|
130
|
+
1. Add either "ComfyUI Tool" or "ComfyUI" node
|
|
131
|
+
2. Paste your Workflow JSON
|
|
132
|
+
3. Configure ComfyUI URL
|
|
133
|
+
4. (Optional) Set up parameters
|
|
134
|
+
```
|
|
51
135
|
|
|
52
|
-
|
|
136
|
+
#### 3. Execute
|
|
53
137
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
4. Optionally configure **Node Parameters**
|
|
138
|
+
```
|
|
139
|
+
Run your workflow and enjoy! 🎉
|
|
140
|
+
```
|
|
58
141
|
|
|
59
|
-
|
|
142
|
+
---
|
|
60
143
|
|
|
61
|
-
|
|
144
|
+
## 🤖 ComfyUI Tool Node
|
|
62
145
|
|
|
63
|
-
|
|
64
|
-
- **ComfyUI URL**: `http://127.0.0.1:8188`
|
|
65
|
-
- **Workflow JSON**: Your ComfyUI workflow in API format
|
|
146
|
+
### Overview
|
|
66
147
|
|
|
67
|
-
**
|
|
68
|
-
- Node ID: `6` (your CLIP text node)
|
|
69
|
-
- Parameter Name: `text`
|
|
70
|
-
- Type: `Text`
|
|
71
|
-
- Value: `a beautiful landscape, high quality`
|
|
148
|
+
**Optimized for AI Agent workflows** - URL-based image input, simple configuration, LLM-friendly.
|
|
72
149
|
|
|
73
|
-
###
|
|
150
|
+
### Why URL-Based Input?
|
|
74
151
|
|
|
75
|
-
|
|
152
|
+
```
|
|
153
|
+
❌ Base64 Image:
|
|
154
|
+
- Size: ~100KB - 1MB per image
|
|
155
|
+
- Tokens: ~130K - 1.3M tokens
|
|
156
|
+
- Result: 💥 Explodes LLM context
|
|
157
|
+
|
|
158
|
+
✅ Image URL:
|
|
159
|
+
- Size: ~100 bytes
|
|
160
|
+
- Tokens: ~30 tokens
|
|
161
|
+
- Result: ✅ Lightweight and efficient
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Configuration
|
|
76
165
|
|
|
77
|
-
|
|
166
|
+
#### Basic Setup
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
┌─────────────────────────────────────────────────┐
|
|
170
|
+
│ ComfyUI Tool │
|
|
171
|
+
├─────────────────────────────────────────────────┤
|
|
172
|
+
│ ComfyUI URL: http://127.0.0.1:8188 │
|
|
173
|
+
│ Workflow JSON: [Your ComfyUI workflow] │
|
|
174
|
+
│ Timeout: 300 │
|
|
175
|
+
│ Load Image Node ID: │
|
|
176
|
+
│ (for image workflows) │
|
|
177
|
+
│ Image URL: [URL or {{ $json.imageUrl }}] │
|
|
178
|
+
└─────────────────────────────────────────────────┘
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
#### Parameters
|
|
182
|
+
|
|
183
|
+
| Parameter | Description | Example |
|
|
184
|
+
|-----------|-------------|---------|
|
|
185
|
+
| **ComfyUI URL** | ComfyUI server address | `http://127.0.0.1:8188` |
|
|
186
|
+
| **Workflow JSON** | ComfyUI workflow in API format | `{ "3": {...} }` |
|
|
187
|
+
| **Timeout** | Max wait time (seconds) | `300` (5 min) |
|
|
188
|
+
| **Load Image Node ID** | LoadImage node ID for image workflows | `107` |
|
|
189
|
+
| **Image URL** | URL of image to process | `https://...` |
|
|
190
|
+
| **Parameter Overrides** | Override workflow parameters | See below |
|
|
191
|
+
|
|
192
|
+
### Output Format
|
|
78
193
|
|
|
79
194
|
```json
|
|
80
195
|
{
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
|
|
84
|
-
|
|
196
|
+
"success": true,
|
|
197
|
+
"imageUrls": [
|
|
198
|
+
"http://127.0.0.1:8188/view?filename=ComfyUI_00001.png"
|
|
199
|
+
],
|
|
200
|
+
"videoUrls": [],
|
|
201
|
+
"imageCount": 1,
|
|
202
|
+
"videoCount": 0
|
|
85
203
|
}
|
|
86
204
|
```
|
|
87
205
|
|
|
88
|
-
|
|
206
|
+
### AI Agent Integration Example
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
Workflow:
|
|
210
|
+
[Chat Input] → [AI Agent] → [ComfyUI Tool]
|
|
211
|
+
↓
|
|
212
|
+
Passes imageUrl
|
|
213
|
+
↓
|
|
214
|
+
Downloads image
|
|
215
|
+
↓
|
|
216
|
+
Processes in ComfyUI
|
|
217
|
+
↓
|
|
218
|
+
Returns result URLs
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Chat Example:**
|
|
89
222
|
|
|
90
|
-
|
|
223
|
+
```
|
|
224
|
+
User: Transform this image (https://example.com/photo.png)
|
|
225
|
+
to oil painting style
|
|
91
226
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
227
|
+
AI Agent:
|
|
228
|
+
1. Extracts URL from message
|
|
229
|
+
2. Calls ComfyUI Tool
|
|
230
|
+
3. ComfyUI Tool downloads image
|
|
231
|
+
4. Processes in ComfyUI
|
|
232
|
+
5. Returns result URLs
|
|
233
|
+
6. AI Agent shows result to user
|
|
234
|
+
```
|
|
95
235
|
|
|
96
|
-
|
|
236
|
+
---
|
|
97
237
|
|
|
98
|
-
|
|
238
|
+
## 🔧 ComfyUI Node
|
|
99
239
|
|
|
100
|
-
|
|
240
|
+
### Overview
|
|
101
241
|
|
|
102
|
-
|
|
242
|
+
**Full-featured node for standard workflows** - Supports binary and URL inputs with advanced configuration.
|
|
103
243
|
|
|
104
|
-
|
|
105
|
-
- **Image Input Type**: `Binary`
|
|
106
|
-
- **Value**: Binary property name (e.g., `data`, `image`, `file`)
|
|
244
|
+
### Configuration
|
|
107
245
|
|
|
108
|
-
####
|
|
246
|
+
#### Basic Setup
|
|
109
247
|
|
|
110
|
-
|
|
248
|
+
```
|
|
249
|
+
┌─────────────────────────────────────────────────┐
|
|
250
|
+
│ ComfyUI │
|
|
251
|
+
├─────────────────────────────────────────────────┤
|
|
252
|
+
│ ComfyUI URL: http://127.0.0.1:8188 │
|
|
253
|
+
│ Workflow JSON: [Your ComfyUI workflow] │
|
|
254
|
+
│ Timeout: 300 │
|
|
255
|
+
│ Output Binary Key: data │
|
|
256
|
+
├─────────────────────────────────────────────────┤
|
|
257
|
+
│ Node Parameters: │
|
|
258
|
+
│ [Multiple parameter configurations] │
|
|
259
|
+
└─────────────────────────────────────────────────┘
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
#### Parameters
|
|
263
|
+
|
|
264
|
+
| Parameter | Description | Example |
|
|
265
|
+
|-----------|-------------|---------|
|
|
266
|
+
| **ComfyUI URL** | ComfyUI server address | `http://127.0.0.1:8188` |
|
|
267
|
+
| **Workflow JSON** | ComfyUI workflow in API format | `{ "3": {...} }` |
|
|
268
|
+
| **Timeout** | Max wait time (seconds) | `300` (5 min) |
|
|
269
|
+
| **Output Binary Key** | First output binary property name | `data`, `image` |
|
|
270
|
+
| **Node Parameters** | Override workflow parameters | See below |
|
|
271
|
+
|
|
272
|
+
### Image Input Methods
|
|
273
|
+
|
|
274
|
+
#### Method 1: Binary Data
|
|
111
275
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
276
|
+
```
|
|
277
|
+
Node Parameters:
|
|
278
|
+
Node ID: 107
|
|
279
|
+
Parameter Mode: Single Parameter
|
|
280
|
+
Parameter Name: image
|
|
281
|
+
Type: Image
|
|
282
|
+
Image Input Type: Binary ← Binary mode
|
|
283
|
+
Value: data
|
|
284
|
+
```
|
|
115
285
|
|
|
116
|
-
|
|
286
|
+
**Use when:** Previous node outputs binary data (HTTP Request, Webhook, etc.)
|
|
117
287
|
|
|
118
|
-
|
|
288
|
+
#### Method 2: URL
|
|
119
289
|
|
|
120
|
-
|
|
290
|
+
```
|
|
291
|
+
Node Parameters:
|
|
292
|
+
Node ID: 107
|
|
293
|
+
Parameter Mode: Single Parameter
|
|
294
|
+
Parameter Name: image
|
|
295
|
+
Type: Image
|
|
296
|
+
Image Input Type: URL ← URL mode
|
|
297
|
+
Image URL: https://example.com/image.png
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Use when:** Downloading from web or using URL
|
|
121
301
|
|
|
122
|
-
|
|
123
|
-
- Default: `data`
|
|
302
|
+
### Output Format
|
|
124
303
|
|
|
125
|
-
**Example:**
|
|
126
304
|
```json
|
|
127
305
|
{
|
|
306
|
+
"json": {
|
|
307
|
+
"success": true,
|
|
308
|
+
"imageCount": 1,
|
|
309
|
+
"imageUrls": ["http://..."],
|
|
310
|
+
"data": { ... }
|
|
311
|
+
},
|
|
128
312
|
"binary": {
|
|
129
|
-
"
|
|
313
|
+
"data": {
|
|
314
|
+
"data": "base64...",
|
|
315
|
+
"mimeType": "image/png",
|
|
316
|
+
"fileName": "ComfyUI_00001.png"
|
|
317
|
+
}
|
|
130
318
|
}
|
|
131
319
|
}
|
|
132
320
|
```
|
|
133
321
|
|
|
134
|
-
|
|
322
|
+
---
|
|
135
323
|
|
|
136
|
-
|
|
324
|
+
## 📚 Advanced Usage
|
|
137
325
|
|
|
138
|
-
###
|
|
326
|
+
### 1. Text-to-Image with Dynamic Prompts
|
|
139
327
|
|
|
140
|
-
**
|
|
141
|
-
1. Add **OpenAI Conversational Agent** node
|
|
142
|
-
2. Configure Chat Model (GPT-4/GPT-3.5)
|
|
143
|
-
3. Add Memory (optional but recommended)
|
|
328
|
+
**ComfyUI Node Setup:**
|
|
144
329
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
330
|
+
```
|
|
331
|
+
Node Parameters:
|
|
332
|
+
Node ID: 6 (CLIP Text Encode)
|
|
333
|
+
Parameter Mode: Single Parameter
|
|
334
|
+
Parameter Name: text
|
|
335
|
+
Type: Text
|
|
336
|
+
Value: {{ $json.prompt }}
|
|
337
|
+
```
|
|
153
338
|
|
|
154
|
-
**
|
|
155
|
-
|
|
339
|
+
**Input:**
|
|
340
|
+
```json
|
|
341
|
+
{
|
|
342
|
+
"prompt": "a beautiful landscape at sunset"
|
|
343
|
+
}
|
|
344
|
+
```
|
|
156
345
|
|
|
157
|
-
###
|
|
346
|
+
### 2. Image-to-Image Processing
|
|
158
347
|
|
|
159
|
-
**
|
|
348
|
+
**ComfyUI Tool Setup:**
|
|
160
349
|
|
|
161
|
-
**User:**
|
|
162
350
|
```
|
|
163
|
-
|
|
351
|
+
Load Image Node ID: 107
|
|
352
|
+
Image URL: {{ $json.imageUrl }}
|
|
353
|
+
Parameter Overrides:
|
|
354
|
+
- Node ID: 6
|
|
355
|
+
Param Path: inputs.text
|
|
356
|
+
Value: {{ $json.prompt }}
|
|
164
357
|
```
|
|
165
358
|
|
|
166
|
-
**
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
359
|
+
**Input:**
|
|
360
|
+
```json
|
|
361
|
+
{
|
|
362
|
+
"imageUrl": "https://example.com/input.png",
|
|
363
|
+
"prompt": "Transform to oil painting style"
|
|
364
|
+
}
|
|
171
365
|
```
|
|
172
366
|
|
|
173
|
-
|
|
367
|
+
### 3. Multiple Parameters Override
|
|
368
|
+
|
|
369
|
+
**ComfyUI Node Setup:**
|
|
174
370
|
|
|
175
|
-
**User:**
|
|
176
371
|
```
|
|
177
|
-
|
|
372
|
+
Node Parameters:
|
|
373
|
+
Node ID: 3
|
|
374
|
+
Parameter Mode: Multiple Parameters
|
|
375
|
+
Parameters JSON:
|
|
376
|
+
{
|
|
377
|
+
"width": 1024,
|
|
378
|
+
"height": 1024,
|
|
379
|
+
"steps": 30,
|
|
380
|
+
"cfg": 7.5,
|
|
381
|
+
"seed": 123456
|
|
382
|
+
}
|
|
178
383
|
```
|
|
179
384
|
|
|
180
|
-
|
|
181
|
-
- `size:WIDTHxHEIGHT` - Image dimensions
|
|
182
|
-
- `steps:N` - Sampling steps
|
|
183
|
-
- `cfg:N` - CFG strength
|
|
184
|
-
- `seed:N` - Random seed
|
|
185
|
-
- `negative:TEXT` - Negative prompt
|
|
385
|
+
### 4. Video Generation
|
|
186
386
|
|
|
187
|
-
**
|
|
387
|
+
**Setup:** Similar to image generation, just use a video workflow in ComfyUI.
|
|
188
388
|
|
|
189
|
-
**
|
|
190
|
-
```
|
|
191
|
-
|
|
389
|
+
**Output:**
|
|
390
|
+
```json
|
|
391
|
+
{
|
|
392
|
+
"videoUrls": ["http://127.0.0.1:8188/view?filename=video.mp4"],
|
|
393
|
+
"videoCount": 1
|
|
394
|
+
}
|
|
192
395
|
```
|
|
193
396
|
|
|
194
|
-
|
|
397
|
+
---
|
|
195
398
|
|
|
196
|
-
|
|
399
|
+
## 🤖 AI Agent Workflows
|
|
197
400
|
|
|
198
|
-
|
|
199
|
-
- **Parameter Mode**: Single Parameter
|
|
200
|
-
- **Parameter Name**: `text`
|
|
201
|
-
- **Type**: Text
|
|
202
|
-
- **Value**: [Leave empty - AI Agent will fill this]
|
|
401
|
+
### Example 1: Image Generation Chat
|
|
203
402
|
|
|
204
|
-
|
|
403
|
+
```
|
|
404
|
+
Workflow:
|
|
405
|
+
[Chat Interface] → [AI Agent] → [ComfyUI Tool]
|
|
406
|
+
|
|
407
|
+
Configuration:
|
|
408
|
+
- Model: GPT-4
|
|
409
|
+
- Tools: ComfyUI Tool
|
|
410
|
+
- Workflow: Text-to-Image
|
|
411
|
+
|
|
412
|
+
Conversation:
|
|
413
|
+
User: "Generate a picture of a cute cat"
|
|
414
|
+
AI: [Calls ComfyUI Tool]
|
|
415
|
+
AI: "Here's your image! 😊"
|
|
416
|
+
```
|
|
205
417
|
|
|
206
|
-
|
|
418
|
+
### Example 2: Image Editing
|
|
207
419
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
420
|
+
```
|
|
421
|
+
Workflow:
|
|
422
|
+
[Chat Interface] → [AI Agent] → [ComfyUI Tool]
|
|
423
|
+
|
|
424
|
+
Configuration:
|
|
425
|
+
- ComfyUI Tool:
|
|
426
|
+
- Workflow: Image-to-Image
|
|
427
|
+
- Load Image Node ID: 107
|
|
428
|
+
- Image URL: {{ $json.imageUrl }}
|
|
429
|
+
|
|
430
|
+
Conversation:
|
|
431
|
+
User: "Transform this image (URL) to watercolor style"
|
|
432
|
+
AI: [Extracts URL, downloads image, processes in ComfyUI]
|
|
433
|
+
AI: "Done! Here's the watercolor version 🎨"
|
|
434
|
+
```
|
|
213
435
|
|
|
214
|
-
|
|
215
|
-
- `json.images`: Array of image paths
|
|
216
|
-
- `json.imageUrls`: Array of complete image URLs (e.g., `http://127.0.0.1:8188/view?filename=...`)
|
|
217
|
-
- `json.videos`: Array of video paths
|
|
218
|
-
- `json.videoUrls`: Array of complete video URLs
|
|
219
|
-
- `json.imageCount`: Number of images generated
|
|
220
|
-
- `json.videoCount`: Number of videos generated
|
|
436
|
+
### Example 3: Multi-Modal Workflow
|
|
221
437
|
|
|
222
|
-
|
|
438
|
+
```
|
|
439
|
+
Workflow:
|
|
440
|
+
[Chat Input] → [AI Agent] → [ComfyUI Tool] → [Chat Model]
|
|
441
|
+
↓ ↓
|
|
442
|
+
Generate Image Write Poem
|
|
443
|
+
↓ ↓
|
|
444
|
+
Return Combined Result
|
|
445
|
+
|
|
446
|
+
Conversation:
|
|
447
|
+
User: "Create an image of a futuristic city
|
|
448
|
+
and write a poem about it"
|
|
449
|
+
|
|
450
|
+
AI: [1. Generates image via ComfyUI Tool]
|
|
451
|
+
[2. Writes poem about the image]
|
|
452
|
+
[3. Returns both to user]
|
|
453
|
+
```
|
|
223
454
|
|
|
224
|
-
|
|
455
|
+
---
|
|
225
456
|
|
|
226
|
-
|
|
457
|
+
## ⚙️ Best Practices
|
|
227
458
|
|
|
228
|
-
|
|
459
|
+
### 1. URL Selection
|
|
229
460
|
|
|
230
|
-
**
|
|
461
|
+
✅ **Good:**
|
|
462
|
+
```
|
|
463
|
+
https://cdn.example.com/images/photo.png
|
|
464
|
+
https://storage.googleapis.com/bucket/image.jpg
|
|
465
|
+
https://s3.amazonaws.com/bucket/photo.png
|
|
466
|
+
```
|
|
231
467
|
|
|
232
|
-
|
|
468
|
+
❌ **Avoid:**
|
|
469
|
+
```
|
|
470
|
+
file:///local/path/image.png ← Not accessible
|
|
471
|
+
http://localhost:8080/image.png ← Private network
|
|
472
|
+
```
|
|
233
473
|
|
|
234
|
-
|
|
474
|
+
### 2. Parameter Naming
|
|
235
475
|
|
|
236
|
-
**
|
|
476
|
+
✅ **Use Clear Names:**
|
|
477
|
+
```
|
|
478
|
+
Node ID: 6
|
|
479
|
+
Parameter Name: text ← Matches ComfyUI node input
|
|
480
|
+
```
|
|
237
481
|
|
|
238
|
-
**
|
|
482
|
+
❌ **Vague Names:**
|
|
483
|
+
```
|
|
484
|
+
Node ID: node_6
|
|
485
|
+
Parameter Name: param1 ← Unclear what it does
|
|
486
|
+
```
|
|
239
487
|
|
|
240
|
-
|
|
488
|
+
### 3. Timeout Settings
|
|
241
489
|
|
|
242
490
|
```
|
|
243
|
-
|
|
491
|
+
Simple workflows: 60-120 seconds
|
|
492
|
+
Complex workflows: 300-600 seconds
|
|
493
|
+
Video generation: 600-1800 seconds
|
|
244
494
|
```
|
|
245
495
|
|
|
246
|
-
###
|
|
496
|
+
### 4. Error Handling
|
|
247
497
|
|
|
248
|
-
|
|
498
|
+
```javascript
|
|
499
|
+
// Always validate inputs
|
|
500
|
+
if (!workflowJson) {
|
|
501
|
+
throw new Error('Workflow JSON is required');
|
|
502
|
+
}
|
|
249
503
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
504
|
+
// Check ComfyUI server availability
|
|
505
|
+
// Use appropriate timeouts
|
|
506
|
+
// Handle network errors gracefully
|
|
253
507
|
```
|
|
254
508
|
|
|
255
|
-
|
|
256
|
-
- Upload input image as binary data
|
|
257
|
-
- Configure style parameters
|
|
509
|
+
---
|
|
258
510
|
|
|
259
|
-
|
|
511
|
+
## 🔧 Troubleshooting
|
|
260
512
|
|
|
261
|
-
|
|
513
|
+
### Common Issues
|
|
262
514
|
|
|
263
|
-
|
|
264
|
-
```
|
|
265
|
-
Generate an image of a futuristic city, then write a poem about it
|
|
266
|
-
```
|
|
515
|
+
#### ❌ "Invalid ComfyUI URL"
|
|
267
516
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
517
|
+
**Solution:**
|
|
518
|
+
- Check ComfyUI is running
|
|
519
|
+
- Verify URL format: `http://127.0.0.1:8188`
|
|
520
|
+
- Try accessing ComfyUI in browser first
|
|
521
|
+
|
|
522
|
+
#### ❌ "Workflow execution timeout"
|
|
523
|
+
|
|
524
|
+
**Solutions:**
|
|
525
|
+
- Increase timeout value
|
|
526
|
+
- Check workflow complexity
|
|
527
|
+
- Verify ComfyUI server performance
|
|
528
|
+
- Check ComfyUI logs for errors
|
|
529
|
+
|
|
530
|
+
#### ❌ "Node ID not found in workflow"
|
|
272
531
|
|
|
273
|
-
|
|
532
|
+
**Solutions:**
|
|
533
|
+
- Open workflow JSON
|
|
534
|
+
- Find the correct node ID
|
|
535
|
+
- Note: IDs are strings like "6", "13", not numbers
|
|
274
536
|
|
|
275
|
-
|
|
537
|
+
#### ❌ "Failed to download image from URL"
|
|
276
538
|
|
|
277
|
-
**
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
539
|
+
**Solutions:**
|
|
540
|
+
- Verify URL is publicly accessible
|
|
541
|
+
- Check URL doesn't require authentication
|
|
542
|
+
- Ensure URL returns image (not HTML)
|
|
543
|
+
- Test URL in browser first
|
|
281
544
|
|
|
282
|
-
|
|
545
|
+
#### ❌ "AI Agent doesn't call ComfyUI"
|
|
283
546
|
|
|
284
|
-
**
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
547
|
+
**Solutions:**
|
|
548
|
+
- Ensure ComfyUI Tool is added to Agent's tools
|
|
549
|
+
- Check tool description is clear
|
|
550
|
+
- Verify workflow JSON is configured
|
|
551
|
+
- Check Agent logs
|
|
288
552
|
|
|
289
|
-
|
|
553
|
+
---
|
|
290
554
|
|
|
291
|
-
|
|
292
|
-
|-------|-------------|
|
|
293
|
-
| **ComfyUI URL** | URL of your ComfyUI server |
|
|
294
|
-
| **Workflow JSON** | ComfyUI workflow in API format |
|
|
295
|
-
| **Timeout** | Maximum wait time in seconds (default: 300) |
|
|
296
|
-
| **Output Binary Key** | Property name for first output binary data (default: `data`) |
|
|
297
|
-
| **Node Parameters** | Override workflow parameters |
|
|
555
|
+
## 📖 Configuration Reference
|
|
298
556
|
|
|
299
|
-
|
|
557
|
+
### ComfyUI Tool Node
|
|
300
558
|
|
|
301
|
-
| Field | Description |
|
|
302
|
-
|
|
303
|
-
| **
|
|
304
|
-
| **
|
|
305
|
-
| **
|
|
306
|
-
| **Image
|
|
307
|
-
| **Image URL** |
|
|
308
|
-
| **Parameter
|
|
309
|
-
|
|
310
|
-
|
|
559
|
+
| Field | Type | Required | Default | Description |
|
|
560
|
+
|-------|------|----------|---------|-------------|
|
|
561
|
+
| **ComfyUI URL** | String | ✅ | `http://127.0.0.1:8188` | ComfyUI server address |
|
|
562
|
+
| **Workflow JSON** | String | ✅ | - | ComfyUI workflow in API format |
|
|
563
|
+
| **Timeout** | Number | ❌ | `300` | Max wait time (seconds) |
|
|
564
|
+
| **Load Image Node ID** | String | ❌ | - | LoadImage node ID for image workflows |
|
|
565
|
+
| **Image URL** | String | ❌ | - | URL of image to process |
|
|
566
|
+
| **Parameter Overrides** | Collection | ❌ | - | Override workflow parameters |
|
|
567
|
+
|
|
568
|
+
### ComfyUI Node
|
|
569
|
+
|
|
570
|
+
| Field | Type | Required | Default | Description |
|
|
571
|
+
|-------|------|----------|---------|-------------|
|
|
572
|
+
| **ComfyUI URL** | String | ✅ | `http://127.0.0.1:8188` | ComfyUI server address |
|
|
573
|
+
| **Workflow JSON** | String | ✅ | - | ComfyUI workflow in API format |
|
|
574
|
+
| **Timeout** | Number | ❌ | `300` | Max wait time (seconds) |
|
|
575
|
+
| **Output Binary Key** | String | ❌ | `data` | First output binary property name |
|
|
576
|
+
| **Node Parameters** | Collection | ❌ | - | Override workflow parameters |
|
|
577
|
+
|
|
578
|
+
### Node Parameter Fields
|
|
579
|
+
|
|
580
|
+
| Field | Description | Options |
|
|
581
|
+
|-------|-------------|---------|
|
|
582
|
+
| **Node ID** | Node ID from workflow JSON | e.g., `6`, `13`, `107` |
|
|
583
|
+
| **Parameter Mode** | How to configure parameters | Single / Multiple |
|
|
584
|
+
| **Type** | Parameter data type | Text / Number / Boolean / Image |
|
|
585
|
+
| **Image Input Type** | How to input image (when Type=Image) | Binary / URL |
|
|
586
|
+
| **Parameter Name** | Parameter to override (single mode) | e.g., `text`, `seed`, `steps` |
|
|
587
|
+
| **Parameters JSON** | JSON object with parameters (multiple mode) | `{"width": 1024}` |
|
|
588
|
+
| **Value** | Value to set | Text / Number / Boolean |
|
|
589
|
+
|
|
590
|
+
---
|
|
311
591
|
|
|
312
592
|
## 💡 Tips
|
|
313
593
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
-
|
|
317
|
-
-
|
|
318
|
-
-
|
|
319
|
-
-
|
|
594
|
+
### 🎯 Performance
|
|
595
|
+
|
|
596
|
+
- Start with simple workflows to test setup
|
|
597
|
+
- Use appropriate timeout values
|
|
598
|
+
- Monitor ComfyUI resource usage
|
|
599
|
+
- Use specific prompts for better results
|
|
600
|
+
|
|
601
|
+
### 🔒 Security
|
|
602
|
+
|
|
603
|
+
- Don't expose ComfyUI server publicly
|
|
604
|
+
- Use secure URLs for images
|
|
605
|
+
- Validate user inputs in production
|
|
606
|
+
- Keep workflow JSON private if needed
|
|
607
|
+
|
|
608
|
+
### 📝 Workflow Design
|
|
609
|
+
|
|
610
|
+
- Document your ComfyUI workflows
|
|
611
|
+
- Use consistent node IDs
|
|
612
|
+
- Test workflows in ComfyUI first
|
|
613
|
+
- Keep workflows simple and modular
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## 🤝 Contributing
|
|
618
|
+
|
|
619
|
+
Contributions are welcome! Please feel free to submit issues or pull requests.
|
|
620
|
+
|
|
621
|
+
## 📄 License
|
|
622
|
+
|
|
623
|
+
MIT License - see LICENSE file for details
|
|
624
|
+
|
|
625
|
+
## 🙏 Acknowledgments
|
|
626
|
+
|
|
627
|
+
- [ComfyUI](https://github.com/comfyanonymous/ComfyUI) - Powerful UI for Stable Diffusion
|
|
628
|
+
- [n8n](https://n8n.io) - Workflow automation tool
|
|
629
|
+
|
|
630
|
+
---
|
|
631
|
+
|
|
632
|
+
**Need Help?**
|
|
633
|
+
|
|
634
|
+
- 📖 Check the [Documentation](https://docs.n8n.io)
|
|
635
|
+
- 💬 Join the [Community](https://community.n8n.io)
|
|
636
|
+
- 🐛 Report [Issues](https://github.com/your-repo/issues)
|
|
637
|
+
|
|
638
|
+
**Happy Automating! 🚀**
|