The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): local models pane — sort catalog by fit, one context pill, no green on system RAM
emozilla00ab0be5e217
diff --git a/apps/desktop/src/app/settings/local-models-settings.test.tsx b/apps/desktop/src/app/settings/local-models-settings.test.tsxindex a8df4c3ff3d..9a17434184e 100644--- a/apps/desktop/src/app/settings/local-models-settings.test.tsx+++ b/apps/desktop/src/app/settings/local-models-settings.test.tsx@@ -150,20 +150,21 @@ describe('LocalModelsSettings', () => {expect(await screen.findByText('Qwen3.6 27B')).toBeTruthy()// The fitting model reads as pills, not prose: green memory pill +- // full-context pill (start_window == native here).+ // green full-context pill (start_window == native, resident on GPU).expect(screen.getByText('Fits your GPU')).toBeTruthy()- expect(screen.getByText('Full 256K context')).toBeTruthy()+ expect(screen.getByText('Full 256K context').className).toContain('emerald')// The refused model is NOT hidden (discoverability rule): red memory- // pill, and the ceiling it would have had (spilled model shows one too).+ // pill, plus the ceiling it would have had.expect(screen.getByText('Huge Model')).toBeTruthy()expect(screen.getByText('Too big for this machine')).toBeTruthy()- expect(screen.getAllByText('Up to 256K').length).toBeGreaterThanOrEqual(1)- // The spilled model reads amber + a start/ceiling pair.+ // The spilled model reads amber + ONE quiet ceiling pill — the same+ // 'Up to' shape the refused row wears; no start/grow pair.expect(screen.getByText('Spilled Model')).toBeTruthy()expect(screen.getByText('Uses system RAM')).toBeTruthy()- expect(screen.getByText('Starts at 64K')).toBeTruthy()+ expect(screen.getAllByText('Up to 256K context').length).toBe(2)+ expect(screen.queryByText(/Starts at/)).toBeNull()// Its download button is disabled; the fitting model's is enabled once// the runtime exists (here runtime_installed=false, so both disabled —@@ -172,6 +173,41 @@ describe('LocalModelsSettings', () => {expect(buttons.every(b => (b as HTMLButtonElement).disabled)).toBe(true)})+ it('orders the catalog by fit: resident first, then spilled, then too-big', async () => {+ // Scrambled input — the pane, not the backend, owns display order.+ mocked.getLocalCatalog.mockResolvedValue({ models: [REFUSED_MODEL, SPILLED_MODEL, FITTING_MODEL] })+ await renderFullPane()+ await screen.findByText('Qwen3.6 27B')++ // The matched element is the row-title span; the recommended row's+ // includes its nested pill copy — strip it before comparing order.+ const names = screen+ .getAllByText(/^(Qwen3\.6 27B|Spilled Model|Huge Model)$/)+ .map(el => el.textContent?.replace('Recommended', ''))++ expect(names).toEqual(['Qwen3.6 27B', 'Spilled Model', 'Huge Model'])+ })++ it('never greens the full-context pill on a system-RAM model', async () => {+ // Full native window, but earned by spilling into system RAM: the+ // pill must not wear the green that would recommend exactly the+ // wrong model.+ const spilledFull: LocalCatalogModel = {+ ...FITTING_MODEL,+ id: 'Spilled-Full',+ display_name: 'Spilled Full',+ recommended: false,+ spilled: true,+ fit_summary: 'runs its full 256K context, partly from system RAM'+ }++ mocked.getLocalCatalog.mockResolvedValue({ models: [spilledFull] })+ await renderFullPane()+ await screen.findByText('Spilled Full')++ expect(screen.getByText('Full 256K context').className).not.toContain('emerald')+ })+it('enables downloads only once the runtime is installed', async () => {mocked.getLocalModelsStatus.mockResolvedValue({...BASE_STATUS,diff --git a/apps/desktop/src/app/settings/local-models-settings.tsx b/apps/desktop/src/app/settings/local-models-settings.tsxindex 16a1bdc84e8..504a9fbb173 100644--- a/apps/desktop/src/app/settings/local-models-settings.tsx+++ b/apps/desktop/src/app/settings/local-models-settings.tsx@@ -56,6 +56,21 @@ function gbLabel(bytes: number | null | undefined): string {return `${(bytes / (1 << 30)).toFixed(1)} GB`}+// Catalog display order: what runs well leads. Resident (all on GPU)+// first, then spilled (works, slower), then doesn't-fit; catalog order+// (recommended first) holds within each band.+function fitRank(model: LocalCatalogModel): number {+ if (model.fits && !model.spilled) {+ return 0+ }++ if (model.fits) {+ return 1+ }++ return 2+}+export function LocalModelsSettings() {const { t } = useI18n()const copy = t.settings.localModels@@ -267,6 +282,8 @@ export function LocalModelsSettings() {const rJob = runningRuntimeInstall(jobs)const lastError = jobs.find(j => j.status === 'error')+ const sortedCatalog = [...catalog].sort((a, b) => fitRank(a) - fitRank(b))+// ── Quickstart: the dummy-proof front door ──// Until something is servable (runtime + at least one model), the pane// leads with a hero that does everything in one click; the full pane@@ -532,7 +549,7 @@ export function LocalModelsSettings() {{/* ── Models ── */}<SettingsSection icon={Download} meta={`${catalog.length}`} title={copy.modelsTitle}><div className="grid gap-1">- {catalog.map(model => {+ {sortedCatalog.map(model => {const dJob = runningDownloadFor(jobs, model.id)const anyDownloadRunning = jobs.some(j => j.kind === 'model-download' && j.status === 'running')const activateTarget = model.downloaded_model_id ?? model.model_id@@ -677,23 +694,24 @@ export function LocalModelsSettings() {</Tip>)}- {/* Context: where it starts, and how far it can grow.- A model granted its full native window collapses- both into one green pill. */}+ {/* Context: one pill. Green 'Full X context' only when+ the model earned its complete window resident on the+ GPU — a big context served from system RAM is slow,+ and a green badge there would sell exactly the wrong+ model, so a spilled full window goes gray. Anything+ starting below its native window gets one quiet+ 'Up to' pill instead of a start/grow pair. */}{model.fits && model.start_window_label && (model.start_window && model.start_window >= model.native_context ? (<Tip label={copy.pillFullContextTip}>- <Pill tone="success">{copy.pillFullContext(model.native_context_label)}</Pill>+ <Pill tone={model.spilled ? 'muted' : 'success'}>+ {copy.pillFullContext(model.native_context_label)}+ </Pill></Tip>) : (- <>- <Tip label={copy.pillStartsTip}>- <Pill>{copy.pillStarts(model.start_window_label)}</Pill>- </Tip>- <Tip label={copy.pillGrowsTip}>- <Pill>{copy.pillUpTo(model.native_context_label)}</Pill>- </Tip>- </>+ <Tip label={copy.pillGrowsTip}>+ <Pill>{copy.pillUpTo(model.native_context_label)}</Pill>+ </Tip>))}