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: add Qwen3-Coder integration + Download Manager overhaul
PurpleDoubleDd65909c6d123
diff --git a/src-tauri/src/commands/proxy.rs b/src-tauri/src/commands/proxy.rsindex 57d88c10..3c3bd079 100644--- a/src-tauri/src/commands/proxy.rs+++ b/src-tauri/src/commands/proxy.rs@@ -1,3 +1,5 @@+use tauri::Emitter;+/// Validate that an external URL is safe to fetch (no SSRF)./// Blocks private IP ranges, non-HTTP schemes, and localhost.fn validate_external_url(raw: &str) -> Result<(), String> {@@ -170,6 +172,112 @@ pub async fn proxy_localhost_stream(url: String, method: Option<String>, body: Oresp.bytes().await.map(|b| b.to_vec()).map_err(|e| e.to_string())}+/// Streaming Ollama model pull — emits per-model progress events.+/// Each event is a JSON object: { "model": "name", "data": { ...ollama progress... } }+#[tauri::command]+pub async fn pull_model_stream(app: tauri::AppHandle, state: tauri::State<'_, crate::state::AppState>, name: String) -> Result<(), String> {+ use futures_util::StreamExt;++ // Create cancellation token for this pull+ let token = tokio_util::sync::CancellationToken::new();+ {+ let mut tokens = state.pull_tokens.lock().unwrap();+ // Cancel any existing pull for same model+ if let Some(old) = tokens.remove(&name) {+ old.cancel();+ }+ tokens.insert(name.clone(), token.clone());+ }++ let client = reqwest::Client::builder()+ .user_agent("LocallyUncensored/2.0")+ .timeout(std::time::Duration::from_secs(7200))+ .build()+ .map_err(|e| e.to_string())?;++ let resp = client+ .post("http://localhost:11434/api/pull")+ .header("Content-Type", "application/json")+ .body(format!(r#"{{"name":"{}","stream":true}}"#, name))+ .send()+ .await+ .map_err(|e| format!("pull_model_stream: {}", e))?;++ if !resp.status().is_success() {+ let status = resp.status().as_u16();+ let text = resp.text().await.unwrap_or_default();+ state.pull_tokens.lock().unwrap().remove(&name);+ return Err(format!("HTTP {}: {}", status, text));+ }++ let mut stream = resp.bytes_stream();+ let mut buffer = String::new();++ let mut was_cancelled = false;++ loop {+ tokio::select! {+ _ = token.cancelled() => {+ was_cancelled = true;+ break;+ }+ chunk = stream.next() => {+ match chunk {+ Some(Ok(bytes)) => {+ buffer.push_str(&String::from_utf8_lossy(&bytes));+ while let Some(pos) = buffer.find('\n') {+ let line = buffer[..pos].trim().to_string();+ buffer = buffer[pos + 1..].to_string();+ if !line.is_empty() {+ // Emit with model name so frontend can route+ let payload = format!(r#"{{"model":"{}","data":{}}}"#, name, line);+ let _ = app.emit("pull-progress", &payload);+ }+ }+ }+ Some(Err(e)) => {+ let _ = app.emit("pull-progress", &format!(+ r#"{{"model":"{}","data":{{"status":"Error: {}"}}}}"#, name, e+ ));+ break;+ }+ None => break, // Stream finished+ }+ }+ }+ }++ // Flush remaining (only if not cancelled)+ if !was_cancelled {+ let remaining = buffer.trim().to_string();+ if !remaining.is_empty() {+ let payload = format!(r#"{{"model":"{}","data":{}}}"#, name, remaining);+ let _ = app.emit("pull-progress", &payload);+ }+ }++ // Cleanup token+ state.pull_tokens.lock().unwrap().remove(&name);++ if was_cancelled {+ Err("cancelled".to_string())+ } else {+ Ok(())+ }+}++/// Cancel an active Ollama model pull+#[tauri::command]+pub fn cancel_model_pull(state: tauri::State<'_, crate::state::AppState>, name: String) -> Result<(), String> {+ let mut tokens = state.pull_tokens.lock().unwrap();+ if let Some(token) = tokens.remove(&name) {+ token.cancel();+ Ok(())+ } else {+ Ok(()) // Already finished or never started+ }+}+/// Proxy search requests to ollama.com (needed because frontend can't CORS to ollama.com)#[tauri::command]pub async fn ollama_search(query: String) -> Result<serde_json::Value, String> {diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rsindex 8779331f..89c463ff 100644--- a/src-tauri/src/main.rs+++ b/src-tauri/src/main.rs@@ -54,6 +54,8 @@ fn main() {commands::proxy::fetch_external_bytes,commands::proxy::proxy_localhost,commands::proxy::proxy_localhost_stream,+ commands::proxy::pull_model_stream,+ commands::proxy::cancel_model_pull,// Window managementcommands::process::show_window,])diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rsindex a7f83c5d..ba67c9dd 100644--- a/src-tauri/src/state.rs+++ b/src-tauri/src/state.rs@@ -40,6 +40,7 @@ pub struct AppState {pub whisper: Arc<Mutex<WhisperServer>>,pub downloads: Arc<Mutex<HashMap<String, DownloadProgress>>>,pub download_tokens: Arc<Mutex<HashMap<String, CancellationToken>>>,+ pub pull_tokens: Arc<Mutex<HashMap<String, CancellationToken>>>,pub install_status: Mutex<InstallState>,pub searxng_install: Mutex<InstallState>,pub searxng_available: AtomicBool,@@ -57,6 +58,7 @@ impl AppState {whisper: Arc::new(Mutex::new(WhisperServer::new())),downloads: Arc::new(Mutex::new(HashMap::new())),download_tokens: Arc::new(Mutex::new(HashMap::new())),+ pull_tokens: Arc::new(Mutex::new(HashMap::new())),install_status: Mutex::new(InstallState::default()),searxng_install: Mutex::new(InstallState::default()),searxng_available: AtomicBool::new(false),diff --git a/src/api/__tests__/model-compatibility.test.ts b/src/api/__tests__/model-compatibility.test.tsindex 646541db..1a3d503f 100644--- a/src/api/__tests__/model-compatibility.test.ts+++ b/src/api/__tests__/model-compatibility.test.ts@@ -46,6 +46,15 @@ describe('isAgentCompatible', () => {expect(isAgentCompatible('gemma4:26b-a4b-it-q4_K_M')).toBe(true)})+ it('qwen3-coder models are compatible (native tool calling)', () => {+ expect(isAgentCompatible('qwen3-coder:30b')).toBe(true)+ expect(isAgentCompatible('qwen3-coder:latest')).toBe(true)+ })++ it('qwen3-coder abliterated retains native tool calling', () => {+ expect(isAgentCompatible('huihui_ai/qwen3-coder-abliterated:latest')).toBe(true)+ })+it('other compatible models', () => {expect(isAgentCompatible('command-r:35b')).toBe(true)expect(isAgentCompatible('phi-4:14b')).toBe(true)diff --git a/src/api/backend.ts b/src/api/backend.tsindex 6af3c533..621fce6b 100644--- a/src/api/backend.ts+++ b/src/api/backend.ts@@ -63,13 +63,14 @@ export async function localFetch(*/export async function localFetchStream(url: string,- options?: { method?: string; body?: string }+ options?: { method?: string; body?: string; signal?: AbortSignal }): Promise<Response> {if (!isTauri()) {return fetch(url, {method: options?.method || "GET",body: options?.body,headers: options?.body ? { "Content-Type": "application/json" } : undefined,+ signal: options?.signal,});}diff --git a/src/api/discover.ts b/src/api/discover.tsindex e5fea2a4..5a3d277e 100644--- a/src/api/discover.ts+++ b/src/api/discover.ts@@ -211,29 +211,32 @@ export function getUncensoredTextModels(): DiscoverModel[] {// ── HOT: Agent Mode + Uncensored ──{ name: 'hermes3', description: 'NousResearch Hermes 3 — uncensored + native tool calling. THE agent model.', pulls: '500K+', tags: ['3B', '8B', '70B', '405B'], updated: 'Hot', hot: true, agent: true },{ name: 'dolphin3', description: 'Dolphin 3 — uncensored from training. Coding, math, general purpose.', pulls: '3.7M', tags: ['8B'], updated: 'Hot', hot: true },- { name: 'huihui_ai/qwen3.5-abliterated', description: 'Qwen 3.5 abliterated — newest, strongest reasoning + coding.', pulls: '10K+', tags: ['8B', '14B', '32B'], updated: 'Hot', hot: true },- { name: 'huihui_ai/gpt-oss-abliterated', description: 'OpenAI GPT-OSS — abliterated open-source GPT model.', pulls: '15K+', tags: ['8B', '32B'], updated: 'Hot', hot: true },+ { name: 'huihui_ai/qwen3.5-abliterated', description: 'Qwen 3.5 abliterated — newest, strongest reasoning + coding.', pulls: '10K+', tags: ['9B', '27B', '35B'], updated: 'Hot', hot: true },+ { name: 'huihui_ai/gpt-oss-abliterated', description: 'OpenAI GPT-OSS — abliterated open-source GPT model.', pulls: '15K+', tags: ['20B', '120B'], updated: 'Hot', hot: true },+ { name: 'huihui_ai/qwen3-coder-abliterated', description: 'Qwen3-Coder abliterated — 30B MoE (3B active), built for code agents. 256K context.', pulls: '5K+', tags: ['30B', '480B'], updated: 'Hot', hot: true, agent: true },// ── Popular Uncensored ──{ name: 'huihui_ai/qwen3-abliterated', description: 'Qwen3 abliterated — best overall. Exceptional reasoning, coding, multilingual.', pulls: '30K+', tags: ['8B', '30B'], updated: 'Popular' },- { name: 'mannix/llama3.1-8b-abliterated', description: 'Llama 3.1 8B — fast, reliable, great entry point.', pulls: '200K+', tags: ['8B', 'Q5_K_M'], updated: 'Popular' },+ { name: 'mannix/llama3.1-8b-abliterated', description: 'Llama 3.1 8B — fast, reliable, great entry point.', pulls: '200K+', tags: ['Q5_K_M', 'Q4_K_M'], updated: 'Popular' },{ name: 'huihui_ai/deepseek-r1-abliterated', description: 'DeepSeek R1 — chain-of-thought reasoning. Scales to your hardware.', pulls: '40K+', tags: ['8B', '14B', '32B', '70B'], updated: 'Popular' },- { name: 'huihui_ai/glm4.6-abliterated', description: 'GLM 4.6 abliterated — newest model, strong coding and reasoning.', pulls: '5K+', tags: ['9B'], updated: 'New' },+ { name: 'huihui_ai/glm4.6-abliterated', description: 'GLM 4.6 abliterated — newest model, strong coding and reasoning.', pulls: '5K+', tags: ['357B'], updated: 'New' },{ name: 'huihui_ai/gemma3-abliterated', description: 'Google Gemma 3 — vision support, great quality.', pulls: '20K+', tags: ['4B', '12B', '27B'], updated: 'Popular' },- { name: 'richardyoung/qwen3-14b-abliterated', description: 'Qwen3 14B — sweet spot of speed and intelligence.', pulls: '4K+', tags: ['14B', 'Q4_K_M'], updated: 'Recent' },- { name: 'huihui_ai/qwen2.5-abliterated', description: 'Qwen 2.5 abliterated series — proven and reliable.', pulls: '50K+', tags: ['7B', '14B', '32B'], updated: 'Popular' },+ { name: 'richardyoung/qwen3-14b-abliterated', description: 'Qwen3 14B — sweet spot of speed and intelligence.', pulls: '4K+', tags: ['Q4_K_M', 'Q5_K_M'], updated: 'Recent' },+ { name: 'huihui_ai/qwen2.5-abliterate', description: 'Qwen 2.5 abliterated series — proven and reliable.', pulls: '50K+', tags: ['7B', '14B', '32B'], updated: 'Popular' },{ name: 'huihui_ai/llama3.3-abliterated', description: 'Llama 3.3 70B — maximum intelligence for high-VRAM setups.', pulls: '15K+', tags: ['70B'], updated: 'Popular' },{ name: 'huihui_ai/mistral-small-abliterated', description: 'Mistral Small 24B — powerful, strong multilingual.', pulls: '10K+', tags: ['24B'], updated: 'Recent' },{ name: 'huihui_ai/phi4-abliterated', description: 'Microsoft Phi-4 — excellent at math, logic, structured tasks.', pulls: '8K+', tags: ['14B'], updated: 'Recent' },- { name: 'krith/mistral-nemo-instruct-2407-abliterated', description: 'Mistral Nemo 12B — multilingual powerhouse.', pulls: '5K+', tags: ['12B'], updated: 'Popular' },+ { name: 'krith/mistral-nemo-instruct-2407-abliterated', description: 'Mistral Nemo 12B — multilingual powerhouse.', pulls: '5K+', tags: ['IQ4_XS', 'IQ3_M'], updated: 'Popular' },]}/** Mainstream models — not uncensored but excellent for specific tasks */export function getMainstreamTextModels(): DiscoverModel[] {return [- { name: 'gemma4', description: 'Google Gemma 4 — native tool calling + vision. 128-256K context. Apache 2.0.', pulls: '100K+', tags: ['2B', '4B', '26B MoE', '31B'], updated: 'New', hot: true, agent: true },+ { name: 'gemma4', description: 'Google Gemma 4 — native tool calling + vision. 128-256K context. Apache 2.0.', pulls: '100K+', tags: ['e2b', 'e4b', '26B', '31B'], updated: 'New', hot: true, agent: true },+ { name: 'qwen3-coder', description: 'Qwen3-Coder — 30B MoE coding agent (3B active). Native tool calling, 256K context.', pulls: '100K+', tags: ['30B', '480B'], updated: 'New', hot: true, agent: true },+ { name: 'qwen3-coder-next', description: 'Qwen3-Coder-Next — 80B MoE (3B active). Optimized for agentic coding workflows.', pulls: '10K+', tags: ['Q4_K_M', 'Q8_0'], updated: 'New', hot: true, agent: true },{ name: 'qwen3', description: 'Qwen 3 — top-tier reasoning and coding. Thinking mode support.', pulls: '5M+', tags: ['8B', '14B', '32B'], updated: 'Popular', agent: true },- { name: 'llama4', description: 'Meta Llama 4 — latest generation. Strong all-rounder with tool calling.', pulls: '1M+', tags: ['8B'], updated: 'New', agent: true },+ { name: 'llama4', description: 'Meta Llama 4 — latest generation MoE. Needs 64GB+ RAM.', pulls: '1M+', tags: ['scout', 'maverick'], updated: 'New', agent: true },{ name: 'deepseek-r1', description: 'DeepSeek R1 — chain-of-thought reasoning model. Shows its thinking.', pulls: '2M+', tags: ['8B', '14B', '32B', '70B'], updated: 'Popular' },{ name: 'phi4', description: 'Microsoft Phi 4 — excellent math, logic, structured tasks.', pulls: '500K+', tags: ['14B'], updated: 'Popular', agent: true },{ name: 'mistral-small', description: 'Mistral Small — fast, multilingual, native tool calling.', pulls: '300K+', tags: ['24B'], updated: 'Popular', agent: true },diff --git a/src/api/ollama.ts b/src/api/ollama.tsindex 69fdc0fa..d63a2199 100644--- a/src/api/ollama.ts+++ b/src/api/ollama.ts@@ -1,5 +1,5 @@-import type { OllamaModel } from "../types/models"-import { ollamaUrl, localFetch, localFetchStream } from "./backend"+import type { OllamaModel, PullProgress } from "../types/models"+import { ollamaUrl, localFetch, localFetchStream, isTauri } from "./backend"export async function listModels(): Promise<OllamaModel[]> {const res = await localFetch(ollamaUrl("/tags"))@@ -98,14 +98,58 @@ export async function chatWithTools(}export async function pullModel(name: string, signal?: AbortSignal): Promise<Response> {- const res = await localFetchStream(ollamaUrl("/pull"), {+ const res = await localFetchStream(isTauri() ? ollamaUrl("/pull") : "/api/pull", {method: "POST",body: JSON.stringify({ name, stream: true }),+ signal,})if (!res.ok) throw new Error("Failed to pull model")return res}+/**+ * Tauri-only: stream a model pull via Rust command + events.+ * Events are tagged with model name so multiple concurrent pulls work.+ * Returns { promise, cancel } — cancel() stops both frontend + Rust backend.+ */+export function pullModelTauri(+ name: string,+ onProgress: (progress: PullProgress) => void,+): { promise: Promise<void>; cancel: () => void } {+ let cancelFn = () => {}++ const promise = (async () => {+ const { invoke } = await import("@tauri-apps/api/core")+ const { listen } = await import("@tauri-apps/api/event")++ const unlisten = await listen<string>("pull-progress", (event) => {+ try {+ const envelope = JSON.parse(event.payload) as { model: string; data: PullProgress }+ // Only process events for THIS model+ if (envelope.model === name) {+ onProgress(envelope.data)+ }+ } catch { /* ignore parse errors */ }+ })++ cancelFn = () => {+ unlisten()+ // Also cancel the Rust-side download+ import("@tauri-apps/api/core").then(({ invoke: inv }) => {+ inv("cancel_model_pull", { name }).catch(() => {})+ })+ }++ try {+ await invoke("pull_model_stream", { name })+ } finally {+ unlisten()+ }+ })()++ return { promise, cancel: () => cancelFn() }+}+export async function deleteModel(name: string): Promise<void> {const res = await localFetch(ollamaUrl("/delete"), {method: "DELETE",diff --git a/src/components/layout/DownloadBadge.tsx b/src/components/layout/DownloadBadge.tsxnew file mode 100644index 00000000..5678e593--- /dev/null+++ b/src/components/layout/DownloadBadge.tsx@@ -0,0 +1,167 @@+import { useState, useRef, useEffect } from 'react'+import { motion, AnimatePresence } from 'framer-motion'+import { ArrowDownToLine, Pause, Play, X, CheckCircle } from 'lucide-react'+import { useModels } from '../../hooks/useModels'+import { formatBytes } from '../../lib/formatters'++function ProgressBar({ progress }: { progress: number }) {+ return (+ <div className="w-full h-1 rounded-full bg-white/[0.06] overflow-hidden">+ <div className="h-full rounded-full bg-blue-500 transition-all duration-300" style={{ width: `${Math.min(100, progress)}%` }} />+ </div>+ )+}++export function DownloadBadge() {+ const { activePulls, pullModel, pausePull, dismissPull } = useModels()+ const [open, setOpen] = useState(false)+ const ref = useRef<HTMLDivElement>(null)++ const entries = Object.entries(activePulls)+ const activeCount = entries.filter(([, s]) => !s.paused && !s.complete).length+ const hasAny = entries.length > 0++ // Click outside to close+ useEffect(() => {+ const handler = (e: MouseEvent) => {+ if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false)+ }+ document.addEventListener('mousedown', handler)+ return () => document.removeEventListener('mousedown', handler)+ }, [])++ // Auto-open when a new download starts+ useEffect(() => {+ if (activeCount > 0) setOpen(true)+ }, [activeCount])++ return (+ <div ref={ref} className="relative">+ {/* Icon button */}+ <button+ onClick={() => setOpen(!open)}+ className={`relative p-1.5 rounded-md transition-colors ${+ hasAny+ ? 'text-blue-400 hover:bg-blue-500/10'+ : 'text-gray-500 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-white/5'+ }`}+ title="Downloads"+ >+ <ArrowDownToLine size={14} />+ {/* Badge */}+ {activeCount > 0 && (+ <span className="absolute -top-0.5 -right-0.5 min-w-[14px] h-[14px] flex items-center justify-center rounded-full bg-blue-500 text-[0.5rem] font-bold text-white leading-none px-0.5">+ {activeCount}+ <span className="absolute inset-0 rounded-full bg-blue-500 animate-ping opacity-40" />+ </span>+ )}+ {/* Paused indicator (yellow dot, no ping) */}+ {activeCount === 0 && entries.some(([, s]) => s.paused) && (+ <span className="absolute -top-0.5 -right-0.5 w-2.5 h-2.5 rounded-full bg-yellow-500" />+ )}+ </button>++ {/* Dropdown */}+ <AnimatePresence>+ {open && (+ <motion.div+ className="absolute right-0 top-full mt-1.5 w-72 rounded-lg overflow-hidden z-50 bg-white dark:bg-[#0f0f0f] border border-gray-200 dark:border-white/[0.06] shadow-2xl shadow-black/50"+ initial={{ opacity: 0, y: -6, scale: 0.98 }}+ animate={{ opacity: 1, y: 0, scale: 1 }}+ exit={{ opacity: 0, y: -6, scale: 0.98 }}+ transition={{ duration: 0.12, ease: 'easeOut' }}+ >+ {/* Header */}+ <div className="flex items-center justify-between px-3 pt-2.5 pb-1">+ <span className="text-[0.65rem] font-semibold uppercase tracking-widest text-gray-500">+ Downloads {hasAny && `(${entries.length})`}+ </span>+ {entries.some(([, s]) => s.complete) && (+ <button+ onClick={() => entries.filter(([, s]) => s.complete).forEach(([n]) => dismissPull(n))}+ className="text-[0.6rem] text-gray-500 hover:text-gray-300 transition-colors"+ >+ Clear completed+ </button>+ )}+ </div>++ {/* Download list */}+ <div className="max-h-[300px] overflow-y-auto">+ {entries.length === 0 && (+ <p className="text-center text-[0.7rem] text-gray-500 py-6">No active downloads</p>+ )}++ {entries.map(([name, state]) => {+ const prog = state.progress.total && state.progress.completed+ ? (state.progress.completed / state.progress.total) * 100 : 0++ return (+ <div key={name} className="px-3 py-2 border-t border-gray-100 dark:border-white/[0.04] first:border-t-0">+ {/* Top row: name + controls */}+ <div className="flex items-center justify-between gap-2 mb-1">+ <p className="text-[0.7rem] font-mono text-gray-700 dark:text-gray-300 truncate">{name}</p>+ <div className="flex items-center gap-0.5 shrink-0">+ {/* Pause */}+ {!state.complete && !state.paused && (+ <button+ onClick={() => pausePull(name)}+ className="p-0.5 rounded hover:bg-yellow-500/20 text-gray-400 hover:text-yellow-400 transition-colors"+ title="Pause"+ >+ <Pause size={11} />+ </button>+ )}+ {/* Resume */}+ {state.paused && (+ <button+ onClick={() => pullModel(name)}+ className="p-0.5 rounded hover:bg-green-500/20 text-gray-400 hover:text-green-400 transition-colors"+ title="Resume"+ >+ <Play size={11} />+ </button>+ )}+ {/* Dismiss */}+ <button+ onClick={() => dismissPull(name)}+ className="p-0.5 rounded hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors"+ title="Dismiss"+ >+ <X size={11} />+ </button>+ </div>+ </div>++ {/* Status */}+ {state.complete ? (+ <div className="flex items-center gap-1.5 text-green-400">+ <CheckCircle size={11} />+ <span className="text-[0.65rem]">Complete</span>+ </div>+ ) : state.paused ? (+ <span className="text-[0.65rem] text-yellow-400">Paused — click ▶ to resume</span>+ ) : (+ <>+ <p className="text-[0.6rem] text-gray-500 mb-1 truncate">{state.progress.status}</p>+ {state.progress.total && state.progress.completed !== undefined && (+ <>+ <ProgressBar progress={prog} />+ <p className="text-[0.55rem] text-gray-500 mt-0.5">+ {formatBytes(state.progress.completed || 0)} / {formatBytes(state.progress.total)}+ {prog > 0 && <span className="ml-1.5 text-blue-400">{Math.round(prog)}%</span>}+ </p>+ </>+ )}+ </>+ )}+ </div>+ )+ })}+ </div>+ </motion.div>+ )}+ </AnimatePresence>+ </div>+ )+}diff --git a/src/components/layout/Header.tsx b/src/components/layout/Header.tsxindex ddb2ddc6..39b23c17 100644--- a/src/components/layout/Header.tsx+++ b/src/components/layout/Header.tsx@@ -5,6 +5,7 @@ import { useChatStore } from '../../stores/chatStore'import { useCompareStore } from '../../stores/compareStore'import { ModelSelector } from '../models/ModelSelector'import { UpdateBadge } from './UpdateBadge'+import { DownloadBadge } from './DownloadBadge'export function Header() {const { currentView, toggleSidebar, setView } = useUIStore()@@ -62,6 +63,7 @@ export function Header() {{/* Right: Nav icons — Order: Chat, Create, A/B Compare, Benchmark, Models, Settings */}<div className="flex items-center gap-0.5">+ <DownloadBadge /><buttononClick={toggleTheme}className="p-1.5 rounded-md text-gray-500 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-white/5 transition-colors"diff --git a/src/components/models/DiscoverModels.tsx b/src/components/models/DiscoverModels.tsxindex 7a67600f..60b9fa12 100644--- a/src/components/models/DiscoverModels.tsx+++ b/src/components/models/DiscoverModels.tsx@@ -23,14 +23,23 @@ interface Props {}// Variant selector for text models with multiple sizes-function VariantPullButton({ model, pullModel, isPulling, isInstalled }: {+function VariantPullButton({ model, pullModel, isPullingModel, isInstalled }: {model: DiscoverModelpullModel: (name: string) => void- isPulling: boolean+ isPullingModel: (name: string) => booleanisInstalled: (name: string) => boolean}) {const [open, setOpen] = useState(false)- const tags = model.tags.filter(t => /^\d+B/.test(t) || /^Q\d/.test(t))+ // Filter tags that are valid Ollama size/variant identifiers (e.g. 8B, Q4_K_M, e2b, scout, IQ4_XS)+ const tags = model.tags.filter(t => /^\d+B$/i.test(t) || /^[Qe]\d/i.test(t) || /^IQ\d/i.test(t) || /^[a-z]+$/i.test(t))++ // Human-readable descriptions for non-obvious tags+ const TAG_INFO: Record<string, string> = {+ scout: 'Llama 4 Scout — 16×17B MoE, ~109 GB, 10M context',+ maverick: 'Llama 4 Maverick — 128×17B MoE, ~280 GB, 1M context',+ e2b: 'Gemma 4 — 2B parameters, lightweight',+ e4b: 'Gemma 4 — 4B parameters, balanced',+ }// If no size tags or only one, show simple buttonif (tags.length <= 1) {@@ -41,7 +50,7 @@ function VariantPullButton({ model, pullModel, isPulling, isInstalled }: {return (<buttononClick={() => pullModel(fullName)}- disabled={isPulling}+ disabled={isPullingModel(fullName)}className="p-2 rounded-lg bg-gray-100 dark:bg-white/10 hover:bg-gray-200 dark:hover:bg-white/15 text-gray-700 dark:text-white disabled:opacity-30 transition-all"title={`Install ${fullName}`}>@@ -55,8 +64,7 @@ function VariantPullButton({ model, pullModel, isPulling, isInstalled }: {<div className="relative"><buttononClick={() => setOpen(!open)}- disabled={isPulling}- className="flex items-center gap-1 px-2 py-1.5 rounded-lg bg-gray-100 dark:bg-white/10 hover:bg-gray-200 dark:hover:bg-white/15 text-gray-700 dark:text-white disabled:opacity-30 transition-all text-xs"+ className="flex items-center gap-1 px-2 py-1.5 rounded-lg bg-gray-100 dark:bg-white/10 hover:bg-gray-200 dark:hover:bg-white/15 text-gray-700 dark:text-white transition-all text-xs"><Download size={12} /><span>Install</span>@@ -67,18 +75,23 @@ function VariantPullButton({ model, pullModel, isPulling, isInstalled }: {{tags.map(tag => {const fullName = `${model.name}:${tag.toLowerCase()}`const installed = isInstalled(fullName)+ const info = TAG_INFO[tag.toLowerCase()]return (<buttonkey={tag}onClick={() => { if (!installed) pullModel(fullName); setOpen(false) }}- disabled={installed || isPulling}- className="w-full flex items-center justify-between gap-3 px-3 py-2 text-xs hover:bg-gray-200 dark:hover:bg-white/10 transition-colors disabled:opacity-50"+ disabled={installed || isPullingModel(fullName)}+ className="w-full flex items-start justify-between gap-3 px-3 py-2 text-xs hover:bg-gray-200 dark:hover:bg-white/10 transition-colors disabled:opacity-50"+ title={info || `Install ${fullName}`}>- <span className="text-gray-800 dark:text-white font-medium">{tag}</span>+ <div className="text-left">+ <span className="text-gray-800 dark:text-white font-medium">{tag}</span>+ {info && <p className="text-[0.6rem] text-gray-500 mt-0.5">{info}</p>}+ </div>{installed ? (- <CheckCircle size={12} className="text-green-500" />+ <CheckCircle size={12} className="text-green-500 shrink-0 mt-0.5" />) : (- <Download size={12} className="text-gray-400" />+ <Download size={12} className="text-gray-400 shrink-0 mt-0.5" />)}</button>)@@ -89,13 +102,13 @@ function VariantPullButton({ model, pullModel, isPulling, isInstalled }: {)}-function ModelDiscoverCard({ model, index, isText, getModelDownloadState, pullModel, isPulling, isInstalled, handleDownload }: {+function ModelDiscoverCard({ model, index, isText, getModelDownloadState, pullModel, isPullingModel, isInstalled, handleDownload }: {model: DiscoverModelindex: numberisText: booleangetModelDownloadState: (m: DiscoverModel) => DownloadProgress | nullpullModel: (name: string) => void- isPulling: boolean+ isPullingModel: (name: string) => booleanisInstalled: (name: string) => booleanhandleDownload: (m: DiscoverModel) => void}) {@@ -155,7 +168,7 @@ function ModelDiscoverCard({ model, index, isText, getModelDownloadState, pullMo<div className="flex items-center gap-1 shrink-0">{isText ? (- <VariantPullButton model={model} pullModel={pullModel} isPulling={isPulling} isInstalled={isInstalled} />+ <VariantPullButton model={model} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} />) : (<>{isComplete ? (@@ -200,7 +213,7 @@ export function DiscoverModels({ category }: Props) {const [downloadMeta, setDownloadMeta] = useState<Record<string, { url: string; subfolder: string }>>({})const [systemVRAM, setSystemVRAM] = useState<number | null>(null)const [subTab, setSubTab] = useState<'uncensored' | 'mainstream'>('uncensored')- const { pullModel, isPulling, pullProgress, models: installedModels } = useModels()+ const { pullModel, isPullingModel, models: installedModels } = useModels()const pollRef = useRef<ReturnType<typeof setInterval> | null>(null)// Load text models from Ollama search@@ -377,9 +390,7 @@ export function DiscoverModels({ category }: Props) {return downloads[model.filename] ?? null}- const progress = pullProgress?.total && pullProgress?.completed- ? (pullProgress.completed / pullProgress.total) * 100- : 0+ // Progress calculation moved to DownloadBadge in Headerconst handleOllamaSearch = async () => {if (!search.trim() || !isText) return@@ -470,20 +481,7 @@ export function DiscoverModels({ category }: Props) {</GlassCard>)}- {/* Ollama pull progress */}- {isText && isPulling && pullProgress && (- <GlassCard className="p-3">- <p className="text-sm text-gray-600 dark:text-gray-300 mb-2">{pullProgress.status}</p>- {pullProgress.total && pullProgress.completed !== undefined && (- <>- <ProgressBar progress={progress} />- <p className="text-xs text-gray-500 mt-1">- {formatBytes(pullProgress.completed || 0)} / {formatBytes(pullProgress.total)}- </p>- </>- )}- </GlassCard>- )}+ {/* Download progress moved to DownloadBadge in Header */}{!isText && (<p className="text-[0.65rem] text-gray-500">@@ -665,7 +663,7 @@ export function DiscoverModels({ category }: Props) {{subTab === 'uncensored' && (<div className="grid grid-cols-1 md:grid-cols-2 gap-3">{filteredUncensored.map((model, i) => (- <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPulling={isPulling} isInstalled={isInstalled} handleDownload={handleDownload} />+ <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} handleDownload={handleDownload} />))}{filteredUncensored.length === 0 && (<p className="text-center text-gray-500 py-4 col-span-2">No uncensored models match your search</p>@@ -675,7 +673,7 @@ export function DiscoverModels({ category }: Props) {{subTab === 'mainstream' && (<div className="grid grid-cols-1 md:grid-cols-2 gap-3">{filteredMainstream.map((model, i) => (- <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPulling={isPulling} isInstalled={isInstalled} handleDownload={handleDownload} />+ <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} handleDownload={handleDownload} />))}{filteredMainstream.length === 0 && (<p className="text-center text-gray-500 py-4 col-span-2">No mainstream models match your search</p>@@ -689,7 +687,7 @@ export function DiscoverModels({ category }: Props) {<h3 className="text-[0.7rem] font-semibold text-gray-500 uppercase tracking-wider">Search Results</h3><div className="grid grid-cols-1 md:grid-cols-2 gap-3">{filtered.filter(m => !uncensoredModels.some(u => u.name === m.name) && !mainstreamModels.some(u => u.name === m.name)).map((model, i) => (- <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPulling={isPulling} isInstalled={isInstalled} handleDownload={handleDownload} />+ <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} handleDownload={handleDownload} />))}</div></div>@@ -698,7 +696,7 @@ export function DiscoverModels({ category }: Props) {) : !isVideo && (<div className="grid grid-cols-1 md:grid-cols-2 gap-3">{filtered.map((model, i) => (- <ModelDiscoverCard key={model.name} model={model} index={i} isText={false} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPulling={isPulling} isInstalled={isInstalled} handleDownload={handleDownload} />+ <ModelDiscoverCard key={model.name} model={model} index={i} isText={false} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} handleDownload={handleDownload} />))}</div>)}diff --git a/src/components/models/PullModelDialog.tsx b/src/components/models/PullModelDialog.tsxindex 872fb156..62ecf7c2 100644--- a/src/components/models/PullModelDialog.tsx+++ b/src/components/models/PullModelDialog.tsx@@ -2,9 +2,7 @@ import { useState } from 'react'import { Download } from 'lucide-react'import { Modal } from '../ui/Modal'import { GlowButton } from '../ui/GlowButton'-import { ProgressBar } from '../ui/ProgressBar'import { useModels } from '../../hooks/useModels'-import { formatBytes } from '../../lib/formatters'interface Props {open: boolean@@ -13,18 +11,14 @@ interface Props {export function PullModelDialog({ open, onClose }: Props) {const [modelName, setModelName] = useState('')- const { pullModel, isPulling, pullProgress } = useModels()+ const { pullModel } = useModels()const handlePull = () => {- if (!modelName.trim() || isPulling) return+ if (!modelName.trim()) returnpullModel(modelName.trim())+ setModelName('')}- const progress =- pullProgress?.total && pullProgress?.completed- ? (pullProgress.completed / pullProgress.total) * 100- : 0-return (<Modal open={open} onClose={onClose} title="Pull Model"><div className="space-y-4">@@ -36,27 +30,13 @@ export function PullModelDialog({ open, onClose }: Props) {onKeyDown={(e) => e.key === 'Enter' && handlePull()}placeholder="e.g. llama3.1:8b or mannix/llama3.1-8b-abliterated"className="w-full px-3 py-2 rounded-lg bg-white/5 border border-white/10 text-white placeholder-gray-500 focus:outline-none focus:border-white/20 text-sm"- disabled={isPulling}/>+ <p className="text-[0.6rem] text-gray-500 mt-1">Progress appears in the download icon in the header.</p></div>- {isPulling && pullProgress && (- <div className="space-y-2">- <p className="text-sm text-gray-300">{pullProgress.status}</p>- {pullProgress.total && pullProgress.completed !== undefined && (- <>- <ProgressBar progress={progress} />- <p className="text-xs text-gray-500">- {formatBytes(pullProgress.completed || 0)} / {formatBytes(pullProgress.total)}- </p>- </>- )}- </div>- )}-- <GlowButton onClick={handlePull} disabled={!modelName.trim() || isPulling} className="w-full flex items-center justify-center gap-2">+ <GlowButton onClick={handlePull} disabled={!modelName.trim()} className="w-full flex items-center justify-center gap-2"><Download size={16} />- {isPulling ? 'Downloading...' : 'Pull Model'}+ Pull Model</GlowButton></div></Modal>diff --git a/src/components/onboarding/Onboarding.tsx b/src/components/onboarding/Onboarding.tsxindex ad4d4d6e..8a7463f8 100644--- a/src/components/onboarding/Onboarding.tsx+++ b/src/components/onboarding/Onboarding.tsx@@ -1,6 +1,6 @@import { useState, useEffect } from 'react'import { motion, AnimatePresence } from 'framer-motion'-import { Sun, Moon, ArrowRight, Download, Check, ChevronRight, Loader2 } from 'lucide-react'+import { Sun, Moon, ArrowRight, Download, Check, ChevronRight, Loader2, Pause } from 'lucide-react'import { useSettingsStore } from '../../stores/settingsStore'import { useProviderStore } from '../../stores/providerStore'import { useModels } from '../../hooks/useModels'@@ -16,7 +16,7 @@ export function Onboarding() {const [step, setStep] = useState<Step>('welcome')const [selectedModels, setSelectedModels] = useState<string[]>([])const { settings, updateSettings } = useSettingsStore()- const { pullModel, isPulling, pullProgress, models: installedModels } = useModels()+ const { pullModel, pausePull, isPulling, activePulls, models: installedModels } = useModels()const [pullingModel, setPullingModel] = useState<string | null>(null)const [pulledModels, setPulledModels] = useState<string[]>([])const [detectedBackends, setDetectedBackends] = useState<DetectedBackend[]>([])@@ -49,6 +49,8 @@ export function Onboarding() {updateSettings({ onboardingDone: true })}+ const currentPull = pullingModel ? activePulls[pullingModel] : null+ const pullProgress = currentPull?.progress ?? nullconst progress =pullProgress?.total && pullProgress?.completed? (pullProgress.completed / pullProgress.total) * 100@@ -233,9 +235,18 @@ export function Onboarding() {{isPulling && pullingModel && (<div className={`p-2.5 rounded-lg border ${cardClass}`}>- <p className="text-[0.7rem] mb-1">- Installing <span className="font-mono font-medium">{pullingModel}</span>...- </p>+ <div className="flex items-center justify-between mb-1">+ <p className="text-[0.7rem]">+ Installing <span className="font-mono font-medium">{pullingModel}</span>...+ </p>+ <button+ onClick={() => pullingModel && pausePull(pullingModel)}+ className="p-0.5 rounded hover:bg-red-500/20 text-gray-400 hover:text-red-400 transition-colors"+ title="Pause download"+ >+ <Pause size={12} />+ </button>+ </div><p className={`text-[0.6rem] mb-1.5 ${isDark ? 'text-gray-400' : 'text-gray-500'}`}>{pullProgress?.status}</p>{pullProgress?.total && pullProgress?.completed !== undefined && (<ProgressBar progress={progress} />diff --git a/src/hooks/useModels.ts b/src/hooks/useModels.tsindex 7b321d23..d49bbeb7 100644--- a/src/hooks/useModels.ts+++ b/src/hooks/useModels.ts@@ -1,14 +1,13 @@import { useCallback } from 'react'-import { listModels, pullModel as pullModelApi, deleteModel as deleteModelApi } from '../api/ollama'+import { listModels, pullModel as pullModelApi, pullModelTauri, deleteModel as deleteModelApi } from '../api/ollama'+import { isTauri } from '../api/backend'import { getCheckpoints as getComfyCheckpoints, getDiffusionModels as getComfyDiffusionModels, checkComfyConnection } from '../api/comfyui'import { parseNDJSONStream } from '../api/stream'import { useModelStore } from '../stores/modelStore'import { useProviderStore } from '../stores/providerStore'-// useProviderStore also used inline in fetchModels for Ollama-enabled checkimport { getEnabledProviders, prefixModelName } from '../api/providers'import type { PullProgress, AIModel, ModelCategory, ImageModel, VideoModel, CloudModel } from '../types/models'-// Known video model patternsconst VIDEO_PATTERNS = [/wan/, /svd/, /animatediff/, /animate/, /video/, /cogvideo/, /ltx/i]function isVideoModel(name: string): boolean {@@ -17,66 +16,41 @@ function isVideoModel(name: string): boolean {}export function useModels() {- const { models, activeModel, pullProgress, isPulling, categoryFilter, setModels, setActiveModel, setPullProgress, setIsPulling, setCategoryFilter } =- useModelStore()+ const {+ models, activeModel, activePulls, categoryFilter,+ setModels, setActiveModel, startPull, updatePullProgress,+ pausePull, completePull, dismissPull, setCategoryFilter,+ } = useModelStore()++ const isPulling = Object.keys(activePulls).length > 0const fetchModels = useCallback(async () => {try {const allModels: AIModel[] = []-- // ── Fetch from all enabled providers ──────────────────const providers = getEnabledProviders()-const providerResults = await Promise.allSettled(providers.map(async (provider) => {const providerModels = await provider.listModels()return providerModels.map((pm): AIModel => {if (pm.provider === 'ollama') {- // Ollama models keep their original name format (backward compat)return {- name: pm.id,- model: pm.id,- size: 0,- digest: '',- modified_at: '',- details: {- parent_model: '',- format: '',- family: '',- families: [],- parameter_size: '',- quantization_level: '',- },- type: 'text' as const,- provider: 'ollama',- providerName: 'Ollama',+ name: pm.id, model: pm.id, size: 0, digest: '', modified_at: '',+ details: { parent_model: '', format: '', family: '', families: [], parameter_size: '', quantization_level: '' },+ type: 'text' as const, provider: 'ollama', providerName: 'Ollama',}}-- // Cloud models get prefixed names for disambiguationconst prefixedName = prefixModelName(pm.provider, pm.id)return {- name: prefixedName,- model: pm.id,- size: 0,- type: 'text' as const,- provider: pm.provider,- providerName: pm.providerName,- contextLength: pm.contextLength,- supportsTools: pm.supportsTools,- supportsVision: pm.supportsVision,+ name: prefixedName, model: pm.id, size: 0, type: 'text' as const,+ provider: pm.provider, providerName: pm.providerName,+ contextLength: pm.contextLength, supportsTools: pm.supportsTools, supportsVision: pm.supportsVision,} satisfies CloudModel})}))-for (const result of providerResults) {- if (result.status === 'fulfilled') {- allModels.push(...result.value)- }+ if (result.status === 'fulfilled') allModels.push(...result.value)}-- // Fallback: if Ollama is enabled but provider didn't return models, try direct APIconst ollamaEnabled = useProviderStore.getState().providers.ollama.enabledconst hasOllamaModels = allModels.some(m => m.provider === 'ollama')if (ollamaEnabled && !hasOllamaModels) {@@ -85,55 +59,73 @@ export function useModels() {allModels.push(...ollamaModels.map(m => ({ ...m, provider: 'ollama' as const, providerName: 'Ollama' })))} catch { /* Ollama might not be running */ }}-- // ── ComfyUI image/video models (unchanged) ────────────let comfyModels: AIModel[] = []const comfyOk = await checkComfyConnection()if (comfyOk) {try {- const [checkpoints, diffusionModels] = await Promise.all([- getComfyCheckpoints(),- getComfyDiffusionModels(),- ])+ const [checkpoints, diffusionModels] = await Promise.all([getComfyCheckpoints(), getComfyDiffusionModels()])const classifyComfyModel = (name: string): AIModel => {- if (isVideoModel(name)) {- return { name, model: name, size: 0, format: 'safetensors', architecture: 'unknown', type: 'video', providerName: 'ComfyUI' } as VideoModel- }+ if (isVideoModel(name)) return { name, model: name, size: 0, format: 'safetensors', architecture: 'unknown', type: 'video', providerName: 'ComfyUI' } as VideoModelreturn { name, model: name, size: 0, format: 'safetensors', architecture: 'unknown', type: 'image', providerName: 'ComfyUI' } as ImageModel}- comfyModels = [- ...checkpoints.map((name) => classifyComfyModel(name)),- ...diffusionModels.map((name) => classifyComfyModel(name)),- ]- } catch {- // ComfyUI model fetch failed, continue without- }+ comfyModels = [...checkpoints.map(classifyComfyModel), ...diffusionModels.map(classifyComfyModel)]+ } catch { /* continue */ }}-setModels([...allModels, ...comfyModels])- } catch {- // ignore- }+ } catch { /* ignore */ }}, [setModels])const pullModel = useCallback(async (name: string) => {- setIsPulling(true)- setPullProgress({ status: 'Starting download...' })+ const existing = activePulls[name]+ // If already active and not paused, don't restart+ if (existing && !existing.paused && !existing.complete) return++ const controller = new AbortController()+ startPull(name, controller)++ if (isTauri()) {+ const { promise, cancel } = pullModelTauri(name, (progress) => {+ updatePullProgress(name, progress)+ })+ controller.signal.addEventListener('abort', cancel)+ try {+ await promise+ completePull(name)+ await fetchModels()+ // Auto-dismiss after 5s+ setTimeout(() => dismissPull(name), 5000)+ } catch {+ // Stream disconnected (pause or error) — card stays visible+ }+ return+ }++ // Dev mode: streaming fetchtry {- const response = await pullModelApi(name)+ const response = await pullModelApi(name, controller.signal)for await (const chunk of parseNDJSONStream<PullProgress>(response)) {- setPullProgress(chunk)+ updatePullProgress(name, chunk)}+ completePull(name)await fetchModels()+ setTimeout(() => dismissPull(name), 5000)} catch (err) {- setPullProgress({ status: `Error: ${(err as Error).message}` })- } finally {- setIsPulling(false)- setTimeout(() => setPullProgress(null), 3000)+ if ((err as Error).name !== 'AbortError') {+ updatePullProgress(name, { status: `Error: ${(err as Error).message}` })+ }+ // On abort (pause): card stays with "Paused" status}},- [fetchModels, setIsPulling, setPullProgress]+ [activePulls, fetchModels, startPull, updatePullProgress, completePull, dismissPull]+ )++ const isPullingModel = useCallback(+ (name: string) => {+ const pull = activePulls[name]+ return !!pull && !pull.paused && !pull.complete+ },+ [activePulls])const removeModel = useCallback(@@ -144,11 +136,14 @@ export function useModels() {[fetchModels])- // Filter-Helper für UIconst getFilteredModels = (filter: ModelCategory = categoryFilter) => {if (filter === 'all') return modelsreturn models.filter((m: AIModel) => m.type === filter)}- return { models, activeModel, pullProgress, isPulling, categoryFilter, fetchModels, pullModel, removeModel, setActiveModel, setCategoryFilter, getFilteredModels }+ return {+ models, activeModel, activePulls, isPulling, categoryFilter,+ fetchModels, pullModel, pausePull, dismissPull,+ removeModel, setActiveModel, setCategoryFilter, getFilteredModels, isPullingModel,+ }}diff --git a/src/lib/model-compatibility.ts b/src/lib/model-compatibility.tsindex 7111ce6e..b1b59b9b 100644--- a/src/lib/model-compatibility.ts+++ b/src/lib/model-compatibility.ts@@ -12,7 +12,7 @@ const AGENT_COMPATIBLE = [// ── Hermes: THE uncensored agent model ──'hermes3', 'hermes-3', 'hermes',// ── Standard models with native tool calling ──- 'qwen3', 'qwen2.5',+ 'qwen3-coder-next', 'qwen3-coder', 'qwen3', 'qwen2.5','llama3.1', 'llama3.2', 'llama3.3', 'llama4','mistral', 'mistral-nemo', 'mistral-small', 'mistral-large','command-r',@@ -35,7 +35,14 @@ export function isAgentCompatible(modelName: string): boolean {// Ollama: check compatibility listconst name = modelName.toLowerCase()- if (name.includes('abliterated') || name.includes('uncensored')) return false++ // Some abliterated models retain native tool calling+ const ABLITERATED_NATIVE = ['qwen3-coder', 'hermes3', 'hermes-3', 'hermes']+ if (name.includes('abliterated') || name.includes('uncensored')) {+ const baseName = name.replace(/^[^/]+\//, '').replace(/-abliterated/g, '').replace(/-uncensored/g, '').replace(/:.*$/, '')+ return ABLITERATED_NATIVE.some((f) => baseName.startsWith(f))+ }+const baseName = name.replace(/^[^/]+\//, '').replace(/-instruct/g, '').replace(/-chat/g, '').replace(/:.*$/, '')return AGENT_COMPATIBLE.some((f) => baseName.startsWith(f))}@@ -72,6 +79,7 @@ export function getRecommendedAgentModels(): RecommendedModel[] {{ name: 'hermes3:8b', label: 'Hermes 3 8B', reason: 'Uncensored + native tool calling. THE agent model.', hot: true, provider: 'ollama' },{ name: 'hermes3:70b', label: 'Hermes 3 70B', reason: 'Maximum power uncensored agent. Needs 48GB+.', hot: true, provider: 'ollama' },{ name: 'gemma4:26b', label: 'Gemma 4 26B MoE', reason: '26B brain, runs like 4B. Native tools + vision. Apache 2.0.', hot: true, provider: 'ollama' },+ { name: 'qwen3-coder:30b', label: 'Qwen3-Coder 30B MoE', reason: '30B brain, 3B active. Built for code + agentic workflows. 256K context.', hot: true, provider: 'ollama' },{ name: 'qwen2.5:7b', label: 'Qwen 2.5 7B', reason: 'Fast, reliable tool calling', provider: 'ollama' },{ name: 'llama3.1:8b', label: 'Llama 3.1 8B', reason: 'Proven tool calling all-rounder', provider: 'ollama' },{ name: 'openai::gpt-4o', label: 'GPT-4o', reason: 'Cloud: powerful tool calling', provider: 'openai' },diff --git a/src/stores/modelStore.ts b/src/stores/modelStore.tsindex 360ec8b0..96cd3d87 100644--- a/src/stores/modelStore.ts+++ b/src/stores/modelStore.ts@@ -3,17 +3,26 @@ import { persist } from 'zustand/middleware'import type { AIModel, PullProgress, ModelCategory } from '../types/models'import { unloadModel } from '../api/ollama'+export interface PullState {+ progress: PullProgress+ controller: AbortController+ paused: boolean+ complete: boolean+}+interface ModelState {models: AIModel[]activeModel: string | null- pullProgress: PullProgress | null- isPulling: boolean+ activePulls: Record<string, PullState>isModelLoading: booleancategoryFilter: ModelCategorysetModels: (models: AIModel[]) => voidsetActiveModel: (name: string) => void- setPullProgress: (progress: PullProgress | null) => void- setIsPulling: (pulling: boolean) => void+ startPull: (name: string, controller: AbortController) => void+ updatePullProgress: (name: string, progress: PullProgress) => void+ pausePull: (name: string) => void+ completePull: (name: string) => void+ dismissPull: (name: string) => voidsetIsModelLoading: (loading: boolean) => voidsetCategoryFilter: (category: ModelCategory) => void}@@ -23,8 +32,7 @@ export const useModelStore = create<ModelState>()((set, get) => ({models: [],activeModel: null,- pullProgress: null,- isPulling: false,+ activePulls: {},isModelLoading: false,categoryFilter: 'all',@@ -37,20 +45,61 @@ export const useModelStore = create<ModelState>()(setActiveModel: (name) => {const prev = get().activeModelset({ activeModel: name })-- // Auto-unload previous Ollama model to free RAM/VRAM (fire-and-forget)- // Only unload local Ollama models (no '::' provider prefix)if (prev && prev !== name && !prev.includes('::')) {unloadModel(prev).catch(() => {})}},- setPullProgress: (progress) => set({ pullProgress: progress }),+ startPull: (name, controller) =>+ set((state) => ({+ activePulls: {+ ...state.activePulls,+ [name]: { progress: { status: 'Starting download...' }, controller, paused: false, complete: false },+ },+ })),- setIsPulling: (pulling) => set({ isPulling: pulling }),+ updatePullProgress: (name, progress) =>+ set((state) => {+ if (!state.activePulls[name]) return state+ return {+ activePulls: {+ ...state.activePulls,+ [name]: { ...state.activePulls[name], progress, paused: false },+ },+ }+ }),- setIsModelLoading: (loading) => set({ isModelLoading: loading }),+ pausePull: (name) => {+ const pull = get().activePulls[name]+ if (pull && !pull.complete) {+ pull.controller.abort()+ set((state) => ({+ activePulls: {+ ...state.activePulls,+ [name]: { ...state.activePulls[name], paused: true, progress: { ...state.activePulls[name].progress, status: 'Paused' } },+ },+ }))+ }+ },++ completePull: (name) =>+ set((state) => {+ if (!state.activePulls[name]) return state+ return {+ activePulls: {+ ...state.activePulls,+ [name]: { ...state.activePulls[name], complete: true, paused: false, progress: { status: 'Complete' } },+ },+ }+ }),+ dismissPull: (name) =>+ set((state) => {+ const { [name]: _, ...rest } = state.activePulls+ return { activePulls: rest }+ }),++ setIsModelLoading: (loading) => set({ isModelLoading: loading }),setCategoryFilter: (category) => set({ categoryFilter: category }),}),{