mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4216
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2692
Author: @MrKop-git
Created: 10/15/2026
Status: ❌ Closed
Base:
main← Head:pr/web-sse-i18n📝 Commits (6)
7a5be5eweb: one long-lived stream instead of a poll per second, and a language pack (#2686, #2687)91e4e34web: fix the flicker where it is - write a node only when its text changed826aa3cweb: the pages really are Chinese now - three start-up bugs found by rendering them29a4933web: the language switch uses the drawer's own segmented control661a426web: three labels were still English - Seed, Temperature, Prompt040711dweb: /api-monitor is translated too - translate="no" was unfair on an English-only page📊 Changes
10 files changed (+2028 additions, -275 deletions)
View changed files
📝
docs/DETAILS.md(+37 -0)📝
serve/server.py(+132 -0)➕
serve/test_web_stream.py(+558 -0)📝
serve/web/app.css(+2 -0)📝
serve/web/app.js(+320 -159)➕
serve/web/i18n/en.json(+381 -0)➕
serve/web/i18n/zh-CN.json(+381 -0)📝
serve/web/index.html(+90 -85)📝
serve/web/monitor.html(+16 -16)📝
serve/web/monitor.js(+111 -15)📄 Description
Title
Issue: Resolves #2687, resolves #2686
Summary
The web app stopped asking the server once a second and now keeps one long-lived response open instead, and it
speaks more than one language: a UTF-8 pack per language under
serve/web/i18n, Simplified Chinese first.Two issues, one change each:
the UI back to English - once a second on the Monitor. A stream writes only when something actually changed, and
nothing at all while nothing does. The page also sets
translate="no", so the browser stops offering to translatea page that now translates itself.
under About > Settings. UTF-8 everywhere, never GBK/cp936.
What changed
serve/server.py:GET /metrics/streamandGET /api/requests/stream- onetext/event-streamresponse each,written to only when what the page draws from changed.
?every=N(1..60, default 1) sets the server's tick;?requests=allkeeps the "Show all" behaviour. Both end when the tab closes (the next tick notices the socket) orwhen the server stops, and both use the existing API-key check.
GET /i18nlists the packs;/web/i18n/<lang>.jsonserves them as
application/json; charset=utf-8. No path may leave the folder.serve/web/app.js,serve/web/monitor.js: open that stream withEventSource. A server without the routes neverdelivers an event, so the page falls back to its old timer - an older server behaves exactly as it did before.
serve/web/i18n/en.json,serve/web/i18n/zh-CN.json: 305 keys each, one UTF-8 file per language, with ameta(
name,dir).index.htmlcarriesdata-i18nkeys andapp.jsbuilds its runtime strings throught().serve/web/index.html,serve/web/monitor.html:translate="no".serve/test_web_stream.py: 17 tests - the streams (the event and its payload, the API key, the client hanging up,the server stopping), the packs (valid UTF-8, no BOM, the same key set, served as UTF-8 JSON, no path out of the
folder), and the pack logic itself run in node with the DOM stubbed out.
docs/DETAILS.md: what the streams and the packs are, and how to add a language.What it leaves alone
The engine, the OpenAI/Anthropic APIs, the model's answers, the installer and the default path. An English browser
on a current server sees the same page it saw before, and a page on a server without
/metrics/streamkeeps pollingas it always did.
Extra Notes
How I checked
python3 -m unittest serve.test_web_stream: 17 passed.serve.test_monitor,serve.test_runconfig,serve.test_security,serve.test_server: 356 tests, the 3 errorsare the pre-existing
ModuleNotFoundError: No module named 'regex'fromtools/strata_tokenizer.py- they failon a clean checkout here too, before this change.
node --checkonapp.jsandmonitor.js; every touched file decoded as UTF-8 with no BOM.On the translation itself
The wording is translated, the terms are not, and a test asserts it: token stays "token(s)" - never 代币 or
令牌 - and VRAM, PCIe, Prefill, Decode, MTP, KV cache, Top-p, Top-k, seed, GPU, CPU and API key are left as they
are, because they are what the user reads in the logs, in the docs and in their own client.
Adding a language later
Drop a
<lang>.jsonnext toen.jsonwith the same keys and ameta:GET /i18npicks it up and the Settingsswitch lists it. A key a pack lacks shows as the key, never as a blank, so a pack can lag behind the page.
How the stream was measured
I did not measure bytes on the wire. What I can say from the code: the old path was one
GET /metricsper secondper open tab, each answered with the full payload (~7 KB of JSON with a minute of history per series). The new path
is one request per tab, then an event only when the fingerprint of
live,hardware,totals,engine,conversation_cacheand the newest request changes - so an idle Monitor, which is most of the time, gets nothingafter the first event.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.