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): D1 - Troubleshoot sagt "switched off" statt nur "Reachable"
purplefc9a4f4250ab
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsxindex c256552d..70655fde 100644--- a/src/components/settings/SettingsPage.tsx+++ b/src/components/settings/SettingsPage.tsx@@ -2454,7 +2454,7 @@ export function UpdateSection() {// ── B7 Troubleshoot section — one-shot diagnostic probe ───────-interface BackendProbe {+export interface BackendProbe {status: 'ok' | 'unreachable' | 'not_installed' | 'error'detail: stringendpoint: string@@ -2479,7 +2479,12 @@ interface SystemHealthReport {lm_studio: BackendProbe}-function ProbeBadge({ probe }: { probe: BackendProbe }) {+// Exported for D1's regression test (3.0.1): SettingsPage.tsx is+// hook/store-heavy with no render harness of its own, so the small,+// self-contained pieces that carry real decisions get tested directly+// instead of through the whole page, the same pattern ModelSelector.tsx uses+// for its LM Studio helpers.+export function ProbeBadge({ probe, switchedOff }: { probe: BackendProbe; switchedOff?: boolean }) {// "Not running" und "Not installed" sind beide nur ein Nein und tragen// deshalb dasselbe Grau; der Unterschied steht im Wort, nicht in der Farbe.// Das Gelb, das "Not running" frueher trug, hat einen ausgeschalteten@@ -2497,12 +2502,25 @@ function ProbeBadge({ probe }: { probe: BackendProbe }) {not_installed: 'Not installed',error: 'Error',}+ // D1 (3.0.1): the probe itself only asks the fixed default address whether+ // something answers there — it does not know, and cannot say, whether LU+ // has this backend switched OFF in Settings. Reachable-but-off used to read+ // as plain "Reachable", telling a customer with Ollama installed but turned+ // off that it is in use when it plainly is not. This is the half of the fix+ // this file can make on its own: the word changes to name both facts at+ // once. The other half — asking the CONFIGURED address instead of the+ // hard-coded default — is Rust (health.rs) and stays open (see report).+ const label = probe.status === 'ok' && switchedOff ? `${labels.ok}, switched off` : labels[probe.status]+ // Emerald reads as "in use", which is exactly the wrong colour once the+ // sentence itself says the opposite — the quiet grey used for the other+ // off states says so at a glance too.+ const color = probe.status === 'ok' && switchedOff ? RUHIG : colors[probe.status]return (<span- className={`text-[0.55rem] px-1.5 py-0.5 rounded border font-medium ${colors[probe.status]}`}+ className={`text-[0.55rem] px-1.5 py-0.5 rounded border font-medium ${color}`}title={probe.detail || probe.endpoint}>- {labels[probe.status]}+ {label}</span>)}@@ -2511,6 +2529,8 @@ function TroubleshootSection() {const [report, setReport] = useState<SystemHealthReport | null>(null)const [loading, setLoading] = useState(false)const [hinweis, setHinweis] = useState<TroubleshootHinweis | null>(null)+ // D1 (3.0.1): the one fact the probe itself cannot know — see ProbeBadge.+ const ollamaEnabled = useProviderStore((s) => s.providers.ollama.enabled)const run = async () => {setLoading(true)@@ -2563,7 +2583,7 @@ function TroubleshootSection() {<div className="text-[0.55rem] uppercase tracking-widest text-gray-500">Backends</div><div className="flex items-center justify-between"><span className="text-[0.65rem] text-gray-300">Ollama</span>- <ProbeBadge probe={report.ollama} />+ <ProbeBadge probe={report.ollama} switchedOff={!ollamaEnabled} /></div>{!isMlxImageHost() && (<div className="flex items-center justify-between">diff --git a/src/components/settings/__tests__/probe-badge-switched-off.test.tsx b/src/components/settings/__tests__/probe-badge-switched-off.test.tsxnew file mode 100644index 00000000..cc789ed8--- /dev/null+++ b/src/components/settings/__tests__/probe-badge-switched-off.test.tsx@@ -0,0 +1,38 @@+// @vitest-environment jsdom+/**+ * D1 (3.0.1): Troubleshoot showed "Reachable" for Ollama even with the+ * provider switched off in Settings, and (the other direction, T5) "Not+ * running" a moment after a real 200 answer. `health.rs:246` probes a fixed+ * default address and knows nothing about the frontend's on/off switch — the+ * Rust half of the fix (ask the CONFIGURED address, `AppState::ollama_base`)+ * is out of scope for this repo/pass (no Rust here). This is the half TS can+ * fix on its own: the badge now says BOTH facts when they disagree —+ * reachable, but the user turned it off — instead of a plain "Reachable"+ * that reads as "in use".+ *+ * Run: npx vitest run src/components/settings/__tests__/probe-badge-switched-off.test.tsx+ */+import { describe, it, expect } from 'vitest'+import { render, screen } from '@testing-library/react'+import { ProbeBadge, type BackendProbe } from '../SettingsPage'++const reachable: BackendProbe = { status: 'ok', detail: '', endpoint: 'http://127.0.0.1:11434' }++describe('D1 — ProbeBadge names both facts when they disagree', () => {+ it('plain "Reachable" when the backend is on, same as before', () => {+ render(<ProbeBadge probe={reachable} switchedOff={false} />)+ expect(screen.getByText('Reachable')).toBeTruthy()+ })++ it('"Reachable, switched off" when the process answers but the user turned it off', () => {+ render(<ProbeBadge probe={reachable} switchedOff={true} />)+ expect(screen.getByText('Reachable, switched off')).toBeTruthy()+ expect(screen.queryByText('Reachable')).toBeNull()+ })++ it('switchedOff has no effect on a real "Not running" — never invents a sentence for a status that already says no', () => {+ const unreachable: BackendProbe = { status: 'unreachable', detail: '', endpoint: 'http://127.0.0.1:11434' }+ render(<ProbeBadge probe={unreachable} switchedOff={true} />)+ expect(screen.getByText('Not running')).toBeTruthy()+ })+})