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): der auto-Ordner heisst, was er ist, plus zwei Haerten
purple533377c793bc
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsxindex 3f1b0e44..3d51e450 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 it, up to four levels down. Models here run on the LU Engine.+ 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.</div><div className="flex items-center gap-2"><inputdiff --git a/src/components/settings/__tests__/model-storage-three-rows.test.ts b/src/components/settings/__tests__/model-storage-three-rows.test.tsindex eda54b16..08a2f287 100644--- a/src/components/settings/__tests__/model-storage-three-rows.test.ts+++ b/src/components/settings/__tests__/model-storage-three-rows.test.ts@@ -81,17 +81,29 @@ 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(`(auto: ${APP_DIR})`)+ expect(field.placeholder).toBe(`Leave empty and LU uses its own folder: ${APP_DIR}`)+ })++ // A14 review 4: the two folders are walked to different depths, the app's+ // own two levels and the one you name four, so the paragraph has to say+ // which of them the four belong to. It said "reads every .gguf in it, up to+ // four levels down" over a field whose placeholder named the app folder.+ it('says the four levels belong to the folder you set', async () => {+ 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()})// NEGATIVE CONTROL: with no folder known there is nothing to name, and the- // placeholder must not print "(auto: )" at the user.- it('falls back to the old wording when the listing knows no folder', async () => {+ // placeholder must not print a dangling colon at the user.+ it('names no folder when the listing knows none', async () => {dirs = []render(createElement(HfDownloadPathSetting))await settle()const field = screen.getByLabelText('LU Engine folder') as HTMLInputElement- expect(field.placeholder).toBe('(auto-detect)')+ expect(field.placeholder).toBe('Leave empty and LU uses its own folder')+ expect(field.placeholder).not.toContain(':')})// NEGATIVE CONTROL: the sentences that moved to the other two rows are gonediff --git a/src/hooks/__tests__/lu-engine-resume-routing.test.ts b/src/hooks/__tests__/lu-engine-resume-routing.test.tsindex e9f65f86..de62103f 100644--- a/src/hooks/__tests__/lu-engine-resume-routing.test.ts+++ b/src/hooks/__tests__/lu-engine-resume-routing.test.ts@@ -49,11 +49,12 @@ vi.mock('../../api/providers', async () => {const actual = await vi.importActual<typeof import('../../api/providers')>('../../api/providers')return { ...actual, getEnabledProviders: () => [] }})+const listBundledModels = vi.fn(async () => [CHAT, EMBED])vi.mock('../../api/engine', async () => {const actual = await vi.importActual<typeof import('../../api/engine')>('../../api/engine')return {...actual,- listBundledModels: vi.fn(async () => [CHAT, EMBED]),+ listBundledModels: (...a: unknown[]) => listBundledModels(...(a as [])),isManagedBuiltinActive: () => managedBuiltin,bundledEngineStatus,bundledEmbedStatus,@@ -62,18 +63,24 @@ vi.mock('../../api/engine', async () => {}})-/** One fresh app session. */+/** One fresh app session. Returns a way to refresh again in the SAME session. */async function bootAndRefresh() {vi.resetModules()const { useModels } = await import('../useModels')const { result } = renderHook(() => useModels())- await act(async () => { await result.current.fetchModels() })- // The resumes are fired without await on purpose, so the list is not held- // hostage by a cold engine start. Let those microtasks land.- await act(async () => { await new Promise((r) => setTimeout(r, 0)) })+ const refresh = async () => {+ await act(async () => { await result.current.fetchModels() })+ // The resumes are fired without await on purpose, so the list is not held+ // hostage by a cold engine start. Let those microtasks land.+ await act(async () => { await new Promise((r) => setTimeout(r, 0)) })+ }+ await refresh()+ return refresh}beforeEach(() => {+ listBundledModels.mockReset()+ listBundledModels.mockResolvedValue([CHAT, EMBED])bundledEngineStatus.mockClear()bundledEmbedStatus.mockClear()startBundledEmbed.mockClear()@@ -97,3 +104,40 @@ describe('the boot resume goes to the right process', () => {expect(startBundledEmbed).toHaveBeenCalledWith(EMBED.path)})})++// ── A14 review 6: the boot resume is a BOOT resume ──────────────────────────++describe('the once-per-session flag is raised on the attempt, not on the success', () => {+ it('a machine with no sidecar does not re-attempt the resume on every refresh', async () => {+ managedBuiltin = true+ // No sidecar: the command has no route and throws, the way it does in the+ // web and remote-bridge builds and on a broken install.+ listBundledModels.mockRejectedValue(new Error('command list_bundled_models not found'))+ const refresh = await bootAndRefresh()+ expect(startBundledEmbed).not.toHaveBeenCalled()+ expect(bundledEngineStatus).not.toHaveBeenCalled()++ // fetchModels runs from several mounted components and on every refresh+ // event. With the flag raised only after a SUCCESSFUL call, the engine+ // that starts answering an hour into the session would get a boot resume+ // an hour after boot, evicting Ollama's residents and dropping ComfyUI's+ // VRAM cache for a start nobody asked for.+ listBundledModels.mockResolvedValue([CHAT, EMBED])+ await refresh()+ expect(bundledEngineStatus, 'a boot resume an hour after boot').not.toHaveBeenCalled()+ expect(startBundledEmbed).not.toHaveBeenCalled()+ })++ // NEGATIVE CONTROL: the boot resume must still happen at boot. A flag raised+ // too eagerly would turn this whole mechanism off.+ it('but the first pass of a working session still resumes', async () => {+ managedBuiltin = true+ const refresh = await bootAndRefresh()+ expect(bundledEngineStatus).toHaveBeenCalled()+ // ...and exactly once, however often the list is refreshed afterwards.+ bundledEngineStatus.mockClear()+ await refresh()+ await refresh()+ expect(bundledEngineStatus).not.toHaveBeenCalled()+ })+})diff --git a/src/hooks/useModels.ts b/src/hooks/useModels.tsindex ff307823..0cc0fdf5 100644--- a/src/hooks/useModels.ts+++ b/src/hooks/useModels.ts@@ -241,6 +241,14 @@ export function useModels() {// check for the engine: it is a Tauri command with no bridge route, so// the web and remote-bridge builds, which have no sidecar to start,// still get nothing and are unchanged.+ //+ // A14 review 6: the once-per-session flag is raised BEFORE the call, not+ // after a successful one. fetchModels runs from several mounted+ // components and on every refresh event, so raising it afterwards meant+ // a machine without a sidecar (web, remote bridge, a broken install)+ // re-attempted the whole resume on every single refresh, forever.+ const firstPassThisSession = !builtinResumeAttempted+ builtinResumeAttempted = truelet bundledRaw: BundledModel[] | null = nulltry {bundledRaw = await listBundledModels()@@ -251,8 +259,7 @@ export function useModels() {// LM Studio lists the model over its own API and the folder walk finds// the same file. The row that is already serving the chat wins.allModels.push(...dropDuplicateLuEngineRows(bundled, allModels))- if (!builtinResumeAttempted) {- builtinResumeAttempted = true+ if (firstPassThisSession) {// Unchanged in both directions: the chat engine is only resumed when// it holds the slot, and the embeddings server is resumed when it// does not, so RAG survives a relaunch under a foreign backend.diff --git a/src/lib/__tests__/lu-engine-name.test.ts b/src/lib/__tests__/lu-engine-name.test.tsindex 4c0c5765..63d02d98 100644--- a/src/lib/__tests__/lu-engine-name.test.ts+++ b/src/lib/__tests__/lu-engine-name.test.ts@@ -172,3 +172,45 @@ describe('a store written before the rename opens under the new name', () => {expect(store.getState().providers.openai.name).toBe('LU Engine')})})++// ── A14 review 5: the merge must survive a damaged blob ─────────────────────++describe('a broken lu-providers blob does not cost the user his keys', () => {+ afterEach(() => { vi.unstubAllGlobals() })+ beforeEach(() => { vi.resetModules() })++ // A merge that throws takes the whole provider store down to defaults, and+ // that is every API key the user ever typed. A null entry is what a+ // hand-edited or truncated blob looks like.+ it('steps over a null provider entry instead of throwing', async () => {+ installLocalStorage({+ 'lu-providers': JSON.stringify({+ version: 1,+ state: {+ providers: {+ openai: null,+ anthropic: { id: 'anthropic', name: 'Anthropic', enabled: true, baseUrl: 'https://api.anthropic.com', apiKey: 'sk-kept', isLocal: false },+ },+ },+ }),+ })+ const store = await freshStore()+ // The key on the healthy entry survived, which is the whole point.+ expect(store.getState().providers.anthropic.apiKey).toBe('sk-kept')+ })++ it('and over a displaced memory that is not an object', async () => {+ installLocalStorage({+ 'lu-providers': JSON.stringify({+ version: 1,+ state: {+ providers: {+ openai: { id: 'openai', name: 'Built-in Engine', enabled: true, baseUrl: 'http://127.0.0.1:8127/v1', apiKey: '', isLocal: true, managed: true, displaced: 'nonsense' },+ },+ },+ }),+ })+ const store = await freshStore()+ expect(store.getState().providers.openai.name).toBe('LU Engine')+ })+})diff --git a/src/lib/model-storage-rows.ts b/src/lib/model-storage-rows.tsindex a4fa4cec..9c550fd8 100644--- a/src/lib/model-storage-rows.ts+++ b/src/lib/model-storage-rows.ts@@ -23,11 +23,19 @@ export interface LmStudioModelDir {* "(auto-detect)" on its own answered the wrong question. The user is not* asking whether the app detects something, he is asking which folder is being* read while the field is empty, and the app knows that folder: it is row 0 of- * the last listing, the app's own models dir. So the placeholder names it.+ * the last listing, the app's own models dir.+ *+ * A14 review 4: it is named for what it IS, not as an "auto" anything. There+ * is no detection going on and nothing is derived from the active provider;+ * an empty field simply means LU uses the folder it owns. Saying "auto" there+ * 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).*/export function luEngineFolderPlaceholder(autoDir: string | null | undefined): string {const dir = (autoDir ?? '').trim()- return dir ? `(auto: ${dir})` : '(auto-detect)'+ return dir ? `Leave empty and LU uses its own folder: ${dir}` : 'Leave empty and LU uses its own folder'}/** The role line under the LM Studio row. */diff --git a/src/stores/providerStore.ts b/src/stores/providerStore.tsindex da14be2d..a9816b80 100644--- a/src/stores/providerStore.ts+++ b/src/stores/providerStore.ts@@ -289,10 +289,24 @@ export const useProviderStore = create<ProviderState>()(// are what the provider card and the standby card print, so both are// relabelled here. Only that exact name is touched, so a backend the// user named himself is left alone.+ //+ // This relabel MUST STAY WHILE OLD STORES EXIST. It is not a one-off+ // migration that a version bump retires: `version` is still 1 and the+ // blob is merged, not rewritten in place, so a machine that has not+ // been opened since 2.6.7 arrives here with the old name on its very+ // next launch, whenever that is. Deleting this puts "Built-in Engine"+ // back on that user's provider card. The READ side (isLuEngineName)+ // has to stay for the same reason, for rows recorded in old chats.+ //+ // Defensive on purpose: a hand-edited or truncated blob can carry a+ // null entry, and a merge that throws takes the whole provider store+ // down to defaults, which is every API key the user typed.for (const id of Object.keys(merged) as ProviderId[]) {- const cfg = renameLegacyEngine(merged[id])- const displaced = cfg.displaced ? renameLegacyEngine(cfg.displaced) : undefined- if (cfg !== merged[id] || displaced !== cfg.displaced) {+ const raw = merged[id]+ if (!raw || typeof raw !== 'object') continue+ const cfg = renameLegacyEngine(raw)+ const displaced = cfg.displaced ? renameLegacyEngine(cfg.displaced) : cfg.displaced+ if (cfg !== raw || displaced !== cfg.displaced) {merged[id] = displaced ? { ...cfg, displaced } : cfg}}