feat(webui): rebuild console with tabbed pages

Replace the single-file frontend (app.js, styles.css) with a multi-file
ES module structure served from go:embed, and reorganize the 13 pages
into 8 tabbed pages under 4 navigation groups: runtime (overview,
diagnostics), integrations (access guide, API keys), models (quotas,
rotation), and system (configuration, account).

The redesign adopts a monochrome light/dark design system driven by
prefers-color-scheme, replaces prompt()/confirm() flows with in-page
dialogs, and keeps every management API call and deep link (old hashes
alias to the new pages).

Behavior changes: the log SSE connection now spans the whole console
session and buffers while the stream tab is hidden; quota polling runs
only while its tab is active; the first-run checklist appears on the
overview page and hides once ready.

Also fixes a crash on the rotation page: the persisted state serializes
empty orders and maps as JSON null, which is now normalized before
rendering, with the same defensive handling in the quota and API key
pages.

CI now syntax-checks the ES modules via node --input-type=module, and
the README structure notes are updated.
This commit is contained in:
michaelliunsky committed 2026-10-16 18:09:42 +08:00
1 parent a6601da673
commit a0da31ed08
26 files changed
+4098 -3297

No files matched your search

+2 -2
View File
@@ -33,7 +33,7 @@
go test ./...
go test -race ./...
go vet ./...
node --check webui/app.js
for f in webui/js/*.js webui/js/pages/*.js; do node --input-type=module --check < "$f"; done
go build -trimpath -o opencode2api ./cmd/opencode2api
```
@@ -81,7 +81,7 @@ Messages,以及这三种协议的流式输出。真实模型 ID 的原有调
- `POST /api/rotation/current`:`{"group":"sota","model":"glm-5.3"}`;立即
修改当前模型并解除该模型的临时暂停。
验证:`go test -race ./...`、`go vet ./...`、`node --check webui/app.js`。
验证:`go test -race ./...`、`go vet ./...`、`for f in webui/js/*.js webui/js/pages/*.js; do node --input-type=module --check < "$f"; done`。
模拟上游测试覆盖 9 次普通错误上限、超过 3 个额度跳过、混合错误预算、
Retry-After、单个模型故障不影响 Key、三种入口协议的跨协议转换、成功保持、
别名发现与用量归属、畸形响应、输出前错误、首个输出超时、输出后故障、