MCPcopy Create free account
hub / github.com/algorithmicsuperintelligence/openevolve / formatMetrics

Function formatMetrics

scripts/static/js/main.js:43–55  ·  view source on GitHub ↗
(metrics)

Source from the content-addressed store, hash-verified

41}
42
43function formatMetrics(metrics) {
44 if (!metrics || typeof metrics !== 'object') return '';
45 let rows = Object.entries(metrics).map(([k, v]) => {
46 let min = 0, max = 1;
47 if (metricMinMax[k]) {
48 min = metricMinMax[k].min;
49 max = metricMinMax[k].max;
50 }
51 let valStr = (typeof v === 'number' && isFinite(v)) ? v.toFixed(4) : v;
52 return `<tr><td style='padding-right:0.7em;'><b>${k}</b></td><td style='padding-right:0.7em;'>${valStr}</td><td style='min-width:90px;'>${typeof v === 'number' ? renderMetricBar(v, min, max) : ''}</td></tr>`;
53 }).join('');
54 return `<table class='metrics-table'><tbody>${rows}</tbody></table>`;
55}
56
57function renderMetricBar(value, min, max, opts={}) {
58 let percent = 0;

Callers 1

showSidebarContentFunction · 0.90

Calls 1

renderMetricBarFunction · 0.85

Tested by

no test coverage detected