Fixes crash related to old value of progress_latents in state

This commit is contained in:
psychedelicious 2022-11-02 15:27:46 +11:00 committed by Lincoln Stein
parent 42a02bbb80
commit 1e51c39928
2 changed files with 19 additions and 13 deletions

View File

@ -1,5 +1,7 @@
// TODO: use Enums? // TODO: use Enums?
import { InProgressImageType } from '../features/system/systemSlice';
// Valid samplers // Valid samplers
export const SAMPLERS: Array<string> = [ export const SAMPLERS: Array<string> = [
'ddim', 'ddim',
@ -38,8 +40,11 @@ export const NUMPY_RAND_MAX = 4294967295;
export const FACETOOL_TYPES = ['gfpgan', 'codeformer'] as const; export const FACETOOL_TYPES = ['gfpgan', 'codeformer'] as const;
export const IN_PROGRESS_IMAGE_TYPES: Array<{ key: string; value: string }> = [ export const IN_PROGRESS_IMAGE_TYPES: Array<{
{ key: "None", value: 'none'}, key: string;
{ key: "Fast", value: 'latents' }, value: InProgressImageType;
{ key: "Accurate", value: 'full-res' } }> = [
{ key: 'None', value: 'none' },
{ key: 'Fast', value: 'latents' },
{ key: 'Accurate', value: 'full-res' },
]; ];

View File

@ -20,10 +20,12 @@ export type ReadinessPayload = {
reasonsWhyNotReady: string[]; reasonsWhyNotReady: string[];
}; };
export type InProgressImageType = 'none' | 'full-res' | 'latents';
export interface SystemState export interface SystemState
extends InvokeAI.SystemStatus, extends InvokeAI.SystemStatus,
InvokeAI.SystemConfig { InvokeAI.SystemConfig {
shouldDisplayInProgressType: string; shouldDisplayInProgressType: InProgressImageType;
log: Array<LogEntry>; log: Array<LogEntry>;
shouldShowLogViewer: boolean; shouldShowLogViewer: boolean;
isGFPGANAvailable: boolean; isGFPGANAvailable: boolean;
@ -43,12 +45,12 @@ export interface SystemState
isCancelable: boolean; isCancelable: boolean;
} }
const initialSystemState = { const initialSystemState: SystemState = {
isConnected: false, isConnected: false,
isProcessing: false, isProcessing: false,
log: [], log: [],
shouldShowLogViewer: false, shouldShowLogViewer: false,
shouldDisplayInProgressType: "none", shouldDisplayInProgressType: 'none',
shouldDisplayGuides: true, shouldDisplayGuides: true,
isGFPGANAvailable: true, isGFPGANAvailable: true,
isESRGANAvailable: true, isESRGANAvailable: true,
@ -70,17 +72,16 @@ const initialSystemState = {
hasError: false, hasError: false,
wasErrorSeen: true, wasErrorSeen: true,
isCancelable: true, isCancelable: true,
isReady: false,
reasonsWhyNotReady: [],
}; };
const initialState: SystemState = initialSystemState;
export const systemSlice = createSlice({ export const systemSlice = createSlice({
name: 'system', name: 'system',
initialState, initialState: initialSystemState,
reducers: { reducers: {
setShouldDisplayInProgressType: (state, action: PayloadAction<string>) => { setShouldDisplayInProgressType: (
state,
action: PayloadAction<InProgressImageType>
) => {
state.shouldDisplayInProgressType = action.payload; state.shouldDisplayInProgressType = action.payload;
}, },
setIsProcessing: (state, action: PayloadAction<boolean>) => { setIsProcessing: (state, action: PayloadAction<boolean>) => {