Unify viewer metrics panel

This commit is contained in:
Meta Vens 2026-04-24 16:28:16 +01:00
commit 30896a3171
4 changed files with 31 additions and 45 deletions

View file

@ -428,9 +428,11 @@ function renderInference(): void {
}
function renderMetrics(): void {
metricsPanel.innerHTML = "";
metricsPanel.querySelectorAll<HTMLElement>("[data-dynamic='true']").forEach((node) => {
node.remove();
});
const frame = getSelectedFrame();
const items: Array<[string, string]> = [["Stage", state.currentStage]];
const items: Array<[string, string]> = [];
if (frame) {
items.push(["Loss", frame.loss === null ? "n/a" : formatNumber(frame.loss, 4)]);
for (const [key, value] of Object.entries(frame.terms)) {
@ -447,6 +449,7 @@ function renderMetrics(): void {
for (const [label, value] of items) {
const node = document.createElement("div");
node.className = "metric-chip";
node.dataset.dynamic = "true";
node.innerHTML = `<strong>${label}</strong><span>${value}</span>`;
metricsPanel.appendChild(node);
}