From a91c13867d8e0163ad25cca90edaa67794f555fb Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Wed, 4 Feb 2026 17:04:31 -0800 Subject: [PATCH] fix: filter cloud models from API response --- admin/app/services/ollama_service.ts | 16 ++++++++++++---- admin/types/ollama.ts | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/admin/app/services/ollama_service.ts b/admin/app/services/ollama_service.ts index 090c3ad..9db5ac2 100644 --- a/admin/app/services/ollama_service.ts +++ b/admin/app/services/ollama_service.ts @@ -221,10 +221,18 @@ export class OllamaService { return null } - const models = response.data.models as NomadOllamaModel[] + const rawModels = response.data.models as NomadOllamaModel[] + + // Filter out tags where cloud is truthy, then remove models with no remaining tags + const noCloud = rawModels + .map((model) => ({ + ...model, + tags: model.tags.filter((tag) => !tag.cloud), + })) + .filter((model) => model.tags.length > 0) - await this.writeModelsToCache(models) - return this.sortModels(models, sort) + await this.writeModelsToCache(noCloud) + return this.sortModels(noCloud, sort) } catch (error) { logger.error( `[OllamaService] Failed to retrieve models from Nomad API: ${error instanceof Error ? error.message : error @@ -333,7 +341,7 @@ export class OllamaService { private fuseSearchModels(models: NomadOllamaModel[], query: string): NomadOllamaModel[] { const options: IFuseOptions = { ignoreDiacritics: true, - keys: ['name', 'description', 'tags.tag'], + keys: ['name', 'description', 'tags.name'], threshold: 0.3, // lower threshold for stricter matching } diff --git a/admin/types/ollama.ts b/admin/types/ollama.ts index 304136e..f7168fe 100644 --- a/admin/types/ollama.ts +++ b/admin/types/ollama.ts @@ -13,6 +13,7 @@ export type NomadOllamaModelTag = { size: string context: string input: string + cloud: boolean } export type NomadOllamaModelAPIResponse = {