Skip to content

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.

feat(models): Model Hub — complete Model Manager redesign

purplec2fd8dc860e5
diff --git a/src/components/models/DiscoverModels.tsx b/src/components/models/DiscoverModels.tsx
index 1ee7f341..5b660242 100644
--- a/src/components/models/DiscoverModels.tsx
+++ b/src/components/models/DiscoverModels.tsx
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react'
import { motion } from 'framer-motion'
-import { Download, RefreshCw, ExternalLink, Search, CheckCircle, XCircle, Loader2 } from 'lucide-react'
+import { Search, XCircle, Loader2, Sparkles, Unlock, ShieldCheck, ExternalLink, Download, CheckCircle } from 'lucide-react'
import { X } from 'lucide-react'
import {
searchHuggingFaceModels,
@@ -12,6 +12,7 @@ import {
type DiscoverModel, type DownloadProgress, type ModelBundle, type CivitAIModelResult, type HfGgufFile,
} from '../../api/discover'
import { getSystemVRAM } from '../../api/comfyui'
+import { getMaxVramGb, getTotalRamGb } from '../../lib/hardware'
import { openExternal } from '../../api/backend'
import { useModels } from '../../hooks/useModels'
import { useDownloadStore } from '../../stores/downloadStore'
@@ -30,6 +31,9 @@ import { formatBytes } from '../../lib/formatters'
import type { ModelCategory } from '../../types/models'
import { proxyImageUrl } from '../../lib/privacy'
import { log } from '../../lib/logger'
+import {
+ ModelTile, BundleTile, HardwareChip, groupModels, pickDefaultVariant, computeFit,
+} from './ModelTiles'
interface Props {
category: ModelCategory
@@ -39,129 +43,10 @@ interface Props {
searchSubmitToken?: number
}
-function ModelDiscoverCard({ model, index, isText, getModelDownloadState, isModelFullyInstalled, handleDownload }: {
- model: DiscoverModel
- index: number
- isText: boolean
- getModelDownloadState: (m: DiscoverModel) => DownloadProgress | null
- isModelFullyInstalled: (model: DiscoverModel) => boolean
- handleDownload: (m: DiscoverModel) => void
-}) {
- const dlState = getModelDownloadState(model)
- const isDownloading = dlState?.status === 'downloading' || dlState?.status === 'connecting'
- const isComplete = dlState?.status === 'complete'
- const canDirectDownload = (!!model.downloadUrl && !!model.filename) || !!model.ollamaModel
-
- return (
- <motion.div
- initial={{ opacity: 0, y: 10 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ delay: index * 0.03 }}
- >
- <div className="rounded-lg border border-gray-200 dark:border-white/[0.06] bg-gray-50 dark:bg-white/[0.03] p-3 transition-colors hover:bg-gray-100 dark:hover:bg-white/[0.05]">
- <div className="flex items-start justify-between gap-2">
- <div className="flex-1 min-w-0">
- <h3 className="text-sm font-medium text-gray-900 dark:text-white flex items-center gap-1.5 flex-wrap">
- {isModelFullyInstalled(model) && <span className="text-[0.55rem] px-1.5 py-0.5 rounded bg-green-500/15 text-green-500 font-bold border border-green-500/30 shrink-0">INSTALLED</span>}
- {model.hot && !isModelFullyInstalled(model) && <span className="text-[0.55rem] px-1.5 py-0.5 rounded bg-orange-500/15 text-orange-500 font-bold border border-orange-500/30 shrink-0">HOT</span>}
- {model.agent && <span className="text-[0.55rem] px-1.5 py-0.5 rounded bg-green-500/15 text-green-500 font-bold border border-green-500/30 shrink-0">AGENT</span>}
- {/* F4 (juliandiggins-stack GH#21) — explicit CPU-only / ≤8 GB RAM badge.
- Pinned to a small curated set of unfiltered models that we have
- test-loaded on an 8 GB box without a discrete GPU. */}
- {model.lightweight && (
- <span
- className="text-[0.55rem] px-1.5 py-0.5 rounded bg-emerald-500/15 text-emerald-500 font-bold border border-emerald-500/30 shrink-0"
- title="Runs on 8 GB RAM, CPU-only. No discrete GPU required."
- >
- CPU-FRIENDLY
- </span>
- )}
- <span>{model.description || model.name}</span>
- </h3>
- <p className="text-xs text-gray-400 dark:text-gray-500 mt-0.5 truncate">{model.name}</p>
- <div className="flex items-center gap-2 mt-1.5 flex-wrap">
- {model.tags.map((tag) => (
- <span key={tag} className="text-[10px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-white/5 text-gray-600 dark:text-gray-400">
- {tag}
- </span>
- ))}
- {model.sizeGB && (
- <span className="text-[10px] text-gray-400">{model.sizeGB} GB</span>
- )}
- {model.pulls && (
- <span className="text-[10px] text-gray-500">{model.pulls}</span>
- )}
- </div>
-
- {/* Download progress shown exclusively in DownloadBadge (header) */}
- </div>
-
- <div className="flex items-center gap-1 shrink-0">
- {isText && model.canPull === false ? (
- <>
- <span className="text-xs text-green-500 px-2 py-1 rounded bg-green-500/10">Available</span>
- {model.url && (
- <button
- onClick={() => openExternal(model.url!)}
- className="p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 transition-all"
- title="View on HuggingFace"
- aria-label="View on HuggingFace"
- >
- <ExternalLink size={14} />
- </button>
- )}
- </>
- ) : isText && canDirectDownload ? (
- /* HuggingFace GGUF: direct download button */
- isComplete ? (
- <span className="flex items-center gap-1 text-xs text-green-500 px-2 py-1">
- <CheckCircle size={12} /> Downloaded
- </span>
- ) : isDownloading ? (
- <span className="p-2 text-gray-400">
- <Loader2 size={14} className="animate-spin" />
- </span>
- ) : (
- <button
- onClick={() => handleDownload(model)}
- className="p-2 rounded-lg bg-green-100 dark:bg-green-500/15 hover:bg-green-200 dark:hover:bg-green-500/25 text-green-700 dark:text-green-400 transition-all"
- title={`Download ${model.sizeGB ? model.sizeGB + ' GB' : ''}`}
- >
- <Download size={14} />
- </button>
- )
- ) : !isText ? (
- <>
- {isComplete ? (
- <span className="flex items-center gap-1 text-xs text-green-500 px-2 py-1">
- <CheckCircle size={12} /> Installed
- </span>
- ) : isDownloading ? (
- <span className="p-2 text-gray-400">
- <Loader2 size={14} className="animate-spin" />
- </span>
- ) : canDirectDownload ? (
- <button
- onClick={() => handleDownload(model)}
- className="p-2 rounded-lg bg-green-100 dark:bg-green-500/15 hover:bg-green-200 dark:hover:bg-green-500/25 text-green-700 dark:text-green-400 transition-all"
- title={`Download ${model.sizeGB ? model.sizeGB + ' GB' : ''} to ComfyUI`}
- >
- <Download size={14} />
- </button>
- ) : null}
- {model.url && (
- <button onClick={() => openExternal(model.url!)} className="p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 transition-all" title="View on website">
- <ExternalLink size={14} />
- </button>
- )}
- </>
- ) : null}
- </div>
- </div>
- </div>
- </motion.div>
- )
-}
+// Size buckets stay EXACTLY the ones from the old VRAM-tier filter (David
+// 2026-06-06) — only the labels turned human. 'fit' is new and additive:
+// it filters on the detected GPU instead of a fixed bucket.
+type SizeTier = 'all' | 'fit' | 'ultra' | 'light' | 'middle' | 'highend'
export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }: Props) {
const [civitaiResults, setCivitaiResults] = useState<CivitAIModelResult[]>([])
@@ -178,12 +63,12 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
const setCivitaiHost = useWorkflowStore((s) => s.setCivitaiHost)
const [loading, setLoading] = useState(false)
const [systemVRAM, setSystemVRAM] = useState<number | null>(null)
+ const [ramGb, setRamGb] = useState<number | null>(null)
const [subTab, setSubTab] = useState<'uncensored' | 'mainstream'>('uncensored')
- // Weight-class categories (David 2026-06-06): four size buckets so every
- // model lands in exactly one class — Ultra Lightweight ≤4 GB, Lightweight
- // 4–10 GB, Middleweight 10–20 GB, High-End >20 GB (open-ended). Replaces the
- // older 3-tier lightweight/mid/highend VRAM filter.
- const [vramTier, setVramTier] = useState<'all' | 'ultra' | 'light' | 'middle' | 'highend'>('all')
+ const [vramTier, setVramTier] = useState<SizeTier>('all')
+ // Details modal — the card shows one calm line; the FULL catalog description
+ // (incl. per-model tips like "run thinking-OFF") lives here.
+ const [infoModel, setInfoModel] = useState<DiscoverModel | null>(null)
const downloads = useDownloadStore(s => s.downloads)
const dlStore = useDownloadStore
@@ -216,9 +101,17 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
detectProviderModelPath(providerName).then(path => setHfModelPath(path))
}, [category, hfOverride, providers.openai?.name])
- // Detect system VRAM
+ // Detect hardware for the "runs on your PC" hints. Two probes, best wins:
+ // detect_gpus (nvidia-smi/rocm-smi/wmic — works WITHOUT ComfyUI running)
+ // and ComfyUI's /system_stats (the pre-redesign source, kept as fallback).
useEffect(() => {
- getSystemVRAM().then(v => setSystemVRAM(v))
+ getMaxVramGb().then(v => {
+ if (v > 0) setSystemVRAM(prev => Math.max(prev ?? 0, Math.round(v)))
+ }).catch(() => {})
+ getSystemVRAM().then(v => {
+ if (v) setSystemVRAM(prev => Math.max(prev ?? 0, v))
+ })
+ getTotalRamGb().then(r => { if (r > 0) setRamGb(r) }).catch(() => {})
}, [])
// Check which bundles are REALLY installed (file size validated, not just file existence)
@@ -288,6 +181,7 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
const vramFilteredBundles = tabFilteredBundles.filter(b => {
if (vramTier === 'all') return true
const vram = parseVRAM(b.vramRequired)
+ if (vramTier === 'fit') return systemVRAM ? vram <= systemVRAM + 2 : true
if (vramTier === 'ultra') return vram <= 4
if (vramTier === 'light') return vram > 4 && vram <= 10
if (vramTier === 'middle') return vram > 10 && vram <= 20
@@ -456,7 +350,33 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
return downloads[model.filename] ?? null
}
- // Progress calculation moved to DownloadBadge in Header
+ const retryBundle = (bundle: ModelBundle) => {
+ // Retry only the files that are NOT complete
+ for (const f of bundle.files) {
+ if (!f.filename || !f.downloadUrl || !f.subfolder) continue
+ const dl = downloads[f.filename]
+ // Retry if: explicit error, OR no download entry and not on disk
+ if (dl?.status === 'error') {
+ dlStore.getState().retry(f.filename)
+ } else if (!dl || (dl.status !== 'complete' && dl.status !== 'downloading' && dl.status !== 'connecting')) {
+ // File has no active download — start fresh
+ dlStore.getState().setMeta(f.filename, f.downloadUrl, f.subfolder)
+ startModelDownload(f.downloadUrl, f.subfolder, f.filename, f.sizeGB ? Math.round(f.sizeGB * 1_073_741_824) : undefined)
+ dlStore.getState().startPolling()
+ }
+ }
+ }
+
+ // Clear (the_mr_pickles): a bundle whose download keeps failing (bad URL,
+ // model pulled) was stuck on Retry with no escape — the user couldn't get it
+ // out of the error state to try another model. Dismiss ALL of the bundle's
+ // entries (not just errored — a partial-complete otherwise keeps
+ // hasBundleErrors true) so it resets to Install.
+ const clearBundle = (bundle: ModelBundle) => {
+ for (const f of bundle.files) {
+ if (f.filename) dlStore.getState().dismiss(f.filename)
+ }
+ }
const [hfSearchResults, setHfSearchResults] = useState<DiscoverModel[]>([])
@@ -470,9 +390,9 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
setLoading(false)
}
- // The search input now lives in the ModelManager header (uselu arrangement).
- // It feeds `search` (live filter) and bumps `searchSubmitToken` on Enter,
- // which we treat as "run the HuggingFace catalog search".
+ // The search input lives in the ModelManager header. It feeds `search`
+ // (live filter) and bumps `searchSubmitToken` on Enter, which we treat as
+ // "run the HuggingFace catalog search".
useEffect(() => {
if (searchSubmitToken > 0 && search.trim() && isText) handleSearch()
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -481,14 +401,15 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
const uncensoredModels = isText ? getUncensoredTextModels() : []
const mainstreamModels = isText ? getMainstreamTextModels() : []
- // Apply the VRAM tier filter to text models too (Feature 46, leonsk29 GH #46).
+ // Apply the size filter to text models too (Feature 46, leonsk29 GH #46).
// We use the model's GGUF `sizeGB` as a proxy for VRAM need — Q4 quants run
- // entirely on the GPU when sizeGB ≤ VRAM, so the same lightweight/mid/highend
- // bucketing as image/video applies here. Models without a `sizeGB` (cloud
- // / canPull:false placeholders) bypass the filter and always show.
+ // entirely on the GPU when sizeGB ≤ VRAM, so the same bucketing as
+ // image/video applies here. Models without a `sizeGB` (cloud / canPull:false
+ // placeholders) bypass the filter and always show.
const matchesVramTier = (sizeGB?: number) => {
if (vramTier === 'all') return true
if (sizeGB === undefined || sizeGB === null) return true
+ if (vramTier === 'fit') return systemVRAM ? computeFit(sizeGB, systemVRAM) !== 'big' : true
if (vramTier === 'ultra') return sizeGB <= 4
if (vramTier === 'light') return sizeGB > 4 && sizeGB <= 10
if (vramTier === 'middle') return sizeGB > 10 && sizeGB <= 20
@@ -655,57 +576,123 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
}
}
+ // ── Derived view data for the tile grid ─────────────────────────────
+
+ const activeTextModels = subTab === 'uncensored' ? filteredUncensored : filteredMainstream
+ const textGroups = isText ? groupModels(activeTextModels) : []
+
+ // "Start here" — up to 3 derived picks for the current tab. Pure derivation
+ // from existing flags (hot/agent/lightweight) + the hardware fit; no new
+ // catalog data and no picks while searching or filtering.
+ const showPicks = isText && !search && vramTier === 'all' && textGroups.length > 4
+ const scoredGroups = showPicks
+ ? [...textGroups]
+ .map(g => {
+ const rep = pickDefaultVariant(g, systemVRAM, isModelFullyInstalled, getModelDownloadState)
+ let score = 0
+ if (rep.hot) score += 2
+ if (rep.agent) score += 1
+ const fit = computeFit(rep.sizeGB, systemVRAM)
+ if (fit === 'fits') score += 2
+ else if (fit === 'tight') score += 1
+ if (!systemVRAM && rep.lightweight) score += 2
+ if (rep.canPull === false) score -= 2
+ if (isModelFullyInstalled(rep)) score -= 3
+ return { g, score }
+ })
+ .sort((a, b) => b.score - a.score)
+ : []
+ const topPicks = showPicks ? scoredGroups.slice(0, 3).filter(s => s.score > 1).map(s => s.g) : []
+ const pickKeys = new Set(topPicks.map(g => g[0].group ?? g[0].name))
+ const gridGroups = textGroups.filter(g => !pickKeys.has(g[0].group ?? g[0].name))
+
+ const infoRepoUrl = (m: DiscoverModel): string | null => {
+ if (m.url) return m.url
+ if (m.downloadUrl) {
+ const p = parseHfUrl(m.downloadUrl)
+ if (p) return `https://huggingface.co/${p.user}/${p.repo}`
+ }
+ return null
+ }
+
+ const renderTile = (group: DiscoverModel[], i: number, highlight = false) => (
+ <motion.div
+ key={group[0].group ?? group[0].name}
+ initial={{ opacity: 0, y: 8 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ delay: Math.min(i, 12) * 0.025 }}
+ >
+ <ModelTile
+ variants={group}
+ vramGb={systemVRAM}
+ isInstalled={isModelFullyInstalled}
+ dlState={getModelDownloadState}
+ onDownload={handleTextDownload}
+ onInfo={setInfoModel}
+ onOpenUrl={(u) => openExternal(u)}
+ highlight={highlight}
+ />
+ </motion.div>
+ )
+
return (
<div className="space-y-4">
- {/* Sub-tabs: Unfiltered / Mainstream — for all text sources and image/video */}
- {(isText || isImage || isVideo) && (
- <div className="flex gap-4 mb-4">
+ {/* Filter bar: Unfiltered/Mainstream + size chips + hardware chip */}
+ <div className="flex items-center gap-2 flex-wrap">
+ <div className="flex p-0.5 rounded-lg bg-gray-100 dark:bg-white/[0.04] border border-gray-200 dark:border-white/[0.06]">
<button
onClick={() => setSubTab('uncensored')}
- className={`flex items-center gap-2 transition-all ${
- subTab === 'uncensored' ? 'opacity-100' : 'opacity-40 hover:opacity-70'
+ aria-pressed={subTab === 'uncensored'}
+ title="No filters, no limits"
+ className={`flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[0.66rem] font-semibold transition-all ${
+ subTab === 'uncensored'
+ ? 'bg-white dark:bg-white/10 text-red-500 shadow-sm'
+ : 'text-gray-500 hover:text-gray-700 dark:hover:text-gray-300'
}`}
>
- <div className={`w-1 h-5 rounded-full ${subTab === 'uncensored' ? 'bg-red-500' : 'bg-red-500/50'}`} />
- <span className="text-[0.75rem] font-semibold text-gray-900 dark:text-white uppercase tracking-wider">Unfiltered</span>
- <span className="text-[0.55rem] text-gray-500">{isText ? 'No filters, no limits' : 'No content filter'}</span>
+ <Unlock size={11} /> Unfiltered
</button>
<button
onClick={() => setSubTab('mainstream')}
- className={`flex items-center gap-2 transition-all ${
- subTab === 'mainstream' ? 'opacity-100' : 'opacity-40 hover:opacity-70'
+ aria-pressed={subTab === 'mainstream'}
+ title="Popular models with tool calling + vision"
+ className={`flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[0.66rem] font-semibold transition-all ${
+ subTab === 'mainstream'
+ ? 'bg-white dark:bg-white/10 text-blue-500 shadow-sm'
+ : 'text-gray-500 hover:text-gray-700 dark:hover:text-gray-300'
}`}
>
- <div className={`w-1 h-5 rounded-full ${subTab === 'mainstream' ? 'bg-blue-500' : 'bg-blue-500/50'}`} />
- <span className="text-[0.75rem] font-semibold text-gray-900 dark:text-white uppercase tracking-wider">Mainstream</span>
- <span className="text-[0.55rem] text-gray-500">{isText ? 'Tool calling + vision' : 'Popular + high quality'}</span>
+ <ShieldCheck size={11} /> Mainstream
</button>
</div>
- )}
- {/* VRAM Tier Filter — image/video bundles AND text models (Feature 46,
- leonsk29 GH #46). Text models reuse the same tier thresholds, derived
- from each model's GGUF `sizeGB` (Q4 quant roughly equals VRAM need). */}
+ <div className="ml-auto">
+ <HardwareChip vramGb={systemVRAM} ramGb={ramGb} />
+ </div>
+ </div>
+
+ {/* Size chips — same buckets as the old VRAM-tier filter, plain labels */}
{(isImage || isVideo || (isText && (uncensoredModels.length > 0 || mainstreamModels.length > 0))) && (
- <div className="flex gap-1.5">
+ <div className="flex gap-1.5 flex-wrap">
{([
- { key: 'all', label: 'All', desc: '' },
- { key: 'ultra', label: 'Ultra Lightweight', desc: '≤4 GB' },
- { key: 'light', label: 'Lightweight', desc: '4–10 GB' },
- { key: 'middle', label: 'Middleweight', desc: '10–20 GB' },
- { key: 'highend', label: 'High-End', desc: '>20 GB' },
- ] as const).map(tier => (
+ { key: 'all' as SizeTier, label: 'All', desc: '' },
+ ...(systemVRAM ? [{ key: 'fit' as SizeTier, label: 'Fits my PC', desc: `≤${systemVRAM} GB` }] : []),
+ { key: 'ultra' as SizeTier, label: 'Tiny', desc: '≤4 GB' },
+ { key: 'light' as SizeTier, label: 'Small', desc: '4–10 GB' },
+ { key: 'middle' as SizeTier, label: 'Medium', desc: '10–20 GB' },
+ { key: 'highend' as SizeTier, label: 'Big', desc: '>20 GB' },
+ ]).map(tier => (
<button
key={tier.key}
onClick={() => setVramTier(tier.key)}
- className={`px-2.5 py-1 rounded-full text-[11px] font-medium transition-all ${
+ className={`px-2.5 py-1 rounded-full text-[11px] font-medium transition-all border ${
vramTier === tier.key
- ? 'bg-white/15 text-white border border-white/20'
- : 'text-gray-500 hover:text-gray-300 hover:bg-white/5'
+ ? 'bg-gray-900 text-white dark:bg-white/15 dark:text-white border-transparent dark:border-white/20'
+ : 'text-gray-500 border-gray-200 dark:border-white/[0.06] hover:text-gray-800 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-white/5'
}`}
>
{tier.label}
- {tier.desc && <span className="text-[9px] text-gray-500 ml-1">{tier.desc}</span>}
+ {tier.desc && <span className={`text-[9px] ml-1 ${vramTier === tier.key ? 'text-gray-300 dark:text-gray-400' : 'text-gray-400 dark:text-gray-500'}`}>{tier.desc}</span>}
</button>
))}
</div>
@@ -722,124 +709,30 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
</div>
)}
- {/* Model Bundles (Image + Video) — same grid style as text models */}
+ {/* Image / Video bundles */}
{(isImage || isVideo) && filteredBundles.length > 0 && (
- <div className="grid grid-cols-1 gap-2">
- {filteredBundles.map((bundle, bi) => {
- const complete = isBundleComplete(bundle)
- const downloading = isBundleDownloading(bundle) || installingBundle === bundle.name
- const isComingSoon = !bundle.verified && !complete
-
- return (
- <motion.div key={bundle.name} initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: bi * 0.03 }}>
- <div className={`rounded-lg border border-gray-200 dark:border-white/[0.06] bg-gray-50 dark:bg-white/[0.03] p-3 relative overflow-hidden transition-colors hover:bg-gray-100 dark:hover:bg-white/[0.05] ${isComingSoon ? 'opacity-50' : ''}`}>
- {isComingSoon && (
- <div className="absolute inset-0 z-10 flex items-center justify-center bg-black/40 backdrop-blur-[1px] rounded-lg">
- <span className="px-3 py-1.5 rounded-full bg-white/10 border border-white/20 text-white text-xs font-semibold tracking-wider">
- COMING SOON
- </span>
- </div>
- )}
- <div className="flex items-start justify-between gap-2">
- <div className="flex-1 min-w-0">
- <h3 className="text-sm font-medium text-gray-900 dark:text-white truncate flex items-center gap-1.5">
- {complete && <span className="text-[0.55rem] px-1.5 py-0.5 rounded bg-green-500/15 text-green-500 font-bold border border-green-500/30 shrink-0">INSTALLED</span>}
- {bundle.hot && !complete && <span className="text-[0.55rem] px-1.5 py-0.5 rounded bg-orange-500/15 text-orange-500 font-bold border border-orange-500/30 shrink-0">HOT</span>}
- <span className="truncate">{bundle.name}</span>
- </h3>
- {bundle.description && (
- <p className="text-xs text-gray-500 mt-0.5">{bundle.description}</p>
- )}
- <div className="flex items-center gap-2 mt-1.5 flex-wrap">
- {bundle.tags.map(t => (
- <span key={t} className="text-[10px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-white/5 text-gray-600 dark:text-gray-400">{t}</span>
- ))}
- {bundle.totalSizeGB && (
- <span className="text-[10px] text-gray-400">{bundle.totalSizeGB} GB</span>
- )}
- <span className="text-[10px] text-gray-400">{bundle.files.length} files</span>
- {systemVRAM && parseVRAM(bundle.vramRequired) <= systemVRAM && (
- <span className="text-[10px] px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-500 font-medium">Fits GPU</span>
- )}
- </div>
-
- {/* Progress shown exclusively in DownloadBadge (header) */}
- </div>
-
- <div className="flex items-center gap-1 shrink-0">
- {complete ? null : downloading ? (
- <span className="p-2 text-gray-400">
- <Loader2 size={14} className="animate-spin" />
- </span>
- ) : hasBundleErrors(bundle) ? (
- <>
- <button
- onClick={() => {
- // Retry only the files that are NOT complete
- for (const f of bundle.files) {
- if (!f.filename || !f.downloadUrl || !f.subfolder) continue
- const dl = downloads[f.filename]
- // Retry if: explicit error, OR no download entry and not on disk
- if (dl?.status === 'error') {
- dlStore.getState().retry(f.filename)
- } else if (!dl || (dl.status !== 'complete' && dl.status !== 'downloading' && dl.status !== 'connecting')) {
- // File has no active download — start fresh
- dlStore.getState().setMeta(f.filename, f.downloadUrl, f.subfolder)
- startModelDownload(f.downloadUrl, f.subfolder, f.filename, f.sizeGB ? Math.round(f.sizeGB * 1_073_741_824) : undefined)
- dlStore.getState().startPolling()
- }
- }
- }}
- className="flex items-center gap-1 px-2 py-1.5 rounded-lg bg-red-100 dark:bg-red-500/15 hover:bg-red-200 dark:hover:bg-red-500/25 text-red-700 dark:text-red-400 transition-all text-xs"
- title="Retry failed downloads"
- >
- <RefreshCw size={12} />
- <span>Retry</span>
- </button>
- {/* Clear (the_mr_pickles): a bundle whose download keeps
- failing (bad URL, model pulled) was stuck on Retry with
- no escape — the user couldn't get it out of the error
- state to try another model. Dismiss ALL of the bundle's
- entries (not just errored — a partial-complete otherwise
- keeps hasBundleErrors true) so it resets to Install. */}
- <button
- onClick={() => {
- for (const f of bundle.files) {
- if (f.filename) dlStore.getState().dismiss(f.filename)
- }
- }}
- className="flex items-center gap-1 px-2 py-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-gray-400 transition-all text-xs"
- title="Clear this failed download so you can start over or pick another model"
- >
- <X size={12} />
- <span>Clear</span>
- </button>
- </>
- ) : (
- <button
- onClick={() => handleBundleInstall(bundle)}
- className="p-2 rounded-lg bg-green-100 dark:bg-green-500/15 hover:bg-green-200 dark:hover:bg-green-500/25 text-green-700 dark:text-green-400 transition-all"
- title={`Install all ${bundle.files.length} files (${bundle.totalSizeGB} GB)`}
- >
- <Download size={14} />
- </button>
- )}
- {bundle.url && (
- <button onClick={() => openExternal(bundle.url!)} className="p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 transition-all" title="View on HuggingFace">
- <ExternalLink size={14} />
- </button>
- )}
- </div>
- </div>
- </div>
- </motion.div>
- )
- })}
+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-2.5">
+ {filteredBundles.map((bundle, bi) => (
+ <motion.div key={bundle.name} initial={{ opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: Math.min(bi, 12) * 0.025 }}>
+ <BundleTile
+ bundle={bundle}
+ vramGb={systemVRAM}
+ complete={isBundleComplete(bundle)}
+ downloading={isBundleDownloading(bundle) || installingBundle === bundle.name}
+ hasErrors={hasBundleErrors(bundle)}
+ onInstall={() => handleBundleInstall(bundle)}
+ onRetry={() => retryBundle(bundle)}
+ onClear={() => clearBundle(bundle)}
+ onOpenUrl={(u) => openExternal(u)}
+ parseVRAM={parseVRAM}
+ />
+ </motion.div>
+ ))}
</div>
)}
{(isImage || isVideo) && sortedBundles.length > 0 && filteredBundles.length === 0 && (
- <p className="text-center text-gray-500 py-4 text-sm">No models match this VRAM tier. Try a different filter.</p>
+ <p className="text-center text-gray-500 py-4 text-sm">No models match this size filter. Try a different one.</p>
)}
{/* CivitAI Search (Image & Video) */}
@@ -869,7 +762,7 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
))}
</div>
</div>
- <div className="flex gap-2 w-1/2 mx-auto">
+ <div className="flex gap-2 w-full sm:w-2/3 lg:w-1/2 mx-auto">
<input
value={civitaiQuery}
onChange={(e) => setCivitaiQuery(e.target.value)}
@@ -945,34 +838,61 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
<div className="text-center py-8 text-gray-500">Loading models...</div>
) : isText ? (
<>
- {subTab === 'uncensored' && (
- <div className="grid grid-cols-1 gap-2">
- {filteredUncensored.map((model, i) => (
- <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} isModelFullyInstalled={isModelFullyInstalled} handleDownload={handleTextDownload} />
- ))}
- {filteredUncensored.length === 0 && (
- <p className="text-center text-gray-500 py-4 col-span-2">No unfiltered models match your search</p>
- )}
+ {/* Start here — derived picks, only in the unfiltered default view */}
+ {topPicks.length >= 2 && (
+ <div className="space-y-1.5">
+ <div className="flex items-center gap-1.5 px-1">
+ <Sparkles size={11} className="text-violet-500 dark:text-violet-400" />
+ <h3 className="text-[0.62rem] font-semibold uppercase tracking-[0.12em] text-gray-700 dark:text-gray-300">Start here</h3>
+ <span className="text-[0.55rem] text-gray-400 dark:text-gray-500">picked for your PC</span>
+ <div className="flex-1 h-px bg-gray-200 dark:bg-white/[0.06]" />
+ </div>
+ <div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2.5">
+ {topPicks.map((g, i) => renderTile(g, i, true))}
+ </div>
</div>
)}
- {subTab === 'mainstream' && (
- <div className="grid grid-cols-1 gap-2">
- {filteredMainstream.map((model, i) => (
- <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} isModelFullyInstalled={isModelFullyInstalled} handleDownload={handleTextDownload} />
- ))}
- {filteredMainstream.length === 0 && (
- <p className="text-center text-gray-500 py-4 col-span-2">No mainstream models match your search</p>
- )}
+
+ <div className="space-y-1.5">
+ {topPicks.length >= 2 && (
+ <div className="flex items-center gap-1.5 px-1 pt-1">
+ <h3 className="text-[0.62rem] font-semibold uppercase tracking-[0.12em] text-gray-700 dark:text-gray-300">
+ {subTab === 'uncensored' ? 'All unfiltered models' : 'All mainstream models'}
+ </h3>
+ <div className="flex-1 h-px bg-gray-200 dark:bg-white/[0.06]" />
+ </div>
+ )}
+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-2.5">
+ {gridGroups.map((g, i) => renderTile(g, i))}
</div>
- )}
+ {activeTextModels.length === 0 && (
+ <p className="text-center text-gray-500 py-4">
+ {subTab === 'uncensored' ? 'No unfiltered models match your search' : 'No mainstream models match your search'}
+ </p>
+ )}
+ </div>
{/* HuggingFace Search Results */}
{hfSearchResults.length > 0 && (
- <div className="space-y-3 mt-6">
- <h3 className="text-[0.7rem] font-semibold text-gray-500 uppercase tracking-wider">HuggingFace Search Results</h3>
- <div className="grid grid-cols-1 gap-2">
+ <div className="space-y-1.5 mt-6">
+ <div className="flex items-center gap-1.5 px-1">
+ <Search size={10} className="text-gray-400" />
+ <h3 className="text-[0.62rem] font-semibold uppercase tracking-[0.12em] text-gray-500">HuggingFace results</h3>
+ <div className="flex-1 h-px bg-gray-200 dark:bg-white/[0.06]" />
+ </div>
+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-2.5">
{hfSearchResults.map((model, i) => (
- <ModelDiscoverCard key={model.name + i} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} isModelFullyInstalled={isModelFullyInstalled} handleDownload={handleTextDownload} />
+ <motion.div key={model.name + i} initial={{ opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: Math.min(i, 12) * 0.025 }}>
+ <ModelTile
+ variants={[model]}
+ vramGb={systemVRAM}
+ isInstalled={isModelFullyInstalled}
+ dlState={getModelDownloadState}
+ onDownload={handleTextDownload}
+ onInfo={setInfoModel}
+ onOpenUrl={(u) => openExternal(u)}
+ />
+ </motion.div>
))}
</div>
</div>
@@ -984,6 +904,31 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
<p className="text-center text-gray-500 py-4">No models found</p>
)}
+ {/* Details modal — the full catalog description, tags and links */}
+ <Modal open={!!infoModel} onClose={() => setInfoModel(null)} title={infoModel?.group ? `${infoModel.group} — ${infoModel.name}` : (infoModel?.name || 'Model')}>
+ {infoModel && (
+ <div className="space-y-3">
+ <p className="text-[0.72rem] text-gray-700 dark:text-gray-200 leading-relaxed">{infoModel.description}</p>
+ <div className="flex items-center gap-1.5 flex-wrap">
+ {infoModel.tags.map(t => (
+ <span key={t} className="text-[10px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-white/5 text-gray-600 dark:text-gray-400">{t}</span>
+ ))}
+ {infoModel.sizeGB && <span className="text-[10px] text-gray-400">{infoModel.sizeGB} GB</span>}
+ {infoModel.pulls && <span className="text-[10px] text-gray-400">{infoModel.pulls} pulls</span>}
+ {infoModel.released && <span className="text-[10px] text-gray-400">released {infoModel.released}</span>}
+ </div>
+ {infoRepoUrl(infoModel) && (
+ <button
+ onClick={() => openExternal(infoRepoUrl(infoModel)!)}
+ className="flex items-center gap-1.5 text-[0.65rem] text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors"
+ >
+ <ExternalLink size={11} /> View on HuggingFace
+ </button>
+ )}
+ </div>
+ )}
+ </Modal>
+
<Modal open={!!confirmDownload} onClose={() => setConfirmDownload(null)} title="Download multi-part model">
{confirmDownload && (
<div className="space-y-3">
diff --git a/src/components/models/ModelManager.tsx b/src/components/models/ModelManager.tsx
index 3ec87ccb..15e182a8 100644
--- a/src/components/models/ModelManager.tsx
+++ b/src/components/models/ModelManager.tsx
@@ -1,8 +1,8 @@
import { useState, useEffect, useRef } from 'react'
import { motion } from 'framer-motion'
import {
- Download, ArrowLeft, RefreshCw, Search, MessageSquare, Image, Video,
- X as XIcon, HardDrive, Sparkles, PackageOpen,
+ Download, ArrowLeft, RefreshCw, Search, MessagesSquare, Images, Clapperboard,
+ X as XIcon, HardDrive, Sparkles, PackageOpen, Video as VideoIcon, Image as ImageIcon,
} from 'lucide-react'
import { useModels } from '../../hooks/useModels'
import { useUIStore } from '../../stores/uiStore'
@@ -16,15 +16,14 @@ import { showModel } from '../../api/ollama'
import { checkComfyConnection } from '../../api/comfyui'
import type { ModelCategory, AIModel } from '../../types/models'
-// Three-mode filter shared by both Installed and Discover banners. There is no
-// "All" tab — the Installed view shows the active mode's section instead, so
-// the toggle stays a clean three-choice control.
+// One category drives BOTH views (Discover + Installed) — the old split
+// discoverMode/categoryFilter pair collapsed into the persisted store value.
type Mode = Extract<ModelCategory, 'text' | 'image' | 'video'>
-const MODE_TABS: { key: Mode; label: string; icon: typeof MessageSquare; accent: string }[] = [
- { key: 'text', label: 'Text', icon: MessageSquare, accent: 'text-blue-400' },
- { key: 'image', label: 'Image', icon: Image, accent: 'text-purple-400' },
- { key: 'video', label: 'Video', icon: Video, accent: 'text-emerald-400' },
+const RAIL_ITEMS: { key: Mode; label: string; icon: typeof MessagesSquare; accent: string }[] = [
+ { key: 'text', label: 'Chat', icon: MessagesSquare, accent: 'text-blue-500 dark:text-blue-400' },
+ { key: 'image', label: 'Image', icon: Images, accent: 'text-purple-500 dark:text-purple-400' },
+ { key: 'video', label: 'Video', icon: Clapperboard, accent: 'text-emerald-500 dark:text-emerald-400' },
]
export function ModelManager() {
@@ -35,35 +34,25 @@ export function ModelManager() {
const [infoOpen, setInfoOpen] = useState(false)
const [modelInfo, setModelInfo] = useState<any>(null)
const [confirmDelete, setConfirmDelete] = useState<string | null>(null)
- // Open Model Manager on Discover by default — most opens are to find and
- // install something new. Installed (right icon) is one click away.
+ // Open on Discover by default — most opens are to find and install
+ // something new. Installed is one click away in the segment control.
const [tab, setTab] = useState<'installed' | 'discover'>('discover')
- // Discover-specific mode lives in the parent so the centered banner row
- // (rendered outside the max-w-4xl column) stays in sync with the view.
- const [discoverMode, setDiscoverMode] = useState<Mode>('text')
-
- // Inline search lives in the header — the magnifier toggles a sliding input
- // that submits to Discover (live filter + HF catalog search on Enter).
- const [searchOpen, setSearchOpen] = useState(false)
+ // Header search: always visible (no hidden magnifier), live filter +
+ // Enter submits the HuggingFace catalog search in Discover.
const [searchQuery, setSearchQuery] = useState('')
const [searchSubmitToken, setSearchSubmitToken] = useState(0)
const searchInputRef = useRef<HTMLInputElement>(null)
- useEffect(() => {
- if (searchOpen) searchInputRef.current?.focus()
- }, [searchOpen])
-
// The store still defaults categoryFilter to 'all' for legacy reasons, but
- // the All tab is gone — coerce to 'text' on mount so the user never lands
- // on an unselected state.
+ // there is no All rail item — coerce to 'text' on mount so the user never
+ // lands on an unselected state.
useEffect(() => {
if (categoryFilter === 'all') setCategoryFilter('text')
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
- // The Installed banner is driven by the same Mode tuple as Discover.
- const installedMode: Mode = (categoryFilter === 'text' || categoryFilter === 'image' || categoryFilter === 'video')
+ const mode: Mode = (categoryFilter === 'text' || categoryFilter === 'image' || categoryFilter === 'video')
? categoryFilter
: 'text'
@@ -86,7 +75,8 @@ export function ModelManager() {
setConfirmDelete(null)
}
- const filteredModels = models.filter((m: AIModel) => m.type === installedMode)
+ const filteredModels = models.filter((m: AIModel) => m.type === mode)
+ const modeMeta = RAIL_ITEMS.find(r => r.key === mode)!
// d37d7bf5 + neejuh (2.5.5): "models show installed in Discover but the
// Installed tab is empty and I can't select them." Image/video models are
@@ -97,7 +87,7 @@ export function ModelManager() {
// with a ONE-SHOT reachability check (never a poll — keep the app light, #70)
// so we can show the real reason instead of a misleading "no models installed".
const [comfyReachable, setComfyReachable] = useState<boolean | null>(null)
- const imageOrVideo = installedMode === 'image' || installedMode === 'video'
+ const imageOrVideo = mode === 'image' || mode === 'video'
useEffect(() => {
if (!(tab === 'installed' && imageOrVideo && filteredModels.length === 0)) return
let alive = true
@@ -115,79 +105,107 @@ export function ModelManager() {
// ── Render ──────────────────────────────────────────────────────
return (
- <div className="h-full overflow-y-auto scrollbar-thin p-4">
- {/* Header — bounded to the same column as the model list so the back
- arrow and title line up with the cards beneath. */}
- <div className="max-w-4xl mx-auto">
- <div className="flex items-center justify-between mb-4">
+ <div className="h-full flex overflow-hidden">
+ {/* Category rail — the big, labeled home of Chat / Image / Video */}
+ <aside className="shrink-0 w-12 lg:w-36 border-r border-gray-200 dark:border-white/[0.06] bg-gray-50/60 dark:bg-white/[0.015] flex flex-col py-3 px-1.5 lg:px-2 gap-1">
+ {RAIL_ITEMS.map(({ key, label, icon: Icon, accent }) => {
+ const active = mode === key
+ const count = models.filter((m) => m.type === key).length
+ return (
+ <button
+ key={key}
+ onClick={() => setCategoryFilter(key)}
+ title={label}
+ aria-pressed={active}
+ className={`flex items-center justify-center lg:justify-start gap-2 px-2 py-2 rounded-lg transition-colors ${
+ active
+ ? 'bg-white dark:bg-white/[0.08] shadow-sm border border-gray-200 dark:border-white/[0.08]'
+ : 'border border-transparent hover:bg-gray-100 dark:hover:bg-white/[0.04]'
+ }`}
+ >
+ <Icon size={15} className={active ? accent : 'text-gray-400 dark:text-gray-500'} />
+ <span className={`hidden lg:block text-[0.68rem] font-medium ${active ? 'text-gray-900 dark:text-white' : 'text-gray-500 dark:text-gray-400'}`}>
+ {label}
+ </span>
+ {count > 0 && (
+ <span className="hidden lg:block ml-auto text-[0.55rem] text-gray-400 dark:text-gray-500 tabular-nums">{count}</span>
+ )}
+ </button>
+ )
+ })}
+ <div className="mt-auto hidden lg:block px-2 pb-1 text-[0.5rem] leading-relaxed text-gray-400 dark:text-gray-600">
+ Models run 100% on your computer.
+ </div>
+ </aside>
+
+ {/* Content */}
+ <div className="flex-1 min-w-0 overflow-y-auto scrollbar-thin">
+ <div className="p-4 max-w-5xl mx-auto space-y-4">
+ {/* Top bar */}
<div className="flex items-center gap-2">
<button
onClick={() => setView('chat')}
className="p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors"
+ title="Back to chat"
>
<ArrowLeft size={16} />
</button>
- <h1 className="text-[0.8rem] font-semibold text-gray-800 dark:text-gray-200">Model Manager</h1>
+ <h1 className="text-[0.85rem] font-semibold text-gray-900 dark:text-white">Models</h1>
- {/* Mode toggle — Discover (left) · Installed (right). */}
- <div className="ml-1 flex items-center gap-0.5 p-0.5 rounded-lg bg-gray-100 dark:bg-white/[0.04] border border-gray-200 dark:border-white/[0.06]">
+ {/* Discover / Installed segment */}
+ <div className="ml-2 flex items-center p-0.5 rounded-lg bg-gray-100 dark:bg-white/[0.04] border border-gray-200 dark:border-white/[0.06]">
<button
onClick={() => setTab('discover')}
- title="Discover new models"
aria-pressed={tab === 'discover'}
- className={`flex items-center justify-center w-[26px] h-[20px] rounded-md transition-colors ${
+ className={`flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[0.62rem] font-semibold transition-colors ${
tab === 'discover'
- ? 'bg-white dark:bg-white/10 text-amber-500 dark:text-amber-300 shadow-sm'
+ ? 'bg-white dark:bg-white/10 text-amber-600 dark:text-amber-300 shadow-sm'
: 'text-gray-500 hover:text-gray-700 dark:hover:text-gray-300'
}`}
>
- <Sparkles size={11} />
+ <Sparkles size={11} /> Get new
</button>
<button
onClick={() => setTab('installed')}
- title={`Installed — ${models.length} model${models.length === 1 ? '' : 's'}`}
aria-pressed={tab === 'installed'}
- className={`flex items-center gap-1 px-1.5 py-0.5 rounded-md transition-colors ${
+ className={`flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[0.62rem] font-semibold transition-colors ${
tab === 'installed'
- ? 'bg-white dark:bg-white/10 text-blue-500 dark:text-blue-400 shadow-sm'
+ ? 'bg-white dark:bg-white/10 text-blue-600 dark:text-blue-400 shadow-sm'
: 'text-gray-500 hover:text-gray-700 dark:hover:text-gray-300'
}`}
>
- <HardDrive size={11} />
- <span className="text-[0.55rem] font-semibold">{models.length}</span>
+ <HardDrive size={11} /> Installed
+ <span className="text-[0.55rem] font-normal opacity-70 tabular-nums">{filteredModels.length}</span>
</button>
</div>
- </div>
- <div className="flex items-center gap-1.5">
- {/* Sliding search input */}
- <div className={`flex items-center transition-[width,opacity] duration-200 ease-out overflow-hidden ${
- searchOpen ? 'w-48 opacity-100' : 'w-0 opacity-0'
- }`}>
+ <div className="flex-1" />
+
+ {/* Always-visible search */}
+ <div className="relative w-40 sm:w-56">
+ <Search size={12} className="absolute left-2 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none" />
<input
ref={searchInputRef}
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
onKeyDown={(e) => {
if (e.key === 'Enter') { setTab('discover'); setSearchSubmitToken((t) => t + 1) }
- else if (e.key === 'Escape') { setSearchQuery(''); setSearchOpen(false) }
+ else if (e.key === 'Escape') setSearchQuery('')
}}
- onBlur={() => { if (!searchQuery) setSearchOpen(false) }}
placeholder="Search models…"
- className="w-full px-2.5 py-1 rounded-md bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/10 text-[0.65rem] text-gray-900 dark:text-white placeholder-gray-500 focus:outline-none focus:border-gray-400 dark:focus:border-white/20"
+ className="w-full pl-7 pr-6 py-1.5 rounded-lg bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/10 text-[0.65rem] text-gray-900 dark:text-white placeholder-gray-500 focus:outline-none focus:border-gray-400 dark:focus:border-white/20"
/>
+ {searchQuery && (
+ <button
+ onClick={() => setSearchQuery('')}
+ className="absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 rounded text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"
+ title="Clear search"
+ aria-label="Clear search"
+ >
+ <XIcon size={11} />
+ </button>
+ )}
</div>
- <button
- onClick={() => {
- if (searchOpen && searchQuery) { setSearchQuery(''); setSearchOpen(false) }
- else setSearchOpen((o) => !o)
- }}
- title={searchOpen ? (searchQuery ? 'Clear search' : 'Close search') : 'Search models'}
- className="p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 hover:text-gray-900 dark:hover:text-white transition-colors"
- aria-label="Search models"
- >
- {searchOpen && searchQuery ? <XIcon size={13} /> : <Search size={13} />}
- </button>
<button onClick={fetchModels} className="p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 hover:text-gray-900 dark:hover:text-white transition-colors" title="Refresh">
<RefreshCw size={13} />
@@ -195,158 +213,129 @@ export function ModelManager() {
{ollamaEnabled && (
<button
onClick={() => setPullOpen(true)}
- className="flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/10 text-[0.65rem] text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-white/10 transition-colors"
+ className="flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/10 text-[0.62rem] text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-white/10 transition-colors"
+ title="Pull any Ollama model by name"
>
- <Download size={12} /> Pull Model
+ <Download size={11} /> Pull
</button>
)}
</div>
- </div>
- </div>
-
- {/* Banner — rendered OUTSIDE the max-w-4xl column so it sits at the true
- horizontal centre of the view. */}
- <div className="flex justify-center items-center gap-2 mb-5">
- <div className="flex gap-0.5 p-0.5 bg-gray-100 dark:bg-white/[0.04] rounded-lg border border-gray-200 dark:border-white/[0.06]">
- {MODE_TABS.map(({ key, label, icon: Icon, accent }) => {
- const active = tab === 'installed' ? installedMode === key : discoverMode === key
- const count = tab === 'installed' ? models.filter((m) => m.type === key).length : null
- return (
- <button
- key={key}
- onClick={() => {
- if (tab === 'installed') setCategoryFilter(key)
- else setDiscoverMode(key)
- }}
- className={`flex items-center gap-1 px-2 py-1 rounded-md text-[0.6rem] font-medium transition-all ${
- active
- ? 'bg-white dark:bg-white/10 text-gray-900 dark:text-white shadow-sm'
- : 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300'
- }`}
- >
- <Icon size={10} className={active ? accent : ''} />
- <span>{label}</span>
- {count !== null && (
- <span className={`text-[0.55rem] font-normal ${active ? 'text-gray-400 dark:text-gray-500' : 'text-gray-400 dark:text-gray-600'}`}>
- {count}
- </span>
- )}
- </button>
- )
- })}
- </div>
- </div>
- {/* Content column */}
- <div className="max-w-4xl mx-auto">
- {tab === 'installed' && (
- <>
- {imageOrVideo && filteredModels.length === 0 && comfyReachable !== true ? (
- // comfyReachable: null = still probing, false = confirmed down.
- // Never show the misleading "no models installed" here while the
- // probe is pending — on desktop checkComfyConnection has to time
- // out when ComfyUI is down (a few seconds), and that flashed the
- // wrong message before the hint appeared (caught in desktop E2E).
- comfyReachable === null ? (
- <div className="text-center py-16 px-6">
- <p className="text-[0.7rem] text-gray-500">Checking ComfyUI…</p>
- </div>
- ) : (
- <div className="flex flex-col items-center justify-center text-center py-16 px-6 gap-3">
- <div className="w-14 h-14 rounded-full bg-gray-100 dark:bg-white/[0.04] border border-gray-200 dark:border-white/[0.06] flex items-center justify-center">
- {installedMode === 'video' ? <Video size={22} className="text-gray-400 dark:text-gray-500" /> : <Image size={22} className="text-gray-400 dark:text-gray-500" />}
- </div>
- <div className="space-y-1">
- <p className="text-[0.75rem] font-medium text-gray-800 dark:text-gray-200">Start ComfyUI to see your {installedMode} models</p>
- <p className="text-[0.6rem] text-gray-500 max-w-[300px] leading-relaxed">
- {installedMode === 'image' ? 'Image' : 'Video'} models are served by ComfyUI, which isn't running right now — so the ones you've downloaded can't be listed yet. Open the Create tab and start ComfyUI (the power button next to the model picker), then come back.
- </p>
+ {/* Views */}
+ {tab === 'installed' && (
+ <>
+ {imageOrVideo && filteredModels.length === 0 && comfyReachable !== true ? (
+ // comfyReachable: null = still probing, false = confirmed down.
+ // Never show the misleading "no models installed" here while the
+ // probe is pending — on desktop checkComfyConnection has to time
+ // out when ComfyUI is down (a few seconds), and that flashed the
+ // wrong message before the hint appeared (caught in desktop E2E).
+ comfyReachable === null ? (
+ <div className="text-center py-16 px-6">
+ <p className="text-[0.7rem] text-gray-500">Checking ComfyUI…</p>
+ </div>
+ ) : (
+ <div className="flex flex-col items-center justify-center text-center py-16 px-6 gap-3">
+ <div className="w-14 h-14 rounded-full bg-gray-100 dark:bg-white/[0.04] border border-gray-200 dark:border-white/[0.06] flex items-center justify-center">
+ {mode === 'video' ? <VideoIcon size={22} className="text-gray-400 dark:text-gray-500" /> : <ImageIcon size={22} className="text-gray-400 dark:text-gray-500" />}
+ </div>
+ <div className="space-y-1">
+ <p className="text-[0.75rem] font-medium text-gray-800 dark:text-gray-200">Start ComfyUI to see your {mode} models</p>
+ <p className="text-[0.6rem] text-gray-500 max-w-[300px] leading-relaxed">
+ {mode === 'image' ? 'Image' : 'Video'} models are served by ComfyUI, which isn't running right now — so the ones you've downloaded can't be listed yet. Open the Create tab and start ComfyUI (the power button next to the model picker), then come back.
+ </p>
+ </div>
+ <button
+ onClick={() => setView('create')}
+ className="flex items-center gap-1.5 mt-1 px-3 py-1.5 rounded-md bg-gray-900 dark:bg-white/10 hover:bg-gray-800 dark:hover:bg-white/15 text-white text-[0.65rem] font-medium transition-colors"
+ >
+ <Sparkles size={11} /> Go to Create
+ </button>
</div>
- <button
- onClick={() => setView('create')}
- className="flex items-center gap-1.5 mt-1 px-3 py-1.5 rounded-md bg-gray-900 dark:bg-white/10 hover:bg-gray-800 dark:hover:bg-white/15 text-white text-[0.65rem] font-medium transition-colors"
- >
- <Sparkles size={11} /> Go to Create
- </button>
- </div>
- )
- ) : models.length === 0 ? (
- <div className="flex flex-col items-center justify-center text-center py-16 px-6 gap-3">
- <div className="w-14 h-14 rounded-full bg-gray-100 dark:bg-white/[0.04] border border-gray-200 dark:border-white/[0.06] flex items-center justify-center">
- <PackageOpen size={22} className="text-gray-400 dark:text-gray-500" />
+ )
+ ) : models.length === 0 ? (
+ <div className="flex flex-col items-center justify-center text-center py-16 px-6 gap-3">
+ <div className="w-14 h-14 rounded-full bg-gray-100 dark:bg-white/[0.04] border border-gray-200 dark:border-white/[0.06] flex items-center justify-center">
+ <PackageOpen size={22} className="text-gray-400 dark:text-gray-500" />
+ </div>
+ <div className="space-y-1">
+ <p className="text-[0.75rem] font-medium text-gray-800 dark:text-gray-200">No models installed yet</p>
+ <p className="text-[0.6rem] text-gray-500 max-w-[280px] leading-relaxed">
+ Browse curated chat, image and video models and install them with one click.
+ </p>
+ </div>
+ <button
+ onClick={() => setTab('discover')}
+ className="flex items-center gap-1.5 mt-1 px-3 py-1.5 rounded-md bg-gray-900 dark:bg-white/10 hover:bg-gray-800 dark:hover:bg-white/15 text-white text-[0.65rem] font-medium transition-colors"
+ >
+ <Sparkles size={11} /> Discover models
+ </button>
</div>
- <div className="space-y-1">
- <p className="text-[0.75rem] font-medium text-gray-800 dark:text-gray-200">No models installed yet</p>
- <p className="text-[0.6rem] text-gray-500 max-w-[280px] leading-relaxed">
- Browse curated text, image and video models in Discover and install them with one click.
+ ) : filteredModels.length === 0 ? (
+ <div className="text-center py-10 space-y-2">
+ <p className="text-[0.7rem] text-gray-500">
+ No {modeMeta.label.toLowerCase()} models installed
</p>
+ <button
+ onClick={() => setTab('discover')}
+ className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/10 text-[0.65rem] text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-white/10 transition-colors"
+ >
+ <Sparkles size={11} /> Discover {modeMeta.label.toLowerCase()} models
+ </button>
</div>
- <button
- onClick={() => setTab('discover')}
- className="flex items-center gap-1.5 mt-1 px-3 py-1.5 rounded-md bg-gray-900 dark:bg-white/10 hover:bg-gray-800 dark:hover:bg-white/15 text-white text-[0.65rem] font-medium transition-colors"
- >
- <Sparkles size={11} /> Discover models
- </button>
- </div>
- ) : filteredModels.length === 0 ? (
- <div className="text-center py-10 space-y-2">
- <p className="text-[0.7rem] text-gray-500">
- No {installedMode} models installed
- </p>
- <button
- onClick={() => setTab('discover')}
- className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/10 text-[0.65rem] text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-white/10 transition-colors"
- >
- <Sparkles size={11} /> Discover {installedMode} models
- </button>
- </div>
- ) : (
- (() => {
- const meta = MODE_TABS.find((s) => s.key === installedMode)!
- const SectionIcon = meta.icon
- return (
- <section className="space-y-1.5">
- <div className="flex items-center gap-2 px-1">
- <SectionIcon size={11} className={meta.accent} />
- <h2 className="text-[0.62rem] font-semibold uppercase tracking-[0.12em] text-gray-700 dark:text-gray-300">
- {meta.label}
- </h2>
- <span className="text-[0.55rem] text-gray-400 dark:text-gray-500 tabular-nums">{filteredModels.length}</span>
- <div className="flex-1 h-px bg-gray-200 dark:bg-white/[0.06]" />
- </div>
- <div className="space-y-1.5">
- {filteredModels.map((model, i) => (
- <motion.div
- key={model.name}
- initial={{ opacity: 0, y: 4 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ delay: i * 0.015 }}
- >
- <ModelCard
- model={model}
- isActive={model.name === activeModel}
- onSelect={() => setActiveModel(model.name)}
- onDelete={() => setConfirmDelete(model.name)}
- onInfo={() => handleInfo(model.name)}
- canDelete={ollamaEnabled && model.type === 'text' && (!('provider' in model) || model.provider === 'ollama')}
- />
- </motion.div>
- ))}
- </div>
- </section>
- )
- })()
- )}
- </>
- )}
+ ) : (
+ (() => {
+ const SectionIcon = modeMeta.icon
+ const shown = searchQuery
+ ? filteredModels.filter(m => m.name.toLowerCase().includes(searchQuery.toLowerCase()))
+ : filteredModels
+ return (
+ <section className="space-y-1.5">
+ <div className="flex items-center gap-2 px-1">
+ <SectionIcon size={11} className={modeMeta.accent} />
+ <h2 className="text-[0.62rem] font-semibold uppercase tracking-[0.12em] text-gray-700 dark:text-gray-300">
+ {modeMeta.label}
+ </h2>
+ <span className="text-[0.55rem] text-gray-400 dark:text-gray-500 tabular-nums">{shown.length}</span>
+ <div className="flex-1 h-px bg-gray-200 dark:bg-white/[0.06]" />
+ </div>
+ <div className="space-y-1.5">
+ {shown.map((model, i) => (
+ <motion.div
+ key={model.name}
+ initial={{ opacity: 0, y: 4 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ delay: i * 0.015 }}
+ >
+ <ModelCard
+ model={model}
+ isActive={model.name === activeModel}
+ onSelect={() => setActiveModel(model.name)}
+ onDelete={() => setConfirmDelete(model.name)}
+ onInfo={() => handleInfo(model.name)}
+ canDelete={ollamaEnabled && model.type === 'text' && (!('provider' in model) || model.provider === 'ollama')}
+ />
+ </motion.div>
+ ))}
+ {shown.length === 0 && (
+ <p className="text-center text-[0.65rem] text-gray-500 py-6">No installed {modeMeta.label.toLowerCase()} models match "{searchQuery}"</p>
+ )}
+ </div>
+ </section>
+ )
+ })()
+ )}
+ </>
+ )}
- {tab === 'discover' && (
- <DiscoverModels
- category={discoverMode}
- search={searchQuery}
- searchSubmitToken={searchSubmitToken}
- />
- )}
+ {tab === 'discover' && (
+ <DiscoverModels
+ category={mode}
+ search={searchQuery}
+ searchSubmitToken={searchSubmitToken}
+ />
+ )}
+ </div>
</div>
<PullModelDialog open={pullOpen} onClose={() => setPullOpen(false)} />
diff --git a/src/components/models/ModelTiles.tsx b/src/components/models/ModelTiles.tsx
new file mode 100644
index 00000000..8c30bbe2
--- /dev/null
+++ b/src/components/models/ModelTiles.tsx
@@ -0,0 +1,450 @@
+// Presentational building blocks for the redesigned Model Manager ("Model
+// Hub"). All download/install LOGIC stays in DiscoverModels/ModelManager —
+// these components only render state and forward events, so the existing
+// handlers (Ollama routing, sharded confirm, bundle retry/clear, …) keep
+// working unchanged behind a new surface.
+import { useEffect, useRef, useState } from 'react'
+import {
+ Download, ExternalLink, Info, Check, ChevronDown, Loader2, RefreshCw,
+ X, Flame, Wrench, Eye, Feather, HardDrive,
+} from 'lucide-react'
+import type { DiscoverModel, DownloadProgress, ModelBundle } from '../../api/discover'
+import { formatBytes } from '../../lib/formatters'
+
+// ─── Family monogram ────────────────────────────────────────────────
+
+// Deterministic gradient per model family so the grid gets stable visual
+// anchors without shipping any artwork. Index = simple string hash.
+const MONOGRAM_GRADIENTS = [
+ 'from-violet-500/80 to-fuchsia-500/60',
+ 'from-sky-500/80 to-cyan-400/60',
+ 'from-emerald-500/80 to-teal-400/60',
+ 'from-amber-500/80 to-orange-500/60',
+ 'from-rose-500/80 to-pink-500/60',
+ 'from-indigo-500/80 to-blue-500/60',
+ 'from-lime-500/80 to-green-500/60',
+ 'from-purple-500/80 to-violet-400/60',
+]
+
+export function familyOf(name: string): string {
+ // "Qwen 3.6 27B Samantha Unfiltered" → "Qwen" · "GPT-OSS 20B" → "GPT-OSS"
+ const first = (name || '?').trim().split(/\s+/)[0]
+ return first.replace(/[:,]$/, '')
+}
+
+function hashString(s: string): number {
+ let h = 0
+ for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) | 0
+ return Math.abs(h)
+}
+
+export function Monogram({ name, size = 34 }: { name: string; size?: number }) {
+ const fam = familyOf(name)
+ const grad = MONOGRAM_GRADIENTS[hashString(fam.toLowerCase()) % MONOGRAM_GRADIENTS.length]
+ return (
+ <div
+ className={`shrink-0 rounded-[10px] bg-gradient-to-br ${grad} flex items-center justify-center border border-white/20 shadow-sm`}
+ style={{ width: size, height: size }}
+ aria-hidden
+ >
+ <span className="text-white font-bold select-none" style={{ fontSize: size * 0.42 }}>
+ {fam.slice(0, 1).toUpperCase()}
+ </span>
+ </div>
+ )
+}
+
+// ─── Hardware fit ───────────────────────────────────────────────────
+
+export type Fit = 'fits' | 'tight' | 'big' | 'unknown'
+
+// GGUF weights ≈ VRAM need; leave headroom for KV-cache/context. Never used
+// to BLOCK a download — purely an honest hint.
+export function computeFit(sizeGB: number | undefined, vramGb: number | null): Fit {
+ if (!sizeGB || !vramGb) return 'unknown'
+ if (sizeGB <= vramGb * 0.85) return 'fits'
+ if (sizeGB <= vramGb * 1.15) return 'tight'
+ return 'big'
+}
+
+const FIT_META: Record<Fit, { dot: string; label: string; title: string }> = {
+ fits: { dot: 'bg-emerald-500', label: 'Runs on your PC', title: 'Fits fully in your GPU memory — fast.' },
+ tight: { dot: 'bg-amber-500', label: 'Tight fit', title: 'Barely fits — parts may spill to RAM and slow it down.' },
+ big: { dot: 'bg-red-500', label: 'Too big for your GPU', title: 'Bigger than your GPU memory — runs mostly on CPU/RAM, slow. You can still try it.' },
+ unknown: { dot: 'bg-gray-400 dark:bg-gray-600', label: '', title: 'Hardware not detected yet.' },
+}
+
+export function FitHint({ fit, compact = false }: { fit: Fit; compact?: boolean }) {
+ if (fit === 'unknown') return null
+ const meta = FIT_META[fit]
+ return (
+ <span className="inline-flex items-center gap-1" title={meta.title}>
+ <span className={`w-1.5 h-1.5 rounded-full ${meta.dot}`} />
+ {!compact && (
+ <span className={`text-[0.58rem] ${fit === 'fits' ? 'text-emerald-600 dark:text-emerald-400' : fit === 'tight' ? 'text-amber-600 dark:text-amber-400' : 'text-red-500 dark:text-red-400'}`}>
+ {meta.label}
+ </span>
+ )}
+ </span>
+ )
+}
+
+// ─── Small chips ────────────────────────────────────────────────────
+
+export function SizePill({ sizeGB }: { sizeGB?: number }) {
+ if (!sizeGB) return null
+ return (
+ <span className="text-[0.58rem] px-1.5 py-0.5 rounded-md bg-gray-100 dark:bg-white/[0.06] text-gray-600 dark:text-gray-300 font-medium tabular-nums">
+ {sizeGB} GB
+ </span>
+ )
+}
+
+// Capability icons with tooltips replace the old text badges (AGENT /
+// CPU-FRIENDLY / Vision tag soup) — same information, far less noise.
+export function CapIcons({ model }: { model: DiscoverModel }) {
+ const vision = model.tags.some(t => /vision/i.test(t))
+ return (
+ <span className="inline-flex items-center gap-1">
+ {model.hot && (
+ <span title="Hot right now" className="p-0.5 rounded text-orange-500"><Flame size={11} /></span>
+ )}
+ {model.agent && (
+ <span title="Tool calling — works in Agent Mode" className="p-0.5 rounded text-emerald-600 dark:text-emerald-400"><Wrench size={11} /></span>
+ )}
+ {vision && (
+ <span title="Understands images (vision)" className="p-0.5 rounded text-sky-600 dark:text-sky-400"><Eye size={11} /></span>
+ )}
+ {model.lightweight && (
+ <span title="Runs on 8 GB RAM, CPU-only — no GPU needed" className="p-0.5 rounded text-teal-600 dark:text-teal-400"><Feather size={11} /></span>
+ )}
+ </span>
+ )
+}
+
+// ─── Blurb derivation ───────────────────────────────────────────────
+
+// One calm line per card instead of the full catalog description. The full
+// text stays reachable via the ⓘ details modal — nothing is lost.
+export function shortBlurb(m: DiscoverModel): string {
+ if (m.blurb) return m.blurb
+ const d = m.description || ''
+ const afterDash = d.includes('—') ? d.slice(d.indexOf('—') + 1) : d
+ const dot = afterDash.indexOf('. ')
+ const first = dot > 0 ? afterDash.slice(0, dot) : afterDash
+ const t = first.trim().replace(/\.\s*$/, '')
+ return t.length > 92 ? `${t.slice(0, 89)}…` : t
+}
+
+// Human variant label: prefer the quant tag ("Q4_K_M"), else the size.
+export function variantLabel(m: DiscoverModel): string {
+ const quant = m.tags.find(t => /^(UD-)?(I?Q\d|BF16|FP\d|NVFP\d|MXFP\d|MLX)/i.test(t))
+ return quant || (m.sizeGB ? `${m.sizeGB} GB` : m.name)
+}
+
+// ─── Grouping ───────────────────────────────────────────────────────
+
+/** Group catalog entries that only differ by quant (same `group` key),
+ * preserving catalog order. Ungrouped entries become 1-element groups. */
+export function groupModels(models: DiscoverModel[]): DiscoverModel[][] {
+ const order: string[] = []
+ const byKey = new Map<string, DiscoverModel[]>()
+ for (const m of models) {
+ const key = m.group ?? m.name
+ if (!byKey.has(key)) { byKey.set(key, []); order.push(key) }
+ byKey.get(key)!.push(m)
+ }
+ return order.map(k => byKey.get(k)!)
+}
+
+/** Default variant: installed > downloading > best fit under VRAM > smallest. */
+export function pickDefaultVariant(
+ variants: DiscoverModel[],
+ vramGb: number | null,
+ isInstalled: (m: DiscoverModel) => boolean,
+ dlState: (m: DiscoverModel) => DownloadProgress | null,
+): DiscoverModel {
+ const installed = variants.find(isInstalled)
+ if (installed) return installed
+ const active = variants.find(v => {
+ const s = dlState(v)?.status
+ return s === 'downloading' || s === 'connecting'
+ })
+ if (active) return active
+ if (vramGb) {
+ const fitting = variants.filter(v => v.sizeGB && v.sizeGB <= vramGb * 0.85)
+ if (fitting.length) return fitting.reduce((a, b) => ((a.sizeGB ?? 0) >= (b.sizeGB ?? 0) ? a : b))
+ }
+ return variants.reduce((a, b) => ((a.sizeGB ?? Infinity) <= (b.sizeGB ?? Infinity) ? a : b))
+}
+
+// ─── Model tile ─────────────────────────────────────────────────────
+
+export interface ModelTileProps {
+ variants: DiscoverModel[]
+ vramGb: number | null
+ isInstalled: (m: DiscoverModel) => boolean
+ dlState: (m: DiscoverModel) => DownloadProgress | null
+ onDownload: (m: DiscoverModel) => void
+ onInfo: (m: DiscoverModel) => void
+ onOpenUrl: (url: string) => void
+ highlight?: boolean
+}
+
+export function ModelTile({ variants, vramGb, isInstalled, dlState, onDownload, onInfo, onOpenUrl, highlight }: ModelTileProps) {
+ const [pickerOpen, setPickerOpen] = useState(false)
+ const [chosen, setChosen] = useState<string | null>(null)
+ const pickerRef = useRef<HTMLDivElement>(null)
+
+ const def = pickDefaultVariant(variants, vramGb, isInstalled, dlState)
+ const sel = variants.find(v => v.name === chosen) ?? def
+ const groupTitle = sel.group ?? sel.name
+ const dl = dlState(sel)
+ const downloading = dl?.status === 'downloading' || dl?.status === 'connecting'
+ const installed = isInstalled(sel) || dl?.status === 'complete'
+ const externalOnly = sel.canPull === false
+ const fit = computeFit(sel.sizeGB, vramGb)
+
+ useEffect(() => {
+ if (!pickerOpen) return
+ const close = (e: MouseEvent) => {
+ if (pickerRef.current && !pickerRef.current.contains(e.target as Node)) setPickerOpen(false)
+ }
+ window.addEventListener('mousedown', close)
+ return () => window.removeEventListener('mousedown', close)
+ }, [pickerOpen])
+
+ return (
+ <div
+ className={`relative rounded-xl border p-3 transition-colors bg-gray-50 dark:bg-white/[0.03] hover:bg-gray-100 dark:hover:bg-white/[0.05] ${
+ installed
+ ? 'border-emerald-400/40 dark:border-emerald-500/30'
+ : highlight
+ ? 'border-violet-400/50 dark:border-violet-400/30 ring-1 ring-violet-400/20'
+ : 'border-gray-200 dark:border-white/[0.06]'
+ }`}
+ data-model-tile={groupTitle}
+ >
+ <div className="flex items-start gap-2.5">
+ <Monogram name={groupTitle} />
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-1.5 min-w-0">
+ <h3 className="text-[0.78rem] font-semibold text-gray-900 dark:text-white truncate">{groupTitle}</h3>
+ <CapIcons model={sel} />
+ </div>
+ <p className="text-[0.62rem] text-gray-500 dark:text-gray-400 leading-snug mt-0.5 line-clamp-2">{shortBlurb(sel)}</p>
+ </div>
+ <button
+ onClick={() => onInfo(sel)}
+ className="shrink-0 p-1 rounded-md hover:bg-gray-200 dark:hover:bg-white/10 text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 transition-colors"
+ title="Details"
+ aria-label={`Details for ${groupTitle}`}
+ >
+ <Info size={12} />
+ </button>
+ </div>
+
+ <div className="flex items-center gap-2 mt-2.5">
+ {/* Variant / size selector — only when the family ships several quants */}
+ {variants.length > 1 ? (
+ <div className="relative" ref={pickerRef}>
+ <button
+ onClick={() => setPickerOpen(o => !o)}
+ className="flex items-center gap-1 px-1.5 py-0.5 rounded-md bg-gray-100 dark:bg-white/[0.06] hover:bg-gray-200 dark:hover:bg-white/10 text-[0.58rem] font-medium text-gray-700 dark:text-gray-200 transition-colors"
+ title="Choose a size / quality"
+ >
+ <span className="tabular-nums">{variantLabel(sel)} · {sel.sizeGB} GB</span>
+ <ChevronDown size={10} className={`transition-transform ${pickerOpen ? 'rotate-180' : ''}`} />
+ </button>
+ {pickerOpen && (
+ <div className="absolute z-30 left-0 top-full mt-1 w-56 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-[#17171c] shadow-xl p-1">
+ {variants.map(v => {
+ const vFit = computeFit(v.sizeGB, vramGb)
+ const vInst = isInstalled(v) || dlState(v)?.status === 'complete'
+ return (
+ <button
+ key={v.name}
+ onClick={() => { setChosen(v.name); setPickerOpen(false) }}
+ className={`w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left transition-colors hover:bg-gray-100 dark:hover:bg-white/[0.06] ${v.name === sel.name ? 'bg-gray-100 dark:bg-white/[0.06]' : ''}`}
+ >
+ <FitHint fit={vFit} compact />
+ <span className="flex-1 text-[0.62rem] text-gray-800 dark:text-gray-200">{variantLabel(v)}</span>
+ <span className="text-[0.58rem] text-gray-400 tabular-nums">{v.sizeGB} GB</span>
+ {vInst && <Check size={11} className="text-emerald-500" />}
+ </button>
+ )
+ })}
+ </div>
+ )}
+ </div>
+ ) : (
+ <SizePill sizeGB={sel.sizeGB} />
+ )}
+
+ <FitHint fit={fit} />
+ {sel.pulls && <span className="text-[0.55rem] text-gray-400 dark:text-gray-500 ml-auto mr-1">{sel.pulls}</span>}
+
+ <div className={`flex items-center gap-1 shrink-0 ${sel.pulls ? '' : 'ml-auto'}`}>
+ {externalOnly ? (
+ sel.url ? (
+ <button
+ onClick={() => onOpenUrl(sel.url!)}
+ className="flex items-center gap-1 px-2 py-1 rounded-md bg-gray-100 dark:bg-white/[0.06] hover:bg-gray-200 dark:hover:bg-white/10 text-[0.62rem] font-medium text-gray-700 dark:text-gray-200 transition-colors"
+ title="View on HuggingFace"
+ >
+ <ExternalLink size={11} /> View
+ </button>
+ ) : null
+ ) : installed ? (
+ <span className="flex items-center gap-1 px-2 py-1 rounded-md bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 text-[0.62rem] font-semibold">
+ <Check size={11} /> Installed
+ </span>
+ ) : downloading ? (
+ <span className="flex items-center gap-1.5 px-2 py-1 text-[0.62rem] text-gray-500 dark:text-gray-400">
+ <Loader2 size={11} className="animate-spin" /> Downloading…
+ </span>
+ ) : (
+ <button
+ onClick={() => onDownload(sel)}
+ className="flex items-center gap-1 px-2.5 py-1 rounded-md bg-emerald-500/15 hover:bg-emerald-500/25 text-emerald-700 dark:text-emerald-400 text-[0.62rem] font-semibold transition-colors"
+ title={sel.sizeGB ? `Download ${sel.sizeGB} GB` : 'Download'}
+ >
+ <Download size={11} /> Get
+ </button>
+ )}
+ </div>
+ </div>
+
+ {/* Slim inline progress — the header badge stays the full control center */}
+ {downloading && dl && dl.total > 0 && (
+ <div className="mt-2">
+ <div className="h-1 rounded-full bg-gray-200 dark:bg-white/[0.06] overflow-hidden">
+ <div className="h-full rounded-full bg-emerald-500 transition-[width]" style={{ width: `${Math.min(100, (dl.progress / dl.total) * 100)}%` }} />
+ </div>
+ <div className="flex justify-between mt-0.5 text-[0.55rem] text-gray-400 tabular-nums">
+ <span>{formatBytes(dl.progress)} / {formatBytes(dl.total)}</span>
+ <span>{Math.round((dl.progress / dl.total) * 100)}%</span>
+ </div>
+ </div>
+ )}
+ </div>
+ )
+}
+
+// ─── Bundle tile (image / video) ────────────────────────────────────
+
+export interface BundleTileProps {
+ bundle: ModelBundle
+ vramGb: number | null
+ complete: boolean
+ downloading: boolean
+ hasErrors: boolean
+ onInstall: () => void
+ onRetry: () => void
+ onClear: () => void
+ onOpenUrl: (url: string) => void
+ parseVRAM: (s: string) => number
+}
+
+export function BundleTile({ bundle, vramGb, complete, downloading, hasErrors, onInstall, onRetry, onClear, onOpenUrl, parseVRAM }: BundleTileProps) {
+ const comingSoon = !bundle.verified && !complete
+ const need = parseVRAM(bundle.vramRequired)
+ const fit: Fit = !vramGb ? 'unknown' : need <= vramGb ? 'fits' : need <= vramGb + 2 ? 'tight' : 'big'
+
+ return (
+ <div
+ className={`relative rounded-xl border border-gray-200 dark:border-white/[0.06] bg-gray-50 dark:bg-white/[0.03] p-3 overflow-hidden transition-colors hover:bg-gray-100 dark:hover:bg-white/[0.05] ${comingSoon ? 'opacity-60' : ''} ${complete ? 'border-emerald-400/40 dark:border-emerald-500/30' : ''}`}
+ data-bundle-tile={bundle.name}
+ >
+ {comingSoon && (
+ <div className="absolute inset-0 z-10 flex items-center justify-center bg-black/40 backdrop-blur-[1px] rounded-xl">
+ <span className="px-3 py-1.5 rounded-full bg-white/10 border border-white/20 text-white text-xs font-semibold tracking-wider">
+ COMING SOON
+ </span>
+ </div>
+ )}
+ <div className="flex items-start gap-2.5">
+ <Monogram name={bundle.name} />
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-1.5 min-w-0">
+ <h3 className="text-[0.78rem] font-semibold text-gray-900 dark:text-white truncate">{bundle.name}</h3>
+ {bundle.hot && !complete && <span title="Hot right now" className="text-orange-500 shrink-0"><Flame size={11} /></span>}
+ </div>
+ {bundle.description && (
+ <p className="text-[0.62rem] text-gray-500 dark:text-gray-400 leading-snug mt-0.5 line-clamp-2">{bundle.description}</p>
+ )}
+ </div>
+ {bundle.url && (
+ <button
+ onClick={() => onOpenUrl(bundle.url!)}
+ className="shrink-0 p-1 rounded-md hover:bg-gray-200 dark:hover:bg-white/10 text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 transition-colors"
+ title="View on HuggingFace"
+ aria-label={`View ${bundle.name} on HuggingFace`}
+ >
+ <ExternalLink size={12} />
+ </button>
+ )}
+ </div>
+
+ <div className="flex items-center gap-2 mt-2.5">
+ <SizePill sizeGB={bundle.totalSizeGB} />
+ <span className="text-[0.55rem] text-gray-400 dark:text-gray-500">{bundle.files.length} files</span>
+ <FitHint fit={fit} />
+
+ <div className="flex items-center gap-1 shrink-0 ml-auto">
+ {complete ? (
+ <span className="flex items-center gap-1 px-2 py-1 rounded-md bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 text-[0.62rem] font-semibold">
+ <Check size={11} /> Installed
+ </span>
+ ) : downloading ? (
+ <span className="flex items-center gap-1.5 px-2 py-1 text-[0.62rem] text-gray-500 dark:text-gray-400">
+ <Loader2 size={11} className="animate-spin" /> Installing…
+ </span>
+ ) : hasErrors ? (
+ <>
+ <button
+ onClick={onRetry}
+ className="flex items-center gap-1 px-2 py-1 rounded-md bg-red-100 dark:bg-red-500/15 hover:bg-red-200 dark:hover:bg-red-500/25 text-red-700 dark:text-red-400 text-[0.62rem] font-medium transition-colors"
+ title="Retry failed downloads"
+ >
+ <RefreshCw size={11} /> Retry
+ </button>
+ <button
+ onClick={onClear}
+ className="flex items-center gap-1 px-2 py-1 rounded-md hover:bg-gray-200 dark:hover:bg-white/10 text-gray-500 dark:text-gray-400 text-[0.62rem] transition-colors"
+ title="Clear this failed download so you can start over or pick another model"
+ >
+ <X size={11} /> Clear
+ </button>
+ </>
+ ) : (
+ <button
+ onClick={onInstall}
+ className="flex items-center gap-1 px-2.5 py-1 rounded-md bg-emerald-500/15 hover:bg-emerald-500/25 text-emerald-700 dark:text-emerald-400 text-[0.62rem] font-semibold transition-colors"
+ title={`Install all ${bundle.files.length} files (${bundle.totalSizeGB} GB)`}
+ >
+ <Download size={11} /> Get · {bundle.totalSizeGB} GB
+ </button>
+ )}
+ </div>
+ </div>
+ </div>
+ )
+}
+
+// ─── Hardware chip ──────────────────────────────────────────────────
+
+export function HardwareChip({ vramGb, ramGb }: { vramGb: number | null; ramGb: number | null }) {
+ if (!vramGb && !ramGb) return null
+ return (
+ <span
+ className="inline-flex items-center gap-1.5 px-2 py-1 rounded-lg bg-gray-100 dark:bg-white/[0.04] border border-gray-200 dark:border-white/[0.06] text-[0.6rem] text-gray-600 dark:text-gray-300"
+ title="Detected hardware — used for the 'runs on your PC' hints. Models are never hidden because of it."
+ >
+ <HardDrive size={11} className="text-gray-400" />
+ {vramGb ? <span className="tabular-nums">{Math.round(vramGb)} GB GPU</span> : null}
+ {vramGb && ramGb ? <span className="opacity-40">·</span> : null}
+ {ramGb ? <span className="tabular-nums">{Math.round(ramGb)} GB RAM</span> : null}
+ </span>
+ )
+}
diff --git a/src/components/onboarding/Onboarding.tsx b/src/components/onboarding/Onboarding.tsx
index 614e3e92..a42412f6 100644
--- a/src/components/onboarding/Onboarding.tsx
+++ b/src/components/onboarding/Onboarding.tsx
@@ -1556,7 +1556,7 @@ export function Onboarding() {
<div className="text-center mb-3">
<h2 className="text-base font-semibold mb-1">Pick a starter model</h2>
<p className={`text-[0.7rem] ${isDark ? 'text-gray-400' : 'text-gray-500'}`}>
- One small model to get you running. You can browse and install more from the Discover tab in Model Manager once you're in.
+ One small model to get you running. You can browse and install more from the Models tab once you're in.
</p>
</div>
@@ -1774,10 +1774,10 @@ export function Onboarding() {
{pulledModels.length > 0
? `${pulledModels.length} model${pulledModels.length > 1 ? 's' : ''} installed. You're ready to go.`
: selectedBackend === BUILTIN_BACKEND_ID
- ? 'The built-in engine is ready. Install a model anytime from Model Manager.'
+ ? 'The built-in engine is ready. Install a model anytime from the Models tab.'
: detectedBackends.length > 0
? `Connected to ${detectedBackends.find(b => b.id === selectedBackend)?.name || detectedBackends[0].name}. You're ready to go.`
- : 'You can configure backends and install models anytime from Settings and Model Manager.'}
+ : 'You can configure backends and install models anytime from Settings and the Models tab.'}
</p>
<button onClick={finish} className={primaryBtn}>
Get Started <ArrowRight size={14} />