feat(ui): auto-select controlnet processor

- when the controlnet model is changed, if there is a default processor for the model set, the processor is changed.
- once a control image is selected (and processed), changing the model does not change the processor - must be manually changed
This commit is contained in:
psychedelicious 2023-06-06 20:57:44 +10:00
parent fa1ac57c90
commit 6245a27650

View File

@ -9,6 +9,7 @@ import {
} from './types';
import {
CONTROLNET_MODELS,
CONTROLNET_MODEL_MAP,
CONTROLNET_PROCESSORS,
ControlNetModel,
} from './constants';
@ -135,6 +136,16 @@ export const controlNetSlice = createSlice({
) => {
const { controlNetId, model } = action.payload;
state.controlNets[controlNetId].model = model;
if (!state.controlNets[controlNetId].controlImage) {
const processorType = CONTROLNET_MODEL_MAP[model];
if (processorType) {
state.controlNets[controlNetId].processorType = processorType;
state.controlNets[controlNetId].processorNode = CONTROLNET_PROCESSORS[
processorType
].default as RequiredControlNetProcessorNode;
}
}
},
controlNetWeightChanged: (
state,