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(ui): fuenf Kleinigkeiten aus der Nachpruefung
purple98c19fc94132
diff --git a/src/components/chat/LuEngineSwitchBar.tsx b/src/components/chat/LuEngineSwitchBar.tsxindex 8866cc5a..7349bccc 100644--- a/src/components/chat/LuEngineSwitchBar.tsx+++ b/src/components/chat/LuEngineSwitchBar.tsx@@ -11,20 +11,28 @@ import { useLuEngineSwitchStore } from '../../stores/luEngineSwitchStore'export function LuEngineSwitchBar() {const note = useLuEngineSwitchStore((s) => s.note)- if (!note) return null+ // The live region stays MOUNTED and its text changes, which is the only+ // shape a screen reader actually announces: a region that appears at the+ // same moment as its content is usually read as page furniture and skipped.+ // Polite, not assertive, because nothing went wrong and the user is in the+ // middle of picking a model.return (- <div- data-testid="lu-engine-switch-note"- className="mx-3 mb-1.5 flex items-start gap-2 px-2 py-1 rounded-md bg-white/5 border border-white/10 text-[0.62rem] text-gray-600 dark:text-gray-300"- >- <span className="flex-1 leading-snug">{note}</span>- <button- onClick={() => useLuEngineSwitchStore.getState().dismiss()}- className="shrink-0 text-gray-500 hover:text-gray-700 dark:hover:text-gray-200"- aria-label="Dismiss"- >- <X size={11} />- </button>+ <div role="status" aria-live="polite">+ {note && (+ <div+ data-testid="lu-engine-switch-note"+ className="mx-3 mb-1.5 flex items-start gap-2 px-2 py-1 rounded-md bg-white/5 border border-white/10 text-[0.62rem] text-gray-600 dark:text-gray-300"+ >+ <span className="flex-1 leading-snug">{note}</span>+ <button+ onClick={() => useLuEngineSwitchStore.getState().dismiss()}+ className="shrink-0 text-gray-500 hover:text-gray-700 dark:hover:text-gray-200"+ aria-label="Dismiss"+ >+ <X size={11} />+ </button>+ </div>+ )}</div>)}diff --git a/src/components/chat/__tests__/lu-engine-switch-note-is-visible.test.ts b/src/components/chat/__tests__/lu-engine-switch-note-is-visible.test.tsindex 4da20302..79d94f47 100644--- a/src/components/chat/__tests__/lu-engine-switch-note-is-visible.test.ts+++ b/src/components/chat/__tests__/lu-engine-switch-note-is-visible.test.ts@@ -90,6 +90,17 @@ describe('the line survives the pick that caused it', () => {expect(screen.queryByTestId('lu-engine-switch-note')).toBeNull()})+ it('is a polite live region that stays mounted, so it is really announced', async () => {+ const { container } = render(createElement(LuEngineSwitchBar))+ const region = container.querySelector('[role="status"]')+ // Mounted BEFORE there is anything to say: a live region that appears+ // together with its content is usually read as furniture and skipped.+ expect(region, 'the live region has to already be there').toBeTruthy()+ expect(region?.getAttribute('aria-live')).toBe('polite')+ await act(async () => { pickAnLuEngineModel() })+ expect(region?.textContent).toContain('Switched your chat provider to the LU Engine')+ })+it('can be dismissed by hand', async () => {render(createElement(LuEngineSwitchBar))await act(async () => { pickAnLuEngineModel() })@@ -107,6 +118,19 @@ describe('the line survives the pick that caused it', () => {expect(screen.queryByTestId('lu-engine-switch-note')).toBeNull()})+ it('cancels the pending timer when the line is dismissed', () => {+ vi.useFakeTimers()+ render(createElement(LuEngineSwitchBar))+ act(() => { useLuEngineSwitchStore.getState().announce('first') })+ act(() => { useLuEngineSwitchStore.getState().dismiss() })+ // A second announcement after the dismiss must live its full span: the+ // first pick's timer is gone, not merely outvoted.+ act(() => { useLuEngineSwitchStore.getState().announce('second') })+ act(() => { vi.advanceTimersByTime(LU_ENGINE_SWITCH_NOTE_MS - 100) })+ expect(screen.getByTestId('lu-engine-switch-note').textContent).toContain('second')+ expect(vi.getTimerCount(), 'exactly one timer should be pending').toBe(1)+ })+// NEGATIVE CONTROL: an older announcement's timer must not clear a newer// line. Two picks in a row would otherwise leave the second one blank.it('a second pick is not cut short by the first pick timer', () => {@@ -117,6 +141,8 @@ describe('the line survives the pick that caused it', () => {act(() => { useLuEngineSwitchStore.getState().announce('second') })act(() => { vi.advanceTimersByTime(200) })expect(screen.getByTestId('lu-engine-switch-note').textContent).toContain('second')+ // And the first one's timer is gone rather than merely outvoted.+ expect(vi.getTimerCount()).toBe(1)})})diff --git a/src/components/settings/CivitaiApiKeySetting.tsx b/src/components/settings/CivitaiApiKeySetting.tsxindex 3ad1c838..dfd4ebd8 100644--- a/src/components/settings/CivitaiApiKeySetting.tsx+++ b/src/components/settings/CivitaiApiKeySetting.tsx@@ -30,8 +30,17 @@ export function CivitaiApiKeySetting() {const [saved, setSaved] = useState(false)useEffect(() => { setDraft(apiKey) }, [apiKey])+ const looksWrong = looksLikeAFolderPath(draft)+function save() {const next = draft.trim()+ // A14 second review: a value that is plainly a folder is NOT written.+ // Saying so under the field and storing it anyway was the worst of both:+ // the path went into the OS credential store, every CivitAI download kept+ // failing with a bare 400, and the field then showed a row of dots that+ // looked exactly like a key that was there. The line below says what is+ // wrong; refusing the write is what keeps it fixable.+ if (looksLikeAFolderPath(next)) returnsetApiKey(next)setDraft(next)setSaved(true)@@ -78,7 +87,7 @@ export function CivitaiApiKeySetting() {</button>)}</div>- {looksLikeAFolderPath(draft) && (+ {looksWrong && (<div data-testid="civitai-key-looks-wrong" className="flex items-start gap-1.5 text-[0.6rem] leading-relaxed text-amber-600 dark:text-amber-400"><AlertTriangle size={11} className="shrink-0 mt-0.5" /><span>{CIVITAI_KEY_LOOKS_WRONG}</span>diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsxindex dbd4b50f..a6c97ea4 100644--- a/src/components/settings/SettingsPage.tsx+++ b/src/components/settings/SettingsPage.tsx@@ -340,7 +340,7 @@ export function HfDownloadPathSetting() {<div className="space-y-2 py-1"><p className="text-[0.62rem] font-semibold text-gray-700 dark:text-gray-300">LU Engine folder</p><div className="text-[0.6rem] text-gray-500 leading-relaxed">- LU downloads GGUFs here and reads every <code className="font-mono">.gguf</code> in a folder you set, up to four levels down. Models here run on the LU Engine. Leave it empty and LU uses its own folder instead, the one named below.+ LU downloads GGUFs here and reads every <code className="font-mono">.gguf</code> in a folder you set, up to four levels down. Models here run on the LU Engine. Leave it empty and LU uses its own folder, which it reads two levels down.</div><div className="flex items-center gap-2"><inputdiff --git a/src/components/settings/__tests__/civitai-key-field-renders.test.ts b/src/components/settings/__tests__/civitai-key-field-renders.test.tsindex cc0d8a7a..f5539157 100644--- a/src/components/settings/__tests__/civitai-key-field-renders.test.ts+++ b/src/components/settings/__tests__/civitai-key-field-renders.test.ts@@ -145,3 +145,43 @@ describe('the field says what belongs in it', () => {expect(screen.queryByTestId('civitai-key-looks-wrong')).toBeNull()})})++describe('a folder is refused, not stored behind a row of dots', () => {+ it('a pasted path never reaches the store', () => {+ show()+ const field = screen.getByLabelText('CivitAI API key')+ fireEvent.change(field, { target: { value: 'G:\\AI\\Models' } })+ fireEvent.blur(field)+ expect(useWorkflowStore.getState().civitaiApiKey).toBe('')+ // And the reason stays on screen instead of a Saved tick.+ expect(screen.getByTestId('civitai-key-looks-wrong')).toBeTruthy()+ expect(screen.queryByText('Saved')).toBeNull()+ })++ it('the Save button refuses it too, not just the blur', () => {+ show()+ fireEvent.change(screen.getByLabelText('CivitAI API key'), { target: { value: '/Users/dev/lu-e2e-models' } })+ fireEvent.click(screen.getByText('Save'))+ expect(useWorkflowStore.getState().civitaiApiKey).toBe('')+ })++ // NEGATIVE CONTROL: a real key still saves. A field that refuses everything+ // is a field nobody can use.+ it('a real key still goes in', () => {+ show()+ const field = screen.getByLabelText('CivitAI API key')+ fireEvent.change(field, { target: { value: '3f9a1c7d5e2b48f06a1d9c3e7b52f8a4' } })+ fireEvent.blur(field)+ expect(useWorkflowStore.getState().civitaiApiKey).toBe('3f9a1c7d5e2b48f06a1d9c3e7b52f8a4')+ })++ // NEGATIVE CONTROL: clearing the field is not a path, so Remove still works.+ it('and an empty value still clears it', () => {+ useWorkflowStore.setState({ civitaiApiKey: '3f9a1c7d5e2b48f06a1d9c3e7b52f8a4' })+ show()+ const field = screen.getByLabelText('CivitAI API key')+ fireEvent.change(field, { target: { value: '' } })+ fireEvent.blur(field)+ expect(useWorkflowStore.getState().civitaiApiKey).toBe('')+ })+})diff --git a/src/components/settings/__tests__/model-storage-three-rows.test.ts b/src/components/settings/__tests__/model-storage-three-rows.test.tsindex 08a2f287..29bb99d9 100644--- a/src/components/settings/__tests__/model-storage-three-rows.test.ts+++ b/src/components/settings/__tests__/model-storage-three-rows.test.ts@@ -81,7 +81,7 @@ describe('row 1: the folder the user sets belongs to the LU Engine and says so',render(createElement(HfDownloadPathSetting))await settle()const field = screen.getByLabelText('LU Engine folder') as HTMLInputElement- expect(field.placeholder).toBe(`Leave empty and LU uses its own folder: ${APP_DIR}`)+ expect(field.placeholder).toBe(`LU's own folder: ${APP_DIR}`)})// A14 review 4: the two folders are walked to different depths, the app's@@ -92,7 +92,9 @@ describe('row 1: the folder the user sets belongs to the LU Engine and says so',render(createElement(HfDownloadPathSetting))await settle()expect(screen.getByText(/in a folder you set, up to four levels down/)).toBeTruthy()- expect(screen.getByText(/LU uses its own folder instead/)).toBeTruthy()+ // ...and the app's own folder is walked two, which the paragraph now says+ // instead of leaving the placeholder to imply a rule of its own.+ expect(screen.getByText(/its own folder, which it reads two levels down/)).toBeTruthy()})// NEGATIVE CONTROL: with no folder known there is nothing to name, and the@@ -102,7 +104,7 @@ describe('row 1: the folder the user sets belongs to the LU Engine and says so',render(createElement(HfDownloadPathSetting))await settle()const field = screen.getByLabelText('LU Engine folder') as HTMLInputElement- expect(field.placeholder).toBe('Leave empty and LU uses its own folder')+ expect(field.placeholder).toBe("LU's own folder")expect(field.placeholder).not.toContain(':')})diff --git a/src/lib/model-storage-rows.ts b/src/lib/model-storage-rows.tsindex 9c550fd8..3cbc2924 100644--- a/src/lib/model-storage-rows.ts+++ b/src/lib/model-storage-rows.ts@@ -31,11 +31,15 @@ export interface LmStudioModelDir {* next to a paragraph about four folder levels invited the reading that the* four levels apply to this folder, and they do not: the app folder is walked* two levels deep (MAX_SCAN_DEPTH), the folder the user names four- * (MAX_CUSTOM_SCAN_DEPTH).+ * (MAX_CUSTOM_SCAN_DEPTH). The paragraph carries both depths now, so this one+ * only has to name the folder.*/export function luEngineFolderPlaceholder(autoDir: string | null | undefined): string {const dir = (autoDir ?? '').trim()- return dir ? `Leave empty and LU uses its own folder: ${dir}` : 'Leave empty and LU uses its own folder'+ // Only the folder, not the sentence: the paragraph above already says what+ // an empty field means, and printing that twice made the placeholder read+ // like a second, different rule (second review).+ return dir ? `LU's own folder: ${dir}` : "LU's own folder"}/** The role line under the LM Studio row. */diff --git a/src/stores/luEngineSwitchStore.ts b/src/stores/luEngineSwitchStore.tsindex e232c62a..23a7ead6 100644--- a/src/stores/luEngineSwitchStore.ts+++ b/src/stores/luEngineSwitchStore.ts@@ -30,15 +30,34 @@ interface LuEngineSwitchState {dismiss: () => void}+// The pending self-clear. The generation counter alone already stopped an old+// timer from clearing a new line, but the timer itself kept running: a session+// where the user picks his way through a handful of models left one live timer+// per pick, each holding the store closure until it fired. Cancelled outright+// now, and the generation counter stays as the belt to that pair of braces.+let pending: ReturnType<typeof setTimeout> | null = null++function cancelPending(): void {+ if (pending !== null) {+ clearTimeout(pending)+ pending = null+ }+}+export const useLuEngineSwitchStore = create<LuEngineSwitchState>((set, get) => ({note: null,generation: 0,announce: (note) => {+ cancelPending()const generation = get().generation + 1set({ note, generation })- setTimeout(() => {+ pending = setTimeout(() => {+ pending = nullif (get().generation === generation) set({ note: null })}, LU_ENGINE_SWITCH_NOTE_MS)},- dismiss: () => set({ note: null, generation: get().generation + 1 }),+ dismiss: () => {+ cancelPending()+ set({ note: null, generation: get().generation + 1 })+ },}))