dsh-comfyui 0.5.3 → 0.5.5

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.
@@ -1,36 +0,0 @@
1
- /**
2
- * Built-in ComfyUI workflow templates in API format (node id → class_type +
3
- * inputs). `txt2img` and `img2img` use only core ComfyUI nodes; `video` is a
4
- * Wan 2.1 text-to-video skeleton that requires the ComfyUI-WanVideoWrapper
5
- * custom nodes and matching model files. The `guide` field is shown to the
6
- * model so it can override the right node inputs.
7
- */
8
- export interface WorkflowTemplate {
9
- id: string;
10
- name: string;
11
- description: string;
12
- guide: string;
13
- workflow: Record<string, {
14
- class_type: string;
15
- inputs: Record<string, unknown>;
16
- }>;
17
- }
18
- export declare const TEMPLATES: WorkflowTemplate[];
19
- /** Look up a template by id. */
20
- export declare function findTemplate(id: string): WorkflowTemplate | undefined;
21
- /**
22
- * Merge per-node input overrides into a workflow copy. Each entry maps a node
23
- * id to a partial inputs object; later entries observe earlier merges.
24
- */
25
- export declare function applyTemplateInputs(workflow: Record<string, {
26
- class_type: string;
27
- inputs: Record<string, unknown>;
28
- }>, overrides: Record<string, Record<string, unknown>>): void;
29
- /** Clone a template workflow so callers never mutate the shared constant. */
30
- export declare function cloneWorkflow(workflow: Record<string, {
31
- class_type: string;
32
- inputs: Record<string, unknown>;
33
- }>): Record<string, {
34
- class_type: string;
35
- inputs: Record<string, unknown>;
36
- }>;
package/lib/templates.js DELETED
@@ -1,84 +0,0 @@
1
- /**
2
- * Built-in ComfyUI workflow templates in API format (node id → class_type +
3
- * inputs). `txt2img` and `img2img` use only core ComfyUI nodes; `video` is a
4
- * Wan 2.1 text-to-video skeleton that requires the ComfyUI-WanVideoWrapper
5
- * custom nodes and matching model files. The `guide` field is shown to the
6
- * model so it can override the right node inputs.
7
- */
8
- export const TEMPLATES = [
9
- {
10
- id: 'txt2img',
11
- name: 'SDXL text-to-image',
12
- description: 'Generate an image from a text prompt using a standard SDXL checkpoint.',
13
- guide: 'Node ids: 4 checkpoint (ckpt_name), 5 EmptyLatentImage (width/height/batch_size), 6 positive CLIPTextEncode (text), 7 negative CLIPTextEncode (text), 3 KSampler (seed/steps/cfg/denoise), 9 SaveImage (filename_prefix). Override 6.text with the prompt and 7.text with negative prompt; set a random 3.seed for variety.',
14
- workflow: {
15
- '3': {
16
- class_type: 'KSampler',
17
- inputs: { seed: 0, steps: 20, cfg: 8, sampler_name: 'euler', scheduler: 'normal', denoise: 1, model: ['4', 0], positive: ['6', 0], negative: ['7', 0], latent_image: ['5', 0] },
18
- },
19
- '4': { class_type: 'CheckpointLoaderSimple', inputs: { ckpt_name: 'sd_xl_base_1.0.safetensors' } },
20
- '5': { class_type: 'EmptyLatentImage', inputs: { width: 1024, height: 1024, batch_size: 1 } },
21
- '6': { class_type: 'CLIPTextEncode', inputs: { text: '', clip: ['4', 1] } },
22
- '7': { class_type: 'CLIPTextEncode', inputs: { text: '', clip: ['4', 1] } },
23
- '8': { class_type: 'VAEDecode', inputs: { samples: ['3', 0], vae: ['4', 2] } },
24
- '9': { class_type: 'SaveImage', inputs: { filename_prefix: 'dsh-comfyui', images: ['8', 0] } },
25
- },
26
- },
27
- {
28
- id: 'img2img',
29
- name: 'SDXL image-to-image',
30
- description: 'Edit or restyle an input image with a text prompt and denoise strength.',
31
- guide: 'Node ids: 4 checkpoint, 10 LoadImage (image), 11 VAEEncode, 6 positive text, 7 negative text, 3 KSampler (denoise controls how much the input changes, 0..1; seed/steps/cfg), 9 SaveImage. Put the input image filename in 10.image, the prompt in 6.text.',
32
- workflow: {
33
- '3': {
34
- class_type: 'KSampler',
35
- inputs: { seed: 0, steps: 20, cfg: 7, sampler_name: 'euler', scheduler: 'normal', denoise: 0.6, model: ['4', 0], positive: ['6', 0], negative: ['7', 0], latent_image: ['11', 0] },
36
- },
37
- '4': { class_type: 'CheckpointLoaderSimple', inputs: { ckpt_name: 'sd_xl_base_1.0.safetensors' } },
38
- '6': { class_type: 'CLIPTextEncode', inputs: { text: '', clip: ['4', 1] } },
39
- '7': { class_type: 'CLIPTextEncode', inputs: { text: '', clip: ['4', 1] } },
40
- '8': { class_type: 'VAEDecode', inputs: { samples: ['3', 0], vae: ['4', 2] } },
41
- '9': { class_type: 'SaveImage', inputs: { filename_prefix: 'dsh-comfyui', images: ['8', 0] } },
42
- '10': { class_type: 'LoadImage', inputs: { image: 'example.png' } },
43
- '11': { class_type: 'VAEEncode', inputs: { pixels: ['10', 0], vae: ['4', 2] } },
44
- },
45
- },
46
- {
47
- id: 'video',
48
- name: 'Wan 2.1 text-to-video',
49
- description: 'Generate a short video from a text prompt (requires ComfyUI-WanVideoWrapper custom nodes and Wan 2.1 models).',
50
- guide: 'Node ids: 10 UNETLoader (unet_name), 11 CLIPLoader, 12 VAELoader, 13 WanTextEncode (prompt/negative_prompt), 14 WanImageToVideo (width/height/length frames/batch_size), 15 KSampler (seed/steps/cfg), 17 SaveVideo (filename_prefix). Requires the ComfyUI-WanVideoWrapper custom nodes and downloaded Wan 2.1 checkpoints; verify node names with comfyui_object_info if your install differs.',
51
- workflow: {
52
- '10': { class_type: 'UNETLoader', inputs: { unet_name: 'wan2.1_t2v_14B_fp8_e4m3fn.safetensors', weight_dtype: 'fp8_e4m3fn' } },
53
- '11': { class_type: 'CLIPLoader', inputs: { clip_name: 'wan2.1_t2v_14B_clip.safetensors', type: 'wan' } },
54
- '12': { class_type: 'VAELoader', inputs: { vae_name: 'wan_2.1_vae.safetensors' } },
55
- '13': { class_type: 'WanTextEncode', inputs: { prompt: '', negative_prompt: '', clip: ['11', 0] } },
56
- '14': { class_type: 'WanImageToVideo', inputs: { positive: ['13', 0], negative: ['13', 1], vae: ['12', 0], width: 832, height: 480, length: 81, batch_size: 1 } },
57
- '15': { class_type: 'KSampler', inputs: { seed: 0, steps: 20, cfg: 6, sampler_name: 'euler', scheduler: 'simple', denoise: 1, model: ['10', 0], positive: ['13', 0], negative: ['13', 1], latent_image: ['14', 0] } },
58
- '16': { class_type: 'WanVideoDecode', inputs: { samples: ['15', 0], vae: ['12', 0] } },
59
- '17': { class_type: 'SaveVideo', inputs: { filename_prefix: 'dsh-comfyui', video: ['16', 0] } },
60
- },
61
- },
62
- ];
63
- /** Look up a template by id. */
64
- export function findTemplate(id) {
65
- return TEMPLATES.find((template) => template.id === id);
66
- }
67
- /**
68
- * Merge per-node input overrides into a workflow copy. Each entry maps a node
69
- * id to a partial inputs object; later entries observe earlier merges.
70
- */
71
- export function applyTemplateInputs(workflow, overrides) {
72
- for (const [nodeId, partial] of Object.entries(overrides)) {
73
- const node = workflow[nodeId];
74
- if (node === undefined)
75
- continue;
76
- if (typeof partial !== 'object' || partial === null)
77
- continue;
78
- node.inputs = { ...node.inputs, ...partial };
79
- }
80
- }
81
- /** Clone a template workflow so callers never mutate the shared constant. */
82
- export function cloneWorkflow(workflow) {
83
- return JSON.parse(JSON.stringify(workflow));
84
- }