The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
feat(comfy): C80 install a separate ComfyUI next to a found one
purple2cbafebd8d14
diff --git a/dev-server/__tests__/mlx-media-endpoint-coverage.test.ts b/dev-server/__tests__/mlx-media-endpoint-coverage.test.tsindex 89e46e24..28ef74b8 100644--- a/dev-server/__tests__/mlx-media-endpoint-coverage.test.ts+++ b/dev-server/__tests__/mlx-media-endpoint-coverage.test.ts@@ -205,6 +205,12 @@ describe('endpointMap covers every backendCall/invokeMedia site the frontend can// components/settings/HardwareSettings.tsx). Asked only behind isTauri():// the browser build never builds a ComfyUI environment.'comfy_torch_plan',+ // C74 (3.1.0): why the card list is empty under Linux without lspci+ // (components/settings/HardwareSettings.tsx). Asked only after a+ // `detect_gpus` answered with an empty list, and `detect_gpus` itself has+ // no dev route (pre-existing list above): the browser build lands in the+ // error branch and never asks.+ 'gpu_probe_hint',// Settings, Storage folder (components/settings/StorageFolderSetting.tsx):// behind isTauri() for the same reason, the browser build has no files of// its own to place.diff --git a/src/components/chat/ChatNotices.tsx b/src/components/chat/ChatNotices.tsxindex ff511584..e7f4e759 100644--- a/src/components/chat/ChatNotices.tsx+++ b/src/components/chat/ChatNotices.tsx@@ -11,7 +11,7 @@* fuer Anmerkungen und Fehler vorschreibt: eine Zeile, kein Kasten, ruhiges* Grau oder Rot, und ein x, das sie wegnimmt.*/-import { Binary, Bot, Download, FileText, FolderOpen, ImageOff, Images, Paperclip, Scissors } from 'lucide-react'+import { Binary, Bot, Download, FileText, FolderOpen, ImageOff, Images, Paperclip, PowerOff, Scissors } from 'lucide-react'import { Hinweis } from '../ui/Hinweis'import { useChatNoticeStore, CONVERSATION_BOUND, type ChatNoticeId } from '../../stores/chatNoticeStore'import { COMPOSER_MAX_W } from './composer-width'@@ -32,6 +32,7 @@ const ICON: Record<ChatNoticeId, typeof Paperclip> = {'agent-outside-workspace': FolderOpen,'agent-for-local-files': Bot,'create-save': Download,+ 'engine-stopped': PowerOff,}diff --git a/src/components/onboarding/ComfyStep.tsx b/src/components/onboarding/ComfyStep.tsxindex 58e2d7af..d870cdcb 100644--- a/src/components/onboarding/ComfyStep.tsx+++ b/src/components/onboarding/ComfyStep.tsx@@ -35,6 +35,7 @@ import { isRunning, formatElapsed, lastLog, type InstallerStatusResponse } fromimport type { Step } from './wizard-steps'import type { OnboardingSkin } from './onboarding-skin'import type { InstallerFleet } from './use-installer-fleet'+import { SeparateComfyInstall, COMFY_PATH_CONNECT_HINT } from '../settings/SeparateComfyInstall'interface ComfyStepProps {skin: OnboardingSkin@@ -248,6 +249,70 @@ export function ComfyStep({ skin, fleet, step, setStep }: ComfyStepProps) {// Installation nicht durchlaeuft und jemand Platz schaffen muss.const diskPressure = comfyInstall.logs.find(l => l.startsWith('⚠'))?.replace(/^⚠\s*/, '')+ /** The install, with its Python pre-flight and its progress card. C80: an+ * `installPath` puts a separate ComfyUI there instead of the default. */+ const startComfyInstall = async (installPath?: string) => {+ // P14 pre-flight, install Python first if missing,+ // then proceed with the original ComfyUI flow. Both+ // progress cards animate from this single click; the+ // user never has to interact mid-flight.+ const pythonOk = await ensurePythonInstalled()+ if (!pythonOk) return++ comfyDo({ type: 'start', at: Date.now(), log: 'Starting ComfyUI installation...' })+ try {+ await (installPath ? backendCall('install_comfyui', { installPath }) : backendCall('install_comfyui'))+ // Poll installation status+ const poll = setInterval(async () => {+ try {+ const status = await backendCall<InstallerStatusResponse>('install_comfyui_status')+ comfyDo({+ type: 'progress',+ status: status.status,+ logs: status.logs || [],+ received: status.download_progress || 0,+ total: status.download_total || 0,+ speed: status.download_speed || 0,+ })+ if (status.status === 'complete' || status.status === 'done') {+ clearInterval(poll)+ comfyDo({ type: 'ready' })+ setComfyReady(true)+ // C80: a separate install is now the one LU uses.+ if (installPath) setComfyFound({ found: true, complete: true, path: installPath })+ // Auto-start ComfyUI.+ //+ // Level (b): the install DID finish, which is what+ // this step was for, so the wizard moves on to its+ // ready state either way. But "ready" would then be+ // claiming something that is not running, so say so.+ try {+ await backendCall('start_comfyui')+ } catch (e) {+ // `warn`, nicht `fail`: die Installation IST+ // durch — nur der Start danach nicht.+ comfyDo({ type: 'warn', error: withDetail(+ 'ComfyUI is installed but did not start. You can start it from Settings → ComfyUI later; the rest of the setup is unaffected.',+ e,+ ) })+ }+ } else if (status.status === 'cancelled') {+ // Bug #1: install cancelled by user, close the+ // progress card and surface the install options+ // again so they can retry or pick another drive.+ clearInterval(poll)+ comfyDo({ type: 'fail', error: 'Install cancelled.' })+ } else if (status.status === 'error') {+ clearInterval(poll)+ comfyDo({ type: 'fail', error: withInstallerOutput('Installing ComfyUI did not finish.', lastLog(status.logs)) })+ }+ } catch { /* keep polling */ }+ }, 2000)+ } catch (err) {+ comfyDo({ type: 'fail', error: err instanceof Error ? err.message : 'Installation failed' })+ }+ }+return (<>{/* D-S39: hier stand ein nackter 13,8px-Punkt in `bg-purple-400`@@ -342,6 +407,18 @@ export function ComfyStep({ skin, fleet, step, setStep }: ComfyStepProps) {<span className="text-[0.7rem] font-medium">ComfyUI detected</span></div><p className={`text-[0.55rem] font-mono mt-1 ${isDark ? 'text-gray-500' : 'text-gray-400'}`}>{comfyFound.path}</p>+ {/* C80 (GitHub #230): keep the found one and install a separate one. */}+ {!isMacOS() && (+ <div className="mt-2 flex justify-center">+ <SeparateComfyInstall+ currentPath={comfyFound.path}+ onInstall={(target) => void startComfyInstall(target)}+ disabled={isRunning(pythonInstall)}+ buttonClassName={secondaryBtn}+ textClassName={`t-micro ${isDark ? 'text-gray-400' : 'text-gray-600'}`}+ />+ </div>+ )}</div>)}@@ -360,65 +437,7 @@ export function ComfyStep({ skin, fleet, step, setStep }: ComfyStepProps) {</Hinweis>)}<button- onClick={async () => {- // P14 pre-flight, install Python first if missing,- // then proceed with the original ComfyUI flow. Both- // progress cards animate from this single click; the- // user never has to interact mid-flight.- const pythonOk = await ensurePythonInstalled()- if (!pythonOk) return-- comfyDo({ type: 'start', at: Date.now(), log: 'Starting ComfyUI installation...' })- try {- await backendCall('install_comfyui')- // Poll installation status- const poll = setInterval(async () => {- try {- const status = await backendCall<InstallerStatusResponse>('install_comfyui_status')- comfyDo({- type: 'progress',- status: status.status,- logs: status.logs || [],- received: status.download_progress || 0,- total: status.download_total || 0,- speed: status.download_speed || 0,- })- if (status.status === 'complete' || status.status === 'done') {- clearInterval(poll)- comfyDo({ type: 'ready' })- setComfyReady(true)- // Auto-start ComfyUI.- //- // Level (b): the install DID finish, which is what- // this step was for, so the wizard moves on to its- // ready state either way. But "ready" would then be- // claiming something that is not running, so say so.- try {- await backendCall('start_comfyui')- } catch (e) {- // `warn`, nicht `fail`: die Installation IST- // durch — nur der Start danach nicht.- comfyDo({ type: 'warn', error: withDetail(- 'ComfyUI is installed but did not start. You can start it from Settings → ComfyUI later; the rest of the setup is unaffected.',- e,- ) })- }- } else if (status.status === 'cancelled') {- // Bug #1: install cancelled by user, close the- // progress card and surface the install options- // again so they can retry or pick another drive.- clearInterval(poll)- comfyDo({ type: 'fail', error: 'Install cancelled.' })- } else if (status.status === 'error') {- clearInterval(poll)- comfyDo({ type: 'fail', error: withInstallerOutput('Installing ComfyUI did not finish.', lastLog(status.logs)) })- }- } catch { /* keep polling */ }- }, 2000)- } catch (err) {- comfyDo({ type: 'fail', error: err instanceof Error ? err.message : 'Installation failed' })- }- }}+ onClick={() => void startComfyInstall()}className="lu-primary w-full flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg text-[0.7rem] transition-all"><Download size={14} /> Install ComfyUI (Recommended)@@ -484,6 +503,9 @@ export function ComfyStep({ skin, fleet, step, setStep }: ComfyStepProps) {</button></div>)}+ {comfyPathInput !== undefined && comfyPathInput.trim() !== '' && (+ <Hinweis className="text-left">{COMFY_PATH_CONNECT_HINT}</Hinweis>+ )}</div>)}diff --git a/src/components/settings/SeparateComfyInstall.tsx b/src/components/settings/SeparateComfyInstall.tsxnew file mode 100644index 00000000..e07ed409--- /dev/null+++ b/src/components/settings/SeparateComfyInstall.tsx@@ -0,0 +1,85 @@+/**+ * C80 (3.1.0, GitHub #230): "Install a separate ComfyUI…" next to a ComfyUI+ * LU already found. Pick a folder, see where the new install goes, confirm.+ * Used in Settings → ComfyUI and in the onboarding's ComfyUI step.+ */+import { useState } from 'react'+import { FolderPlus } from 'lucide-react'+import { backendCall, isWindows } from '../../api/backend'+import { separateComfyTarget } from '../../lib/separate-comfy-target'+import { withDetail } from '../../lib/error-text'++interface Props {+ /** The ComfyUI LU uses now, shown as the one that stays untouched. */+ currentPath?: string | null+ /** Start the install into `target` (the caller owns progress and errors). */+ onInstall: (target: string) => void+ disabled?: boolean+ /** Classes for the opening button, so each screen keeps its own look. */+ buttonClassName?: string+ /** Classes for the explanatory text. */+ textClassName?: string+}++export function SeparateComfyInstall({ currentPath, onInstall, disabled, buttonClassName, textClassName }: Props) {+ const [target, setTarget] = useState<string | null>(null)+ const [error, setError] = useState<string | null>(null)++ const pick = async () => {+ setError(null)+ setTarget(null)+ let chosen: string | null = null+ try {+ chosen = await backendCall<string | null>('pick_folder')+ } catch (e) {+ setError(withDetail('The folder picker did not open.', e))+ return+ }+ if (!chosen) return+ const answer = separateComfyTarget(chosen, currentPath, isWindows())+ if (answer.ok) setTarget(answer.target)+ else setError(answer.reason)+ }++ const text = textClassName ?? 't-micro text-gray-500'+ return (+ <div className="w-full space-y-1.5" data-testid="separate-comfy-install">+ {target === null && (+ <button type="button" onClick={pick} disabled={disabled} className={buttonClassName} data-testid="separate-comfy-open">+ <FolderPlus size={12} className="shrink-0" /> Install a separate ComfyUI…+ </button>+ )}+ {target !== null && (+ <div className="space-y-1.5 text-left">+ <p className={`${text} leading-relaxed`} data-testid="separate-comfy-target">+ A new ComfyUI goes to <code className="font-mono break-all">{target}</code>.+ {currentPath ? <> Your current one at <code className="font-mono break-all">{currentPath}</code> stays as it is.</> : null}{' '}+ When the install finishes, LU uses the new one; switch back any time with Path and Connect. If that folder already holds a ComfyUI, it is updated and used.+ </p>+ <div className="flex items-center gap-1.5">+ <button+ type="button"+ disabled={disabled}+ onClick={() => { const t = target; setTarget(null); onInstall(t) }}+ className="px-2 py-1 rounded t-micro bg-purple-500/10 text-purple-400 hover:bg-purple-500/20 transition-colors disabled:opacity-30"+ data-testid="separate-comfy-confirm"+ >+ Install here+ </button>+ <button+ type="button"+ onClick={() => setTarget(null)}+ className="px-2 py-1 rounded t-micro bg-white/5 text-gray-400 hover:bg-white/10 transition-colors"+ >+ Cancel+ </button>+ </div>+ </div>+ )}+ {error && <p className="t-micro text-red-600 dark:text-red-400" role="alert">{error}</p>}+ </div>+ )+}++/** The line under a ComfyUI path field: typing alone changes nothing. */+export const COMFY_PATH_CONNECT_HINT = 'Typing a path changes nothing yet: click Connect to use it. The folder needs ComfyUI\u2019s main.py.'diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsxindex 01a6be23..98d4b17b 100644--- a/src/components/settings/SettingsPage.tsx+++ b/src/components/settings/SettingsPage.tsx@@ -95,6 +95,7 @@ import { HighTemperatureWarning } from '../chat/HighTemperatureWarning'import { BoundedNumberInput } from './BoundedNumberInput'import { CONTEXT_WINDOW_MAX, MAX_TOKENS_MAX, SUB_AGENT_LIMIT_MAX } from '../../lib/number-limits'import { usePageMemoryStore } from '../../stores/pageMemoryStore'+import { SeparateComfyInstall, COMFY_PATH_CONNECT_HINT } from './SeparateComfyInstall'// ── User profile picture (Appearance) ───────────────────────────// Self-contained like HfDownloadPathSetting. Stores the picture as a@@ -1245,6 +1246,10 @@ export function ComfyUISettings() {Connect</button></div>+ {/* C80: the field alone does nothing; GitHub #230 read it as saved. */}+ {customPath.trim() && customPath.trim() !== status?.path && !pathError && !pathSuccess && (+ <p className={`t-micro ${HINWEIS_TEXT.ruhig}`} data-testid="comfy-path-connect-hint">{COMFY_PATH_CONNECT_HINT}</p>+ )}{pathError && <p className="text-[0.55rem] text-red-400">{pathError}</p>}{pathSuccess && <p className="text-[0.55rem] text-green-400">Path set successfully</p>}</div>@@ -1386,6 +1391,17 @@ export function ComfyUISettings() {Update ComfyUI</button>)}+ {/* C80 (GitHub #230): a second, separate install next to the found one. */}+ {status?.found && status?.complete !== false && installIdle && (+ <SeparateComfyInstall+ currentPath={status?.path}+ onInstall={(target) => {+ clearInstallNotice()+ void useComfyInstallStore.getState().runInstall(target)+ }}+ buttonClassName="flex items-center gap-1 px-2 py-1 rounded t-micro bg-white/5 text-gray-400 hover:text-gray-200 hover:bg-white/10 transition-colors"+ />+ )}{(!status?.found || status?.complete === false) && installIdle && (<p className="w-full t-micro text-gray-600">Installs to your home folder by default. Set Path above (e.g. D:\ComfyUI) to install on another drive.diff --git a/src/components/settings/__tests__/separate-comfy-install.test.tsx b/src/components/settings/__tests__/separate-comfy-install.test.tsxnew file mode 100644index 00000000..08daedd2--- /dev/null+++ b/src/components/settings/__tests__/separate-comfy-install.test.tsx@@ -0,0 +1,56 @@+/**+ * @vitest-environment jsdom+ *+ * C80 (3.1.0, GitHub #230): "Install a separate ComfyUI…" picks a folder,+ * shows where the new install goes and only then starts it.+ *+ * Negative control: call onInstall straight from the picker and the+ * "nothing starts before the confirm" case turns red.+ */+import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'+import { render, screen, cleanup, fireEvent, waitFor } from '@testing-library/react'++let picked: string | null = 'D:\\AI'+vi.mock('../../../api/backend', async (importOriginal) => ({+ ...(await importOriginal<typeof import('../../../api/backend')>()),+ isWindows: () => true,+ backendCall: vi.fn(async (cmd: string) => (cmd === 'pick_folder' ? picked : null)),+}))++const { SeparateComfyInstall } = await import('../SeparateComfyInstall')++beforeEach(() => { picked = 'D:\\AI' })+afterEach(cleanup)++describe('C80: a separate ComfyUI next to the found one', () => {+ it('shows the target and starts nothing before the confirm', async () => {+ const onInstall = vi.fn()+ render(<SeparateComfyInstall currentPath={'C:\\Users\\a\\ComfyUI'} onInstall={onInstall} />)+ fireEvent.click(screen.getByText(/Install a separate ComfyUI/))+ const line = await screen.findByTestId('separate-comfy-target')+ expect(line.textContent).toContain('D:\\AI\\ComfyUI')+ expect(line.textContent).toContain('C:\\Users\\a\\ComfyUI')+ expect(onInstall).not.toHaveBeenCalled()+ fireEvent.click(screen.getByTestId('separate-comfy-confirm'))+ expect(onInstall).toHaveBeenCalledWith('D:\\AI\\ComfyUI')+ })++ it('a cancelled picker changes nothing', async () => {+ picked = null+ const onInstall = vi.fn()+ render(<SeparateComfyInstall currentPath={'C:\\ComfyUI'} onInstall={onInstall} />)+ fireEvent.click(screen.getByText(/Install a separate ComfyUI/))+ await waitFor(() => expect(screen.getByTestId('separate-comfy-open')).toBeTruthy())+ expect(screen.queryByTestId('separate-comfy-target')).toBeNull()+ expect(onInstall).not.toHaveBeenCalled()+ })++ it('refuses the folder LU already uses', async () => {+ picked = 'C:\\Users\\a'+ const onInstall = vi.fn()+ render(<SeparateComfyInstall currentPath={'C:\\Users\\a\\ComfyUI'} onInstall={onInstall} />)+ fireEvent.click(screen.getByText(/Install a separate ComfyUI/))+ expect((await screen.findByRole('alert')).textContent).toMatch(/already uses/)+ expect(screen.queryByTestId('separate-comfy-confirm')).toBeNull()+ })+})diff --git a/src/lib/__tests__/separate-comfy-target.test.ts b/src/lib/__tests__/separate-comfy-target.test.tsnew file mode 100644index 00000000..25e25c89--- /dev/null+++ b/src/lib/__tests__/separate-comfy-target.test.ts@@ -0,0 +1,32 @@+/**+ * C80 (3.1.0, GitHub #230): where a separate ComfyUI install goes.+ */+import { describe, it, expect } from 'vitest'+import { separateComfyTarget } from '../separate-comfy-target'++describe('separateComfyTarget', () => {+ it('puts a ComfyUI subfolder into a general folder', () => {+ expect(separateComfyTarget('D:\\AI', 'C:\\Users\\a\\ComfyUI', true)).toEqual({ ok: true, target: 'D:\\AI\\ComfyUI' })+ expect(separateComfyTarget('/mnt/big/', '/home/a/ComfyUI', false)).toEqual({ ok: true, target: '/mnt/big/ComfyUI' })+ expect(separateComfyTarget('D:\\', null, true)).toEqual({ ok: true, target: 'D:\\ComfyUI' })+ })++ it('takes a folder that already says ComfyUI as it is', () => {+ expect(separateComfyTarget('D:\\ComfyUI-LU', 'C:\\ComfyUI', true)).toEqual({ ok: true, target: 'D:\\ComfyUI-LU' })+ expect(separateComfyTarget('/opt/comfyui2', '/home/a/ComfyUI', false)).toEqual({ ok: true, target: '/opt/comfyui2' })+ })++ it('refuses the install LU already uses, also when picked as its parent', () => {+ const r1 = separateComfyTarget('C:\\Users\\a\\comfyui\\', 'C:\\Users\\a\\ComfyUI', true)+ expect(r1.ok).toBe(false)+ const r2 = separateComfyTarget('/home/a', '/home/a/ComfyUI', false)+ expect(r2.ok).toBe(false)+ if (!r2.ok) expect(r2.reason).toMatch(/already uses/)+ // Linux paths are case-sensitive: a different folder.+ expect(separateComfyTarget('/home/a/comfyui', '/home/a/ComfyUI', false).ok).toBe(true)+ })++ it('an empty pick is no target', () => {+ expect(separateComfyTarget(' ', '/x', false).ok).toBe(false)+ })+})diff --git a/src/lib/separate-comfy-target.ts b/src/lib/separate-comfy-target.tsnew file mode 100644index 00000000..92973c42--- /dev/null+++ b/src/lib/separate-comfy-target.ts@@ -0,0 +1,44 @@+/**+ * C80 (3.1.0, GitHub #230): install a second, separate ComfyUI next to one LU+ * already found, for example to keep a hand-tuned install untouched.+ *+ * `install_comfyui` takes an install path, but the buttons only offered it+ * when no ComfyUI was found. The user picks a folder; this decides where the+ * new install goes, so the answer can be shown before anything is downloaded.+ *+ * - A folder whose name already says ComfyUI is taken as it is.+ * - Any other folder gets a `ComfyUI` subfolder, so picking `D:\AI` does not+ * spill a git checkout into a folder full of other things.+ * - The folder LU already uses is refused: that would update it, not add one.+ */+export type SeparateComfyTarget = { ok: true; target: string } | { ok: false; reason: string }++function trimSeparators(path: string): string {+ let p = path.trim()+ // Keep a bare root ("/", "C:\") whole.+ while (p.length > 1 && /[\\/]$/.test(p) && !/^[A-Za-z]:[\\/]$/.test(p)) p = p.slice(0, -1)+ return p+}++function sameFolder(a: string, b: string, onWindows: boolean): boolean {+ const norm = (s: string) => {+ const t = trimSeparators(s).replace(/\\/g, '/')+ return onWindows ? t.toLowerCase() : t+ }+ return norm(a) === norm(b)+}++export function separateComfyTarget(picked: string, currentPath: string | null | undefined, onWindows: boolean): SeparateComfyTarget {+ const folder = trimSeparators(picked)+ if (!folder) return { ok: false, reason: 'No folder was chosen.' }+ const sep = onWindows ? '\\' : '/'+ const base = folder.split(/[\\/]/).pop() ?? ''+ const target = /comfyui/i.test(base) ? folder : `${folder}${/[\\/]$/.test(folder) ? '' : sep}ComfyUI`+ if (currentPath && sameFolder(target, currentPath, onWindows)) {+ return {+ ok: false,+ reason: 'That is the ComfyUI LU already uses. Pick another folder for the separate install.',+ }+ }+ return { ok: true, target }+}