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(create): bg-removal card = one-click Download & install
purple9263925ea126
diff --git a/src/components/create/experimental/CreateContext.tsx b/src/components/create/experimental/CreateContext.tsxindex 1c3b1ac0..78a34cda 100644--- a/src/components/create/experimental/CreateContext.tsx+++ b/src/components/create/experimental/CreateContext.tsx@@ -3,9 +3,9 @@ import { useCreate } from '../../../hooks/useCreate'import { useCloudCreate, hasActiveCloudRun } from '../../../hooks/useCloudCreate'import { useCloudSession } from '../../../hooks/useCloudSession'import { useCreateStore, type GalleryItem } from '../../../stores/createStore'-import { useUIStore } from '../../../stores/uiStore'import { getLoraModels, getVAEModels } from '../../../api/comfyui'-import { getAllNodeInfo } from '../../../api/comfyui-nodes'+import { getAllNodeInfo, clearNodeCache } from '../../../api/comfyui-nodes'+import { installCustomNodes } from '../../../api/discover'import { backendCall } from '../../../api/backend'import { ensureLocalFilename } from './loadImage'import type { CloudQuota } from '../../../lib/render/cloud-jobs'@@ -34,8 +34,11 @@ interface CreateExpValue {* RX 7900 XTX): surfaces the honest slow-mode warning instead of a silent* 20-minute timeout. */comfyOnCpu: boolean- /** Route a missing capability (e.g. background-removal nodes) to the Model Manager. */- installCapability: (cap: 'rmbg') => void+ /** Install a missing capability in place: download the custom node, restart+ * ComfyUI, and re-probe until it's available. Reports progress via the+ * optional callback and throws on failure. Currently only background+ * removal (the RMBG node). */+ installCapability: (cap: 'rmbg', onProgress?: (msg: string) => void) => Promise<void>/** Runtime backend axis: hosted rendering offered for this session? */cloudAvailable: booleanquota: CloudQuota | null@@ -59,25 +62,11 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {const cloud = useCloudCreate({ onQuotaChange: refreshQuota })const backend = useCreateStore((s) => s.backend)const setBackend = useCreateStore((s) => s.setBackend)- const setView = useUIStore((s) => s.setView)const setCaps = useCreateStore((s) => s.setCaps)const [loraList, setLoraList] = useState<string[]>([])const [vaeList, setVaeList] = useState<string[]>(['auto'])const [comfyOnCpu, setComfyOnCpu] = useState(false)- // Re-read the CPU/GPU launch flag whenever ComfyUI (re)connects: the Rust- // side records it at every ComfyUI (re)start, so a Settings → Hardware- // change + restart updates the banner. Fails silent (stays false) when no- // Rust backend answers (web build).- useEffect(() => {- if (connected !== true) { setComfyOnCpu(false); return }- let cancelled = false- backendCall<{ mode?: string; startedCpu?: boolean | null }>('get_comfy_gpu_status')- .then((s) => { if (!cancelled) setComfyOnCpu(s?.startedCpu === true) })- .catch(() => { if (!cancelled) setComfyOnCpu(false) })- return () => { cancelled = true }- }, [connected])-// Never strand the session on a dead axis: losing the license/logging out// while 'cloud' is selected falls back to local rendering.useEffect(() => {@@ -107,6 +96,19 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {fetchModels()}, [checkConnection, fetchModels])+ // Surface a CPU-only ComfyUI (no usable GPU detected) so an AMD / non-NVIDIA+ // user isn't left staring at a silent 20-minute timeout. The Rust side records+ // the launch mode at every ComfyUI (re)start; re-read it whenever the+ // connection (re)establishes. Desktop-only (web has no such command → false).+ useEffect(() => {+ if (connected !== true) { setComfyOnCpu(false); return }+ let cancelled = false+ backendCall<{ startedCpu?: boolean | null }>('get_comfy_gpu_status')+ .then((s) => { if (!cancelled) setComfyOnCpu(s?.startedCpu === true) })+ .catch(() => { if (!cancelled) setComfyOnCpu(false) })+ return () => { cancelled = true }+ }, [connected])+// Once ComfyUI is reachable, fetch LoRA/VAE lists and probe installed// capabilities (RMBG for cutout, inpaint nodes) so the UI gates correctly.useEffect(() => {@@ -133,7 +135,40 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {return () => { cancelled = true }}, [connected, setCaps])- const installCapability = useCallback((_cap: 'rmbg') => { setView('models') }, [setView])+ // Install background removal in place — mirrors the VHS one-click flow (#72):+ // clone the custom node + pip install, restart ComfyUI so it registers, then+ // poll /object_info (clearing the node cache each round so we don't read the+ // stale pre-install catalogue) until the RMBG node shows up. The BiRefNet /+ // RMBG-2.0 cutout model is fetched by the node itself on the first run.+ const installCapability = useCallback(async (cap: 'rmbg', onProgress?: (msg: string) => void) => {+ if (cap !== 'rmbg') return+ onProgress?.('Downloading & installing the background-removal node — this can take a minute…')+ await installCustomNodes(['rmbg'])+ onProgress?.('Restarting ComfyUI to register the node…')+ try { await backendCall('stop_comfyui') } catch { /* may already be stopped */ }+ await new Promise((r) => setTimeout(r, 2000))+ await backendCall('start_comfyui')+ onProgress?.('Waiting for ComfyUI to come back…')+ for (let i = 0; i < 20; i++) {+ await new Promise((r) => setTimeout(r, 2000))+ try {+ clearNodeCache()+ const nodes = await getAllNodeInfo()+ const names = new Set(Object.keys(nodes))+ if (names.has('RMBG')) {+ setCaps({+ rmbg: true,+ 'inpaint-nodes': names.has('VAEEncodeForInpaint') || names.has('InpaintModelConditioning'),+ })+ return+ }+ } catch { /* ComfyUI still restarting — keep polling */ }+ }+ throw new Error(+ "Installed ComfyUI-RMBG and restarted ComfyUI, but it still isn't listing the RMBG node. " ++ 'Open the Model Manager to finish the install, or check the ComfyUI console for a pip error.',+ )+ }, [setCaps])const value: CreateExpValue = {generate: backend === 'cloud' ? cloud.generate : generate,diff --git a/src/components/create/experimental/Stage.tsx b/src/components/create/experimental/Stage.tsxindex 6329f2f3..ede2677e 100644--- a/src/components/create/experimental/Stage.tsx+++ b/src/components/create/experimental/Stage.tsx@@ -1,6 +1,6 @@import { useRef, useState } from 'react'import { motion, AnimatePresence } from 'framer-motion'-import { UploadCloud, ImagePlus, Scissors, Wand2, Sparkles, X, Loader2 } from 'lucide-react'+import { UploadCloud, ImagePlus, Scissors, Wand2, Sparkles, X, Loader2, Download, AlertTriangle } from 'lucide-react'import { useCreateStore, type GalleryItem } from '../../../stores/createStore'import { useCreateExp } from './CreateContext'import { INTENT_MAP } from './intents'@@ -228,17 +228,53 @@ function ChangeImageButton({ onChange }: { onChange: (r: Awaited<ReturnType<type)}-// ── Capability missing → route to Model Manager ──+// ── Capability missing → one-click install right here ──function CapabilityCard({ cap }: { cap: 'rmbg' }) {const { installCapability } = useCreateExp()+ const [installing, setInstalling] = useState(false)+ const [status, setStatus] = useState('')+ const [err, setErr] = useState<string | null>(null)++ const run = async () => {+ setInstalling(true); setErr(null); setStatus('Starting…')+ try {+ // On success caps.rmbg flips true and Stage swaps this card for the input slot.+ await installCapability(cap, setStatus)+ } catch (e) {+ setErr(e instanceof Error ? e.message : String(e))+ } finally {+ setInstalling(false)+ }+ }+return (<EmptyStateicon={Scissors}tone="accent"- title="Background Removal needs a quick one-time download"- description="The AI cutout model (ComfyUI-RMBG / BiRefNet) runs fully locally. Get it from the Model Manager — about 300 MB — and this becomes a one-click action."- action={{ label: 'Get this feature', icon: UploadCloud, onClick: () => installCapability(cap) }}- secondaryAction={{ label: 'Open Model Manager', onClick: () => installCapability(cap) }}- />+ title="Background removal needs a one-time download"+ description="The AI cutout runs fully locally (ComfyUI-RMBG). This installs the node now — the ~300 MB cutout model downloads automatically on your first cutout."+ >+ <div className="flex flex-col items-center gap-2.5 pt-1">+ {installing ? (+ <div className="t-control text-gray-400 flex items-center gap-2">+ <Loader2 size={14} className="animate-spin shrink-0" />+ <span>{status || 'Installing…'}</span>+ </div>+ ) : (+ <Button variant="primary" icon={Download} onClick={run}>Download & install</Button>+ )}+ {err && (+ <div className="relative t-control text-gray-300 bg-white/[0.03] rounded-[var(--radius-control)] px-2.5 py-2 pr-7 max-w-sm text-left">+ <div className="flex items-start gap-2">+ <AlertTriangle size={13} className="text-gray-400 shrink-0 mt-px" />+ <span className="min-w-0 break-words">{err}</span>+ </div>+ <button onClick={() => setErr(null)} className="absolute top-1.5 right-1.5 text-gray-500 hover:text-gray-300 transition-colors" title="Dismiss" aria-label="Dismiss">+ <X size={12} />+ </button>+ </div>+ )}+ </div>+ </EmptyState>)}