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.

fix: VRAM detection, download button, and model search

PurpleDoubleDa2cb96b8d50b
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 0cde5386..2a05bb80 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -1860,7 +1860,7 @@ checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
[[package]]
name = "locally-uncensored"
-version = "1.5.3"
+version = "1.5.5"
dependencies = [
"base64 0.22.1",
"dirs",
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index 3319ffe0..00478d57 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -115,8 +115,8 @@ export async function getSystemVRAM(): Promise<number | null> {
const res = await localFetch(comfyuiUrl('/system_stats'))
if (!res.ok) return null
const data = await res.json()
- // ComfyUI returns devices[].vram_total in bytes
- const devices = data?.system?.devices ?? data?.devices ?? []
+ // ComfyUI returns top-level devices[].vram_total in bytes
+ const devices = data?.devices ?? []
if (devices.length > 0) {
const vramBytes = devices[0]?.vram_total ?? 0
cachedVRAM = Math.round(vramBytes / (1024 * 1024 * 1024)) // bytes → GB
diff --git a/src/api/discover.ts b/src/api/discover.ts
index 00eaaac2..2cea786a 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -120,52 +120,25 @@ export const COMPONENT_REGISTRY: Record<ModelType, ComponentRequirements> = {
// ─── Ollama Text Models ───
export async function fetchAbliteratedModels(): Promise<DiscoverModel[]> {
+ return searchOllamaModels('abliterated')
+}
+
+/** Search Ollama registry — works in both Tauri and dev mode */
+export async function searchOllamaModels(query: string): Promise<DiscoverModel[]> {
try {
- // In Tauri production mode, we can't proxy to ollama.com — fall back to curated list
- const { isTauri } = await import("./backend")
+ let html: string
+
+ const { isTauri, fetchExternal } = await import("./backend")
if (isTauri()) {
- return getCuratedTextModels()
+ // In Tauri: use fetchExternal to bypass CORS
+ html = await fetchExternal(`https://ollama.com/search?q=${encodeURIComponent(query)}&p=1`)
+ } else {
+ // In dev: use proxy
+ const res = await fetch(`/ollama-search?q=${encodeURIComponent(query)}&p=1`)
+ html = await res.text()
}
- const res = await fetch('/ollama-search?q=abliterated&p=1')
- const html = await res.text()
-
- const models: DiscoverModel[] = []
- const parser = new DOMParser()
- const doc = parser.parseFromString(html, 'text/html')
-
- const items = doc.querySelectorAll('[x-test-search-response-title]')
- items.forEach((item) => {
- const container = item.closest('a') || item.parentElement?.closest('a')
- const name = item.textContent?.trim() || ''
- const href = container?.getAttribute('href') || ''
-
- const parent = item.closest('div')?.parentElement
- const spans = parent?.querySelectorAll('span') || []
- let pulls = ''
- let updated = ''
-
- spans.forEach((span) => {
- const text = span.textContent?.trim() || ''
- if (text.includes('Pull') || text.includes('K') || text.includes('M')) {
- if (!pulls) pulls = text
- }
- if (text.includes('ago') || text.includes('month') || text.includes('week') || text.includes('day')) {
- updated = text
- }
- })
-
- if (name && href) {
- models.push({
- name: href.startsWith('/') ? href.slice(1) : name,
- description: '',
- pulls,
- tags: [],
- updated,
- })
- }
- })
-
+ const models = parseOllamaSearchHTML(html)
if (models.length === 0) return getCuratedTextModels()
return models
} catch {
@@ -173,6 +146,46 @@ export async function fetchAbliteratedModels(): Promise<DiscoverModel[]> {
}
}
+function parseOllamaSearchHTML(html: string): DiscoverModel[] {
+ const models: DiscoverModel[] = []
+ const parser = new DOMParser()
+ const doc = parser.parseFromString(html, 'text/html')
+
+ const items = doc.querySelectorAll('[x-test-search-response-title]')
+ items.forEach((item) => {
+ const container = item.closest('a') || item.parentElement?.closest('a')
+ const name = item.textContent?.trim() || ''
+ const href = container?.getAttribute('href') || ''
+
+ const parent = item.closest('div')?.parentElement
+ const spans = parent?.querySelectorAll('span') || []
+ let pulls = ''
+ let updated = ''
+
+ spans.forEach((span) => {
+ const text = span.textContent?.trim() || ''
+ if (text.includes('Pull') || text.includes('K') || text.includes('M')) {
+ if (!pulls) pulls = text
+ }
+ if (text.includes('ago') || text.includes('month') || text.includes('week') || text.includes('day')) {
+ updated = text
+ }
+ })
+
+ if (name && href) {
+ models.push({
+ name: href.startsWith('/') ? href.slice(1) : name,
+ description: '',
+ pulls,
+ tags: [],
+ updated,
+ })
+ }
+ })
+
+ return models
+}
+
function getCuratedTextModels(): DiscoverModel[] {
return [
{ name: 'huihui_ai/qwen3-abliterated', description: 'Qwen3 abliterated — best overall. Exceptional reasoning, coding, multilingual.', pulls: '30K+', tags: ['8B', '30B'], updated: 'Popular' },
diff --git a/src/components/create/CreateView.tsx b/src/components/create/CreateView.tsx
index 038afea1..c0686ee7 100644
--- a/src/components/create/CreateView.tsx
+++ b/src/components/create/CreateView.tsx
@@ -321,8 +321,15 @@ export function CreateView() {
{e.downloadUrl && e.downloadFilename && e.downloadSubfolder && (
<button
onClick={async () => {
- await startModelDownload(e.downloadUrl!, e.downloadSubfolder!, e.downloadFilename!)
- useUIStore.getState().setView('models')
+ try {
+ const result = await startModelDownload(e.downloadUrl!, e.downloadSubfolder!, e.downloadFilename!)
+ console.log('[CreateView] Download started:', result)
+ // Small delay to let backend register the download before switching views
+ await new Promise(r => setTimeout(r, 500))
+ useUIStore.getState().setView('models')
+ } catch (err) {
+ console.error('[CreateView] Download failed:', err)
+ }
}}
className="shrink-0 flex items-center gap-1 px-2 py-0.5 rounded bg-red-500/20 hover:bg-red-500/30 text-red-300 text-[9px] font-medium transition-colors"
>
diff --git a/src/components/models/DiscoverModels.tsx b/src/components/models/DiscoverModels.tsx
index c2d700f0..28ba03bf 100644
--- a/src/components/models/DiscoverModels.tsx
+++ b/src/components/models/DiscoverModels.tsx
@@ -3,7 +3,7 @@ import { motion } from 'framer-motion'
import { Download, RefreshCw, ExternalLink, Search, Info, CheckCircle, XCircle, Loader2 } from 'lucide-react'
import { Pause, Play, X } from 'lucide-react'
import {
- fetchAbliteratedModels, getImageBundles, getVideoBundles,
+ fetchAbliteratedModels, searchOllamaModels, getImageBundles, getVideoBundles,
startModelDownload, getDownloadProgress, searchCivitaiModels,
pauseDownload, cancelDownload, resumeDownload,
type DiscoverModel, type DownloadProgress, type ModelBundle, type CivitAIModelResult,
@@ -81,8 +81,18 @@ export function DiscoverModels({ category }: Props) {
? allModels.filter((m) => m.name.toLowerCase().includes(search.toLowerCase()) || m.description.toLowerCase().includes(search.toLowerCase()))
: allModels
- // Parse VRAM requirement string to min GB number for sorting
+ // Parse VRAM requirement string to minimum GB needed
+ // "6-8 GB" → 8 (need at least the upper bound)
+ // "12+ GB" → 13 (+ means MORE than that number)
+ // "8 GB" → 8
const parseVRAM = (s: string): number => {
+ if (s.includes('+')) {
+ const match = s.match(/(\d+)\+/)
+ return match ? parseInt(match[1]) + 2 : 99 // "12+" means realistically 14+ GB needed
+ }
+ // Range like "6-8 GB" → take the upper number
+ const range = s.match(/(\d+)\s*-\s*(\d+)/)
+ if (range) return parseInt(range[2])
const match = s.match(/(\d+)/)
return match ? parseInt(match[1]) : 99
}
@@ -198,9 +208,19 @@ export function DiscoverModels({ category }: Props) {
? (pullProgress.completed / pullProgress.total) * 100
: 0
+ const handleOllamaSearch = async () => {
+ if (!search.trim() || !isText) return
+ setLoading(true)
+ try {
+ const results = await searchOllamaModels(search.trim())
+ setTextModels(results)
+ } catch { /* keep existing */ }
+ setLoading(false)
+ }
+
const title = isText ? 'Uncensored Text Models' : isImage ? 'Image Models (ComfyUI)' : 'Video Models (ComfyUI)'
const subtitle = isText
- ? 'Abliterated models from the Ollama registry. Click to install.'
+ ? 'Search the Ollama registry or browse curated abliterated models.'
: isImage
? 'Complete packages — each bundle includes everything you need to generate images.'
: 'Complete packages — each bundle includes Model + VAE + CLIP for video generation.'
@@ -223,7 +243,8 @@ export function DiscoverModels({ category }: Props) {
<input
value={search}
onChange={(e) => setSearch(e.target.value)}
- placeholder="Filter models..."
+ onKeyDown={(e) => { if (e.key === 'Enter' && isText) handleOllamaSearch() }}
+ placeholder={isText ? 'Search Ollama registry... (Enter to search)' : 'Filter models...'}
className="w-full pl-9 pr-3 py-2 rounded-lg bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/10 text-sm text-gray-900 dark:text-white placeholder-gray-500 focus:outline-none focus:border-gray-400 dark:focus:border-white/30"
/>
</div>