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(picker): die LU-Cloud-Leiste zeigt jedes Mal dieselben fuenf, und nennt den Rest

purplee7b2b4409b6f
diff --git a/src/components/models/ModelSelector.tsx b/src/components/models/ModelSelector.tsx
index 3157c66b..687b429b 100644
--- a/src/components/models/ModelSelector.tsx
+++ b/src/components/models/ModelSelector.tsx
@@ -17,6 +17,7 @@ import { isLmStudioProvider } from '../../lib/hf-to-provider'
import { lmStudioSlotUpdate, adoptionReplacesBuiltinEngine } from '../../lib/lmstudio-backend-adopt'
import { nextProbeDelayMs } from '../../lib/probe-backoff'
import { noChatBackendEnabled } from '../../lib/provider-visibility'
+import { cloudTeaserModels } from '../../lib/cloud-teaser-models'
import type { AIModel } from '../../types/models'
// ── Local-mode cloud discovery (2.5.8): an "LU Cloud" section at the list's
@@ -31,7 +32,14 @@ function CloudTeaserSection({ onOpen }: { onOpen: () => void }) {
const setCloudGateOpen = useUIStore((s) => s.setCloudGateOpen)
const allModels = useModelStore((s) => s.models)
if (appMode === 'cloud' || !teasersEnabled) return null
- const cloudChat = allModels.filter((m) => m.provider === 'lu-cloud' && m.type === 'text').slice(0, 5)
+ // The five used to be the head of the list as `/v1/models` happened to send
+ // it, and that order is not stable, so the strip showed a different five on
+ // every look (Nebenbefund 3, R9 re-measure). Same five every time now, and
+ // the ones that did not fit are counted instead of silently dropped.
+ const { shown: cloudChat, more: cloudMore } = cloudTeaserModels(
+ allModels.filter((m) => m.provider === 'lu-cloud' && m.type === 'text'),
+ (m) => (('displayName' in m && m.displayName) || displayModelName(m.name)) as string,
+ )
const open = () => { onOpen(); setCloudGateOpen(true) }
return (
<div className="mt-1 border-t border-white/[0.05]">
@@ -41,8 +49,7 @@ function CloudTeaserSection({ onOpen }: { onOpen: () => void }) {
LU Cloud
</span>
</div>
- {cloudChat.length > 0 ? (
- cloudChat.map((m) => (
+ {cloudChat.map((m) => (
<button
key={m.name}
onClick={open}
@@ -55,8 +62,19 @@ function CloudTeaserSection({ onOpen }: { onOpen: () => void }) {
</span>
<span className="ml-auto text-[8px] text-violet-500 dark:text-violet-200">Cloud</span>
</button>
- ))
- ) : (
+ ))}
+ {cloudChat.length > 0 && cloudMore > 0 && (
+ <button
+ onClick={open}
+ className="w-full flex items-center gap-2 px-2.5 py-1.5 text-left hover:bg-white/[0.04] transition-colors"
+ title="See the whole hosted catalogue"
+ >
+ <span className="text-[0.62rem] text-gray-500">
+ {cloudMore} more cloud {cloudMore === 1 ? 'model' : 'models'}, see them all
+ </span>
+ </button>
+ )}
+ {cloudChat.length === 0 && (
<button
onClick={open}
className="w-full flex items-center gap-2 px-2.5 py-1.5 text-left hover:bg-white/[0.04] transition-colors"
diff --git a/src/lib/__tests__/cloud-teaser-stable.test.ts b/src/lib/__tests__/cloud-teaser-stable.test.ts
new file mode 100644
index 00000000..9aeed09d
--- /dev/null
+++ b/src/lib/__tests__/cloud-teaser-stable.test.ts
@@ -0,0 +1,114 @@
+/**
+ * Nebenbefund 3 of the R9 re-measure on the real 2.6.7 Windows build
+ * (2026-08-30, ergebnis-r9-nachmessung.md): the LU CLOUD group in the chat
+ * model picker showed a different set of five on every look. Five measurements,
+ * five different groups. The tester's words: whoever wants to find one
+ * particular cloud model again is in for a long hunt.
+ *
+ * Checked whether that is a deliberate rotation. It is not. The app has no
+ * rotation, no sampling and no shuffle anywhere on that path: the strip took
+ * the first five models exactly as `/v1/models` handed them over, and that
+ * payload has no rank field, no "featured" flag and no promised order, so which
+ * five arrived was decided by the order of the last answer. The strip also
+ * never said the list was longer than five.
+ *
+ * The two model sets below are the two the re-measure wrote down, in the order
+ * it wrote them down.
+ *
+ * Run: npx vitest run src/lib/__tests__/cloud-teaser-stable.test.ts
+ */
+import { describe, it, expect } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import { dirname, resolve } from 'node:path'
+
+import { cloudTeaserModels, CLOUD_TEASER_LIMIT } from '../cloud-teaser-models'
+
+const here = dirname(fileURLToPath(import.meta.url))
+const repo = resolve(here, '../../..')
+const modelSelector = readFileSync(resolve(repo, 'src/components/models/ModelSelector.tsx'), 'utf8')
+
+const m = (displayName: string) => ({ name: `lu-cloud::${displayName}`, displayName })
+
+/** The ten models the two measurements between them showed. */
+const CATALOGUE = [
+ m('DeepSeek V4 Flash 0731'), m('Qwen3 VL 30B'), m('DeepSeek R1'),
+ m('Qwen 3.5 397B A17B'), m('Kimi K3'), m('gpt-oss 120B'), m('GLM 5'),
+ m('Hermes 3 405B'), m('Qwen 3.6 27B'), m('Qwen 3.6 35B A3B'),
+]
+
+/** The same ten as the second measurement happened to receive them. */
+const REORDERED = [
+ m('gpt-oss 120B'), m('GLM 5'), m('Hermes 3 405B'), m('Qwen 3.6 27B'),
+ m('Qwen 3.6 35B A3B'), m('DeepSeek V4 Flash 0731'), m('Qwen3 VL 30B'),
+ m('DeepSeek R1'), m('Qwen 3.5 397B A17B'), m('Kimi K3'),
+]
+
+const labels = (list: { displayName?: string }[]) => list.map((x) => x.displayName)
+
+describe('THE FIX: the same five stand there every time', () => {
+ it('two payload orders of one catalogue give one strip', () => {
+ expect(labels(cloudTeaserModels(CATALOGUE).shown))
+ .toEqual(labels(cloudTeaserModels(REORDERED).shown))
+ })
+
+ it('and the order inside the strip is the same too, not just the set', () => {
+ expect(labels(cloudTeaserModels(REORDERED).shown)).toEqual([
+ 'DeepSeek R1', 'DeepSeek V4 Flash 0731', 'GLM 5', 'gpt-oss 120B', 'Hermes 3 405B',
+ ])
+ })
+
+ it('a reversed payload changes nothing either', () => {
+ expect(labels(cloudTeaserModels([...CATALOGUE].reverse()).shown))
+ .toEqual(labels(cloudTeaserModels(CATALOGUE).shown))
+ })
+
+ it('the models that did not fit are counted, not silently dropped', () => {
+ expect(cloudTeaserModels(CATALOGUE).more).toBe(CATALOGUE.length - CLOUD_TEASER_LIMIT)
+ })
+
+ it('case does not decide the order, so gpt-oss lands with the g names', () => {
+ // A naive sort would put every lowercase name behind every capital one.
+ expect(labels(cloudTeaserModels(CATALOGUE).shown)).toContain('gpt-oss 120B')
+ })
+})
+
+describe('NEGATIVE CONTROL: what must not change', () => {
+ it('the strip still shows at most five', () => {
+ expect(cloudTeaserModels(CATALOGUE).shown).toHaveLength(CLOUD_TEASER_LIMIT)
+ })
+
+ it('a short catalogue shows everything and counts no rest', () => {
+ const short = CATALOGUE.slice(0, 3)
+ expect(cloudTeaserModels(short).shown).toHaveLength(3)
+ expect(cloudTeaserModels(short).more).toBe(0)
+ })
+
+ it('an empty catalogue stays empty, the logged-out row is the picker`s job', () => {
+ expect(cloudTeaserModels([]).shown).toEqual([])
+ expect(cloudTeaserModels([]).more).toBe(0)
+ })
+
+ it('the caller`s array is not reordered under it', () => {
+ const given = [...CATALOGUE]
+ cloudTeaserModels(given)
+ expect(labels(given)).toEqual(labels(CATALOGUE))
+ })
+})
+
+describe('the wiring, so the rule reaches the screen', () => {
+ it('the picker sorts through the rule instead of slicing the raw list', () => {
+ expect(modelSelector).toMatch(/const \{ shown: cloudChat, more: cloudMore \} = cloudTeaserModels\(/)
+ expect(modelSelector).not.toMatch(/m\.type === 'text'\)\.slice\(0, 5\)/)
+ })
+
+ it('it sorts by the label the user reads, not the raw id', () => {
+ expect(modelSelector).toMatch(
+ /cloudTeaserModels\([\s\S]{0,200}displayName\) \|\| displayModelName\(m\.name\)/,
+ )
+ })
+
+ it('and the rest is offered instead of hidden', () => {
+ expect(modelSelector).toMatch(/\{cloudMore\} more cloud \{cloudMore === 1 \? 'model' : 'models'\}, see them all/)
+ })
+})
diff --git a/src/lib/cloud-teaser-models.ts b/src/lib/cloud-teaser-models.ts
new file mode 100644
index 00000000..05a9cf46
--- /dev/null
+++ b/src/lib/cloud-teaser-models.ts
@@ -0,0 +1,54 @@
+/**
+ * Which hosted models the LU Cloud strip in the chat picker shows, and in what
+ * order.
+ *
+ * Nebenbefund 3 of the R9 re-measure on the 2.6.7 Windows build (2026-08-30):
+ * in five looks at the picker, the LU CLOUD group showed five different groups
+ * of five, once "DeepSeek V4 Flash 0731, Qwen3 VL 30B, DeepSeek R1, Qwen 3.5
+ * 397B A17B, Kimi K3", shortly after "gpt-oss 120B, GLM 5, Hermes 3 405B, Qwen
+ * 3.6 27B, Qwen 3.6 35B A3B". It reads like a deliberately rotating taster.
+ *
+ * It is not one. Nothing in the app rotates, samples or shuffles that list:
+ * the strip took `.slice(0, 5)` off the models exactly as `/v1/models` handed
+ * them over, and that payload carries no rank, no "featured" flag and no
+ * stable order, so which five reach the screen is decided by whatever order
+ * the last answer happened to arrive in. The strip also never said the list
+ * was longer than five, so a model seen once looked simply gone.
+ *
+ * The answer is the smallest honest one: sort by the label the user reads, so
+ * the same five stand there every time, and name the number that did not fit.
+ */
+
+export const CLOUD_TEASER_LIMIT = 5
+
+export interface TeaserModel {
+ name: string
+ displayName?: string
+}
+
+/** Deterministic, locale-independent: case-folded label, `name` breaks ties. */
+function byLabel<T extends TeaserModel>(labelOf: (m: T) => string) {
+ return (a: T, b: T): number => {
+ const la = labelOf(a).toLowerCase()
+ const lb = labelOf(b).toLowerCase()
+ if (la !== lb) return la < lb ? -1 : 1
+ if (a.name !== b.name) return a.name < b.name ? -1 : 1
+ return 0
+ }
+}
+
+/**
+ * The rows the strip draws, and how many hosted models it left out.
+ * `models` is not mutated.
+ */
+export function cloudTeaserModels<T extends TeaserModel>(
+ models: T[],
+ labelOf: (m: T) => string = (m) => m.displayName ?? m.name,
+ limit: number = CLOUD_TEASER_LIMIT,
+): { shown: T[]; more: number } {
+ const sorted = [...models].sort(byLabel(labelOf))
+ return {
+ shown: sorted.slice(0, limit),
+ more: Math.max(0, sorted.length - limit),
+ }
+}