-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
53 lines (53 loc) · 1.51 KB
/
Copy pathindex.html
File metadata and controls
53 lines (53 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Promptimprover Swarm Dashboard</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header>
<h1>Promptimprover Swarm Dashboard</h1>
</header>
<main>
<table id="dashboard">
<thead>
<tr>
<th>Time</th>
<th>Span</th>
<th>Persona</th>
<th>Action</th>
<th>Tokens</th>
<th>Reasoning</th>
</tr>
</thead>
<tbody></tbody>
</table>
</main>
<script>
async function fetchData() {
const resp = await fetch('/data');
const logs = await resp.json();
const tbody = document.querySelector('#dashboard tbody');
tbody.innerHTML = '';
logs.reverse().forEach(log => {
const tr = document.createElement('tr');
const fmtTime = new Date(log.timestamp).toLocaleTimeString();
const reason = log.reasoning_path && log.reasoning_path.length > 60 ? log.reasoning_path.slice(0,57) + '...' : log.reasoning_path;
tr.innerHTML = `
<td>${fmtTime}</td>
<td>${log.span_id || 'N/A'}</td>
<td>${log.persona || 'Unknown'}</td>
<td>${log.action_type || 'Unknown'}</td>
<td>${log.metrics?.total_tokens || 0}</td>
<td>${reason || ''}</td>
`;
tbody.appendChild(tr);
});
}
setInterval(fetchData, 2000);
fetchData();
</script>
</body>
</html>