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): constrain audio category to audio-signal results
Adam Eivy7fb86f6f2730
diff --git a/server/services/huggingFaceCatalog.js b/server/services/huggingFaceCatalog.jsindex 5f2999fd0e..5be3d56d95 100644--- a/server/services/huggingFaceCatalog.js+++ b/server/services/huggingFaceCatalog.js@@ -179,6 +179,16 @@ function extractParams(repoId) {// the auto-classify ('all') path.const AUDIO_RE = /(text-to-audio|text-to-music|text-to-speech|audio-to-audio|automatic-speech-recognition|musicgen|audioldm|stable-audio|ace-?step|magenta|\bbark\b|\bxtts\b)/+// Does this model actually look like an audio/music model? The audio category+// relaxes the GGUF filter, so without this predicate a non-audio query (e.g.+// "llama") would return unrelated models that `toResult` then mislabels as audio+// (requestedCategory short-circuits classifyModel). This keeps the Audio & Music+// results constrained to genuine audio models while still not requiring GGUF.+function hasAudioSignal(model) {+ const haystack = `${repoIdOf(model)} ${tagsOf(model).join(' ')} ${model?.pipeline_tag || ''}`.toLowerCase()+ return AUDIO_RE.test(haystack)+}+function classifyModel(model, requestedCategory) {if (CATEGORY_IDS.has(requestedCategory) && requestedCategory !== 'all') return requestedCategoryconst haystack = `${repoIdOf(model)} ${(tagsOf(model) || []).join(' ')} ${model?.pipeline_tag || ''}`.toLowerCase()@@ -436,7 +446,10 @@ export async function searchHuggingFaceModels({ backend, query = '', category =: []const live = models- .filter((model) => (ggufOnly ? hasGgufSignal(model) : true))+ // GGUF categories keep the GGUF signal filter; the audio category swaps it+ // for an audio-signal filter (relaxed off GGUF, but still audio-only) so a+ // non-audio query can't surface unrelated models mislabeled as audio.+ .filter((model) => (ggufOnly ? hasGgufSignal(model) : hasAudioSignal(model))).map((model) => toResult(model, backend, requestedCategory, installedIds, installedAudio)).filter(Boolean).filter((model) => {diff --git a/server/services/huggingFaceCatalog.test.js b/server/services/huggingFaceCatalog.test.jsindex e98898724e..7d1d1c1817 100644--- a/server/services/huggingFaceCatalog.test.js+++ b/server/services/huggingFaceCatalog.test.js@@ -145,6 +145,24 @@ describe('huggingFaceCatalog', () => {expect(byRepo['stabilityai/stable-audio-3-medium'].note).toMatch(/data-sharing agreement/i)})+ it('drops non-audio results from a non-audio query (no GGUF, but audio-only)', async () => {+ // category=audio relaxes the GGUF filter — but a query like "llama" must+ // not surface unrelated chat models mislabeled as audio. Only the curated+ // suggestions (which match the query? none here) should remain.+ fetch.mockResolvedValue(response([+ {+ modelId: 'meta-llama/Llama-3.1-8B-Instruct',+ downloads: 999999,+ tags: ['text-generation', 'safetensors'],+ pipeline_tag: 'text-generation',+ siblings: [{ rfilename: 'model.safetensors', size: 8_000_000_000 }]+ }+ ]))++ const results = await searchHuggingFaceModels({ backend: 'ollama', query: 'llama', category: 'audio' })+ expect(results.find((r) => r.repository === 'meta-llama/Llama-3.1-8B-Instruct')).toBeUndefined()+ })+it('marks an audio model installed when it is in the shared registry', async () => {fetch.mockResolvedValue(response([{