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
fix: Backend Selector modal no longer spams every 5-10s
PurpleDoubleDfb583387f87d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 26d3b1fd..a3e608c7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,7 @@ All notable changes to Locally Uncensored are documented here.- (2) `src/hooks/useCreate.ts:fetchModels` only cleared the persisted image/video model names when ComfyUI returned a non-empty list. With 0 models, the stale strings stayed alive forever. Now fetchModels explicitly `state.setImageModel('', 'unknown')` + `state.setVideoModel('')` when the corresponding list is empty after the startup-race retries expire.- (3) `src/components/create/CreateView.tsx` renders a dedicated empty-state card when `connected === true && modelsLoaded && currentModeModels.length === 0`. The card shows `PackageOpen` icon + "No {image|video} models installed" + a **Go to Model Manager** primary button (calls `useUIStore.getState().setView('models')`) + a **Refresh list** secondary action (calls `fetchModels()`). `OutputDisplay` / `PromptInput` / `ParamPanel` / I2V + I2I uploads / preflight banners all suppress during the empty state so no downstream code can hit the old crash path. The Mode switcher (Image / Video) stays so the user can switch sides and get a matching empty-state.+- **Backend Selector modal no longer spams on repeat** — users with multiple local backends (Ollama + LM Studio, Ollama + vLLM, etc) reported on Discord that the "N local backends detected" modal kept re-appearing every 5-10 seconds, regardless of whether they clicked Skip or Use selected. The pre-existing `sessionStorage` guard wasn't enough in the face of WebView2 reloads (which the backup-restore triad can trigger) or cache evictions. Fix: (1) added a persistent `hideBackendSelector` flag in `providerStore` so the user's opt-out survives reloads; (2) the modal now has a pre-checked "Don't show this again" tickbox; (3) a permanent explanatory line "You can add, remove, or switch backends anytime in **Settings → Providers**" (with the link clickable — it navigates you there); (4) dismissing the modal with the tickbox checked persists the opt-out. Users who want the modal back at some point can uncheck the box before dismissing.- **LU always starts in the Chat sidebar tab, not Code** — on a fresh install or an NSIS update, the left-sidebar tab (Chat / Code / Remote) could land on Code because `codexStore`'s persist middleware saved `chatMode` between sessions. Newcomers clicking around Code without any conversations got an empty screen. `codexStore` now excludes `chatMode` from `partialize` so the default (`'lu'`) is used on every fresh boot. If a user wants to stay in Codex or Claude Code mid-session, they pick it from the sidebar each time; `workingDirectory` still persists so Codex remembers the last project path.- Tiny grammar fix in the Create empty-state copy: "Install **an image** model" / "Install **a video** model" (was "Install a image model" in both branches).diff --git a/README.md b/README.mdindex 5defd06b..7351f3ac 100644--- a/README.md+++ b/README.md@@ -44,6 +44,7 @@ Drop-in patch on top of v2.3.8.### What's fixed- **Create view: clean empty-state instead of a crash when no models are installed** — if you opened Create before downloading any ComfyUI model, the Create tab could go from unresponsive to a hard shutdown ("program disappears and a duplicate reopens"). Surfaced on Discord by @figuringitallout on a fresh Windows install. Root causes, both fixed: (1) `classifyModel()` was called with stale persisted model names that no longer existed on disk, (2) the main content area kept rendering `OutputDisplay` / `PromptInput` / `ParamPanel` against an empty model list. Create now detects this state and renders a calm empty-state card with a primary **Go to Model Manager** CTA and a **Refresh list** secondary action. Mode switcher stays available. Stale persisted image/video model names are proactively cleared by `useCreate.fetchModels` when ComfyUI reports 0 models in that category.- **App always starts in the Chat tab on boot, not Code** — `codexStore` used to persist `chatMode` between sessions, so users who happened to end their last session in Codex / Claude Code would re-open the app inside an empty coding panel instead of the Chat homepage. Newcomers in particular landed in Code without any visible conversations and thought the app was broken. Fixed by excluding `chatMode` from the persisted slice — default `'lu'` (Chat) is used on every fresh boot; pick Code or Remote from the sidebar each session when you want them.+- **Backend Selector modal no longer reopens every 5-10 seconds** — users with multiple local backends (Ollama + LM Studio, Ollama + vLLM, etc) reported on Discord that the "N local backends detected" modal kept re-appearing no matter how often they dismissed it. Fix: a persistent `hideBackendSelector` flag in `providerStore`, a pre-checked "Don't show this again" tickbox in the modal, and a permanent pointer to **Settings → Providers** (clickable — it navigates you there) so users know where to manage providers going forward.- **`classifyModel(name)` is null-safe** — defensive guard returns `unknown` if called with `null`, `undefined`, or non-string, so any path that reaches the classifier with a stale or missing model name degrades gracefully.- **CONTRIBUTING.md dev workflow documented** — `npm run tauri:dev` / `npm run tauri:build` / `npm run dev` are now spelled out with the trade-off between them. Reported in Discord by @k-wilkinson (sourceodin) — thanks.diff --git a/src/components/layout/AppShell.tsx b/src/components/layout/AppShell.tsxindex 909b5106..c3d761ec 100644--- a/src/components/layout/AppShell.tsx+++ b/src/components/layout/AppShell.tsx@@ -413,6 +413,12 @@ export function AppShell() {// Single backend → we're done (already enabled above, or was Ollama).if (backends.length === 1) return+ // User previously opted out of the selector (tickbox "don't show again")+ // → never re-show. They manage providers via Settings → Providers.+ // This is the persistent guard; the sessionStorage check above is just+ // the within-session guard.+ if (useProviderStore.getState().hideBackendSelector) return+// Multiple backends detected → show selection dialog so the user can// change which one is the primary openai-compat provider if they want.setDetectedBackends(backends)diff --git a/src/components/layout/__tests__/AppShell-backend-autoenable.test.ts b/src/components/layout/__tests__/AppShell-backend-autoenable.test.tsindex 9e50f04a..48b497f9 100644--- a/src/components/layout/__tests__/AppShell-backend-autoenable.test.ts+++ b/src/components/layout/__tests__/AppShell-backend-autoenable.test.ts@@ -57,4 +57,16 @@ describe('AppShell multi-backend auto-enable', () => {// refactor accidentally trying to auto-enable with an empty list.expect(src).toContain('if (backends.length === 0) return')})++ // v2.3.9 — Discord-reported: "popup comes back every 5-10 seconds".+ // The sessionStorage guard was not enough in some conditions (WebView2 reload+ // via the backup-restore triad, browser cache eviction, etc). We now also+ // gate on a persisted flag so existing users who clicked "Don't show again"+ // stop seeing the modal for good.+ it('persistently gates the selector on hideBackendSelector', () => {+ // The guard must live inside the multi-backend branch (i.e. after the+ // length === 1 early-return) so single-backend users still see nothing.+ expect(src).toMatch(/hideBackendSelector/)+ expect(src).toMatch(/if \(useProviderStore\.getState\(\)\.hideBackendSelector\) return/)+ })})diff --git a/src/components/onboarding/BackendSelector.tsx b/src/components/onboarding/BackendSelector.tsxindex 72296c4c..949d9fde 100644--- a/src/components/onboarding/BackendSelector.tsx+++ b/src/components/onboarding/BackendSelector.tsx@@ -1,13 +1,17 @@/*** Backend Selection Dialog*- * Shown on startup when multiple local backends are detected.- * User picks one as the primary backend. All backends treated equally.+ * Shown ONCE per install when multiple local backends are detected.+ * User picks one as the primary backend + acknowledges the "don't show this+ * again" tickbox (pre-checked). Dismissing ALWAYS persists the opt-out so the+ * modal never re-appears mid-session or after a restart. Users manage providers+ * from Settings → Providers going forward.*/import { useState } from 'react'import { Modal } from '../ui/Modal'import { useProviderStore } from '../../stores/providerStore'+import { useUIStore } from '../../stores/uiStore'import { PROVIDER_PRESETS } from '../../api/providers/types'import type { DetectedBackend } from '../../lib/backend-detector'@@ -19,14 +23,25 @@ interface Props {export function BackendSelector({ open, backends, onClose }: Props) {const [selected, setSelected] = useState<string>(backends[0]?.id || '')- const { setProviderConfig } = useProviderStore()+ // Pre-checked: the common case is "saw it once, don't bug me again". User can+ // uncheck if they want it to re-appear on next launch.+ const [dontShowAgain, setDontShowAgain] = useState(true)+ const { setProviderConfig, setHideBackendSelector } = useProviderStore()++ const dismiss = () => {+ // Persist the user's choice on EVERY dismissal (Skip, Use selected, X).+ // Even if the tickbox was unchecked we still hide for this session via the+ // AppShell sessionStorage guard; persistent opt-out only fires when checked.+ if (dontShowAgain) setHideBackendSelector(true)+ onClose()+ }const handleConfirm = () => {const backend = backends.find(b => b.id === selected)- if (!backend) { onClose(); return }+ if (!backend) { dismiss(); return }const preset = PROVIDER_PRESETS.find(p => p.id === backend.id)- if (!preset) { onClose(); return }+ if (!preset) { dismiss(); return }if (preset.providerId === 'ollama') {// Ollama uses its own provider, already enabled by default@@ -39,11 +54,16 @@ export function BackendSelector({ open, backends, onClose }: Props) {})}- onClose()+ dismiss()+ }++ const openSettings = () => {+ useUIStore.getState().setView('settings')+ dismiss()}return (- <Modal open={open} onClose={onClose} title="">+ <Modal open={open} onClose={dismiss} title=""><div className="space-y-4"><h3 className="text-base font-semibold text-white text-center">{backends.length} local backend{backends.length > 1 ? 's' : ''} detected@@ -51,7 +71,7 @@ export function BackendSelector({ open, backends, onClose }: Props) {<p className="text-[0.75rem] text-gray-400 text-center leading-relaxed">{backends.length === 1? `${backends[0].name} is running on your system.`- : 'Multiple backends running. Select your primary backend. You can add more in Settings.'}+ : 'Multiple backends running. Select your primary backend.'}</p><div className="space-y-1">@@ -76,9 +96,30 @@ export function BackendSelector({ open, backends, onClose }: Props) {))}</div>+ <p className="text-[0.65rem] text-gray-500 text-center leading-relaxed">+ You can add, remove, or switch backends anytime in{' '}+ <button+ onClick={openSettings}+ className="text-gray-300 hover:text-white underline underline-offset-2 transition-colors"+ >+ Settings → Providers+ </button>+ .+ </p>++ <label className="flex items-center justify-center gap-2 text-[0.65rem] text-gray-400 cursor-pointer select-none pt-1">+ <input+ type="checkbox"+ checked={dontShowAgain}+ onChange={(e) => setDontShowAgain(e.target.checked)}+ className="w-3 h-3 rounded border-white/20 bg-white/5 text-white focus:ring-0 focus:ring-offset-0 cursor-pointer"+ />+ Don't show this again+ </label>+<div className="flex items-center justify-center gap-3 pt-1"><button- onClick={onClose}+ onClick={dismiss}className="px-4 py-1.5 rounded-lg text-[0.7rem] text-gray-400 hover:text-white hover:bg-white/10 transition-colors">Skipdiff --git a/src/stores/providerStore.ts b/src/stores/providerStore.tsindex 499a814a..40935d22 100644--- a/src/stores/providerStore.ts+++ b/src/stores/providerStore.ts@@ -66,12 +66,17 @@ const DEFAULT_PROVIDERS: Record<ProviderId, ProviderConfig> = {interface ProviderState {providers: Record<ProviderId, ProviderConfig>+ /** Persisted: user opted out of the multi-backend selector modal. When true,+ * AppShell never re-shows the modal on startup even if multiple backends are+ * running. User can still add / remove providers via Settings → Providers. */+ hideBackendSelector: booleansetProviderConfig: (id: ProviderId, updates: Partial<ProviderConfig>) => voidsetProviderApiKey: (id: ProviderId, key: string) => voidgetProviderApiKey: (id: ProviderId) => stringgetEnabledProviders: () => ProviderConfig[]resetProvider: (id: ProviderId) => void+ setHideBackendSelector: (hide: boolean) => void}// ── Zustand Store ──────────────────────────────────────────────@@ -80,6 +85,9 @@ export const useProviderStore = create<ProviderState>()(persist((set, get) => ({providers: DEFAULT_PROVIDERS,+ hideBackendSelector: false,++ setHideBackendSelector: (hide) => set({ hideBackendSelector: hide }),setProviderConfig: (id, updates) => {set((state) => ({@@ -128,8 +136,11 @@ export const useProviderStore = create<ProviderState>()({name: 'lu-providers',version: 1,- // Don't persist transient state, only configs- partialize: (state) => ({ providers: state.providers }),+ // Don't persist transient state, only configs + user's "don't show again" preference+ partialize: (state) => ({+ providers: state.providers,+ hideBackendSelector: state.hideBackendSelector,+ }),}))