n8n-nodes-comfyui-all 2.0.0 → 2.1.0

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.
Files changed (2) hide show
  1. package/README.md +156 -785
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,882 +1,253 @@
1
- # n8n-comfyui-nodes
1
+ # n8n-nodes-comfyui-all
2
2
 
3
- n8n 社区节点,用于集成 ComfyUI 工作流到 n8n 自动化平台。
3
+ > n8n community node for integrating ComfyUI workflows into n8n automation platform.
4
4
 
5
- ## 📚 快速导航
5
+ [![npm version](https://badge.fury.io/js/n8n-nodes-comfyui-all.svg)](https://www.npmjs.com/package/n8n-nodes-comfyui-all)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
7
 
7
- - **[AI Agent 集成](#ai-agent-集成)** - 在 AI Agent 中使用 ComfyUI 生成图像
8
- - **[快速开始](#快速开始)** - 安装和配置指南
9
- - **[使用方法](#使用方法)** - 基础节点使用
10
- - **[工作流示例](#工作流示例)** - 实际应用案例
11
- - **[故障排除](#故障排除)** - 常见问题解决
8
+ ## Features
12
9
 
13
- ## 版本信息
10
+ - 🎨 **Universal Workflow Support** - Works with any ComfyUI workflow in API format
11
+ - 🔄 **Dynamic Parameters** - Override workflow parameters dynamically
12
+ - 🎬 **Multi-Modal Output** - Supports images, videos, and more
13
+ - 🔐 **SSRF Protection** - Built-in security for private networks
14
+ - 🤖 **AI Agent Ready** - Can be used as a tool in AI Agent workflows
15
+ - 📊 **Flexible Configuration** - JSON mode or single parameter mode
16
+ - 🖼️ **Binary Data Support** - Upload input images to ComfyUI
14
17
 
15
- **当前版本**: 2.4
16
- **发布日期**: 2026-01-07
17
- **节点名称**: ComfyUI Workflow
18
+ ## 📦 Installation
18
19
 
19
- ---
20
-
21
- ## 特性
22
-
23
- - ✅ **统一节点**:支持任意 ComfyUI API 格式工作流
24
- - ✅ **动态参数**:自动识别和配置工作流中的输入参数
25
- - ✅ **灵活配置**:支持文本生成图像、图像处理、视频生成等所有 ComfyUI 功能
26
- - ✅ **智能验证**:自动验证工作流格式和参数
27
- - ✅ **SSRF 防护**:防止内网地址访问
28
- - ✅ **错误处理**:完善的错误处理和重试机制
29
- - ✅ **双模式参数配置**:支持 JSON 模式(多个参数)和单参数模式(逐个配置)
30
- - ✅ **图像输入验证**:imagesToAny action 自动验证图像输入
31
- - 🆕 **AI Agent 支持**:既可作为普通节点,也可作为 AI Agent Tool 使用
32
- - 🆕 **双模式工作**:在普通工作流和 AI Agent 对话中都能使用
33
-
34
- ### 重要说明
35
-
36
- #### 自定义节点 vs 社区节点
37
-
38
- 本项目是一个**自定义节点**(Custom Node),用于本地开发和测试。
39
-
40
- **自定义节点**:
41
- - 本地开发,无需发布到 npm
42
- - 可以快速迭代和调试
43
- - 实时修改代码,立即生效
44
- - 适合开发环境
45
-
46
- **社区节点**(Community Nodes):
47
- - 通过 n8n 界面安装(Settings → Community Nodes)
48
- - 从 npm registry 下载已发布的包
49
- - n8n 自动管理依赖
50
- - 适合使用第三方开发的成熟节点
51
-
52
- ---
53
-
54
- ## 快速开始
55
-
56
- ### 前置要求
57
-
58
- - Node.js 18.10+
59
- - npm
60
- - n8n 2.x
61
- - ComfyUI 服务器运行中(默认:http://127.0.0.1:8188)
20
+ ### n8n Cloud (Recommended)
62
21
 
63
- ### 安装
22
+ 1. Go to **Settings** → **Community Nodes**
23
+ 2. Click **Install**
24
+ 3. Enter: `n8n-nodes-comfyui-all`
25
+ 4. Click **Install**
64
26
 
65
- #### 方法 1: 使用本地安装(推荐)
27
+ ### Self-Hosted n8n
66
28
 
67
29
  ```bash
68
- # 步骤 1: 编译项目
69
- cd /home/ZLQyiA/projets/n8n-service/n8n-comfyui-nodes
70
- npm install
71
- npm run build
30
+ # Via npm
31
+ cd ~/.n8n
32
+ npm install n8n-nodes-comfyui-all
72
33
 
73
- # 步骤 2: n8n 的 custom 目录安装
74
- cd /home/ZLQyiA/projets/n8n-service/.n8n/custom
75
-
76
- # 创建 package.json(如果不存在)
77
- cat > package.json << 'EOF'
78
- {
79
- "name": "n8n-custom-nodes",
80
- "version": "1.0.0",
81
- "description": "Custom n8n nodes",
82
- "dependencies": {
83
- "n8n-nodes-comfyui-all": "file:../../n8n-comfyui-nodes"
84
- }
85
- }
86
- EOF
87
-
88
- # 安装本地包
89
- npm install
90
-
91
- # 步骤 3: 验证安装
92
- ls -la node_modules/
93
- # 应该看到: n8n-nodes-comfyui-all -> ../../../n8n-comfyui-nodes
94
-
95
- # 步骤 4: 重启 n8n 服务
96
- cd /home/ZLQyiA/projets/n8n-service
97
- ./stop-n8n.sh
98
- ./start-n8n.sh
34
+ # Or via n8n interface
35
+ # Settings → Community Nodes → Install → n8n-nodes-comfyui-all
99
36
  ```
100
37
 
101
- **重要说明**:
102
- - n8n 使用 `N8N_USER_DATA_DIR` 环境变量指定的目录
103
- - 在我们的环境中,custom 目录位于:`/home/ZLQyiA/projets/n8n-service/.n8n/custom/`
104
- - 请确保安装到正确的 custom 目录,而不是 `~/.n8n/custom/`
38
+ Restart n8n after installation.
105
39
 
106
- ### 重新部署
40
+ ## 🚀 Quick Start
107
41
 
108
- 如果需要重新部署(例如修改代码后):
42
+ ### 1. Prerequisites
109
43
 
110
- ```bash
111
- # 1. 清理旧安装
112
- cd /home/ZLQyiA/projets/n8n-service
113
- rm -rf .n8n/custom/node_modules .n8n/custom/package-lock.json
114
- rm -rf n8n-comfyui-nodes/dist
115
-
116
- # 2. 重新编译
117
- cd n8n-comfyui-nodes
118
- npm run build
119
-
120
- # 3. 重新安装
121
- cd ../.n8n/custom
122
- npm install
123
-
124
- # 4. 重启 n8n
125
- cd ../..
126
- ./stop-n8n.sh
127
- ./start-n8n.sh
128
-
129
- # 5. 验证部署
130
- cd n8n-comfyui-nodes
131
- ./check-deployment.sh
132
- ```
44
+ - ComfyUI server running (default: `http://127.0.0.1:8188`)
45
+ - n8n instance (version 2.x or higher)
133
46
 
134
- **一键部署脚本** (推荐):
135
- ```bash
136
- cd /home/ZLQyiA/projets/n8n-service/n8n-comfyui-nodes
137
- ./check-deployment.sh # 检查当前部署状态
138
- ```
47
+ ### 2. Create Your Workflow in ComfyUI
139
48
 
140
- #### 方法 2: 通过 n8n 界面安装
49
+ 1. Design your workflow in ComfyUI
50
+ 2. Click **Save (API Format)** to export
51
+ 3. Copy the generated JSON
141
52
 
142
- 1. 访问 n8n 界面
143
- 2. Settings → Community Nodes
144
- 3. 点击 "Install"
145
- 4. 输入包名并安装
53
+ ### 3. Configure n8n Node
146
54
 
147
- ### 重启 n8n
55
+ 1. Add **ComfyUI** node to your n8n workflow
56
+ 2. Set **ComfyUI URL**: `http://127.0.0.1:8188`
57
+ 3. Paste your **Workflow JSON**
58
+ 4. Optionally configure **Node Parameters**
148
59
 
149
- ```bash
150
- cd /home/ZLQyiA/projets/n8n-service
151
- ./stop-n8n.sh
152
- ./start-n8n.sh
153
- ```
154
-
155
- ---
156
-
157
- ## 使用方法
158
-
159
- ### 步骤 1: 在 ComfyUI 中创建工作流
160
-
161
- 1. 在 ComfyUI 中设计你的工作流
162
- 2. 点击 **Save (API Format)** 导出工作流
163
- 3. 复制生成的 JSON
60
+ ## 📖 Usage
164
61
 
165
- ### 步骤 2: n8n 中配置节点
62
+ ### Basic Example: Text to Image
166
63
 
167
- 1. 添加 **ComfyUI Workflow** 节点
168
- 2. 配置参数:
169
- - **ComfyUI URL**: `http://127.0.0.1:8188`
170
- - **Workflow JSON**: 粘贴工作流 JSON
171
- - **Node Parameters**: 配置节点参数(支持 JSON 模式和单参数模式)
64
+ **Node Configuration:**
65
+ - **Action**: TextToAny
66
+ - **ComfyUI URL**: `http://127.0.0.1:8188`
67
+ - **Workflow JSON**: Your ComfyUI workflow in API format
172
68
 
173
- ### 步骤 3: 配置输入参数
69
+ **Optional Node Parameters (Single Parameter Mode):**
70
+ - Node ID: `6` (your CLIP text node)
71
+ - Parameter Name: `text`
72
+ - Type: `Text`
73
+ - Value: `a beautiful landscape, high quality`
174
74
 
175
- 使用 **Node Parameters** 功能为节点配置参数,支持两种模式:
75
+ ### Advanced: Node Parameters
176
76
 
177
- #### 模式 1: JSON 模式(推荐)
77
+ The node supports two parameter configuration modes:
178
78
 
179
- 一次性为节点配置多个参数,适合熟悉 JSON 的用户。
79
+ #### 1. Multiple Parameters Mode (JSON)
180
80
 
181
- **使用步骤**:
182
-
183
- 1. 在节点配置中找到 **"Node Parameters"** 部分
184
- 2. 点击 **"Add Node"** 添加一个节点配置
185
- 3. 选择 **Parameter Mode** 为 **JSON Mode**
186
- 4. 填写以下字段:
187
- - **Node ID**: 工作流中节点的 ID(例如:`13`)
188
- - **Parameters JSON**: 该节点的所有参数,JSON 格式
189
-
190
- **示例**:
191
-
192
- 假设你的工作流中有一个 EmptyLatentImage 节点(ID: 13),需要配置 width、height 和 batch_size:
81
+ Configure multiple parameters at once using JSON:
193
82
 
194
83
  ```json
195
84
  {
196
85
  "width": 1024,
197
86
  "height": 1024,
198
- "batch_size": 1
87
+ "batch_size": 1,
88
+ "seed": 12345
199
89
  }
200
90
  ```
201
91
 
202
- **多个节点配置**:
203
-
204
- 你可以添加多个 Node 条目来配置不同的节点:
205
-
206
- - Node 1: ID=13, Mode=JSON, Parameters=`{"width": 1024, "height": 1024, "batch_size": 1}`
207
- - Node 2: ID=3, Mode=JSON, Parameters=`{"seed": 12345, "steps": 20, "cfg": 7.5}`
208
-
209
- **优点**:
210
- - ✅ 配置更简洁,一个节点一个配置项
211
- - ✅ 支持 JSON 格式,可以复制粘贴
212
- - ✅ 适合需要配置多个参数的节点
92
+ #### 2. Single Parameter Mode
213
93
 
214
- #### 模式 2: 单参数模式
94
+ Configure one parameter at a time with type validation:
215
95
 
216
- 逐个配置参数,适合不熟悉 JSON 的用户。
96
+ - **Parameter Name**: `steps`
97
+ - **Type**: `Number`
98
+ - **Value**: `25`
217
99
 
218
- **使用步骤**:
219
-
220
- 1. 在节点配置中找到 **"Node Parameters"** 部分
221
- 2. 点击 **"Add Node"** 添加一个节点配置
222
- 3. 选择 **Parameter Mode** 为 **Single Parameter**
223
- 4. 填写以下字段:
224
- - **Node ID**: 工作流中节点的 ID(例如:`13`)
225
- - **Parameter Name**: 参数名(例如:`width`)
226
- - **Type**: 数据类型(text/number/boolean/json)
227
- - **Value**: 参数值
228
-
229
- **示例**:
230
-
231
- 配置 EmptyLatentImage 节点(ID: 13)的 width 参数:
232
-
233
- - Node 1: ID=13, Mode=Single, Parameter Name=width, Type=number, Value=1024
234
-
235
- 配置多个参数:
236
-
237
- - Node 1: ID=13, Mode=Single, Parameter Name=width, Type=number, Value=1024
238
- - Node 2: ID=13, Mode=Single, Parameter Name=height, Type=number, Value=1024
239
- - Node 3: ID=13, Mode=Single, Parameter Name=batch_size, Type=number, Value=1
240
-
241
- **优点**:
242
- - ✅ 不需要了解 JSON 语法
243
- - ✅ 有类型验证,避免错误
244
- - ✅ 适合只需要配置少量参数的情况
245
-
246
- #### 两种模式的对比
247
-
248
- | 特性 | JSON 模式 | 单参数模式 |
249
- |------|-----------|-----------|
250
- | 配置方式 | JSON 格式,一次多个参数 | 逐个参数配置 |
251
- | 适用场景 | 节点有多个参数需要配置 | 只需要配置少量参数 |
252
- | 类型验证 | 无(JSON 格式) | 有(Type 字段) |
253
- | 推荐度 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ |
254
-
255
- **注意**:
256
- - 图像应该通过工作流连接(imagesToAny)或工作流 JSON 直接配置,不需要通过参数上传
257
- - 参数值会覆盖工作流 JSON 中的默认值
258
- - 两种模式可以混合使用
259
-
260
- ---
100
+ ### Binary File Upload
261
101
 
262
- ## AI Agent 集成
102
+ To upload input images to ComfyUI:
263
103
 
264
- ### 🎉 双模式支持
104
+ - **Type**: `Binary`
105
+ - **Binary Property**: `data` (default)
106
+ - The node will automatically upload the binary data and use the filename
265
107
 
266
- ComfyUI Workflow 节点现在支持两种使用方式:
108
+ ## 🤖 AI Agent Integration
267
109
 
268
- #### 模式 1: 作为普通节点使用
269
-
270
- 拖拽到任何工作流中,手动配置参数。
271
-
272
- #### 模式 2: 作为 AI Agent Tool 使用 🆕
273
-
274
- 在 AI Agent 的 tools 列表中会自动出现 ComfyUI Workflow!
275
-
276
- ### 在 AI Agent 中使用
277
-
278
- #### 步骤 1: 创建 AI Agent
279
-
280
- 1. 添加 **OpenAI Conversational Agent** 节点
281
- 2. 配置 Chat Model 和 Memory
282
-
283
- #### 步骤 2: 添加 ComfyUI Tool
284
-
285
- 1. 点击 AI Agent 节点
286
- 2. 在 **Tools** 部分点击 **+ Add Tool**
287
- 3. 搜索 **"ComfyUI"**
288
- 4. 选择 **ComfyUI Workflow** 节点
289
- 5. 配置节点参数(ComfyUI URL、Workflow JSON 等)
290
-
291
- #### 步骤 3: 开始对话
292
-
293
- **示例对话**:
294
- ```
295
- 用户: 生成一只可爱的猫咪
296
-
297
- AI: 好的,我来为您生成一张可爱猫咪的图片。
298
- [调用 ComfyUI Workflow tool]
299
- 完成!图片已生成。
300
- ```
301
-
302
- ### 技术实现
303
-
304
- 节点通过 `usableAsTool: true` 属性支持 AI Agent。这与 lark/feishu 节点的实现方式相同。
305
-
306
- ### 使用示例
307
-
308
- #### 基础用法
309
-
310
- **用户输入**:
311
- ```
312
- 生成一只在森林里的狐狸
313
- ```
314
-
315
- **AI Agent 行为**:
316
- 1. 识别用户想要生成图像
317
- 2. 调用 ComfyUI 工具
318
- 3. 使用默认参数生成图像(512x512, 20 steps)
319
- 4. 返回生成的图像 URL
320
-
321
- #### 高级用法(带参数)
322
-
323
- **用户输入**:
324
- ```
325
- 创建一个赛博朋克城市,size:1024x768, steps:30, cfg:10
326
- ```
327
-
328
- **支持的参数**:
329
- - `size:WIDTHxHEIGHT` - 图像尺寸(如:1024x768)
330
- - `steps:N` - 采样步数(如:30)
331
- - `cfg:N` - CFG 强度(如:7.5)
332
- - `seed:N` - 随机种子(如:12345)
333
- - `negative:TEXT` - 负向提示词(如:ugly, blurry)
334
-
335
- #### 负向提示词
336
-
337
- **用户输入**:
338
- ```
339
- 画一个美丽的日落,negative: 模糊, 低质量, 变形
340
- ```
341
-
342
- ### 文件位置
343
-
344
- - **完整代码**: `agent-tools/ComfyUI-Agent-Tool.js`
345
- - **详细文档**: `agent-tools/README.md`
346
- - **工作流示例**: `agent-tools/example-workflow.json`
347
-
348
- ### 定制工作流
349
-
350
- 要使用你自己的 ComfyUI 工作流:
351
-
352
- 1. 在 ComfyUI 中创建工作流
353
- 2. 导出为 **API Format**
354
- 3. 替换 `ComfyUI-Agent-Tool.js` 中的 `WORKFLOW_TEMPLATE`
355
- 4. 根据你的工作流调整 `updateWorkflow()` 函数
356
-
357
- **详细指南**: 请参考 `agent-tools/README.md`
358
-
359
- ---
360
-
361
- ## 支持的节点类型
362
-
363
- | 节点类型 | 说明 | 可配置参数 |
364
- |---------|------|-----------|
365
- | LoadImage | 图像加载 | image |
366
- | KSampler | 采样器 | seed, steps, cfg, sampler_name, scheduler, denoise |
367
- | CheckpointLoaderSimple | 模型加载 | ckpt_name |
368
- | LoraLoader | LoRA 加载 | lora_name, strength_model, strength_clip |
369
- | CLIPTextEncode | 文本编码 | text |
370
- | EmptyLatentImage | 潜像尺寸 | width, height, batch_size |
371
- | SaveImage | 保存图像 | filename_prefix |
372
-
373
- ---
374
-
375
- ## 常见使用场景
376
-
377
- ### 1. 文本生成图像
378
-
379
- **工作流**: 标准的 text-to-image
380
-
381
- **参数**:
382
- ```json
383
- {
384
- "6_text": "beautiful landscape, high quality",
385
- "7_text": "ugly, blurry",
386
- "3_steps": 25,
387
- "3_cfg": 7.5,
388
- "3_sampler_name": "euler"
389
- }
390
- ```
110
+ Use ComfyUI as a tool in AI Agent workflows:
391
111
 
392
- ### 2. 图像风格转换
112
+ 1. Add an **AI Agent** node (e.g., OpenAI Conversational Agent)
113
+ 2. In the **Tools** section, add **ComfyUI**
114
+ 3. Configure the ComfyUI node parameters
115
+ 4. Start chatting!
393
116
 
394
- **参数**:
395
- ```json
396
- {
397
- "6_text": "oil painting style, artistic",
398
- "10_image": "http://example.com/input.jpg",
399
- "3_denoise": 0.65
400
- }
117
+ **Example:**
401
118
  ```
119
+ User: Generate a cute cat picture
402
120
 
403
- ### 3. 使用固定种子
404
-
405
- **参数**:
406
- ```json
407
- {
408
- "6_text": "a cyberpunk city",
409
- "3_seed": 12345
410
- }
121
+ AI: I'll generate that for you using ComfyUI.
122
+ [Calls ComfyUI tool]
123
+ Done! Here's your cute cat picture.
411
124
  ```
412
125
 
413
- ---
126
+ For detailed AI Agent usage, see [AI-AGENT-USAGE.md](AI-AGENT-USAGE.md).
414
127
 
415
- ## 参数说明
128
+ ## 🎯 Common Use Cases
416
129
 
417
- ### 文本参数
130
+ ### 1. Text to Image
418
131
 
419
- ```json
420
- {
421
- "6_text": "beautiful landscape",
422
- "9_filename_prefix": "my_image"
423
- }
424
- ```
132
+ Generate images from text descriptions.
425
133
 
426
- ### 数字参数
134
+ ### 2. Image to Image
427
135
 
428
- ```json
429
- {
430
- "3_steps": 20,
431
- "3_cfg": 7.5,
432
- "5_width": 512,
433
- "5_height": 512
434
- }
435
- ```
136
+ Transform images with different styles.
436
137
 
437
- ### 选项参数
138
+ ### 3. Video Generation
438
139
 
439
- **sampler_name**: `euler`, `euler_ancestral`, `heun`, `dpm_2`, `dpm_2_ancestral`, `lms`, `ddim`, `uni_pc`
140
+ Create videos using ComfyUI's video generation workflows.
440
141
 
441
- **scheduler**: `normal`, `karras`, `exponential`, `sgm_uniform`, `simple`, `ddim_uniform`
142
+ ### 4. Batch Processing
442
143
 
443
- ### 图像参数
144
+ Process multiple images or generate multiple outputs.
444
145
 
445
- URL 方式:
446
- ```json
447
- {
448
- "10_image": "http://example.com/image.png"
449
- }
450
- ```
146
+ ## 📋 Output Format
451
147
 
452
- Base64 方式:
453
- ```json
454
- {
455
- "10_image": "data:image/png;base64,iVBORw0KG..."
456
- }
457
- ```
458
-
459
- ---
460
-
461
- ## 输出格式
462
-
463
- 成功执行后返回:
148
+ The node returns binary data in n8n format:
464
149
 
465
150
  ```json
466
151
  {
467
152
  "success": true,
468
- "images": [
469
- {
470
- "url": "http://127.0.0.1:8188/view?filename=ComfyUI_00001.png...",
471
- "type": "image"
472
- }
473
- ],
474
- "videos": [
475
- {
476
- "url": "http://127.0.0.1:8188/view?filename=video.mp4...",
477
- "type": "video"
478
- }
479
- ]
153
+ "imageCount": 1,
154
+ "videoCount": 0,
155
+ "data": {
156
+ "mimeType": "image/png",
157
+ "fileName": "ComfyUI_00001.png",
158
+ "data": "base64_encoded_image_data"
159
+ }
480
160
  }
481
161
  ```
482
162
 
483
- ---
484
-
485
- ## 开发
486
-
487
- ### 编译
163
+ **Binary Output:**
164
+ - First output: `data` (for preview)
165
+ - Additional outputs: `image_0`, `image_1`, etc.
166
+ - Videos: `video_0`, `video_1`, etc.
488
167
 
489
- ```bash
490
- npm run build
491
- ```
168
+ ## 🔧 Configuration
492
169
 
493
- ### 代码检查
170
+ ### Node Parameters
494
171
 
495
- ```bash
496
- npm run lint
497
- npm run lintfix
498
- ```
172
+ | Field | Description |
173
+ |-------|-------------|
174
+ | **ComfyUI URL** | URL of your ComfyUI server |
175
+ | **Action** | TextToAny or ImagesToAny |
176
+ | **Workflow JSON** | ComfyUI workflow in API format |
177
+ | **Timeout** | Maximum wait time in seconds (default: 300) |
178
+ | **Node Parameters** | Override workflow parameters |
499
179
 
500
- ### 监听模式
180
+ ### Parameter Modes
501
181
 
502
- ```bash
503
- npm run dev
504
- ```
182
+ | Mode | Best For | Input Type |
183
+ |------|----------|------------|
184
+ | **Multiple Parameters** | Bulk configuration | JSON object |
185
+ | **Single Parameter** | Individual parameters | Text/Number/Boolean/Binary |
505
186
 
506
- ### 测试
187
+ ## 🐛 Troubleshooting
507
188
 
508
- ```bash
509
- node test-load.js
510
- ```
189
+ ### Node not appearing in n8n
511
190
 
512
- ---
191
+ 1. Check installation: `ls ~/.n8n/nodes/node_modules/ | grep comfyui`
192
+ 2. Restart n8n service
193
+ 3. Clear browser cache (Ctrl+Shift+R)
513
194
 
514
- ## 故障排除
195
+ ### Connection to ComfyUI failed
515
196
 
516
- ### 节点未出现在 n8n
197
+ 1. Verify ComfyUI is running: `curl http://127.0.0.1:8188/system_stats`
198
+ 2. Check firewall settings
199
+ 3. Ensure correct URL configuration
517
200
 
518
- 1. 确认安装到正确的 custom 目录:
519
- ```bash
520
- ls -la /home/ZLQyiA/projets/n8n-service/.n8n/custom/node_modules/
521
- ```
522
- 应该看到:`n8n-nodes-comfyui-all -> ../../../n8n-comfyui-nodes`
201
+ ### Workflow validation failed
523
202
 
524
- 2. 重启 n8n 服务:
525
- ```bash
526
- cd /home/ZLQyiA/projets/n8n-service
527
- ./stop-n8n.sh
528
- ./start-n8n.sh
529
- ```
203
+ 1. Ensure using **Save (API Format)** export
204
+ 2. Validate JSON syntax
205
+ 3. Check node IDs match your workflow
530
206
 
531
- 3. 检查 package.json 包含正确配置
207
+ ### Private network access denied
532
208
 
533
- ### 连接 ComfyUI 失败
209
+ If you see "Cannot connect to private network addresses" error:
210
+ - This is n8n's SSRF protection
211
+ - For local ComfyUI: Use environment variable `N8N_ALLOW_NODES_SELF_REFERRAL=true`
212
+ - For remote ComfyUI: Ensure it's accessible from your n8n instance
534
213
 
535
- 1. 确保 ComfyUI 正在运行
536
- 2. 检查 URL 配置
537
- 3. 查看防火墙设置
214
+ ## 📚 Additional Documentation
538
215
 
539
- ### 工作流验证失败
216
+ - **[AI Agent Usage Guide](AI-AGENT-USAGE.md)** - Detailed AI Agent integration guide
217
+ - **[Development Guide](DEVELOPMENT.md)** - Contributing and development setup
218
+ - **[Deployment Guide](DEPLOYMENT.md)** - Custom deployment for development
540
219
 
541
- 1. 确保使用 "Save (API Format)" 导出
542
- 2. 验证 JSON 格式正确
543
- 3. 检查节点 ID 和参数名
220
+ ## 🎥 Video Tutorials
544
221
 
545
- ### n8n 检测到包缺失警告
222
+ Video tutorials coming soon!
223
+ 📺 [YouTube Playlist](https://youtube.com/playlist?list=PLxxxxx) (Coming Soon)
224
+ 📺 [Bilibili Playlist](https://space.bilibili.com/xxxxx) (即将推出)
546
225
 
547
- 如果看到 `n8n detected that some packages are missing` 警告,这是正常的:
548
- - n8n 尝试从 npm registry 获取社区节点信息但超时
549
- - 不影响本地自定义节点的使用
550
- - 如果节点能正常工作,可以忽略此警告
226
+ ## 💡 Tips
551
227
 
552
- ---
228
+ - **First time**: Start with a simple text-to-image workflow
229
+ - **Parameter overrides**: Use Node Parameters instead of modifying workflow JSON
230
+ - **Seed control**: Fixed seeds produce reproducible results
231
+ - **Optimization**: 20-30 sampling steps are usually sufficient
232
+ - **Binary data**: Use Binary type to upload input images
553
233
 
554
- ## 项目结构
234
+ ## 🛠️ Technical Stack
555
235
 
556
- ```
557
- n8n-nodes-comfyui-all/
558
- ├── nodes/
559
- │ ├── ComfyUi/
560
- │ │ ├── ComfyUi.node.ts # 主节点实现
561
- │ │ └── comfyui.svg # 节点图标
562
- │ ├── ComfyUiClient.ts # API 客户端
563
- │ ├── workflow-parser.ts # 工作流解析器
564
- │ ├── validation.ts # 验证工具
565
- │ ├── types.ts # 类型定义
566
- │ └── constants.ts # 配置常量
567
- ├── agent-tools/ # AI Agent 工具
568
- │ ├── ComfyUI-Agent-Tool.js # Custom Code Tool 代码
569
- │ ├── README.md # AI Agent 工具文档
570
- │ └── example-workflow.json # 工作流示例
571
- ├── dist/ # 编译输出
572
- ├── index.ts # 入口文件
573
- ├── package.json # 包配置
574
- ├── tsconfig.json # TypeScript 配置
575
- └── README.md # 本文件
576
- ```
236
+ - TypeScript (strict mode)
237
+ - n8n-workflow SDK
238
+ - ComfyUI API integration
577
239
 
578
- ---
240
+ ## 📄 License
579
241
 
580
- ## 工作流示例
242
+ MIT License - see [LICENSE](LICENSE) for details
581
243
 
582
- ### 示例 1: 简单的文本生成图像
244
+ ## 🤝 Contributing
583
245
 
584
- **工作流 JSON**:
585
-
586
- ```json
587
- {
588
- "3": {
589
- "inputs": {
590
- "seed": 123456789,
591
- "steps": 20,
592
- "cfg": 8,
593
- "sampler_name": "euler",
594
- "scheduler": "normal",
595
- "denoise": 1,
596
- "model": ["4", 0],
597
- "positive": ["6", 0],
598
- "negative": ["7", 0],
599
- "latent_image": ["5", 0]
600
- },
601
- "class_type": "KSampler"
602
- },
603
- "4": {
604
- "inputs": {
605
- "ckpt_name": "v1-5-pruned-emaonly.ckpt"
606
- },
607
- "class_type": "CheckpointLoaderSimple"
608
- },
609
- "5": {
610
- "inputs": {
611
- "width": 512,
612
- "height": 512,
613
- "batch_size": 1
614
- },
615
- "class_type": "EmptyLatentImage"
616
- },
617
- "6": {
618
- "inputs": {
619
- "text": "beautiful landscape, high quality",
620
- "clip": ["4", 1]
621
- },
622
- "class_type": "CLIPTextEncode"
623
- },
624
- "7": {
625
- "inputs": {
626
- "text": "ugly, blurry, low quality",
627
- "clip": ["4", 1]
628
- },
629
- "class_type": "CLIPTextEncode"
630
- },
631
- "8": {
632
- "inputs": {
633
- "samples": ["3", 0],
634
- "vae": ["4", 2]
635
- },
636
- "class_type": "VAEDecode"
637
- },
638
- "9": {
639
- "inputs": {
640
- "filename_prefix": "ComfyUI",
641
- "images": ["8", 0]
642
- },
643
- "class_type": "SaveImage"
644
- }
645
- }
646
- ```
647
-
648
- **n8n 输入参数**:
649
-
650
- ```json
651
- {
652
- "6_text": "a serene mountain landscape at sunset",
653
- "7_text": "ugly, blurry, low quality, distorted",
654
- "3_steps": 25,
655
- "3_cfg": 7.5
656
- }
657
- ```
658
-
659
- ---
660
-
661
- ### 示例 2: 图像风格转换
662
-
663
- **工作流 JSON**:
664
-
665
- ```json
666
- {
667
- "3": {
668
- "inputs": {
669
- "seed": 0,
670
- "steps": 20,
671
- "cfg": 8,
672
- "sampler_name": "euler",
673
- "scheduler": "normal",
674
- "denoise": 0.75,
675
- "model": ["4", 0],
676
- "positive": ["6", 0],
677
- "negative": ["7", 0],
678
- "latent_image": ["5", 0]
679
- },
680
- "class_type": "KSampler"
681
- },
682
- "4": {
683
- "inputs": {
684
- "ckpt_name": "v1-5-pruned-emaonly.ckpt"
685
- },
686
- "class_type": "CheckpointLoaderSimple"
687
- },
688
- "5": {
689
- "inputs": {
690
- "pixels": ["10", 0],
691
- "vae": ["4", 2]
692
- },
693
- "class_type": "VAEEncode"
694
- },
695
- "6": {
696
- "inputs": {
697
- "text": "oil painting style",
698
- "clip": ["4", 1]
699
- },
700
- "class_type": "CLIPTextEncode"
701
- },
702
- "7": {
703
- "inputs": {
704
- "text": "ugly, blurry",
705
- "clip": ["4", 1]
706
- },
707
- "class_type": "CLIPTextEncode"
708
- },
709
- "8": {
710
- "inputs": {
711
- "samples": ["3", 0],
712
- "vae": ["4", 2]
713
- },
714
- "class_type": "VAEDecode"
715
- },
716
- "9": {
717
- "inputs": {
718
- "filename_prefix": "ComfyUI",
719
- "images": ["8", 0]
720
- },
721
- "class_type": "SaveImage"
722
- },
723
- "10": {
724
- "inputs": {
725
- "image": "example.png",
726
- "choose file to upload": "image"
727
- },
728
- "class_type": "LoadImage"
729
- }
730
- }
731
- ```
732
-
733
- **n8n 输入参数**:
734
-
735
- ```json
736
- {
737
- "6_text": "watercolor painting style, artistic",
738
- "7_text": "",
739
- "10_image": "http://example.com/input.jpg",
740
- "3_denoise": 0.6
741
- }
742
- ```
743
-
744
- ---
745
-
746
- ### 示例 3: 使用固定种子
747
-
748
- **工作流**: 使用示例 1 的工作流
749
-
750
- **参数**:
751
- ```json
752
- {
753
- "6_text": "a cyberpunk city",
754
- "3_seed": 12345
755
- }
756
- ```
757
-
758
- ---
759
-
760
- ## 参数说明
761
-
762
- ### 节点说明
763
-
764
- | 节点 ID | 类型 | 功能 | 可配置参数 |
765
- |---------|------|------|-----------|
766
- | 3 | KSampler | 采样器,控制生成参数 | seed, steps, cfg, sampler_name, scheduler, denoise |
767
- | 4 | CheckpointLoaderSimple | 加载模型 | ckpt_name |
768
- | 5 | EmptyLatentImage / VAEEncode | 创建空潜像或编码图像 | width, height, batch_size / pixels |
769
- | 6 | CLIPTextEncode | 正向提示词编码 | text |
770
- | 7 | CLIPTextEncode | 负向提示词编码 | text |
771
- | 8 | VAEDecode | 解码潜像为图像 | - |
772
- | 9 | SaveImage | 保存生成的图像 | filename_prefix |
773
- | 10 | LoadImage | 加载输入图像 | image |
774
-
775
- ### 常用参数详解
776
-
777
- **KSampler (节点 3)**:
778
- - `seed`: 随机种子(留空自动生成,固定可复现结果)
779
- - `steps`: 采样步数 (20-50,通常 20-30 步足够)
780
- - `cfg`: CFG 强度 (6-15,常用 7-8)
781
- - `sampler_name`: 采样器类型(euler, euler_ancestral, ddim 等)
782
- - `scheduler`: 调度器类型(normal, karras, exponential 等)
783
- - `denoise`: 去噪强度 (0-1)
784
- - 文生图: 1.0
785
- - 图生图: 0.5-0.75
786
- - 图像编辑: 0.3-0.5
787
-
788
- **CLIPTextEncode (节点 6/7)**:
789
- - `text`: 提示词文本
790
-
791
- **EmptyLatentImage (节点 5)**:
792
- - `width`: 图像宽度 (512, 768, 1024)
793
- - `height`: 图像高度 (512, 768, 1024)
794
- - `batch_size`: 批次大小 (1-4)
795
-
796
- **LoadImage (节点 10)**:
797
- - `image`: 图像 URL 或 base64 数据
798
-
799
- ### 使用提示
800
-
801
- - **首次使用**:建议使用示例 1(文本生成图像)开始
802
- - **种子控制**:固定 seed 可以复现结果
803
- - **步数优化**:20-30 步通常足够,更多步数不一定更好
804
- - **CFG 值**:7-8 是常用范围,太高可能导致过饱和
805
- - **去噪强度**:根据使用场景调整(见上方 KSampler 参数说明)
806
-
807
- ---
808
-
809
- ## 更多示例
810
-
811
- ---
812
-
813
- ## 技术栈
814
-
815
- - TypeScript (严格模式)
816
- - n8n-workflow
817
- - axios
818
- - ComfyUI API
246
+ Contributions are welcome! Please see [DEVELOPMENT.md](DEVELOPMENT.md) for guidelines.
819
247
 
820
248
  ---
821
249
 
822
- ## 许可证
823
-
824
- MIT
825
-
826
- ---
250
+ **Author**: wwrs
251
+ **Repository**: [n8n-nodes-comfyui-all](https://github.com/wwrs/n8n-nodes-comfyui)
827
252
 
828
- ## 更新日志
829
-
830
- ### v2.4 (2026-01-07)
831
-
832
- - ✨ **优雅的模式切换**:添加 Parameter Mode 选择器,动态显示相关字段
833
- - ✨ **改进用户体验**:JSON 模式和单参数模式清晰分离,不再混淆
834
- - ✨ **动态显示**:根据选择的模式自动显示/隐藏字段
835
- - 📝 更新文档,详细说明模式切换的使用方法
836
- - 🔧 优化代码结构,提升可维护性
837
-
838
- ### v2.3 (2026-01-07)
839
-
840
- - ✨ **Node Parameters 双模式支持**:支持 JSON 模式和单参数模式
841
- - ✨ **灵活配置**:JSON 模式适合配置多个参数,单参数模式适合逐个配置
842
- - ✨ **动态显示**:根据选择的模式动态显示相关字段
843
- - 📝 更新文档,详细说明两种模式的使用方法和对比
844
- - 🔧 优化代码结构,提升用户体验
845
-
846
- ### v2.2 (2026-01-07)
847
-
848
- - ✨ **简化参数配置**:移除冗余的 Parameters 功能,只保留 Node Parameters
849
- - ✨ **优化用户体验**:统一使用 JSON 格式配置节点参数,更加简洁
850
- - ✨ **图像输入验证**:imagesToAny action 自动验证图像输入,避免配置错误
851
- - 📝 更新文档,简化参数配置说明
852
- - 🔧 优化代码结构,移除不必要的类型定义和逻辑
853
- - ✅ 完善测试覆盖
854
-
855
- ### v2.1 (2026-01-07)
856
-
857
- - ✨ **节点级别参数配置**:新增 Node Parameters 功能,支持一次性为节点配置多个参数
858
- - ✨ **改进参数配置体验**:提供两种参数配置方式,满足不同使用场景
859
- - ✨ **图像输入验证**:imagesToAny action 自动验证图像输入,避免配置错误
860
- - 📝 更新文档,详细说明两种参数配置方式的使用方法和对比
861
- - 🔧 优化代码结构,提升可维护性
862
- - ✅ 完善测试覆盖
863
-
864
- ### v2.0 (2026-01-06)
865
-
866
- - ✨ 完全重构,支持动态工作流
867
- - ✨ 自动参数识别和配置
868
- - ✨ 统一节点设计
869
- - 🆕 **AI Agent 集成**:通过 Custom Code Tool 在 AI Agent 中生成图像
870
- - 🆕 添加自然语言参数解析(支持 size, steps, cfg, seed, negative 等)
871
- - 🆕 提供完整的 AI Agent 工具模板和文档
872
- - 📚 新增 `agent-tools/` 目录,包含 Custom Code Tool 代码和示例
873
- - 🐛 修复视频输出 bug
874
- - 🔒 增强 SSRF 防护
875
- - 📝 改进错误处理和资源管理
876
- - 🔧 修复自定义节点安装问题(使用正确的 custom 目录)
877
- - 🔧 修复重复节点安装问题
878
-
879
- ### v1.0 (2026-01-05)
880
-
881
- - 初始版本
882
- - 支持多种预定义操作类型
253
+ **Support**: For issues and questions, please use [GitHub Issues](https://github.com/wwrs/n8n-nodes-comfyui/issues)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-comfyui-all",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "n8n community nodes for ComfyUI workflow execution with dynamic parameter support",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",