Files
junction/web/public/index.html
T
Hermes b71bfb5a0a Dashboard zeigt die letzten Anfragen — Dauer, Cache-Quelle, p95, Trefferquote
Die Zeilen aus dem Anfrage-Log lagen bisher nur in der Datei. Jetzt gibt es sie über den
Steuerkanal (`requests.tail`, Standard 20, Deckel 200) und das Dashboard zeigt sie:
Zeit, Modell, Ziel, Status, Millisekunden, Cache-Quelle, Tokens, Kosten — dazu p95 und
Trefferquote, ausdrücklich nur über die angezeigten Zeilen gerechnet.

Gelesen wird der letzte Block der Datei (256 KB), nicht die ganze: ein Ledger wächst, und
das Dashboard fragt regelmäßig. Die erste, womöglich angeschnittene Zeile fällt weg; bei
mehr Zeilen als gefragt bleiben die neuesten, nicht die ersten (Ringpuffer, geprüft mit
500 Zeilen und count 9999: n=200, erste m300, letzte m499).

Auf n95 live: control-Socket beantwortet requests.tail, Dashboard zeigt vier echte
Anfragen mit 714–751 ms, Karte "Letzte Anfragen" im HTML, app.js liest sie über
/api/requests.

Tests: control.py prüft requests.tail gegen ein vorbereitetes Ledger und den Deckel —
11 statt 9 Prüfungen. make test: PASS, 222 Prüfungen, 154 s.
2026-11-08 12:25:22 +00:00

130 lines
4.3 KiB
HTML

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>junction</title>
<link rel="stylesheet" href="/static/app.css">
</head>
<body>
<header>
<div class="brand">
<span class="dot" id="state"></span>
<h1>junction</h1>
<span class="sub" id="uptime">—</span>
</div>
<div class="numbers">
<div class="n"><b id="n-req">—</b><span>Anfragen/s</span></div>
<div class="n"><b id="n-tok">—</b><span>Token/s</span></div>
<div class="n"><b id="n-lat">—</b><span>Latenz</span></div>
<div class="n"><b id="n-cost">—</b><span>Kosten/h</span></div>
<div class="n"><b id="n-fail">—</b><span>Fehler</span></div>
</div>
</header>
<main>
<section class="card wide">
<h2>Durchsatz <small id="c-req"></small></h2>
<canvas id="g-requests" height="140"></canvas>
</section>
<section class="card wide">
<h2>Token <small id="c-tok"></small></h2>
<canvas id="g-tokens" height="140"></canvas>
</section>
<section class="card">
<h2>Latenz</h2>
<canvas id="g-latency" height="120"></canvas>
</section>
<section class="card">
<h2>Anfragedaten</h2>
<canvas id="g-traffic" height="120"></canvas>
</section>
<section class="card wide" id="eps">
<h2>Endpunkte</h2>
<table id="t-eps">
<thead><tr>
<th>Name</th><th>Zustand</th><th class="num">ok</th><th class="num">Fehler</th>
<th class="num">laufend</th><th class="num">letzte ms</th><th></th>
</tr></thead>
<tbody></tbody>
</table>
</section>
<section class="card wide">
<h2>MCP-Server <small id="c-mcp"></small></h2>
<table id="t-mcp">
<thead><tr>
<th>Name</th><th>Adresse</th><th class="num">Werkzeuge</th>
<th class="num">Abrufe</th><th class="num">Fehler</th><th>zuletzt</th>
</tr></thead>
<tbody></tbody>
</table>
<p class="hint" id="mcp-hint">Ein Agent verbindet sich mit <code id="mcp-url">/mcp</code>
und sieht alle Werkzeuge unten — mit dem Servernamen als Präfix.</p>
<div id="mcp-tools" class="tools"></div>
</section>
<section class="card wide">
<h2>Schlüssel &amp; Monat <small id="c-spend"></small></h2>
<table id="t-vkeys">
<thead><tr>
<th>Schlüssel</th><th>Modelle</th><th class="num">rpm</th>
<th class="num">Budget</th><th class="num">verbraucht</th>
<th class="num">Anfragen</th><th class="num">abgelehnt</th>
</tr></thead>
<tbody></tbody>
</table>
<div id="spend-detail" class="tools"></div>
<p class="hint">Kosten aus dem Spend-Log, nicht geschätzt. Ein Schlüssel ohne Grenze
steht mit 0 — das heißt „kein Limit“, nicht „unbekannt“.</p>
</section>
<section class="card wide">
<h2>Letzte Anfragen <small id="req-stats"></small></h2>
<table id="t-req">
<thead><tr>
<th>Zeit</th><th>Modell</th><th>Ziel</th><th class="num">Status</th>
<th class="num">ms</th><th>Cache</th><th class="num">ein/aus</th><th class="num">$</th>
</tr></thead>
<tbody></tbody>
</table>
<p class="hint">Eine Zeile je bedienter Anfrage aus dem Anfrage-Log. <b>p95</b> und
<b>Trefferquote</b> gelten für die angezeigten Zeilen, nicht für den ganzen Tag —
was nicht im Log steht, wird hier nicht behauptet.</p>
</section>
<section class="card wide">
<h2>Regeln <small id="c-rules"></small></h2>
<table id="t-rules">
<thead><tr>
<th class="num">#</th><th>Modell</th><th>Pfad</th><th>Ziel</th>
<th class="num">need</th><th class="num">ctx</th><th></th>
</tr></thead>
<tbody></tbody>
</table>
<form id="f-rule">
<input id="rule-text" placeholder='neue Regel, z.B. req for "deepseek-*" pass cloud'>
<button type="submit">setzen</button>
</form>
<p class="hint" id="rule-hint"></p>
</section>
<section class="card wide">
<h2>Konfiguration <small>wird beim Speichern sofort übernommen</small></h2>
<textarea id="config" spellcheck="false"></textarea>
<div class="row">
<button id="cfg-load">laden</button>
<button id="cfg-save" class="primary">prüfen &amp; speichern</button>
<span class="hint" id="cfg-hint"></span>
</div>
</section>
</main>
<script src="/static/app.js"></script>
</body>
</html>