cleanup esrgan frontend code

This commit is contained in:
chainchompa 2024-07-23 10:22:38 -04:00
parent c098edc6b2
commit a2f49ef7c1
5 changed files with 2 additions and 59 deletions

View File

@ -25,7 +25,6 @@ import { nodesPersistConfig, nodesSlice, nodesUndoableConfig } from 'features/no
import { workflowSettingsPersistConfig, workflowSettingsSlice } from 'features/nodes/store/workflowSettingsSlice'; import { workflowSettingsPersistConfig, workflowSettingsSlice } from 'features/nodes/store/workflowSettingsSlice';
import { workflowPersistConfig, workflowSlice } from 'features/nodes/store/workflowSlice'; import { workflowPersistConfig, workflowSlice } from 'features/nodes/store/workflowSlice';
import { generationPersistConfig, generationSlice } from 'features/parameters/store/generationSlice'; import { generationPersistConfig, generationSlice } from 'features/parameters/store/generationSlice';
import { postprocessingPersistConfig, postprocessingSlice } from 'features/parameters/store/postprocessingSlice';
import { upscalePersistConfig, upscaleSlice } from 'features/parameters/store/upscaleSlice'; import { upscalePersistConfig, upscaleSlice } from 'features/parameters/store/upscaleSlice';
import { queueSlice } from 'features/queue/store/queueSlice'; import { queueSlice } from 'features/queue/store/queueSlice';
import { sdxlPersistConfig, sdxlSlice } from 'features/sdxl/store/sdxlSlice'; import { sdxlPersistConfig, sdxlSlice } from 'features/sdxl/store/sdxlSlice';
@ -53,7 +52,6 @@ const allReducers = {
[gallerySlice.name]: gallerySlice.reducer, [gallerySlice.name]: gallerySlice.reducer,
[generationSlice.name]: generationSlice.reducer, [generationSlice.name]: generationSlice.reducer,
[nodesSlice.name]: undoable(nodesSlice.reducer, nodesUndoableConfig), [nodesSlice.name]: undoable(nodesSlice.reducer, nodesUndoableConfig),
[postprocessingSlice.name]: postprocessingSlice.reducer,
[systemSlice.name]: systemSlice.reducer, [systemSlice.name]: systemSlice.reducer,
[configSlice.name]: configSlice.reducer, [configSlice.name]: configSlice.reducer,
[uiSlice.name]: uiSlice.reducer, [uiSlice.name]: uiSlice.reducer,
@ -104,7 +102,6 @@ const persistConfigs: { [key in keyof typeof allReducers]?: PersistConfig } = {
[galleryPersistConfig.name]: galleryPersistConfig, [galleryPersistConfig.name]: galleryPersistConfig,
[generationPersistConfig.name]: generationPersistConfig, [generationPersistConfig.name]: generationPersistConfig,
[nodesPersistConfig.name]: nodesPersistConfig, [nodesPersistConfig.name]: nodesPersistConfig,
[postprocessingPersistConfig.name]: postprocessingPersistConfig,
[systemPersistConfig.name]: systemPersistConfig, [systemPersistConfig.name]: systemPersistConfig,
[workflowPersistConfig.name]: workflowPersistConfig, [workflowPersistConfig.name]: workflowPersistConfig,
[uiPersistConfig.name]: uiPersistConfig, [uiPersistConfig.name]: uiPersistConfig,

View File

@ -36,7 +36,6 @@ export const CONTROL_NET_COLLECT = 'control_net_collect';
export const IP_ADAPTER_COLLECT = 'ip_adapter_collect'; export const IP_ADAPTER_COLLECT = 'ip_adapter_collect';
export const T2I_ADAPTER_COLLECT = 't2i_adapter_collect'; export const T2I_ADAPTER_COLLECT = 't2i_adapter_collect';
export const METADATA = 'core_metadata'; export const METADATA = 'core_metadata';
export const ESRGAN = 'esrgan';
export const SPANDREL = 'spandrel'; export const SPANDREL = 'spandrel';
export const SDXL_MODEL_LOADER = 'sdxl_model_loader'; export const SDXL_MODEL_LOADER = 'sdxl_model_loader';
export const SDXL_DENOISE_LATENTS = 'sdxl_denoise_latents'; export const SDXL_DENOISE_LATENTS = 'sdxl_denoise_latents';

View File

@ -1,53 +0,0 @@
import type { PayloadAction } from '@reduxjs/toolkit';
import { createSlice } from '@reduxjs/toolkit';
import type { PersistConfig, RootState } from 'app/store/store';
import { z } from 'zod';
const zParamESRGANModelName = z.enum([
'RealESRGAN_x4plus.pth',
'RealESRGAN_x4plus_anime_6B.pth',
'ESRGAN_SRx4_DF2KOST_official-ff704c30.pth',
'RealESRGAN_x2plus.pth',
]);
type ParamESRGANModelName = z.infer<typeof zParamESRGANModelName>;
export const isParamESRGANModelName = (v: unknown): v is ParamESRGANModelName =>
zParamESRGANModelName.safeParse(v).success;
interface PostprocessingState {
_version: 1;
esrganModelName: ParamESRGANModelName;
}
const initialPostprocessingState: PostprocessingState = {
_version: 1,
esrganModelName: 'RealESRGAN_x4plus.pth',
};
export const postprocessingSlice = createSlice({
name: 'postprocessing',
initialState: initialPostprocessingState,
reducers: {
esrganModelNameChanged: (state, action: PayloadAction<ParamESRGANModelName>) => {
state.esrganModelName = action.payload;
},
},
});
export const { esrganModelNameChanged } = postprocessingSlice.actions;
export const selectPostprocessingSlice = (state: RootState) => state.postprocessing;
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
const migratePostprocessingState = (state: any): any => {
if (!('_version' in state)) {
state._version = 1;
}
return state;
};
export const postprocessingPersistConfig: PersistConfig<PostprocessingState> = {
name: postprocessingSlice.name,
initialState: initialPostprocessingState,
migrate: migratePostprocessingState,
persistDenylist: [],
};