mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
add modelSelected middleware to clear submodels on base_model change
This commit is contained in:
committed by
psychedelicious
parent
b9a1aa38e3
commit
a9a4081f51
@ -2,7 +2,6 @@ import { useAppDispatch } from 'app/store/storeHooks';
|
||||
import { useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
modelSelected,
|
||||
setCfgScale,
|
||||
setHeight,
|
||||
setImg2imgStrength,
|
||||
@ -14,7 +13,7 @@ import {
|
||||
setWidth,
|
||||
} from '../store/generationSlice';
|
||||
import { isImageField } from 'services/api/guards';
|
||||
import { initialImageSelected } from '../store/actions';
|
||||
import { initialImageSelected, modelSelected } from '../store/actions';
|
||||
import { useAppToaster } from 'app/components/Toaster';
|
||||
import { ImageDTO } from 'services/api/types';
|
||||
import {
|
||||
@ -163,7 +162,7 @@ export const useRecallParameters = () => {
|
||||
parameterNotSetToast();
|
||||
return;
|
||||
}
|
||||
dispatch(modelSelected(model));
|
||||
dispatch(modelSelected(model?.id || ''));
|
||||
parameterSetToast();
|
||||
},
|
||||
[dispatch, parameterSetToast, parameterNotSetToast]
|
||||
|
@ -4,3 +4,5 @@ import { ImageDTO } from 'services/api/types';
|
||||
export const initialImageSelected = createAction<ImageDTO | string | undefined>(
|
||||
'generation/initialImageSelected'
|
||||
);
|
||||
|
||||
export const modelSelected = createAction<string>('generation/modelSelected');
|
||||
|
@ -223,6 +223,9 @@ export const generationSlice = createSlice({
|
||||
|
||||
state.model = { id: action.payload, base_model, name, type };
|
||||
},
|
||||
modelChanged: (state, action: PayloadAction<ModelParam>) => {
|
||||
state.model = action.payload;
|
||||
},
|
||||
vaeSelected: (state, action: PayloadAction<string>) => {
|
||||
state.vae = action.payload;
|
||||
},
|
||||
@ -282,7 +285,7 @@ export const {
|
||||
setHorizontalSymmetrySteps,
|
||||
setVerticalSymmetrySteps,
|
||||
initialImageChanged,
|
||||
modelSelected,
|
||||
modelChanged,
|
||||
vaeSelected,
|
||||
setShouldUseNoiseSettings,
|
||||
setSeamlessXAxis,
|
||||
|
Reference in New Issue
Block a user