fix: Clamp clipskip value when model changes

This commit is contained in:
blessedcoolant 2023-07-07 19:29:11 +12:00
parent a4dec53b4d
commit 53cb200f85
2 changed files with 8 additions and 1 deletions

View File

@ -5,7 +5,7 @@ import { setClipSkip } from 'features/parameters/store/generationSlice';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
const clipSkipMap = {
export const clipSkipMap = {
'sd-1': {
maxClip: 12,
markers: [0, 1, 2, 3, 4, 8, 12],

View File

@ -5,6 +5,7 @@ import { configChanged } from 'features/system/store/configSlice';
import { setShouldShowAdvancedOptions } from 'features/ui/store/uiSlice';
import { clamp } from 'lodash-es';
import { ImageDTO } from 'services/api/types';
import { clipSkipMap } from '../components/Parameters/Advanced/ParamClipSkip';
import {
CfgScaleParam,
HeightParam,
@ -216,6 +217,12 @@ export const generationSlice = createSlice({
},
modelSelected: (state, action: PayloadAction<string>) => {
state.model = action.payload;
// Clamp ClipSkip Based On Selected Model
const clipSkipMax =
clipSkipMap[action.payload.split('/')[0] as keyof typeof clipSkipMap]
.maxClip;
state.clipSkip = clamp(state.clipSkip, 0, clipSkipMax);
},
vaeSelected: (state, action: PayloadAction<string>) => {
state.vae = action.payload;