File tree Expand file tree Collapse file tree 4 files changed +9
-13
lines changed
invokeai/frontend/web/src/features/nodes/util/graph/generation Expand file tree Collapse file tree 4 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { selectRefImagesSlice } from 'features/controlLayers/store/refImagesSlic
5
5
import { selectCanvasMetadata } from 'features/controlLayers/store/selectors' ;
6
6
import { isChatGPT4oAspectRatioID , isChatGPT4oReferenceImageConfig } from 'features/controlLayers/store/types' ;
7
7
import { getGlobalReferenceImageWarnings } from 'features/controlLayers/store/validators' ;
8
- import { type ImageField , zModelIdentifierField } from 'features/nodes/types/common' ;
8
+ import { type ImageField , zImageField , zModelIdentifierField } from 'features/nodes/types/common' ;
9
9
import { Graph } from 'features/nodes/util/graph/generation/Graph' ;
10
10
import {
11
11
getOriginalAndScaledSizesForOtherModes ,
@@ -49,9 +49,7 @@ export const buildChatGPT4oGraph = async (arg: GraphBuilderArg): Promise<GraphBu
49
49
reference_images = [ ] ;
50
50
for ( const entity of validRefImages ) {
51
51
assert ( entity . config . image , 'Image is required for reference image' ) ;
52
- reference_images . push ( {
53
- image_name : entity . config . image . crop ?. image . image_name ?? entity . config . image . original . image . image_name ,
54
- } ) ;
52
+ reference_images . push ( zImageField . parse ( entity . config . image . crop ?. image ?? entity . config . image . original . image ) ) ;
55
53
}
56
54
}
57
55
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ export const buildFLUXGraph = async (arg: GraphBuilderArg): Promise<GraphBuilder
164
164
const kontextImagePrep = g . addNode ( {
165
165
id : getPrefixedId ( 'flux_kontext_image_prep' ) ,
166
166
type : 'flux_kontext_image_prep' ,
167
- images : [ zImageField . parse ( config . image ) ] ,
167
+ images : [ zImageField . parse ( config . image ?. crop ?. image ?? config . image ?. original . image ) ] ,
168
168
} ) ;
169
169
const kontextConditioning = g . addNode ( {
170
170
type : 'flux_kontext' ,
Original file line number Diff line number Diff line change @@ -60,17 +60,17 @@ export const buildFluxKontextGraph = (arg: GraphBuilderArg): GraphBuilderReturn
60
60
model : zModelIdentifierField . parse ( model ) ,
61
61
aspect_ratio : aspectRatio . id ,
62
62
prompt_upsampling : true ,
63
- input_image : {
64
- image_name : firstImage . crop ?. image . image_name ?? firstImage . original . image . image_name ,
65
- } ,
63
+ input_image : zImageField . parse ( firstImage . crop ?. image ?? firstImage . original . image ) ,
66
64
...selectCanvasOutputFields ( state ) ,
67
65
} ) ;
68
66
} else {
69
67
// Multiple reference images - use concatenation
70
68
const kontextConcatenator = g . addNode ( {
71
69
id : getPrefixedId ( 'flux_kontext_image_prep' ) ,
72
70
type : 'flux_kontext_image_prep' ,
73
- images : validRefImages . map ( ( { config } ) => zImageField . parse ( config . image ) ) ,
71
+ images : validRefImages . map ( ( { config } ) =>
72
+ zImageField . parse ( config . image ?. crop ?. image ?? config . image ?. original . image )
73
+ ) ,
74
74
} ) ;
75
75
76
76
fluxKontextImage = g . addNode ( {
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { selectMainModelConfig } from 'features/controlLayers/store/paramsSlice'
4
4
import { selectRefImagesSlice } from 'features/controlLayers/store/refImagesSlice' ;
5
5
import { isGemini2_5ReferenceImageConfig } from 'features/controlLayers/store/types' ;
6
6
import { getGlobalReferenceImageWarnings } from 'features/controlLayers/store/validators' ;
7
- import type { ImageField } from 'features/nodes/types/common' ;
7
+ import { type ImageField , zImageField } from 'features/nodes/types/common' ;
8
8
import { Graph } from 'features/nodes/util/graph/generation/Graph' ;
9
9
import { selectCanvasOutputFields } from 'features/nodes/util/graph/graphBuilderUtils' ;
10
10
import type { GraphBuilderArg , GraphBuilderReturn } from 'features/nodes/util/graph/types' ;
@@ -44,9 +44,7 @@ export const buildGemini2_5Graph = (arg: GraphBuilderArg): GraphBuilderReturn =>
44
44
reference_images = [ ] ;
45
45
for ( const entity of validRefImages ) {
46
46
assert ( entity . config . image , 'Image is required for reference image' ) ;
47
- reference_images . push ( {
48
- image_name : entity . config . image . crop ?. image . image_name ?? entity . config . image . original . image . image_name ,
49
- } ) ;
47
+ reference_images . push ( zImageField . parse ( entity . config . image . crop ?. image ?? entity . config . image . original . image ) ) ;
50
48
}
51
49
}
52
50
You can’t perform that action at this time.
0 commit comments