From a2f49ef7c1afa1dc5b8c1475c8c693bed412fced Mon Sep 17 00:00:00 2001 From: chainchompa Date: Tue, 23 Jul 2024 10:22:38 -0400 Subject: [PATCH] cleanup esrgan frontend code --- invokeai/frontend/web/src/app/store/store.ts | 3 -- .../util/graph/buildAdHocUpscaleGraph.ts | 2 +- .../features/nodes/util/graph/constants.ts | 1 - .../components/Upscale/ParamSimpleUpscale.tsx | 2 +- .../parameters/store/postprocessingSlice.ts | 53 ------------------- 5 files changed, 2 insertions(+), 59 deletions(-) delete mode 100644 invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts diff --git a/invokeai/frontend/web/src/app/store/store.ts b/invokeai/frontend/web/src/app/store/store.ts index 1a4093dfc5..6ae2011355 100644 --- a/invokeai/frontend/web/src/app/store/store.ts +++ b/invokeai/frontend/web/src/app/store/store.ts @@ -25,7 +25,6 @@ import { nodesPersistConfig, nodesSlice, nodesUndoableConfig } from 'features/no import { workflowSettingsPersistConfig, workflowSettingsSlice } from 'features/nodes/store/workflowSettingsSlice'; import { workflowPersistConfig, workflowSlice } from 'features/nodes/store/workflowSlice'; 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 { queueSlice } from 'features/queue/store/queueSlice'; import { sdxlPersistConfig, sdxlSlice } from 'features/sdxl/store/sdxlSlice'; @@ -53,7 +52,6 @@ const allReducers = { [gallerySlice.name]: gallerySlice.reducer, [generationSlice.name]: generationSlice.reducer, [nodesSlice.name]: undoable(nodesSlice.reducer, nodesUndoableConfig), - [postprocessingSlice.name]: postprocessingSlice.reducer, [systemSlice.name]: systemSlice.reducer, [configSlice.name]: configSlice.reducer, [uiSlice.name]: uiSlice.reducer, @@ -104,7 +102,6 @@ const persistConfigs: { [key in keyof typeof allReducers]?: PersistConfig } = { [galleryPersistConfig.name]: galleryPersistConfig, [generationPersistConfig.name]: generationPersistConfig, [nodesPersistConfig.name]: nodesPersistConfig, - [postprocessingPersistConfig.name]: postprocessingPersistConfig, [systemPersistConfig.name]: systemPersistConfig, [workflowPersistConfig.name]: workflowPersistConfig, [uiPersistConfig.name]: uiPersistConfig, diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/buildAdHocUpscaleGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildAdHocUpscaleGraph.ts index e23d6c49d7..0fae75491f 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/buildAdHocUpscaleGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/buildAdHocUpscaleGraph.ts @@ -37,4 +37,4 @@ export const buildAdHocUpscaleGraph = ({ image, state }: Arg): Graph => { }); return graph; -}; \ No newline at end of file +}; diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/constants.ts b/invokeai/frontend/web/src/features/nodes/util/graph/constants.ts index 200b8305e3..5bc2192f53 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/constants.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/constants.ts @@ -36,7 +36,6 @@ export const CONTROL_NET_COLLECT = 'control_net_collect'; export const IP_ADAPTER_COLLECT = 'ip_adapter_collect'; export const T2I_ADAPTER_COLLECT = 't2i_adapter_collect'; export const METADATA = 'core_metadata'; -export const ESRGAN = 'esrgan'; export const SPANDREL = 'spandrel'; export const SDXL_MODEL_LOADER = 'sdxl_model_loader'; export const SDXL_DENOISE_LATENTS = 'sdxl_denoise_latents'; diff --git a/invokeai/frontend/web/src/features/parameters/components/Upscale/ParamSimpleUpscale.tsx b/invokeai/frontend/web/src/features/parameters/components/Upscale/ParamSimpleUpscale.tsx index 19a622fc0c..b5712b54f6 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Upscale/ParamSimpleUpscale.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Upscale/ParamSimpleUpscale.tsx @@ -43,4 +43,4 @@ const ParamSimpleUpscale = () => { ); }; -export default memo(ParamSimpleUpscale); \ No newline at end of file +export default memo(ParamSimpleUpscale); diff --git a/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts b/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts deleted file mode 100644 index c15bf982b8..0000000000 --- a/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts +++ /dev/null @@ -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; -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) => { - 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 = { - name: postprocessingSlice.name, - initialState: initialPostprocessingState, - migrate: migratePostprocessingState, - persistDenylist: [], -};