ui : fix the context column reading the hub

Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash
This commit is contained in:
Aleksander Grygier
2026-09-28 12:10:12 +02:00
parent d56bd2d9ca
commit ee096ee77a
2 changed files with 8 additions and 2 deletions
@@ -68,6 +68,6 @@
let context = $derived(reported ?? fetched);
</script>
<span class={['text-sm text-muted-foreground', className]}>
<span bind:this={el} class={['text-sm text-muted-foreground', className]}>
{context ? `${formatParameters(context)} tokens` : '—'}
</span>
@@ -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);