[object Object]

← back to Qwen38 Viewer

keep model warm (keep_alive 30m) to avoid ~2min cold loads

5db139838633086ad9fd78013b03c5c38993bfca · 2026-08-19 09:58:21 -0700 · steve

Files touched

Diff

commit 5db139838633086ad9fd78013b03c5c38993bfca
Author: steve <steve@designerwallcoverings.com>
Date:   Wed Aug 19 09:58:21 2026 -0700

    keep model warm (keep_alive 30m) to avoid ~2min cold loads
---
 server.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server.js b/server.js
index 568c362..f2d4717 100644
--- a/server.js
+++ b/server.js
@@ -14,6 +14,7 @@ const app = express();
 const PORT = process.env.PORT || 9821;
 const OLLAMA = process.env.OLLAMA_URL || 'http://127.0.0.1:11434';
 const MODEL = process.env.MODEL || 'qwen3.8-27b-heretic';
+const KEEP_ALIVE = process.env.KEEP_ALIVE || '30m'; // keep model warm to avoid ~2min cold loads
 
 // ---- Basic auth gate (fleet convention admin / DW2024!) --------------------
 const USER = process.env.BASIC_USER || 'admin';
@@ -62,7 +63,7 @@ app.post('/api/chat', async (req, res) => {
     const upstream = await fetch(`${OLLAMA}/api/chat`, {
       method: 'POST',
       headers: { 'Content-Type': 'application/json' },
-      body: JSON.stringify({ model: MODEL, messages, stream: true, options }),
+      body: JSON.stringify({ model: MODEL, messages, stream: true, options, keep_alive: KEEP_ALIVE }),
     });
     if (!upstream.ok || !upstream.body) {
       res.write(JSON.stringify({ error: `ollama ${upstream.status}` }) + '\n');

← 46278be qwen38-viewer: auth-gated web chat for local Qwen3.8-27B Her  ·  back to Qwen38 Viewer  ·  multi-user basic auth (admin + Dave) e9ac061 →