mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
## Summary Extracts desktop UI into apps/desktop-ui package with minimal changes. ## Changes - **What**: - Separates desktop-specific code into standalone package with independent Vite config, router, and i18n - Drastically simplifies the main app router by removing all desktop routes - Adds a some code duplication, most due to the existing design - Some duplication can be refactored to be *simpler* on either side - no need to split things by `isElectron()` - Rudimentary storybook support has been added - **Breaking**: Stacked PR for publishing must be merged before this PR makes it to stable core (but publishing _could_ be done manually) - #5915 - **Dependencies**: Takes full advantage of pnpm catalog. No additional dependencies added. ## Review Focus - Should be no changes to normal frontend operation - Scripts added to root package.json are acceptable - The duplication in this PR is copied as is, wherever possible. Any corrections or fix-ups beyond the scope of simply migrating the functionality as-is, can be addressed in later PRs. That said, if any changes are made, it instantly becomes more difficult to separate the duplicated code out into a shared utility. - Tracking issue to address concerns: #5925 ### i18n Fixing i18n is out of scope for this PR. It is a larger task that we should consider carefully and implement properly. Attempting to isolate the desktop i18n and duplicate the _current_ localisation scripts would be wasted energy.
148 lines
4.8 KiB
TypeScript
148 lines
4.8 KiB
TypeScript
import { PrimeIcons } from '@primevue/core'
|
|
|
|
import type { MaintenanceTask } from '@/types/desktop/maintenanceTypes'
|
|
import { electronAPI } from '@/utils/envUtil'
|
|
|
|
const electron = electronAPI()
|
|
|
|
const openUrl = (url: string) => {
|
|
window.open(url, '_blank')
|
|
return true
|
|
}
|
|
|
|
export const DESKTOP_MAINTENANCE_TASKS: Readonly<MaintenanceTask>[] = [
|
|
{
|
|
id: 'basePath',
|
|
execute: async () => await electron.setBasePath(),
|
|
name: 'Base path',
|
|
shortDescription: 'Change the application base path.',
|
|
errorDescription: 'Unable to open the base path. Please select a new one.',
|
|
description:
|
|
'The base path is the default location where ComfyUI stores data. It is the location for the python environment, and may also contain models, custom nodes, and other extensions.',
|
|
isInstallationFix: true,
|
|
button: {
|
|
icon: PrimeIcons.QUESTION,
|
|
text: 'Select'
|
|
}
|
|
},
|
|
{
|
|
id: 'git',
|
|
headerImg: 'assets/images/Git-Logo-White.svg',
|
|
execute: () => openUrl('https://git-scm.com/downloads/'),
|
|
name: 'Download git',
|
|
shortDescription: 'Open the git download page.',
|
|
errorDescription:
|
|
'Git is missing. Please download and install git, then restart ComfyUI Desktop.',
|
|
description:
|
|
'Git is required to download and manage custom nodes and other extensions. This task opens the download page in your default browser, where you can download the latest version of git. Once you have installed git, please restart ComfyUI Desktop.',
|
|
button: {
|
|
icon: PrimeIcons.EXTERNAL_LINK,
|
|
text: 'Download'
|
|
}
|
|
},
|
|
{
|
|
id: 'vcRedist',
|
|
execute: () => openUrl('https://aka.ms/vs/17/release/vc_redist.x64.exe'),
|
|
name: 'Download VC++ Redist',
|
|
shortDescription: 'Download the latest VC++ Redistributable runtime.',
|
|
description:
|
|
'The Visual C++ runtime libraries are required to run ComfyUI. You will need to download and install this file.',
|
|
button: {
|
|
icon: PrimeIcons.EXTERNAL_LINK,
|
|
text: 'Download'
|
|
}
|
|
},
|
|
{
|
|
id: 'reinstall',
|
|
severity: 'danger',
|
|
requireConfirm: true,
|
|
execute: async () => {
|
|
await electron.reinstall()
|
|
return true
|
|
},
|
|
name: 'Reinstall ComfyUI',
|
|
shortDescription:
|
|
'Deletes the desktop app config and load the welcome screen.',
|
|
description:
|
|
'Delete the desktop app config, restart the app, and load the installation screen.',
|
|
confirmText: 'Delete all saved config and reinstall?',
|
|
button: {
|
|
icon: PrimeIcons.EXCLAMATION_TRIANGLE,
|
|
text: 'Reinstall'
|
|
}
|
|
},
|
|
{
|
|
id: 'pythonPackages',
|
|
requireConfirm: true,
|
|
execute: async () => {
|
|
try {
|
|
await electron.uv.installRequirements()
|
|
return true
|
|
} catch (error) {
|
|
return false
|
|
}
|
|
},
|
|
name: 'Install python packages',
|
|
shortDescription:
|
|
'Installs the base python packages required to run ComfyUI.',
|
|
errorDescription:
|
|
'Python packages that are required to run ComfyUI are not installed.',
|
|
description:
|
|
'This will install the python packages required to run ComfyUI. This includes torch, torchvision, and other dependencies.',
|
|
usesTerminal: true,
|
|
isInstallationFix: true,
|
|
button: {
|
|
icon: PrimeIcons.DOWNLOAD,
|
|
text: 'Install'
|
|
}
|
|
},
|
|
{
|
|
id: 'uv',
|
|
execute: () =>
|
|
openUrl('https://docs.astral.sh/uv/getting-started/installation/'),
|
|
name: 'uv executable',
|
|
shortDescription: 'uv installs and maintains the python environment.',
|
|
description:
|
|
"This will open the download page for Astral's uv tool. uv is used to install python and manage python packages.",
|
|
button: {
|
|
icon: 'pi pi-asterisk',
|
|
text: 'Download'
|
|
}
|
|
},
|
|
{
|
|
id: 'uvCache',
|
|
severity: 'danger',
|
|
requireConfirm: true,
|
|
execute: async () => await electron.uv.clearCache(),
|
|
name: 'uv cache',
|
|
shortDescription: 'Remove the Astral uv cache of python packages.',
|
|
description:
|
|
'This will remove the uv cache directory and its contents. All downloaded python packages will need to be downloaded again.',
|
|
confirmText: 'Delete uv cache of python packages?',
|
|
usesTerminal: true,
|
|
isInstallationFix: true,
|
|
button: {
|
|
icon: PrimeIcons.TRASH,
|
|
text: 'Clear cache'
|
|
}
|
|
},
|
|
{
|
|
id: 'venvDirectory',
|
|
severity: 'danger',
|
|
requireConfirm: true,
|
|
execute: async () => await electron.uv.resetVenv(),
|
|
name: 'Reset virtual environment',
|
|
shortDescription:
|
|
'Remove and recreate the .venv directory. This removes all python packages.',
|
|
description:
|
|
'The python environment is where ComfyUI installs python and python packages. It is used to run the ComfyUI server.',
|
|
confirmText: 'Delete the .venv directory?',
|
|
usesTerminal: true,
|
|
isInstallationFix: true,
|
|
button: {
|
|
icon: PrimeIcons.FOLDER,
|
|
text: 'Recreate'
|
|
}
|
|
}
|
|
] as const
|