@@ -5,6 +5,7 @@ import { selectRefImagesSlice } from 'features/controlLayers/store/refImagesSlic
55import { selectCanvasMetadata , selectCanvasSlice } from 'features/controlLayers/store/selectors' ;
66import { isFluxKontextReferenceImageConfig } from 'features/controlLayers/store/types' ;
77import { getGlobalReferenceImageWarnings } from 'features/controlLayers/store/validators' ;
8+ import { zImageField } from 'features/nodes/types/common' ;
89import { addFLUXFill } from 'features/nodes/util/graph/generation/addFLUXFill' ;
910import { addFLUXLoRAs } from 'features/nodes/util/graph/generation/addFLUXLoRAs' ;
1011import { addFLUXReduxes } from 'features/nodes/util/graph/generation/addFLUXRedux' ;
@@ -155,24 +156,17 @@ export const buildFLUXGraph = async (arg: GraphBuilderArg): Promise<GraphBuilder
155156 . filter ( ( entity ) => getGlobalReferenceImageWarnings ( entity , model ) . length === 0 ) ;
156157
157158 if ( validFLUXKontextConfigs . length > 0 ) {
158- const kontextCollector = g . addNode ( {
159- id : getPrefixedId ( 'flux_kontext_collector' ) ,
160- type : 'collect' ,
159+ const kontextConcatenator = g . addNode ( {
160+ id : getPrefixedId ( 'flux_kontext_image_prep' ) ,
161+ type : 'flux_kontext_image_prep' ,
162+ images : validFLUXKontextConfigs . map ( ( { config } ) => zImageField . parse ( config . image ) ) ,
161163 } ) ;
162- g . addEdge ( kontextCollector , 'collection' , denoise , 'kontext_conditioning' ) ;
163-
164- for ( const kontextConfig of validFLUXKontextConfigs ) {
165- const { image } = kontextConfig . config ;
166-
167- assert ( image , 'getGlobalReferenceImageWarnings checks if the image is there, this should never raise' ) ;
168-
169- const kontextConditioning = g . addNode ( {
170- type : 'flux_kontext' ,
171- id : getPrefixedId ( `flux_kontext_${ kontextConfig . id } ` ) ,
172- image,
173- } ) ;
174- g . addEdge ( kontextConditioning , 'kontext_cond' , kontextCollector , 'item' ) ;
175- }
164+ const kontextConditioning = g . addNode ( {
165+ type : 'flux_kontext' ,
166+ id : getPrefixedId ( 'flux_kontext' ) ,
167+ } ) ;
168+ g . addEdge ( kontextConcatenator , 'image' , kontextConditioning , 'image' ) ;
169+ g . addEdge ( kontextConditioning , 'kontext_cond' , denoise , 'kontext_conditioning' ) ;
176170
177171 g . upsertMetadata ( { ref_images : [ validFLUXKontextConfigs ] } , 'merge' ) ;
178172 }
0 commit comments