From ee096ee77a373d758c2e2e03a1ec157b1aaf34b4 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Thu, 24 Sep 2026 09:15:53 +0200 Subject: [PATCH] ui : fix the context column reading the hub Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash --- .../ui/src/lib/components/app/models/ModelContext.svelte | 2 +- tools/ui/src/lib/services/huggingface.service.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/ui/src/lib/components/app/models/ModelContext.svelte b/tools/ui/src/lib/components/app/models/ModelContext.svelte index 36cca3561a..a946487571 100644 --- a/tools/ui/src/lib/components/app/models/ModelContext.svelte +++ b/tools/ui/src/lib/components/app/models/ModelContext.svelte @@ -68,6 +68,6 @@ let context = $derived(reported ?? fetched); - + {context ? `${formatParameters(context)} tokens` : '—'} diff --git a/tools/ui/src/lib/services/huggingface.service.ts b/tools/ui/src/lib/services/huggingface.service.ts index 1072d1760f..9f9b21ac4c 100644 --- a/tools/ui/src/lib/services/huggingface.service.ts +++ b/tools/ui/src/lib/services/huggingface.service.ts @@ -517,7 +517,13 @@ export class HuggingFaceService { if (!response.ok) throw new Error(`Failed to fetch model details: ${response.status}`); - const data = (await response.json()) as HfModelDetailInfo; + // the hub answers with a list of provider entries for one repo, and the + // gguf and card data sit on the entry that carries them + const payload = (await response.json()) as HfModelDetailInfo | HfModelDetailInfo[]; + const entries = Array.isArray(payload) ? payload : [payload]; + const data = entries.find((entry) => entry?.gguf ?? entry?.cardData) ?? entries[0]; + + if (!data) return null; HuggingFaceService.detailsCache.set(modelId, data);