From 6d6b52e10e04242ce849ae886e62127594c734ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Battistella=20Nadas?= Date: Tue, 9 Jun 2026 18:39:30 +0200 Subject: [PATCH] fix: don't show "unloads in" when keep_alive=-1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the radagast server flipped to OLLAMA_KEEP_ALIVE=-1, /api/ps returns expires_at as year 4001 (effectively forever), which the old code rendered as "Hot: gemma2:9b — unloads in 17500000h". Add a 7-day threshold to formatRemaining(); anything beyond that just shows the model name with no expiry suffix. --- CHANGELOG.md | 3 +++ static/index.html | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8c4819..78f59b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ Versioning: [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Added - "Scan image" button next to the input pane: opens the phone's rear camera (or a file picker on desktop), runs OCR locally in the browser via Tesseract.js (loaded from esm.sh on first use), and replaces the editor contents with the recognised text. Language follows the "From" dropdown via an ISO 639-2 mapping; "Auto-detect" loads a common European set (`eng+por+deu+nld`). Progress status shows beneath the input ("Loading OCR engine…" → "OCR 40%" → "OCR done in 3.2s"). Zero image-size cost — same CDN pattern as CodeMirror. +### Fixed +- "Hot: …" status no longer claims "unloads in X" when the server's `keep_alive` is `-1` (Ollama returns an absurd year-4001 `expires_at`). Threshold: any expiry >7 days drops the suffix and just shows the model name. + ## [0.2.0] - 2026-06-09 ### Added diff --git a/static/index.html b/static/index.html index 7120f21..2d0dae5 100644 --- a/static/index.html +++ b/static/index.html @@ -547,6 +547,10 @@ if (!expiresAt) return null; const ms = new Date(expiresAt).getTime() - Date.now(); if (!isFinite(ms) || ms <= 0) return null; + // Ollama's keep_alive=-1 returns expires_at far in the future (year 4001). + // Any realistic finite keep_alive is hours at most, so treat >7 days + // as "never unloads" and drop the misleading suffix. + if (ms > 7 * 24 * 60 * 60 * 1000) return null; const totalSec = Math.floor(ms / 1000); const mins = Math.floor(totalSec / 60); const secs = totalSec % 60;