diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/ControlNetModelFieldInputComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/ControlNetModelFieldInputComponent.tsx index 53d800e7b6..1951ec60d3 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/ControlNetModelFieldInputComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/ControlNetModelFieldInputComponent.tsx @@ -3,9 +3,10 @@ import { useAppDispatch } from 'app/store/storeHooks'; import { useGroupedModelCombobox } from 'common/hooks/useGroupedModelCombobox'; import { fieldControlNetModelValueChanged } from 'features/nodes/store/nodesSlice'; import type { ControlNetModelFieldInputInstance, ControlNetModelFieldInputTemplate } from 'features/nodes/types/field'; +import { pick } from 'lodash-es'; import { memo, useCallback } from 'react'; -import type { ControlNetConfig } from 'services/api/endpoints/models'; import { useGetControlNetModelsQuery } from 'services/api/endpoints/models'; +import type { ControlNetConfig } from 'services/api/types'; import type { FieldComponentProps } from './types'; @@ -35,7 +36,7 @@ const ControlNetModelFieldInputComponent = (props: Props) => { const { options, value, onChange, placeholder, noOptionsMessage } = useGroupedModelCombobox({ modelEntities: data, onChange: _onChange, - selectedModel: field.value ? { ...field.value, model_type: 'controlnet' } : undefined, + selectedModel: field.value ? pick(field.value, ['key', 'base']) : undefined, isLoading, }); diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/IPAdapterModelFieldInputComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/IPAdapterModelFieldInputComponent.tsx index 3f195ceb32..137f751fca 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/IPAdapterModelFieldInputComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/IPAdapterModelFieldInputComponent.tsx @@ -3,9 +3,10 @@ import { useAppDispatch } from 'app/store/storeHooks'; import { useGroupedModelCombobox } from 'common/hooks/useGroupedModelCombobox'; import { fieldIPAdapterModelValueChanged } from 'features/nodes/store/nodesSlice'; import type { IPAdapterModelFieldInputInstance, IPAdapterModelFieldInputTemplate } from 'features/nodes/types/field'; +import { pick } from 'lodash-es'; import { memo, useCallback } from 'react'; -import type { IPAdapterConfig } from 'services/api/endpoints/models'; import { useGetIPAdapterModelsQuery } from 'services/api/endpoints/models'; +import type { IPAdapterConfig } from 'services/api/types'; import type { FieldComponentProps } from './types'; @@ -35,7 +36,7 @@ const IPAdapterModelFieldInputComponent = ( const { options, value, onChange } = useGroupedModelCombobox({ modelEntities: ipAdapterModels, onChange: _onChange, - selectedModel: field.value ? { ...field.value, model_type: 'ip_adapter' } : undefined, + selectedModel: field.value ? pick(field.value, ['key', 'base']) : undefined, }); return ( diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/LoRAModelFieldInputComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/LoRAModelFieldInputComponent.tsx index eeb07fa08e..5f6318de9e 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/LoRAModelFieldInputComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/LoRAModelFieldInputComponent.tsx @@ -3,9 +3,10 @@ import { useAppDispatch } from 'app/store/storeHooks'; import { useGroupedModelCombobox } from 'common/hooks/useGroupedModelCombobox'; import { fieldLoRAModelValueChanged } from 'features/nodes/store/nodesSlice'; import type { LoRAModelFieldInputInstance, LoRAModelFieldInputTemplate } from 'features/nodes/types/field'; +import { pick } from 'lodash-es'; import { memo, useCallback } from 'react'; -import type { LoRAConfig } from 'services/api/endpoints/models'; import { useGetLoRAModelsQuery } from 'services/api/endpoints/models'; +import type { LoRAConfig } from 'services/api/types'; import type { FieldComponentProps } from './types'; @@ -34,7 +35,7 @@ const LoRAModelFieldInputComponent = (props: Props) => { const { options, value, onChange, placeholder, noOptionsMessage } = useGroupedModelCombobox({ modelEntities: data, onChange: _onChange, - selectedModel: field.value ? { ...field.value, model_type: 'lora' } : undefined, + selectedModel: field.value ? pick(field.value, ['key', 'base']) : undefined, isLoading, }); diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/MainModelFieldInputComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/MainModelFieldInputComponent.tsx index 7ddde08816..1cb0658b81 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/MainModelFieldInputComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/MainModelFieldInputComponent.tsx @@ -6,8 +6,8 @@ import { fieldMainModelValueChanged } from 'features/nodes/store/nodesSlice'; import type { MainModelFieldInputInstance, MainModelFieldInputTemplate } from 'features/nodes/types/field'; import { memo, useCallback } from 'react'; import { NON_SDXL_MAIN_MODELS } from 'services/api/constants'; -import type { MainModelConfig } from 'services/api/endpoints/models'; import { useGetMainModelsQuery } from 'services/api/endpoints/models'; +import type { MainModelConfig } from 'services/api/types'; import type { FieldComponentProps } from './types'; diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/RefinerModelFieldInputComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/RefinerModelFieldInputComponent.tsx index 9b5a1138d4..be2b4a4d4f 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/RefinerModelFieldInputComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/RefinerModelFieldInputComponent.tsx @@ -9,8 +9,8 @@ import type { } from 'features/nodes/types/field'; import { memo, useCallback } from 'react'; import { REFINER_BASE_MODELS } from 'services/api/constants'; -import type { MainModelConfig } from 'services/api/endpoints/models'; import { useGetMainModelsQuery } from 'services/api/endpoints/models'; +import type { MainModelConfig } from 'services/api/types'; import type { FieldComponentProps } from './types'; diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/SDXLMainModelFieldInputComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/SDXLMainModelFieldInputComponent.tsx index cf353619e8..d0d7754606 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/SDXLMainModelFieldInputComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/SDXLMainModelFieldInputComponent.tsx @@ -6,8 +6,8 @@ import { fieldMainModelValueChanged } from 'features/nodes/store/nodesSlice'; import type { SDXLMainModelFieldInputInstance, SDXLMainModelFieldInputTemplate } from 'features/nodes/types/field'; import { memo, useCallback } from 'react'; import { SDXL_MAIN_MODELS } from 'services/api/constants'; -import type { MainModelConfig } from 'services/api/endpoints/models'; import { useGetMainModelsQuery } from 'services/api/endpoints/models'; +import type { MainModelConfig } from 'services/api/types'; import type { FieldComponentProps } from './types'; diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/T2IAdapterModelFieldInputComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/T2IAdapterModelFieldInputComponent.tsx index 8402c56343..9115f22c14 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/T2IAdapterModelFieldInputComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/T2IAdapterModelFieldInputComponent.tsx @@ -3,9 +3,10 @@ import { useAppDispatch } from 'app/store/storeHooks'; import { useGroupedModelCombobox } from 'common/hooks/useGroupedModelCombobox'; import { fieldT2IAdapterModelValueChanged } from 'features/nodes/store/nodesSlice'; import type { T2IAdapterModelFieldInputInstance, T2IAdapterModelFieldInputTemplate } from 'features/nodes/types/field'; +import { pick } from 'lodash-es'; import { memo, useCallback } from 'react'; -import type { T2IAdapterConfig } from 'services/api/endpoints/models'; import { useGetT2IAdapterModelsQuery } from 'services/api/endpoints/models'; +import type { T2IAdapterConfig } from 'services/api/types'; import type { FieldComponentProps } from './types'; @@ -36,7 +37,7 @@ const T2IAdapterModelFieldInputComponent = ( const { options, value, onChange } = useGroupedModelCombobox({ modelEntities: t2iAdapterModels, onChange: _onChange, - selectedModel: field.value ? { ...field.value, model_type: 't2i_adapter' } : undefined, + selectedModel: field.value ? pick(field.value, ['key', 'base']) : undefined, }); return ( diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/VAEModelFieldInputComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/VAEModelFieldInputComponent.tsx index af09f2d8f2..87272f48b9 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/VAEModelFieldInputComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/VAEModelFieldInputComponent.tsx @@ -4,9 +4,10 @@ import { useGroupedModelCombobox } from 'common/hooks/useGroupedModelCombobox'; import { SyncModelsIconButton } from 'features/modelManager/components/SyncModels/SyncModelsIconButton'; import { fieldVaeModelValueChanged } from 'features/nodes/store/nodesSlice'; import type { VAEModelFieldInputInstance, VAEModelFieldInputTemplate } from 'features/nodes/types/field'; +import { pick } from 'lodash-es'; import { memo, useCallback } from 'react'; -import type { VAEConfig } from 'services/api/endpoints/models'; import { useGetVaeModelsQuery } from 'services/api/endpoints/models'; +import type { VAEConfig } from 'services/api/types'; import type { FieldComponentProps } from './types'; @@ -34,7 +35,7 @@ const VAEModelFieldInputComponent = (props: Props) => { const { options, value, onChange, placeholder, noOptionsMessage } = useGroupedModelCombobox({ modelEntities: data, onChange: _onChange, - selectedModel: field.value ? { ...field.value, model_type: 'vae' } : null, + selectedModel: field.value ? pick(field.value, ['key', 'base']) : null, isLoading, }); diff --git a/invokeai/frontend/web/src/features/nodes/types/common.ts b/invokeai/frontend/web/src/features/nodes/types/common.ts index 891bd29bc8..d5d04deaa5 100644 --- a/invokeai/frontend/web/src/features/nodes/types/common.ts +++ b/invokeai/frontend/web/src/features/nodes/types/common.ts @@ -73,7 +73,7 @@ export type BaseModel = z.infer; export type ModelType = z.infer; export type ModelIdentifier = z.infer; export type ModelIdentifierWithBase = z.infer; -export const zMainModelField = zModelFieldBase; +export const zMainModelField = zModelIdentifierWithBase; export type MainModelField = z.infer; export const zSDXLRefinerModelField = zModelIdentifier; @@ -93,23 +93,23 @@ export const zSubModelType = z.enum([ ]); export type SubModelType = z.infer; -export const zVAEModelField = zModelFieldBase; +export const zVAEModelField = zModelIdentifierWithBase; export const zModelInfo = zModelIdentifier.extend({ submodel_type: zSubModelType.nullish(), }); export type ModelInfo = z.infer; -export const zLoRAModelField = zModelFieldBase; +export const zLoRAModelField = zModelIdentifierWithBase; export type LoRAModelField = z.infer; -export const zControlNetModelField = zModelFieldBase; +export const zControlNetModelField = zModelIdentifierWithBase; export type ControlNetModelField = z.infer; -export const zIPAdapterModelField = zModelFieldBase; +export const zIPAdapterModelField = zModelIdentifierWithBase; export type IPAdapterModelField = z.infer; -export const zT2IAdapterModelField = zModelFieldBase; +export const zT2IAdapterModelField = zModelIdentifierWithBase; export type T2IAdapterModelField = z.infer; export const zLoraInfo = zModelInfo.extend({