n8n-nodes-comfyui-all 2.4.1 → 2.4.2
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/dist/nodes/ComfyUiTool/ComfyUiTool.node.d.ts +59 -34
- package/dist/nodes/ComfyUiTool/ComfyUiTool.node.d.ts.map +1 -1
- package/dist/nodes/ComfyUiTool/ComfyUiTool.node.js +122 -146
- package/dist/nodes/ComfyUiTool/ComfyUiTool.node.js.map +1 -1
- package/dist/nodes/agentToolHelpers.d.ts +32 -51
- package/dist/nodes/agentToolHelpers.d.ts.map +1 -1
- package/dist/nodes/agentToolHelpers.js +57 -183
- package/dist/nodes/agentToolHelpers.js.map +1 -1
- package/dist/nodes/types.d.ts +0 -38
- package/dist/nodes/types.d.ts.map +1 -1
- package/dist/nodes/workflowConfig.d.ts +27 -13
- package/dist/nodes/workflowConfig.d.ts.map +1 -1
- package/dist/nodes/workflowConfig.js +57 -148
- package/dist/nodes/workflowConfig.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,163 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Workflow Configuration Utilities
|
|
4
|
+
*
|
|
5
|
+
* This module provides utilities for handling ComfyUI workflows.
|
|
6
|
+
* All workflows must be provided by the user - there are no built-in templates.
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
9
|
+
exports.parseWorkflow = parseWorkflow;
|
|
10
|
+
exports.findNodesByClassType = findNodesByClassType;
|
|
11
|
+
exports.getAllNodeIds = getAllNodeIds;
|
|
12
|
+
exports.getWorkflowClassTypes = getWorkflowClassTypes;
|
|
5
13
|
const validation_1 = require("./validation");
|
|
6
14
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
15
|
+
* Validate and parse user-provided workflow JSON
|
|
16
|
+
* @param workflowJson - Workflow JSON string or object
|
|
17
|
+
* @returns Parsed workflow object
|
|
18
|
+
* @throws Error if workflow is invalid
|
|
9
19
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"sampler_name": "euler",
|
|
17
|
-
"scheduler": "normal",
|
|
18
|
-
"denoise": 1,
|
|
19
|
-
"model": ["4", 0],
|
|
20
|
-
"positive": ["6", 0],
|
|
21
|
-
"negative": ["7", 0],
|
|
22
|
-
"latent_image": ["5", 0]
|
|
23
|
-
},
|
|
24
|
-
"class_type": "KSampler"
|
|
25
|
-
},
|
|
26
|
-
"4": {
|
|
27
|
-
"inputs": {
|
|
28
|
-
"ckpt_name": "v1-5-pruned-emaonly.ckpt"
|
|
29
|
-
},
|
|
30
|
-
"class_type": "CheckpointLoaderSimple"
|
|
31
|
-
},
|
|
32
|
-
"5": {
|
|
33
|
-
"inputs": {
|
|
34
|
-
"width": 512,
|
|
35
|
-
"height": 512,
|
|
36
|
-
"batch_size": 1
|
|
37
|
-
},
|
|
38
|
-
"class_type": "EmptyLatentImage"
|
|
39
|
-
},
|
|
40
|
-
"6": {
|
|
41
|
-
"inputs": {
|
|
42
|
-
"text": "",
|
|
43
|
-
"clip": ["4", 1]
|
|
44
|
-
},
|
|
45
|
-
"class_type": "CLIPTextEncode"
|
|
46
|
-
},
|
|
47
|
-
"7": {
|
|
48
|
-
"inputs": {
|
|
49
|
-
"text": "ugly, blurry, low quality",
|
|
50
|
-
"clip": ["4", 1]
|
|
51
|
-
},
|
|
52
|
-
"class_type": "CLIPTextEncode"
|
|
53
|
-
},
|
|
54
|
-
"8": {
|
|
55
|
-
"inputs": {
|
|
56
|
-
"samples": ["3", 0],
|
|
57
|
-
"vae": ["4", 2]
|
|
58
|
-
},
|
|
59
|
-
"class_type": "VAEDecode"
|
|
60
|
-
},
|
|
61
|
-
"9": {
|
|
62
|
-
"inputs": {
|
|
63
|
-
"filename_prefix": "ComfyUI",
|
|
64
|
-
"images": ["8", 0]
|
|
65
|
-
},
|
|
66
|
-
"class_type": "SaveImage"
|
|
20
|
+
function parseWorkflow(workflowJson) {
|
|
21
|
+
if (typeof workflowJson === 'string') {
|
|
22
|
+
if (!workflowJson.trim()) {
|
|
23
|
+
throw new Error('Workflow JSON is empty. Please provide a valid ComfyUI workflow.');
|
|
24
|
+
}
|
|
25
|
+
return (0, validation_1.safeJsonParse)(workflowJson, 'Workflow JSON');
|
|
67
26
|
}
|
|
68
|
-
|
|
27
|
+
if (typeof workflowJson === 'object' && workflowJson !== null) {
|
|
28
|
+
if (Object.keys(workflowJson).length === 0) {
|
|
29
|
+
throw new Error('Workflow object is empty. Please provide a valid ComfyUI workflow.');
|
|
30
|
+
}
|
|
31
|
+
return workflowJson;
|
|
32
|
+
}
|
|
33
|
+
throw new Error('Invalid workflow format. Expected JSON string or object.');
|
|
34
|
+
}
|
|
69
35
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
36
|
+
* Check if a workflow has a specific node type
|
|
37
|
+
* @param workflow - ComfyUI workflow object
|
|
38
|
+
* @param classType - Node class type to search for
|
|
39
|
+
* @returns Array of node IDs that match the class type
|
|
72
40
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"sampler_name": "euler",
|
|
80
|
-
"scheduler": "normal",
|
|
81
|
-
"denoise": 0.75,
|
|
82
|
-
"model": ["4", 0],
|
|
83
|
-
"positive": ["6", 0],
|
|
84
|
-
"negative": ["7", 0],
|
|
85
|
-
"latent_image": ["10", 0]
|
|
86
|
-
},
|
|
87
|
-
"class_type": "KSampler"
|
|
88
|
-
},
|
|
89
|
-
"4": {
|
|
90
|
-
"inputs": {
|
|
91
|
-
"ckpt_name": "v1-5-pruned-emaonly.ckpt"
|
|
92
|
-
},
|
|
93
|
-
"class_type": "CheckpointLoaderSimple"
|
|
94
|
-
},
|
|
95
|
-
"5": {
|
|
96
|
-
"inputs": {
|
|
97
|
-
"image": "input_image.png",
|
|
98
|
-
"upload": "image"
|
|
99
|
-
},
|
|
100
|
-
"class_type": "LoadImage"
|
|
101
|
-
},
|
|
102
|
-
"6": {
|
|
103
|
-
"inputs": {
|
|
104
|
-
"text": "",
|
|
105
|
-
"clip": ["4", 1]
|
|
106
|
-
},
|
|
107
|
-
"class_type": "CLIPTextEncode"
|
|
108
|
-
},
|
|
109
|
-
"7": {
|
|
110
|
-
"inputs": {
|
|
111
|
-
"text": "ugly, blurry, low quality",
|
|
112
|
-
"clip": ["4", 1]
|
|
113
|
-
},
|
|
114
|
-
"class_type": "CLIPTextEncode"
|
|
115
|
-
},
|
|
116
|
-
"10": {
|
|
117
|
-
"inputs": {
|
|
118
|
-
"pixels": ["5", 0],
|
|
119
|
-
"vae": ["4", 2]
|
|
120
|
-
},
|
|
121
|
-
"class_type": "VAEEncode"
|
|
122
|
-
},
|
|
123
|
-
"8": {
|
|
124
|
-
"inputs": {
|
|
125
|
-
"samples": ["3", 0],
|
|
126
|
-
"vae": ["4", 2]
|
|
127
|
-
},
|
|
128
|
-
"class_type": "VAEDecode"
|
|
129
|
-
},
|
|
130
|
-
"9": {
|
|
131
|
-
"inputs": {
|
|
132
|
-
"filename_prefix": "ComfyUI",
|
|
133
|
-
"images": ["8", 0]
|
|
134
|
-
},
|
|
135
|
-
"class_type": "SaveImage"
|
|
41
|
+
function findNodesByClassType(workflow, classType) {
|
|
42
|
+
const matchingNodes = [];
|
|
43
|
+
for (const nodeId in workflow) {
|
|
44
|
+
if (workflow[nodeId] && workflow[nodeId].class_type === classType) {
|
|
45
|
+
matchingNodes.push(nodeId);
|
|
46
|
+
}
|
|
136
47
|
}
|
|
137
|
-
|
|
48
|
+
return matchingNodes;
|
|
49
|
+
}
|
|
138
50
|
/**
|
|
139
|
-
* Get
|
|
140
|
-
* @param
|
|
141
|
-
* @returns
|
|
51
|
+
* Get all node IDs from a workflow
|
|
52
|
+
* @param workflow - ComfyUI workflow object
|
|
53
|
+
* @returns Array of node IDs
|
|
142
54
|
*/
|
|
143
|
-
function
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
55
|
+
function getAllNodeIds(workflow) {
|
|
56
|
+
return Object.keys(workflow);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get all class types used in a workflow
|
|
60
|
+
* @param workflow - ComfyUI workflow object
|
|
61
|
+
* @returns Array of unique class types
|
|
62
|
+
*/
|
|
63
|
+
function getWorkflowClassTypes(workflow) {
|
|
64
|
+
const classTypes = new Set();
|
|
65
|
+
for (const nodeId in workflow) {
|
|
66
|
+
if (workflow[nodeId] && workflow[nodeId].class_type) {
|
|
67
|
+
classTypes.add(workflow[nodeId].class_type);
|
|
151
68
|
}
|
|
152
69
|
}
|
|
153
|
-
|
|
154
|
-
if (config?.template && typeof config.template === 'object' && Object.keys(config.template).length > 0) {
|
|
155
|
-
return config.template;
|
|
156
|
-
}
|
|
157
|
-
// Return template based on mode
|
|
158
|
-
if (config?.mode === 'image-to-image') {
|
|
159
|
-
return exports.IMAGE_TO_IMAGE_WORKFLOW_TEMPLATE;
|
|
160
|
-
}
|
|
161
|
-
return exports.DEFAULT_WORKFLOW_TEMPLATE;
|
|
70
|
+
return Array.from(classTypes);
|
|
162
71
|
}
|
|
163
72
|
//# sourceMappingURL=workflowConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflowConfig.js","sourceRoot":"","sources":["../../nodes/workflowConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflowConfig.js","sourceRoot":"","sources":["../../nodes/workflowConfig.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAWH,sCAgBC;AAQD,oDAUC;AAOD,sCAEC;AAOD,sDAUC;AApED,6CAA6C;AAE7C;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,YAA+B;IAC3D,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC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