Repository navigation
Expand file tree
/
Copy pathdashboard.html
More file actions
155 lines (154 loc) · 6.98 KB
/
Copy pathdashboard.html
File metadata and controls
155 lines (154 loc) · 6.98 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<!--
anytimelime · research dashboard — live view of what the research model is
doing while research.sh runs. research.sh copies this file into
.research-live/ and serves that directory on a local port (default 8070);
the page polls ./events.jsonl, which research.sh appends to as it works:
{"t":"14:03:22","kind":"status","text":"trying FREE openrouter/free …"}
{"t":"14:03:40","kind":"delta","text":"I found that Groq of…"} (streamed)
Kinds: status = a step/line, delta = streamed output token text from the
model, done = run finished. No server logic — just fetch + render.
-->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>anytimelime · research live</title>
<style>
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
min-height: 100vh; display: flex; flex-direction: column; align-items: center;
justify-content: center; gap: 14px; background: #0f0f11; color: #e4e4e7;
padding: 1.5rem; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.page-title { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: #52525b; }
.page-title em { color: #d97757; font-style: normal; }
.cc-box {
width: min(760px, 100%); border-radius: 10px; overflow: hidden;
border: 1px solid #262626; background: #0d0d0d; box-shadow: 0 12px 40px rgba(0,0,0,.55);
}
.cc-titlebar {
display: flex; align-items: center; gap: 10px; padding: 9px 14px;
background: linear-gradient(#1c1c1c,#141414); border-bottom: 1px solid #232323;
font-family: ui-monospace, Menlo, Monaco, monospace; font-size: 11.5px;
}
.cc-dots { display: flex; gap: 6px; }
.cc-dot { width: 11px; height: 11px; border-radius: 50%; }
.cc-dot:nth-child(1){background:#ff5f57}.cc-dot:nth-child(2){background:#febc2e}.cc-dot:nth-child(3){background:#28c840}
.cc-title { color: #8a8578; letter-spacing: .08em; }
.cc-model { margin-left: auto; color: #d97757; border: 1px solid #3a2a22; background: #191210;
border-radius: 4px; padding: 2px 8px; font-size: 10.5px; }
.cc-body {
height: 400px; overflow-y: auto; padding: 16px 18px;
font-family: ui-monospace, Menlo, Monaco, monospace; font-size: 13px; line-height: 1.65;
color: #e8e4dc; white-space: pre-wrap; word-break: break-word;
}
.cc-body::-webkit-scrollbar { width: 8px; }
.cc-body::-webkit-scrollbar-thumb { background: #262626; border-radius: 4px; }
.cc-line { margin-bottom: 4px; }
.cc-line .t { color: #4d4a42; margin-right: 8px; font-size: 11px; }
.cc-status { color: #9ec3e6; }
.cc-activity { color: #d9a05f; }
.cc-delta { color: #e8e4dc; }
.cc-done { color: #28c840; font-weight: 700; }
.cc-caret {
display: inline-block; width: 8px; height: 15px; margin-left: 2px;
vertical-align: text-bottom; background: #d97757; animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.cc-statusbar {
display: flex; align-items: center; gap: 8px; padding: 7px 14px;
border-top: 1px solid #232323; background: #111;
font-family: ui-monospace, Menlo, Monaco, monospace; font-size: 11px; color: #6b6b6b;
}
.cc-live { width: 7px; height: 7px; border-radius: 50%; background: #3f3f3f; }
.cc-statusbar.live .cc-live { background: #d97757; animation: blink 1.2s steps(1) infinite; }
.cc-statusbar.done .cc-live { background: #28c840; }
</style>
</head>
<body>
<div class="page-title">anytimelime · <em>research live</em></div>
<div class="cc-box">
<div class="cc-titlebar">
<div class="cc-dots"><span class="cc-dot"></span><span class="cc-dot"></span><span class="cc-dot"></span></div>
<span class="cc-title">free-model research — streaming</span>
<span class="cc-model" id="modelChip">…</span>
</div>
<div class="cc-body" id="body"></div>
<div class="cc-statusbar live" id="status">
<span class="cc-live"></span><span id="statusText">waiting for events…</span>
</div>
</div>
<script>
"use strict";
const body = document.getElementById("body");
const statusEl = document.getElementById("status");
const statusText = document.getElementById("statusText");
const modelChip = document.getElementById("modelChip");
let seen = 0; // events already rendered (detects file reset = new run)
let deltaPara = null; // current streaming <span> for delta text
let caret = null;
let quietMs = 0;
function setStatus(mode, text) {
statusEl.className = "cc-statusbar " + (mode || "");
statusText.textContent = text;
}
function newDeltaBlock() {
if (deltaPara) return;
const p = document.createElement("span"); p.className = "cc-delta";
caret = document.createElement("span"); caret.className = "cc-caret";
const line = document.createElement("div"); line.className = "cc-line";
line.append(p, caret); body.appendChild(line);
deltaPara = p;
}
function closeDeltaBlock() {
if (caret) { caret.remove(); caret = null; }
deltaPara = null;
}
function render(ev) {
const line = document.createElement("div"); line.className = "cc-line";
const t = document.createElement("span"); t.className = "t"; t.textContent = ev.t;
const s = document.createElement("span");
if (ev.model) modelChip.textContent = ev.model; // who is speaking — always
if (ev.kind === "delta") {
// deltas stream into their own paragraph so tokens appear mid-line
newDeltaBlock();
deltaPara.textContent += ev.text;
return;
}
closeDeltaBlock();
if (ev.kind === "done") s.className = "cc-done";
else if (ev.kind === "activity") s.className = "cc-activity";
else if (ev.kind === "status") s.className = "cc-status";
s.textContent = ev.text;
line.append(t, s); body.appendChild(line);
if (ev.model) modelChip.textContent = ev.model;
if (ev.kind === "done") setStatus("done", ev.text);
}
async function poll() {
try {
const r = await fetch("events.jsonl", { cache: "no-store" });
if (!r.ok) throw new Error(r.status);
const text = await r.text();
// Only complete lines count: a fetch racing an append can deliver a
// half-written last line — parsing it fails and, if counted as seen,
// its remainder is never rendered (text vanishes mid-token).
const complete = text.endsWith("\n") ? text : text.slice(0, text.lastIndexOf("\n"));
const lines = complete.split("\n").filter(Boolean);
if (lines.length < seen) { body.textContent = ""; seen = 0; deltaPara = null; caret = null; } // new run
for (const l of lines.slice(seen)) {
try { render(JSON.parse(l)); } catch {}
}
seen = lines.length;
if (lines.length && statusEl.className.indexOf("done") === -1) {
const last = JSON.parse(lines[lines.length - 1]);
if (last.kind !== "done") setStatus("live", last.kind === "delta" ? "streaming answer…" : "working…");
}
body.scrollTop = body.scrollHeight;
quietMs = 0;
} catch { quietMs += 1500; if (quietMs >= 60000) setStatus("", "no events yet — is research.sh running?"); }
}
setInterval(poll, 1500); poll();
</script>
</body>
</html>