more chat UI

This commit is contained in:
Dobromir Popov
2026-07-08 20:51:42 +03:00
parent 42d6fe2b15
commit aa7f4eb13b
3 changed files with 20 additions and 9 deletions

View File

@@ -277,6 +277,7 @@ const esc = s => String(s).replace(/[&<>"]/g,
const usdt = v => (Math.round(v * 1e6) / 1e6).toFixed(6);
const tps = v => (v === null || v === undefined) ? "?" : (Math.round(v * 10) / 10).toFixed(1);
const copies = v => (v === null || v === undefined) ? "?" : Number(v).toFixed(2);
const hp = v => (v === null || v === undefined) ? "?HP" : `${Number(v).toFixed(1)}HP`;
const short = (s, n=14) => { s = String(s); return s.length > n ? s.slice(0, 6) + "…" + s.slice(-5) : s; };
function modelAliasKey(value) {
@@ -1114,12 +1115,8 @@ function findRoutingForModel(model, routing) {
return null;
}
function chatModelHealthLabel(coverage) {
if (coverage === null || coverage === undefined) return "unknown";
const pct = Math.round(Number(coverage));
if (pct >= 100) return "healthy";
if (pct > 0) return `${pct}% cov`;
return "no coverage";
function chatModelHealthHp(servedCopies) {
return hp(servedCopies);
}
function chatModelTypicalTps(model, routing) {
@@ -1136,7 +1133,7 @@ function chatModelOptionLabel(model, routing) {
const base = model.name && model.name !== model.id
? `${model.name} (${model.id})`
: model.id;
const health = chatModelHealthLabel(model.coverage);
const health = chatModelHealthHp(model.servedCopies);
const speed = chatModelTypicalTps(model, routing);
const speedText = speed === null ? "?" : `${tps(speed)} tok/s`;
const suffix = model.recommended ? " · recommended" : "";
@@ -1644,6 +1641,7 @@ async function refresh() {
recommended: Boolean(model.recommended),
aliases: model.aliases || [],
coverage: model.shard_coverage_percentage,
servedCopies: model.served_model_copies,
})).filter(model => model.id);
renderHive(raft);
renderNodes(map);