-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1561 lines (1445 loc) · 92.5 KB
/
Copy pathindex.html
File metadata and controls
1561 lines (1445 loc) · 92.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Local-Bench · Companion Intelligence</title>
<meta name="description" content="Local-Bench — a Companion Intelligence app for benchmarking local LLMs and comparing model intelligence.">
<link rel="icon" type="image/svg+xml" href="assets/ci-icon.svg">
<meta name="color-scheme" content="light dark">
<!-- Theme: apply the saved or system colour scheme before first paint (no flash). -->
<script>
(function () {
try {
var t = localStorage.getItem('lb-theme');
if (t !== 'light' && t !== 'dark') {
t = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
document.documentElement.dataset.theme = t;
} catch (e) { document.documentElement.dataset.theme = 'light'; }
})();
</script>
<!-- Companion Intelligence brand font (matches Hub & Portal). Loaded with display=swap
and a full system fallback, so the dashboard still renders offline (local-first). -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<!-- Chart.js is vendored locally so the dashboard works fully offline (local-first).
If it fails to load, the UI falls back to CSS bar charts automatically. -->
<script src="assets/chart.umd.min.js"></script>
<script src="assets/jspdf.umd.min.js"></script>
<style>
:root {
/* Companion Intelligence — Hub/Portal design system, light colorway.
Body content is dark ink on light surfaces; every coloured ("muted")
surface — buttons, chips, banners — carries white text at AA contrast. */
--bg: #f3fafb; /* Hub/Portal light background */
--bg-deep: #e9f4f7;
--surface: #ffffff;
--surface-2: #f5fafc;
--ink: #12212a; /* primary text */
--ink-2: #344b56; /* soft text */
--muted: #617784; /* muted text */
--muted-2: #8395a0;
--muted-soft: #90a0a9; /* card <p> — ~30% lighter than --muted */
--border: rgba(16,78,92,.14);
--border-strong: rgba(16,78,92,.26);
/* Accent / brand teal — the "muted" background colour behind white text */
--accent: #0f6f78;
--accent-2: #0b8790;
--accent-strong: #095e66;
--accent-ink: #ffffff;
--brand: #0f6f78; /* links & focus */
--brand-strong: #095e66;
--success: #0c7a43; /* white text clears AA on this green */
--installed-line: #2ea9b3; /* "Installed" chip — brand light teal outline */
--installed-text: #238088; /* ~20% darker brand teal; clears AA (4.65) on white */
--danger: #b42318;
--warn: #a36400;
--radius: 14px;
--radius-sm: 10px;
--shadow: 0 2px 4px rgba(6,108,128,.08), 0 12px 30px rgba(6,108,128,.10);
--shadow-sm: 0 1px 2px rgba(6,108,128,.10);
--sans: 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
--mono: ui-monospace, 'SF Mono', SFMono-Regular, 'Cascadia Code', 'Roboto Mono', Menlo, Consolas, monospace;
color-scheme: light;
}
/* ---- Dark mode — Companion Hub dark colorway. Only the surface/text/accent
tokens flip; chip colours (white-on-muted) and contrast rules carry over. ---- */
[data-theme="dark"] {
color-scheme: dark;
--bg: #041620;
--bg-deep: #07202b;
--surface: #0a222e;
--surface-2: #0e2c39;
--ink: #e8f1f2;
--ink-2: #b7cbcd;
--muted: #93a9ab;
--muted-2: #6e868a;
--muted-soft: #b3c3c4; /* card <p> — ~30% lighter than dark --muted */
--installed-line: #5fd0d8; /* brand light teal outline (dark) */
--installed-text: #7fe0e6; /* bright teal text, legible on dark cards */
--border: rgba(120,205,210,.16);
--border-strong: rgba(120,205,210,.30);
--accent: #0f7b83;
--accent-2: #16a3ad;
--accent-strong: #0a5a61;
--brand: #5fd0d8;
--brand-strong: #8fe3e8;
--shadow: 0 2px 4px rgba(0,0,0,.45), 0 14px 34px rgba(0,0,0,.5);
--shadow-sm: 0 1px 2px rgba(0,0,0,.5);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: var(--sans);
color: var(--ink);
background:
radial-gradient(1200px 600px at 12% -8%, #ffffff 0%, rgba(255,255,255,0) 55%),
radial-gradient(1000px 520px at 100% 0%, #e9f4f7 0%, rgba(233,244,247,0) 50%),
var(--bg);
min-height: 100vh;
-webkit-font-smoothing: antialiased;
line-height: 1.5;
}
[data-theme="dark"] body {
background:
radial-gradient(1200px 600px at 12% -8%, #07202b 0%, rgba(7,32,43,0) 55%),
radial-gradient(1000px 520px at 100% 0%, #0c2c39 0%, rgba(12,44,57,0) 50%),
var(--bg);
}
[data-theme="dark"] .topbar { background: rgba(8,28,38,.82); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 768px) { .wrap { padding: 0 14px; } }
/* ---- Top bar ---- */
.topbar {
position: sticky; top: 0; z-index: 20;
backdrop-filter: saturate(180%) blur(10px);
background: rgba(255,255,255,.82);
border-bottom: 1px solid var(--border);
}
.topbar-inner {
position: relative;
display: flex; align-items: center; justify-content: space-between;
gap: 16px; padding: 14px 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 40px; width: auto; flex: 0 0 auto; display: block; }
/* Centered wordmark — all caps, 400 weight, cap-height matched to the
logo icon's outer coloured edge (~28.7px → ~41px Montserrat). */
.brand-app {
position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
margin: 0; font-size: 34px; line-height: 1; font-weight: 400;
text-transform: uppercase; letter-spacing: .04em; color: var(--ink);
white-space: nowrap; pointer-events: none;
}
@media (max-width: 640px) { .brand-logo { height: 26px; } .brand-app { display: none; } }
.brand-logo-dark { display: none; }
[data-theme="dark"] .brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo-dark { display: block; }
.topbar-meta { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
display: inline-flex; align-items: center; justify-content: center;
width: 36px; height: 36px; flex: 0 0 auto; padding: 0;
background: var(--surface); border: 1px solid var(--border); color: var(--ink-2);
border-radius: 999px; cursor: pointer; box-shadow: var(--shadow-sm);
transition: background .12s ease, color .12s ease;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .icon-dark { display: none; }
[data-theme="dark"] .theme-toggle .icon-light { display: none; }
[data-theme="dark"] .theme-toggle .icon-dark { display: block; }
.nav-link {
display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
font-size: .82rem; font-weight: 600; color: var(--ink-2); text-decoration: none;
background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
box-shadow: var(--shadow-sm); transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: var(--accent); color: #fff; border-color: var(--accent-strong); }
.pill {
display: inline-flex; align-items: center; gap: 7px;
font-size: .78rem; font-weight: 600; color: var(--ink-2);
background: var(--surface); border: 1px solid var(--border);
padding: 7px 12px; border-radius: 999px; box-shadow: var(--shadow-sm);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.pill .dot.ok { background: var(--success); }
/* Amber "Ollama unavailable" indicator — slow, calm breathing glow. */
.pill .dot.warn {
background: #c98a00;
animation: ollama-breathe 3.4s ease-in-out infinite;
}
@keyframes ollama-breathe {
0%, 100% { box-shadow: 0 0 0 0 rgba(201,138,0,0); opacity: .7; transform: scale(1); }
50% { box-shadow: 0 0 9px 2px rgba(201,138,0,.7); opacity: 1; transform: scale(1.15); }
}
@media (prefers-reduced-motion: reduce) { .pill .dot.warn { animation: none; } }
@media (max-width: 640px) { .topbar-meta .pill.hide-sm { display: none; } }
/* ---- Hero ---- */
.hero { padding: 46px 0 8px; }
.hero h1 {
font-size: 1.68rem; font-weight: 800; letter-spacing: -.025em;
line-height: 1.08; max-width: 24ch;
}
.hero p.lede { margin-top: 14px; color: var(--muted); font-size: 1.08rem; max-width: 62ch; }
@media (max-width: 768px) { .hero { padding: 30px 0 4px; } .hero h1 { font-size: 1.19rem; } }
.summary {
display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 28px;
}
@media (max-width: 900px) { .summary { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .summary { grid-template-columns: 1fr; } }
.summary-card {
background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
padding: 18px 18px 16px; box-shadow: var(--shadow-sm);
}
.summary-card .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.summary-card .v { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; }
.summary-card .v small { font-size: .9rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.summary-card .sub { font-size: .82rem; color: var(--muted); margin-top: 4px; }
/* ---- Sections / cards ---- */
main { padding: 30px 0 60px; }
.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.section-head h2 { font-size: 1.18rem; font-weight: 700; letter-spacing: -.01em; }
.section-head .hint { font-size: .85rem; color: var(--muted); }
.section-head-right { display: flex; align-items: center; gap: 10px; align-self: center; }
.collapse-toggle {
display: inline-flex; align-items: center; justify-content: center;
width: 28px; height: 28px; flex: 0 0 auto; padding: 0;
background: var(--surface); border: 1px solid var(--border); color: var(--ink-2);
border-radius: 8px; cursor: pointer; box-shadow: var(--shadow-sm);
transition: background .12s ease, color .12s ease;
}
.collapse-toggle:hover { background: var(--surface-2); color: var(--ink); }
.collapse-toggle svg { width: 16px; height: 16px; display: block; transition: transform .2s ease; }
/* Chevron points up when expanded; flips to point down when collapsed. */
.section.collapsed .collapse-toggle svg { transform: rotate(180deg); }
.section.collapsed > .card { display: none; }
.card {
background: var(--surface); border: 1px solid var(--border);
border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
@media (max-width: 768px) { .card { padding: 16px; } }
.note {
border: 1px solid var(--border); background: var(--surface-2);
border-radius: var(--radius-sm); padding: 14px 16px; color: var(--ink-2); font-size: .92rem;
}
.note.brand { background: var(--accent); border-color: var(--accent-strong); color: #fff; }
.note.warn { background: var(--warn); border-color: #855200; color: #fff; }
.note.error { background: var(--danger); border-color: #8f1b12; color: #fff; }
.note.brand strong, .note.warn strong, .note.error strong { color: #fff; }
.note.brand a { color: #fff; text-decoration: underline; }
/* Inline command chip — click to copy (e.g. `ollama serve`). */
code.cmd {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: .9em; background: var(--surface-2); border: 1px solid var(--border);
border-radius: 6px; padding: 1px 7px; color: var(--ink);
cursor: pointer; white-space: nowrap; transition: background .12s ease;
}
code.cmd:hover { background: var(--surface); }
code.cmd.copied { color: var(--success); border-color: var(--success); }
.note.warn code.cmd { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.4); color: #fff; }
.note.warn code.cmd.copied { color: #fff; border-color: #fff; }
/* ---- Tags / chips ---- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
display: inline-flex; align-items: center; gap: 5px;
font-size: .75rem; font-weight: 600; color: var(--ink-2);
background: var(--surface-2); border: 1px solid var(--border);
padding: 3px 9px; border-radius: 999px;
}
.tag.ok { background: transparent; border-color: var(--installed-line); color: var(--installed-text); }
.tag.muted { color: var(--muted); }
.tag.brand { background: var(--accent); border-color: var(--accent-strong); color: #fff; }
/* ---- Buttons ---- */
.btn {
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
font-family: inherit; font-size: .95rem; font-weight: 600;
padding: 11px 18px; border-radius: 10px; border: 1px solid transparent;
cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #0f7b83, #095e66); color: var(--accent-ink); border-color: var(--accent-strong); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 18px rgba(9,94,102,.28); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
@media (max-width: 560px) { .btn-row { flex-direction: column; } .btn { width: 100%; } }
/* ---- Model selector ---- */
.field-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 10px; color: var(--ink-2); }
.model-grid {
display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px;
max-height: 420px; overflow-y: auto; padding: 2px;
}
.model-opt {
position: relative; display: block; cursor: pointer;
border: 1px solid var(--border); border-radius: 12px; padding: 14px;
background: var(--surface); transition: border-color .12s ease, box-shadow .12s ease;
}
.model-opt:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.model-opt.disabled { opacity: .6; cursor: not-allowed; }
.model-opt input { position: absolute; top: 14px; right: 14px; width: 16px; height: 16px; accent-color: var(--brand); }
.model-opt .name { font-weight: 700; font-size: .96rem; padding-right: 26px; word-break: break-word; }
.model-opt .meta { margin-top: 6px; color: var(--muted); font-size: .82rem; }
.model-opt .tags { margin-top: 10px; }
.iq {
display: inline-flex; align-items: baseline; gap: 4px;
font-weight: 700; color: #fff;
background: var(--accent); border: 1px solid var(--accent-strong);
border-radius: 999px; padding: 2px 9px; font-size: .76rem;
}
.iq .n { font-size: .86rem; }
.iq.na { color: var(--muted); background: var(--surface-2); border-color: var(--border); }
.catalog-summary { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* ---- Prompt selector ---- */
select.input, textarea.input {
width: 100%; font-family: inherit; font-size: .95rem; color: var(--ink);
background: var(--surface); border: 1px solid var(--border-strong);
border-radius: 10px; padding: 11px 12px;
}
select.input:focus, textarea.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,111,120,.18); }
textarea.input { min-height: 84px; resize: vertical; }
.prompt-desc { margin-top: 8px; font-size: .86rem; color: var(--muted); }
.prompt-preview {
margin-top: 12px; padding: 12px 14px; background: var(--surface-2);
border: 1px solid var(--border); border-left: 3px solid var(--brand);
border-radius: 8px; font-size: .9rem; color: var(--ink-2);
}
.prompt-preview .lbl { font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.prompt-editor-hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.prompt-library { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.prompt-card {
position: relative; padding: 13px; border: 1px solid var(--border); border-radius: 12px;
background: var(--surface-2); cursor: pointer;
transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.prompt-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.prompt-card.selected { border-color: var(--accent-strong); box-shadow: 0 0 0 2px rgba(15,111,120,.20); background: var(--surface); }
.prompt-card h3 { font-size: .92rem; margin: 8px 0 6px; padding-right: 28px; }
.prompt-card p { font-size: .84rem; color: var(--muted-soft); }
.prompt-card-toggle {
position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; padding: 0;
display: inline-flex; align-items: center; justify-content: center;
background: var(--surface); border: 1px solid var(--border); color: var(--ink-2);
border-radius: 7px; cursor: pointer; transition: background .12s ease, color .12s ease;
}
.prompt-card-toggle:hover { background: var(--surface-2); color: var(--ink); }
.prompt-card-toggle svg { width: 13px; height: 13px; display: block; transition: transform .2s ease; }
.prompt-card.expanded .prompt-card-toggle svg { transform: rotate(180deg); }
.prompt-card-text {
margin-top: 10px; padding: 10px; font-size: .82rem; color: var(--ink-2);
background: var(--surface); border: 1px solid var(--border); border-radius: 8px; white-space: pre-wrap;
}
/* ---- Response comparison ---- */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 760px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.response-box {
white-space: pre-wrap; word-break: break-word;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: .85rem; line-height: 1.5; color: var(--ink);
background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
padding: 14px; max-height: 460px; overflow-y: auto;
}
.response-empty { color: var(--danger); font-style: italic; font-family: inherit; }
/* ---- Progress ---- */
.progress { margin-top: 16px; display: none; }
.progress.active { display: block; }
.progress-track { height: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-strong)); transition: width .3s ease; }
.progress-status { margin-top: 8px; font-size: .85rem; color: var(--muted); }
/* ---- Intelligence ranking ---- */
.iq-source { font-size: .82rem; color: var(--muted); }
.iq-list { display: flex; flex-direction: column; }
.iq-row {
display: grid; grid-template-columns: 26px minmax(150px, 230px) 1fr auto;
gap: 14px; align-items: center; padding: 11px 4px; border-top: 1px solid var(--border);
}
.iq-row:first-child { border-top: none; }
.iq-rank { font-variant-numeric: tabular-nums; color: var(--muted-2); font-weight: 700; font-size: .85rem; text-align: right; }
.iq-model { min-width: 0; }
.iq-model .nm { font-weight: 700; font-size: .94rem; word-break: break-word; }
.iq-model .sub { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.iq-bar { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.iq-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-strong), var(--accent-2)); border-radius: 999px; }
.iq-score { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.iq-score.na { color: var(--muted-2); font-weight: 600; }
@media (max-width: 640px) {
.iq-row { grid-template-columns: 22px 1fr auto; }
.iq-bar { display: none; }
}
.iq-foot { margin-top: 14px; font-size: .82rem; color: var(--muted); }
/* ---- Stats grid ---- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .stats { grid-template-columns: 1fr; } }
.stat {
border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
background: var(--surface-2);
}
.stat .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; }
.stat .v small { font-size: .85rem; color: var(--muted); font-weight: 600; }
/* ---- Chart ---- */
.chart-box { position: relative; min-height: 380px; }
.chart-fallback { display: none; flex-direction: column; gap: 10px; }
.chart-fallback.active { display: flex; }
.fb-row { display: grid; grid-template-columns: minmax(120px, 200px) 1fr auto; gap: 12px; align-items: center; }
.fb-label { font-weight: 600; font-size: .9rem; word-break: break-word; }
.fb-bar { height: 22px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.fb-fill { height: 100%; background: linear-gradient(90deg, var(--accent-strong), var(--accent-2)); }
.fb-val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-insights { margin-top: 14px; }
/* ---- System specs ---- */
.specs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; }
.spec-item { font-size: .92rem; }
.spec-item .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.spec-item .v { font-weight: 600; color: var(--ink-2); margin-top: 2px; word-break: break-word; }
.spec-gpus { margin-top: 4px; padding-left: 18px; color: var(--ink-2); font-weight: 600; }
/* ---- Table ---- */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
thead th {
text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
color: var(--muted); font-weight: 700; padding: 13px 16px; background: var(--surface-2);
border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num { font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .82rem; }
.badge.ok { color: var(--success); }
.badge.fail { color: var(--danger); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
footer { border-top: 1px solid var(--border); padding: 24px 0 40px; color: var(--muted); font-size: .85rem; }
footer .row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
footer .conf { font-size: .76rem; color: var(--muted-2); }
footer .footer-links { display: inline-flex; gap: 16px; flex-wrap: wrap; }
footer .footer-links a { color: var(--ink-2); text-decoration: none; font-weight: 600; }
footer .footer-links a:hover { color: var(--accent-2); text-decoration: underline; }
/* ---- In-app docs (sidebar + content, one tab per topic) ---- */
.docs { padding: 18px 0 60px; }
.docs-layout {
display: flex; min-height: calc(100vh - 240px);
border: 1px solid var(--border); border-radius: var(--radius);
overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm);
}
.docs-sidebar {
width: 250px; flex-shrink: 0; padding: 18px 14px;
border-right: 1px solid var(--border); background: var(--surface-2); overflow-y: auto;
}
.docs-sidebar h2 { margin: 0 0 14px; font-size: .95rem; font-weight: 700; color: var(--ink); }
.docs-category { margin-bottom: 18px; }
.docs-category h3 { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.docs-category ul { list-style: none; padding: 0; margin: 0; }
.docs-category li { margin-bottom: 2px; }
.docs-tab {
width: 100%; text-align: left; padding: 8px 10px; border: none; background: transparent;
cursor: pointer; font-family: inherit; font-size: .88rem; font-weight: 500; color: var(--ink-2);
border-radius: 7px; transition: background .12s ease, color .12s ease;
}
.docs-tab:hover { background: var(--surface); color: var(--ink); }
.docs-tab.active { background: var(--surface); color: var(--accent-2); font-weight: 700; box-shadow: inset 2px 0 0 var(--accent); }
.docs-content { flex: 1; min-width: 0; padding: 24px 28px; overflow-y: auto; }
.docs-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; font-size: .82rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.docs-back:hover { color: var(--ink); }
.docs-topic { max-width: 780px; }
.docs-topic h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.docs-topic h2 { font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em; margin: 26px 0 0; }
.docs-topic p { color: var(--ink-2); line-height: 1.7; margin-top: 12px; }
.docs-topic ul { margin: 12px 0 0; padding-left: 22px; color: var(--ink-2); line-height: 1.6; }
.docs-topic li { margin-top: 9px; }
.docs-topic li strong { color: var(--ink); }
.docs-topic a { color: var(--accent-2); text-decoration: none; font-weight: 600; }
.docs-topic a:hover { text-decoration: underline; }
.docs-links { list-style: none; padding-left: 0; }
.docs-links li { margin-top: 10px; }
@media (max-width: 760px) {
.docs-layout { flex-direction: column; min-height: 0; }
.docs-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
}
</style>
</head>
<body>
<div class="topbar">
<div class="wrap topbar-inner">
<div class="brand">
<img class="brand-logo brand-logo-light" src="assets/2024_CI__Logo_Banner_Color_small-lightmode.svg" alt="Companion Intelligence" width="109" height="30" />
<img class="brand-logo brand-logo-dark" src="assets/2024_CI__Logo_Banner_Color_small-darkmode.svg" alt="Companion Intelligence" width="109" height="30" />
</div>
<span class="brand-app">Local Bench</span>
<div class="topbar-meta">
<a class="nav-link" id="docsNav" href="#docs">Docs</a>
<span class="pill hide-sm" id="ollamaStatus"><span class="dot" id="ollamaDot"></span><span id="ollamaLabel">Connecting…</span></span>
<button class="theme-toggle" id="themeToggle" type="button" aria-label="Toggle light or dark theme" title="Toggle theme">
<svg class="icon-light" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
<svg class="icon-dark" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"/></svg>
</button>
</div>
</div>
</div>
<div class="wrap" id="heroWrap">
<section class="hero">
<h1>Local LLM benchmark<br />& intelligence catalog</h1>
<p class="lede">Measure throughput for the models you run locally via Ollama, and compare their skills at various tasks. Run Ollama with <code class="cmd" title="Click to copy">ollama serve</code> in a terminal application.</p>
<div class="summary" id="summary">
<div class="summary-card"><div class="k">Catalog models</div><div class="v" id="sumCatalog">—</div><div class="sub" id="sumCatalogSub">Curated Companion catalog</div></div>
<div class="summary-card"><div class="k">Installed locally</div><div class="v" id="sumInstalled">—</div><div class="sub" id="sumInstalledSub">Detected via Ollama</div></div>
<div class="summary-card"><div class="k">Top intelligence</div><div class="v" id="sumTopIq">—</div><div class="sub" id="sumTopIqSub">By intelligence index</div></div>
<div class="summary-card"><div class="k">Fastest measured</div><div class="v" id="sumFastest">—</div><div class="sub" id="sumFastestSub">Run a benchmark to populate</div></div>
</div>
</section>
</div>
<main class="wrap" id="dashboardMain">
<div id="errorContainer"></div>
<!-- Run benchmarks -->
<section class="section">
<div class="section-head">
<h2>Run a benchmark</h2>
<span class="hint">Select installed models, choose a prompt, and measure tokens/second.</span>
</div>
<div class="card">
<div id="benchmarkAlert"></div>
<label class="field-label">Models</label>
<div class="model-grid" id="modelList"><p style="color:var(--muted)">Loading available models…</p></div>
<div class="catalog-summary" id="modelCatalogSummary"></div>
<div style="margin-top:22px">
<label class="field-label" for="promptSelect">Test prompt</label>
<select class="input" id="promptSelect" onchange="handlePromptChange()">
<option value="">Loading prompts…</option>
</select>
<div class="prompt-desc" id="promptDescription"></div>
<label class="field-label" style="margin-top:14px" for="activePrompt">Current prompt <span class="prompt-editor-hint">— editable; this exact text is sent to the model</span></label>
<textarea class="input" id="activePrompt" placeholder="Select a prompt below or type your own…"></textarea>
<label class="field-label" style="margin-top:18px">Prompt library <span class="prompt-editor-hint">— click a card to use it, expand to preview the prompt</span></label>
<div class="prompt-library" id="promptLibrary"></div>
</div>
<div class="btn-row">
<button class="btn btn-primary" id="runBenchmarkBtn" onclick="runBenchmark()">Run benchmark</button>
<button class="btn btn-ghost" onclick="selectAllModels()">Select all installed</button>
<button class="btn btn-ghost" onclick="deselectAllModels()">Clear selection</button>
</div>
<div class="progress" id="progressContainer">
<div class="progress-track"><div class="progress-fill" id="progressFill"></div></div>
<div class="progress-status" id="progressStatus">Preparing…</div>
</div>
</div>
</section>
<!-- Model intelligence -->
<section class="section" id="intelligenceSection">
<div class="section-head">
<h2>Model intelligence</h2>
<div class="section-head-right">
<span class="hint" id="iqSourceHint">Artificial Analysis Intelligence Index</span>
<button class="collapse-toggle" id="intelligenceToggle" type="button" aria-expanded="true" aria-controls="intelligenceBody" aria-label="Collapse section" onclick="toggleIntelligence()">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 15l-6-6-6 6"/></svg>
</button>
</div>
</div>
<div class="card" id="intelligenceBody">
<div class="iq-list" id="intelligenceList"><p style="color:var(--muted)">Loading curated catalog…</p></div>
<div class="iq-foot" id="intelligenceFoot"></div>
</div>
</section>
<!-- System specs -->
<section class="section">
<div class="section-head">
<h2>System specifications</h2>
<span class="hint">Captured with each benchmark run</span>
</div>
<div class="card"><div id="systemSpecs" class="note">Loading system specifications…</div></div>
</section>
<!-- Statistics -->
<section class="section">
<div class="section-head"><h2>Statistics</h2></div>
<div class="card"><div class="stats" id="statsGrid"></div></div>
</section>
<!-- Performance chart -->
<section class="section">
<div class="section-head">
<h2>Throughput comparison</h2>
<span class="hint">Tokens per second, higher is faster</span>
</div>
<div class="card">
<div class="chart-box">
<canvas id="benchmarkChart"></canvas>
<div class="chart-fallback" id="chartFallback"></div>
</div>
<div class="chart-insights" id="chartInsights"></div>
</div>
</section>
<!-- Detailed results -->
<section class="section">
<div class="section-head">
<h2>Detailed results</h2>
<div style="display:flex; gap:8px; align-items:center">
<button class="btn btn-primary" id="exportPdfBtn" onclick="exportResultsPdf()" hidden>Export PDF</button>
<button class="btn btn-ghost" onclick="loadResults()">Refresh</button>
</div>
</div>
<div class="card" style="padding:0; overflow:hidden">
<div class="table-scroll">
<table>
<thead>
<tr>
<th>Model</th>
<th>Intelligence</th>
<th>Tokens/s</th>
<th>Total tokens</th>
<th>Duration</th>
<th>Timestamp</th>
<th>Status</th>
</tr>
</thead>
<tbody id="resultsBody"></tbody>
</table>
</div>
</div>
</section>
<!-- Response comparison (two models at a time from the last run) -->
<section class="section" id="responseSection" hidden>
<div class="section-head">
<h2>Response comparison</h2>
<span class="hint">Two models side by side from your last run</span>
</div>
<div class="card">
<div class="prompt-preview" style="margin-top:0">
<div class="lbl">Prompt</div>
<div id="responsePrompt"></div>
</div>
<div class="compare-grid">
<div class="compare-col">
<select class="input" id="compareLeft" onchange="renderCompareSides()" aria-label="Model on the left"></select>
<div class="response-box" id="responseLeft"></div>
</div>
<div class="compare-col">
<select class="input" id="compareRight" onchange="renderCompareSides()" aria-label="Model on the right"></select>
<div class="response-box" id="responseRight"></div>
</div>
</div>
</div>
</section>
</main>
<!-- In-app documentation (CI-Import-Tools style: sidebar + content, one tab per topic) -->
<main class="wrap docs" id="docsView" hidden>
<div class="docs-layout">
<aside class="docs-sidebar">
<h2>Documentation</h2>
<div class="docs-category">
<h3>Local Bench</h3>
<ul>
<li><button class="docs-tab active" data-topic="overview" onclick="selectDocTopic('overview')">Overview</button></li>
<li><button class="docs-tab" data-topic="what-it-shows" onclick="selectDocTopic('what-it-shows')">What it shows, and why</button></li>
<li><button class="docs-tab" data-topic="prompts" onclick="selectDocTopic('prompts')">Types of prompts</button></li>
<li><button class="docs-tab" data-topic="multi-agent" onclick="selectDocTopic('multi-agent')">Building multi-agent systems</button></li>
<li><button class="docs-tab" data-topic="learn-more" onclick="selectDocTopic('learn-more')">Learn more</button></li>
</ul>
</div>
</aside>
<div class="docs-content">
<a class="docs-back" href="#" onclick="location.hash=''; return false;">← Back to dashboard</a>
<section class="docs-topic" id="topic-overview">
<h1>Local Bench</h1>
<p>Local Bench is a companion app that benchmarks local language models on your own hardware. It runs a set of prompts through models served by Ollama, measures how each one performs, and saves the results so you can compare them over time.</p>
<p>Everything runs locally. Your prompts and the model responses stay on your machine. Use the tabs on the left to learn what Local Bench shows, the kinds of prompts it runs, and how it helps you plan multi-agent systems.</p>
</section>
<section class="docs-topic" id="topic-what-it-shows" hidden>
<h1>What it shows, and why</h1>
<p>Local Bench shows how a model actually behaves on your machine:</p>
<ul>
<li><strong>Throughput and timing</strong> for each model (how quickly it produces tokens).</li>
<li><strong>Your system specs</strong> recorded next to every run, so a number always has context.</li>
<li><strong>A history of runs</strong>, stored to disk, so you can compare before and after a change such as a new GPU, a different quantization, or a newer model.</li>
</ul>
<p><strong>Why it matters:</strong> a model that is fast on someone else's hardware may be too slow on yours. Before you build anything on top of a local model, Local Bench tells you what to expect, in real numbers, on the hardware you own.</p>
</section>
<section class="docs-topic" id="topic-prompts" hidden>
<h1>Types of prompts</h1>
<p>Local Bench runs a set of benchmark prompts rather than a single one, because different workloads stress a model in different ways. These categories map to how you will actually use a model:</p>
<ul>
<li><strong>Short prompts with short answers.</strong> Closest to quick, high-frequency calls. Latency matters most here.</li>
<li><strong>Long-context prompts.</strong> Large inputs such as documents, transcripts, or chat history test how a model handles a full context window.</li>
<li><strong>Reasoning or multi-step prompts.</strong> Longer generations where steady throughput and stability matter.</li>
</ul>
<p>Pick the prompt types that match your real use case and weigh the results accordingly.</p>
</section>
<section class="docs-topic" id="topic-multi-agent" hidden>
<h1>Building multi-agent systems</h1>
<p>A multi-agent system runs several models, or several copies of a model, working together: one plans, others carry out steps, another reviews. On local hardware they all share the same GPU and memory, so performance is a budget you spend.</p>
<p>Local Bench helps you plan that budget:</p>
<ul>
<li><strong>Match models to roles.</strong> Put a small, fast model on high-frequency agents (routing, simple tool calls) and reserve a larger, slower model for the few steps that need deeper reasoning.</li>
<li><strong>Know your ceiling.</strong> Throughput figures tell you roughly how many agents can run at once before the system slows down.</li>
<li><strong>Re-test after changes.</strong> When you swap a model or change hardware, run the benchmark again so your agent design still fits the numbers.</li>
<li><strong>Start small.</strong> Benchmark the one or two models you plan to use, confirm they are fast enough for the busiest agent in your system, then add more agents from there.</li>
</ul>
</section>
<section class="docs-topic" id="topic-learn-more" hidden>
<h1>Learn more</h1>
<ul class="docs-links">
<li><a href="https://docs.ci.computer/" target="_blank" rel="noopener">Local Bench on the Companion Intelligence docs</a></li>
<li><a href="https://github.com/companionintelligence/Local-Bench" target="_blank" rel="noopener">Local Bench on GitHub</a></li>
</ul>
</section>
</div>
</div>
</main>
<footer>
<div class="wrap row">
<span>Local-Bench, a Companion Intelligence app for benchmarking local LLMs.</span>
<span class="footer-links">
<a href="https://ci.computer/" target="_blank" rel="noopener">Ecosystem</a>
<a href="https://discord.com/invite/yQp9hwpzAa" target="_blank" rel="noopener">Discord</a>
</span>
<span class="conf">Licensed under the Companion Intelligence Commercial Standard License (CI-Commercial-1.0).</span>
</div>
</footer>
<script>
let chart = null;
let availablePrompts = [];
let availableModels = [];
let modelIndexByName = {};
let lastResults = [];
let lastRun = [];
let latestSpecs = null;
let intelligenceAutoCollapsed = false;
let intelligenceMeta = { source: 'Artificial Analysis Intelligence Index', url: 'https://artificialanalysis.ai/', asOf: '' };
function escapeHtml(value) {
return String(value ?? '')
.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
.replace(/"/g, '"').replace(/'/g, ''');
}
function normalizeResult(result) {
const normalizedStatus = typeof result.status === 'string' ? result.status.toLowerCase() : '';
const success = typeof result.success === 'boolean' ? result.success : normalizedStatus === 'success';
return {
model: result.model,
tokensPerSecond: Number(result.tokensPerSecond || 0),
totalTokens: Number(result.totalTokens || 0),
duration: Number(result.duration ?? result.durationSeconds ?? 0),
timestamp: result.timestamp,
status: success ? 'Success' : 'Failed',
success
};
}
function iqBadge(score) {
if (score === null || score === undefined) return '<span class="iq na" title="Not individually rated by the index">IQ —</span>';
return `<span class="iq"><span>IQ</span><span class="n">${escapeHtml(score)}</span></span>`;
}
async function loadMeta() {
try {
const res = await fetch('/api/meta');
if (!res.ok) return;
const data = await res.json();
if (data && data.intelligence) {
intelligenceMeta = { ...intelligenceMeta, ...data.intelligence };
const hint = document.getElementById('iqSourceHint');
const asOf = intelligenceMeta.asOf ? ` · as of ${escapeHtml(intelligenceMeta.asOf)}` : '';
hint.textContent = `${intelligenceMeta.source}${asOf}`;
}
} catch (e) { /* attribution stays at default */ }
}
function renderPromptLibrary(prompts) {
document.getElementById('promptLibrary').innerHTML = prompts.map(prompt => `
<div class="prompt-card" data-id="${escapeHtml(prompt.id)}" role="button" tabindex="0" onclick="selectPromptCard('${escapeHtml(prompt.id)}')" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();selectPromptCard('${escapeHtml(prompt.id)}');}">
<button class="prompt-card-toggle" type="button" aria-expanded="false" aria-label="Show prompt" onclick="togglePromptCard(this, event)">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>
</button>
<div class="tags"><span class="tag brand">${escapeHtml(prompt.category)}</span><span class="tag muted">${escapeHtml(prompt.type)}</span></div>
<h3>${escapeHtml(prompt.name)}</h3>
<p>${escapeHtml(prompt.description)}</p>
<div class="prompt-card-text" hidden>${escapeHtml(prompt.prompt)}</div>
</div>`).join('');
markSelectedPromptCard(document.getElementById('promptSelect').value);
}
// Reveal/hide the full prompt text inside a card without selecting it.
function togglePromptCard(btn, event) {
event.stopPropagation();
const card = btn.closest('.prompt-card');
if (!card) return;
const text = card.querySelector('.prompt-card-text');
const expanded = card.classList.toggle('expanded');
if (text) text.hidden = !expanded;
btn.setAttribute('aria-expanded', String(expanded));
btn.setAttribute('aria-label', expanded ? 'Hide prompt' : 'Show prompt');
}
// Selecting a card loads its prompt into the editable box (in sync with the dropdown).
function selectPromptCard(id) {
const promptSelect = document.getElementById('promptSelect');
promptSelect.value = id;
handlePromptChange();
}
function markSelectedPromptCard(id) {
document.querySelectorAll('#promptLibrary .prompt-card').forEach(card => {
card.classList.toggle('selected', card.dataset.id === id);
});
}
function updateOllamaStatus(state) {
const dot = document.getElementById('ollamaDot');
const label = document.getElementById('ollamaLabel');
if (state === 'connected') { dot.className = 'dot ok'; label.textContent = 'Ollama connected'; }
else if (state === 'unavailable') { dot.className = 'dot warn'; label.textContent = 'Ollama unavailable'; }
else { dot.className = 'dot'; label.textContent = 'Connecting…'; }
}
// Click an inline command chip (e.g. `ollama serve`) to copy it to the clipboard.
document.addEventListener('click', (event) => {
const chip = event.target.closest('code.cmd');
if (!chip || chip.classList.contains('copied')) return;
const command = chip.textContent;
const showCopied = () => {
chip.classList.add('copied');
chip.textContent = 'Copied!';
setTimeout(() => { chip.textContent = command; chip.classList.remove('copied'); }, 1100);
};
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(command).then(showCopied).catch(() => {});
}
});
function updateModelCatalogSummary(models, options = {}) {
const summary = document.getElementById('modelCatalogSummary');
const installedCount = models.filter(m => m.installed).length;
const supportedCount = models.filter(m => m.supported).length;
const customInstalledCount = models.filter(m => m.installed && !m.supported).length;
const note = options.ollamaUnavailable
? '<span class="note warn" style="flex:1 1 100%;margin-top:8px">Ollama is currently unavailable — showing the curated catalog only. Open a terminal application and run <code class="cmd" title="Click to copy">ollama serve</code> to start it, then refresh to enable benchmarking.</span>'
: '<span class="tag muted" style="flex:1 1 100%;background:none;border:none;padding-left:0">Disabled cards are in the curated catalog but not installed locally.</span>';
summary.innerHTML = `
<span class="tag ok">${installedCount} installed</span>
<span class="tag">${supportedCount} curated</span>
${customInstalledCount > 0 ? `<span class="tag muted">${customInstalledCount} custom</span>` : ''}
${note}`;
}
function updateSummaryCards() {
const catalog = availableModels.filter(m => m.supported);
const installed = availableModels.filter(m => m.installed);
document.getElementById('sumCatalog').textContent = catalog.length || availableModels.length || '—';
document.getElementById('sumInstalled').textContent = installed.length;
const rated = availableModels.filter(m => typeof m.intelligenceIndex === 'number');
if (rated.length) {
const top = rated.reduce((a, b) => (b.intelligenceIndex > a.intelligenceIndex ? b : a));
document.getElementById('sumTopIq').innerHTML = `${top.intelligenceIndex} <small>${escapeHtml(top.name)}</small>`;
} else {
document.getElementById('sumTopIq').textContent = '—';
}
}
function renderIntelligenceCatalog(models) {
const list = document.getElementById('intelligenceList');
const foot = document.getElementById('intelligenceFoot');
const rated = models.filter(m => typeof m.intelligenceIndex === 'number')
.sort((a, b) => b.intelligenceIndex - a.intelligenceIndex);
const unrated = models.filter(m => typeof m.intelligenceIndex !== 'number');
if (rated.length === 0) {
list.innerHTML = '<p style="color:var(--muted)">No intelligence scores available.</p>';
foot.innerHTML = '';
return;
}
const maxScore = rated[0].intelligenceIndex;
const ceiling = Math.max(10, Math.ceil(maxScore / 10) * 10);
list.innerHTML = rated.map((m, i) => {
const width = Math.max(2, (m.intelligenceIndex / ceiling) * 100);
const sub = [m.size, m.contextWindow ? m.contextWindow + ' ctx' : null, (m.inputs || []).join(' + ')]
.filter(Boolean).join(' · ');
const installedTag = m.installed ? '<span class="tag ok">Installed</span>' : '';
return `
<div class="iq-row">
<div class="iq-rank">${i + 1}</div>
<div class="iq-model">
<div class="nm">${escapeHtml(m.name)} ${installedTag}</div>
<div class="sub">${escapeHtml(sub)}</div>
</div>
<div class="iq-bar"><span style="width:${width.toFixed(1)}%"></span></div>
<div class="iq-score">${m.intelligenceIndex}</div>
</div>`;
}).join('');
const url = intelligenceMeta.url || 'https://artificialanalysis.ai/';
const asOf = intelligenceMeta.asOf ? ` (snapshot ${escapeHtml(intelligenceMeta.asOf)})` : '';
foot.innerHTML = `Scores are the <a href="${escapeHtml(url)}" target="_blank" rel="noopener">${escapeHtml(intelligenceMeta.source)}</a>${asOf} — higher is more capable.`
+ (unrated.length ? ` ${unrated.length} model(s) are not individually rated (vision-only or very small) and are shown as “IQ —”.` : '');
}
async function loadPrompts() {
try {
const response = await fetch('/api/prompts');
if (!response.ok) throw new Error('Failed to fetch prompts');
availablePrompts = await response.json();
const promptSelect = document.getElementById('promptSelect');
promptSelect.innerHTML = availablePrompts.map(p =>
`<option value="${escapeHtml(p.id)}">${escapeHtml(p.name)} • ${escapeHtml(p.type)}</option>`
).join('') + '<option value="custom">✏️ Custom prompt</option>';
renderPromptLibrary(availablePrompts);
handlePromptChange();
} catch (error) {
document.getElementById('promptSelect').innerHTML = '<option value="">Failed to load prompts</option>';
}
}
function handlePromptChange() {
const promptSelect = document.getElementById('promptSelect');
const descriptionDiv = document.getElementById('promptDescription');
const activePrompt = document.getElementById('activePrompt');
const selectedValue = promptSelect.value;
if (selectedValue === 'custom') {
descriptionDiv.textContent = 'Custom prompt — type anything you want to benchmark below.';
activePrompt.value = '';
activePrompt.focus();
} else {
const selectedPrompt = availablePrompts.find(p => p.id === selectedValue);
if (selectedPrompt) {
descriptionDiv.textContent = `${selectedPrompt.category} • ${selectedPrompt.type} — ${selectedPrompt.description}`;
activePrompt.value = selectedPrompt.prompt;
}
}
markSelectedPromptCard(selectedValue);
}
function getPromptConfig() {
// The editable box is the single source of truth — base prompts are pre-filled
// there and may be edited, so always send its text as the prompt to run.
return { customPrompt: document.getElementById('activePrompt').value.trim() };
}
async function loadSystemSpecs() {
try {
const response = await fetch('/api/system-specs');
if (!response.ok) throw new Error('Failed to fetch system specs');
displaySystemSpecs(await response.json());
} catch (error) {
document.getElementById('systemSpecs').className = 'note';
document.getElementById('systemSpecs').textContent = 'No system specs yet. Run a benchmark to capture CPU, memory, OS, and GPU details.';
}
}
function displaySystemSpecs(specs) {
latestSpecs = specs || null;
const el = document.getElementById('systemSpecs');
if (!specs) {
el.className = 'note';
el.textContent = 'No system specs yet. Run a benchmark to capture CPU, memory, OS, and GPU details.';
return;
}
const gpusHtml = (specs.gpus || []).map(gpu => `<li>${escapeHtml(gpu.model)}${gpu.vram ? ` (${escapeHtml(gpu.vram)} MB)` : ''}</li>`).join('');
el.className = '';
el.innerHTML = `
<div class="specs-grid">
<div class="spec-item"><div class="k">Server</div><div class="v">${escapeHtml(specs.serverName)}</div></div>
<div class="spec-item"><div class="k">CPU</div><div class="v">${escapeHtml(specs.cpuModel)}</div></div>
<div class="spec-item"><div class="k">Cores / threads</div><div class="v">${escapeHtml(specs.cpuCores)} cores · ${escapeHtml(specs.cpuThreads)} threads</div></div>
<div class="spec-item"><div class="k">Memory</div><div class="v">${escapeHtml(specs.totalMemoryGB)} GB</div></div>
<div class="spec-item"><div class="k">OS</div><div class="v">${escapeHtml(specs.osType)} ${escapeHtml(specs.osVersion)}</div></div>