diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/addControlNetToLinearGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addControlNetToLinearGraph.ts index 834dda4565..bea8cff0df 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/addControlNetToLinearGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/addControlNetToLinearGraph.ts @@ -1,16 +1,14 @@ import type { RootState } from 'app/store/store'; import { selectValidControlNets } from 'features/controlAdapters/store/controlAdaptersSlice'; -import { fetchModelConfigWithTypeGuard } from 'features/metadata/util/modelFetchingHelpers'; import type { CollectInvocation, ControlNetInvocation, CoreMetadataInvocation, NonNullableGraph, } from 'services/api/types'; -import { isControlNetModelConfig } from 'services/api/types'; import { CONTROL_NET_COLLECT } from './constants'; -import { getModelMetadataField, upsertMetadata } from './metadata'; +import { upsertMetadata } from './metadata'; export const addControlNetToLinearGraph = async ( state: RootState, @@ -27,10 +25,6 @@ export const addControlNetToLinearGraph = async ( } ); - // const metadataAccumulator = graph.nodes[METADATA_ACCUMULATOR] as - // | MetadataAccumulatorInvocation - // | undefined; - const controlNetMetadata: CoreMetadataInvocation['controlnets'] = []; if (validControlNets.length) { @@ -95,10 +89,8 @@ export const addControlNetToLinearGraph = async ( graph.nodes[controlNetNode.id] = controlNetNode as ControlNetInvocation; - const modelConfig = await fetchModelConfigWithTypeGuard(model.key, isControlNetModelConfig); - controlNetMetadata.push({ - control_model: getModelMetadataField(modelConfig), + control_model: model, control_weight: weight, control_mode: controlMode, begin_step_percent: beginStepPct, diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/addIPAdapterToLinearGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addIPAdapterToLinearGraph.ts index 7a1fb3266f..71600c4344 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/addIPAdapterToLinearGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/addIPAdapterToLinearGraph.ts @@ -1,16 +1,14 @@ import type { RootState } from 'app/store/store'; import { selectValidIPAdapters } from 'features/controlAdapters/store/controlAdaptersSlice'; -import { fetchModelConfigWithTypeGuard } from 'features/metadata/util/modelFetchingHelpers'; import type { CollectInvocation, CoreMetadataInvocation, IPAdapterInvocation, NonNullableGraph, } from 'services/api/types'; -import { isIPAdapterModelConfig } from 'services/api/types'; import { IP_ADAPTER_COLLECT } from './constants'; -import { getModelMetadataField, upsertMetadata } from './metadata'; +import { upsertMetadata } from './metadata'; export const addIPAdapterToLinearGraph = async ( state: RootState, @@ -67,11 +65,9 @@ export const addIPAdapterToLinearGraph = async ( graph.nodes[ipAdapterNode.id] = ipAdapterNode; - const modelConfig = await fetchModelConfigWithTypeGuard(model.key, isIPAdapterModelConfig); - ipAdapterMetdata.push({ weight: weight, - ip_adapter_model: getModelMetadataField(modelConfig), + ip_adapter_model: model, begin_step_percent: beginStepPct, end_step_percent: endStepPct, image: ipAdapterNode.image, diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/addT2IAdapterToLinearGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addT2IAdapterToLinearGraph.ts index 9763dda268..bbca07dfcc 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/addT2IAdapterToLinearGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/addT2IAdapterToLinearGraph.ts @@ -1,16 +1,14 @@ import type { RootState } from 'app/store/store'; import { selectValidT2IAdapters } from 'features/controlAdapters/store/controlAdaptersSlice'; -import { fetchModelConfigWithTypeGuard } from 'features/metadata/util/modelFetchingHelpers'; -import { - type CollectInvocation, - type CoreMetadataInvocation, - isT2IAdapterModelConfig, - type NonNullableGraph, - type T2IAdapterInvocation, +import type { + CollectInvocation, + CoreMetadataInvocation, + NonNullableGraph, + T2IAdapterInvocation, } from 'services/api/types'; import { T2I_ADAPTER_COLLECT } from './constants'; -import { getModelMetadataField, upsertMetadata } from './metadata'; +import { upsertMetadata } from './metadata'; export const addT2IAdaptersToLinearGraph = async ( state: RootState, @@ -89,13 +87,11 @@ export const addT2IAdaptersToLinearGraph = async ( graph.nodes[t2iAdapterNode.id] = t2iAdapterNode; - const modelConfig = await fetchModelConfigWithTypeGuard(t2iAdapter.model.key, isT2IAdapterModelConfig); - t2iAdapterMetadata.push({ begin_step_percent: beginStepPct, end_step_percent: endStepPct, resize_mode: resizeMode, - t2i_adapter_model: getModelMetadataField(modelConfig), + t2i_adapter_model: t2iAdapter.model, weight: weight, image: t2iAdapterNode.image, }); diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/addVAEToGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addVAEToGraph.ts index 58c92eddd7..4806bc1172 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/addVAEToGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/addVAEToGraph.ts @@ -1,7 +1,5 @@ import type { RootState } from 'app/store/store'; -import { fetchModelConfigWithTypeGuard } from 'features/metadata/util/modelFetchingHelpers'; -import type { ModelMetadataField, NonNullableGraph } from 'services/api/types'; -import { isVAEModelConfig } from 'services/api/types'; +import type { NonNullableGraph } from 'services/api/types'; import { CANVAS_IMAGE_TO_IMAGE_GRAPH, @@ -25,7 +23,7 @@ import { TEXT_TO_IMAGE_GRAPH, VAE_LOADER, } from './constants'; -import { getModelMetadataField, upsertMetadata } from './metadata'; +import { upsertMetadata } from './metadata'; export const addVAEToGraph = async ( state: RootState, @@ -151,8 +149,6 @@ export const addVAEToGraph = async ( } if (vae) { - const modelConfig = await fetchModelConfigWithTypeGuard(vae.key, isVAEModelConfig); - const vaeMetadata: ModelMetadataField = getModelMetadataField(modelConfig); - upsertMetadata(graph, { vae: vaeMetadata }); + upsertMetadata(graph, { vae }); } }; diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/metadata.ts b/invokeai/frontend/web/src/features/nodes/util/graph/metadata.ts index 3a87b30fd7..9e8b5a5a6b 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/metadata.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/metadata.ts @@ -1,5 +1,6 @@ import type { JSONObject } from 'common/types'; -import type { AnyModelConfig, CoreMetadataInvocation, ModelMetadataField, NonNullableGraph } from 'services/api/types'; +import type { ModelIdentifierField } from 'features/nodes/types/common'; +import type { AnyModelConfig, CoreMetadataInvocation, NonNullableGraph } from 'services/api/types'; import { METADATA } from './constants'; @@ -72,7 +73,7 @@ export const setMetadataReceivingNode = (graph: NonNullableGraph, nodeId: string }); }; -export const getModelMetadataField = ({ key, hash, name, base, type }: AnyModelConfig): ModelMetadataField => ({ +export const getModelMetadataField = ({ key, hash, name, base, type }: AnyModelConfig): ModelIdentifierField => ({ key, hash, name, diff --git a/invokeai/frontend/web/src/services/api/types.ts b/invokeai/frontend/web/src/services/api/types.ts index 2d304a8333..d42220f962 100644 --- a/invokeai/frontend/web/src/services/api/types.ts +++ b/invokeai/frontend/web/src/services/api/types.ts @@ -141,9 +141,6 @@ export type ImageWatermarkInvocation = S['ImageWatermarkInvocation']; export type SeamlessModeInvocation = S['SeamlessModeInvocation']; export type CoreMetadataInvocation = S['CoreMetadataInvocation']; -// Metadata fields -export type ModelMetadataField = S['ModelMetadataField']; - // ControlNet Nodes export type ControlNetInvocation = S['ControlNetInvocation']; export type T2IAdapterInvocation = S['T2IAdapterInvocation'];