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(settings): ein abgeschalteter Anbieter behaelt seine Karte und einen Enable-Knopf
purple749fc31ef8d1
diff --git a/src/api/providers/types.ts b/src/api/providers/types.tsindex 62af8a5a..cd7dcd5b 100644--- a/src/api/providers/types.ts+++ b/src/api/providers/types.ts@@ -22,6 +22,13 @@ export interface ProviderConfig {// (the Tauri command), not `/v1/models`. Undefined = a normal user-configured// backend, unchanged behavior.managed?: boolean+ // Set when the user switched this provider off with the Disable button in+ // Settings, AI Backends, and cleared when Enable puts it back. The list keeps+ // such a row visible (greyed, with Enable) instead of dropping it, so the+ // control that turns a backend off is not also the control that hides the way+ // back (Nebenbefund 1, R9 re-measure 2026-08-30). Undefined = a slot nobody+ // has touched here; it stays out of the list as before.+ disabledByUser?: boolean}// ── Provider Presets (auto-fill URL) ───────────────────────────diff --git a/src/components/models/ModelSelector.tsx b/src/components/models/ModelSelector.tsxindex 66f58efb..3157c66b 100644--- a/src/components/models/ModelSelector.tsx+++ b/src/components/models/ModelSelector.tsx@@ -1,6 +1,6 @@import { useState, useRef, useEffect } from 'react'import { motion, AnimatePresence } from 'framer-motion'-import { Ban, ChevronDown, Loader2, Power, PlayCircle, Wrench, X, Cloud } from 'lucide-react'+import { Ban, ChevronDown, Loader2, Power, PlayCircle, Settings as SettingsIcon, Wrench, X, Cloud } from 'lucide-react'import { useModels } from '../../hooks/useModels'import { useModelStore } from '../../stores/modelStore'import { useProviderStore } from '../../stores/providerStore'@@ -16,6 +16,7 @@ import { listLoadedLmStudioModels, loadLmStudioModel, unloadLmStudioModel } fromimport { isLmStudioProvider } from '../../lib/hf-to-provider'import { lmStudioSlotUpdate, adoptionReplacesBuiltinEngine } from '../../lib/lmstudio-backend-adopt'import { nextProbeDelayMs } from '../../lib/probe-backoff'+import { noChatBackendEnabled } from '../../lib/provider-visibility'import type { AIModel } from '../../types/models'// ── Local-mode cloud discovery (2.5.8): an "LU Cloud" section at the list's@@ -476,6 +477,11 @@ export function ModelSelector({ openUpward = false, surface = 'chat' }: ModelSel// Deliberate, but the picker never SAID so, and the silence reads as "my// local models are gone" (it cost a whole repro round on 2026-08-07).const appMode = useSettingsStore((s) => s.settings.appMode)+ // Whether the empty list is empty because nothing is switched on at all.+ // That has a different answer from "the engine did not start", and it has a+ // button (Nebenbefund 1, R9 re-measure 2026-08-30).+ const noBackendEnabled = useProviderStore((s) => noChatBackendEnabled(s.providers, appMode))+ const openSettingsAt = useUIStore((s) => s.openSettingsAt)const [open, setOpen] = useState(false)// Read by the empty-state probe below, which runs before the render that// computes textModels. A ref keeps it out of the effect's dependency list.@@ -850,7 +856,23 @@ export function ModelSelector({ openUpward = false, surface = 'chat' }: ModelSel{textModels.length === 0 && (<div className="px-2.5 py-3 text-center"><p className="text-[0.65rem] text-gray-600">No models available</p>- {emptyReason && (+ {/* An empty picker after the user switched the last backend+ off in Settings used to say only that, which reads like a+ machine with nothing installed (Nebenbefund 1, R9+ re-measure). The reason and the way back belong here. */}+ {noBackendEnabled ? (+ <>+ <p className="mt-1 text-[0.6rem] text-amber-300/90 leading-snug text-left">+ No AI backend is enabled, so there is nothing to list. Open Settings, go to AI Backends, and press Enable on the backend you switched off, or Add Provider.+ </p>+ <button+ onClick={() => { setOpen(false); openSettingsAt({ tab: 'backends' }) }}+ className="mt-2 inline-flex items-center gap-1 px-2 py-1 rounded bg-white/5 border border-white/10 text-[0.6rem] text-gray-300 hover:bg-white/10 transition-colors"+ >+ <SettingsIcon size={10} /> Open Settings+ </button>+ </>+ ) : emptyReason && (<p className="mt-1 text-[0.6rem] text-amber-300/90 leading-snug text-left">{emptyReason}</p>)}</div>diff --git a/src/components/settings/ProviderConfig.tsx b/src/components/settings/ProviderConfig.tsxindex 6c037941..1875db3a 100644--- a/src/components/settings/ProviderConfig.tsx+++ b/src/components/settings/ProviderConfig.tsx@@ -1,6 +1,7 @@import { useState, useEffect } from 'react'import { Wifi, WifiOff, Loader2, Eye, EyeOff, ChevronDown, Plus, Power, Play } from 'lucide-react'import { useProviderStore } from '../../stores/providerStore'+import { providerRowIds, isReturnableRow } from '../../lib/provider-visibility'import { useMemoryStore } from '../../stores/memoryStore'import { getProvider } from '../../api/providers'import { PROVIDER_PRESETS } from '../../api/providers/types'@@ -149,6 +150,11 @@ export function ProviderSettings() {// Get all enabled providersconst enabledProviderIds = (Object.keys(providers) as ProviderId[]).filter(id => providers[id].enabled)+ // The rows the list draws: everything enabled, PLUS everything the user+ // switched off right here. Disabling used to delete the card, and with it the+ // only control that could bring the provider back (Nebenbefund 1, R9+ // re-measure). A switched-off row stays, greyed, with Enable on it.+ const rowIds = providerRowIds(providers) as ProviderId[]// Add a preset (enable a provider without disabling others)function selectPreset(preset: typeof PROVIDER_PRESETS[0]) {@@ -177,10 +183,14 @@ export function ProviderSettings() {setExpandedProvider(preset.providerId)}- // Toggle a provider on/off independently+ // Toggle a provider on/off independently. The off state is marked as the+ // user's own doing so the row survives it and can offer Enable; turning it+ // back on clears the mark, and the row is a normal row again.function toggleProvider(id: ProviderId) {- setProviderConfig(id, { enabled: !providers[id].enabled })+ const nextEnabled = !providers[id].enabled+ setProviderConfig(id, { enabled: nextEnabled, disabledByUser: !nextEnabled })setStatuses(prev => ({ ...prev, [id]: 'idle' }))+ if (nextEnabled) setExpandedProvider(id)}const handleTest = async (providerId: ProviderId) => {@@ -258,10 +268,43 @@ export function ProviderSettings() {return (<div className="space-y-2">- {/* Active Providers List */}- {enabledProviderIds.map(id => {+ {/* Providers List — enabled rows, plus the ones the user switched off */}+ {rowIds.map(id => {const config = providers[id]const view = providerSlotView(id, config)++ // Switched off by the user: the row stays and carries the way back.+ // Nothing to test and nothing to configure while it is off, so the row+ // is one line and one button.+ if (isReturnableRow(config)) {+ return (+ <div key={id} className="rounded-lg border border-white/8 bg-white/[0.01] overflow-hidden">+ <div className="flex items-center gap-2 px-2 py-1.5">+ <button+ onClick={() => toggleProvider(id)}+ className="group flex items-center"+ title="Enable provider"+ >+ <Power size={10} className="text-gray-500 group-hover:text-green-400 transition-colors" />+ </button>+ <div className="flex-1 flex items-center gap-2 min-w-0">+ <span className="w-1.5 h-1.5 rounded-full shrink-0 bg-gray-600" />+ <span className="text-[0.65rem] text-gray-500 font-medium truncate">{view.label}</span>+ <span className="text-[0.5rem] px-1 py-0.5 rounded bg-white/5 text-gray-500 shrink-0">DISABLED</span>+ </div>+ <button+ onClick={() => toggleProvider(id)}+ className="shrink-0 px-2 py-0.5 rounded bg-green-500/10 border border-green-500/20 text-[0.6rem] text-green-300 hover:text-green-200 hover:bg-green-500/15 transition-colors"+ >+ Enable+ </button>+ </div>+ <p className="px-2 pb-1.5 text-[0.55rem] text-gray-600 leading-snug">+ Switched off, so its models are not offered in the chat model picker. Press Enable to use it again.+ </p>+ </div>+ )+ }const needsKey = view.needsKeyconst currentKey = getProviderApiKey(id)const status = statuses[id] || 'idle'@@ -428,9 +471,15 @@ export function ProviderSettings() {)})}- {/* No backend warning */}+ {/* No backend warning. With a switched-off row on screen the honest+ sentence names that row first, because pressing Enable on it is the+ shorter way back than adding a provider again. */}{noBackend && (- <p className="text-[0.6rem] text-red-400">No backend configured. Add one below to start chatting.</p>+ <p className="text-[0.6rem] text-red-400">+ {rowIds.length > 0+ ? 'No backend is enabled. Press Enable on one above, or add one below, to start chatting.'+ : 'No backend configured. Add one below to start chatting.'}+ </p>)}{/* Add Provider Dropdown */}diff --git a/src/lib/__tests__/provider-disable-return-path.test.ts b/src/lib/__tests__/provider-disable-return-path.test.tsnew file mode 100644index 00000000..3624e1a1--- /dev/null+++ b/src/lib/__tests__/provider-disable-return-path.test.ts@@ -0,0 +1,142 @@+/**+ * Nebenbefund 1 of the R9 re-measure on the real 2.6.7 Windows build+ * (2026-08-30, ergebnis-r9-nachmessung.md).+ *+ * The measured frame: Settings, AI Backends, the LM Studio card, the red+ * "Disable" button. After the click the card was gone from the list, the only+ * row left was LU Cloud, `activeModel` was null, and the chat model picker+ * said "No models available" with nothing on it to press. The list rendered+ * enabled providers only, so the control that switched a backend off also+ * removed the control that could switch it back on. Ollama sits in the same+ * list and had the same behaviour.+ *+ * The rule under test: a provider the user switched off HERE keeps its row and+ * carries an Enable button, while a slot nobody has touched (fresh Ollama and+ * Anthropic, and the built-in engine after onboarding hands the slot to+ * Ollama) stays out of the list as before.+ *+ * Run: npx vitest run src/lib/__tests__/provider-disable-return-path.test.ts+ */+import { describe, it, expect } from 'vitest'+import { readFileSync } from 'node:fs'+import { fileURLToPath } from 'node:url'+import { dirname, resolve } from 'node:path'++import {+ providerRowIds,+ isReturnableRow,+ noChatBackendEnabled,+} from '../provider-visibility'++const here = dirname(fileURLToPath(import.meta.url))+const repo = resolve(here, '../../..')+const read = (rel: string) => readFileSync(resolve(repo, rel), 'utf8')++const providerPane = read('src/components/settings/ProviderConfig.tsx')+const modelSelector = read('src/components/models/ModelSelector.tsx')++/** The exact shape the re-measure left behind: LM Studio on the openai slot,+ * disabled by its own Disable button, LU Cloud the only thing still on. */+const AFTER_DISABLE = {+ ollama: { enabled: false },+ openai: { enabled: false, disabledByUser: true },+ anthropic: { enabled: false },+ 'lu-cloud': { enabled: true },+}++describe('THE FIX: a provider the user switched off keeps its row', () => {+ it('the disabled LM Studio slot is still a row', () => {+ expect(providerRowIds(AFTER_DISABLE)).toContain('openai')+ })++ it('and that row is the one that offers the way back', () => {+ expect(isReturnableRow(AFTER_DISABLE.openai)).toBe(true)+ })++ it('Ollama, the other card with the same Disable button, behaves the same', () => {+ const offOllama = { ...AFTER_DISABLE, ollama: { enabled: false, disabledByUser: true } }+ expect(providerRowIds(offOllama)).toContain('ollama')+ expect(isReturnableRow(offOllama.ollama)).toBe(true)+ })++ it('enabling it again clears the mark, so it is a normal row', () => {+ const backOn = { enabled: true, disabledByUser: false }+ expect(isReturnableRow(backOn)).toBe(false)+ expect(providerRowIds({ openai: backOn })).toEqual(['openai'])+ })+})++describe('NEGATIVE CONTROL: slots nobody switched off stay out of the list', () => {+ it('a fresh install lists the built-in engine only', () => {+ const fresh = {+ ollama: { enabled: false },+ openai: { enabled: true },+ anthropic: { enabled: false },+ 'lu-cloud': { enabled: false },+ }+ expect(providerRowIds(fresh)).toEqual(['openai'])+ })++ it('onboarding handing the slot to Ollama does not leave a disabled card behind', () => {+ // Onboarding.tsx: picking Ollama writes openai { enabled: false } without+ // the user ever pressing Disable, so no Enable row is owed.+ const afterOnboarding = {+ ollama: { enabled: true },+ openai: { enabled: false },+ anthropic: { enabled: false },+ 'lu-cloud': { enabled: false },+ }+ expect(providerRowIds(afterOnboarding)).toEqual(['ollama'])+ expect(isReturnableRow(afterOnboarding.openai)).toBe(false)+ })+})++describe('the picker says WHY it is empty, per mode', () => {+ it('after the disable, local mode has no backend it can list', () => {+ expect(noChatBackendEnabled(AFTER_DISABLE, 'local')).toBe(true)+ })++ it('NEGATIVE CONTROL: the same state in cloud mode has one, LU Cloud', () => {+ expect(noChatBackendEnabled(AFTER_DISABLE, 'cloud')).toBe(false)+ })++ it('NEGATIVE CONTROL: a running local backend is not reported as missing', () => {+ const withEngine = { ...AFTER_DISABLE, openai: { enabled: true } }+ expect(noChatBackendEnabled(withEngine, 'local')).toBe(false)+ })++ it('NEGATIVE CONTROL: local-only backends do not count in cloud mode', () => {+ const localOnly = {+ ollama: { enabled: true },+ openai: { enabled: true },+ 'lu-cloud': { enabled: false },+ }+ expect(noChatBackendEnabled(localOnly, 'cloud')).toBe(true)+ })+})++describe('the wiring, so the rule reaches the screen', () => {+ it('the providers pane draws the rule, not the enabled-only filter', () => {+ expect(providerPane).toMatch(/rowIds = providerRowIds\(providers\)/)+ expect(providerPane).toMatch(/\{rowIds\.map\(id => \{/)+ })++ it('the switched-off row carries an Enable button', () => {+ expect(providerPane).toMatch(/if \(isReturnableRow\(config\)\)/)+ expect(providerPane).toMatch(/>\s*Enable\s*<\/button>/)+ expect(providerPane).toMatch(/DISABLED<\/span>/)+ })++ it('Disable marks the off state as the user`s own, Enable clears it', () => {+ expect(providerPane).toMatch(+ /setProviderConfig\(id, \{ enabled: nextEnabled, disabledByUser: !nextEnabled \}\)/,+ )+ })++ it('the picker names the reason and gives a button to Settings', () => {+ expect(modelSelector).toMatch(/No AI backend is enabled/)+ expect(modelSelector).toMatch(+ /openSettingsAt\(\{ tab: 'backends' \}\)[\s\S]{0,300}Open Settings/,+ )+ })+})diff --git a/src/lib/provider-visibility.ts b/src/lib/provider-visibility.tsnew file mode 100644index 00000000..c94dcbe4--- /dev/null+++ b/src/lib/provider-visibility.ts@@ -0,0 +1,65 @@+/**+ * Which provider rows Settings, AI Backends shows, and whether the chat picker+ * has any backend left to list.+ *+ * Nebenbefund 1 of the R9 re-measure on the 2.6.7 Windows build (2026-08-30):+ * the red "Disable" button on the LM Studio card removed the card from the+ * list. The list only ever rendered ENABLED providers, so the control that+ * turned a provider off also deleted the only place that could turn it back+ * on. What was left was LU Cloud, `activeModel` on null, and a chat picker+ * saying "No models available" with nothing to press.+ *+ * The rule here is small on purpose: a provider the USER switched off keeps+ * its row and shows an Enable button. A provider that is simply not in use+ * (a fresh install has Ollama and Anthropic off, and onboarding turns the+ * built-in engine off when the user picks Ollama) stays out of the list, so+ * the pane does not fill up with slots nobody asked for. That is what+ * `disabledByUser` marks, and only the Disable/Enable control writes it.+ */++export interface ProviderVisibilityConfig {+ enabled: boolean+ /** Set by the card's own Disable button, cleared by Enable. */+ disabledByUser?: boolean+}++/** Providers whose models never show in local mode, and are the only ones that+ * show in cloud mode. */+const CLOUD_ONLY_IDS = ['lu-cloud']++/**+ * The rows the providers list renders, in store order: everything enabled,+ * plus everything the user switched off here.+ */+export function providerRowIds<T extends ProviderVisibilityConfig>(+ providers: Record<string, T | undefined>,+): string[] {+ return Object.keys(providers).filter((id) => {+ const p = providers[id]+ if (!p) return false+ return p.enabled || p.disabledByUser === true+ })+}++/** True for a row that is present but switched off, i.e. the Enable row. */+export function isReturnableRow<T extends ProviderVisibilityConfig>(config: T | undefined): boolean {+ return !!config && !config.enabled && config.disabledByUser === true+}++/**+ * No backend the CURRENT mode can use is enabled. Local mode never lists the+ * hosted models and cloud mode never lists the local ones, so "is anything+ * enabled" has to be asked per mode or the picker would claim a backend it+ * does not show.+ */+export function noChatBackendEnabled<T extends ProviderVisibilityConfig>(+ providers: Record<string, T | undefined>,+ appMode: 'local' | 'cloud',+): boolean {+ return !Object.keys(providers).some((id) => {+ const p = providers[id]+ if (!p?.enabled) return false+ const isCloudOnly = CLOUD_ONLY_IDS.includes(id)+ return appMode === 'cloud' ? isCloudOnly : !isCloudOnly+ })+}