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
release: v2.3.7 — fix Ollama unreachable when OLLAMA_HOST is set (#31)
PurpleDoubleD0104c27ce119
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c41c76ab..e659fe3e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,20 @@All notable changes to Locally Uncensored are documented here.+## [2.3.7] - 2026-04-22++### Added+- **Configurable Ollama endpoint (remote Ollama + `OLLAMA_HOST` env var support)** — GitHub Issue #31 by @k-wilkinson. The pre-2.3.7 app hardcoded `http://localhost:11434` in four places (the frontend `ollamaUrl()` helper used by every `/tags`/`/chat`/`/show`/`/pull`/`/generate` call, the Vite dev-proxy target, the Ollama provider's dev-mode `apiUrl()`, and the Rust `pull_model_stream` URL), so setting `OLLAMA_HOST=0.0.0.0:11434`, `192.168.1.x:11434` or any non-default port was silently ignored — the app reported "No local backend detected", model dropdowns stayed empty, Settings → Providers → Ollama → Endpoint field had zero effect, and the Test button always said Failed even when `curl` against the configured endpoint returned data. Now all four layers flow from a single `ollama_base` field that reads, in priority order, the persisted GUI value from `%APPDATA%/locally-uncensored/config.json`, the `OLLAMA_HOST` env var at startup (same semantics as Ollama itself), then the default. Accepts bare `host:port`, scheme-less host, or full URL. The Vite dev-proxy target is computed from `OLLAMA_HOST` at server startup so `OLLAMA_HOST=… npm run dev` also just works. The Rust SSRF allow-list in `proxy_localhost` was widened to accept the configured Ollama + ComfyUI hosts (everything else still blocked). 19 regression tests in `backend-urls.test.ts`.++### Fixed+- **`pull_model_stream` Rust command was hardcoded to `http://localhost:11434/api/pull`** — same root cause as Issue #31 but in a second place. Model-pull downloads ignored any user-configured Ollama endpoint. Now reads from `state.ollama_base`.++### Changed+- Test suite 2183 → 2202 green.++### Notes+- Drop-in upgrade from v2.3.6. The default endpoint is still `http://localhost:11434` — existing users see zero behavior change. If you have `OLLAMA_HOST` in your environment (Docker, LAN, homelab) it's now honored; if you've edited Settings → Providers → Ollama → Endpoint that value now actually flows through the app.+## [2.3.6] - 2026-04-21### Addeddiff --git a/README.md b/README.mdindex 35fcf889..a8ee8176 100644--- a/README.md+++ b/README.md@@ -35,17 +35,15 @@ No cloud. No data collection. No API keys. Auto-detects 12 local backends. Your----## v2.3.6 — Current Release+## v2.3.7 — Current Release-**Remote ComfyUI host + LM Studio/OpenAI-compat CORS fix, 2183 Tests**+**Remote Ollama + `OLLAMA_HOST` env var support, 2202 Tests**### Critical Fixes (why you want this update)-- **Configurable ComfyUI host** — Settings → ComfyUI → Host. Previously only the port was configurable, the host was hardcoded `localhost`. Now you can point LU at a ComfyUI running in Docker, on a LAN machine, or on a headless homelab server. When the host is local, the Start/Stop/Restart/Install/Path controls stay visible; remote hosts hide them (LU can't manage a remote Python process). Requested in Discussion #1 by @ShoaibSajid.-- **LM Studio (and every OpenAI-compat local backend) can actually be reached from LU** — v2.3.5 auto-detected LM Studio and pre-enabled it, but the actual `/v1/*` calls CORS-failed inside the Tauri WebView because `openai-provider.ts` used plain `fetch()`. Test button always showed "Failed" and models never appeared in the dropdown even when curl confirmed the backend was up. Fix routes localhost calls through the Rust proxy with direct-fetch fallback. Covers LM Studio, vLLM, llama.cpp server, KoboldCpp, Jan, GPT4All, oobabooga, Aphrodite, SGLang, TGI, LocalAI, TabbyAPI.-- **ComfyUI port now actually persists across restarts** — pre-existing bug: the port setter wrote to `config.json` but startup never read it back. New `load_comfy_config_values()` helper applies persisted port + host at startup.+- **Remote Ollama now actually works** — Issue #31 by @k-wilkinson. Pre-2.3.7 the Ollama endpoint was hardcoded to `localhost:11434` in four places (frontend URL helper, Vite dev proxy, Ollama provider dev-mode path, Rust pull-model command), so setting `OLLAMA_HOST=0.0.0.0:11434`, `192.168.1.x:11434` or any custom port was silently ignored — LU reported "No local backend detected", model dropdowns stayed empty, Settings → Providers → Ollama → Endpoint field had zero effect, and the Test button always said Failed. Fixed end-to-end: a single `ollama_base` field reads, in priority, the persisted GUI value, then the `OLLAMA_HOST` env var (same semantics as Ollama itself), then the default. Vite dev proxy target is computed from `OLLAMA_HOST` at startup, the Rust SSRF allow-list in `proxy_localhost` accepts the configured Ollama + ComfyUI hosts, `pull_model_stream` reads from state.-### What's still in v2.3.6 from v2.3.5-Drop-in upgrade. v2.3.5's auto-detection fix + Windows terminal-popup hardening + setup.bat warnings remain in place. Every fix from v2.3.5, v2.3.4, and earlier still applies.+### What's still in v2.3.7 from v2.3.6+Drop-in upgrade. v2.3.6's configurable ComfyUI host (Shoaib's remote ComfyUI feature), LM Studio / OpenAI-compat CORS fix, and ComfyUI port persistence all remain in place.### Remote Access + Mobile Web App- **Access your AI from your phone** — Dispatch via LAN or Cloudflare Tunnel (Internet)diff --git a/docs/index.html b/docs/index.htmlindex c0999d1d..30d7b8b3 100644--- a/docs/index.html+++ b/docs/index.html@@ -33,7 +33,7 @@<link rel="icon" href="https://locallyuncensored.com/favicon.png"><link rel="apple-touch-icon" href="https://locallyuncensored.com/favicon.png"><script type="application/ld+json">-{"@context":"https://schema.org","@type":"SoftwareApplication","name":"Locally Uncensored","alternateName":["LU","Locally Uncensored Desktop App"],"applicationCategory":"DeveloperApplication","applicationSubCategory":"Artificial Intelligence","operatingSystem":"Windows 10, Windows 11, Linux","description":"Open-source desktop app for running AI locally. Chat with 20+ providers, generate images and video via ComfyUI, and code with a built-in AI agent — all on your own hardware. Auto-detects 12 local backends. No cloud, no telemetry.","url":"https://locallyuncensored.com/","downloadUrl":"https://github.com/PurpleDoubleD/locally-uncensored/releases/latest","softwareVersion":"2.3.6","license":"https://www.gnu.org/licenses/agpl-3.0.html","author":{"@type":"Person","name":"PurpleDoubleD","url":"https://github.com/PurpleDoubleD"},"offers":{"@type":"Offer","price":"0","priceCurrency":"USD","availability":"https://schema.org/InStock"},"featureList":["Plug & Play Setup with 12 Local Backend Auto-Detection (Ollama, LM Studio, vLLM, KoboldCpp, Jan, llama.cpp, LocalAI, GPT4All, TabbyAPI, Aphrodite, SGLang, TGI)","20+ Provider Presets (local + cloud)","Qwen 3.6 Day-0 Support (35B MoE, Vision, Agentic Coding, 256K context)","GPT-OSS Compatible (120B, 20B via Ollama)","GLM-4.7 Flash Integration","DeepSeek R1 and DeepSeek V3 Support","Llama 4 and Llama 3.3 Ready","Gemma 4 E4B and 27B (Native Vision)","Mistral Small 3 and Phi 4 Support","Qwen 3 Coder and Qwen 2.5 Coder","Abliterated Model Variants","Codex Coding Agent with Live Streaming and Apply-Patch","Claude Code CLI Integration","Agent Mode with 14 Tools, Parallel Execution, MCP, Sub-Agent Delegation","Remote Access from Phone via LAN or Cloudflare Tunnel (6-digit Passcode, QR Setup)","Mobile Web App (Chat, Codex, Tools, Plugins)","Image Generation via ComfyUI (FLUX 2 Klein, FLUX.1, Juggernaut XL, Z-Image Turbo, ERNIE-Image, SDXL, SD 3.5)","Video Generation (Wan 2.1, Wan 2.2, HunyuanVideo 1.5, LTX 2.3, FramePack F1, AnimateDiff, CogVideoX)","Image-to-Image with Denoise Control","Image-to-Video (FramePack F1, CogVideoX, SVD)","Granular Permission System (7 Tool Categories)","File Upload with Vision Support","Thinking Mode with Universal Tag Stripping","A/B Model Compare","Local Benchmark","Memory System and Document RAG","Voice (STT / TTS)","Auto-Update over Signed NSIS Channel","75+ One-Click Model Downloads","Hardware-Aware Model Recommendations","100% Offline and Private (No Telemetry)","AGPL-3.0 Open Source"],"screenshot":"https://raw.githubusercontent.com/PurpleDoubleD/locally-uncensored/master/docs/social-preview.png","softwareRequirements":"Any OpenAI-compatible local backend (Ollama, LM Studio, vLLM, KoboldCpp, etc.) or cloud API key","memoryRequirements":"8 GB RAM minimum; 8-16 GB VRAM for image/video generation","storageRequirements":"6 GB for default model"}+{"@context":"https://schema.org","@type":"SoftwareApplication","name":"Locally Uncensored","alternateName":["LU","Locally Uncensored Desktop App"],"applicationCategory":"DeveloperApplication","applicationSubCategory":"Artificial Intelligence","operatingSystem":"Windows 10, Windows 11, Linux","description":"Open-source desktop app for running AI locally. Chat with 20+ providers, generate images and video via ComfyUI, and code with a built-in AI agent — all on your own hardware. Auto-detects 12 local backends. No cloud, no telemetry.","url":"https://locallyuncensored.com/","downloadUrl":"https://github.com/PurpleDoubleD/locally-uncensored/releases/latest","softwareVersion":"2.3.7","license":"https://www.gnu.org/licenses/agpl-3.0.html","author":{"@type":"Person","name":"PurpleDoubleD","url":"https://github.com/PurpleDoubleD"},"offers":{"@type":"Offer","price":"0","priceCurrency":"USD","availability":"https://schema.org/InStock"},"featureList":["Plug & Play Setup with 12 Local Backend Auto-Detection (Ollama, LM Studio, vLLM, KoboldCpp, Jan, llama.cpp, LocalAI, GPT4All, TabbyAPI, Aphrodite, SGLang, TGI)","20+ Provider Presets (local + cloud)","Qwen 3.6 Day-0 Support (35B MoE, Vision, Agentic Coding, 256K context)","GPT-OSS Compatible (120B, 20B via Ollama)","GLM-4.7 Flash Integration","DeepSeek R1 and DeepSeek V3 Support","Llama 4 and Llama 3.3 Ready","Gemma 4 E4B and 27B (Native Vision)","Mistral Small 3 and Phi 4 Support","Qwen 3 Coder and Qwen 2.5 Coder","Abliterated Model Variants","Codex Coding Agent with Live Streaming and Apply-Patch","Claude Code CLI Integration","Agent Mode with 14 Tools, Parallel Execution, MCP, Sub-Agent Delegation","Remote Access from Phone via LAN or Cloudflare Tunnel (6-digit Passcode, QR Setup)","Mobile Web App (Chat, Codex, Tools, Plugins)","Image Generation via ComfyUI (FLUX 2 Klein, FLUX.1, Juggernaut XL, Z-Image Turbo, ERNIE-Image, SDXL, SD 3.5)","Video Generation (Wan 2.1, Wan 2.2, HunyuanVideo 1.5, LTX 2.3, FramePack F1, AnimateDiff, CogVideoX)","Image-to-Image with Denoise Control","Image-to-Video (FramePack F1, CogVideoX, SVD)","Granular Permission System (7 Tool Categories)","File Upload with Vision Support","Thinking Mode with Universal Tag Stripping","A/B Model Compare","Local Benchmark","Memory System and Document RAG","Voice (STT / TTS)","Auto-Update over Signed NSIS Channel","75+ One-Click Model Downloads","Hardware-Aware Model Recommendations","100% Offline and Private (No Telemetry)","AGPL-3.0 Open Source"],"screenshot":"https://raw.githubusercontent.com/PurpleDoubleD/locally-uncensored/master/docs/social-preview.png","softwareRequirements":"Any OpenAI-compatible local backend (Ollama, LM Studio, vLLM, KoboldCpp, etc.) or cloud API key","memoryRequirements":"8 GB RAM minimum; 8-16 GB VRAM for image/video generation","storageRequirements":"6 GB for default model"}</script><script type="application/ld+json">{"@context":"https://schema.org","@type":"Organization","name":"PurpleDoubleD","url":"https://github.com/PurpleDoubleD","logo":"https://locallyuncensored.com/logos/LU-monogram-bw-transparent.png","sameAs":["https://github.com/PurpleDoubleD","https://github.com/PurpleDoubleD/locally-uncensored","https://reddit.com/user/GroundbreakingMall54","https://locallyuncensored.com"]}@@ -827,7 +827,7 @@ footer a:hover{color:var(--fg)}<!-- Top meta strip --><div class="mast-strip">- <span class="numero">v 2.3.6</span>+ <span class="numero">v 2.3.7</span><span class="sep">·</span><span>AGPL-3.0</span><span class="sep">·</span>@@ -868,10 +868,10 @@ footer a:hover{color:var(--fg)}<div class="container"><div class="dl-card"><div class="dl-info">- <h3>Locally Uncensored <em>— 2.3.6</em></h3>+ <h3>Locally Uncensored <em>— 2.3.7</em></h3><p>WINDOWS · ~7 MB installer · AGPL-3.0</p></div>- <a class="dl-btn" href="https://github.com/PurpleDoubleD/locally-uncensored/releases/download/v2.3.6/Locally.Uncensored_2.3.6_x64-setup.exe" download>+ <a class="dl-btn" href="https://github.com/PurpleDoubleD/locally-uncensored/releases/download/v2.3.7/Locally.Uncensored_2.3.7_x64-setup.exe" download><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>Download .exe</a>@@ -1153,10 +1153,10 @@ footer a:hover{color:var(--fg)}<div class="narrow"><div class="dl-card"><div class="dl-info">- <h3>Locally Uncensored <em>— 2.3.6</em></h3>+ <h3>Locally Uncensored <em>— 2.3.7</em></h3><p>WINDOWS · ~7 MB installer · AGPL-3.0</p></div>- <a class="dl-btn" href="https://github.com/PurpleDoubleD/locally-uncensored/releases/download/v2.3.6/Locally.Uncensored_2.3.6_x64-setup.exe" download>+ <a class="dl-btn" href="https://github.com/PurpleDoubleD/locally-uncensored/releases/download/v2.3.7/Locally.Uncensored_2.3.7_x64-setup.exe" download><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>Download .exe</a>diff --git a/package.json b/package.jsonindex abcc0403..c26b9ba9 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "locally-uncensored",- "version": "2.3.6",+ "version": "2.3.7","private": false,"description": "Generate anything — text, images, video. Locally. Uncensored.","license": "AGPL-3.0",diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lockindex 653e8579..708086f5 100644--- a/src-tauri/Cargo.lock+++ b/src-tauri/Cargo.lock@@ -2508,7 +2508,7 @@ dependencies = [[[package]]name = "locally-uncensored"-version = "2.3.6"+version = "2.3.7"dependencies = ["axum","base64 0.22.1",diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.tomlindex 1e83bf14..08e64753 100644--- a/src-tauri/Cargo.toml+++ b/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "locally-uncensored"-version = "2.3.6"+version = "2.3.7"description = "Private, local AI chat & image/video generation"authors = ["purpledoubled"]edition = "2021"diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rsindex e30359e6..17208d31 100644--- a/src-tauri/src/commands/process.rs+++ b/src-tauri/src/commands/process.rs@@ -523,6 +523,80 @@ pub fn set_comfyui_port(port: u16, state: State<'_, AppState>) -> Result<serde_jOk(serde_json::json!({"status": "saved", "port": port}))}+/// Normalize user input into a full Ollama base URL.+/// Accepts bare `host:port`, scheme-less host, or full URL.+/// Returns full URL without trailing slash, or Err for obviously bad input.+fn normalize_ollama_base(input: &str) -> Result<String, String> {+ let trimmed = input.trim().trim_end_matches('/');+ if trimmed.is_empty() {+ return Err("Endpoint must not be empty".into());+ }+ // Reject whitespace / newlines inside the URL.+ if trimmed.chars().any(|c| c.is_whitespace()) {+ return Err("Endpoint must not contain whitespace".into());+ }+ let with_scheme = if trimmed.starts_with("http://") || trimmed.starts_with("https://") {+ trimmed.to_string()+ } else {+ format!("http://{}", trimmed)+ };+ // Sanity-check with a URL parse so "http://" alone or "http://:1234" can't pass.+ match url::Url::parse(&with_scheme) {+ Ok(u) if u.host_str().map_or(false, |h| !h.is_empty()) => Ok(with_scheme),+ _ => Err(format!("Not a valid URL: {}", input)),+ }+}++#[tauri::command]+pub fn set_ollama_host(host: String, state: State<'_, AppState>) -> Result<serde_json::Value, String> {+ let final_base = normalize_ollama_base(&host)?;++ {+ let mut b = state.ollama_base.lock().unwrap();+ *b = final_base.clone();+ }++ // Persist to config file under ollama_base — next startup will pick it+ // up via load_ollama_base() before any request fires.+ if let Some(config_dir) = dirs::config_dir() {+ let app_config = config_dir.join("locally-uncensored");+ let _ = fs::create_dir_all(&app_config);+ let config_file = app_config.join("config.json");++ let mut config: serde_json::Value = if config_file.exists() {+ fs::read_to_string(&config_file)+ .ok()+ .and_then(|s| serde_json::from_str(&s).ok())+ .unwrap_or_else(|| serde_json::json!({}))+ } else {+ serde_json::json!({})+ };++ config["ollama_base"] = serde_json::json!(final_base);+ let _ = fs::write(&config_file, serde_json::to_string_pretty(&config).unwrap());+ }++ let is_local = url::Url::parse(&final_base)+ .ok()+ .and_then(|u| u.host_str().map(|h| h.to_lowercase()))+ .map(|h| matches!(h.as_str(), "localhost" | "127.0.0.1" | "::1" | "0.0.0.0"))+ .unwrap_or(false);++ println!("[Ollama] Base URL set to {} (local={})", final_base, is_local);+ Ok(serde_json::json!({"status": "saved", "base": final_base, "isLocal": is_local}))+}++#[tauri::command]+pub fn get_ollama_host(state: State<'_, AppState>) -> Result<serde_json::Value, String> {+ let base = state.ollama_base.lock().unwrap().clone();+ let is_local = url::Url::parse(&base)+ .ok()+ .and_then(|u| u.host_str().map(|h| h.to_lowercase()))+ .map(|h| matches!(h.as_str(), "localhost" | "127.0.0.1" | "::1" | "0.0.0.0"))+ .unwrap_or(false);+ Ok(serde_json::json!({"base": base, "isLocal": is_local}))+}+/// Auto-start Ollama on app launch (called from setup)pub fn auto_start_ollama(_state: &AppState) {// Check if already runningdiff --git a/src-tauri/src/commands/proxy.rs b/src-tauri/src/commands/proxy.rsindex d08303d0..35e91151 100644--- a/src-tauri/src/commands/proxy.rs+++ b/src-tauri/src/commands/proxy.rs@@ -99,8 +99,28 @@ pub async fn fetch_external_bytes(url: String) -> Result<Vec<u8>, String> {resp.bytes().await.map(|b| b.to_vec()).map_err(|e| e.to_string())}-/// Validate that a URL targets localhost only (anti-SSRF for local proxy).-fn validate_localhost_url(raw: &str) -> Result<(), String> {+/// Extract the host from `ollama_base` + `comfy_host` so we can allow-list+/// user-configured remote backends through the CORS proxy. Returns a+/// lowercase host string (or empty if the configured URL is malformed).+fn configured_host(url_or_host: &str) -> String {+ // ollama_base is always stored as a full URL (see load_ollama_base); try+ // that parse first.+ if let Ok(u) = url::Url::parse(url_or_host) {+ if let Some(h) = u.host_str() {+ return h.to_lowercase();+ }+ }+ // comfy_host is stored as a bare hostname/IP.+ url_or_host.trim().to_lowercase()+}++/// Validate that a URL targets either localhost or one of the user-configured+/// backend hosts (Ollama via `ollama_base`, ComfyUI via `comfy_host`).+///+/// SSRF policy: the proxy only forwards to hosts the user explicitly pointed+/// LU at. A JS-level compromise still cannot reach arbitrary intranet+/// services; it can only reach the host the user already wanted to reach.+fn validate_proxy_url(raw: &str, state: &crate::state::AppState) -> Result<(), String> {let parsed = url::Url::parse(raw).map_err(|e| format!("Invalid URL: {}", e))?;@@ -109,19 +129,46 @@ fn validate_localhost_url(raw: &str) -> Result<(), String> {other => return Err(format!("Blocked scheme: {}", other)),}- let host = parsed.host_str().unwrap_or("");- if host == "localhost" || host == "127.0.0.1" || host == "::1" || host == "[::1]" {- Ok(())- } else {- Err(format!("proxy_localhost: blocked non-localhost URL (host={})", host))+ let host = parsed.host_str().unwrap_or("").to_lowercase();++ // Always-allowed: localhost variants. Covers the common case + any+ // backend bound to 0.0.0.0 on the same machine.+ let is_local = matches!(host.as_str(),+ "localhost" | "127.0.0.1" | "::1" | "[::1]" | "0.0.0.0"+ ) || host.ends_with(".localhost");+ if is_local {+ return Ok(());+ }++ // Configured Ollama host (Issue #31: users with OLLAMA_HOST=192.168.x.x).+ let ollama_host = state.ollama_base.lock()+ .ok()+ .map(|g| configured_host(&g))+ .unwrap_or_default();+ if !ollama_host.is_empty() && host == ollama_host {+ return Ok(());}++ // Configured ComfyUI host (v2.3.6 feature).+ let comfy_host = state.comfy_host.lock()+ .ok()+ .map(|g| configured_host(&g))+ .unwrap_or_default();+ if !comfy_host.is_empty() && host == comfy_host {+ return Ok(());+ }++ Err(format!(+ "proxy_localhost: host '{}' not allowed. Configure remote backends via Settings → Providers (Ollama) or Settings → ComfyUI (Host).",+ host+ ))}-/// Generic localhost proxy — fetch any localhost URL bypassing CORS.-/// Used for Ollama and ComfyUI API calls in production mode.+/// Generic localhost proxy — fetch any localhost or configured-backend URL+/// bypassing CORS. Used for Ollama and ComfyUI API calls in production mode.#[tauri::command]-pub async fn proxy_localhost(url: String, method: Option<String>, body: Option<String>) -> Result<String, String> {- validate_localhost_url(&url)?;+pub async fn proxy_localhost(url: String, method: Option<String>, body: Option<String>, state: tauri::State<'_, crate::state::AppState>) -> Result<String, String> {+ validate_proxy_url(&url, &state)?;let client = reqwest::Client::builder().user_agent("LocallyUncensored/2.0")@@ -158,8 +205,8 @@ pub async fn proxy_localhost(url: String, method: Option<String>, body: Option<S/// Streaming localhost proxy — returns raw bytes for streaming responses (Ollama pull/chat).#[tauri::command]-pub async fn proxy_localhost_stream(url: String, method: Option<String>, body: Option<String>) -> Result<Vec<u8>, String> {- validate_localhost_url(&url)?;+pub async fn proxy_localhost_stream(url: String, method: Option<String>, body: Option<String>, state: tauri::State<'_, crate::state::AppState>) -> Result<Vec<u8>, String> {+ validate_proxy_url(&url, &state)?;let client = reqwest::Client::builder().user_agent("LocallyUncensored/2.0")@@ -217,8 +264,15 @@ pub async fn pull_model_stream(app: tauri::AppHandle, state: tauri::State<'_, cr.build().map_err(|e| e.to_string())?;+ // Route to the configured Ollama base (Issue #31 — was hardcoded+ // http://localhost:11434 so remote Ollama hosts never got the pull).+ let ollama_base = state.ollama_base.lock().ok()+ .map(|g| g.clone())+ .unwrap_or_else(|| "http://localhost:11434".to_string());+ let pull_url = format!("{}/api/pull", ollama_base.trim_end_matches('/'));+let resp = client- .post("http://localhost:11434/api/pull")+ .post(&pull_url).header("Content-Type", "application/json").body(format!(r#"{{"name":"{}","stream":true}}"#, name)).send()diff --git a/src-tauri/src/commands/remote.rs b/src-tauri/src/commands/remote.rsindex 10866346..d090de59 100644--- a/src-tauri/src/commands/remote.rs+++ b/src-tauri/src/commands/remote.rs@@ -59,7 +59,11 @@ pub struct PasscodeState {struct RemoteState {jwt_secret: Arc<TokioMutex<String>>,passcode: Arc<TokioMutex<PasscodeState>>,- ollama_port: u16,+ /// Full Ollama base URL (e.g. `http://localhost:11434` or `http://192.168.1.50:11434`).+ /// Mirrors AppState.ollama_base so mobile clients dispatched through the+ /// Remote Access proxy reach the same Ollama instance the desktop is+ /// configured for (Issue #31).+ ollama_base: String,comfy_port: u16,/// Configurable ComfyUI host — mirrors AppState.comfy_host so the mobile/// proxy forwards to the right machine when the user pointed LU at a@@ -655,9 +659,17 @@ async fn proxy_ollama(}let query = req.uri().query().map(|q| format!("?{}", q)).unwrap_or_default();- // NOTE: reqwest inside Tauri subprocess fails on "localhost" resolution- // (known proxy_localhost bug). Use 127.0.0.1 directly.- let target = format!("http://127.0.0.1:{}{}{}", state.ollama_port, path, query);+ // Route to the configured Ollama base URL. For the common localhost case+ // we rewrite "localhost" → "127.0.0.1" because reqwest inside the Tauri+ // subprocess fails on localhost resolution (known proxy_localhost bug).+ // Remote LAN/Docker hosts stay verbatim since they resolve via normal DNS.+ let base = state.ollama_base.trim_end_matches('/');+ let base_final = if base.contains("://localhost") {+ base.replace("://localhost", "://127.0.0.1")+ } else {+ base.to_string()+ };+ let target = format!("{}{}{}", base_final, path, query);proxy_to_target(&target, req).await}@@ -3312,7 +3324,7 @@ pub async fn start_remote_server(system_prompt: Option<String>,) -> Result<serde_json::Value, String> {// Clone Arcs from std::sync::Mutex, then drop it before any .await- let (jwt_secret_arc, passcode_arc, permissions_arc, devices_arc, tunnel_url_arc, dispatched_model_arc, dispatched_system_prompt_arc, port, comfy_port, comfy_host) = {+ let (jwt_secret_arc, passcode_arc, permissions_arc, devices_arc, tunnel_url_arc, dispatched_model_arc, dispatched_system_prompt_arc, port, comfy_port, comfy_host, ollama_base) = {let remote = state.remote.lock().map_err(|e| e.to_string())?;if remote.handle.is_some() {return Err("Remote server already running".into());@@ -3322,6 +3334,11 @@ pub async fn start_remote_server(// a missing comfy_port as a non-fatal "no comfy yet" (port 0).let comfy_port = state.comfy_port.lock().map(|g| *g).unwrap_or(0);let comfy_host = state.comfy_host.lock().map(|g| g.clone()).unwrap_or_else(|_| "localhost".to_string());+ // Issue #31: snapshot the current Ollama base URL so the mobile proxy+ // forwards to whatever the desktop currently targets.+ let ollama_base = state.ollama_base.lock()+ .map(|g| g.clone())+ .unwrap_or_else(|_| "http://localhost:11434".to_string());(remote.jwt_secret.clone(),@@ -3334,6 +3351,7 @@ pub async fn start_remote_server(remote.port,comfy_port,comfy_host,+ ollama_base,)}; // std::sync::MutexGuard dropped here@@ -3373,7 +3391,7 @@ pub async fn start_remote_server(let server_state = RemoteState {jwt_secret: jwt_secret_arc,passcode: passcode_arc,- ollama_port: 11434,+ ollama_base,comfy_port,comfy_host,permissions: permissions_arc,diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rsindex 3a2a8249..0994daaf 100644--- a/src-tauri/src/main.rs+++ b/src-tauri/src/main.rs@@ -30,6 +30,8 @@ fn main() {commands::process::set_comfyui_path,commands::process::set_comfyui_port,commands::process::set_comfyui_host,+ commands::process::set_ollama_host,+ commands::process::get_ollama_host,// Installationcommands::install::install_comfyui,commands::install::install_comfyui_status,diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rsindex 4340b3c2..42816744 100644--- a/src-tauri/src/state.rs+++ b/src-tauri/src/state.rs@@ -70,6 +70,54 @@ pub(crate) fn load_comfy_config_values() -> (u16, String) {(port, host)}+/// Read persisted Ollama base URL with the following priority:+/// 1. `ollama_base` in config.json (GUI-configured)+/// 2. `OLLAMA_HOST` env var (Ollama's own convention)+/// 3. Default `http://localhost:11434`+///+/// Accepts bare `host:port`, scheme-less `host`, or full URL — returns full+/// URL without trailing slash. Matches Ollama's own OLLAMA_HOST semantics so+/// setting it as an env var before launching LU "just works".+pub(crate) fn load_ollama_base() -> String {+ let normalize = |raw: &str| -> String {+ let trimmed = raw.trim().trim_end_matches('/');+ if trimmed.is_empty() {+ "http://localhost:11434".to_string()+ } else if trimmed.starts_with("http://") || trimmed.starts_with("https://") {+ trimmed.to_string()+ } else {+ format!("http://{}", trimmed)+ }+ };++ // Priority 1: config.json override (GUI takes precedence)+ if let Some(config_dir) = dirs::config_dir() {+ let config_file = config_dir.join("locally-uncensored").join("config.json");+ if let Ok(raw) = std::fs::read_to_string(&config_file) {+ if let Ok(v) = serde_json::from_str::<serde_json::Value>(&raw) {+ if let Some(b) = v.get("ollama_base").and_then(|x| x.as_str()) {+ let normalized = normalize(b);+ if !normalized.is_empty() {+ return normalized;+ }+ }+ }+ }+ }++ // Priority 2: OLLAMA_HOST env var — same semantics as Ollama itself.+ // Ollama docs explicitly document e.g. `OLLAMA_HOST=0.0.0.0:11434`.+ if let Ok(env) = std::env::var("OLLAMA_HOST") {+ let normalized = normalize(&env);+ if !normalized.is_empty() {+ return normalized;+ }+ }++ // Priority 3: default+ "http://localhost:11434".to_string()+}+pub struct AppState {pub comfy_process: Mutex<Option<Child>>,pub comfy_path: Mutex<Option<String>>,@@ -78,6 +126,12 @@ pub struct AppState {/// remote hostname/IP lets users point LU at a ComfyUI running on/// another machine (homelab, Docker, LAN). Persisted in config.json.pub comfy_host: Mutex<String>,+ /// Configurable Ollama base URL. Default `http://localhost:11434`.+ /// Seeded from (in priority order): config.json `ollama_base` field,+ /// `OLLAMA_HOST` env var, or the default. Updated at runtime via the+ /// `set_ollama_host` command. Every call that proxies Ollama reads this+ /// value so GUI changes reflect everywhere without a restart.+ pub ollama_base: Mutex<String>,pub whisper: Arc<Mutex<WhisperServer>>,pub downloads: Arc<Mutex<HashMap<String, DownloadProgress>>>,pub download_tokens: Arc<Mutex<HashMap<String, CancellationToken>>>,@@ -110,11 +164,21 @@ impl AppState {println!("[ComfyUI] Loaded persisted host: {}", initial_host);}+ // Same bootstrap for Ollama — reads config.json first, then+ // OLLAMA_HOST env var, then defaults. Fixes Issue #31 where users+ // with OLLAMA_HOST set globally (Docker, homelab, LAN) saw "No local+ // backend detected" even though ollama.exe was running.+ let initial_ollama_base = load_ollama_base();+ if initial_ollama_base != "http://localhost:11434" {+ println!("[Ollama] Using base URL: {}", initial_ollama_base);+ }+Self {comfy_process: Mutex::new(None),comfy_path: Mutex::new(None),comfy_port: Mutex::new(initial_port),comfy_host: Mutex::new(initial_host),+ ollama_base: Mutex::new(initial_ollama_base),whisper: Arc::new(Mutex::new(WhisperServer::new())),downloads: Arc::new(Mutex::new(HashMap::new())),download_tokens: Arc::new(Mutex::new(HashMap::new())),diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.jsonindex 832a6f94..f8a9d050 100644--- a/src-tauri/tauri.conf.json+++ b/src-tauri/tauri.conf.json@@ -1,7 +1,7 @@{"$schema": "https://raw.githubusercontent.com/tauri-apps/tauri/dev/crates/tauri-cli/schema.json","productName": "Locally Uncensored",- "version": "2.3.6",+ "version": "2.3.7","identifier": "com.purpledoubled.locally-uncensored","build": {"beforeBuildCommand": "npm run build",diff --git a/src/api/__tests__/backend-urls.test.ts b/src/api/__tests__/backend-urls.test.tsindex b958dc7c..2cce1ed7 100644--- a/src/api/__tests__/backend-urls.test.ts+++ b/src/api/__tests__/backend-urls.test.ts@@ -18,6 +18,10 @@ import {setComfyHost,getComfyHost,isComfyLocal,+ setOllamaBase,+ getOllamaBase,+ isOllamaLocal,+ normalizeOllamaBase,} from '../backend'describe('backend — URL helpers', () => {@@ -26,6 +30,7 @@ describe('backend — URL helpers', () => {delete windowMock.__TAURI_INTERNALS__setComfyPort(8188)setComfyHost('localhost')+ setOllamaBase('http://localhost:11434')})afterEach(() => {@@ -33,6 +38,7 @@ describe('backend — URL helpers', () => {delete windowMock.__TAURI_INTERNALS__setComfyPort(8188)setComfyHost('localhost')+ setOllamaBase('http://localhost:11434')})// ─── isTauri ───@@ -85,7 +91,7 @@ describe('backend — URL helpers', () => {expect(ollamaUrl('/tags')).toBe('/api/tags')})- it('returns full localhost URL in Tauri mode', () => {+ it('returns full localhost URL in Tauri mode by default', () => {windowMock.__TAURI__ = {}expect(ollamaUrl('/tags')).toBe('http://localhost:11434/api/tags')})@@ -104,6 +110,124 @@ describe('backend — URL helpers', () => {windowMock.__TAURI__ = {}expect(ollamaUrl('')).toBe('http://localhost:11434/api')})++ // Issue #31 — custom OLLAMA_HOST has to actually flow through.+ it('honours setOllamaBase when user points at a LAN Ollama (Tauri)', () => {+ windowMock.__TAURI__ = {}+ setOllamaBase('http://192.168.1.50:11434')+ expect(ollamaUrl('/tags')).toBe('http://192.168.1.50:11434/api/tags')+ expect(ollamaUrl('/chat')).toBe('http://192.168.1.50:11434/api/chat')+ })++ it('honours custom port from setOllamaBase', () => {+ windowMock.__TAURI__ = {}+ setOllamaBase('http://localhost:11435')+ expect(ollamaUrl('/tags')).toBe('http://localhost:11435/api/tags')+ })++ it('honours HTTPS base for remote Ollama', () => {+ windowMock.__TAURI__ = {}+ setOllamaBase('https://ollama.example.com')+ expect(ollamaUrl('/tags')).toBe('https://ollama.example.com/api/tags')+ })++ it('dev mode still routes through Vite proxy regardless of base', () => {+ delete windowMock.__TAURI__+ setOllamaBase('http://192.168.1.50:11434')+ // Vite proxy target comes from OLLAMA_HOST env var at server startup,+ // so the frontend path stays /api — proxy does the rewrite.+ expect(ollamaUrl('/tags')).toBe('/api/tags')+ })++ it('accepts bare host:port (no scheme) and adds http://', () => {+ windowMock.__TAURI__ = {}+ setOllamaBase('192.168.1.50:11434')+ expect(ollamaUrl('/tags')).toBe('http://192.168.1.50:11434/api/tags')+ })++ it('strips trailing slash from the base URL', () => {+ windowMock.__TAURI__ = {}+ setOllamaBase('http://localhost:11434/')+ expect(ollamaUrl('/tags')).toBe('http://localhost:11434/api/tags')+ })+ })++ // ─── setOllamaBase / getOllamaBase / normalizeOllamaBase ───++ describe('setOllamaBase / getOllamaBase / normalizeOllamaBase', () => {+ it('default base is http://localhost:11434', () => {+ setOllamaBase('http://localhost:11434')+ expect(getOllamaBase()).toBe('http://localhost:11434')+ })++ it('stores and retrieves LAN IP base', () => {+ setOllamaBase('http://192.168.1.50:11434')+ expect(getOllamaBase()).toBe('http://192.168.1.50:11434')+ })++ it('accepts bare host:port and adds scheme', () => {+ setOllamaBase('192.168.1.50:11434')+ expect(getOllamaBase()).toBe('http://192.168.1.50:11434')+ })++ it('accepts full HTTPS URL unchanged', () => {+ setOllamaBase('https://ollama.example.com')+ expect(getOllamaBase()).toBe('https://ollama.example.com')+ })++ it('strips trailing slash', () => {+ setOllamaBase('http://localhost:11434/')+ expect(getOllamaBase()).toBe('http://localhost:11434')+ })++ it('empty input falls back to default', () => {+ setOllamaBase('')+ expect(getOllamaBase()).toBe('http://localhost:11434')+ setOllamaBase(' ')+ expect(getOllamaBase()).toBe('http://localhost:11434')+ })++ it('normalizeOllamaBase is a pure function', () => {+ expect(normalizeOllamaBase('192.168.1.50:11434')).toBe('http://192.168.1.50:11434')+ expect(normalizeOllamaBase('http://foo:11434')).toBe('http://foo:11434')+ expect(normalizeOllamaBase('https://foo/')).toBe('https://foo')+ expect(normalizeOllamaBase('')).toBe('http://localhost:11434')+ expect(normalizeOllamaBase(' ')).toBe('http://localhost:11434')+ })+ })++ // ─── isOllamaLocal ───++ describe('isOllamaLocal', () => {+ it('returns true for localhost', () => {+ setOllamaBase('http://localhost:11434')+ expect(isOllamaLocal()).toBe(true)+ })++ it('returns true for 127.0.0.1', () => {+ setOllamaBase('http://127.0.0.1:11434')+ expect(isOllamaLocal()).toBe(true)+ })++ it('returns true for 0.0.0.0 (wildcard bind visible as bound IP)', () => {+ setOllamaBase('http://0.0.0.0:11434')+ expect(isOllamaLocal()).toBe(true)+ })++ it('returns false for LAN IP', () => {+ setOllamaBase('http://192.168.1.50:11434')+ expect(isOllamaLocal()).toBe(false)+ })++ it('returns false for remote hostname', () => {+ setOllamaBase('http://ollama.example.com')+ expect(isOllamaLocal()).toBe(false)+ })++ it('is case-insensitive', () => {+ setOllamaBase('http://LOCALHOST:11434')+ expect(isOllamaLocal()).toBe(true)+ })})// ─── comfyuiUrl ───diff --git a/src/api/__tests__/provider-ollama.test.ts b/src/api/__tests__/provider-ollama.test.tsindex 3334a892..50ab850b 100644--- a/src/api/__tests__/provider-ollama.test.ts+++ b/src/api/__tests__/provider-ollama.test.ts@@ -8,11 +8,14 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'import { ProviderError } from '../providers/types'import type { ProviderConfig } from '../providers/types'-// Mock the backend module — Ollama uses localFetch / localFetchStream instead of bare fetch+// Mock the backend module — Ollama uses localFetch / localFetchStream instead of bare fetch.+// Issue #31: apiUrl() now delegates to ollamaUrl() from backend.ts for a single+// source of truth. Mocked to the dev-mode `/api${path}` shape the tests expect.vi.mock('../backend', () => ({isTauri: () => false,localFetch: vi.fn(),localFetchStream: vi.fn(),+ ollamaUrl: (path: string) => `/api${path}`,}))import { OllamaProvider } from '../providers/ollama-provider'diff --git a/src/api/backend.ts b/src/api/backend.tsindex 0fd30db2..a3f2f47f 100644--- a/src/api/backend.ts+++ b/src/api/backend.ts@@ -160,6 +160,8 @@ export async function backendCall<T = any>(install_ollama_status: { path: "/local-api/install-ollama-status" },set_comfyui_port: { path: "/local-api/set-comfyui-port", method: "POST" },set_comfyui_host: { path: "/local-api/set-comfyui-host", method: "POST" },+ set_ollama_host: { path: "/local-api/set-ollama-host", method: "POST" },+ get_ollama_host: { path: "/local-api/get-ollama-host" },install_custom_node: { path: "/local-api/install-custom-node", method: "POST" },whisper_status: { path: "/local-api/transcribe-status" },transcribe: { path: "/local-api/transcribe", method: "POST" },@@ -249,10 +251,51 @@ export async function backendCall<T = any>(return res.json();}-/** Get the base URL for Ollama API calls */+/**+ * Configurable Ollama base URL. Default `http://localhost:11434`.+ * Can be set to any URL so users can point LU at a remote Ollama+ * (e.g. LAN machine, Docker container, cluster node). Supports the+ * OLLAMA_HOST env var on Tauri startup via the Rust side, and GUI-+ * configured endpoint via `set_ollama_host` — whichever comes last+ * wins, matching how other providers behave.+ *+ * Stored without trailing slash so `${_ollamaBase}/api${path}` never+ * produces a double slash.+ */+let _ollamaBase = 'http://localhost:11434';++/** Accepts bare host:port, scheme-less host, or full URL — returns full URL. */+export function normalizeOllamaBase(input: string): string {+ const raw = (input || '').trim()+ if (!raw) return 'http://localhost:11434'+ // Already has scheme?+ if (/^https?:\/\//i.test(raw)) return raw.replace(/\/+$/, '')+ // Bare "host:port" or "host" — add http://+ return `http://${raw.replace(/\/+$/, '')}`+}++export function setOllamaBase(input: string) {+ _ollamaBase = normalizeOllamaBase(input)+}+export function getOllamaBase(): string { return _ollamaBase }++export function isOllamaLocal(): boolean {+ try {+ const h = new URL(_ollamaBase).hostname.toLowerCase()+ return h === 'localhost' || h === '127.0.0.1' || h === '::1' || h === '0.0.0.0'+ } catch {+ return true+ }+}++/** Get the base URL for Ollama API calls.+ * - Tauri: `${_ollamaBase}/api${path}` — honors GUI + env var.+ * - Dev: `/api${path}` — Vite proxy target is set from OLLAMA_HOST env var+ * at dev-server startup time.+ */export function ollamaUrl(path: string): string {if (isTauri()) {- return `http://localhost:11434/api${path}`;+ return `${_ollamaBase}/api${path}`;}return `/api${path}`;}diff --git a/src/api/providers/ollama-provider.ts b/src/api/providers/ollama-provider.tsindex 812a34ff..2662d1d7 100644--- a/src/api/providers/ollama-provider.ts+++ b/src/api/providers/ollama-provider.ts@@ -10,7 +10,7 @@ import type {ChatStreamChunk, ToolCall, ToolDefinition,} from './types'import { ProviderError } from './types'-import { isTauri, localFetch, localFetchStream } from '../backend'+import { localFetch, localFetchStream, ollamaUrl } from '../backend'import { parseNDJSONStream } from '../stream'import { repairToolCallArgs, extractToolCallsFromContent } from '../../lib/tool-call-repair'@@ -44,14 +44,20 @@ export class OllamaProvider implements ProviderClient {constructor(private config: ProviderConfig) {}- /** Build a full Ollama API URL from config.baseUrl + path */+ /**+ * Build a full Ollama API URL. Delegates to `ollamaUrl()` from backend.ts+ * so Tauri-mode (direct URL honoring `_ollamaBase`) and dev-mode+ * (`/api/*` → Vite proxy with OLLAMA_HOST target) stay in sync with the+ * rest of the app.+ *+ * Issue #31 fix: previously this function used `config.baseUrl` in Tauri+ * mode only, and in dev mode always forwarded to the Vite proxy which+ * itself was hardcoded to localhost:11434 — so a user-configured remote+ * Ollama never actually got called. Both modes now go through the single+ * ollamaUrl() resolver.+ */private apiUrl(path: string): string {- const base = this.config.baseUrl || 'http://localhost:11434'- if (isTauri()) {- return `${base}/api${path}`- }- // Dev mode: proxy through Vite — use /api path- return `/api${path}`+ return ollamaUrl(path)}async *chatStream(diff --git a/src/components/layout/AppShell.tsx b/src/components/layout/AppShell.tsxindex c22a775c..909b5106 100644--- a/src/components/layout/AppShell.tsx+++ b/src/components/layout/AppShell.tsx@@ -167,6 +167,104 @@ export function AppShell() {document.documentElement.classList.toggle('light', settings.theme === 'light')}, [settings.theme])+ // ── Issue #31: Ollama host sync (Rust ↔ frontend) ─────────────+ // Two async prereqs to serialize against:+ // (a) Tauri v2 `__TAURI_INTERNALS__` is set async via `withGlobalTauri`.+ // (b) Zustand `persist` middleware hydrates `lu-providers` async — if we+ // push Rust's value into the store BEFORE hydration finishes,+ // hydration replays the stale localStorage baseUrl and clobbers us.+ //+ // The deliberate order:+ // 1. Wait for the Tauri global via the same 100ms × 50-tick poll the+ // backup triad uses (v2.3.3 commit 835ce86).+ // 2. Use zustand's own `onFinishHydration` callback for ordering against+ // hydration — more reliable than polling `hasHydrated()` because it+ // fires deterministically AFTER the replay, not whenever we happen+ // to check.+ // 3. Fetch Rust's resolved base (config.json > OLLAMA_HOST > default)+ // and push it into both the providerStore and backend.ts, regardless+ // of what hydration just wrote — Rust wins at cold start.+ // 4. Arm a zustand subscribe listener for future GUI edits so+ // `set_ollama_host` keeps Rust's config.json authoritative.+ useEffect(() => {+ let cancelled = false+ let tries = 0+ let storeUnsub: (() => void) | null = null+ let hydrationUnsub: (() => void) | null = null++ const armSubscription = () => {+ storeUnsub = useProviderStore.subscribe(async (state, prev) => {+ const next = state.providers.ollama?.baseUrl+ const old = prev.providers.ollama?.baseUrl+ if (!next || next === old || cancelled) return+ const { setOllamaBase } = await import('../../api/backend')+ setOllamaBase(next)+ if (isTauri()) {+ backendCall('set_ollama_host', { host: next }).catch(() => {})+ }+ })+ }++ const pullAndArm = async () => {+ if (cancelled) return+ const { setOllamaBase } = await import('../../api/backend')++ // Arm the store subscription FIRST, so that the setProviderConfig+ // below fires its listener (which writes back to Rust via+ // `set_ollama_host`). If we armed after, the initial sync would not+ // reach config.json and users with OLLAMA_HOST would see an empty+ // `ollama_base` field there.+ if (!cancelled) armSubscription()++ try {+ const res = await backendCall<{ base?: string }>('get_ollama_host')+ if (!cancelled && res?.base) {+ setOllamaBase(res.base)+ const current = useProviderStore.getState().providers.ollama?.baseUrl+ if (current !== res.base) {+ useProviderStore.getState().setProviderConfig('ollama', { baseUrl: res.base })+ }+ }+ } catch { /* Rust not ready — providerStore wins, subscription handles later edits */ }++ const current = useProviderStore.getState().providers.ollama?.baseUrl+ if (!cancelled && current) setOllamaBase(current)+ }++ const afterHydration = () => {+ // Either hydration already finished (so we run now) or we register a+ // one-shot callback for when it does.+ const persist = (useProviderStore as any).persist+ if (!persist || persist.hasHydrated?.()) {+ void pullAndArm()+ } else {+ hydrationUnsub = persist.onFinishHydration?.(() => { void pullAndArm() }) ?? null+ }+ }++ const waitForTauri = setInterval(() => {+ if (cancelled) { clearInterval(waitForTauri); return }+ tries+++ if (isTauri()) {+ clearInterval(waitForTauri)+ afterHydration()+ } else if (tries >= 50) {+ // 5 s elapsed — probably browser dev session. Still wire the store+ // subscription so user edits reach Rust if Tauri appears later.+ clearInterval(waitForTauri)+ armSubscription()+ }+ }, 100)++ return () => {+ cancelled = true+ clearInterval(waitForTauri)+ if (storeUnsub) storeUnsub()+ if (hydrationUnsub) hydrationUnsub()+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [])+// ── Mirror remote mobile chat into the dispatched desktop conversation ──useEffect(() => {if (!isTauri()) returndiff --git a/vite.config.ts b/vite.config.tsindex f6fb89b6..fabfe247 100644--- a/vite.config.ts+++ b/vite.config.ts@@ -1877,7 +1877,15 @@ export default defineConfig({allowedHosts: true,proxy: {'/api': {- target: 'http://localhost:11434',+ // Issue #31: honour OLLAMA_HOST so `OLLAMA_HOST=0.0.0.0:11434 npm run dev`+ // and remote Ollama setups (Docker, LAN, homelab) just work in dev mode+ // too. Accept bare `host:port`, scheme-less host, or full URL.+ target: (() => {+ const raw = (process.env.OLLAMA_HOST || '').trim()+ if (!raw) return 'http://localhost:11434'+ if (/^https?:\/\//i.test(raw)) return raw.replace(/\/+$/, '')+ return `http://${raw.replace(/\/+$/, '')}`+ })(),changeOrigin: true,},'/ollama-search': {