Skip to content

Commit 2647ff1

Browse files
psychedeliciousmaryhipp
authored andcommitted
feat(ui): add basic metadata to imagen3/chatgpt-4o graphs
1 parent ba0bac2 commit 2647ff1

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

invokeai/frontend/web/src/features/nodes/util/graph/generation/buildChatGPT4oGraph.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const buildChatGPT4oGraph = async (state: RootState, manager: CanvasManag
3939
const { positivePrompt } = selectPresetModifiedPrompts(state);
4040

4141
assert(model, 'No model found in state');
42-
assert(model.base === 'chatgpt-4o', 'Model is not a FLUX model');
42+
assert(model.base === 'chatgpt-4o', 'Model is not a ChatGPT 4o model');
4343

4444
assert(isChatGPT4oAspectRatioID(bbox.aspectRatio.id), 'ChatGPT 4o does not support this aspect ratio');
4545

@@ -77,6 +77,12 @@ export const buildChatGPT4oGraph = async (state: RootState, manager: CanvasManag
7777
is_intermediate,
7878
board,
7979
});
80+
g.upsertMetadata({
81+
positive_prompt: positivePrompt,
82+
model: Graph.getModelMetadataField(model),
83+
width: bbox.rect.width,
84+
height: bbox.rect.height,
85+
});
8086
return {
8187
g,
8288
positivePromptFieldIdentifier: { nodeId: gptImage.id, fieldName: 'positive_prompt' },
@@ -102,6 +108,12 @@ export const buildChatGPT4oGraph = async (state: RootState, manager: CanvasManag
102108
is_intermediate,
103109
board,
104110
});
111+
g.upsertMetadata({
112+
positive_prompt: positivePrompt,
113+
model: Graph.getModelMetadataField(model),
114+
width: bbox.rect.width,
115+
height: bbox.rect.height,
116+
});
105117
return {
106118
g,
107119
positivePromptFieldIdentifier: { nodeId: gptImage.id, fieldName: 'positive_prompt' },

invokeai/frontend/web/src/features/nodes/util/graph/generation/buildImagen3Graph.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from 'features/nodes/util/graph/graphBuilderUtils';
1414
import { type GraphBuilderReturn, UnsupportedGenerationModeError } from 'features/nodes/util/graph/types';
1515
import { t } from 'i18next';
16+
import { selectMainModelConfig } from 'services/api/endpoints/models';
1617
import type { Equals } from 'tsafe';
1718
import { assert } from 'tsafe';
1819

@@ -32,7 +33,9 @@ export const buildImagen3Graph = async (state: RootState, manager: CanvasManager
3233

3334
const { bbox } = canvas;
3435
const { positivePrompt, negativePrompt } = selectPresetModifiedPrompts(state);
36+
const model = selectMainModelConfig(state);
3537

38+
assert(model, 'No model found for Imagen3 graph');
3639
assert(isImagen3AspectRatioID(bbox.aspectRatio.id), 'Imagen3 does not support this aspect ratio');
3740
assert(positivePrompt.length > 0, 'Imagen3 requires positive prompt to have at least one character');
3841

@@ -54,6 +57,13 @@ export const buildImagen3Graph = async (state: RootState, manager: CanvasManager
5457
is_intermediate,
5558
board,
5659
});
60+
g.upsertMetadata({
61+
positive_prompt: positivePrompt,
62+
negative_prompt: negativePrompt,
63+
width: bbox.rect.width,
64+
height: bbox.rect.height,
65+
model: Graph.getModelMetadataField(model),
66+
});
5767
return {
5868
g,
5969
seedFieldIdentifier: { nodeId: imagen3.id, fieldName: 'seed' },

0 commit comments

Comments
 (0)