feat(ui): on base model change, disable control adapters

Previously it deleted them entirely.
This commit is contained in:
psychedelicious 2023-10-07 18:22:18 +11:00
parent 82e8b92ba0
commit 1cc686734b
2 changed files with 14 additions and 9 deletions

View File

@ -1106,7 +1106,8 @@
},
"toast": {
"addedToBoard": "Added to board",
"baseModelChangedCleared": "Base model changed, cleared",
"baseModelChangedCleared_one": "Base model changed, cleared or disabled {{number}} incompatible submodel",
"baseModelChangedCleared_many": "$t(toast.baseModelChangedCleared_one)s",
"canceled": "Processing Canceled",
"canvasCopiedClipboard": "Canvas Copied to Clipboard",
"canvasDownloaded": "Canvas Downloaded",
@ -1126,7 +1127,6 @@
"imageSavingFailed": "Image Saving Failed",
"imageUploaded": "Image Uploaded",
"imageUploadFailed": "Image Upload Failed",
"incompatibleSubmodel": "incompatible submodel",
"initialImageNotSet": "Initial Image Not Set",
"initialImageNotSetDesc": "Could not load initial image",
"initialImageSet": "Initial Image Set",

View File

@ -1,7 +1,7 @@
import { logger } from 'app/logging/logger';
import { setBoundingBoxDimensions } from 'features/canvas/store/canvasSlice';
import {
controlAdapterModelCleared,
controlAdapterIsEnabledChanged,
selectControlAdapterAll,
} from 'features/controlAdapters/store/controlAdaptersSlice';
import { loraRemoved } from 'features/lora/store/loraSlice';
@ -62,7 +62,9 @@ export const addModelSelectedListener = () => {
// handle incompatible controlnets
selectControlAdapterAll(state.controlAdapters).forEach((ca) => {
if (ca.model?.base_model !== base_model) {
dispatch(controlAdapterModelCleared({ id: ca.id }));
dispatch(
controlAdapterIsEnabledChanged({ id: ca.id, isEnabled: false })
);
modelsCleared += 1;
}
});
@ -71,11 +73,14 @@ export const addModelSelectedListener = () => {
dispatch(
addToast(
makeToast({
title: `${t(
'toast.baseModelChangedCleared'
)} ${modelsCleared} ${t('toast.incompatibleSubmodel')}${
modelsCleared === 1 ? '' : 's'
}`,
title: t(
modelsCleared === 1
? 'toast.baseModelChangedCleared_one'
: 'toast.baseModelChangedCleared_many',
{
number: modelsCleared,
}
),
status: 'warning',
})
)