mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): get workflow editor model selects working
This commit is contained in:
parent
e771c5f467
commit
8afe328af0
@ -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,
|
||||
});
|
||||
|
||||
|
@ -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 (
|
||||
|
@ -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,
|
||||
});
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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 (
|
||||
|
@ -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,
|
||||
});
|
||||
|
||||
|
@ -73,7 +73,7 @@ export type BaseModel = z.infer<typeof zBaseModel>;
|
||||
export type ModelType = z.infer<typeof zModelType>;
|
||||
export type ModelIdentifier = z.infer<typeof zModelIdentifier>;
|
||||
export type ModelIdentifierWithBase = z.infer<typeof zModelIdentifierWithBase>;
|
||||
export const zMainModelField = zModelFieldBase;
|
||||
export const zMainModelField = zModelIdentifierWithBase;
|
||||
export type MainModelField = z.infer<typeof zMainModelField>;
|
||||
|
||||
export const zSDXLRefinerModelField = zModelIdentifier;
|
||||
@ -93,23 +93,23 @@ export const zSubModelType = z.enum([
|
||||
]);
|
||||
export type SubModelType = z.infer<typeof zSubModelType>;
|
||||
|
||||
export const zVAEModelField = zModelFieldBase;
|
||||
export const zVAEModelField = zModelIdentifierWithBase;
|
||||
|
||||
export const zModelInfo = zModelIdentifier.extend({
|
||||
submodel_type: zSubModelType.nullish(),
|
||||
});
|
||||
export type ModelInfo = z.infer<typeof zModelInfo>;
|
||||
|
||||
export const zLoRAModelField = zModelFieldBase;
|
||||
export const zLoRAModelField = zModelIdentifierWithBase;
|
||||
export type LoRAModelField = z.infer<typeof zLoRAModelField>;
|
||||
|
||||
export const zControlNetModelField = zModelFieldBase;
|
||||
export const zControlNetModelField = zModelIdentifierWithBase;
|
||||
export type ControlNetModelField = z.infer<typeof zControlNetModelField>;
|
||||
|
||||
export const zIPAdapterModelField = zModelFieldBase;
|
||||
export const zIPAdapterModelField = zModelIdentifierWithBase;
|
||||
export type IPAdapterModelField = z.infer<typeof zIPAdapterModelField>;
|
||||
|
||||
export const zT2IAdapterModelField = zModelFieldBase;
|
||||
export const zT2IAdapterModelField = zModelIdentifierWithBase;
|
||||
export type T2IAdapterModelField = z.infer<typeof zT2IAdapterModelField>;
|
||||
|
||||
export const zLoraInfo = zModelInfo.extend({
|
||||
|
Loading…
Reference in New Issue
Block a user