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): the B26 sentence also shows under "Loading model" and through hidden thinking

purplec6d2bf76a683
diff --git a/src/components/chat/WorkingAnchor.tsx b/src/components/chat/WorkingAnchor.tsx
index 059a6987..c5cd4bc4 100644
--- a/src/components/chat/WorkingAnchor.tsx
+++ b/src/components/chat/WorkingAnchor.tsx
@@ -95,9 +95,11 @@ export function WorkingAnchor({ isRunning, conversationId, awaitingApproval, loa
>
<StatusChip kind={status.kind} word={status.word} detail={status.detail} seconds={elapsed} />
</div>
- {/* B26: why the first wait lasts, while it is still the line shown.
- Outside the live region: the word is announced, the sentence is read. */}
- {activity?.hint && status.word === activity.label && (
+ {/* B26: why the first wait lasts, while it is still the line shown, or
+ while the chat's own "Loading model" stands in for it (a local model
+ keeps that word until its first token, loaded or not). Outside the
+ live region: the word is announced, the sentence is read. */}
+ {activity?.hint && (status.word === activity.label || status.kind === 'loading') && (
<p className="pl-11 pr-3 pb-1.5 text-xs text-gray-500 dark:text-gray-400" data-testid="working-anchor-hint">
{activity.hint}
</p>
diff --git a/src/lib/__tests__/first-wait-vram.test.ts b/src/lib/__tests__/first-wait-vram.test.ts
index 815b34a1..b9e1e2f9 100644
--- a/src/lib/__tests__/first-wait-vram.test.ts
+++ b/src/lib/__tests__/first-wait-vram.test.ts
@@ -88,6 +88,19 @@ describe('the watch', () => {
expect(store.get()).toBeUndefined()
})
+ 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 })
+ await vi.advanceTimersByTimeAsync(10_000)
+ expect(store.get()?.hint).toContain('fit on your graphics card')
+ // hiddenThoughtArrived: the run says "Thinking", without the sentence.
+ useRunActivityStore.getState().setActivity('c1', { label: 'Thinking', kind: 'thinking' })
+ await vi.advanceTimersByTimeAsync(5_000)
+ expect(store.get()).toMatchObject({ label: 'Thinking', kind: 'thinking' })
+ expect(store.get()?.hint).toContain('fit on your graphics card')
+ })
+
it('Stop ends it before the first look', async () => {
useRunActivityStore.getState().setActivity('c1', reading)
const abort = new AbortController()
@@ -106,6 +119,13 @@ describe('the status line shows the sentence', () => {
expect(screen.getByTestId('working-anchor-hint').textContent).toContain('fit on your graphics card')
})
+ it('under the chat\'s own "Loading model" too, which a local model keeps until its first token', () => {
+ useRunActivityStore.setState({ activity: { c9: { ...reading, hint: 'Only 6.9 GB of x fit on your graphics card.' } } })
+ render(createElement(WorkingAnchor, { isRunning: true, conversationId: 'c9', loadingModel: true, message: { content: '', agentBlocks: [] } }))
+ expect(screen.getByTestId('working-anchor').textContent).toContain('Loading model')
+ expect(screen.getByTestId('working-anchor-hint').textContent).toContain('fit on your graphics card')
+ })
+
it('not once the model answers', () => {
useRunActivityStore.setState({ activity: { c9: { ...reading, hint: 'Only 6.9 GB of x fit on your graphics card.' } } })
render(createElement(WorkingAnchor, { isRunning: true, conversationId: 'c9', message: { content: 'Hallo' } }))
diff --git a/src/lib/first-wait-vram.ts b/src/lib/first-wait-vram.ts
index ec0506fc..fa739879 100644
--- a/src/lib/first-wait-vram.ts
+++ b/src/lib/first-wait-vram.ts
@@ -116,8 +116,9 @@ export function watchFirstWait(opts: {
}): () => void {
let stopped = false
let timer: ReturnType<typeof setTimeout> | null = null
- // The reading line as the run set it, so a later look can go back to it
- // (a load that finished turns "Loading the model" back into reading).
+ // The run's own line without anything this watch added, so a later look
+ // 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
const stop = () => {
stopped = true
@@ -125,17 +126,25 @@ export function watchFirstWait(opts: {
opts.signal?.removeEventListener('abort', stop)
}
opts.signal?.addEventListener('abort', stop, { once: true })
+ // The first wait, and the hidden thinking after it: a model partly on the
+ // CPU writes its hidden thoughts just as slowly (Mac run 30.10.: "Thinking"
+ // for seven minutes on 5.6 of 18.1 GB on the card). Any other line, or
+ // none, ends the watch: the model answers, or the turn is over.
+ const waiting = (a: RunActivity | undefined) => a?.kind === 'reading' || a?.kind === 'thinking'
+ const own = (a: RunActivity): RunActivity => ({ label: a.label, kind: a.kind, ...(a.detail ? { detail: a.detail } : {}) })
const look = async () => {
timer = null
if (stopped) return
const now = opts.getActivity()
- if (now?.kind !== 'reading') { stop(); return }
- if (!reading) reading = now.label === 'Loading the model' ? null : { label: now.label, kind: now.kind, ...(now.detail ? { detail: now.detail } : {}) }
+ if (!now || !waiting(now)) { stop(); return }
+ if (now.label !== 'Loading the model') reading = own(now)
let loaded: LoadedOllamaModel[] | null = null
try { loaded = await opts.readLoaded() } catch { loaded = null }
if (stopped) return
// The first word may have come in while /api/ps was being read.
- if (opts.getActivity()?.kind !== 'reading') { stop(); return }
+ const after = opts.getActivity()
+ 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() })
if (next) opts.setActivity(next)