Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (claude): anchor HF result on a variant so install id matches the picker
[._.]/ Adam Eivyb85b7eaf101e
diff --git a/server/services/huggingFaceCatalog.js b/server/services/huggingFaceCatalog.jsindex 5d8f5dee59..4069956aba 100644--- a/server/services/huggingFaceCatalog.js+++ b/server/services/huggingFaceCatalog.js@@ -507,10 +507,17 @@ async function enrichWithSizes(results, { backend, usableBytes } = {}) {if (!isAudio) {const variants = buildVariants(model, backend, usableBytes)if (variants.length > 0) {- // RAM-aware default: only re-pick when we have a memory budget; without- // one, keep the QUANT_PRIORITY default chosen in toResult.- const chosen = usableBytes ? pickVariantForBudget(variants, usableBytes) : null- if (chosen) applyVariant(result, chosen)+ // Always anchor the result on one of its own variants so the install id+ // and the client's controlled <select> agree. Prefer the RAM-aware pick;+ // otherwise the QUANT_PRIORITY default toResult chose (matched by quant);+ // fall back to the largest variant. Without this, LM Studio's bare-repo+ // default id — and any repo where the blobs endpoint omits sizes, so the+ // budget pick can't fire — would match no variant, flagging zero+ // recommended and making Install pull a different quant than the one shown.+ const chosen = (usableBytes ? pickVariantForBudget(variants, usableBytes) : null)+ || variants.find((v) => v.quant && v.quant === result.quant)+ || variants[0]+ applyVariant(result, chosen)// Flag whichever variant the result now points at as recommended so the// UI can mark it (covers both the RAM-aware and QUANT_PRIORITY default).for (const v of variants) v.recommended = v.installId === result.iddiff --git a/server/services/huggingFaceCatalog.test.js b/server/services/huggingFaceCatalog.test.jsindex d1097327ae..9da101f7d8 100644--- a/server/services/huggingFaceCatalog.test.js+++ b/server/services/huggingFaceCatalog.test.js@@ -300,6 +300,23 @@ describe('huggingFaceCatalog', () => {// Bare-repo installed list still matches the quant-tagged result.expect(result.installed).toBe(true)})++ it('anchors the LM Studio default on a variant even when the repo omits file sizes', async () => {+ const repo = 'bartowski/NoSize-GGUF'+ fetch+ .mockResolvedValueOnce(listing(repo, ['NoSize-Q4_K_M.gguf', 'NoSize-Q8_0.gguf']))+ // HF's blobs endpoint sometimes omits per-file sizes — the budget pick+ // can't fire, but the default must still resolve to a real variant id.+ .mockResolvedValueOnce(response({ id: repo, siblings: [{ rfilename: 'NoSize-Q4_K_M.gguf' }, { rfilename: 'NoSize-Q8_0.gguf' }] }))++ const [result] = await searchHuggingFaceModels({ backend: 'lmstudio', query: 'nosize', systemMemoryBytes: 128 * 1024 ** 3 })++ expect(result.variants.map((v) => v.installId)).toEqual([`${repo}@Q4_K_M`, `${repo}@Q8_0`])+ // Falls back to the QUANT_PRIORITY pick (Q4_K_M) as the default — and it+ // must equal a listed variant so the client's controlled <select> matches.+ expect(result.id).toBe(`${repo}@Q4_K_M`)+ expect(result.variants.find((v) => v.recommended).installId).toBe(result.id)+ })})describe('audio installed registry', () => {