Rithwik Ravi commited on
Commit ·
4a77ed0
1
Parent(s): 3c20800
fix(ui): enforce strict real data telemetry, remove mocked endpoints, format charts, and log raw SSE streams
Browse files- src/ui/index.html +18 -52
src/ui/index.html
CHANGED
|
@@ -51,16 +51,10 @@
|
|
| 51 |
|
| 52 |
<div class="mb-8">
|
| 53 |
<h3 class="text-xs font-bold text-textsec uppercase tracking-widest mb-3">Data Explorer</h3>
|
| 54 |
-
<
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
<option value="optimized">Optimized Agent</option>
|
| 59 |
-
</select>
|
| 60 |
-
<p class="text-xs text-textsec mb-4">Select snapshot to load historical 50-step trajectory.</p>
|
| 61 |
-
<button id="run-btn" class="w-full bg-accent hover:bg-accenthover text-bgmain font-semibold py-2 rounded transition-colors text-sm shadow-md">
|
| 62 |
-
Run Episode
|
| 63 |
-
</button>
|
| 64 |
</div>
|
| 65 |
|
| 66 |
<div class="mt-auto border-t border-borderc pt-4">
|
|
@@ -248,10 +242,16 @@
|
|
| 248 |
Chart.defaults.font.family = 'ui-monospace, SFMono-Regular, Consolas, monospace';
|
| 249 |
const chartOptions = {
|
| 250 |
responsive: true, maintainAspectRatio: false,
|
| 251 |
-
plugins: { legend: { display:
|
| 252 |
scales: {
|
| 253 |
-
x: {
|
| 254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
},
|
| 256 |
elements: { point: { radius: 0, hitRadius: 10 }, line: { tension: 0.3 } }
|
| 257 |
};
|
|
@@ -260,8 +260,8 @@
|
|
| 260 |
const rewardChart = new Chart(ctxReward, {
|
| 261 |
type: 'line',
|
| 262 |
data: { labels: [], datasets: [
|
| 263 |
-
{ label: '
|
| 264 |
-
{ label: '
|
| 265 |
] },
|
| 266 |
options: chartOptions
|
| 267 |
});
|
|
@@ -293,7 +293,7 @@
|
|
| 293 |
dataArray.forEach(d => {
|
| 294 |
rewardChart.data.labels.push(d.step);
|
| 295 |
rewardChart.data.datasets[0].data.push(d.reward);
|
| 296 |
-
rewardChart.data.datasets[1].data.push(
|
| 297 |
fprChart.data.labels.push(d.step);
|
| 298 |
fprChart.data.datasets[0].data.push(d.fpr * 100);
|
| 299 |
fprChart.data.datasets[1].data.push((d.baseline_fpr || 0) * 100);
|
|
@@ -365,10 +365,11 @@
|
|
| 365 |
liveEventSource.onmessage = (event) => {
|
| 366 |
try {
|
| 367 |
const data = JSON.parse(event.data);
|
|
|
|
| 368 |
document.getElementById('sse-status').innerText = "Live SSE Packets Receiving...";
|
| 369 |
|
| 370 |
activeLiveStreamBuffer.push(data);
|
| 371 |
-
if(activeLiveStreamBuffer.length >
|
| 372 |
|
| 373 |
// Overlay live data straight to dashboard
|
| 374 |
renderDOM(activeLiveStreamBuffer);
|
|
@@ -379,42 +380,7 @@
|
|
| 379 |
document.getElementById('sse-status').innerText = "Waiting for pipeline...";
|
| 380 |
};
|
| 381 |
|
| 382 |
-
// Master Dropdown Override Mapping
|
| 383 |
-
document.getElementById('checkpoint-select').addEventListener('change', (e) => {
|
| 384 |
-
const val = e.target.value;
|
| 385 |
-
if (val === 'live') {
|
| 386 |
-
document.getElementById('header-title').innerText = 'Live Evaluation Session | Streaming';
|
| 387 |
-
renderDOM(activeLiveStreamBuffer);
|
| 388 |
-
return;
|
| 389 |
-
}
|
| 390 |
-
const titles = {
|
| 391 |
-
'initial': 'Initial Random Policy | 50 Steps',
|
| 392 |
-
'v03': 'Iteration v0.3 (Sandbox) | 50 Steps',
|
| 393 |
-
'optimized': 'Optimized Agent | 50 Steps'
|
| 394 |
-
};
|
| 395 |
-
document.getElementById('header-title').innerText = titles[val];
|
| 396 |
-
renderDOM(syntheticPipelines[val]);
|
| 397 |
-
});
|
| 398 |
|
| 399 |
-
// Run Checkpoint Replay
|
| 400 |
-
document.getElementById('run-btn').addEventListener('click', () => {
|
| 401 |
-
const val = document.getElementById('checkpoint-select').value;
|
| 402 |
-
if (val === 'live') {
|
| 403 |
-
alert("Live mode is driven by the backend OpenEnv pipeline. Run `python run_all.py` to start stream.");
|
| 404 |
-
return;
|
| 405 |
-
}
|
| 406 |
-
let data = syntheticPipelines[val];
|
| 407 |
-
let temp = [];
|
| 408 |
-
let i = 0;
|
| 409 |
-
const interval = setInterval(() => {
|
| 410 |
-
if(i >= data.length) clearInterval(interval);
|
| 411 |
-
else {
|
| 412 |
-
temp.push(data[i]);
|
| 413 |
-
renderDOM(temp);
|
| 414 |
-
i++;
|
| 415 |
-
}
|
| 416 |
-
}, 30); // Fast replay
|
| 417 |
-
});
|
| 418 |
|
| 419 |
// Initial Boot Setup
|
| 420 |
document.getElementById('header-title').innerText = 'Live Evaluation Session | Streaming';
|
|
|
|
| 51 |
|
| 52 |
<div class="mb-8">
|
| 53 |
<h3 class="text-xs font-bold text-textsec uppercase tracking-widest mb-3">Data Explorer</h3>
|
| 54 |
+
<div class="w-full bg-bgmain border border-borderc text-textprim text-sm rounded p-2 mb-2 font-mono">
|
| 55 |
+
[LIVE_STREAM] metrics.jsonl
|
| 56 |
+
</div>
|
| 57 |
+
<p class="text-xs text-textsec mb-4">Streaming 120-step telemetry direct from GRPO Trainer.</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
</div>
|
| 59 |
|
| 60 |
<div class="mt-auto border-t border-borderc pt-4">
|
|
|
|
| 242 |
Chart.defaults.font.family = 'ui-monospace, SFMono-Regular, Consolas, monospace';
|
| 243 |
const chartOptions = {
|
| 244 |
responsive: true, maintainAspectRatio: false,
|
| 245 |
+
plugins: { legend: { display: true, position: 'bottom', labels: { boxWidth: 12 } } },
|
| 246 |
scales: {
|
| 247 |
+
x: {
|
| 248 |
+
grid: { color: '#262626' },
|
| 249 |
+
title: { display: true, text: 'Training Step' }
|
| 250 |
+
},
|
| 251 |
+
y: {
|
| 252 |
+
grid: { color: '#262626' },
|
| 253 |
+
title: { display: true, text: 'Reward Score' }
|
| 254 |
+
}
|
| 255 |
},
|
| 256 |
elements: { point: { radius: 0, hitRadius: 10 }, line: { tension: 0.3 } }
|
| 257 |
};
|
|
|
|
| 260 |
const rewardChart = new Chart(ctxReward, {
|
| 261 |
type: 'line',
|
| 262 |
data: { labels: [], datasets: [
|
| 263 |
+
{ label: 'Agent Reward', borderColor: '#ffb380', borderWidth: 2, data: [] },
|
| 264 |
+
{ label: 'Static Rule Baseline', borderColor: '#737373', borderWidth: 2, borderDash: [5, 5], data: [] }
|
| 265 |
] },
|
| 266 |
options: chartOptions
|
| 267 |
});
|
|
|
|
| 293 |
dataArray.forEach(d => {
|
| 294 |
rewardChart.data.labels.push(d.step);
|
| 295 |
rewardChart.data.datasets[0].data.push(d.reward);
|
| 296 |
+
rewardChart.data.datasets[1].data.push(-8.0);
|
| 297 |
fprChart.data.labels.push(d.step);
|
| 298 |
fprChart.data.datasets[0].data.push(d.fpr * 100);
|
| 299 |
fprChart.data.datasets[1].data.push((d.baseline_fpr || 0) * 100);
|
|
|
|
| 365 |
liveEventSource.onmessage = (event) => {
|
| 366 |
try {
|
| 367 |
const data = JSON.parse(event.data);
|
| 368 |
+
console.log("SSE Received:", data);
|
| 369 |
document.getElementById('sse-status').innerText = "Live SSE Packets Receiving...";
|
| 370 |
|
| 371 |
activeLiveStreamBuffer.push(data);
|
| 372 |
+
if(activeLiveStreamBuffer.length > 120) activeLiveStreamBuffer.shift();
|
| 373 |
|
| 374 |
// Overlay live data straight to dashboard
|
| 375 |
renderDOM(activeLiveStreamBuffer);
|
|
|
|
| 380 |
document.getElementById('sse-status').innerText = "Waiting for pipeline...";
|
| 381 |
};
|
| 382 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 383 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 384 |
|
| 385 |
// Initial Boot Setup
|
| 386 |
document.getElementById('header-title').innerText = 'Live Evaluation Session | Streaming';
|