NOT-OMEGA commited on
Commit
5f5b2c4
·
verified ·
1 Parent(s): 382ae17

Update index.html

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