From 4ee4a801c680adbb71dc57e02dc1739f3db006ad Mon Sep 17 00:00:00 2001
From: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
Date: Fri, 8 Mar 2024 19:50:00 +1100
Subject: [PATCH] feat(ui): update default settings for main models
Needed some massaging now that only main models get main model default settings.
---
.../hooks/useMainModelDefaultSettings.ts | 65 ++++++++
.../subpanels/ModelPanel/DefaultSettings.tsx | 68 ---------
.../DefaultCfgRescaleMultiplier.tsx | 2 +-
.../DefaultCfgScale.tsx | 2 +-
.../DefaultScheduler.tsx | 2 +-
.../DefaultSettingsForm.tsx | 0
.../DefaultSteps.tsx | 2 +-
.../DefaultVae.tsx | 2 +-
.../DefaultVaePrecision.tsx | 2 +-
.../MainModelDefaultSettings.tsx | 144 ++++++++++++++++++
.../SettingToggle.tsx | 0
.../subpanels/ModelPanel/ModelView.tsx | 4 +-
.../frontend/web/src/services/api/types.ts | 6 +
13 files changed, 223 insertions(+), 76 deletions(-)
create mode 100644 invokeai/frontend/web/src/features/modelManagerV2/hooks/useMainModelDefaultSettings.ts
delete mode 100644 invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings.tsx
rename invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/{DefaultSettings => MainModelDefaultSettings}/DefaultCfgRescaleMultiplier.tsx (98%)
rename invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/{DefaultSettings => MainModelDefaultSettings}/DefaultCfgScale.tsx (98%)
rename invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/{DefaultSettings => MainModelDefaultSettings}/DefaultScheduler.tsx (97%)
rename invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/{DefaultSettings => MainModelDefaultSettings}/DefaultSettingsForm.tsx (100%)
rename invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/{DefaultSettings => MainModelDefaultSettings}/DefaultSteps.tsx (98%)
rename invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/{DefaultSettings => MainModelDefaultSettings}/DefaultVae.tsx (98%)
rename invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/{DefaultSettings => MainModelDefaultSettings}/DefaultVaePrecision.tsx (97%)
create mode 100644 invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx
rename invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/{DefaultSettings => MainModelDefaultSettings}/SettingToggle.tsx (100%)
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/hooks/useMainModelDefaultSettings.ts b/invokeai/frontend/web/src/features/modelManagerV2/hooks/useMainModelDefaultSettings.ts
new file mode 100644
index 0000000000..207199ec93
--- /dev/null
+++ b/invokeai/frontend/web/src/features/modelManagerV2/hooks/useMainModelDefaultSettings.ts
@@ -0,0 +1,65 @@
+import { skipToken } from '@reduxjs/toolkit/query';
+import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
+import { useAppSelector } from 'app/store/storeHooks';
+import { selectConfigSlice } from 'features/system/store/configSlice';
+import { isNil } from 'lodash-es';
+import { useMemo } from 'react';
+import { useGetModelConfigWithTypeGuard } from 'services/api/hooks/useGetModelConfigWithTypeGuard';
+import { isNonRefinerMainModelConfig } from 'services/api/types';
+
+const initialStatesSelector = createMemoizedSelector(selectConfigSlice, (config) => {
+ const { steps, guidance, scheduler, cfgRescaleMultiplier, vaePrecision } = config.sd;
+
+ return {
+ initialSteps: steps.initial,
+ initialCfg: guidance.initial,
+ initialScheduler: scheduler,
+ initialCfgRescaleMultiplier: cfgRescaleMultiplier.initial,
+ initialVaePrecision: vaePrecision,
+ };
+});
+
+export const useMainModelDefaultSettings = (modelKey?: string | null) => {
+ const { modelConfig, isLoading } = useGetModelConfigWithTypeGuard(modelKey ?? skipToken, isNonRefinerMainModelConfig);
+
+ const { initialSteps, initialCfg, initialScheduler, initialCfgRescaleMultiplier, initialVaePrecision } =
+ useAppSelector(initialStatesSelector);
+
+ const defaultSettingsDefaults = useMemo(() => {
+ return {
+ vae: {
+ isEnabled: !isNil(modelConfig?.default_settings?.vae),
+ value: modelConfig?.default_settings?.vae || 'default',
+ },
+ vaePrecision: {
+ isEnabled: !isNil(modelConfig?.default_settings?.vae_precision),
+ value: modelConfig?.default_settings?.vae_precision || initialVaePrecision || 'fp32',
+ },
+ scheduler: {
+ isEnabled: !isNil(modelConfig?.default_settings?.scheduler),
+ value: modelConfig?.default_settings?.scheduler || initialScheduler || 'euler',
+ },
+ steps: {
+ isEnabled: !isNil(modelConfig?.default_settings?.steps),
+ value: modelConfig?.default_settings?.steps || initialSteps,
+ },
+ cfgScale: {
+ isEnabled: !isNil(modelConfig?.default_settings?.cfg_scale),
+ value: modelConfig?.default_settings?.cfg_scale || initialCfg,
+ },
+ cfgRescaleMultiplier: {
+ isEnabled: !isNil(modelConfig?.default_settings?.cfg_rescale_multiplier),
+ value: modelConfig?.default_settings?.cfg_rescale_multiplier || initialCfgRescaleMultiplier,
+ },
+ };
+ }, [
+ modelConfig?.default_settings,
+ initialSteps,
+ initialCfg,
+ initialScheduler,
+ initialCfgRescaleMultiplier,
+ initialVaePrecision,
+ ]);
+
+ return { defaultSettingsDefaults, isLoading };
+};
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings.tsx
deleted file mode 100644
index 0e31d3b53e..0000000000
--- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import { Text } from '@invoke-ai/ui-library';
-import { skipToken } from '@reduxjs/toolkit/query';
-import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
-import { useAppSelector } from 'app/store/storeHooks';
-import { selectConfigSlice } from 'features/system/store/configSlice';
-import { isNil } from 'lodash-es';
-import { useMemo } from 'react';
-import { useTranslation } from 'react-i18next';
-import { useGetModelConfigQuery } from 'services/api/endpoints/models';
-
-import { DefaultSettingsForm } from './DefaultSettings/DefaultSettingsForm';
-
-const initialStatesSelector = createMemoizedSelector(selectConfigSlice, (config) => {
- const { steps, guidance, scheduler, cfgRescaleMultiplier, vaePrecision } = config.sd;
-
- return {
- initialSteps: steps.initial,
- initialCfg: guidance.initial,
- initialScheduler: scheduler,
- initialCfgRescaleMultiplier: cfgRescaleMultiplier.initial,
- initialVaePrecision: vaePrecision,
- };
-});
-
-export const DefaultSettings = () => {
- const selectedModelKey = useAppSelector((s) => s.modelmanagerV2.selectedModelKey);
- const { t } = useTranslation();
-
- const { data, isLoading } = useGetModelConfigQuery(selectedModelKey ?? skipToken);
- const { initialSteps, initialCfg, initialScheduler, initialCfgRescaleMultiplier, initialVaePrecision } =
- useAppSelector(initialStatesSelector);
-
- const defaultSettingsDefaults = useMemo(() => {
- return {
- vae: { isEnabled: !isNil(data?.default_settings?.vae), value: data?.default_settings?.vae || 'default' },
- vaePrecision: {
- isEnabled: !isNil(data?.default_settings?.vae_precision),
- value: data?.default_settings?.vae_precision || initialVaePrecision || 'fp32',
- },
- scheduler: {
- isEnabled: !isNil(data?.default_settings?.scheduler),
- value: data?.default_settings?.scheduler || initialScheduler || 'euler',
- },
- steps: { isEnabled: !isNil(data?.default_settings?.steps), value: data?.default_settings?.steps || initialSteps },
- cfgScale: {
- isEnabled: !isNil(data?.default_settings?.cfg_scale),
- value: data?.default_settings?.cfg_scale || initialCfg,
- },
- cfgRescaleMultiplier: {
- isEnabled: !isNil(data?.default_settings?.cfg_rescale_multiplier),
- value: data?.default_settings?.cfg_rescale_multiplier || initialCfgRescaleMultiplier,
- },
- };
- }, [
- data?.default_settings,
- initialSteps,
- initialCfg,
- initialScheduler,
- initialCfgRescaleMultiplier,
- initialVaePrecision,
- ]);
-
- if (isLoading) {
- return {t('common.loading')};
- }
-
- return ;
-};
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultCfgRescaleMultiplier.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultCfgRescaleMultiplier.tsx
similarity index 98%
rename from invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultCfgRescaleMultiplier.tsx
rename to invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultCfgRescaleMultiplier.tsx
index 5e1cfe990a..f27885aa81 100644
--- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultCfgRescaleMultiplier.tsx
+++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultCfgRescaleMultiplier.tsx
@@ -1,7 +1,7 @@
import { CompositeNumberInput, CompositeSlider, Flex, FormControl, FormLabel } from '@invoke-ai/ui-library';
import { useAppSelector } from 'app/store/storeHooks';
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
-import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/SettingToggle';
+import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/SettingToggle';
import { useCallback, useMemo } from 'react';
import type { UseControllerProps } from 'react-hook-form';
import { useController } from 'react-hook-form';
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultCfgScale.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultCfgScale.tsx
similarity index 98%
rename from invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultCfgScale.tsx
rename to invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultCfgScale.tsx
index a1bb34868b..131d85ac27 100644
--- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultCfgScale.tsx
+++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultCfgScale.tsx
@@ -1,7 +1,7 @@
import { CompositeNumberInput, CompositeSlider, Flex, FormControl, FormLabel } from '@invoke-ai/ui-library';
import { useAppSelector } from 'app/store/storeHooks';
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
-import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/SettingToggle';
+import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/SettingToggle';
import { useCallback, useMemo } from 'react';
import type { UseControllerProps } from 'react-hook-form';
import { useController } from 'react-hook-form';
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultScheduler.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultScheduler.tsx
similarity index 97%
rename from invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultScheduler.tsx
rename to invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultScheduler.tsx
index d195b2cc38..145f670e54 100644
--- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultScheduler.tsx
+++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultScheduler.tsx
@@ -1,7 +1,7 @@
import type { ComboboxOnChange } from '@invoke-ai/ui-library';
import { Combobox, Flex, FormControl, FormLabel } from '@invoke-ai/ui-library';
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
-import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/SettingToggle';
+import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/SettingToggle';
import { SCHEDULER_OPTIONS } from 'features/parameters/types/constants';
import { isParameterScheduler } from 'features/parameters/types/parameterSchemas';
import { useCallback, useMemo } from 'react';
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultSettingsForm.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultSettingsForm.tsx
similarity index 100%
rename from invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultSettingsForm.tsx
rename to invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultSettingsForm.tsx
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultSteps.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultSteps.tsx
similarity index 98%
rename from invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultSteps.tsx
rename to invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultSteps.tsx
index 37282564b5..c366fe1237 100644
--- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultSteps.tsx
+++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultSteps.tsx
@@ -1,7 +1,7 @@
import { CompositeNumberInput, CompositeSlider, Flex, FormControl, FormLabel } from '@invoke-ai/ui-library';
import { useAppSelector } from 'app/store/storeHooks';
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
-import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/SettingToggle';
+import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/SettingToggle';
import { useCallback, useMemo } from 'react';
import type { UseControllerProps } from 'react-hook-form';
import { useController } from 'react-hook-form';
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultVae.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultVae.tsx
similarity index 98%
rename from invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultVae.tsx
rename to invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultVae.tsx
index d00f6b212f..612ea32690 100644
--- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultVae.tsx
+++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultVae.tsx
@@ -3,7 +3,7 @@ import { Combobox, Flex, FormControl, FormLabel } from '@invoke-ai/ui-library';
import { skipToken } from '@reduxjs/toolkit/query';
import { useAppSelector } from 'app/store/storeHooks';
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
-import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/SettingToggle';
+import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/SettingToggle';
import { map } from 'lodash-es';
import { useCallback, useMemo } from 'react';
import type { UseControllerProps } from 'react-hook-form';
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultVaePrecision.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultVaePrecision.tsx
similarity index 97%
rename from invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultVaePrecision.tsx
rename to invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultVaePrecision.tsx
index b5cfe6f81e..9c7286540b 100644
--- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/DefaultVaePrecision.tsx
+++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultVaePrecision.tsx
@@ -1,7 +1,7 @@
import type { ComboboxOnChange } from '@invoke-ai/ui-library';
import { Combobox, Flex, FormControl, FormLabel } from '@invoke-ai/ui-library';
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
-import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/SettingToggle';
+import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/SettingToggle';
import { isParameterPrecision } from 'features/parameters/types/parameterSchemas';
import { useCallback, useMemo } from 'react';
import type { UseControllerProps } from 'react-hook-form';
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx
new file mode 100644
index 0000000000..54563bf63f
--- /dev/null
+++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx
@@ -0,0 +1,144 @@
+import { Button, Flex, Heading, Text } from '@invoke-ai/ui-library';
+import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
+import { useMainModelDefaultSettings } from 'features/modelManagerV2/hooks/useMainModelDefaultSettings';
+import type { ParameterScheduler } from 'features/parameters/types/parameterSchemas';
+import { addToast } from 'features/system/store/systemSlice';
+import { makeToast } from 'features/system/util/makeToast';
+import { useCallback } from 'react';
+import type { SubmitHandler } from 'react-hook-form';
+import { useForm } from 'react-hook-form';
+import { useTranslation } from 'react-i18next';
+import { PiCheckBold } from 'react-icons/pi';
+import { useUpdateModelMutation } from 'services/api/endpoints/models';
+
+import { DefaultCfgRescaleMultiplier } from './DefaultCfgRescaleMultiplier';
+import { DefaultCfgScale } from './DefaultCfgScale';
+import { DefaultScheduler } from './DefaultScheduler';
+import { DefaultSteps } from './DefaultSteps';
+import { DefaultVae } from './DefaultVae';
+import { DefaultVaePrecision } from './DefaultVaePrecision';
+interface FormField {
+ value: T;
+ isEnabled: boolean;
+}
+
+type DefaultSettingsFormData = {
+ vae: FormField;
+ vaePrecision: FormField;
+ scheduler: FormField;
+ steps: FormField;
+ cfgScale: FormField;
+ cfgRescaleMultiplier: FormField;
+};
+
+export const MainModelDefaultSettings = () => {
+ const selectedModelKey = useAppSelector((s) => s.modelmanagerV2.selectedModelKey);
+ const { t } = useTranslation();
+ const dispatch = useAppDispatch();
+
+ const { defaultSettingsDefaults, isLoading: isLoadingDefaultSettings } =
+ useMainModelDefaultSettings(selectedModelKey);
+
+ const [updateModel, { isLoading: isLoadingUpdateModel }] = useUpdateModelMutation();
+
+ const { handleSubmit, control, formState, reset } = useForm({
+ defaultValues: defaultSettingsDefaults,
+ });
+
+ const onSubmit = useCallback>(
+ (data) => {
+ if (!selectedModelKey) {
+ return;
+ }
+
+ const body = {
+ vae: data.vae.isEnabled ? data.vae.value : null,
+ vae_precision: data.vaePrecision.isEnabled ? data.vaePrecision.value : null,
+ cfg_scale: data.cfgScale.isEnabled ? data.cfgScale.value : null,
+ cfg_rescale_multiplier: data.cfgRescaleMultiplier.isEnabled ? data.cfgRescaleMultiplier.value : null,
+ steps: data.steps.isEnabled ? data.steps.value : null,
+ scheduler: data.scheduler.isEnabled ? data.scheduler.value : null,
+ };
+
+ updateModel({
+ key: selectedModelKey,
+ body: { default_settings: body },
+ })
+ .unwrap()
+ .then((_) => {
+ dispatch(
+ addToast(
+ makeToast({
+ title: t('modelManager.defaultSettingsSaved'),
+ status: 'success',
+ })
+ )
+ );
+ reset(data);
+ })
+ .catch((error) => {
+ if (error) {
+ dispatch(
+ addToast(
+ makeToast({
+ title: `${error.data.detail} `,
+ status: 'error',
+ })
+ )
+ );
+ }
+ });
+ },
+ [selectedModelKey, dispatch, reset, updateModel, t]
+ );
+
+ if (isLoadingDefaultSettings) {
+ return {t('common.loading')};
+ }
+
+ return (
+ <>
+
+ {t('modelManager.defaultSettings')}
+ }
+ colorScheme="invokeYellow"
+ isDisabled={!formState.isDirty}
+ onClick={handleSubmit(onSubmit)}
+ type="submit"
+ isLoading={isLoadingUpdateModel}
+ >
+ {t('common.save')}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+};
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/SettingToggle.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/SettingToggle.tsx
similarity index 100%
rename from invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/DefaultSettings/SettingToggle.tsx
rename to invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/SettingToggle.tsx
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/ModelView.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/ModelView.tsx
index a167823596..a8143f1c19 100644
--- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/ModelView.tsx
+++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/ModelView.tsx
@@ -5,7 +5,7 @@ import { TriggerPhrases } from 'features/modelManagerV2/subpanels/ModelPanel/Tri
import { useTranslation } from 'react-i18next';
import { useGetModelConfigQuery } from 'services/api/endpoints/models';
-import { DefaultSettings } from './DefaultSettings';
+import { MainModelDefaultSettings } from './MainModelDefaultSettings/MainModelDefaultSettings';
import { ModelAttrView } from './ModelAttrView';
export const ModelView = () => {
@@ -61,7 +61,7 @@ export const ModelView = () => {
{data.type === 'main' && (
-
+
)}
{(data.type === 'main' || data.type === 'lora') && (
diff --git a/invokeai/frontend/web/src/services/api/types.ts b/invokeai/frontend/web/src/services/api/types.ts
index 46faa35d8e..2d304a8333 100644
--- a/invokeai/frontend/web/src/services/api/types.ts
+++ b/invokeai/frontend/web/src/services/api/types.ts
@@ -89,6 +89,12 @@ export const isControlAdapterModelConfig = (
return isControlNetModelConfig(config) || isT2IAdapterModelConfig(config) || isIPAdapterModelConfig(config);
};
+export const isControlNetOrT2IAdapterModelConfig = (
+ config: AnyModelConfig
+): config is ControlNetModelConfig | T2IAdapterModelConfig => {
+ return isControlNetModelConfig(config) || isT2IAdapterModelConfig(config);
+};
+
export const isNonRefinerMainModelConfig = (config: AnyModelConfig): config is MainModelConfig => {
return config.type === 'main' && config.base !== 'sdxl-refiner';
};