fix: Circular dependency in Mask Blur Method

This commit is contained in:
blessedcoolant 2023-08-13 21:26:20 +12:00
parent 33779b6339
commit 3ff9961bda
3 changed files with 20 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import IAIMantineSelect from 'common/components/IAIMantineSelect';
import { setMaskBlurMethod } from 'features/parameters/store/generationSlice';
import { useTranslation } from 'react-i18next';
export type MaskBlurMethods = 'box' | 'gaussian';
type MaskBlurMethods = 'box' | 'gaussian';
const maskBlurMethods: SelectItem[] = [
{ label: 'Box Blur', value: 'box' },

View File

@ -4,12 +4,13 @@ import { roundToMultiple } from 'common/util/roundDownToMultiple';
import { configChanged } from 'features/system/store/configSlice';
import { clamp } from 'lodash-es';
import { ImageDTO } from 'services/api/types';
import { MaskBlurMethods } from '../components/Parameters/Canvas/MaskAdjustment/ParamMaskBlurMethod';
import { clipSkipMap } from '../types/constants';
import {
CfgScaleParam,
HeightParam,
MainModelParam,
MaskBlurMethodParam,
NegativePromptParam,
OnnxModelParam,
PositivePromptParam,
@ -35,7 +36,7 @@ export interface GenerationState {
negativePrompt: NegativePromptParam;
scheduler: SchedulerParam;
maskBlur: number;
maskBlurMethod: MaskBlurMethods;
maskBlurMethod: MaskBlurMethodParam;
seed: SeedParam;
seedWeights: string;
shouldFitToWidthHeight: boolean;
@ -196,7 +197,7 @@ export const generationSlice = createSlice({
setMaskBlur: (state, action: PayloadAction<number>) => {
state.maskBlur = action.payload;
},
setMaskBlurMethod: (state, action: PayloadAction<MaskBlurMethods>) => {
setMaskBlurMethod: (state, action: PayloadAction<MaskBlurMethodParam>) => {
state.maskBlurMethod = action.payload;
},
setTileSize: (state, action: PayloadAction<number>) => {

View File

@ -385,6 +385,21 @@ export const isValidSDXLRefinerStart = (
val: unknown
): val is SDXLRefinerStartParam => zSDXLRefinerstart.safeParse(val).success;
/**
* Zod schema for a mask blur method parameter
*/
export const zMaskBlurMethod = z.enum(['box', 'gaussian']);
/**
* Type alias for mask blur method parameter, inferred from its zod schema
*/
export type MaskBlurMethodParam = z.infer<typeof zMaskBlurMethod>;
/**
* Validates/type-guards a value as a mask blur method parameter
*/
export const isValidMaskBlurMethod = (
val: unknown
): val is MaskBlurMethodParam => zMaskBlurMethod.safeParse(val).success;
// /**
// * Zod schema for BaseModelType
// */