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 (codex): make /catalog HF enrichment opt-in (?variants=1)
[._.]/ Adam Eivyefcb1971eeb9
diff --git a/client/src/components/settings/LocalLlmTab.jsx b/client/src/components/settings/LocalLlmTab.jsxindex daf9f5259c..6133cba612 100644--- a/client/src/components/settings/LocalLlmTab.jsx+++ b/client/src/components/settings/LocalLlmTab.jsx@@ -276,7 +276,7 @@ export function LocalLlmTab() {setCatalogError('');const request = source === 'huggingface'? getLocalLlmHuggingFaceSearch(backend, q, category, 18)- : getLocalLlmCatalog(backend, q);+ : getLocalLlmCatalog(backend, q, { variants: true });return request.then((r) => {if (requestId !== catalogRequestId.current) return;diff --git a/client/src/services/apiLocalLlm.js b/client/src/services/apiLocalLlm.jsindex ea0fe8d15a..dd156f77a1 100644--- a/client/src/services/apiLocalLlm.js+++ b/client/src/services/apiLocalLlm.js@@ -8,8 +8,12 @@ export const getLocalLlmStatus = (options) => request('/local-llm/status', optio// provider id that serves it. Powers the LoRA caption-model picker.export const getVisionModels = (options) => request('/local-llm/vision-models', options);-export const getLocalLlmCatalog = (backend, q = '') =>- request(`/local-llm/catalog?backend=${encodeURIComponent(backend)}${q ? `&q=${encodeURIComponent(q)}` : ''}`);+// `variants: true` opts into per-quant RAM-aware enrichment (probes Hugging Face+// per HF-backed entry) — the recommended-models picker wants it. Callers that only+// need catalog metadata (e.g. the playground decorating installed models) omit it+// to keep the response fast and fully local.+export const getLocalLlmCatalog = (backend, q = '', { variants = false } = {}) =>+ request(`/local-llm/catalog?backend=${encodeURIComponent(backend)}${q ? `&q=${encodeURIComponent(q)}` : ''}${variants ? '&variants=1' : ''}`);export const getLocalLlmHuggingFaceSearch = (backend, q = '', category = 'all', limit = 12) =>request(`/local-llm/huggingface-search?backend=${encodeURIComponent(backend)}&category=${encodeURIComponent(category)}&limit=${encodeURIComponent(limit)}${q ? `&q=${encodeURIComponent(q)}` : ''}`);diff --git a/server/routes/localLlm.js b/server/routes/localLlm.jsindex a7a20a0889..abe85945aa 100644--- a/server/routes/localLlm.js+++ b/server/routes/localLlm.js@@ -61,7 +61,7 @@ router.get('/vision-models', asyncHandler(async (_req, res) => {// RAM-aware default as the live Hugging Face search, so the recommended quant// fits this machine instead of being hard-coded per model.router.get('/catalog', asyncHandler(async (req, res) => {- const { backend, q } = req.query+ const { backend, q, variants } = req.queryif (!isBackend(backend)) throw new ServerError('backend must be "ollama" or "lmstudio"', { status: 400 })const installedModels = await listModels(backend)// getCatalog/searchCatalog normalize raw ids (no `@quant` suffix) — feed them the@@ -77,7 +77,13 @@ router.get('/catalog', asyncHandler(async (req, res) => {// Total system memory drives the RAM-aware recommended quant (unified memory on// Apple Silicon also backs the GPU, so a big box can default to higher fidelity).const systemMemoryBytes = os.totalmem()- await enrichCatalogWithVariants(models, { backend, systemMemoryBytes, installedIds: installedForVariants })+ // Quant-variant enrichment probes Hugging Face per HF-backed entry, so it's+ // opt-in (`?variants=1`): the recommended-models picker requests it, but callers+ // that only need catalog metadata (e.g. the playground decorating installed+ // models) get the fast, fully-local response the catalog has always been.+ if (variants === '1' || variants === 'true') {+ await enrichCatalogWithVariants(models, { backend, systemMemoryBytes, installedIds: installedForVariants })+ }res.json({ backend, models, systemMemoryGb: Math.round(systemMemoryBytes / 1024 ** 3) })}))diff --git a/server/routes/localLlm.test.js b/server/routes/localLlm.test.jsindex 6f90f241c8..46bfa0ca27 100644--- a/server/routes/localLlm.test.js+++ b/server/routes/localLlm.test.js@@ -4,6 +4,7 @@ import { request } from '../lib/testHelper.js';import localLlmRoutes from './localLlm.js';import { runLocalLlmTest, compareLocalLlmModels } from '../services/localLlmPlayground.js';import { listModels } from '../services/localLlm.js';+import { enrichCatalogWithVariants } from '../services/huggingFaceCatalog.js';import { getLoadedModels, unloadModel } from '../services/ollamaManager.js';import { localLlmCompareSchema, localLlmTestSchema } from '../lib/validation.js';import { errorEvents } from '../lib/errorHandler.js';@@ -57,20 +58,31 @@ describe('local LLM playground routes', () => {vi.clearAllMocks();});- it('GET /catalog keeps an installed LM Studio recommendation installed when HF enrichment is a no-op', async () => {+ it('GET /catalog?variants=1 keeps an installed LM Studio recommendation installed (raw-id overlay)', async () => {// The route appends LM Studio's quantization to the enrichment installed list,- // but getCatalog's normalizer can't parse `@quant` — so the offline overlay must- // get the RAW ids, or an already-installed model wrongly shows Install when HF is down.+ // but getCatalog's normalizer can't parse `@quant` — so the overlay must get the+ // RAW ids, or an already-installed model wrongly shows Install. (Enrichment is+ // mocked to a no-op, simulating HF being unreachable.)listModels.mockResolvedValue([{ id: 'lmstudio-community/Llama-3.2-3B-Instruct-GGUF', quantization: 'Q4_K_M' }]);- const res = await request(makeApp()).get('/api/local-llm/catalog?backend=lmstudio');+ const res = await request(makeApp()).get('/api/local-llm/catalog?backend=lmstudio&variants=1');expect(res.status).toBe(200);+ expect(enrichCatalogWithVariants).toHaveBeenCalled();const entry = res.body.models.find((m) => m.id === 'lmstudio-community/Llama-3.2-3B-Instruct-GGUF');expect(entry).toBeTruthy();expect(entry.installed).toBe(true);});+ it('GET /catalog skips HF enrichment unless variants=1 (fast local path for the playground)', async () => {+ const res = await request(makeApp()).get('/api/local-llm/catalog?backend=ollama');++ expect(res.status).toBe(200);+ expect(Array.isArray(res.body.models)).toBe(true);+ // The playground only needs catalog metadata — it must not pay for HF probes.+ expect(enrichCatalogWithVariants).not.toHaveBeenCalled();+ });+it('runs a single local model test with validated defaults', async () => {runLocalLlmTest.mockResolvedValue({backend: 'ollama',