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

View File

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