diff --git a/frontend/src/app/socketio/emitters.ts b/frontend/src/app/socketio/emitters.ts index fcae683e82..de097dc2ce 100644 --- a/frontend/src/app/socketio/emitters.ts +++ b/frontend/src/app/socketio/emitters.ts @@ -13,7 +13,9 @@ import { import { OptionsState } from 'features/options/optionsSlice'; import { addLogEntry, + generationRequested, modelChangeRequested, + setCurrentStatus, setIsProcessing, } from 'features/system/systemSlice'; import { InvokeTabName } from 'features/tabs/InvokeTabs'; @@ -52,24 +54,7 @@ const makeSocketIOEmitters = ( systemState, }; - // if (generationMode === 'inpainting') { - // const initialCanvasImage = initialCanvasImageSelector(getState()); - // const imageUrl = initialCanvasImage?.image.url; - - // if (!imageUrl) { - // dispatch( - // addLogEntry({ - // timestamp: dateFormat(new Date(), 'isoDateTime'), - // message: 'Inpainting image not loaded, cannot generate image.', - // level: 'error', - // }) - // ); - // dispatch(errorOccurred()); - // return; - // } - - // frontendToBackendParametersConfig.imageToProcessUrl = imageUrl; - // } else + dispatch(generationRequested()); if (!['txt2img', 'img2img'].includes(generationMode)) { if (!galleryState.currentImage?.url) return; diff --git a/frontend/src/features/system/systemSlice.ts b/frontend/src/features/system/systemSlice.ts index 3b1feb9e61..1dff43ce17 100644 --- a/frontend/src/features/system/systemSlice.ts +++ b/frontend/src/features/system/systemSlice.ts @@ -175,6 +175,16 @@ export const systemSlice = createSlice({ state.currentStatusHasSteps = false; state.currentStatus = 'Processing canceled'; }, + generationRequested: (state) => { + state.isProcessing = true; + state.isCancelable = true; + state.currentStep = 0; + state.totalSteps = 0; + state.currentIteration = 0; + state.totalIterations = 0; + state.currentStatusHasSteps = false; + state.currentStatus = 'Preparing'; + }, setModelList: ( state, action: PayloadAction> @@ -220,6 +230,7 @@ export const { modelChangeRequested, setSaveIntermediatesInterval, setEnableImageDebugging, + generationRequested, } = systemSlice.actions; export default systemSlice.reducer;