fix(ui): reset clip skip to 0 if new model is sdxl

Clip skip wasn't actually used in SDXL graphs so enabling it didn't do anything, just a UI quirk.

Closes #5508
This commit is contained in:
psychedelicious 2024-01-23 18:41:14 +11:00 committed by Kent Keirsey
parent 653b820da1
commit 022b32c724

View File

@ -175,8 +175,15 @@ export const generationSlice = createSlice({
}
// Clamp ClipSkip Based On Selected Model
const { maxClip } = CLIP_SKIP_MAP[newModel.base_model];
state.clipSkip = clamp(state.clipSkip, 0, maxClip);
// TODO(psyche): remove this special handling when https://github.com/invoke-ai/InvokeAI/issues/4583 is resolved
// WIP PR here: https://github.com/invoke-ai/InvokeAI/pull/4624
if (newModel.base_model === 'sdxl') {
// We don't support clip skip for SDXL yet - it's not in the graphs
state.clipSkip = 0;
} else {
const { maxClip } = CLIP_SKIP_MAP[newModel.base_model];
state.clipSkip = clamp(state.clipSkip, 0, maxClip);
}
if (action.meta.previousModel?.base_model === newModel.base_model) {
// The base model hasn't changed, we don't need to optimize the size