Project NOMAD is an offline-first knowledge and education server. Wikipedia, thousands of books, courses, maps, and optional local AI, all running on hardware you own with no internet required.
TypeScript
fix: filter cloud models from API response
Jake Turnera91c13867d8e
diff --git a/admin/app/services/ollama_service.ts b/admin/app/services/ollama_service.tsindex 090c3ade..9db5ac26 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<NomadOllamaModel> = {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.tsindex 304136ed..f7168fe1 100644--- a/admin/types/ollama.ts+++ b/admin/types/ollama.ts@@ -13,6 +13,7 @@ export type NomadOllamaModelTag = {size: stringcontext: stringinput: string+ cloud: boolean}export type NomadOllamaModelAPIResponse = {