NOT-OMEGA commited on
Commit
6eafce8
Β·
verified Β·
1 Parent(s): cba0c9e

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +1347 -541
index.html CHANGED
@@ -1,473 +1,1278 @@
1
  <!DOCTYPE html>
2
  <html lang="en">
 
3
  <head>
4
- <meta charset="UTF-8"/>
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
- <title>NanoMind Β· 152M</title>
7
- <link rel="preconnect" href="https://fonts.googleapis.com">
8
- <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500;700&family=DM+Sans:wght@300;500;700;900&display=swap" rel="stylesheet">
9
- <style>
10
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
11
- :root{
12
- --bg: #06080f; --bg1: #0c0f1a; --bg2: #121627; --bg3: #1a2035; --bg4: #222840;
13
- --acc: #7c6bff; --acc2: #9d8fff; --acc3: #5a48e0;
14
- --dim: rgba(124,107,255,.08); --dimb: rgba(124,107,255,.18);
15
- --cyan: #3ddcff; --green:#3dffb4; --red:#ff5c6e; --warn:#ffc260;
16
- --t0:#f2f0ff; --t1:#c0bde8; --t2:#7a78a0; --t3:#3a384d;
17
- --mono:'IBM Plex Mono',monospace; --sans:'DM Sans',sans-serif;
18
- --r:8px; --sb:280px;
19
- }
20
- html,body{height:100%;background:var(--bg);color:var(--t0);font-family:var(--mono);font-size:13px;overflow:hidden}
21
- .app{display:flex;height:100vh}
22
- .app::before{content:'';position:fixed;inset:0;
23
- background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
24
- pointer-events:none;z-index:0;opacity:.4}
25
- .app>*{position:relative;z-index:1}
26
- .sb{width:var(--sb);min-width:var(--sb);background:var(--bg1);border-right:1px solid var(--bg3);display:flex;flex-direction:column;overflow:hidden}
27
- .sb-logo{padding:16px;background:var(--bg);border-bottom:1px solid var(--bg3);flex-shrink:0}
28
- .logo-row{display:flex;align-items:center;gap:10px}
29
- .logo-icon{width:34px;height:34px;border-radius:9px;background:linear-gradient(135deg,var(--acc3),var(--acc2));display:flex;align-items:center;justify-content:center;flex-shrink:0;box-shadow:0 0 20px rgba(124,107,255,.35)}
30
- .logo-icon svg{fill:#fff}
31
- .logo-text h2{font-family:var(--sans);font-size:18px;font-weight:900;letter-spacing:-.04em;color:var(--t0)}
32
- .logo-text h2 em{color:var(--acc2);font-style:normal}
33
- .logo-text p{font-size:9px;color:var(--t2);margin-top:2px;letter-spacing:.1em;text-transform:uppercase}
34
- .sb-tabs{display:flex;border-bottom:1px solid var(--bg3);flex-shrink:0;background:var(--bg1)}
35
- .sb-tab{flex:1;padding:8px 4px;text-align:center;font-size:9px;font-weight:700;color:var(--t2);text-transform:uppercase;letter-spacing:.08em;cursor:pointer;border:none;background:none;font-family:var(--mono);border-bottom:2px solid transparent;transition:.15s}
36
- .sb-tab.on{color:var(--acc2);border-bottom-color:var(--acc);background:var(--dim)}
37
- .sb-body{flex:1;overflow-y:auto;padding:10px;scrollbar-width:thin;scrollbar-color:var(--bg4) transparent}
38
- .card{background:var(--bg2);border:1px solid var(--bg3);border-radius:var(--r);padding:11px 13px;margin-bottom:8px}
39
- .ct{font-size:9px;font-weight:700;color:var(--t2);text-transform:uppercase;letter-spacing:.1em;margin-bottom:8px;display:flex;align-items:center;gap:6px}
40
- .sr{display:flex;justify-content:space-between;align-items:center;padding:3px 0}
41
- .sl{color:var(--t1);font-size:11px}
42
- .sv{font-size:12px;font-weight:700;font-variant-numeric:tabular-nums;color:var(--t0)}
43
- .g{color:var(--green)}.c{color:var(--cyan)}.y{color:var(--warn)}.r{color:var(--red)}.p{color:var(--acc2)}
44
- .dot{display:inline-block;width:6px;height:6px;border-radius:50%;flex-shrink:0}
45
- .dot.off{background:var(--t3)}.dot.on{background:var(--green);animation:pulse 1.4s infinite}
46
- @keyframes pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.3;transform:scale(.7)}}
47
- canvas#spark{width:100%;height:44px;display:block;border-radius:var(--r);background:var(--bg)}
48
- .ta{width:100%;background:var(--bg);border:1px solid var(--bg3);border-radius:var(--r);color:var(--t0);font-size:11px;padding:8px 10px;resize:vertical;min-height:56px;font-family:var(--mono);line-height:1.6}
49
- .ta:focus{outline:none;border-color:var(--acc)}
50
- .pg{display:flex;flex-direction:column;gap:4px}
51
- .pg label{font-size:9px;color:var(--t2);text-transform:uppercase;letter-spacing:.08em;display:flex;justify-content:space-between}
52
- .pg label span{color:var(--acc2);font-weight:700}
53
- .pg input[type=range]{width:100%;-webkit-appearance:none;height:2px;background:var(--bg4);border-radius:1px;outline:none}
54
- .pg input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:11px;height:11px;border-radius:50%;background:var(--acc);cursor:pointer;border:2px solid var(--bg1)}
55
- .btn{display:inline-flex;align-items:center;gap:5px;padding:6px 12px;border-radius:var(--r);border:1px solid var(--bg4);cursor:pointer;font-size:10px;font-weight:700;font-family:var(--mono);text-transform:uppercase;letter-spacing:.05em;transition:.13s}
56
- .bp{background:var(--acc);color:#fff;border-color:var(--acc)}
57
- .bp:hover{background:var(--acc2)}.bs{background:var(--bg3);color:var(--t1)}
58
- .bs:hover{background:var(--bg4);color:var(--t0)}
59
- .btn.full{width:100%;justify-content:center}.btn:disabled{opacity:.3;cursor:not-allowed}
60
-
61
- /* ── Filter items ── */
62
- .fi{display:flex;align-items:center;gap:8px;padding:5px 7px;border-radius:6px;cursor:pointer;border:1px solid transparent;transition:.12s;margin-bottom:3px;user-select:none}
63
- .fi:hover{background:var(--bg3)}
64
- .fi.on{background:rgba(124,107,255,.1);border-color:rgba(124,107,255,.25)}
65
- .fi.stories-on{background:rgba(61,220,255,.08);border-color:rgba(61,220,255,.25)}
66
- .fcb{width:13px;height:13px;border-radius:3px;border:1px solid var(--bg4);background:var(--bg);display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:.12s}
67
- .fi.on .fcb{background:var(--acc);border-color:var(--acc)}
68
- .fi.stories-on .fcb{background:var(--cyan);border-color:var(--cyan)}
69
- .fcb svg{opacity:0;transition:.1s}
70
- .fi.on .fcb svg,.fi.stories-on .fcb svg{opacity:1}
71
- .fdot{width:6px;height:6px;border-radius:50%;flex-shrink:0}
72
- .flabel{font-size:11px;color:var(--t1)}
73
- .fi.on .flabel,.fi.stories-on .flabel{color:var(--t0)}
74
-
75
- #bench-panel{display:none;flex-direction:column;height:100%;overflow:hidden}
76
- #bench-panel.visible{display:flex}
77
- #stats-panel,#params-panel{display:flex;flex-direction:column;flex:1;overflow:hidden}
78
- .bench-actions{padding:10px;flex-shrink:0;display:flex;flex-direction:column;gap:6px}
79
- .bench-scroll{flex:1;overflow-y:auto;padding:0 10px 10px;scrollbar-width:thin;scrollbar-color:var(--bg4) transparent}
80
- .b-grid{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin-bottom:10px}
81
- .b-stat{background:var(--bg2);border:1px solid var(--bg3);border-radius:var(--r);padding:10px;text-align:center}
82
- .b-stat .bv{font-family:var(--sans);font-size:22px;font-weight:900;color:var(--acc2);letter-spacing:-.04em}
83
- .b-stat .bk{font-size:9px;color:var(--t2);text-transform:uppercase;letter-spacing:.1em;margin-top:2px}
84
- .ph-card{background:var(--bg2);border:1px solid var(--bg3);border-radius:var(--r);padding:9px 11px;margin-bottom:6px;animation:fadeup .2s ease}
85
- .ph-title{font-size:9px;font-weight:700;color:var(--acc2);text-transform:uppercase;letter-spacing:.08em;margin-bottom:6px}
86
- .ph-label{font-size:11px;color:var(--t2);margin-bottom:4px}
87
- .ph-stats{display:flex;gap:8px;flex-wrap:wrap;margin-top:5px}
88
- .ph-stat{display:flex;flex-direction:column;gap:1px;min-width:50px}
89
- .ph-stat .pv{font-size:13px;font-weight:700;color:var(--green);font-variant-numeric:tabular-nums}
90
- .ph-stat .pk{font-size:9px;color:var(--t2);text-transform:uppercase;letter-spacing:.06em}
91
- .ph-bar{height:2px;background:var(--bg4);border-radius:1px;margin-top:5px;overflow:hidden}
92
- .ph-fill{height:100%;background:linear-gradient(90deg,var(--acc3),var(--acc2));border-radius:1px;transition:width .5s ease;width:0%}
93
- .ph-running{display:flex;align-items:center;gap:5px;font-size:10px;color:var(--warn)}
94
- .spin{width:8px;height:8px;border:1.5px solid var(--warn);border-top-color:transparent;border-radius:50%;animation:spin .7s linear infinite;flex-shrink:0}
95
- @keyframes spin{to{transform:rotate(360deg)}}
96
- .bench-empty{text-align:center;padding:30px 16px;color:var(--t2);font-size:12px;line-height:1.9}
97
- .verdict{padding:10px 12px;border-radius:var(--r);font-size:11px;margin-bottom:8px;border:1px solid var(--bg3)}
98
- .verdict.good{border-color:rgba(61,255,180,.3);background:rgba(61,255,180,.06);color:var(--green)}
99
- .verdict.mid{border-color:rgba(255,194,96,.3);background:rgba(255,194,96,.06);color:var(--warn)}
100
- .chat{flex:1;display:flex;flex-direction:column;overflow:hidden}
101
- .chat-hdr{height:50px;display:flex;align-items:center;padding:0 20px;border-bottom:1px solid var(--bg3);background:var(--bg1);gap:8px;flex-shrink:0}
102
- .badge{background:var(--dim);border:1px solid rgba(124,107,255,.3);border-radius:20px;padding:3px 10px;font-size:10px;font-weight:700;color:var(--acc2);font-family:var(--sans)}
103
- .hdr-title{font-family:var(--sans);font-size:13px;font-weight:600;color:var(--t1)}
104
- .spc{flex:1}
105
- .hpill{display:flex;align-items:center;gap:6px;font-size:10px;color:var(--t2);text-transform:uppercase;letter-spacing:.06em}
106
- .msgs{flex:1;overflow-y:auto;display:flex;flex-direction:column;scrollbar-width:thin;scrollbar-color:var(--bg4) transparent}
107
- .welcome{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;text-align:center;padding:40px;animation:fadeup .4s ease}
108
- .wlogo{font-family:var(--sans);font-size:72px;font-weight:900;background:linear-gradient(135deg,var(--acc),var(--cyan));-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;letter-spacing:-.05em;line-height:1}
109
- .welcome h2{font-family:var(--sans);font-size:22px;font-weight:700;color:var(--t0);letter-spacing:-.02em}
110
- .welcome p{max-width:400px;line-height:1.8;font-size:12px;color:var(--t1)}
111
- .chips{display:flex;gap:6px;flex-wrap:wrap;justify-content:center;margin-top:2px}
112
- .chip{font-size:9px;padding:4px 10px;border:1px solid var(--bg4);border-radius:20px;color:var(--t2);letter-spacing:.07em;text-transform:uppercase;background:var(--bg2)}
113
- .mg{display:flex;gap:0;padding:14px 20px;border-bottom:1px solid var(--bg3);animation:fadeup .18s ease}
114
- .mg:last-child{border-bottom:none}
115
- @keyframes fadeup{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
116
- .mg-role{width:60px;flex-shrink:0;padding-top:2px}
117
- .mlabel{font-size:9px;font-weight:700;letter-spacing:.1em;text-transform:uppercase}
118
- .mg.user .mlabel{color:var(--acc2)}.mg.asst .mlabel{color:var(--cyan)}
119
- .mg-body{flex:1;min-width:0}
120
- .bubble{font-size:13px;line-height:1.75;color:var(--t1);white-space:pre-wrap;word-break:break-word;max-width:660px}
121
- .mg.user .bubble{color:var(--t2)}
122
- .cur{display:inline-block;width:7px;height:2px;background:var(--acc2);margin-left:3px;vertical-align:middle;animation:blink .6s infinite}
123
- @keyframes blink{0%,49%{opacity:1}50%,100%{opacity:0}}
124
- .bmeta{font-size:10px;color:var(--t3);margin-top:5px;display:flex;flex-wrap:wrap;gap:8px}
125
- .bmeta b{color:var(--acc2)}
126
- .inputbar{padding:12px 16px;border-top:1px solid var(--bg3);background:var(--bg1);flex-shrink:0}
127
- .inputwrap{background:var(--bg2);border:1px solid var(--bg3);border-radius:var(--r);display:flex;align-items:flex-end;padding:3px 3px 3px 12px;gap:4px;transition:.13s}
128
- .inputwrap:focus-within{border-color:var(--acc)}
129
- #inp{flex:1;background:none;border:none;outline:none;color:var(--t0);font-size:13px;font-family:var(--mono);resize:none;line-height:1.6;max-height:110px;padding:7px 0}
130
- #inp::placeholder{color:var(--t3)}
131
- .sbtn{background:linear-gradient(135deg,var(--acc3),var(--acc2));border:none;cursor:pointer;width:32px;height:32px;border-radius:6px;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:.13s;align-self:flex-end;margin-bottom:3px;box-shadow:0 0 12px rgba(124,107,255,.4)}
132
- .sbtn:hover{filter:brightness(1.15)}.sbtn:disabled{opacity:.3;cursor:not-allowed}
133
- .sbtn svg{fill:#fff}
134
- .hint{margin-top:5px;font-size:10px;color:var(--t3);text-align:right;letter-spacing:.04em}
135
- </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  </head>
 
137
  <body>
138
- <div class="app">
139
-
140
- <aside class="sb">
141
- <div class="sb-logo">
142
- <div class="logo-row">
143
- <div class="logo-icon">
144
- <svg width="18" height="18" viewBox="0 0 24 24">
145
- <path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/>
146
- </svg>
 
 
 
 
 
 
 
147
  </div>
148
- <div class="logo-text">
149
- <h2>Nano<em>Mind</em></h2>
150
- <p>152M Β· GPT-2 Β· AVX2 + OpenMP</p>
 
 
151
  </div>
152
- </div>
153
- </div>
154
 
155
- <div class="sb-tabs">
156
- <button class="sb-tab on" id="tab-stats" onclick="switchTab('stats')">Stats</button>
157
- <button class="sb-tab" id="tab-bench" onclick="switchTab('bench')">Bench</button>
158
- <button class="sb-tab" id="tab-params" onclick="switchTab('params')">Params</button>
159
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
- <!-- Stats Tab -->
162
- <div id="stats-panel">
163
- <div class="sb-body">
164
- <div class="card">
165
- <div class="ct"><span class="dot off" id="dot-s"></span>Live</div>
166
- <div class="sr"><span class="sl">Throughput</span><span class="sv g" id="s-tps">β€”</span></div>
167
- <div class="sr"><span class="sl">TTFT</span> <span class="sv c" id="s-ttft">β€”</span></div>
168
- <div class="sr"><span class="sl">Tokens out</span><span class="sv" id="s-toks">β€”</span></div>
169
- <div class="sr"><span class="sl">Latency</span> <span class="sv y" id="s-lat">β€”</span></div>
170
- </div>
171
- <div class="card">
172
- <div class="ct">Throughput History</div>
173
- <canvas id="spark"></canvas>
174
- <div style="margin-top:6px">
175
- <div class="sr"><span class="sl">Session avg</span><span class="sv g" id="s-avg">β€”</span></div>
176
- <div class="sr"><span class="sl">Peak</span> <span class="sv g" id="s-peak">β€”</span></div>
177
  </div>
178
  </div>
179
- <div class="card">
180
- <div class="ct">Session</div>
181
- <div class="sr"><span class="sl">Turns</span> <span class="sv" id="s-turns">0</span></div>
182
- <div class="sr"><span class="sl">Total tokens</span><span class="sv" id="s-totok">0</span></div>
183
- <div class="sr"><span class="sl">KV cache</span> <span class="sv c" id="s-kv">β€”</span></div>
184
- <div class="sr"><span class="sl">Server RAM</span> <span class="sv" id="s-ram">β€”</span></div>
185
- <div style="display:flex;gap:6px;margin-top:8px">
186
- <button class="btn bs full" onclick="clearChat()">β†Ί Reset</button>
 
 
 
 
 
187
  </div>
188
- </div>
189
- <div class="card">
190
- <div class="ct">Engine</div>
191
- <div class="sr"><span class="sl">Status</span> <span class="sv g" id="s-eng">β€”</span></div>
192
- <div class="sr"><span class="sl">Sessions</span><span class="sv" id="s-sess">β€”</span></div>
193
- <div class="sr"><span class="sl">Uptime</span> <span class="sv" id="s-up">β€”</span></div>
194
  </div>
195
 
196
- <!-- ══ FILTERS CARD ══ -->
197
- <div class="card">
198
- <div class="ct">Filters</div>
199
- <!-- Stories β€” redirects to inference space -->
200
- <div class="fi" id="fi-stories" onclick="goStories()">
201
- <div class="fcb"><svg width="8" height="6" viewBox="0 0 8 6" fill="none"><path d="M1 3l2 2 4-4" stroke="#fff" stroke-width="1.5" stroke-linecap="round"/></svg></div>
202
- <div class="fdot" style="background:var(--cyan)"></div>
203
- <span class="flabel">Stories β†—</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  </div>
205
  </div>
206
- <!-- ══ END FILTERS CARD ══ -->
207
-
208
- </div>
209
- </div>
210
 
211
- <!-- Benchmark Tab -->
212
- <div id="bench-panel">
213
- <div class="bench-actions">
214
- <button class="btn bp full" id="btnbench" onclick="runBench()">β–Ά Run Benchmark</button>
215
- <div style="font-size:9px;color:var(--t2);text-align:center;line-height:1.6">
216
- 5 phases Β· cold/warm TTFT Β· throughput Β· concurrency
217
- </div>
218
- </div>
219
- <div class="bench-scroll" id="bench-scroll">
220
- <div class="bench-empty" id="bench-empty">
221
- Run benchmark to measure<br>real system performance
222
- </div>
223
- </div>
224
- </div>
225
 
226
- <!-- Params Tab -->
227
- <div id="params-panel" style="display:none">
228
- <div class="sb-body">
229
- <div class="card">
230
- <div class="ct">System Prompt</div>
231
- <textarea class="ta" id="sysprompt" rows="4">You are a helpful, thoughtful, and articulate AI assistant.</textarea>
232
- </div>
233
- <div class="card">
234
- <div class="ct">Generation</div>
235
- <div style="display:flex;flex-direction:column;gap:10px;margin-top:2px">
236
- <div class="pg">
237
- <label>Temperature <span id="v-temp">0.70</span></label>
238
- <input type="range" id="p-temp" min="0.1" max="2.0" step="0.05" value="0.7"
239
- oninput="document.getElementById('v-temp').textContent=parseFloat(this.value).toFixed(2)">
240
- </div>
241
- <div class="pg">
242
- <label>Top-K <span id="v-topk">40</span></label>
243
- <input type="range" id="p-topk" min="1" max="200" step="1" value="40"
244
- oninput="document.getElementById('v-topk').textContent=this.value">
245
- </div>
246
- <div class="pg">
247
- <label>Max tokens <span id="v-maxt">200</span></label>
248
- <input type="range" id="p-maxt" min="20" max="256" step="10" value="200"
249
- oninput="document.getElementById('v-maxt').textContent=this.value">
250
  </div>
251
  </div>
252
  </div>
253
- </div>
254
- </div>
255
- </aside>
256
-
257
- <!-- CHAT -->
258
- <main class="chat">
259
- <header class="chat-hdr">
260
- <div class="badge">NanoMind Β· 152M</div>
261
- <span class="hdr-title">Chat</span>
262
- <div class="spc"></div>
263
- <div class="hpill">
264
- <span class="dot off" id="dot-h"></span>
265
- <span id="hstatus">Idle</span>
266
- </div>
267
- </header>
268
-
269
- <div class="msgs" id="msgs">
270
- <div class="welcome" id="welcome">
271
- <div class="wlogo">NM</div>
272
- <h2>NanoMind Studio</h2>
273
- <p>152M parameter GPT-2 model trained on GPT-4 quality data β€”
274
- running on a hand-written C++ inference engine with AVX2 SIMD,
275
- OpenMP parallelism &amp; persistent KV-cache.</p>
276
- <div class="chips">
277
- <span class="chip">152M params</span>
278
- <span class="chip">AVX2 SIMD</span>
279
- <span class="chip">OpenMP</span>
280
- <span class="chip">KV Cache</span>
281
- <span class="chip">Streaming</span>
282
- <span class="chip">GPT-4 Data</span>
283
  </div>
284
- </div>
285
  </div>
286
 
287
- <div class="inputbar">
288
- <div class="inputwrap">
289
- <textarea id="inp" rows="1" placeholder="Send a message…" onkeydown="handleKey(event)"></textarea>
290
- <button class="sbtn" id="sbtn" onclick="send()">
291
- <svg width="14" height="14" viewBox="0 0 24 24"><path d="M2 21l21-9L2 3v7l15 2-15 2v7z"/></svg>
292
- </button>
293
- </div>
294
- <div class="hint">Enter ↡ to send Β· Shift+Enter for newline</div>
295
- </div>
296
- </main>
297
- </div>
298
-
299
- <script>
300
- const API = '';
301
- let sessId = crypto.randomUUID();
302
- let busy = false, turns = 0, totalToks = 0;
303
- let tpsHist = [], peakTps = 0;
304
-
305
- // ── Filter logic ─────────────────────────────────────────────
306
- function toggleFilter(el, key) {
307
- el.classList.toggle('on');
308
- }
309
-
310
- function goStories() {
311
- const el = document.getElementById('fi-stories');
312
- el.classList.add('stories-on');
313
- setTimeout(() => {
314
- window.open('https://not-omega-inference.hf.space/', '_blank');
315
- setTimeout(() => el.classList.remove('stories-on'), 400);
316
- }, 160);
317
- }
318
-
319
- // ── Tab Switch ───────────────────────────────────────────────
320
- function switchTab(name) {
321
- ['stats','bench','params'].forEach(t => {
322
- const panelId = t === 'stats' ? 'stats-panel' : t + '-panel';
323
- const panel = document.getElementById(panelId);
324
- const tab = document.getElementById('tab-' + t);
325
- const show = t === name;
326
- panel.style.display = show ? 'flex' : 'none';
327
- tab.classList.toggle('on', show);
328
- });
329
- }
330
-
331
- // ── Input ────────────────────────────────────────────────────
332
- const inp = document.getElementById('inp');
333
- inp.addEventListener('input', () => {
334
- inp.style.height = 'auto';
335
- inp.style.height = Math.min(inp.scrollHeight, 110) + 'px';
336
- });
337
- function handleKey(e) {
338
- if (e.key==='Enter' && !e.shiftKey) { e.preventDefault(); send(); }
339
- }
340
-
341
- // ── UI Helpers ───────────────────────────────────────────────
342
- function setBusy(v) {
343
- busy = v;
344
- document.getElementById('sbtn').disabled = v;
345
- ['dot-s','dot-h'].forEach(id => {
346
- document.getElementById(id).className = 'dot ' + (v?'on':'off');
347
- });
348
- document.getElementById('hstatus').textContent = v ? 'Generating…' : 'Idle';
349
- }
350
- function scrollBot() { const el=document.getElementById('msgs'); el.scrollTop=el.scrollHeight; }
351
- function hideWelcome() { const w=document.getElementById('welcome'); if(w) w.remove(); }
352
- function esc(s) { return s.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#39;'); }
353
-
354
- // ── Messages ─────────────────────────────────────────────────
355
- function addUserMsg(text) {
356
- hideWelcome();
357
- const g = document.createElement('div'); g.className='mg user';
358
- g.innerHTML=`<div class="mg-role"><div class="mlabel">You</div></div>
359
  <div class="mg-body"><div class="bubble">${esc(text)}</div></div>`;
360
- document.getElementById('msgs').appendChild(g); scrollBot();
361
- }
362
- function createAsstSlot() {
363
- const g = document.createElement('div'); g.className='mg asst';
364
- const bid='b'+Date.now(), mid='m'+Date.now();
365
- g.innerHTML=`<div class="mg-role"><div class="mlabel">AI</div></div>
366
  <div class="mg-body">
367
  <div class="bubble" id="${bid}"><span class="cur"></span></div>
368
  <div class="bmeta" id="${mid}"></div>
369
  </div>`;
370
- document.getElementById('msgs').appendChild(g); scrollBot();
371
- return { bubble:document.getElementById(bid), meta:document.getElementById(mid) };
372
- }
373
-
374
- // ── Send ─────────────────────────────────────────────────────
375
- async function send() {
376
- if (busy) return;
377
- const text = inp.value.trim(); if(!text) return;
378
- inp.value=''; inp.style.height='auto';
379
- addUserMsg(text); setBusy(true);
380
- const {bubble,meta} = createAsstSlot();
381
- let content='', t0=Date.now(), firstTok=null, tokCount=0;
382
- const payload = {
383
- message: text,
384
- session_id: sessId,
385
- system_prompt: document.getElementById('sysprompt').value,
386
- max_new_tokens: parseInt(document.getElementById('p-maxt').value),
387
- temperature: parseFloat(document.getElementById('p-temp').value),
388
- top_k: parseInt(document.getElementById('p-topk').value),
389
- };
390
- try {
391
- const resp = await fetch(`${API}/chat`,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload)});
392
- if(!resp.ok) throw new Error(`HTTP ${resp.status}`);
393
- const reader=resp.body.getReader(), decoder=new TextDecoder();
394
- let buf='';
395
- while(true) {
396
- const {done,value}=await reader.read(); if(done) break;
397
- buf+=decoder.decode(value,{stream:true});
398
- let nl;
399
- while((nl=buf.indexOf('\n'))!==-1) {
400
- const line=buf.slice(0,nl).trim(); buf=buf.slice(nl+1);
401
- if(!line.startsWith('data:')) continue;
402
- const raw=line.slice(5).trim(); if(raw==='[DONE]') break;
403
- let chunk; try{chunk=JSON.parse(raw);}catch{continue;}
404
- if(chunk.type==='token'){
405
- if(firstTok===null) firstTok=Date.now();
406
- content+=chunk.text; tokCount++; totalToks++;
407
- document.getElementById('s-totok').textContent=totalToks;
408
- document.getElementById('s-toks').textContent=tokCount+' tok';
409
- document.getElementById('s-ttft').textContent=(firstTok-t0)+' ms';
410
- bubble.innerHTML=esc(content)+'<span class="cur"></span>';
411
- scrollBot();
412
- } else if(chunk.type==='done') {
413
- bubble.innerHTML=esc(content);
414
- const ttft=firstTok?(firstTok-t0):0, tps=chunk.tps, ms=chunk.total_ms;
415
- meta.innerHTML=`<b>${tps}</b> tok/s Β· TTFT <b>${ttft}ms</b> Β· <b>${tokCount}</b> tokens Β· <b>${ms.toFixed(0)}ms</b>`;
416
- document.getElementById('s-tps').textContent=tps+' tok/s';
417
- document.getElementById('s-lat').textContent=ms.toFixed(0)+' ms';
418
- tpsHist.push(tps); if(tpsHist.length>30) tpsHist.shift();
419
- if(tps>peakTps) peakTps=tps;
420
- const avg=(tpsHist.reduce((a,b)=>a+b,0)/tpsHist.length).toFixed(1);
421
- document.getElementById('s-avg').textContent=avg+' tok/s';
422
- document.getElementById('s-peak').textContent=peakTps.toFixed(1)+' tok/s';
423
- if(chunk.session_id){
424
- fetch(`${API}/chat/history?session_id=${chunk.session_id}`)
425
- .then(r=>r.json())
426
- .then(d=>{document.getElementById('s-kv').textContent=(d.tokens_in_engine||0)+' tok';})
427
- .catch(()=>{});
 
 
 
 
 
 
428
  }
429
- turns++; document.getElementById('s-turns').textContent=turns;
430
- drawSpark();
431
- } else if(chunk.type==='error'){
432
- bubble.innerHTML+=`<br><span style="color:var(--red)">⚠ ${esc(chunk.message)}</span>`;
433
  }
 
 
 
 
 
 
434
  }
435
  }
436
- } catch(err) {
437
- if(tokCount===0) bubble.innerHTML=`<span style="color:var(--red)">Connection error: ${esc(err.message)}</span>`;
438
- else meta.innerHTML+=` <span style="color:var(--warn)">[interrupted]</span>`;
439
- } finally {
440
- const c=bubble.querySelector('.cur'); if(c) c.remove();
441
- setBusy(false); scrollBot();
442
- }
443
- }
444
-
445
- // ── Sparkline ────────────────────────────────────────────────
446
- function drawSpark() {
447
- const el=document.getElementById('spark'), ctx=el.getContext('2d');
448
- const dpr=window.devicePixelRatio||1;
449
- el.width=el.clientWidth*dpr; el.height=el.clientHeight*dpr;
450
- ctx.scale(dpr,dpr);
451
- const W=el.clientWidth, H=el.clientHeight;
452
- ctx.clearRect(0,0,W,H);
453
- const d=tpsHist; if(d.length<2) return;
454
- const mx=Math.max(...d)*1.15||1, step=W/(d.length-1);
455
- const grad=ctx.createLinearGradient(0,0,0,H);
456
- grad.addColorStop(0,'rgba(124,107,255,.3)'); grad.addColorStop(1,'rgba(124,107,255,.02)');
457
- ctx.beginPath();
458
- d.forEach((v,i)=>{const x=i*step,y=H-(v/mx)*(H-4)-2;i===0?ctx.moveTo(x,y):ctx.lineTo(x,y);});
459
- ctx.strokeStyle='#9d8fff'; ctx.lineWidth=1.5; ctx.stroke();
460
- ctx.lineTo((d.length-1)*step,H); ctx.lineTo(0,H); ctx.closePath();
461
- ctx.fillStyle=grad; ctx.fill();
462
- }
463
-
464
- // ── Clear ────────────────────────────────────────────────────
465
- async function clearChat() {
466
- if(busy) return;
467
- await fetch(`${API}/chat/reset`,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({session_id:sessId})}).catch(()=>{});
468
- sessId=crypto.randomUUID();
469
- turns=0; totalToks=0; tpsHist=[]; peakTps=0;
470
- document.getElementById('msgs').innerHTML=`
471
  <div class="welcome" id="welcome">
472
  <div class="wlogo">NM</div>
473
  <h2>NanoMind Studio</h2>
@@ -477,110 +1282,111 @@ async function clearChat() {
477
  <span class="chip">OpenMP</span><span class="chip">KV Cache</span>
478
  </div>
479
  </div>`;
480
- ['s-turns','s-totok'].forEach(id=>document.getElementById(id).textContent='0');
481
- ['s-tps','s-ttft','s-lat','s-avg','s-peak','s-toks','s-kv'].forEach(id=>document.getElementById(id).textContent='β€”');
482
- drawSpark();
483
- }
484
-
485
- // ── Metrics Poll ─────────────────────────────────────────────
486
- async function pollMetrics() {
487
- try {
488
- const r=await fetch(`${API}/metrics`); if(!r.ok) return;
489
- const d=await r.json();
490
- document.getElementById('s-ram').textContent=d.system_ram_used_pct.toFixed(0)+'% ('+d.process_ram_mb+'MB)';
491
- document.getElementById('s-eng').textContent=(d.engines_ready||0)+' / '+(d.n_engines||'?')+' ready';
492
- document.getElementById('s-sess').textContent=d.active_sessions||0;
493
- document.getElementById('s-up').textContent=fmtUptime(d.uptime_s||0);
494
- } catch {}
495
- }
496
- function fmtUptime(s){
497
- if(s<60) return s+'s';
498
- if(s<3600) return Math.floor(s/60)+'m '+(s%60|0)+'s';
499
- return Math.floor(s/3600)+'h '+Math.floor((s%3600)/60)+'m';
500
- }
501
- pollMetrics(); setInterval(pollMetrics, 4000);
502
-
503
- // ── Benchmark ────────────────────────────────────────────────
504
- const PHASES = [
505
- {id:'cold_ttft',title:'Phase 1 β€” Cold TTFT',desc:'First token latency on a fresh session',prompts:["What is the capital of Japan?"],maxNew:60,temp:0.1,metric:'ttft'},
506
- {id:'warm_ttft',title:'Phase 2 β€” Warm TTFT (KV Cache)',desc:'TTFT on same session β€” measures KV-cache speedup',prompts:["Now tell me about Tokyo's population."],maxNew:60,temp:0.1,reuseSession:true,metric:'ttft'},
507
- {id:'throughput',title:'Phase 3 β€” Throughput (tok/s)',desc:'5 prompts, 80 tokens each β€” avg TPS',prompts:["Explain machine learning in simple terms.","Write a Python function to reverse a string.","What are 3 benefits of regular exercise?","How does a neural network learn from data?","Describe the water cycle briefly."],maxNew:80,temp:0.7,metric:'tps'},
508
- {id:'long_context',title:'Phase 4 β€” Long Context',desc:'Longer prompt input β€” tests attention scaling',prompts:["Please provide a detailed explanation of how transformers work in natural language processing, covering the key components including attention mechanisms, positional encoding, and the encoder-decoder architecture used in models like BERT and GPT."],maxNew:100,temp:0.5,metric:'tps'},
509
- {id:'consistency',title:'Phase 5 β€” Consistency',desc:'3 identical prompts β€” checks TPS variance',prompts:["What is machine learning?","What is machine learning?","What is machine learning?"],maxNew:60,temp:0.1,metric:'variance'},
510
- ];
511
- let benchRunning=false, coldSessId=null;
512
- async function runSinglePrompt(prompt,maxNew,temp,sessionId){
513
- const t0=Date.now(); let firstTok=null,tokCount=0,finalTps=0,finalMs=0;
514
- const resp=await fetch(`${API}/chat`,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({message:prompt,session_id:sessionId,system_prompt:'You are a helpful assistant.',max_new_tokens:maxNew,temperature:temp,top_k:40})});
515
- if(!resp.ok) throw new Error(`HTTP ${resp.status}`);
516
- const reader=resp.body.getReader(), decoder=new TextDecoder(); let buf='';
517
- while(true){
518
- const {done,value}=await reader.read(); if(done) break;
519
- buf+=decoder.decode(value,{stream:true}); let nl;
520
- while((nl=buf.indexOf('\n'))!==-1){
521
- const line=buf.slice(0,nl).trim(); buf=buf.slice(nl+1);
522
- if(!line.startsWith('data:')) continue;
523
- const raw=line.slice(5).trim(); if(raw==='[DONE]') break;
524
- let chunk; try{chunk=JSON.parse(raw);}catch{continue;}
525
- if(chunk.type==='token'){if(firstTok===null)firstTok=Date.now();tokCount++;}
526
- else if(chunk.type==='done'){finalTps=chunk.tps;finalMs=chunk.total_ms;}
527
- }
528
- }
529
- return{ttft:firstTok?(firstTok-t0):0,tps:finalTps,totalMs:finalMs,tokens:tokCount};
530
- }
531
- function mkPhaseCard(phase){
532
- const div=document.createElement('div'); div.className='ph-card'; div.id='ph-'+phase.id;
533
- div.innerHTML=`<div class="ph-title">${phase.title}</div><div class="ph-label">${phase.desc}</div><div class="ph-running" id="ph-st-${phase.id}"><span class="spin"></span> Running…</div><div class="ph-bar"><div class="ph-fill" id="ph-bar-${phase.id}"></div></div>`;
534
- return div;
535
- }
536
- function setPhaseResult(phase,results){
537
- const st=document.getElementById('ph-st-'+phase.id), bar=document.getElementById('ph-bar-'+phase.id);
538
- bar.style.width='100%';
539
- if(phase.metric==='ttft'){
540
- const avg=results.reduce((s,r)=>s+r.ttft,0)/results.length, cls=avg<1000?'g':avg<2000?'y':'r';
541
- st.innerHTML=`<div class="ph-stats"><div class="ph-stat"><div class="pv" style="color:var(--${cls})">${avg.toFixed(0)}ms</div><div class="pk">TTFT</div></div><div class="ph-stat"><div class="pv">${results[0].tokens}</div><div class="pk">tokens</div></div><div class="ph-stat"><div class="pv">${results[0].tps}</div><div class="pk">tok/s</div></div></div>`;
542
- return{label:'TTFT',value:avg,unit:'ms'};
543
- } else if(phase.metric==='tps'){
544
- const avgTps=results.reduce((s,r)=>s+r.tps,0)/results.length, avgTtft=results.reduce((s,r)=>s+r.ttft,0)/results.length, cls=avgTps>35?'g':avgTps>20?'y':'r';
545
- st.innerHTML=`<div class="ph-stats">${results.map((r,i)=>`<div class="ph-stat"><div class="pv" style="color:var(--${cls})">${r.tps}</div><div class="pk">P${i+1} tok/s</div></div>`).join('')}<div class="ph-stat"><div class="pv" style="color:var(--c)">${avgTtft.toFixed(0)}ms</div><div class="pk">avg TTFT</div></div></div>`;
546
- return{label:'Avg TPS',value:avgTps,unit:'tok/s'};
547
- } else {
548
- const tpsList=results.map(r=>r.tps), avg=tpsList.reduce((a,b)=>a+b,0)/tpsList.length, stddev=Math.sqrt(tpsList.reduce((s,v)=>s+Math.pow(v-avg,2),0)/tpsList.length).toFixed(1);
549
- st.innerHTML=`<div class="ph-stats">${tpsList.map((t,i)=>`<div class="ph-stat"><div class="pv">${t}</div><div class="pk">run ${i+1}</div></div>`).join('')}<div class="ph-stat"><div class="pv" style="color:var(--c)">Β±${stddev}</div><div class="pk">std dev</div></div></div>`;
550
- return{label:'Std Dev',value:parseFloat(stddev),unit:'Β±'};
551
- }
552
- }
553
- async function runBench(){
554
- if(benchRunning||busy) return; benchRunning=true; switchTab('bench');
555
- const btn=document.getElementById('btnbench'), scroll=document.getElementById('bench-scroll');
556
- btn.disabled=true; btn.textContent='Running…';
557
- const empty=document.getElementById('bench-empty'); if(empty) empty.remove();
558
- scroll.innerHTML=''; coldSessId=crypto.randomUUID(); let summaryData={};
559
- for(const phase of PHASES){
560
- const card=mkPhaseCard(phase); scroll.appendChild(card); scroll.scrollTop=scroll.scrollHeight;
561
- const bar=document.getElementById('ph-bar-'+phase.id), results=[];
562
- try{
563
- for(let i=0;i<phase.prompts.length;i++){
564
- const sid=phase.reuseSession?coldSessId:crypto.randomUUID();
565
- if(phase.id==='cold_ttft') coldSessId=sid;
566
- bar.style.width=((i/phase.prompts.length)*80)+'%';
567
- const r=await runSinglePrompt(phase.prompts[i],phase.maxNew,phase.temp,sid);
568
- results.push(r);
 
 
 
 
 
 
569
  }
570
- summaryData[phase.id]=setPhaseResult(phase,results);
571
- }catch(e){
572
- document.getElementById('ph-st-'+phase.id).innerHTML=`<span style="color:var(--red)">βœ— ${e.message}</span>`;
573
- bar.style.background='var(--red)'; bar.style.width='100%';
574
- }
575
- }
576
- const p3=summaryData['throughput'], p1=summaryData['cold_ttft'], p2=summaryData['warm_ttft'];
577
- const avgTps=p3?p3.value.toFixed(1):'β€”', coldTtft=p1?p1.value.toFixed(0):'β€”', warmTtft=p2?p2.value.toFixed(0):'β€”', cacheGain=(p1&&p2)?((p1.value-p2.value)/p1.value*100).toFixed(0):'β€”';
578
- const verdict=p3&&p3.value>35?`<div class="verdict good">βœ“ Throughput target met β€” ${avgTps} tok/s exceeds 35 tok/s baseline</div>`:`<div class="verdict mid">β–³ Throughput at ${avgTps} tok/s β€” within expected range</div>`;
579
- const summary=document.createElement('div');
580
- summary.innerHTML=`${verdict}<div class="b-grid"><div class="b-stat"><div class="bv">${avgTps}</div><div class="bk">Avg tok/s</div></div><div class="b-stat"><div class="bv">${coldTtft}ms</div><div class="bk">Cold TTFT</div></div><div class="b-stat"><div class="bv">${warmTtft}ms</div><div class="bk">Warm TTFT</div></div><div class="b-stat"><div class="bv">${cacheGain}%</div><div class="bk">Cache Speedup</div></div></div>`;
581
- scroll.insertBefore(summary,scroll.firstChild);
582
- btn.textContent='β†Ί Run Again'; btn.disabled=false; benchRunning=false;
583
- }
584
- </script>
585
  </body>
 
586
  </html>
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
+
4
  <head>
5
+ <meta charset="UTF-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>NanoMind Β· 152M</title>
8
+ <link rel="preconnect" href="https://fonts.googleapis.com">
9
+ <link
10
+ href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500;700&family=DM+Sans:wght@300;500;700;900&display=swap"
11
+ rel="stylesheet">
12
+ <style>
13
+ *,
14
+ *::before,
15
+ *::after {
16
+ box-sizing: border-box;
17
+ margin: 0;
18
+ padding: 0
19
+ }
20
+
21
+ :root {
22
+ --bg: #06080f;
23
+ --bg1: #0c0f1a;
24
+ --bg2: #121627;
25
+ --bg3: #1a2035;
26
+ --bg4: #222840;
27
+ --acc: #7c6bff;
28
+ --acc2: #9d8fff;
29
+ --acc3: #5a48e0;
30
+ --dim: rgba(124, 107, 255, .08);
31
+ --dimb: rgba(124, 107, 255, .18);
32
+ --cyan: #3ddcff;
33
+ --green: #3dffb4;
34
+ --red: #ff5c6e;
35
+ --warn: #ffc260;
36
+ --t0: #f2f0ff;
37
+ --t1: #c0bde8;
38
+ --t2: #7a78a0;
39
+ --t3: #3a384d;
40
+ --mono: 'IBM Plex Mono', monospace;
41
+ --sans: 'DM Sans', sans-serif;
42
+ --r: 8px;
43
+ --sb: 280px;
44
+ }
45
+
46
+ html,
47
+ body {
48
+ height: 100%;
49
+ background: var(--bg);
50
+ color: var(--t0);
51
+ font-family: var(--mono);
52
+ font-size: 13px;
53
+ overflow: hidden
54
+ }
55
+
56
+ .app {
57
+ display: flex;
58
+ height: 100vh
59
+ }
60
+
61
+ .app::before {
62
+ content: '';
63
+ position: fixed;
64
+ inset: 0;
65
+ background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
66
+ pointer-events: none;
67
+ z-index: 0;
68
+ opacity: .4
69
+ }
70
+
71
+ .app>* {
72
+ position: relative;
73
+ z-index: 1
74
+ }
75
+
76
+ .sb {
77
+ width: var(--sb);
78
+ min-width: var(--sb);
79
+ background: var(--bg1);
80
+ border-right: 1px solid var(--bg3);
81
+ display: flex;
82
+ flex-direction: column;
83
+ overflow: hidden
84
+ }
85
+
86
+ .sb-logo {
87
+ padding: 16px;
88
+ background: var(--bg);
89
+ border-bottom: 1px solid var(--bg3);
90
+ flex-shrink: 0
91
+ }
92
+
93
+ .logo-row {
94
+ display: flex;
95
+ align-items: center;
96
+ gap: 10px
97
+ }
98
+
99
+ .logo-icon {
100
+ width: 34px;
101
+ height: 34px;
102
+ border-radius: 9px;
103
+ background: linear-gradient(135deg, var(--acc3), var(--acc2));
104
+ display: flex;
105
+ align-items: center;
106
+ justify-content: center;
107
+ flex-shrink: 0;
108
+ box-shadow: 0 0 20px rgba(124, 107, 255, .35)
109
+ }
110
+
111
+ .logo-icon svg {
112
+ fill: #fff
113
+ }
114
+
115
+ .logo-text h2 {
116
+ font-family: var(--sans);
117
+ font-size: 18px;
118
+ font-weight: 900;
119
+ letter-spacing: -.04em;
120
+ color: var(--t0)
121
+ }
122
+
123
+ .logo-text h2 em {
124
+ color: var(--acc2);
125
+ font-style: normal
126
+ }
127
+
128
+ .logo-text p {
129
+ font-size: 9px;
130
+ color: var(--t2);
131
+ margin-top: 2px;
132
+ letter-spacing: .1em;
133
+ text-transform: uppercase
134
+ }
135
+
136
+ .sb-tabs {
137
+ display: flex;
138
+ border-bottom: 1px solid var(--bg3);
139
+ flex-shrink: 0;
140
+ background: var(--bg1)
141
+ }
142
+
143
+ .sb-tab {
144
+ flex: 1;
145
+ padding: 8px 4px;
146
+ text-align: center;
147
+ font-size: 9px;
148
+ font-weight: 700;
149
+ color: var(--t2);
150
+ text-transform: uppercase;
151
+ letter-spacing: .08em;
152
+ cursor: pointer;
153
+ border: none;
154
+ background: none;
155
+ font-family: var(--mono);
156
+ border-bottom: 2px solid transparent;
157
+ transition: .15s
158
+ }
159
+
160
+ .sb-tab.on {
161
+ color: var(--acc2);
162
+ border-bottom-color: var(--acc);
163
+ background: var(--dim)
164
+ }
165
+
166
+ .sb-body {
167
+ flex: 1;
168
+ overflow-y: auto;
169
+ padding: 10px;
170
+ scrollbar-width: thin;
171
+ scrollbar-color: var(--bg4) transparent
172
+ }
173
+
174
+ .card {
175
+ background: var(--bg2);
176
+ border: 1px solid var(--bg3);
177
+ border-radius: var(--r);
178
+ padding: 11px 13px;
179
+ margin-bottom: 8px
180
+ }
181
+
182
+ .ct {
183
+ font-size: 9px;
184
+ font-weight: 700;
185
+ color: var(--t2);
186
+ text-transform: uppercase;
187
+ letter-spacing: .1em;
188
+ margin-bottom: 8px;
189
+ display: flex;
190
+ align-items: center;
191
+ gap: 6px
192
+ }
193
+
194
+ .sr {
195
+ display: flex;
196
+ justify-content: space-between;
197
+ align-items: center;
198
+ padding: 3px 0
199
+ }
200
+
201
+ .sl {
202
+ color: var(--t1);
203
+ font-size: 11px
204
+ }
205
+
206
+ .sv {
207
+ font-size: 12px;
208
+ font-weight: 700;
209
+ font-variant-numeric: tabular-nums;
210
+ color: var(--t0)
211
+ }
212
+
213
+ .g {
214
+ color: var(--green)
215
+ }
216
+
217
+ .c {
218
+ color: var(--cyan)
219
+ }
220
+
221
+ .y {
222
+ color: var(--warn)
223
+ }
224
+
225
+ .r {
226
+ color: var(--red)
227
+ }
228
+
229
+ .p {
230
+ color: var(--acc2)
231
+ }
232
+
233
+ .dot {
234
+ display: inline-block;
235
+ width: 6px;
236
+ height: 6px;
237
+ border-radius: 50%;
238
+ flex-shrink: 0
239
+ }
240
+
241
+ .dot.off {
242
+ background: var(--t3)
243
+ }
244
+
245
+ .dot.on {
246
+ background: var(--green);
247
+ animation: pulse 1.4s infinite
248
+ }
249
+
250
+ @keyframes pulse {
251
+
252
+ 0%,
253
+ 100% {
254
+ opacity: 1;
255
+ transform: scale(1)
256
+ }
257
+
258
+ 50% {
259
+ opacity: .3;
260
+ transform: scale(.7)
261
+ }
262
+ }
263
+
264
+ canvas#spark {
265
+ width: 100%;
266
+ height: 44px;
267
+ display: block;
268
+ border-radius: var(--r);
269
+ background: var(--bg)
270
+ }
271
+
272
+ .ta {
273
+ width: 100%;
274
+ background: var(--bg);
275
+ border: 1px solid var(--bg3);
276
+ border-radius: var(--r);
277
+ color: var(--t0);
278
+ font-size: 11px;
279
+ padding: 8px 10px;
280
+ resize: vertical;
281
+ min-height: 56px;
282
+ font-family: var(--mono);
283
+ line-height: 1.6
284
+ }
285
+
286
+ .ta:focus {
287
+ outline: none;
288
+ border-color: var(--acc)
289
+ }
290
+
291
+ .pg {
292
+ display: flex;
293
+ flex-direction: column;
294
+ gap: 4px
295
+ }
296
+
297
+ .pg label {
298
+ font-size: 9px;
299
+ color: var(--t2);
300
+ text-transform: uppercase;
301
+ letter-spacing: .08em;
302
+ display: flex;
303
+ justify-content: space-between
304
+ }
305
+
306
+ .pg label span {
307
+ color: var(--acc2);
308
+ font-weight: 700
309
+ }
310
+
311
+ .pg input[type=range] {
312
+ width: 100%;
313
+ -webkit-appearance: none;
314
+ height: 2px;
315
+ background: var(--bg4);
316
+ border-radius: 1px;
317
+ outline: none
318
+ }
319
+
320
+ .pg input[type=range]::-webkit-slider-thumb {
321
+ -webkit-appearance: none;
322
+ width: 11px;
323
+ height: 11px;
324
+ border-radius: 50%;
325
+ background: var(--acc);
326
+ cursor: pointer;
327
+ border: 2px solid var(--bg1)
328
+ }
329
+
330
+ .btn {
331
+ display: inline-flex;
332
+ align-items: center;
333
+ gap: 5px;
334
+ padding: 6px 12px;
335
+ border-radius: var(--r);
336
+ border: 1px solid var(--bg4);
337
+ cursor: pointer;
338
+ font-size: 10px;
339
+ font-weight: 700;
340
+ font-family: var(--mono);
341
+ text-transform: uppercase;
342
+ letter-spacing: .05em;
343
+ transition: .13s
344
+ }
345
+
346
+ .bp {
347
+ background: var(--acc);
348
+ color: #fff;
349
+ border-color: var(--acc)
350
+ }
351
+
352
+ .bp:hover {
353
+ background: var(--acc2)
354
+ }
355
+
356
+ .bs {
357
+ background: var(--bg3);
358
+ color: var(--t1)
359
+ }
360
+
361
+ .bs:hover {
362
+ background: var(--bg4);
363
+ color: var(--t0)
364
+ }
365
+
366
+ .btn.full {
367
+ width: 100%;
368
+ justify-content: center
369
+ }
370
+
371
+ .btn:disabled {
372
+ opacity: .3;
373
+ cursor: not-allowed
374
+ }
375
+
376
+ /* ── Filter items ── */
377
+ .fi {
378
+ display: flex;
379
+ align-items: center;
380
+ gap: 8px;
381
+ padding: 5px 7px;
382
+ border-radius: 6px;
383
+ cursor: pointer;
384
+ border: 1px solid transparent;
385
+ transition: .12s;
386
+ margin-bottom: 3px;
387
+ user-select: none
388
+ }
389
+
390
+ .fi:hover {
391
+ background: var(--bg3)
392
+ }
393
+
394
+ .fi.on {
395
+ background: rgba(124, 107, 255, .1);
396
+ border-color: rgba(124, 107, 255, .25)
397
+ }
398
+
399
+ .fi.stories-on {
400
+ background: rgba(61, 220, 255, .08);
401
+ border-color: rgba(61, 220, 255, .25)
402
+ }
403
+
404
+ .fcb {
405
+ width: 13px;
406
+ height: 13px;
407
+ border-radius: 3px;
408
+ border: 1px solid var(--bg4);
409
+ background: var(--bg);
410
+ display: flex;
411
+ align-items: center;
412
+ justify-content: center;
413
+ flex-shrink: 0;
414
+ transition: .12s
415
+ }
416
+
417
+ .fi.on .fcb {
418
+ background: var(--acc);
419
+ border-color: var(--acc)
420
+ }
421
+
422
+ .fi.stories-on .fcb {
423
+ background: var(--cyan);
424
+ border-color: var(--cyan)
425
+ }
426
+
427
+ .fcb svg {
428
+ opacity: 0;
429
+ transition: .1s
430
+ }
431
+
432
+ .fi.on .fcb svg,
433
+ .fi.stories-on .fcb svg {
434
+ opacity: 1
435
+ }
436
+
437
+ .fdot {
438
+ width: 6px;
439
+ height: 6px;
440
+ border-radius: 50%;
441
+ flex-shrink: 0
442
+ }
443
+
444
+ .flabel {
445
+ font-size: 11px;
446
+ color: var(--t1)
447
+ }
448
+
449
+ .fi.on .flabel,
450
+ .fi.stories-on .flabel {
451
+ color: var(--t0)
452
+ }
453
+
454
+ #bench-panel {
455
+ display: none;
456
+ flex-direction: column;
457
+ height: 100%;
458
+ overflow: hidden
459
+ }
460
+
461
+ #bench-panel.visible {
462
+ display: flex
463
+ }
464
+
465
+ #stats-panel,
466
+ #params-panel {
467
+ display: flex;
468
+ flex-direction: column;
469
+ flex: 1;
470
+ overflow: hidden
471
+ }
472
+
473
+ .bench-actions {
474
+ padding: 10px;
475
+ flex-shrink: 0;
476
+ display: flex;
477
+ flex-direction: column;
478
+ gap: 6px
479
+ }
480
+
481
+ .bench-scroll {
482
+ flex: 1;
483
+ overflow-y: auto;
484
+ padding: 0 10px 10px;
485
+ scrollbar-width: thin;
486
+ scrollbar-color: var(--bg4) transparent
487
+ }
488
+
489
+ .b-grid {
490
+ display: grid;
491
+ grid-template-columns: 1fr 1fr;
492
+ gap: 5px;
493
+ margin-bottom: 10px
494
+ }
495
+
496
+ .b-stat {
497
+ background: var(--bg2);
498
+ border: 1px solid var(--bg3);
499
+ border-radius: var(--r);
500
+ padding: 10px;
501
+ text-align: center
502
+ }
503
+
504
+ .b-stat .bv {
505
+ font-family: var(--sans);
506
+ font-size: 22px;
507
+ font-weight: 900;
508
+ color: var(--acc2);
509
+ letter-spacing: -.04em
510
+ }
511
+
512
+ .b-stat .bk {
513
+ font-size: 9px;
514
+ color: var(--t2);
515
+ text-transform: uppercase;
516
+ letter-spacing: .1em;
517
+ margin-top: 2px
518
+ }
519
+
520
+ .ph-card {
521
+ background: var(--bg2);
522
+ border: 1px solid var(--bg3);
523
+ border-radius: var(--r);
524
+ padding: 9px 11px;
525
+ margin-bottom: 6px;
526
+ animation: fadeup .2s ease
527
+ }
528
+
529
+ .ph-title {
530
+ font-size: 9px;
531
+ font-weight: 700;
532
+ color: var(--acc2);
533
+ text-transform: uppercase;
534
+ letter-spacing: .08em;
535
+ margin-bottom: 6px
536
+ }
537
+
538
+ .ph-label {
539
+ font-size: 11px;
540
+ color: var(--t2);
541
+ margin-bottom: 4px
542
+ }
543
+
544
+ .ph-stats {
545
+ display: flex;
546
+ gap: 8px;
547
+ flex-wrap: wrap;
548
+ margin-top: 5px
549
+ }
550
+
551
+ .ph-stat {
552
+ display: flex;
553
+ flex-direction: column;
554
+ gap: 1px;
555
+ min-width: 50px
556
+ }
557
+
558
+ .ph-stat .pv {
559
+ font-size: 13px;
560
+ font-weight: 700;
561
+ color: var(--green);
562
+ font-variant-numeric: tabular-nums
563
+ }
564
+
565
+ .ph-stat .pk {
566
+ font-size: 9px;
567
+ color: var(--t2);
568
+ text-transform: uppercase;
569
+ letter-spacing: .06em
570
+ }
571
+
572
+ .ph-bar {
573
+ height: 2px;
574
+ background: var(--bg4);
575
+ border-radius: 1px;
576
+ margin-top: 5px;
577
+ overflow: hidden
578
+ }
579
+
580
+ .ph-fill {
581
+ height: 100%;
582
+ background: linear-gradient(90deg, var(--acc3), var(--acc2));
583
+ border-radius: 1px;
584
+ transition: width .5s ease;
585
+ width: 0%
586
+ }
587
+
588
+ .ph-running {
589
+ display: flex;
590
+ align-items: center;
591
+ gap: 5px;
592
+ font-size: 10px;
593
+ color: var(--warn)
594
+ }
595
+
596
+ .spin {
597
+ width: 8px;
598
+ height: 8px;
599
+ border: 1.5px solid var(--warn);
600
+ border-top-color: transparent;
601
+ border-radius: 50%;
602
+ animation: spin .7s linear infinite;
603
+ flex-shrink: 0
604
+ }
605
+
606
+ @keyframes spin {
607
+ to {
608
+ transform: rotate(360deg)
609
+ }
610
+ }
611
+
612
+ .bench-empty {
613
+ text-align: center;
614
+ padding: 30px 16px;
615
+ color: var(--t2);
616
+ font-size: 12px;
617
+ line-height: 1.9
618
+ }
619
+
620
+ .verdict {
621
+ padding: 10px 12px;
622
+ border-radius: var(--r);
623
+ font-size: 11px;
624
+ margin-bottom: 8px;
625
+ border: 1px solid var(--bg3)
626
+ }
627
+
628
+ .verdict.good {
629
+ border-color: rgba(61, 255, 180, .3);
630
+ background: rgba(61, 255, 180, .06);
631
+ color: var(--green)
632
+ }
633
+
634
+ .verdict.mid {
635
+ border-color: rgba(255, 194, 96, .3);
636
+ background: rgba(255, 194, 96, .06);
637
+ color: var(--warn)
638
+ }
639
+
640
+ .chat {
641
+ flex: 1;
642
+ display: flex;
643
+ flex-direction: column;
644
+ overflow: hidden
645
+ }
646
+
647
+ .chat-hdr {
648
+ height: 50px;
649
+ display: flex;
650
+ align-items: center;
651
+ padding: 0 20px;
652
+ border-bottom: 1px solid var(--bg3);
653
+ background: var(--bg1);
654
+ gap: 8px;
655
+ flex-shrink: 0
656
+ }
657
+
658
+ .badge {
659
+ background: var(--dim);
660
+ border: 1px solid rgba(124, 107, 255, .3);
661
+ border-radius: 20px;
662
+ padding: 3px 10px;
663
+ font-size: 10px;
664
+ font-weight: 700;
665
+ color: var(--acc2);
666
+ font-family: var(--sans)
667
+ }
668
+
669
+ .hdr-title {
670
+ font-family: var(--sans);
671
+ font-size: 13px;
672
+ font-weight: 600;
673
+ color: var(--t1)
674
+ }
675
+
676
+ .spc {
677
+ flex: 1
678
+ }
679
+
680
+ .hpill {
681
+ display: flex;
682
+ align-items: center;
683
+ gap: 6px;
684
+ font-size: 10px;
685
+ color: var(--t2);
686
+ text-transform: uppercase;
687
+ letter-spacing: .06em
688
+ }
689
+
690
+ .msgs {
691
+ flex: 1;
692
+ overflow-y: auto;
693
+ display: flex;
694
+ flex-direction: column;
695
+ scrollbar-width: thin;
696
+ scrollbar-color: var(--bg4) transparent
697
+ }
698
+
699
+ .welcome {
700
+ flex: 1;
701
+ display: flex;
702
+ flex-direction: column;
703
+ align-items: center;
704
+ justify-content: center;
705
+ gap: 14px;
706
+ text-align: center;
707
+ padding: 40px;
708
+ animation: fadeup .4s ease
709
+ }
710
+
711
+ .wlogo {
712
+ font-family: var(--sans);
713
+ font-size: 72px;
714
+ font-weight: 900;
715
+ background: linear-gradient(135deg, var(--acc), var(--cyan));
716
+ -webkit-background-clip: text;
717
+ -webkit-text-fill-color: transparent;
718
+ background-clip: text;
719
+ letter-spacing: -.05em;
720
+ line-height: 1
721
+ }
722
+
723
+ .welcome h2 {
724
+ font-family: var(--sans);
725
+ font-size: 22px;
726
+ font-weight: 700;
727
+ color: var(--t0);
728
+ letter-spacing: -.02em
729
+ }
730
+
731
+ .welcome p {
732
+ max-width: 400px;
733
+ line-height: 1.8;
734
+ font-size: 12px;
735
+ color: var(--t1)
736
+ }
737
+
738
+ .chips {
739
+ display: flex;
740
+ gap: 6px;
741
+ flex-wrap: wrap;
742
+ justify-content: center;
743
+ margin-top: 2px
744
+ }
745
+
746
+ .chip {
747
+ font-size: 9px;
748
+ padding: 4px 10px;
749
+ border: 1px solid var(--bg4);
750
+ border-radius: 20px;
751
+ color: var(--t2);
752
+ letter-spacing: .07em;
753
+ text-transform: uppercase;
754
+ background: var(--bg2)
755
+ }
756
+
757
+ .mg {
758
+ display: flex;
759
+ gap: 0;
760
+ padding: 14px 20px;
761
+ border-bottom: 1px solid var(--bg3);
762
+ animation: fadeup .18s ease
763
+ }
764
+
765
+ .mg:last-child {
766
+ border-bottom: none
767
+ }
768
+
769
+ @keyframes fadeup {
770
+ from {
771
+ opacity: 0;
772
+ transform: translateY(6px)
773
+ }
774
+
775
+ to {
776
+ opacity: 1;
777
+ transform: none
778
+ }
779
+ }
780
+
781
+ .mg-role {
782
+ width: 60px;
783
+ flex-shrink: 0;
784
+ padding-top: 2px
785
+ }
786
+
787
+ .mlabel {
788
+ font-size: 9px;
789
+ font-weight: 700;
790
+ letter-spacing: .1em;
791
+ text-transform: uppercase
792
+ }
793
+
794
+ .mg.user .mlabel {
795
+ color: var(--acc2)
796
+ }
797
+
798
+ .mg.asst .mlabel {
799
+ color: var(--cyan)
800
+ }
801
+
802
+ .mg-body {
803
+ flex: 1;
804
+ min-width: 0
805
+ }
806
+
807
+ .bubble {
808
+ font-size: 13px;
809
+ line-height: 1.75;
810
+ color: var(--t1);
811
+ white-space: pre-wrap;
812
+ word-break: break-word;
813
+ max-width: 660px
814
+ }
815
+
816
+ .mg.user .bubble {
817
+ color: var(--t2)
818
+ }
819
+
820
+ .cur {
821
+ display: inline-block;
822
+ width: 7px;
823
+ height: 2px;
824
+ background: var(--acc2);
825
+ margin-left: 3px;
826
+ vertical-align: middle;
827
+ animation: blink .6s infinite
828
+ }
829
+
830
+ @keyframes blink {
831
+
832
+ 0%,
833
+ 49% {
834
+ opacity: 1
835
+ }
836
+
837
+ 50%,
838
+ 100% {
839
+ opacity: 0
840
+ }
841
+ }
842
+
843
+ .bmeta {
844
+ font-size: 10px;
845
+ color: var(--t3);
846
+ margin-top: 5px;
847
+ display: flex;
848
+ flex-wrap: wrap;
849
+ gap: 8px
850
+ }
851
+
852
+ .bmeta b {
853
+ color: var(--acc2)
854
+ }
855
+
856
+ .inputbar {
857
+ padding: 12px 16px;
858
+ border-top: 1px solid var(--bg3);
859
+ background: var(--bg1);
860
+ flex-shrink: 0
861
+ }
862
+
863
+ .inputwrap {
864
+ background: var(--bg2);
865
+ border: 1px solid var(--bg3);
866
+ border-radius: var(--r);
867
+ display: flex;
868
+ align-items: flex-end;
869
+ padding: 3px 3px 3px 12px;
870
+ gap: 4px;
871
+ transition: .13s
872
+ }
873
+
874
+ .inputwrap:focus-within {
875
+ border-color: var(--acc)
876
+ }
877
+
878
+ #inp {
879
+ flex: 1;
880
+ background: none;
881
+ border: none;
882
+ outline: none;
883
+ color: var(--t0);
884
+ font-size: 13px;
885
+ font-family: var(--mono);
886
+ resize: none;
887
+ line-height: 1.6;
888
+ max-height: 110px;
889
+ padding: 7px 0
890
+ }
891
+
892
+ #inp::placeholder {
893
+ color: var(--t3)
894
+ }
895
+
896
+ .sbtn {
897
+ background: linear-gradient(135deg, var(--acc3), var(--acc2));
898
+ border: none;
899
+ cursor: pointer;
900
+ width: 32px;
901
+ height: 32px;
902
+ border-radius: 6px;
903
+ display: flex;
904
+ align-items: center;
905
+ justify-content: center;
906
+ flex-shrink: 0;
907
+ transition: .13s;
908
+ align-self: flex-end;
909
+ margin-bottom: 3px;
910
+ box-shadow: 0 0 12px rgba(124, 107, 255, .4)
911
+ }
912
+
913
+ .sbtn:hover {
914
+ filter: brightness(1.15)
915
+ }
916
+
917
+ .sbtn:disabled {
918
+ opacity: .3;
919
+ cursor: not-allowed
920
+ }
921
+
922
+ .sbtn svg {
923
+ fill: #fff
924
+ }
925
+
926
+ .hint {
927
+ margin-top: 5px;
928
+ font-size: 10px;
929
+ color: var(--t3);
930
+ text-align: right;
931
+ letter-spacing: .04em
932
+ }
933
+ </style>
934
  </head>
935
+
936
  <body>
937
+ <div class="app">
938
+
939
+ <aside class="sb">
940
+ <div class="sb-logo">
941
+ <div class="logo-row">
942
+ <div class="logo-icon">
943
+ <svg width="18" height="18" viewBox="0 0 24 24">
944
+ <path
945
+ d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z" />
946
+ </svg>
947
+ </div>
948
+ <div class="logo-text">
949
+ <h2>Nano<em>Mind</em></h2>
950
+ <p>152M Β· GPT-2 Β· AVX2 + OpenMP</p>
951
+ </div>
952
+ </div>
953
  </div>
954
+
955
+ <div class="sb-tabs">
956
+ <button class="sb-tab on" id="tab-stats" onclick="switchTab('stats')">Stats</button>
957
+ <button class="sb-tab" id="tab-bench" onclick="switchTab('bench')">Bench</button>
958
+ <button class="sb-tab" id="tab-params" onclick="switchTab('params')">Params</button>
959
  </div>
 
 
960
 
961
+ <!-- Stats Tab -->
962
+ <div id="stats-panel">
963
+ <div class="sb-body">
964
+ <div class="card">
965
+ <div class="ct"><span class="dot off" id="dot-s"></span>Live</div>
966
+ <div class="sr"><span class="sl">Throughput</span><span class="sv g" id="s-tps">β€”</span></div>
967
+ <div class="sr"><span class="sl">TTFT</span> <span class="sv c" id="s-ttft">β€”</span></div>
968
+ <div class="sr"><span class="sl">Tokens out</span><span class="sv" id="s-toks">β€”</span></div>
969
+ <div class="sr"><span class="sl">Latency</span> <span class="sv y" id="s-lat">β€”</span></div>
970
+ </div>
971
+ <div class="card">
972
+ <div class="ct">Throughput History</div>
973
+ <canvas id="spark"></canvas>
974
+ <div style="margin-top:6px">
975
+ <div class="sr"><span class="sl">Session avg</span><span class="sv g" id="s-avg">β€”</span></div>
976
+ <div class="sr"><span class="sl">Peak</span> <span class="sv g" id="s-peak">β€”</span></div>
977
+ </div>
978
+ </div>
979
+ <div class="card">
980
+ <div class="ct">Session</div>
981
+ <div class="sr"><span class="sl">Turns</span> <span class="sv" id="s-turns">0</span></div>
982
+ <div class="sr"><span class="sl">Total tokens</span><span class="sv" id="s-totok">0</span></div>
983
+ <div class="sr"><span class="sl">KV cache</span> <span class="sv c" id="s-kv">β€”</span></div>
984
+ <div class="sr"><span class="sl">Server RAM</span> <span class="sv" id="s-ram">β€”</span></div>
985
+ <div style="display:flex;gap:6px;margin-top:8px">
986
+ <button class="btn bs full" onclick="clearChat()">β†Ί Reset</button>
987
+ </div>
988
+ </div>
989
+ <div class="card">
990
+ <div class="ct">Engine</div>
991
+ <div class="sr"><span class="sl">Status</span> <span class="sv g" id="s-eng">β€”</span></div>
992
+ <div class="sr"><span class="sl">Sessions</span><span class="sv" id="s-sess">β€”</span></div>
993
+ <div class="sr"><span class="sl">Uptime</span> <span class="sv" id="s-up">β€”</span></div>
994
+ </div>
995
+
996
+ <!-- ══ FILTERS CARD ══ -->
997
+ <div class="card">
998
+ <div class="ct">Filters</div>
999
+ <!-- Stories β€” redirects to inference space -->
1000
+ <div class="fi" id="fi-stories" onclick="goStories()">
1001
+ <div class="fcb"><svg width="8" height="6" viewBox="0 0 8 6" fill="none">
1002
+ <path d="M1 3l2 2 4-4" stroke="#fff" stroke-width="1.5" stroke-linecap="round" />
1003
+ </svg></div>
1004
+ <div class="fdot" style="background:var(--cyan)"></div>
1005
+ <span class="flabel">Stories β†—</span>
1006
+ </div>
1007
+ </div>
1008
+ <!-- ══ END FILTERS CARD ══ -->
1009
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1010
  </div>
1011
  </div>
1012
+
1013
+ <!-- Benchmark Tab -->
1014
+ <div id="bench-panel">
1015
+ <div class="bench-actions">
1016
+ <button class="btn bp full" id="btnbench" onclick="runBench()">β–Ά Run Benchmark</button>
1017
+ <div style="font-size:9px;color:var(--t2);text-align:center;line-height:1.6">
1018
+ 5 phases Β· cold/warm TTFT Β· throughput Β· concurrency
1019
+ </div>
1020
+ </div>
1021
+ <div class="bench-scroll" id="bench-scroll">
1022
+ <div class="bench-empty" id="bench-empty">
1023
+ Run benchmark to measure<br>real system performance
1024
+ </div>
1025
  </div>
 
 
 
 
 
 
1026
  </div>
1027
 
1028
+ <!-- Params Tab -->
1029
+ <div id="params-panel" style="display:none">
1030
+ <div class="sb-body">
1031
+ <div class="card">
1032
+ <div class="ct">System Prompt</div>
1033
+ <textarea class="ta" id="sysprompt"
1034
+ rows="4">You are a helpful, thoughtful, and articulate AI assistant.</textarea>
1035
+ </div>
1036
+ <div class="card">
1037
+ <div class="ct">Generation</div>
1038
+ <div style="display:flex;flex-direction:column;gap:10px;margin-top:2px">
1039
+ <div class="pg">
1040
+ <label>Temperature <span id="v-temp">0.70</span></label>
1041
+ <input type="range" id="p-temp" min="0.1" max="2.0" step="0.05" value="0.7"
1042
+ oninput="document.getElementById('v-temp').textContent=parseFloat(this.value).toFixed(2)">
1043
+ </div>
1044
+ <div class="pg">
1045
+ <label>Top-K <span id="v-topk">40</span></label>
1046
+ <input type="range" id="p-topk" min="1" max="200" step="1" value="40"
1047
+ oninput="document.getElementById('v-topk').textContent=this.value">
1048
+ </div>
1049
+ <div class="pg">
1050
+ <label>Max tokens <span id="v-maxt">200</span></label>
1051
+ <input type="range" id="p-maxt" min="20" max="256" step="10" value="200"
1052
+ oninput="document.getElementById('v-maxt').textContent=this.value">
1053
+ </div>
1054
+ </div>
1055
+ </div>
1056
  </div>
1057
  </div>
1058
+ </aside>
 
 
 
1059
 
1060
+ <!-- CHAT -->
1061
+ <main class="chat">
1062
+ <header class="chat-hdr">
1063
+ <div class="badge">NanoMind Β· 152M</div>
1064
+ <span class="hdr-title">Chat</span>
1065
+ <div class="spc"></div>
1066
+ <div class="hpill">
1067
+ <span class="dot off" id="dot-h"></span>
1068
+ <span id="hstatus">Idle</span>
1069
+ </div>
1070
+ </header>
 
 
 
1071
 
1072
+ <div class="msgs" id="msgs">
1073
+ <div class="welcome" id="welcome">
1074
+ <div class="wlogo">NM</div>
1075
+ <h2>NanoMind Studio</h2>
1076
+ <p>152M parameter GPT-2 model trained on GPT-4 quality data β€”
1077
+ running on a hand-written C++ inference engine with AVX2 SIMD,
1078
+ OpenMP parallelism &amp; persistent KV-cache.</p>
1079
+ <div class="chips">
1080
+ <span class="chip">152M params</span>
1081
+ <span class="chip">AVX2 SIMD</span>
1082
+ <span class="chip">OpenMP</span>
1083
+ <span class="chip">KV Cache</span>
1084
+ <span class="chip">Streaming</span>
1085
+ <span class="chip">GPT-4 Data</span>
 
 
 
 
 
 
 
 
 
 
1086
  </div>
1087
  </div>
1088
  </div>
1089
+
1090
+ <div class="inputbar">
1091
+ <div class="inputwrap">
1092
+ <textarea id="inp" rows="1" placeholder="Send a message…" onkeydown="handleKey(event)"></textarea>
1093
+ <button class="sbtn" id="sbtn" onclick="send()">
1094
+ <svg width="14" height="14" viewBox="0 0 24 24">
1095
+ <path d="M2 21l21-9L2 3v7l15 2-15 2v7z" />
1096
+ </svg>
1097
+ </button>
1098
+ </div>
1099
+ <div class="hint">Enter ↡ to send Β· Shift+Enter for newline</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1100
  </div>
1101
+ </main>
1102
  </div>
1103
 
1104
+ <script>
1105
+ const API = '';
1106
+ let sessId = crypto.randomUUID();
1107
+ let busy = false, turns = 0, totalToks = 0;
1108
+ let tpsHist = [], peakTps = 0;
1109
+
1110
+ // ── Filter logic ─────────────────────────────────────────────
1111
+ function toggleFilter(el, key) {
1112
+ el.classList.toggle('on');
1113
+ }
1114
+
1115
+ function goStories() {
1116
+ const el = document.getElementById('fi-stories');
1117
+ el.classList.add('stories-on');
1118
+ setTimeout(() => {
1119
+ window.open('https://not-omega-inference.hf.space/', '_blank');
1120
+ setTimeout(() => el.classList.remove('stories-on'), 400);
1121
+ }, 160);
1122
+ }
1123
+
1124
+ // ── Tab Switch ───────────────────────────────────────────────
1125
+ function switchTab(name) {
1126
+ ['stats', 'bench', 'params'].forEach(t => {
1127
+ const panelId = t === 'stats' ? 'stats-panel' : t + '-panel';
1128
+ const panel = document.getElementById(panelId);
1129
+ const tab = document.getElementById('tab-' + t);
1130
+ const show = t === name;
1131
+ panel.style.display = show ? 'flex' : 'none';
1132
+ tab.classList.toggle('on', show);
1133
+ });
1134
+ }
1135
+
1136
+ // ── Input ────────────────────────────────────────────────────
1137
+ const inp = document.getElementById('inp');
1138
+ inp.addEventListener('input', () => {
1139
+ inp.style.height = 'auto';
1140
+ inp.style.height = Math.min(inp.scrollHeight, 110) + 'px';
1141
+ });
1142
+ function handleKey(e) {
1143
+ if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); send(); }
1144
+ }
1145
+
1146
+ // ── UI Helpers ───────────────────────────────────────────────
1147
+ function setBusy(v) {
1148
+ busy = v;
1149
+ document.getElementById('sbtn').disabled = v;
1150
+ ['dot-s', 'dot-h'].forEach(id => {
1151
+ document.getElementById(id).className = 'dot ' + (v ? 'on' : 'off');
1152
+ });
1153
+ document.getElementById('hstatus').textContent = v ? 'Generating…' : 'Idle';
1154
+ }
1155
+ function scrollBot() { const el = document.getElementById('msgs'); el.scrollTop = el.scrollHeight; }
1156
+ function hideWelcome() { const w = document.getElementById('welcome'); if (w) w.remove(); }
1157
+ function esc(s) { return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;'); }
1158
+
1159
+ // ── Messages ─────────────────────────────────────────────────
1160
+ function addUserMsg(text) {
1161
+ hideWelcome();
1162
+ const g = document.createElement('div'); g.className = 'mg user';
1163
+ g.innerHTML = `<div class="mg-role"><div class="mlabel">You</div></div>
 
 
 
 
 
 
 
 
 
 
 
 
1164
  <div class="mg-body"><div class="bubble">${esc(text)}</div></div>`;
1165
+ document.getElementById('msgs').appendChild(g); scrollBot();
1166
+ }
1167
+ function createAsstSlot() {
1168
+ const g = document.createElement('div'); g.className = 'mg asst';
1169
+ const bid = 'b' + Date.now(), mid = 'm' + Date.now();
1170
+ g.innerHTML = `<div class="mg-role"><div class="mlabel">AI</div></div>
1171
  <div class="mg-body">
1172
  <div class="bubble" id="${bid}"><span class="cur"></span></div>
1173
  <div class="bmeta" id="${mid}"></div>
1174
  </div>`;
1175
+ document.getElementById('msgs').appendChild(g); scrollBot();
1176
+ return { bubble: document.getElementById(bid), meta: document.getElementById(mid) };
1177
+ }
1178
+
1179
+ // ── Send ─────────────────────────────────────────────────────
1180
+ async function send() {
1181
+ if (busy) return;
1182
+ const text = inp.value.trim(); if (!text) return;
1183
+ inp.value = ''; inp.style.height = 'auto';
1184
+ addUserMsg(text); setBusy(true);
1185
+ const { bubble, meta } = createAsstSlot();
1186
+ let content = '', t0 = Date.now(), firstTok = null, tokCount = 0;
1187
+ const payload = {
1188
+ message: text,
1189
+ session_id: sessId,
1190
+ system_prompt: document.getElementById('sysprompt').value,
1191
+ max_new_tokens: parseInt(document.getElementById('p-maxt').value),
1192
+ temperature: parseFloat(document.getElementById('p-temp').value),
1193
+ top_k: parseInt(document.getElementById('p-topk').value),
1194
+ };
1195
+ try {
1196
+ const resp = await fetch(`${API}/chat`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) });
1197
+ if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
1198
+ const reader = resp.body.getReader(), decoder = new TextDecoder();
1199
+ let buf = '';
1200
+ while (true) {
1201
+ const { done, value } = await reader.read(); if (done) break;
1202
+ buf += decoder.decode(value, { stream: true });
1203
+ let nl;
1204
+ while ((nl = buf.indexOf('\n')) !== -1) {
1205
+ const line = buf.slice(0, nl).trim(); buf = buf.slice(nl + 1);
1206
+ if (!line.startsWith('data:')) continue;
1207
+ const raw = line.slice(5).trim(); if (raw === '[DONE]') break;
1208
+ let chunk; try { chunk = JSON.parse(raw); } catch { continue; }
1209
+ if (chunk.type === 'token') {
1210
+ if (firstTok === null) firstTok = Date.now();
1211
+ content += chunk.text; tokCount++; totalToks++;
1212
+ document.getElementById('s-totok').textContent = totalToks;
1213
+ document.getElementById('s-toks').textContent = tokCount + ' tok';
1214
+ document.getElementById('s-ttft').textContent = (firstTok - t0) + ' ms';
1215
+ bubble.innerHTML = esc(content) + '<span class="cur"></span>';
1216
+ scrollBot();
1217
+ } else if (chunk.type === 'done') {
1218
+ bubble.innerHTML = esc(content);
1219
+ const ttft = firstTok ? (firstTok - t0) : 0, tps = chunk.tps, ms = chunk.total_ms;
1220
+ meta.innerHTML = `<b>${tps}</b> tok/s Β· TTFT <b>${ttft}ms</b> Β· <b>${tokCount}</b> tokens Β· <b>${ms.toFixed(0)}ms</b>`;
1221
+ document.getElementById('s-tps').textContent = tps + ' tok/s';
1222
+ document.getElementById('s-lat').textContent = ms.toFixed(0) + ' ms';
1223
+ tpsHist.push(tps); if (tpsHist.length > 30) tpsHist.shift();
1224
+ if (tps > peakTps) peakTps = tps;
1225
+ const avg = (tpsHist.reduce((a, b) => a + b, 0) / tpsHist.length).toFixed(1);
1226
+ document.getElementById('s-avg').textContent = avg + ' tok/s';
1227
+ document.getElementById('s-peak').textContent = peakTps.toFixed(1) + ' tok/s';
1228
+ if (chunk.session_id) {
1229
+ fetch(`${API}/chat/history?session_id=${chunk.session_id}`)
1230
+ .then(r => r.json())
1231
+ .then(d => { document.getElementById('s-kv').textContent = (d.tokens_in_engine || 0) + ' tok'; })
1232
+ .catch(() => { });
1233
+ }
1234
+ turns++; document.getElementById('s-turns').textContent = turns;
1235
+ drawSpark();
1236
+ } else if (chunk.type === 'error') {
1237
+ bubble.innerHTML += `<br><span style="color:var(--red)">⚠ ${esc(chunk.message)}</span>`;
1238
+ }
1239
  }
 
 
 
 
1240
  }
1241
+ } catch (err) {
1242
+ if (tokCount === 0) bubble.innerHTML = `<span style="color:var(--red)">Connection error: ${esc(err.message)}</span>`;
1243
+ else meta.innerHTML += ` <span style="color:var(--warn)">[interrupted]</span>`;
1244
+ } finally {
1245
+ const c = bubble.querySelector('.cur'); if (c) c.remove();
1246
+ setBusy(false); scrollBot();
1247
  }
1248
  }
1249
+
1250
+ // ── Sparkline ──��─────────────────────────────────────────────
1251
+ function drawSpark() {
1252
+ const el = document.getElementById('spark'), ctx = el.getContext('2d');
1253
+ const dpr = window.devicePixelRatio || 1;
1254
+ el.width = el.clientWidth * dpr; el.height = el.clientHeight * dpr;
1255
+ ctx.scale(dpr, dpr);
1256
+ const W = el.clientWidth, H = el.clientHeight;
1257
+ ctx.clearRect(0, 0, W, H);
1258
+ const d = tpsHist; if (d.length < 2) return;
1259
+ const mx = Math.max(...d) * 1.15 || 1, step = W / (d.length - 1);
1260
+ const grad = ctx.createLinearGradient(0, 0, 0, H);
1261
+ grad.addColorStop(0, 'rgba(124,107,255,.3)'); grad.addColorStop(1, 'rgba(124,107,255,.02)');
1262
+ ctx.beginPath();
1263
+ d.forEach((v, i) => { const x = i * step, y = H - (v / mx) * (H - 4) - 2; i === 0 ? ctx.moveTo(x, y) : ctx.lineTo(x, y); });
1264
+ ctx.strokeStyle = '#9d8fff'; ctx.lineWidth = 1.5; ctx.stroke();
1265
+ ctx.lineTo((d.length - 1) * step, H); ctx.lineTo(0, H); ctx.closePath();
1266
+ ctx.fillStyle = grad; ctx.fill();
1267
+ }
1268
+
1269
+ // ── Clear ────────────────────────────────────────────────────
1270
+ async function clearChat() {
1271
+ if (busy) return;
1272
+ await fetch(`${API}/chat/reset`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ session_id: sessId }) }).catch(() => { });
1273
+ sessId = crypto.randomUUID();
1274
+ turns = 0; totalToks = 0; tpsHist = []; peakTps = 0;
1275
+ document.getElementById('msgs').innerHTML = `
 
 
 
 
 
 
 
 
1276
  <div class="welcome" id="welcome">
1277
  <div class="wlogo">NM</div>
1278
  <h2>NanoMind Studio</h2>
 
1282
  <span class="chip">OpenMP</span><span class="chip">KV Cache</span>
1283
  </div>
1284
  </div>`;
1285
+ ['s-turns', 's-totok'].forEach(id => document.getElementById(id).textContent = '0');
1286
+ ['s-tps', 's-ttft', 's-lat', 's-avg', 's-peak', 's-toks', 's-kv'].forEach(id => document.getElementById(id).textContent = 'β€”');
1287
+ drawSpark();
1288
+ }
1289
+
1290
+ // ── Metrics Poll ─────────────────────────────────────────────
1291
+ async function pollMetrics() {
1292
+ try {
1293
+ const r = await fetch(`${API}/metrics`); if (!r.ok) return;
1294
+ const d = await r.json();
1295
+ document.getElementById('s-ram').textContent = d.system_ram_used_pct.toFixed(0) + '% (' + d.process_ram_mb + 'MB)';
1296
+ document.getElementById('s-eng').textContent = (d.engines_ready || 0) + ' / ' + (d.n_engines || '?') + ' ready';
1297
+ document.getElementById('s-sess').textContent = d.active_sessions || 0;
1298
+ document.getElementById('s-up').textContent = fmtUptime(d.uptime_s || 0);
1299
+ } catch { }
1300
+ }
1301
+ function fmtUptime(s) {
1302
+ if (s < 60) return s + 's';
1303
+ if (s < 3600) return Math.floor(s / 60) + 'm ' + (s % 60 | 0) + 's';
1304
+ return Math.floor(s / 3600) + 'h ' + Math.floor((s % 3600) / 60) + 'm';
1305
+ }
1306
+ pollMetrics(); setInterval(pollMetrics, 4000);
1307
+
1308
+ // ── Benchmark ────────────────────────────────────────────────
1309
+ const PHASES = [
1310
+ { id: 'cold_ttft', title: 'Phase 1 β€” Cold TTFT', desc: 'First token latency on a fresh session', prompts: ["What is the capital of Japan?"], maxNew: 60, temp: 0.1, metric: 'ttft' },
1311
+ { id: 'warm_ttft', title: 'Phase 2 β€” Warm TTFT (KV Cache)', desc: 'TTFT on same session β€” measures KV-cache speedup', prompts: ["Now tell me about Tokyo's population."], maxNew: 60, temp: 0.1, reuseSession: true, metric: 'ttft' },
1312
+ { id: 'throughput', title: 'Phase 3 β€” Throughput (tok/s)', desc: '5 prompts, 80 tokens each β€” avg TPS', prompts: ["Explain machine learning in simple terms.", "Write a Python function to reverse a string.", "What are 3 benefits of regular exercise?", "How does a neural network learn from data?", "Describe the water cycle briefly."], maxNew: 80, temp: 0.7, metric: 'tps' },
1313
+ { id: 'long_context', title: 'Phase 4 β€” Long Context', desc: 'Longer prompt input β€” tests attention scaling', prompts: ["Please provide a detailed explanation of how transformers work in natural language processing, covering the key components including attention mechanisms, positional encoding, and the encoder-decoder architecture used in models like BERT and GPT."], maxNew: 100, temp: 0.5, metric: 'tps' },
1314
+ { id: 'consistency', title: 'Phase 5 β€” Consistency', desc: '3 identical prompts β€” checks TPS variance', prompts: ["What is machine learning?", "What is machine learning?", "What is machine learning?"], maxNew: 60, temp: 0.1, metric: 'variance' },
1315
+ ];
1316
+ let benchRunning = false, coldSessId = null;
1317
+ async function runSinglePrompt(prompt, maxNew, temp, sessionId) {
1318
+ const t0 = Date.now(); let firstTok = null, tokCount = 0, finalTps = 0, finalMs = 0;
1319
+ const resp = await fetch(`${API}/chat`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message: prompt, session_id: sessionId, system_prompt: 'You are a helpful assistant.', max_new_tokens: maxNew, temperature: temp, top_k: 40 }) });
1320
+ if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
1321
+ const reader = resp.body.getReader(), decoder = new TextDecoder(); let buf = '';
1322
+ while (true) {
1323
+ const { done, value } = await reader.read(); if (done) break;
1324
+ buf += decoder.decode(value, { stream: true }); let nl;
1325
+ while ((nl = buf.indexOf('\n')) !== -1) {
1326
+ const line = buf.slice(0, nl).trim(); buf = buf.slice(nl + 1);
1327
+ if (!line.startsWith('data:')) continue;
1328
+ const raw = line.slice(5).trim(); if (raw === '[DONE]') break;
1329
+ let chunk; try { chunk = JSON.parse(raw); } catch { continue; }
1330
+ if (chunk.type === 'token') { if (firstTok === null) firstTok = Date.now(); tokCount++; }
1331
+ else if (chunk.type === 'done') { finalTps = chunk.tps; finalMs = chunk.total_ms; }
1332
+ }
1333
+ }
1334
+ return { ttft: firstTok ? (firstTok - t0) : 0, tps: finalTps, totalMs: finalMs, tokens: tokCount };
1335
+ }
1336
+ function mkPhaseCard(phase) {
1337
+ const div = document.createElement('div'); div.className = 'ph-card'; div.id = 'ph-' + phase.id;
1338
+ div.innerHTML = `<div class="ph-title">${phase.title}</div><div class="ph-label">${phase.desc}</div><div class="ph-running" id="ph-st-${phase.id}"><span class="spin"></span> Running…</div><div class="ph-bar"><div class="ph-fill" id="ph-bar-${phase.id}"></div></div>`;
1339
+ return div;
1340
+ }
1341
+ function setPhaseResult(phase, results) {
1342
+ const st = document.getElementById('ph-st-' + phase.id), bar = document.getElementById('ph-bar-' + phase.id);
1343
+ bar.style.width = '100%';
1344
+ if (phase.metric === 'ttft') {
1345
+ const avg = results.reduce((s, r) => s + r.ttft, 0) / results.length, cls = avg < 1000 ? 'g' : avg < 2000 ? 'y' : 'r';
1346
+ st.innerHTML = `<div class="ph-stats"><div class="ph-stat"><div class="pv" style="color:var(--${cls})">${avg.toFixed(0)}ms</div><div class="pk">TTFT</div></div><div class="ph-stat"><div class="pv">${results[0].tokens}</div><div class="pk">tokens</div></div><div class="ph-stat"><div class="pv">${results[0].tps}</div><div class="pk">tok/s</div></div></div>`;
1347
+ return { label: 'TTFT', value: avg, unit: 'ms' };
1348
+ } else if (phase.metric === 'tps') {
1349
+ const avgTps = results.reduce((s, r) => s + r.tps, 0) / results.length, avgTtft = results.reduce((s, r) => s + r.ttft, 0) / results.length, cls = avgTps > 35 ? 'g' : avgTps > 20 ? 'y' : 'r';
1350
+ st.innerHTML = `<div class="ph-stats">${results.map((r, i) => `<div class="ph-stat"><div class="pv" style="color:var(--${cls})">${r.tps}</div><div class="pk">P${i + 1} tok/s</div></div>`).join('')}<div class="ph-stat"><div class="pv" style="color:var(--c)">${avgTtft.toFixed(0)}ms</div><div class="pk">avg TTFT</div></div></div>`;
1351
+ return { label: 'Avg TPS', value: avgTps, unit: 'tok/s' };
1352
+ } else {
1353
+ const tpsList = results.map(r => r.tps), avg = tpsList.reduce((a, b) => a + b, 0) / tpsList.length, stddev = Math.sqrt(tpsList.reduce((s, v) => s + Math.pow(v - avg, 2), 0) / tpsList.length).toFixed(1);
1354
+ st.innerHTML = `<div class="ph-stats">${tpsList.map((t, i) => `<div class="ph-stat"><div class="pv">${t}</div><div class="pk">run ${i + 1}</div></div>`).join('')}<div class="ph-stat"><div class="pv" style="color:var(--c)">Β±${stddev}</div><div class="pk">std dev</div></div></div>`;
1355
+ return { label: 'Std Dev', value: parseFloat(stddev), unit: 'Β±' };
1356
+ }
1357
+ }
1358
+ async function runBench() {
1359
+ if (benchRunning || busy) return; benchRunning = true; switchTab('bench');
1360
+ const btn = document.getElementById('btnbench'), scroll = document.getElementById('bench-scroll');
1361
+ btn.disabled = true; btn.textContent = 'Running…';
1362
+ const empty = document.getElementById('bench-empty'); if (empty) empty.remove();
1363
+ scroll.innerHTML = ''; coldSessId = crypto.randomUUID(); let summaryData = {};
1364
+ for (const phase of PHASES) {
1365
+ const card = mkPhaseCard(phase); scroll.appendChild(card); scroll.scrollTop = scroll.scrollHeight;
1366
+ const bar = document.getElementById('ph-bar-' + phase.id), results = [];
1367
+ try {
1368
+ for (let i = 0; i < phase.prompts.length; i++) {
1369
+ const sid = phase.reuseSession ? coldSessId : crypto.randomUUID();
1370
+ if (phase.id === 'cold_ttft') coldSessId = sid;
1371
+ bar.style.width = ((i / phase.prompts.length) * 80) + '%';
1372
+ const r = await runSinglePrompt(phase.prompts[i], phase.maxNew, phase.temp, sid);
1373
+ results.push(r);
1374
+ }
1375
+ summaryData[phase.id] = setPhaseResult(phase, results);
1376
+ } catch (e) {
1377
+ document.getElementById('ph-st-' + phase.id).innerHTML = `<span style="color:var(--red)">βœ— ${e.message}</span>`;
1378
+ bar.style.background = 'var(--red)'; bar.style.width = '100%';
1379
+ }
1380
  }
1381
+ const p3 = summaryData['throughput'], p1 = summaryData['cold_ttft'], p2 = summaryData['warm_ttft'];
1382
+ const avgTps = p3 ? p3.value.toFixed(1) : 'β€”', coldTtft = p1 ? p1.value.toFixed(0) : 'β€”', warmTtft = p2 ? p2.value.toFixed(0) : 'β€”', cacheGain = (p1 && p2) ? ((p1.value - p2.value) / p1.value * 100).toFixed(0) : 'β€”';
1383
+ const verdict = p3 && p3.value > 35 ? `<div class="verdict good">βœ“ Throughput target met β€” ${avgTps} tok/s exceeds 35 tok/s baseline</div>` : `<div class="verdict mid">β–³ Throughput at ${avgTps} tok/s β€” within expected range</div>`;
1384
+ const summary = document.createElement('div');
1385
+ summary.innerHTML = `${verdict}<div class="b-grid"><div class="b-stat"><div class="bv">${avgTps}</div><div class="bk">Avg tok/s</div></div><div class="b-stat"><div class="bv">${coldTtft}ms</div><div class="bk">Cold TTFT</div></div><div class="b-stat"><div class="bv">${warmTtft}ms</div><div class="bk">Warm TTFT</div></div><div class="b-stat"><div class="bv">${cacheGain}%</div><div class="bk">Cache Speedup</div></div></div>`;
1386
+ scroll.insertBefore(summary, scroll.firstChild);
1387
+ btn.textContent = 'β†Ί Run Again'; btn.disabled = false; benchRunning = false;
1388
+ }
1389
+ </script>
 
 
 
 
 
 
1390
  </body>
1391
+
1392
  </html>