@@ -18,6 +18,7 @@ import {
18
18
19
19
import { getWorkflowInputValues } from '../getWorkflowInputValues'
20
20
import { decodeOutput } from '@/lib/utils/decodeOutput'
21
+ import { ComfyUIWorkflowApiUtils } from './utils'
21
22
22
23
export async function resolveSegment (
23
24
request : ResolveRequest
@@ -54,50 +55,21 @@ export async function resolveSegment(
54
55
request . settings . imageGenerationWorkflow . data
55
56
)
56
57
57
- const txt2ImgPrompt = new PromptBuilder (
58
- comfyApiWorkflow ,
59
- // TODO: this list should be detect/filled automatically (see line 86)
60
- [
61
- 'positive' ,
62
- 'negative' ,
63
- 'checkpoint' ,
64
- 'seed' ,
65
- 'batch' ,
66
- 'step' ,
67
- 'cfg' ,
68
- 'sampler' ,
69
- 'sheduler' ,
70
- 'width' ,
71
- 'height' ,
72
- ] ,
73
- // TODO: this list should be detect/filled automatically (see line 86)
74
- [ 'images' ]
75
- )
76
- // TODO: those input sets should be detect/filled automatically (see line 86)
77
- . setInputNode ( 'checkpoint' , '4.inputs.ckpt_name' )
78
- . setInputNode ( 'seed' , '3.inputs.seed' )
79
- . setInputNode ( 'batch' , '5.inputs.batch_size' )
80
- . setInputNode ( 'negative' , '7.inputs.text' )
81
- . setInputNode ( 'positive' , '6.inputs.text' )
82
- . setInputNode ( 'cfg' , '3.inputs.cfg' )
83
- . setInputNode ( 'sampler' , '3.inputs.sampler_name' )
84
- . setInputNode ( 'sheduler' , '3.inputs.scheduler' )
85
- . setInputNode ( 'step' , '3.inputs.steps' )
86
- . setInputNode ( 'width' , '5.inputs.width' )
87
- . setInputNode ( 'height' , '5.inputs.height' )
88
- . setOutputNode ( 'images' , '9' )
58
+ const txt2ImgPrompt = new ComfyUIWorkflowApiUtils (
59
+ comfyApiWorkflow
60
+ ) . createPromptBuilder ( )
89
61
90
62
const workflow = txt2ImgPrompt
91
63
// TODO: this mapping should be detect/filled automatically (see line 86)
92
- . input ( 'checkpoint ' , 'SDXL/realvisxlV40_v40LightningBakedvae.safetensors' )
64
+ . input ( 'ckpt_name ' , 'SDXL/realvisxlV40_v40LightningBakedvae.safetensors' )
93
65
. input ( 'seed' , generateSeed ( ) )
94
- . input ( 'step ' , 6 )
66
+ . input ( 'steps ' , 6 )
95
67
. input ( 'cfg' , 1 )
96
- . input < TSamplerName > ( 'sampler ' , 'dpmpp_2m_sde_gpu' )
97
- . input < TSchedulerName > ( 'sheduler ' , 'sgm_uniform' )
68
+ . input < TSamplerName > ( 'sampler_name ' , 'dpmpp_2m_sde_gpu' )
69
+ . input < TSchedulerName > ( 'scheduler ' , 'sgm_uniform' )
98
70
. input ( 'width' , request . meta . width )
99
71
. input ( 'height' , request . meta . height )
100
- . input ( 'batch ' , 1 )
72
+ . input ( 'batch_size ' , 1 )
101
73
. input ( 'positive' , request . prompts . image . positive )
102
74
103
75
// for the moment we only have non-working "mock" sample code,
@@ -154,7 +126,7 @@ export async function resolveSegment(
154
126
throw new Error ( `failed to run the pipeline (no output)` )
155
127
}
156
128
157
- const imagePaths = rawOutput . images ?. images . map ( ( img : any ) =>
129
+ const imagePaths = rawOutput . output ?. images . map ( ( img : any ) =>
158
130
api . getPathImage ( img )
159
131
)
160
132
0 commit comments