Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
Web app works behind path-prefixed reverse proxies
mikicvi5c5a05957436
diff --git a/serve/web/app.js b/serve/web/app.jsindex 51c415ea1..45f3eb670 100644--- a/serve/web/app.js+++ b/serve/web/app.js@@ -3,7 +3,7 @@"use strict";const $ = (id) => document.getElementById(id);-const SPRITE = "/web/sprite.svg";+const SPRITE = "web/sprite.svg";const icon = (name, cls = "st-icon") => `<svg class="${cls}" aria-hidden="true"><use href="${SPRITE}#i-${name}"/></svg>`;const esc = (s) => String(s).replace(/[&<>"']/g, (c) => ({"&": "&", "<": "<", ">": ">", '"': """, "'": "'"}[c]));const fmt = (n, d = 0) => (n == null || Number.isNaN(n) ? "–" : Number(n).toLocaleString(undefined, {maximumFractionDigits: d, minimumFractionDigits: d}));@@ -98,7 +98,7 @@ $("api-key").onchange = () => { store.set("apikey", $("api-key").value.trim());let health = {model: "strata", images: false, max_context: 0};async function loadHealth() {try {- health = await (await fetch("/health")).json();+ health = await (await fetch("health")).json();$("attach-btn").title = health.images ? "Attach a text file or a picture (or drop it here)": "Attach a text file (or drop it here)";$("chat-empty-sub").textContent = `${health.model} runs on this PC. Nothing leaves it.`;@@ -147,7 +147,7 @@ let lastMetrics = null, metricsFailures = 0, keyWarned = false, mcpTick = 0;let reqShowAll = false; // the Monitor's request table: the last 12, or every one the server keeps (issue #35)async function poll() {try {- const r = await fetch(reqShowAll ? "/metrics?requests=all" : "/metrics", {headers: headers()});+ const r = await fetch(reqShowAll ? "metrics?requests=all" : "metrics", {headers: headers()});if (r.status === 401) {setPill("error", "API key needed");if (!keyWarned) { keyWarned = true; toast("warn", "API key needed", "This server needs a key: add it under About > Settings.", 6000); }@@ -347,7 +347,7 @@ $("req-all").addEventListener("click", () => { reqShowAll = !reqShowAll; if (laslet mcpInfo = {servers: [], tools: 0}, mcpRetry = null;async function loadMcp() {try {- const r = await fetch("/mcp", {headers: headers()});+ const r = await fetch("mcp", {headers: headers()});if (!r.ok) return;mcpInfo = await r.json();} catch (e) { return; /* an older server: no MCP */ }@@ -679,7 +679,7 @@ async function send() {let firstAt = null, thinkStart = null, usage = null, frame = 0;const paint = () => { frame = 0; updateAssistant(el, m, true); scrollDown(); };try {- const r = await fetch("/v1/chat/completions", {method: "POST", headers: headers(true), body: JSON.stringify(body),+ const r = await fetch("v1/chat/completions", {method: "POST", headers: headers(true), body: JSON.stringify(body),signal: controller.signal});if (!r.ok) {let msg = `HTTP ${r.status}`;@@ -881,7 +881,7 @@ function loadDrawer(s = settings) {let sharedOn = false;async function loadShared() {try {- const r = await fetch("/settings", {headers: headers()});+ const r = await fetch("settings", {headers: headers()});if (r.ok) sharedOn = !!(await r.json()).shared;} catch (e) { /* an older server: the switch just stays off */ }$("s-share").setAttribute("aria-checked", String(sharedOn));@@ -895,7 +895,7 @@ function sharedDefaults(s) {return d;}async function saveShared(on, s) {- const r = await fetch("/settings", {method: "POST", headers: headers(true),+ const r = await fetch("settings", {method: "POST", headers: headers(true),body: JSON.stringify({defaults: on ? sharedDefaults(s) : null})});if (!r.ok) {let msg = `HTTP ${r.status}`;diff --git a/serve/web/index.html b/serve/web/index.htmlindex fd19a8fe8..d858d2f08 100644--- a/serve/web/index.html+++ b/serve/web/index.html@@ -4,9 +4,9 @@<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Strata</title>-<link rel="stylesheet" href="/web/tokens.css">-<link rel="stylesheet" href="/web/components.css">-<link rel="stylesheet" href="/web/app.css">+<link rel="stylesheet" href="web/tokens.css">+<link rel="stylesheet" href="web/components.css">+<link rel="stylesheet" href="web/app.css"><script>// the theme before the first paint: the saved choice, else the system'stry {@@ -21,17 +21,17 @@<span class="st-header__brand">Strata</span><nav class="st-tabs" role="tablist" aria-label="Views"><button class="st-tab" role="tab" id="tab-btn-chat" aria-controls="view-chat" aria-selected="true" data-tab="chat">- <svg class="st-icon st-icon--sm"><use href="/web/sprite.svg#i-chat"/></svg>Chat</button>+ <svg class="st-icon st-icon--sm"><use href="web/sprite.svg#i-chat"/></svg>Chat</button><button class="st-tab" role="tab" id="tab-btn-monitor" aria-controls="view-monitor" aria-selected="false" data-tab="monitor">- <svg class="st-icon st-icon--sm"><use href="/web/sprite.svg#i-activity"/></svg>Monitor</button>+ <svg class="st-icon st-icon--sm"><use href="web/sprite.svg#i-activity"/></svg>Monitor</button><button class="st-tab" role="tab" id="tab-btn-about" aria-controls="view-about" aria-selected="false" data-tab="about">- <svg class="st-icon st-icon--sm"><use href="/web/sprite.svg#i-info"/></svg>About</button>+ <svg class="st-icon st-icon--sm"><use href="web/sprite.svg#i-info"/></svg>About</button></nav><span class="st-header__spacer"></span><span class="st-pill" id="pill" data-state="idle" role="status" aria-live="polite"><span class="st-pill__dot"></span><span id="pill-text">Connecting…</span></span><button class="st-btn st-btn--icon" id="theme-btn" title="Light / dark" aria-label="Switch between light and dark">- <svg class="st-icon"><use id="theme-icon" href="/web/sprite.svg#i-moon"/></svg></button>+ <svg class="st-icon"><use id="theme-icon" href="web/sprite.svg#i-moon"/></svg></button></header><main>@@ -51,20 +51,20 @@<textarea id="input" rows="2" placeholder="Ask anything…" aria-label="Message"></textarea><div class="st-composer__bar"><button type="button" class="st-btn st-btn--icon" id="attach-btn" title="Attach a text file (or drop it here)" aria-label="Attach a file">- <svg class="st-icon"><use href="/web/sprite.svg#i-attach"/></svg></button>+ <svg class="st-icon"><use href="web/sprite.svg#i-attach"/></svg></button><input type="file" id="file" multiple hidden><button type="button" class="st-btn st-btn--icon" id="new-btn" title="New chat" aria-label="New chat">- <svg class="st-icon"><use href="/web/sprite.svg#i-new-chat"/></svg></button>+ <svg class="st-icon"><use href="web/sprite.svg#i-new-chat"/></svg></button><button type="button" class="st-btn st-btn--icon" id="export-btn" title="Save this chat as Markdown" aria-label="Save this chat">- <svg class="st-icon"><use href="/web/sprite.svg#i-download"/></svg></button>+ <svg class="st-icon"><use href="web/sprite.svg#i-download"/></svg></button><button type="button" class="st-btn st-btn--icon" id="sampling-btn" title="Sampling and thinking" aria-label="Sampling and thinking">- <svg class="st-icon"><use href="/web/sprite.svg#i-settings"/></svg></button>+ <svg class="st-icon"><use href="web/sprite.svg#i-settings"/></svg></button><span class="spacer"></span><span class="composer-hint" id="composer-hint"></span><button type="button" class="st-btn st-btn--secondary" id="stop-btn" hidden>- <svg class="st-icon st-icon--sm"><use href="/web/sprite.svg#i-stop"/></svg>Stop</button>+ <svg class="st-icon st-icon--sm"><use href="web/sprite.svg#i-stop"/></svg>Stop</button><button type="submit" class="st-btn st-btn--primary st-btn--send" id="send-btn" aria-label="Send">- <svg class="st-icon"><use href="/web/sprite.svg#i-send"/></svg></button>+ <svg class="st-icon"><use href="web/sprite.svg#i-send"/></svg></button></div></form></div>@@ -169,7 +169,7 @@<aside class="st-drawer" id="drawer" data-open="false" aria-label="Sampling and thinking" aria-hidden="true"><div class="st-drawer__head"><span class="card-title">Sampling</span><button class="st-btn st-btn--icon" id="drawer-close" aria-label="Close">- <svg class="st-icon"><use href="/web/sprite.svg#i-chevron"/></svg></button></div>+ <svg class="st-icon"><use href="web/sprite.svg#i-chevron"/></svg></button></div><div class="st-drawer__body"><div class="st-field"><label class="st-label" for="s-thinking">Thinking <output id="o-thinking"></output></label>@@ -218,6 +218,6 @@</aside><div class="scrim" id="scrim" hidden></div><div class="st-toasts" id="toasts" aria-live="polite"></div>-<script src="/web/app.js"></script>+<script src="web/app.js"></script></body></html>diff --git a/serve/web/tokens.css b/serve/web/tokens.cssindex a96ce6c59..220cf421f 100644--- a/serve/web/tokens.css+++ b/serve/web/tokens.css@@ -3,8 +3,8 @@Values marked (derived) are not in the Gainsty source and were added for the app. *//* Outfit (SIL Open Font License 1.1, serve/web/fonts/OFL.txt): one variable font, weights 100-900 */-@font-face{font-family:"Outfit";src:url("/fonts/outfit-latin-wght.woff2") format("woff2-variations");font-weight:100 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}-@font-face{font-family:"Outfit";src:url("/fonts/outfit-latin-ext-wght.woff2") format("woff2-variations");font-weight:100 900;font-display:swap;unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}+@font-face{font-family:"Outfit";src:url("../fonts/outfit-latin-wght.woff2") format("woff2-variations");font-weight:100 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}+@font-face{font-family:"Outfit";src:url("../fonts/outfit-latin-ext-wght.woff2") format("woff2-variations");font-weight:100 900;font-display:swap;unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}:root{/* type */