NOT-OMEGA commited on
Commit
0c4f84e
·
verified ·
1 Parent(s): 5298950

Delete index.html

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