@@ -16,30 +16,33 @@ export async function resolveSegment(
1616 }
1717
1818 if ( request . segment . category === ClapSegmentCategory . STORYBOARD ) {
19-
20- const workflowId = request . settings . imageGenerationWorkflow . id . split ( '://' ) . pop ( ) || ''
19+ const workflowId =
20+ request . settings . imageGenerationWorkflow . id . split ( '://' ) . pop ( ) || ''
2121
2222 if ( ! workflowId ) {
2323 throw new Error ( `The ComfyICU workflow ID is missing` )
2424 }
2525
26- const inputFields = request . settings . imageGenerationWorkflow . inputFields || [ ]
26+ const inputFields =
27+ request . settings . imageGenerationWorkflow . inputFields || [ ]
2728
2829 // since this is a random "wild" workflow, it is possible
2930 // that the field name is a bit different
3031 // we try to look into the workflow input fields
3132 // to find the best match
3233 const promptFields = [
33- inputFields . find ( f => f . id === 'prompt' ) , // exactMatch,
34- inputFields . find ( f => f . id . includes ( 'prompt' ) ) , // similarName,
35- inputFields . find ( f => f . type === 'string' ) // similarType
36- ] . filter ( x => typeof x !== 'undefined' )
34+ inputFields . find ( ( f ) => f . id === 'prompt' ) , // exactMatch,
35+ inputFields . find ( ( f ) => f . id . includes ( 'prompt' ) ) , // similarName,
36+ inputFields . find ( ( f ) => f . type === 'string' ) , // similarType
37+ ] . filter ( ( x ) => typeof x !== 'undefined' )
3738
3839 const promptField = promptFields [ 0 ]
3940 if ( ! promptField ) {
40- throw new Error ( `this workflow doesn't seem to have a parameter called "prompt"` )
41+ throw new Error (
42+ `this workflow doesn't seem to have a parameter called "prompt"`
43+ )
4144 }
42-
45+
4346 // TODO: modify the serialized workflow payload
4447 // to inject our params:
4548 // ...getWorkflowInputValues(request.settings.imageGenerationWorkflow),
@@ -51,20 +54,22 @@ export async function resolveSegment(
5154 files : { } ,
5255 }
5356
54-
55- const rawResponse = await fetch ( `https://comfy.icu/api/v1/workflows/${ workflowId } /runs` , {
56- headers : {
57- accept : "application/json" ,
58- "content-type" : "application/json" ,
59- authorization : `Bearer ${ request . settings . comfyIcuApiKey } ` ,
60- } ,
61- body : JSON . stringify ( payload ) ,
62- method : "POST" ,
63- } ) ;
57+ const rawResponse = await fetch (
58+ `https://comfy.icu/api/v1/workflows/${ workflowId } /runs` ,
59+ {
60+ headers : {
61+ accept : 'application/json' ,
62+ 'content-type' : 'application/json' ,
63+ authorization : `Bearer ${ request . settings . comfyIcuApiKey } ` ,
64+ } ,
65+ body : JSON . stringify ( payload ) ,
66+ method : 'POST' ,
67+ }
68+ )
6469
6570 const response = await rawResponse . json ( )
6671
67- if ( response . status === " error" ) {
72+ if ( response . status === ' error' ) {
6873 throw new Error ( response . message )
6974 }
7075
0 commit comments