mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: Create SDXL Slice
This commit is contained in:
parent
9c180da58a
commit
9f94d0e52a
@ -15,6 +15,7 @@ import loraReducer from 'features/lora/store/loraSlice';
|
|||||||
import nodesReducer from 'features/nodes/store/nodesSlice';
|
import nodesReducer from 'features/nodes/store/nodesSlice';
|
||||||
import generationReducer from 'features/parameters/store/generationSlice';
|
import generationReducer from 'features/parameters/store/generationSlice';
|
||||||
import postprocessingReducer from 'features/parameters/store/postprocessingSlice';
|
import postprocessingReducer from 'features/parameters/store/postprocessingSlice';
|
||||||
|
import sdxlReducer from 'features/sdxl/store/sdxlSlice';
|
||||||
import configReducer from 'features/system/store/configSlice';
|
import configReducer from 'features/system/store/configSlice';
|
||||||
import systemReducer from 'features/system/store/systemSlice';
|
import systemReducer from 'features/system/store/systemSlice';
|
||||||
import modelmanagerReducer from 'features/ui/components/tabs/ModelManager/store/modelManagerSlice';
|
import modelmanagerReducer from 'features/ui/components/tabs/ModelManager/store/modelManagerSlice';
|
||||||
@ -47,6 +48,7 @@ const allReducers = {
|
|||||||
imageDeletion: imageDeletionReducer,
|
imageDeletion: imageDeletionReducer,
|
||||||
lora: loraReducer,
|
lora: loraReducer,
|
||||||
modelmanager: modelmanagerReducer,
|
modelmanager: modelmanagerReducer,
|
||||||
|
sdxl: sdxlReducer,
|
||||||
[api.reducerPath]: api.reducer,
|
[api.reducerPath]: api.reducer,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -58,6 +60,7 @@ const rememberedKeys: (keyof typeof allReducers)[] = [
|
|||||||
'canvas',
|
'canvas',
|
||||||
'gallery',
|
'gallery',
|
||||||
'generation',
|
'generation',
|
||||||
|
'sdxl',
|
||||||
'nodes',
|
'nodes',
|
||||||
'postprocessing',
|
'postprocessing',
|
||||||
'system',
|
'system',
|
||||||
|
@ -42,6 +42,42 @@ export const isValidNegativePrompt = (
|
|||||||
val: unknown
|
val: unknown
|
||||||
): val is NegativePromptParam => zNegativePrompt.safeParse(val).success;
|
): val is NegativePromptParam => zNegativePrompt.safeParse(val).success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zod schema for SDXL positive style prompt parameter
|
||||||
|
*/
|
||||||
|
export const zPositiveStylePromptSDXL = z.string();
|
||||||
|
/**
|
||||||
|
* Type alias for SDXL positive style prompt parameter, inferred from its zod schema
|
||||||
|
*/
|
||||||
|
export type PositiveStylePromptSDXLParam = z.infer<
|
||||||
|
typeof zPositiveStylePromptSDXL
|
||||||
|
>;
|
||||||
|
/**
|
||||||
|
* Validates/type-guards a value as a SDXL positive style prompt parameter
|
||||||
|
*/
|
||||||
|
export const isValidSDXLPositiveStylePrompt = (
|
||||||
|
val: unknown
|
||||||
|
): val is PositiveStylePromptSDXLParam =>
|
||||||
|
zPositiveStylePromptSDXL.safeParse(val).success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zod schema for SDXL negative style prompt parameter
|
||||||
|
*/
|
||||||
|
export const zNegativeStylePromptSDXL = z.string();
|
||||||
|
/**
|
||||||
|
* Type alias for SDXL negative style prompt parameter, inferred from its zod schema
|
||||||
|
*/
|
||||||
|
export type NegativeStylePromptSDXLParam = z.infer<
|
||||||
|
typeof zNegativeStylePromptSDXL
|
||||||
|
>;
|
||||||
|
/**
|
||||||
|
* Validates/type-guards a value as a SDXL negative style prompt parameter
|
||||||
|
*/
|
||||||
|
export const isValidSDXLNegativeStylePrompt = (
|
||||||
|
val: unknown
|
||||||
|
): val is NegativeStylePromptSDXLParam =>
|
||||||
|
zNegativeStylePromptSDXL.safeParse(val).success;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zod schema for steps parameter
|
* Zod schema for steps parameter
|
||||||
*/
|
*/
|
||||||
|
41
invokeai/frontend/web/src/features/sdxl/store/sdxlSlice.ts
Normal file
41
invokeai/frontend/web/src/features/sdxl/store/sdxlSlice.ts
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import { PayloadAction, createSlice } from '@reduxjs/toolkit';
|
||||||
|
import {
|
||||||
|
NegativeStylePromptSDXLParam,
|
||||||
|
PositiveStylePromptSDXLParam,
|
||||||
|
} from 'features/parameters/types/parameterSchemas';
|
||||||
|
|
||||||
|
type SDXLInitialState = {
|
||||||
|
shouldUseSDXLRefiner: boolean;
|
||||||
|
positiveStylePrompt: PositiveStylePromptSDXLParam;
|
||||||
|
negativeStylePrompt: NegativeStylePromptSDXLParam;
|
||||||
|
};
|
||||||
|
|
||||||
|
const sdxlInitialState: SDXLInitialState = {
|
||||||
|
shouldUseSDXLRefiner: false,
|
||||||
|
positiveStylePrompt: '',
|
||||||
|
negativeStylePrompt: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
const sdxlSlice = createSlice({
|
||||||
|
name: 'sdxl',
|
||||||
|
initialState: sdxlInitialState,
|
||||||
|
reducers: {
|
||||||
|
setPositiveStylePromptSDXL: (state, action: PayloadAction<string>) => {
|
||||||
|
state.positiveStylePrompt = action.payload;
|
||||||
|
},
|
||||||
|
setNegativeStylePromptSDXL: (state, action: PayloadAction<string>) => {
|
||||||
|
state.negativeStylePrompt = action.payload;
|
||||||
|
},
|
||||||
|
setShouldUseSDXLRefiner: (state, action: PayloadAction<boolean>) => {
|
||||||
|
state.shouldUseSDXLRefiner = action.payload;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const {
|
||||||
|
setPositiveStylePromptSDXL,
|
||||||
|
setNegativeStylePromptSDXL,
|
||||||
|
setShouldUseSDXLRefiner,
|
||||||
|
} = sdxlSlice.actions;
|
||||||
|
|
||||||
|
export default sdxlSlice.reducer;
|
Loading…
Reference in New Issue
Block a user