recovered snapshot from suspended aaronjaworski710 (history unavailable)
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>type-toolkit — control plane</title>
|
||||
<style>
|
||||
:root{--bg:#0d1117;--panel:#161b22;--brd:#30363d;--fg:#c9d1d9;--dim:#8b949e;--acc:#58a6ff;--ok:#3fb950;--err:#f85149;--warn:#d29922}
|
||||
*{box-sizing:border-box;margin:0;padding:0}
|
||||
body{background:var(--bg);color:var(--fg);font:14px/1.5 -apple-system,'Segoe UI',Roboto,sans-serif;padding:24px}
|
||||
h1{font-size:20px;margin-bottom:4px}
|
||||
.sub{color:var(--dim);font-size:12px;margin-bottom:20px}
|
||||
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px;margin-bottom:20px}
|
||||
.card{background:var(--panel);border:1px solid var(--brd);border-radius:8px;padding:16px}
|
||||
.card h2{font-size:12px;text-transform:uppercase;color:var(--dim);letter-spacing:.5px;margin-bottom:10px}
|
||||
.big{font-size:26px;font-weight:600}
|
||||
.big.ok{color:var(--ok)}.big.err{color:var(--err)}.big.w{color:var(--warn)}
|
||||
.row{display:flex;justify-content:space-between;padding:3px 0;font-size:13px}
|
||||
.row span:last-child{color:var(--dim)}
|
||||
.bar{display:flex;gap:10px;margin-bottom:20px;flex-wrap:wrap}
|
||||
button{background:#21262d;border:1px solid var(--brd);color:var(--fg);border-radius:6px;padding:8px 16px;font-size:13px;cursor:pointer}
|
||||
button:hover{border-color:var(--acc);color:var(--acc)}
|
||||
button:disabled{opacity:.45;cursor:wait}
|
||||
input{background:#0d1117;border:1px solid var(--brd);color:var(--fg);border-radius:6px;padding:8px 10px;font-size:13px}
|
||||
table{width:100%;border-collapse:collapse;font-size:13px}
|
||||
th{ text-align:left;color:var(--dim);font-size:11px;text-transform:uppercase;padding:8px 10px;border-bottom:1px solid var(--brd)}
|
||||
td{padding:8px 10px;border-bottom:1px solid #21262d}
|
||||
.tag{display:inline-block;padding:2px 8px;border-radius:10px;font-size:11px}
|
||||
.tag.ok{background:#0d2818;color:var(--ok)}.tag.err{background:#2d0b0e;color:var(--err)}
|
||||
.log{background:#0d1117;border:1px solid var(--brd);border-radius:8px;padding:12px;font:12px/1.6 Consolas,monospace;max-height:320px;overflow-y:auto;white-space:pre-wrap}
|
||||
.log .t{color:var(--dim)}
|
||||
.log .ok{color:var(--ok)}.log .err{color:var(--err)}
|
||||
.note{background:#1f2937;border-left:3px solid var(--warn);padding:10px 14px;border-radius:0 6px 6px 0;margin-bottom:20px;font-size:12px;color:#e3b341}
|
||||
a{color:var(--acc);text-decoration:none}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>type-toolkit</h1>
|
||||
<div class="sub">type.com agent platform — autoreg / pool / OpenAI-compat gateway. <a href="http://127.0.0.1:8311/health" target="_blank">gateway :8311</a></div>
|
||||
|
||||
<div class="note">oRPC API закрыт сервером для agent-токенов (401 Invalid token, aud-политика). Пул, авторег и ротация identity работают полностью — см. FINDINGS.md.</div>
|
||||
|
||||
<div class="grid">
|
||||
<div class="card"><h2>Gateway :8311</h2><div class="big" id="gw">—</div></div>
|
||||
<div class="card"><h2>Аккаунтов в пуле</h2><div class="big" id="cnt">—</div></div>
|
||||
<div class="card"><h2>С токеном</h2><div class="big" id="tok">—</div></div>
|
||||
<div class="card"><h2>Обновлено</h2><div class="big w" id="now" style="font-size:14px">—</div></div>
|
||||
</div>
|
||||
|
||||
<div class="bar">
|
||||
<button id="btn-reg" onclick="autoreg()">+ Зарегать акк</button>
|
||||
<input id="org" value="reform-org" placeholder="org name" style="width:140px">
|
||||
<button id="btn-refr" onclick="refresh()">Обновить токены</button>
|
||||
<button onclick="load()">Обновить данные</button>
|
||||
</div>
|
||||
|
||||
<table id="tbl"><thead><tr>
|
||||
<th>email</th><th>org</th><th>создан</th><th>посл. refresh</th><th>статус</th><th>token</th>
|
||||
</tr></thead><tbody></tbody></table>
|
||||
|
||||
<h2 style="font-size:12px;text-transform:uppercase;color:var(--dim);margin:20px 0 8px">Лог</h2>
|
||||
<div class="log" id="log"></div>
|
||||
|
||||
<script>
|
||||
async function load(){
|
||||
try{
|
||||
const s = await (await fetch('/api/status')).json();
|
||||
const gw = document.getElementById('gw');
|
||||
gw.textContent = s.gateway.up ? 'UP' : 'DOWN';
|
||||
gw.className = 'big ' + (s.gateway.up ? 'ok' : 'err');
|
||||
document.getElementById('cnt').textContent = s.pool.count;
|
||||
const tok = document.getElementById('tok');
|
||||
tok.textContent = s.pool.with_token;
|
||||
tok.className = 'big ' + (s.pool.with_token ? 'ok' : 'w');
|
||||
document.getElementById('now').textContent = s.now;
|
||||
const lg = document.getElementById('log');
|
||||
lg.innerHTML = s.log.map(l=>{
|
||||
const m = l.match(/\[(\d+:\d+:\d+)\]\s(.*)/);
|
||||
const t = m?m[1]:''; const txt=(m?m[2]:l)||'';
|
||||
const cls = /OK/.test(txt)?'ok':( /FAIL|ERR/.test(txt)?'err':'');
|
||||
return `<span class="t">[${t}]</span> <span class="${cls}">${txt}</span>`;
|
||||
}).join('\n');
|
||||
lg.scrollTop = lg.scrollHeight;
|
||||
}catch(e){ console.error(e); }
|
||||
}
|
||||
async function accounts(){
|
||||
try{
|
||||
const a = await (await fetch('/api/accounts')).json();
|
||||
document.querySelector('#tbl tbody').innerHTML = a.map(x=>`<tr>
|
||||
<td>${x.email||''}</td><td>${x.org||''}</td><td>${x.created_at||''}</td>
|
||||
<td>${x.last_refresh||''}</td>
|
||||
<td>${x.last_status?`<span class="tag ${/^refresh|^exchange/.test(x.last_status)?'ok':'err'}">${x.last_status}</span>`:''}</td>
|
||||
<td>${x.access_token_len||0}b</td></tr>`).join('') || '<tr><td colspan=6 style="color:var(--dim)">пусто</td></tr>';
|
||||
}catch(e){ console.error(e); }
|
||||
}
|
||||
async function autoreg(){
|
||||
const b = document.getElementById('btn-reg'); b.disabled = true; b.textContent = 'Регистрирую…';
|
||||
try{
|
||||
const r = await (await fetch('/api/autoreg', {method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({org: document.getElementById('org').value})})).json();
|
||||
if(!r.ok) alert('Ошибка: ' + r.error);
|
||||
}catch(e){ alert('Сбой: ' + e); }
|
||||
b.disabled = false; b.textContent = '+ Зарегать акк';
|
||||
load(); accounts();
|
||||
}
|
||||
async function refresh(){
|
||||
const b = document.getElementById('btn-refr'); b.disabled = true; b.textContent = 'Обновляю…';
|
||||
try{ await fetch('/api/refresh', {method:'POST'}); }catch(e){}
|
||||
b.disabled = false; b.textContent = 'Обновить токены';
|
||||
load(); accounts();
|
||||
}
|
||||
load(); accounts();
|
||||
setInterval(()=>{load(); accounts();}, 10000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user