Skip to content

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.

fix(chat): B26 names a smaller installed model from Ollama's own list

purple000d26c1c46b
diff --git a/src/lib/__tests__/first-wait-vram.test.ts b/src/lib/__tests__/first-wait-vram.test.ts
index b9e1e2f9..9adac44e 100644
--- a/src/lib/__tests__/first-wait-vram.test.ts
+++ b/src/lib/__tests__/first-wait-vram.test.ts
@@ -70,7 +70,7 @@ describe('the watch', () => {
useRunActivityStore.getState().setActivity('c1', reading)
const answers = [[], [bigOnCpu]]
const readLoaded = vi.fn(async () => answers.shift() ?? [bigOnCpu])
- watchFirstWait({ conversationId: 'c1', model: 'qwen3.8-27b:iq2_m', readLoaded, readInstalled: () => installed, getActivity: store.get, setActivity: store.set, firstLookMs: 10_000, everyMs: 5_000 })
+ watchFirstWait({ conversationId: 'c1', model: 'qwen3.8-27b:iq2_m', readLoaded, readInstalled: async () => installed, getActivity: store.get, setActivity: store.set, firstLookMs: 10_000, everyMs: 5_000 })
await vi.advanceTimersByTimeAsync(9_000)
expect(readLoaded).not.toHaveBeenCalled()
@@ -79,6 +79,8 @@ describe('the watch', () => {
await vi.advanceTimersByTimeAsync(5_000)
expect(store.get()).toMatchObject({ label: 'Reading the conversation', detail: '5.6k tokens' })
expect(store.get()?.hint).toContain('fit on your graphics card')
+ // Sizes from Ollama's own list: the model store has none (Mac run 30.10.).
+ expect(store.get()?.hint).toContain('for example gemma4:e4b (5.1 GB)')
// The first word takes the line back (endFirstWait): the watch stops.
useRunActivityStore.getState().setActivity('c1', null)
@@ -91,7 +93,7 @@ describe('the watch', () => {
it('keeps the sentence through hidden thinking, which is just as slow on the CPU (Mac run 30.10.)', async () => {
useRunActivityStore.getState().setActivity('c1', reading)
const readLoaded = vi.fn(async () => [bigOnCpu])
- watchFirstWait({ conversationId: 'c1', model: 'qwen3.8-27b:iq2_m', readLoaded, readInstalled: () => installed, getActivity: store.get, setActivity: store.set, firstLookMs: 10_000, everyMs: 5_000 })
+ watchFirstWait({ conversationId: 'c1', model: 'qwen3.8-27b:iq2_m', readLoaded, readInstalled: async () => installed, getActivity: store.get, setActivity: store.set, firstLookMs: 10_000, everyMs: 5_000 })
await vi.advanceTimersByTimeAsync(10_000)
expect(store.get()?.hint).toContain('fit on your graphics card')
// hiddenThoughtArrived: the run says "Thinking", without the sentence.
@@ -105,7 +107,7 @@ describe('the watch', () => {
useRunActivityStore.getState().setActivity('c1', reading)
const abort = new AbortController()
const readLoaded = vi.fn(async () => [bigOnCpu])
- watchFirstWait({ conversationId: 'c1', model: 'm', signal: abort.signal, readLoaded, readInstalled: () => [], getActivity: store.get, setActivity: store.set })
+ watchFirstWait({ conversationId: 'c1', model: 'm', signal: abort.signal, readLoaded, readInstalled: async () => [], getActivity: store.get, setActivity: store.set })
abort.abort()
await vi.advanceTimersByTimeAsync(60_000)
expect(readLoaded).not.toHaveBeenCalled()
diff --git a/src/lib/first-wait-vram.ts b/src/lib/first-wait-vram.ts
index fa739879..0e992232 100644
--- a/src/lib/first-wait-vram.ts
+++ b/src/lib/first-wait-vram.ts
@@ -17,10 +17,9 @@
* The words are pure, so every sentence is a test; the watch is small.
*/
-import { readLoadedModels, type LoadedOllamaModel } from '../api/ollama'
+import { listModels, readLoadedModels, type LoadedOllamaModel } from '../api/ollama'
import { getProviderIdFromModel } from '../api/providers/model-name'
import { cpuSharePercent } from './ollama-window-fit'
-import { useModelStore } from '../stores/modelStore'
import { useRunActivityStore, type RunActivity } from '../stores/runActivityStore'
/** How long a first wait runs before LU looks why. A turn that answers sooner needs no sentence. */
@@ -108,7 +107,7 @@ export function watchFirstWait(opts: {
model: string
signal?: AbortSignal
readLoaded: () => Promise<LoadedOllamaModel[]>
- readInstalled: () => InstalledSize[]
+ readInstalled: () => Promise<InstalledSize[]>
getActivity: () => RunActivity | undefined
setActivity: (activity: RunActivity) => void
firstLookMs?: number
@@ -120,6 +119,7 @@ export function watchFirstWait(opts: {
// can go back to it (a load that finished turns "Loading the model" back
// into reading, a hidden thought turns reading into "Thinking").
let reading: RunActivity | null = null
+ let installed: InstalledSize[] | null = null
const stop = () => {
stopped = true
if (timer) clearTimeout(timer)
@@ -146,7 +146,12 @@ export function watchFirstWait(opts: {
if (!after || !waiting(after)) { stop(); return }
if (after.label !== 'Loading the model') reading = own(after)
const base = reading ?? { label: 'Reading the conversation', kind: 'reading' as const }
- const next = firstWaitActivity({ reading: base, model: opts.model, loaded, installed: opts.readInstalled() })
+ // Read once, and only when it is needed: when part of the model is on the CPU.
+ if (!installed && loaded?.some((m) => sameModel(m.name, opts.model) && m.sizeVram < m.size)) {
+ installed = await opts.readInstalled().catch(() => [])
+ if (stopped) return
+ }
+ const next = firstWaitActivity({ reading: base, model: opts.model, loaded, installed: installed ?? [] })
if (next) opts.setActivity(next)
else if (loaded) opts.setActivity(base)
timer = setTimeout(() => void look(), opts.everyMs ?? FIRST_WAIT_LOOK_EVERY_MS)
@@ -168,9 +173,9 @@ export function watchChatFirstWait(conversationId: string | null | undefined, mo
model,
signal,
readLoaded: () => readLoadedModels(signal),
- readInstalled: () => useModelStore.getState().models
- .filter((m) => m.type === 'text' && getProviderIdFromModel(m.name) === 'ollama')
- .map((m) => ({ name: m.name, size: 'size' in m && typeof m.size === 'number' ? m.size : 0 })),
+ // Ollama's own list: the model store carries no file sizes (size 0 for
+ // every entry, Mac run 30.10.), /api/tags does.
+ readInstalled: async () => (await listModels()).map((m) => ({ name: m.name, size: m.size })),
getActivity: () => useRunActivityStore.getState().activity[conversationId],
setActivity: (activity) => useRunActivityStore.getState().setActivity(conversationId, activity),
})