← back to Macstudio2 Dashboard
feat: TEST button on Mac2 dashboard — same single-prompt latency check
2796cb340d53413191cccf2e1518d59ce5ddd90e · 2026-05-08 01:05:33 -0700 · SteveStudio2
Files touched
M public/index.htmlM server.js
Diff
commit 2796cb340d53413191cccf2e1518d59ce5ddd90e
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date: Fri May 8 01:05:33 2026 -0700
feat: TEST button on Mac2 dashboard — same single-prompt latency check
---
public/index.html | 33 ++++++++++++++++++++++++++++++---
server.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+), 3 deletions(-)
diff --git a/public/index.html b/public/index.html
index 9249110..4c16569 100644
--- a/public/index.html
+++ b/public/index.html
@@ -658,8 +658,21 @@ footer a { color: var(--gold); text-decoration: none; }
</div>
</div>
- <!-- Push-button shifter / hyperdrive controls -->
- <div class="controls">
+ <!-- last test result lozenge -->
+ <div id="test-result" style="margin-bottom:10px;text-align:center;font-family:'JetBrains Mono',monospace;font-size:12px;color:var(--gold);min-height:18px"></div>
+
+ <!-- Push-button shifter / hyperdrive controls (5 columns) -->
+ <div class="controls" style="grid-template-columns: repeat(5, 1fr)">
+ <button class="btn" data-mode="test" onclick="trigger('test', this)" style="border:3px solid var(--turq-dark)" title="Fires a tiny prompt at the loaded model, times the round-trip. Use to compare before/after BOOST.">
+ <span class="light"></span>
+ 🏁 Test
+ <span class="sub-label">prompt + latency check</span>
+ </button>
+ <button class="btn" data-mode="boost" onclick="trigger('boost', this)" style="border:3px solid var(--metal-glow)" title="Restart ollama with NUM_PARALLEL=4, MAX_LOADED=2, FLASH_ATTENTION, q4_0 KV cache, KEEP_ALIVE=-1. Big-deal — kills in-flight calls.">
+ <span class="light"></span>
+ 🏎️ Boost
+ <span class="sub-label">restart w/ 4x parallel · q4 cache</span>
+ </button>
<button class="btn" data-mode="hyperdrive" onclick="trigger('hyperdrive', this)">
<span class="light"></span>
🚀 Hyperdrive
@@ -879,17 +892,31 @@ async function tick() {
}
async function trigger(mode, btn) {
- // Visual feedback: light up the pressed button, dim the others
document.querySelectorAll('.btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
+ const resEl = document.getElementById('test-result');
+ if (resEl && mode === 'test') resEl.textContent = '… firing test prompt …';
try {
const r = await fetch('/api/control/' + mode, { method: 'POST' });
const j = await r.json();
console.log('[control]', mode, j);
+ if (mode === 'test' && resEl) {
+ if (j.ok) {
+ resEl.style.color = 'var(--gold)';
+ resEl.textContent = `🏁 ${j.model} · ${j.ms}ms wall · ${j.tokens_per_s ? j.tokens_per_s + ' tok/s · ' : ''}reply: "${(j.reply||'').slice(0,40)}"`;
+ } else {
+ resEl.style.color = '#c47b7b';
+ resEl.textContent = `× test failed · ${j.status||''} · ${(j.error||j.reply||'unknown').slice(0,80)}`;
+ }
+ }
setTimeout(() => tick(), 400);
} catch (e) {
console.warn('control failed', e);
btn.classList.remove('active');
+ if (resEl && mode === 'test') {
+ resEl.style.color = '#c47b7b';
+ resEl.textContent = '× network error: ' + (e.message || e);
+ }
}
}
diff --git a/server.js b/server.js
index 5307a82..0179bcd 100644
--- a/server.js
+++ b/server.js
@@ -215,6 +215,54 @@ app.post('/api/control/max-ram', async (_req, res) => {
res.json({ ok: true, mode: 'max-ram', loaded: out });
});
+// 🏁 TEST — fires a tiny prompt at the loaded model and times it. Useful to
+// directly compare before/after a BOOST or to see if Mac1 is responsive.
+app.post('/api/control/test', async (_req, res) => {
+ try {
+ const ps = await fetch(`${OLLAMA}/api/ps`, { signal: AbortSignal.timeout(2500) });
+ const psJ: any = ps.ok ? await ps.json() : { models: [] };
+ const model = (psJ.models || [])[0]?.name || 'qwen3:14b';
+ const t0 = Date.now();
+ const r = await fetch(`${OLLAMA}/api/chat`, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ model, stream: false,
+ messages: [{ role: 'user', content: 'Reply with exactly the phrase "BOOST OK" and nothing else, no thinking.' }],
+ options: { num_predict: 8, num_ctx: 512 }
+ }),
+ signal: AbortSignal.timeout(60000)
+ });
+ const ms = Date.now() - t0;
+ if (!r.ok) {
+ const txt = await r.text();
+ return res.json({ ok: false, mode: 'test', model, ms, status: r.status, error: txt.slice(0, 240) });
+ }
+ const j: any = await r.json();
+ res.json({
+ ok: true, mode: 'test', model, ms,
+ reply: (j?.message?.content || '').slice(0, 120),
+ tokens_per_s: j.eval_count && j.eval_duration ? +(j.eval_count / (j.eval_duration / 1e9)).toFixed(1) : null
+ });
+ } catch (e: any) {
+ res.status(500).json({ ok: false, error: String(e?.message || e) });
+ }
+});
+
+// 🏎️ BOOST — runs ~/bin/ollama-boost.sh which kills the manual ollama serve
+// and relaunches via launchd com.steve.ollama-boost with these env vars:
+// OLLAMA_NUM_PARALLEL=4 (4× concurrent inference per model)
+// OLLAMA_MAX_LOADED_MODELS=2 (qwen3:14b + qwen3:8b hot side-by-side)
+// OLLAMA_FLASH_ATTENTION=1 (~30% less KV cache memory)
+// OLLAMA_KV_CACHE_TYPE=q4_0 (4× longer context fits)
+// OLLAMA_KEEP_ALIVE=-1 (never unload)
+// Followed by pre-loading every installed model into VRAM with keep_alive=-1.
+// Big-deal restart — kills in-flight magazine-gen calls; pm2 worker retries.
+app.post('/api/control/boost', async (_req, res) => {
+ const r = await execCmd('/Users/steveabramsdesignsgmail.com/bin/ollama-boost.sh 2>&1', 90000);
+ res.json({ ok: r.ok, mode: 'boost', stdout: r.stdout.slice(-2000), stderr: r.stderr.slice(-1000) });
+});
+
// Idle — restore default power mode + unload models
app.post('/api/control/idle', async (_req, res) => {
const out = {};
← a87669d feat: viewer counter on dashboard odometer — same as Mac1
·
back to Macstudio2 Dashboard
·
fix: same TS-annotation crash a00d6b9 →