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(models): Dedup versteckt keine eigene Quant-Datei mehr hinter einer kollabierten LM-Studio-Zeile

purpleb33ab8457a04
diff --git a/src/lib/__tests__/lu-engine-groups.test.ts b/src/lib/__tests__/lu-engine-groups.test.ts
index fc52e1a3..4a032ce9 100644
--- a/src/lib/__tests__/lu-engine-groups.test.ts
+++ b/src/lib/__tests__/lu-engine-groups.test.ts
@@ -99,20 +99,42 @@ describe('de-duplication asks about the FILE, never about the model', () => {
// A14 second review: the collapsed id is the COMMON case, not the exotic
// one. LM Studio reports "qwen/qwen2.5-0.5b-instruct" with no quant at all
- // whenever it holds exactly one quant of a model, which is most of the time,
- // and the strict rule kept both rows for one file. One nameless row and
- // exactly one file of that identity can only be each other.
- it('drops the row for a collapsed LM Studio id when we hold exactly one such file', () => {
- const q8 = luFile('Qwen2.5-0.5B-Instruct-Q8_0')
- expect(dropDuplicateLuEngineRows([q8], lmsHas('qwen/qwen2.5-0.5b-instruct'))).toEqual([])
+ // whenever it holds exactly one quant of a model, which is most of the time.
+ // A14 third review pinned the price of that shortcut: it may only be walked
+ // when OUR side is nameless too. One nameless row and one nameless file of
+ // that identity can only be each other.
+ it('drops the row for a collapsed LM Studio id when our file names no quant either', () => {
+ const ours = luFile('Qwen2.5-0.5B-Instruct')
+ // The plain spelling, where the two filenames already match.
+ expect(dropDuplicateLuEngineRows([ours], lmsHas('qwen/qwen2.5-0.5b-instruct'))).toEqual([])
+ // And the one route 3 exists for: the same model identity written without
+ // the trailing decoration word, so no filename comparison can join them.
+ expect(dropDuplicateLuEngineRows([ours], lmsHas('qwen/qwen2.5-0.5b'))).toEqual([])
})
- // NEGATIVE CONTROL for that route: with TWO quants of the model in our
- // folder, a nameless LM Studio row cannot say which of them it is. Dropping
- // either would be a guess, so both stay.
+ // THE A14 THIRD REVIEW FINDING, and David's own machine: ~/lu-e2e-models
+ // holds Qwen2.5-0.5B-Instruct-Q8_0.gguf, LM Studio reports the collapsed id
+ // because it happens to hold one quant, and that quant may be a Q4_K_M in a
+ // completely different folder. Our file names its quant, so the two are not
+ // the same file as far as anyone here can prove, and the row that would go
+ // missing is the one the whole feature exists to show.
+ it('keeps our named quant beside a collapsed LM Studio id', () => {
+ const q8 = {
+ name: 'openai::Qwen2.5-0.5B-Instruct-Q8_0',
+ model: 'Qwen2.5-0.5B-Instruct-Q8_0',
+ path: '/Users/d/lu-e2e-models/Qwen2.5-0.5B-Instruct-Q8_0.gguf',
+ provider: 'openai',
+ providerName: 'LU Engine',
+ }
+ expect(dropDuplicateLuEngineRows([q8], lmsHas('qwen/qwen2.5-0.5b-instruct'))).toEqual([q8])
+ })
+
+ // NEGATIVE CONTROL for that route: with TWO nameless files of the model in
+ // our folder, a nameless LM Studio row cannot say which of them it is.
+ // Dropping either would be a guess, so both stay.
it('keeps both when a collapsed id could mean either of two files we hold', () => {
- const rows = [luFile('Qwen2.5-0.5B-Instruct-Q8_0'), luFile('Qwen2.5-0.5B-Instruct-Q4_K_M')]
- expect(dropDuplicateLuEngineRows(rows, lmsHas('qwen/qwen2.5-0.5b-instruct'))).toEqual(rows)
+ const rows = [luFile('Qwen2.5-0.5B-Instruct'), luFile('Qwen2.5-0.5B-Chat')]
+ expect(dropDuplicateLuEngineRows(rows, lmsHas('qwen/qwen2.5-0.5b'))).toEqual(rows)
})
it('drops the row when the file itself lies in LM Studio own store', () => {
diff --git a/src/lib/lu-engine-rows.ts b/src/lib/lu-engine-rows.ts
index b2449aad..58feffa8 100644
--- a/src/lib/lu-engine-rows.ts
+++ b/src/lib/lu-engine-rows.ts
@@ -57,10 +57,20 @@ export const LU_ENGINE_GROUP = 'LU Engine'
* 2. our file lies inside LM Studio's own store, which is what happens the
* moment the folder is pointed at ~/.lmstudio/models. Then it IS LM
* Studio's file and the model identity is enough.
- * 3. LM Studio names no quant and we hold exactly ONE file of that identity.
- * One file and one nameless row can only be each other. Two files of the
- * same identity and a nameless row cannot be told apart, so nothing is
- * dropped and the user keeps both.
+ * 3. NEITHER side names a quant and we hold exactly ONE file of that
+ * identity. One nameless file and one nameless row can only be each
+ * other. Two files of the same identity and a nameless row cannot be told
+ * apart, so nothing is dropped and the user keeps both.
+ *
+ * A14 third review: route 3 used to ask only whether LM STUDIO named a quant,
+ * so a Q8_0 of our own went away behind a collapsed row that may well have
+ * been a Q4_K_M somewhere else entirely. That is the "two files, one of them
+ * hidden" the paragraph above forbids, arrived at from the other side, and it
+ * hit the exact machine this change is about: ~/lu-e2e-models holding
+ * Qwen2.5-0.5B-Instruct-Q8_0.gguf. Our own quant is knowledge, and a route
+ * that throws knowledge away to reach a guess is not a route. The case where
+ * the collapsed row really is our file is already covered by route 2, which
+ * proves it from the path instead of guessing it from the name.
*/
export function dropDuplicateLuEngineRows<T extends InstalledModelLike>(
bundled: T[],
@@ -137,8 +147,11 @@ function sameFile(
// Route 2: our file IS in LM Studio's store, so the identity settles it.
if (sameModel && livesInLmStudioStore(ours)) return true
- // Route 3: LM Studio names no quant and we hold exactly one such file.
- if (sameModel && !namesAQuant(other) && ownByIdentity.get(ourIdentity) === 1) return true
+ // Route 3: neither side names a quant and we hold exactly one such file.
+ // Our own quant, where we have one, is evidence and not noise: a collapsed
+ // LM Studio row could be any quant at any path, so it cannot be shown to be
+ // our Q8_0. Route 2 above is the way that case is settled honestly.
+ if (sameModel && !namesAQuant(other) && !namesAQuant(ours) && ownByIdentity.get(ourIdentity) === 1) return true
// Otherwise the strict rule: same filename, or the same quant named on both
// sides. A missing quant on either side is not evidence.