diff --git a/src/main/install-manager.ts b/src/main/install-manager.ts index aaf947b..05149f6 100644 --- a/src/main/install-manager.ts +++ b/src/main/install-manager.ts @@ -40,6 +40,11 @@ export class InstallManager { this.abortController = null; } + logRepairModeMessages = (): void => { + this.log.info('Try installing again with Repair mode enabled to fix this.\r\n'); + this.log.info('Ask for help on Discord or GitHub if you continue to have issues.\r\n'); + }; + getStatus = (): WithTimestamp => { return this.status; }; @@ -188,6 +193,7 @@ export class InstallManager { if (installPythonResult.isErr()) { this.log.error(`Failed to install Python: ${installPythonResult.error.message}\r\n`); + this.logRepairModeMessages(); this.updateStatus({ type: 'error', error: { @@ -258,6 +264,7 @@ export class InstallManager { if (createVenvResult.isErr()) { this.log.error(`Failed to create virtual environment: ${createVenvResult.error.message}\r\n`); + this.logRepairModeMessages(); this.updateStatus({ type: 'error', error: { @@ -308,6 +315,7 @@ export class InstallManager { if (installAppResult.isErr()) { this.log.error(`Failed to install invokeai python package: ${installAppResult.error.message}\r\n`); + this.logRepairModeMessages(); this.updateStatus({ type: 'error', error: { diff --git a/src/renderer/features/InstallFlow/InstallFlowStepReview.tsx b/src/renderer/features/InstallFlow/InstallFlowStepReview.tsx index ea6e97a..c758e57 100644 --- a/src/renderer/features/InstallFlow/InstallFlowStepReview.tsx +++ b/src/renderer/features/InstallFlow/InstallFlowStepReview.tsx @@ -1,15 +1,20 @@ import { Button, + Checkbox, Divider, + Flex, + FormControl, + FormLabel, Heading, ListItem, + Spacer, Text, Tooltip, UnorderedList, - useShiftModifier, } from '@invoke-ai/ui-library'; import { useStore } from '@nanostores/react'; -import { memo } from 'react'; +import type { ChangeEvent } from 'react'; +import { memo, useCallback } from 'react'; import { assert } from 'tsafe'; import { BodyContainer, BodyContent, BodyFooter, BodyHeader } from '@/renderer/common/layout'; @@ -27,10 +32,12 @@ const GPU_LABEL_MAP: Record = { }; export const InstallFlowStepReview = memo(() => { - const { dirDetails, gpuType, release } = useStore(installFlowApi.$choices); + const { dirDetails, gpuType, release, repairMode } = useStore(installFlowApi.$choices); const installType = useStore(installFlowApi.$installType); - const shift = useShiftModifier(); + const onChangeRepairMode = useCallback((e: ChangeEvent) => { + installFlowApi.$choices.set({ ...installFlowApi.$choices.get(), repairMode: e.target.checked }); + }, []); assert(dirDetails !== null); assert(gpuType !== null); @@ -68,32 +75,32 @@ export const InstallFlowStepReview = memo(() => { - {/* {shift && ( - - - - Repair mode forcibly reinstalls python and recreates the virtual environment. - - - )} */} + + + Repair mode can fix installation or update issues. + It reinstalls python and recreates the virtual environment. + + } + > + + + Repair mode + + + + + - {shift && ( - - - - )} - {!shift && ( - - )} + ); diff --git a/src/renderer/features/InstallFlow/state.ts b/src/renderer/features/InstallFlow/state.ts index 621a504..d97f252 100644 --- a/src/renderer/features/InstallFlow/state.ts +++ b/src/renderer/features/InstallFlow/state.ts @@ -23,10 +23,12 @@ const $choices = map<{ dirDetails: DirDetails | null; gpuType: GpuType | null; release: { version: string; isPrerelease: boolean } | null; + repairMode: boolean; }>({ dirDetails: null, gpuType: null, release: null, + repairMode: false, }); const $activeStep = atom(0); @@ -77,7 +79,7 @@ export const installFlowApi = { $activeStep.set(clamp(currentStep - 1, 0, installFlowApi.steps.length - 1)); }, beginFlow: (dirDetails?: DirDetails) => { - $choices.set({ dirDetails: dirDetails ?? null, gpuType: null, release: null }); + $choices.set({ dirDetails: dirDetails ?? null, gpuType: null, release: null, repairMode: false }); $activeStep.set(0); $isStarted.set(true); }, @@ -86,25 +88,20 @@ export const installFlowApi = { dirDetails: null, gpuType: null, release: null, + repairMode: false, }); $activeStep.set(0); $isStarted.set(false); }, - startInstall: (repair?: boolean) => { - const { dirDetails, gpuType, release } = $choices.get(); + startInstall: () => { + const { dirDetails, gpuType, release, repairMode } = $choices.get(); if (!dirDetails || !dirDetails.canInstall || !release || !gpuType) { return; } $installProcessLogs.set([]); - emitter.invoke('install-process:start-install', dirDetails.path, gpuType, release.version, repair); + emitter.invoke('install-process:start-install', dirDetails.path, gpuType, release.version, repairMode); installFlowApi.nextStep(); }, - startInstallWithoutRepair: () => { - installFlowApi.startInstall(false); - }, - startInstallWithRepair: () => { - installFlowApi.startInstall(true); - }, cancelInstall: async () => { await emitter.invoke('install-process:cancel-install'); $isFinished.set(true);