diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts index 903bfc01ae..d5fd1ae8ca 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts @@ -39,7 +39,7 @@ export const addUpscaleRequestedListener = (startAppListening: AppStartListening const enqueueBatchArg: BatchConfig = { prepend: true, batch: { - graph: buildAdHocUpscaleGraph({ + graph: await buildAdHocUpscaleGraph({ image: imageDTO, state, }), diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/buildAdHocUpscaleGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildAdHocUpscaleGraph.ts index 0fae75491f..0c6a0803ad 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/buildAdHocUpscaleGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/buildAdHocUpscaleGraph.ts @@ -1,8 +1,14 @@ import type { RootState } from 'app/store/store'; -import type { Graph, ImageDTO, Invocation, NonNullableGraph } from 'services/api/types'; +import { fetchModelConfigWithTypeGuard } from 'features/metadata/util/modelFetchingHelpers'; +import { + type ImageDTO, + type Invocation, + isSpandrelImageToImageModelConfig, + type NonNullableGraph, +} from 'services/api/types'; import { assert } from 'tsafe'; -import { addCoreMetadataNode, upsertMetadata } from './canvas/metadata'; +import { addCoreMetadataNode, getModelMetadataField, upsertMetadata } from './canvas/metadata'; import { SPANDREL } from './constants'; type Arg = { @@ -10,7 +16,7 @@ type Arg = { state: RootState; }; -export const buildAdHocUpscaleGraph = ({ image, state }: Arg): Graph => { +export const buildAdHocUpscaleGraph = async ({ image, state }: Arg): Promise => { const { simpleUpscaleModel } = state.upscale; assert(simpleUpscaleModel, 'No upscale model found in state'); @@ -30,10 +36,11 @@ export const buildAdHocUpscaleGraph = ({ image, state }: Arg): Graph => { }, edges: [], }; + const modelConfig = await fetchModelConfigWithTypeGuard(simpleUpscaleModel.key, isSpandrelImageToImageModelConfig); addCoreMetadataNode(graph, {}, SPANDREL); upsertMetadata(graph, { - spandrel_model: simpleUpscaleModel, + upscale_model: getModelMetadataField(modelConfig), }); return graph;