heartcode 0.1.58 → 0.1.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/README.md +27 -10
- package/SKILL.md +59 -17
- package/bin/heart.js +1 -1
- package/bin/heartcode.js +92 -66
- package/package.json +1 -1
- package/prompts/agent.md +64 -15
- package/src/acp.js +3 -3
- package/src/agent.js +175 -44
- package/src/capabilities.js +1 -1
- package/src/client.js +41 -10
- package/src/config.js +3 -3
- package/src/context.js +1 -1
- package/src/guided.js +26 -17
- package/src/headless.js +63 -15
- package/src/importer.js +7 -7
- package/src/log.js +3 -3
- package/src/mcp.js +1 -1
- package/src/memory.js +1 -1
- package/src/oauth.js +1 -1
- package/src/probe.js +14 -4
- package/src/reset.js +2 -2
- package/src/sessions.js +2 -2
- package/src/settings.html +203 -159
- package/src/settings.js +49 -20
- package/src/tabs.js +4 -1
- package/src/telegram.js +1 -1
- package/src/tools.js +102 -33
- package/src/tree.js +1 -1
- package/src/ui.js +110 -26
- package/src/usage.js +9 -0
- package/src/voice.js +1 -1
- package/src/web.js +1 -1
package/src/settings.html
CHANGED
|
@@ -94,6 +94,8 @@
|
|
|
94
94
|
.theme-btn:hover { color: var(--text); }
|
|
95
95
|
.theme-btn svg { width: 18px; height: 18px; }
|
|
96
96
|
main { padding: 36px 44px 72px; width: 100%; max-width: 1640px; min-width: 0; }
|
|
97
|
+
@media (max-width: 1500px) { main { padding-left: 24px; padding-right: 24px; } } /* a laptop: the models table fits without scrolling sideways */
|
|
98
|
+
@media (min-width: 861px) and (max-width: 1400px) { .app { grid-template-columns: 208px minmax(0, 1fr); } main { padding-left: 16px; padding-right: 16px; } } /* a small laptop (1280): a narrower sidebar too */
|
|
97
99
|
.page { display: none; }
|
|
98
100
|
.page.on { display: block; animation: page-in .22s ease-out; }
|
|
99
101
|
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
|
|
@@ -308,6 +310,7 @@
|
|
|
308
310
|
.prov-h .by-name button, .prov-h > button.small { height: 28px; }
|
|
309
311
|
dialog#gone { width: min(560px, 92vw); }
|
|
310
312
|
dialog#h-test { width: min(560px, 92vw); }
|
|
313
|
+
dialog#small-screen { width: min(420px, calc(100vw - 32px)); }
|
|
311
314
|
dialog#gone h2 { color: var(--err); font-family: inherit; font-size: 18px; }
|
|
312
315
|
dialog#gone::backdrop { background: rgba(0, 0, 0, .75); }
|
|
313
316
|
.hello-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
|
|
@@ -428,7 +431,7 @@
|
|
|
428
431
|
.mt-more-pill button:hover:not(:disabled) { background: var(--hover); }
|
|
429
432
|
.mt-more-pill button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
430
433
|
.mt-more-pill button:disabled { color: var(--faint); cursor: default; }
|
|
431
|
-
.mt, .mt-h.mt-hpick { min-width:
|
|
434
|
+
.mt, .mt-h.mt-hpick { min-width: 1024px; } /* the columns below, their gaps and padding: the header, the selection bar and the rows line up (the rows are drawn a screenful at a time, so this can't come from them) */
|
|
432
435
|
.mt-h input[type=checkbox], .mtable input[type=checkbox] { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); cursor: pointer; }
|
|
433
436
|
.mtable li.picked { background: var(--brand-soft); }
|
|
434
437
|
.mt-rules { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 24px; padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
|
|
@@ -450,8 +453,9 @@
|
|
|
450
453
|
.pill .again:hover:not(:disabled) { color: var(--text); }
|
|
451
454
|
.pill.on { border-color: var(--accent); background: var(--accent-soft); }
|
|
452
455
|
.pill.on .again { border-left-color: color-mix(in srgb, var(--accent) 40%, transparent); }
|
|
453
|
-
.mt-h, .mtable li { display: grid; grid-template-columns: 14px
|
|
456
|
+
.mt-h, .mtable li { display: grid; grid-template-columns: 14px 16px 28px minmax(120px, 1fr) 80px 148px 52px 26px 26px 26px 44px 44px 44px 94px 74px 104px; /* the last: Test · Request · Edit · ✕, as wide as they are */ align-items: center; column-gap: 4px; padding: 8px 12px; }
|
|
454
457
|
.mt-h button.mid, .mtable .mid { text-align: center; }
|
|
458
|
+
@media (min-width: 861px) and (max-width: 1400px) { .mt-h, .mtable li { padding-left: 6px; padding-right: 6px; } .mt, .mt-h.mt-hpick { min-width: 1012px; } } /* a small laptop (1280): narrower rows */
|
|
455
459
|
.mt-h > :nth-child(15), .mtable .try { padding-left: 12px; } /* Works?: a little room after the right-aligned price */
|
|
456
460
|
.mtable li .acts { justify-content: flex-start; }
|
|
457
461
|
.mt-h { border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--faint); padding-top: 10px; padding-bottom: 10px; background: var(--panel2); }
|
|
@@ -480,14 +484,13 @@
|
|
|
480
484
|
.hp .sw { display: inline-block; width: 30px; height: 18px; margin: 0 4px 0 0; }
|
|
481
485
|
.hp .sw i::after { width: 12px; height: 12px; }
|
|
482
486
|
.hp .sw input:checked + i::after { transform: translateX(12px); }
|
|
483
|
-
.mtable li .hp .jp { display: inline-flex; align-items: center;
|
|
487
|
+
.mtable li .hp .jp { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 24px; padding: 0; border-radius: 7px; border: 1px solid var(--line-strong); background: transparent; color: var(--faint); cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .1s; }
|
|
488
|
+
.mtable li .hp .jp .icon { width: 14px; height: 14px; }
|
|
484
489
|
.mtable li .hp .jp:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
|
|
485
490
|
.mtable li .hp .jp:active:not(:disabled) { transform: scale(.95); }
|
|
486
491
|
.mtable li .hp .jp:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
487
|
-
.mtable li .hp .jp.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--
|
|
488
|
-
.mtable li .hp .jp.on::before { content: '✓'; color: var(--accent); font-weight: 700; }
|
|
492
|
+
.mtable li .hp .jp.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
|
|
489
493
|
.mtable li .hp .jp.sug { border-style: dashed; border-color: var(--accent); color: var(--accent); }
|
|
490
|
-
.mtable li .hp .jp.sug::before { content: '+'; font-weight: 700; }
|
|
491
494
|
.mtable li .hp.off .jp:not(.sug) { opacity: .6; }
|
|
492
495
|
/* the helper suggestions, waiting for a yes: beside the list's buttons */
|
|
493
496
|
.hsug { display: inline-flex; align-items: center; gap: 6px; padding: 2px 3px 2px 10px; border: 1px dashed var(--accent); border-radius: 10px; background: var(--accent-soft); color: var(--text); white-space: nowrap; }
|
|
@@ -511,6 +514,7 @@
|
|
|
511
514
|
.mtable .try.going .msg { animation: pulse 1.4s ease-in-out infinite; }
|
|
512
515
|
@media (prefers-reduced-motion: reduce) { .mtable .try.going .msg { animation: none; } }
|
|
513
516
|
.mtable .rk { color: var(--muted); }
|
|
517
|
+
.mt-h .icon { width: 15px; height: 15px; vertical-align: -3px; } /* a column named by its icon (its name on hover) */
|
|
514
518
|
.mtable .rk b { color: var(--text); font-weight: 600; margin-right: 5px; }
|
|
515
519
|
.mtable .rk.top b { color: inherit; }
|
|
516
520
|
.mtable .rk.top { color: var(--ok); font-weight: 600; }
|
|
@@ -566,16 +570,23 @@
|
|
|
566
570
|
.mt-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
|
567
571
|
.h-order { display: inline-flex; align-items: center; gap: 8px; margin-right: 4px; }
|
|
568
572
|
.h-order .mt-setl { white-space: nowrap; }
|
|
573
|
+
.h-order select { height: 30px; padding-top: 0; padding-bottom: 0; font-size: 12.5px; width: auto; } /* as tall as the buttons beside it */
|
|
569
574
|
.mt-actions .seg { height: 32px; }
|
|
570
575
|
.mt-actions .seg label { padding: 0 11px; font-size: 12.5px; }
|
|
571
576
|
.mt-sets { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 12px 18px 4px; } /* with the filters below: one toolbar, 8px between its two lines */
|
|
572
|
-
.mt-mode-sets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px
|
|
577
|
+
.mt-mode-sets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
|
|
573
578
|
.mt-set { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
574
|
-
.mt-setl { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
|
|
575
|
-
.mt-
|
|
579
|
+
.mt-setl { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
|
|
580
|
+
.mt-setl .icon { width: 14px; height: 14px; color: var(--faint); }
|
|
581
|
+
.mt-div { width: 1px; height: 22px; background: var(--line-strong); margin: 0 4px; } /* between the fail-over settings and the helpers' */
|
|
582
|
+
.mt-mode-sets .h-order select { height: 34px; }
|
|
583
|
+
.mt-mode-sets .seg { height: 34px; }
|
|
584
|
+
.mt-mode-sets .seg label { padding: 0 11px; font-size: 12.5px; }
|
|
585
|
+
@media (min-width: 861px) and (max-width: 1400px) { .mt-mode-sets { column-gap: 6px; } .mt-mode-sets .seg label { padding: 0 7px; font-size: 12px; } .mt-div { margin: 0; } .mt-setc input[type=number], .mt-setc input.tries { width: 42px; } } /* a small laptop (1280): the settings stay on one line */
|
|
586
|
+
.mt-setc { display: flex; align-items: center; gap: 6px; }
|
|
576
587
|
.mt-setc select { width: auto; min-width: 0; height: 34px; padding-top: 0; padding-bottom: 0; line-height: 32px; }
|
|
577
|
-
.mt-setc input[type=number] { width:
|
|
578
|
-
.mt-setc input.tries { width:
|
|
588
|
+
.mt-setc input[type=number] { width: 50px; height: 34px; }
|
|
589
|
+
.mt-setc input.tries { width: 50px; }
|
|
579
590
|
.mt-setc input[type=number] { appearance: textfield; -moz-appearance: textfield; text-align: center; } /* typed: no spinner taking the digits' room */
|
|
580
591
|
.mt-setc input[type=number]::-webkit-inner-spin-button, .mt-setc input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
|
|
581
592
|
.mt-setc .unit { color: var(--muted); font-size: 13px; }
|
|
@@ -621,6 +632,9 @@
|
|
|
621
632
|
.mtable li .acts button.danger:hover:not(:disabled) { color: var(--err); }
|
|
622
633
|
.f-tog { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 13px; cursor: pointer; user-select: none; }
|
|
623
634
|
.f-tog:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--panel)); }
|
|
635
|
+
.f-tog .icon { width: 14px; height: 14px; color: var(--faint); }
|
|
636
|
+
.f-tog:has(input:checked) .icon { color: var(--accent); }
|
|
637
|
+
@media (max-width: 1860px) { .mt-setl .lt, .f-tog .lt, .hbar button .lt { display: none; } .f-tog { padding: 0 9px; } .hbar button.ghost { border-color: var(--line-strong); } } /* a laptop: the controls' icons only (each says what it is on hover): three rows still */
|
|
624
638
|
.f-tog input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; } /* the pill is the switch; the box stays for the keyboard */
|
|
625
639
|
.f-tog:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
626
640
|
.f-tog { position: relative; color: var(--muted); }
|
|
@@ -714,7 +728,7 @@
|
|
|
714
728
|
nav a.on::before { display: none; } /* a strip of tabs: the highlighted one is enough */
|
|
715
729
|
nav a .count, .using, .nav-group { display: none; }
|
|
716
730
|
.theme-btn { top: 10px; right: 12px; }
|
|
717
|
-
.mt-line { width: 100%; }
|
|
731
|
+
.mt-line { width: 100%; flex-wrap: wrap; } /* its buttons go to a second line, not past the screen's edge */
|
|
718
732
|
.mt-line button.primary { margin-left: auto; }
|
|
719
733
|
main { padding: 20px 16px 60px; }
|
|
720
734
|
.steps { grid-template-columns: 1fr; }
|
|
@@ -860,7 +874,7 @@
|
|
|
860
874
|
<!-- Providers & models -->
|
|
861
875
|
<section class="page" id="page-providers">
|
|
862
876
|
<div class="head">
|
|
863
|
-
<div><h1>Providers</h1><p class="lead">Click a model to add it to
|
|
877
|
+
<div><h1>Providers</h1><p class="lead">Click a model to add it to the list, or tick several. HeartCode tries the list in order: #1 first, the next when one fails.</p></div>
|
|
864
878
|
<div class="head-actions"><button id="p-mine" type="button"></button><button class="primary" id="p-open">+ Add a provider</button></div>
|
|
865
879
|
</div>
|
|
866
880
|
<div class="steps" id="steps"></div>
|
|
@@ -883,18 +897,18 @@
|
|
|
883
897
|
|
|
884
898
|
<!-- Your models: all at once, sortable -->
|
|
885
899
|
<section class="page" id="page-models">
|
|
886
|
-
<div class="head"><div><h1>
|
|
900
|
+
<div class="head"><div><h1>Models</h1><p class="lead" id="mt-lead"></p></div><div class="mt-actions" id="mt-actions"></div></div>
|
|
887
901
|
<div class="card mt-card" id="mt"></div>
|
|
888
902
|
</section>
|
|
889
903
|
|
|
890
904
|
<!-- Notifications -->
|
|
891
905
|
<section class="page" id="page-notify">
|
|
892
|
-
<div class="head"><div><h1>Notifications</h1><p class="lead">A message
|
|
906
|
+
<div class="head"><div><h1>Notifications</h1><p class="lead">A phone message when HeartCode finishes a task, fails, or needs an answer: no need to watch it work.</p></div></div>
|
|
893
907
|
<div class="cols">
|
|
894
908
|
<div class="stack">
|
|
895
909
|
<div class="card">
|
|
896
910
|
<h2>Telegram</h2>
|
|
897
|
-
<p class="sub">Through a bot
|
|
911
|
+
<p class="sub">Through a private bot: only its owner gets its messages.</p>
|
|
898
912
|
<div id="tg-setup"></div>
|
|
899
913
|
</div>
|
|
900
914
|
</div>
|
|
@@ -910,10 +924,10 @@
|
|
|
910
924
|
|
|
911
925
|
<!-- Logging -->
|
|
912
926
|
<section class="page" id="page-logging">
|
|
913
|
-
<div class="head"><div><h1>Logs</h1><p class="lead">What HeartCode writes down, for finding out what went wrong. Off
|
|
927
|
+
<div class="head"><div><h1>Logs</h1><p class="lead">What HeartCode writes down, for finding out what went wrong. Off until switched on.</p></div><div class="disk" id="l-disk"></div></div>
|
|
914
928
|
<div class="card">
|
|
915
929
|
<div class="kinds-top">
|
|
916
|
-
<div><h2 style="margin:0">What to log</h2><p class="sub" style="margin:4px 0 0">Each kind on its own, all off
|
|
930
|
+
<div><h2 style="margin:0">What to log</h2><p class="sub" style="margin:4px 0 0">Each kind on its own, all off until switched on. A running HeartCode takes a change in at once. Written to <span class="mono" id="l-where"></span>, a folder per run.</p></div>
|
|
917
931
|
<button class="small" id="l-alloff">All off</button>
|
|
918
932
|
</div>
|
|
919
933
|
<div class="kinds" id="l-kinds"></div>
|
|
@@ -921,7 +935,7 @@
|
|
|
921
935
|
<label for="l-days"><b>Keep logs for</b></label>
|
|
922
936
|
<input type="number" id="l-days" min="1" max="3650" step="1" value="3">
|
|
923
937
|
<span>days</span>
|
|
924
|
-
<span class="muted">Older ones (every kind) are deleted when HeartCode starts, and right away when
|
|
938
|
+
<span class="muted">Older ones (every kind) are deleted when HeartCode starts, and right away when this changes. API keys are never written.</span>
|
|
925
939
|
</div>
|
|
926
940
|
</div>
|
|
927
941
|
<div class="card reqs-card">
|
|
@@ -943,16 +957,16 @@
|
|
|
943
957
|
|
|
944
958
|
<!-- General: one column, a card per topic, every setting saved as it changes -->
|
|
945
959
|
<section class="page" id="page-general">
|
|
946
|
-
<div class="head"><div><h1>General</h1><p class="lead">How HeartCode works
|
|
960
|
+
<div class="head"><div><h1>General</h1><p class="lead">How HeartCode works. Every change saves on its own, and a running HeartCode picks it up right away.</p></div></div>
|
|
947
961
|
<div class="settings-col">
|
|
948
962
|
<div class="card">
|
|
949
963
|
<h2>Permissions</h2>
|
|
950
|
-
<p class="sub">What HeartCode may do without asking
|
|
964
|
+
<p class="sub">What HeartCode may do without asking first. <span class="mono">Shift+Tab</span> in HeartCode switches between these too.</p>
|
|
951
965
|
<div class="choices three" id="g-perm"></div>
|
|
952
966
|
</div>
|
|
953
967
|
<div class="card">
|
|
954
968
|
<h2>Terminal colors</h2>
|
|
955
|
-
<p class="sub">
|
|
969
|
+
<p class="sub">Custom colors on top of one: theme.json in <a href="#files">Advanced → Files</a>.</p>
|
|
956
970
|
<div class="choices four" id="g-theme"></div>
|
|
957
971
|
</div>
|
|
958
972
|
<div class="card">
|
|
@@ -966,13 +980,13 @@
|
|
|
966
980
|
<select id="g-effort"></select>
|
|
967
981
|
</div>
|
|
968
982
|
<div class="setting">
|
|
969
|
-
<label class="t" for="g-context"><b>Context window</b><span>How many tokens the model can hold. Leave it on auto unless HeartCode gets it wrong.</span></label>
|
|
983
|
+
<label class="t" for="g-context"><b>Context window</b><span>How many tokens the model can hold. Leave it on auto unless HeartCode gets it wrong: a number here is used for every model, over each model's own.</span></label>
|
|
970
984
|
<input type="number" id="g-context" min="1" placeholder="Auto">
|
|
971
985
|
</div>
|
|
972
986
|
</div>
|
|
973
987
|
<div class="card">
|
|
974
988
|
<h2>Voice input</h2>
|
|
975
|
-
<p class="sub">Press Space in an empty input box (or type /voice) and talk:
|
|
989
|
+
<p class="sub">Press Space in an empty input box (or type /voice) and talk: the words show in the box while speaking, and Enter sends them. Esc cancels.</p>
|
|
976
990
|
<div class="setting">
|
|
977
991
|
<label class="t" for="v-src"><b>Transcribe with</b><span id="v-src-about"></span></label>
|
|
978
992
|
<select id="v-src"></select>
|
|
@@ -988,7 +1002,7 @@
|
|
|
988
1002
|
</div>
|
|
989
1003
|
<div class="card">
|
|
990
1004
|
<h2>External tools</h2>
|
|
991
|
-
<p class="sub">Some features need a tool on
|
|
1005
|
+
<p class="sub">Some features need a tool on this machine. Ready ones are ticked; the rest say what to install.</p>
|
|
992
1006
|
<div id="g-caps"></div>
|
|
993
1007
|
</div>
|
|
994
1008
|
<div class="card wide">
|
|
@@ -1033,7 +1047,7 @@
|
|
|
1033
1047
|
<div class="k-install r-bar">
|
|
1034
1048
|
<div class="seg" id="r-kinds" role="radiogroup" aria-label="Kind of prompt"></div>
|
|
1035
1049
|
<input type="search" id="r-search" placeholder="Search all prompts" aria-label="Search all prompts">
|
|
1036
|
-
<label class="f-tog" title="Only the prompts
|
|
1050
|
+
<label class="f-tog" title="Only the changed prompts"><input type="checkbox" id="r-mine">Changed</label>
|
|
1037
1051
|
</div>
|
|
1038
1052
|
<div class="md">
|
|
1039
1053
|
<div class="list"><div class="items" id="r-items"></div></div>
|
|
@@ -1043,7 +1057,7 @@
|
|
|
1043
1057
|
|
|
1044
1058
|
<!-- MCP servers -->
|
|
1045
1059
|
<section class="page" id="page-mcp">
|
|
1046
|
-
<div class="head"><div><h1>MCP servers</h1><p class="lead">Programs that give the model more tools: a browser, a database,
|
|
1060
|
+
<div class="head"><div><h1>MCP servers</h1><p class="lead">Programs that give the model more tools: a browser, a database, an issue tracker. Off: HeartCode doesn't start it or offer it to the model.</p></div><button class="primary" id="c-open">+ Add a server</button></div>
|
|
1047
1061
|
<div class="stack">
|
|
1048
1062
|
<div class="card" id="c-list"></div>
|
|
1049
1063
|
<details class="card" id="c-raw"><summary style="cursor:pointer;font-weight:600">Edit mcp.json directly</summary><p class="sub" style="margin-top:10px">For what the form doesn't have: environment variables (<span class="mono">"env"</span>), headers, and so on.</p><div id="c-file"></div></details>
|
|
@@ -1052,7 +1066,7 @@
|
|
|
1052
1066
|
|
|
1053
1067
|
<!-- Skills -->
|
|
1054
1068
|
<section class="page" id="page-skills">
|
|
1055
|
-
<div class="head"><div><h1>Skills</h1><p class="lead">Ready-made prompts
|
|
1069
|
+
<div class="head"><div><h1>Skills</h1><p class="lead">Ready-made prompts, typed as <span class="mono">/skill:name</span>, or used by the model when it fits.</p></div><div class="head-actions"><button id="k-import">Import from other tools</button><button class="primary" id="k-new">+ New skill</button></div></div>
|
|
1056
1070
|
<div class="k-install" id="k-install-card" title="A GitHub repo (owner/repo or its link) or a link to a SKILL.md. Same as /install_skill in HeartCode; installed for every project.">
|
|
1057
1071
|
<span class="k-install-l">Install a skill</span>
|
|
1058
1072
|
<input type="text" id="k-url" placeholder="owner/repo, a GitHub link, or a SKILL.md link" spellcheck="false" aria-label="GitHub repo or SKILL.md link">
|
|
@@ -1083,7 +1097,7 @@
|
|
|
1083
1097
|
<div class="hint">Empty: as found (models.dev, the server, or what HeartCode learns). Measure asks the server.</div>
|
|
1084
1098
|
<label class="opt"><div class="t"><b>Tool calls</b><span>Reads, edits and runs things itself. Off: HeartCode guides it step by step.</span></div><span class="sw"><input type="checkbox" id="ms-tools"><i></i></span></label>
|
|
1085
1099
|
<label class="opt"><div class="t"><b>Thinking</b><span>Thinks before it answers (the effort setting applies).</span></div><span class="sw"><input type="checkbox" id="ms-thinking"><i></i></span></label>
|
|
1086
|
-
<label class="opt"><div class="t"><b>Images</b><span>Reads screenshots and pictures
|
|
1100
|
+
<label class="opt"><div class="t"><b>Images</b><span>Reads screenshots and pictures.</span></div><span class="sw"><input type="checkbox" id="ms-images"><i></i></span></label>
|
|
1087
1101
|
<label class="opt"><div class="t"><b>Streaming</b><span>Its reply shows as it's written. Off: all at once at the end.</span></div><span class="sw"><input type="checkbox" id="ms-stream"><i></i></span></label>
|
|
1088
1102
|
<div class="actions"><button id="ms-cancel" type="button">Cancel</button><button class="primary" id="ms-save" type="button">Save</button></div>
|
|
1089
1103
|
</form>
|
|
@@ -1100,7 +1114,7 @@
|
|
|
1100
1114
|
<input type="password" id="p-key" autocomplete="off" placeholder="paste it here (none for a server on this machine, like Ollama)">
|
|
1101
1115
|
<div class="hint">Kept in config.json on this machine. This page only shows its first and last characters.</div>
|
|
1102
1116
|
<div id="p-more" hidden>
|
|
1103
|
-
<label class="opt" style="margin-top:16px"><div class="t"><b>Load its model list</b><span>On: its models are asked from the provider. Off: never asked; only the models
|
|
1117
|
+
<label class="opt" style="margin-top:16px"><div class="t"><b>Load its model list</b><span>On: its models are asked from the provider. Off: never asked; only the models added by name show (the box next to its name).</span></div><span class="sw"><input type="checkbox" id="p-list-on"><i></i></span></label>
|
|
1104
1118
|
<div class="actions" id="p-added"></div>
|
|
1105
1119
|
</div>
|
|
1106
1120
|
<div class="actions"><button class="danger" id="p-delete" hidden>Delete provider</button><span class="spacer"></span><button id="p-cancel">Cancel</button><button class="primary" id="p-save">Add provider</button></div>
|
|
@@ -1124,11 +1138,16 @@
|
|
|
1124
1138
|
<div class="actions"><span class="spacer"></span><button id="imp-cancel" type="button">Cancel</button><button class="primary" id="imp-go" type="button">Import selected</button></div>
|
|
1125
1139
|
</dialog>
|
|
1126
1140
|
<dialog id="h-test" aria-labelledby="h-test-title">
|
|
1127
|
-
<h2 id="h-test-title">Test
|
|
1128
|
-
<p class="sub">Helpers are picked from the models that answer a short test. None
|
|
1141
|
+
<h2 id="h-test-title">Test the models first</h2>
|
|
1142
|
+
<p class="sub">Helpers are picked from the models that answer a short test. None has answered one yet.</p>
|
|
1129
1143
|
<p class="sub" id="h-test-cost"></p>
|
|
1130
1144
|
<div class="actions"><span class="spacer"></span><button id="h-test-no" type="button" class="ghost">Cancel</button><button id="h-test-go" type="button" class="primary">Test all, then pick</button></div>
|
|
1131
1145
|
</dialog>
|
|
1146
|
+
<dialog id="small-screen" aria-labelledby="small-screen-title">
|
|
1147
|
+
<h2 id="small-screen-title">Works best on a desktop</h2>
|
|
1148
|
+
<p class="sub">This page has wide tables (models, their abilities and tests). On a phone they need a lot of sideways scrolling. Everything still works here.</p>
|
|
1149
|
+
<div class="actions"><span class="spacer"></span><button id="small-screen-ok" type="button" class="primary">Got it</button></div>
|
|
1150
|
+
</dialog>
|
|
1132
1151
|
<dialog id="gone" aria-labelledby="gone-title">
|
|
1133
1152
|
<h2 id="gone-title">Disconnected</h2>
|
|
1134
1153
|
<p class="sub">HeartCode's settings page was turned off, so nothing here can be changed or saved now.</p>
|
|
@@ -1153,7 +1172,7 @@
|
|
|
1153
1172
|
<dialog id="pr" aria-labelledby="pr-title">
|
|
1154
1173
|
<form>
|
|
1155
1174
|
<h2 id="pr-title">Order providers</h2>
|
|
1156
|
-
<p class="sub">Drag the providers into order, best first.
|
|
1175
|
+
<p class="sub">Drag the providers into order, best first. Models are then sorted by it.</p>
|
|
1157
1176
|
<ol id="pr-list"></ol>
|
|
1158
1177
|
<div class="actions"><button id="pr-cancel" type="button">Cancel</button><button class="primary" id="pr-save" type="button">Save</button></div>
|
|
1159
1178
|
</form>
|
|
@@ -1236,6 +1255,15 @@ const ICON = {
|
|
|
1236
1255
|
terminal: 'M4 17l6-5-6-5M12 19h8',
|
|
1237
1256
|
upload: 'M12 21V9M7 14l5-5 5 5M5 3h14',
|
|
1238
1257
|
arrow: 'M5 12h14M13 6l6 6-6 6',
|
|
1258
|
+
code: 'M16 18l6-6-6-6M8 6l-6 6 6 6',
|
|
1259
|
+
monitor: 'M3 4h18v12H3zM8 20h8M12 16v4',
|
|
1260
|
+
tag: 'M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0L2 12V2h10l8.6 8.6a2 2 0 0 1 0 2.8zM7 7h.01',
|
|
1261
|
+
pause: 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zM10 9v6M14 9v6',
|
|
1262
|
+
hourglass: 'M6 2h12M6 22h12M7 2c0 5 10 6 10 10S7 17 7 22M17 2c0 5-10 6-10 10s10 5 10 10',
|
|
1263
|
+
zap: 'M13 2L3 14h9l-1 8 10-12h-9z',
|
|
1264
|
+
mountain: 'M3 20L9.5 9l4 6.5 2.5-4 5 8.5z',
|
|
1265
|
+
image: 'M3 5h18v14H3zM8.5 11a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zM21 15l-5-5L5 19',
|
|
1266
|
+
bulb: 'M9 18h6M10 22h4M12 2a7 7 0 0 0-4 12.7V16h8v-1.3A7 7 0 0 0 12 2z',
|
|
1239
1267
|
}
|
|
1240
1268
|
const ic = (name, cls = '') => {
|
|
1241
1269
|
const el = document.createElement('span')
|
|
@@ -1257,7 +1285,7 @@ const BUTTON_ICONS = [
|
|
|
1257
1285
|
[/^test|^send a test/i, 'play', 'k-test'], [/^request|^show the raw/i, 'eye', 'k-info'], [/^edit|^set up/i, 'pencil', 'k-edit'],
|
|
1258
1286
|
[/^remove|^delete|^disconnect/i, 'trash', 'k-del'], [/^stop/i, 'stop', 'k-del'], [/^refresh|^retry|^get from models|^look it up|^reset/i, 'refresh', 'k-refresh'],
|
|
1259
1287
|
[/^provider ranking/i, 'bars', 'k-info'], [/^clear|^select none/i, 'x', 'k-info'], [/^invert/i, 'swap', 'k-info'], [/^connect|^sign in/i, 'link', 'k-test'],
|
|
1260
|
-
[/^
|
|
1288
|
+
[/^models \(/i, 'list', 'k-info'], [/^order providers/i, 'bars', 'k-info'], [/^update model info/i, 'refresh', 'k-refresh'], [/^collapse|^expand/i, 'list', 'k-info'], [/^turn off/i, 'x', 'k-del'],
|
|
1261
1289
|
]
|
|
1262
1290
|
// card titles: their icon and color
|
|
1263
1291
|
const TITLE_ICONS = [
|
|
@@ -1291,6 +1319,16 @@ new MutationObserver(() => {
|
|
|
1291
1319
|
queueMicrotask(() => ((decorating = false), decorate()))
|
|
1292
1320
|
}).observe(document.documentElement, { childList: true, subtree: true, characterData: true })
|
|
1293
1321
|
// the sidebar's parts and the pages' titles: their tiles
|
|
1322
|
+
// a phone (or a narrow window): said once that the page is made for a desktop; dismissed, not again in this browser
|
|
1323
|
+
addEventListener('DOMContentLoaded', () => {
|
|
1324
|
+
let seen = false
|
|
1325
|
+
try { seen = localStorage.getItem('heart-small-screen-ok') === '1' } catch {}
|
|
1326
|
+
if (seen || !matchMedia('(max-width: 860px)').matches) return
|
|
1327
|
+
const d = $('small-screen')
|
|
1328
|
+
$('small-screen-ok').onclick = () => d.close()
|
|
1329
|
+
d.addEventListener('close', () => { try { localStorage.setItem('heart-small-screen-ok', '1') } catch {} })
|
|
1330
|
+
d.showModal()
|
|
1331
|
+
})
|
|
1294
1332
|
addEventListener('DOMContentLoaded', () => {
|
|
1295
1333
|
for (const a of document.querySelectorAll('nav a[data-page]')) {
|
|
1296
1334
|
const [name, tone] = PART[a.dataset.page] ?? ['list', 'slate']
|
|
@@ -1383,11 +1421,11 @@ const DOING = {
|
|
|
1383
1421
|
'/api/provider/delete': 'Deleting the provider',
|
|
1384
1422
|
'/api/provider/list': 'Saving the model list setting',
|
|
1385
1423
|
'/api/provider/on': 'Switching the provider',
|
|
1386
|
-
'/api/order': 'Saving
|
|
1387
|
-
'/api/mcp/login': 'Signing in —
|
|
1424
|
+
'/api/order': 'Saving the models',
|
|
1425
|
+
'/api/mcp/login': 'Signing in — a browser window will open',
|
|
1388
1426
|
'/api/telegram/connect': 'Checking the token with Telegram',
|
|
1389
1427
|
'/api/telegram/test': 'Sending a test message',
|
|
1390
|
-
'/api/search/test': 'Trying a search on
|
|
1428
|
+
'/api/search/test': 'Trying a search on SearXNG',
|
|
1391
1429
|
'/api/rankings': null, // with models.dev, in its strip
|
|
1392
1430
|
'/api/models-dev': null, // its own strip
|
|
1393
1431
|
}
|
|
@@ -1463,7 +1501,7 @@ function showPage() {
|
|
|
1463
1501
|
addEventListener('hashchange', showPage)
|
|
1464
1502
|
// A sidebar item with several pages (data-tabs): a tab bar on top of each of them. Each page keeps
|
|
1465
1503
|
// its own address (#providers, #statusbar, #files…), so links to one still open it.
|
|
1466
|
-
const TAB_NAMES = { models: '
|
|
1504
|
+
const TAB_NAMES = { models: 'List', providers: 'Providers', general: 'Settings', statusbar: 'Status bar', logging: 'Logs', files: 'Files' }
|
|
1467
1505
|
const TAB_COUNTS = { providers: 'n-providers' } // a count shown on the tab, not the sidebar item
|
|
1468
1506
|
for (const a of document.querySelectorAll('nav a[data-tabs]')) {
|
|
1469
1507
|
const tabs = a.dataset.tabs.split(' ')
|
|
@@ -1606,7 +1644,7 @@ function openForm(p = null) {
|
|
|
1606
1644
|
$('p-form').querySelector('.sub').hidden = Boolean(p)
|
|
1607
1645
|
if (p) {
|
|
1608
1646
|
$('p-list-on').checked = p.list
|
|
1609
|
-
put($('p-added'), p.added.length ? [h('span', { className: 'muted', style: 'font-size:13px', textContent: `${p.added.length} model${p.added.length === 1 ? '' : 's'}
|
|
1647
|
+
put($('p-added'), p.added.length ? [h('span', { className: 'muted', style: 'font-size:13px', textContent: `${p.added.length} model${p.added.length === 1 ? '' : 's'} added by name` }), h('button', { className: 'small danger', textContent: 'Forget them', onclick: () => ($('p-form').close(), clearAdded(p)) })] : [])
|
|
1610
1648
|
}
|
|
1611
1649
|
drawPresets()
|
|
1612
1650
|
$('p-form').showModal()
|
|
@@ -1615,7 +1653,7 @@ function openForm(p = null) {
|
|
|
1615
1653
|
const closeForm = () => $('p-form').close()
|
|
1616
1654
|
$('p-delete').onclick = () => {
|
|
1617
1655
|
const p = editing
|
|
1618
|
-
if (!p || !confirm(`Delete the provider "${p.name}"? Its models leave
|
|
1656
|
+
if (!p || !confirm(`Delete the provider "${p.name}"? Its models leave the list too.`)) return
|
|
1619
1657
|
closeForm()
|
|
1620
1658
|
act('/api/provider/delete', { name: p.name }, `deleted ${p.name}`)
|
|
1621
1659
|
}
|
|
@@ -1702,7 +1740,7 @@ $('m-search').oninput = (e) => ((modelQuery = e.target.value), (searchOpen = tru
|
|
|
1702
1740
|
const kTok = (n) => (n >= 1e6 ? `${Number((n / 1e6).toFixed(2))}M` : n >= 1000 ? `${Math.round(n / 1000)}k` : String(n))
|
|
1703
1741
|
const usd = (x) => (x === 0 ? 'free' : `$${x < 0.01 ? x.toFixed(4) : x < 1 ? x.toFixed(3).replace(/0$/, '') : x.toFixed(2)}`)
|
|
1704
1742
|
// where what a model can do comes from (the Your models table)
|
|
1705
|
-
const FROM = { 'models.dev': 'from models.dev', you: 'set by
|
|
1743
|
+
const FROM = { 'models.dev': 'from models.dev', you: 'set by hand', tested: 'tested' }
|
|
1706
1744
|
// Test: one short message to the model, to see that it really answers (the key, access to it, its
|
|
1707
1745
|
// name, the server). The result stays under it until the page is reloaded.
|
|
1708
1746
|
const TRIES = {} // "provider/model" → { going } | { ok, ms, reply, at } | { ok: false, status, error, at } (from the server)
|
|
@@ -1712,8 +1750,8 @@ const MEANS = {
|
|
|
1712
1750
|
works: 'it answered',
|
|
1713
1751
|
400: '400: the provider refused the request as sent (often: a model that isn\'t a chat model)',
|
|
1714
1752
|
401: '401: the key isn\'t accepted',
|
|
1715
|
-
402: '402: it needs payment or credits on
|
|
1716
|
-
403: '403: no access to this model with
|
|
1753
|
+
402: '402: it needs payment or credits on the account',
|
|
1754
|
+
403: '403: no access to this model with this plan or key',
|
|
1717
1755
|
404: '404: the provider has no model by this name',
|
|
1718
1756
|
408: '408: the provider timed out',
|
|
1719
1757
|
410: '410: the model was taken down',
|
|
@@ -1735,7 +1773,7 @@ const outcome = (r) => (!r || r.going ? null : r.ok ? 'works' : r.status ? Strin
|
|
|
1735
1773
|
function triedCell(t) {
|
|
1736
1774
|
const r = TRIES[keyOf(t)]
|
|
1737
1775
|
const secs = (r?.ms != null ? ` · ${(r.ms / 1000).toFixed(1)}s` : '') + (r?.at ? ` · tested ${new Date(r.at).toLocaleString()}` : '')
|
|
1738
|
-
const [cls, text, about] = !r ? ['', 'not tested', 'send it a short message to see that it really answers (
|
|
1776
|
+
const [cls, text, about] = !r ? ['', 'not tested', 'send it a short message to see that it really answers (the key, access to it, its name)']
|
|
1739
1777
|
: r.going ? ['going', 'testing…', 'sending it a short message']
|
|
1740
1778
|
: r.ok && r.toolsOk === false ? ['ok', `✓ ${(r.ms / 1000).toFixed(1)}s · ✗ tools`, `it answers ("${r.reply}"), but it couldn't do a small job with a tool, so it's a poor choice for work: ${r.toolsWhy}${secs}`]
|
|
1741
1779
|
: r.ok ? ['ok', `✓ ${(r.ms / 1000).toFixed(1)}s`, `works: it answered "${r.reply}"${r.toolsOk ? ', and did a small job with a tool' : ''}${secs}`]
|
|
@@ -1836,7 +1874,7 @@ function showRun(run) {
|
|
|
1836
1874
|
// models.dev looked up again: one model (its Retry), or all of yours with their rankings (Update model info)
|
|
1837
1875
|
const retry = (t) => h('button', { className: 'small', textContent: 'Retry', title: 'look it up in models.dev again', onclick: (e) => (e.stopPropagation(), lookUp(t)) })
|
|
1838
1876
|
async function lookUp(t) {
|
|
1839
|
-
job('models.dev', { where: ['catalog', 'table'], what: t ? `Looking up ${t.model} in models.dev` : 'Updating
|
|
1877
|
+
job('models.dev', { where: ['catalog', 'table'], what: t ? `Looking up ${t.model} in models.dev` : 'Updating the models: models.dev and LMArena', detail: t ? 'context, tool calls, thinking, images' : 'context, tool calls, thinking, images, price; scores' })
|
|
1840
1878
|
if (!t) (lookingUp = true), mineSoon()
|
|
1841
1879
|
const [r, scored] = await Promise.all([act('/api/models-dev', t ? { provider: t.provider, model: t.model } : {}), t ? null : act('/api/rankings', {})])
|
|
1842
1880
|
if (!t) (lookingUp = false), mineSoon()
|
|
@@ -1854,8 +1892,8 @@ function openSetup(t) {
|
|
|
1854
1892
|
$('ms-title').textContent = t.model
|
|
1855
1893
|
$('ms-from').textContent = {
|
|
1856
1894
|
assumed: "models.dev doesn't know this model. Tell HeartCode what it can do; until then it assumes tool calls, streaming and a ~128k window.",
|
|
1857
|
-
'models.dev': 'From models.dev. Change anything that isn\'t right for how
|
|
1858
|
-
you: 'Set by
|
|
1895
|
+
'models.dev': 'From models.dev. Change anything that isn\'t right for how it\'s reached.',
|
|
1896
|
+
you: 'Set by hand.',
|
|
1859
1897
|
tested: 'From an earlier test. Change anything that isn\'t right.',
|
|
1860
1898
|
}[x.source] ?? ''
|
|
1861
1899
|
$('ms-context').value = x.set?.context ?? ''
|
|
@@ -1967,17 +2005,17 @@ function drawProviders(s) {
|
|
|
1967
2005
|
const none = !s.providers.length
|
|
1968
2006
|
// the steps: always on the page (nothing jumps when one is done), ticked off as you go
|
|
1969
2007
|
put($('steps'), [
|
|
1970
|
-
['Add a provider', 'the service with
|
|
2008
|
+
['Add a provider', 'the service with the models', s.providers.length ? 'done' : 'now'],
|
|
1971
2009
|
['Choose models', 'click one, or tick several and add them', order.length ? 'done' : s.providers.length ? 'now' : ''],
|
|
1972
|
-
['Start HeartCode', 'heart, in
|
|
2010
|
+
['Start HeartCode', 'heart, in a project folder', order.length ? 'now' : ''],
|
|
1973
2011
|
].map(([t, d, cls], i) => h('div', { className: 'step ' + cls }, h('span', { className: 'num', textContent: cls === 'done' ? '✓' : i + 1 }), h('div', {}, h('b', { textContent: t }), d))))
|
|
1974
2012
|
$('steps').hidden = order.length > 0 // the first start only
|
|
1975
2013
|
$('p-work').hidden = none
|
|
1976
2014
|
// your list, at the top: how many, and the way to its page (the order, what to do when one fails)
|
|
1977
2015
|
const shown = shownOrder()
|
|
1978
2016
|
$('p-mine').hidden = !shown.length
|
|
1979
|
-
$('p-mine').textContent = `
|
|
1980
|
-
$('p-mine').title = shown.length ? `HeartCode uses ${shown[0].provider} · ${shown[0].model}. Open
|
|
2017
|
+
$('p-mine').textContent = `Models (${shown.length}) →`
|
|
2018
|
+
$('p-mine').title = shown.length ? `HeartCode uses ${shown[0].provider} · ${shown[0].model}. Open Models: the order, and what happens when one fails` : ''
|
|
1981
2019
|
fillHeight()
|
|
1982
2020
|
|
|
1983
2021
|
// every provider's models, A to Z; one click adds it (the first one becomes #1). Built
|
|
@@ -2100,7 +2138,7 @@ function showRow(provider, id, said) {
|
|
|
2100
2138
|
// Off your list, the one in use too: the next one becomes #1, or none is left (asked first, then).
|
|
2101
2139
|
const removeMine = (provider, id) => {
|
|
2102
2140
|
const rest = S.order.filter((t) => t.provider !== provider || t.model !== id)
|
|
2103
|
-
if (!rest.length && !confirm(`Take off ${id}? It's
|
|
2141
|
+
if (!rest.length && !confirm(`Take off ${id}? It's the only model: HeartCode then has none to use until one is chosen.`)) return
|
|
2104
2142
|
return saveOrder(rest, !rest.length ? `${id} removed: no model chosen now` : placeOf(provider, id) === 0 ? `${id} removed: HeartCode now uses ${rest[0].provider} · ${rest[0].model}` : `${id} removed`)
|
|
2105
2143
|
}
|
|
2106
2144
|
const addModel = (provider, id) => {
|
|
@@ -2119,7 +2157,7 @@ const withOff = (shown) => {
|
|
|
2119
2157
|
return [...S.order.map((t) => (isOff(t.provider) ? t : rest.next().value)).filter(Boolean), ...rest]
|
|
2120
2158
|
}
|
|
2121
2159
|
function rowTail(provider, id) {
|
|
2122
|
-
if (placeOf(provider, id) >= 0 && isOff(provider)) return h('span', { className: 'tag', textContent: 'in
|
|
2160
|
+
if (placeOf(provider, id) >= 0 && isOff(provider)) return h('span', { className: 'tag', textContent: 'in the list · off', title: `${provider} is switched off: HeartCode skips its models (and Models doesn't show them) until it's on` })
|
|
2123
2161
|
const at = shownOrder().findIndex((t) => t.provider === provider && t.model === id) // its place among the ones HeartCode uses
|
|
2124
2162
|
const now = inUse()
|
|
2125
2163
|
return now?.provider === provider && now.model === id ? h('span', { className: 'tag brand', textContent: `#${at + 1} in use` }) : at >= 0 ? h('span', { className: 'tag brand', textContent: `#${at + 1} fallback` }) : h('span', { className: 'add', textContent: S.order.length ? '+ Add' : 'Use' })
|
|
@@ -2214,9 +2252,9 @@ $('hello-close').onclick = () => $('hello').close()
|
|
|
2214
2252
|
// every model added to a provider by name forgotten; the ones in your list leave it too
|
|
2215
2253
|
async function clearAdded(p) {
|
|
2216
2254
|
const inList = S.order.filter((t) => t.provider === p.name && p.added.includes(t.model))
|
|
2217
|
-
if (!confirm(`Forget the ${p.added.length} model${p.added.length === 1 ? '' : 's'}
|
|
2255
|
+
if (!confirm(`Forget the ${p.added.length} model${p.added.length === 1 ? '' : 's'} added to ${p.name} by name?${inList.length ? ` ${inList.length} of them ${inList.length === 1 ? 'is' : 'are'} in the list and will leave it.` : ''}`)) return
|
|
2218
2256
|
if (inList.length && !(await saveOrder(S.order.filter((t) => !inList.includes(t))))) return
|
|
2219
|
-
act('/api/provider/added', { name: p.name, all: true }, `${p.name}: the models
|
|
2257
|
+
act('/api/provider/added', { name: p.name, all: true }, `${p.name}: the models added by name are forgotten`)
|
|
2220
2258
|
}
|
|
2221
2259
|
const CAT_ROW = 40 // a model's row: its name, and what it can do beside it
|
|
2222
2260
|
// The models ticked (provider → Set of ids): kept while you search, so ones ticked for one search
|
|
@@ -2251,7 +2289,7 @@ function drawPicks() {
|
|
|
2251
2289
|
const take = () => {
|
|
2252
2290
|
const off = new Set(toTake.map(keyOf))
|
|
2253
2291
|
const rest = S.order.filter((t) => !off.has(keyOf(t)))
|
|
2254
|
-
if (!confirm(`Take ${toTake.length} model${toTake.length === 1 ? '' : 's'} off
|
|
2292
|
+
if (!confirm(`Take ${toTake.length} model${toTake.length === 1 ? '' : 's'} off the list?${!rest.length ? ' None is left then: HeartCode has no model to use until one is chosen.' : keyOf(rest[0]) !== keyOf(S.order[0]) ? ` HeartCode then uses ${rest[0].provider} · ${rest[0].model}.` : ''}`)) return
|
|
2255
2293
|
PICKED_CAT.clear()
|
|
2256
2294
|
saveOrder(rest, `${toTake.length} removed`)
|
|
2257
2295
|
}
|
|
@@ -2261,8 +2299,8 @@ function drawPicks() {
|
|
|
2261
2299
|
h('span', { className: 'n', textContent: `${all.length} selected` }),
|
|
2262
2300
|
h('button', { className: 'small ghost', textContent: 'Clear', onclick: () => (PICKED_CAT.clear(), drawPicks()) }),
|
|
2263
2301
|
h('button', { className: 'small', textContent: `Test ${all.length}`, title: 'send each ticked model "Hello" and see which answer', onclick: () => helloAll(all) }),
|
|
2264
|
-
toTake.length ? h('button', { className: 'small danger', textContent: `Remove ${toTake.length} from
|
|
2265
|
-
toAdd.length ? h('button', { className: 'small primary', textContent: `Add ${toAdd.length} to
|
|
2302
|
+
toTake.length ? h('button', { className: 'small danger', textContent: `Remove ${toTake.length} from the list`, onclick: take }) : null,
|
|
2303
|
+
toAdd.length ? h('button', { className: 'small primary', textContent: `Add ${toAdd.length} to the list`, onclick: () => (PICKED_CAT.clear(), saveOrder([...S.order, ...toAdd], `${toAdd.length} added: the list has ${S.order.length + toAdd.length} models`)) }) : null)
|
|
2266
2304
|
if (was !== $('picks').hidden) fillHeight() // the list gives it room
|
|
2267
2305
|
}
|
|
2268
2306
|
function buildCatalog(s) {
|
|
@@ -2280,7 +2318,7 @@ function buildCatalog(s) {
|
|
|
2280
2318
|
h('button', { className: 'mrow', 'data-provider': p.name, 'data-model': id, onclick: () => (placeOf(p.name, id) === undefined ? addModel(p.name, id) : removeMine(p.name, id)) },
|
|
2281
2319
|
h('span', { className: 'id', title: id }, id, canCell(m.details?.[id], S.order[placeOf(p.name, id)])),
|
|
2282
2320
|
isFree(m.details?.[id]) ? h('span', { className: 'tag ok', textContent: 'free', title: `${p.name}'s model list says $0` }) : null,
|
|
2283
|
-
own ? h('span', { className: 'tag', textContent: 'not in its list' }) : p.added.includes(id) ? h('span', { className: 'tag', textContent: 'added by
|
|
2321
|
+
own ? h('span', { className: 'tag', textContent: 'not in its list' }) : p.added.includes(id) ? h('span', { className: 'tag', textContent: 'added by name' }) : null,
|
|
2284
2322
|
rowTail(p.name, id))
|
|
2285
2323
|
// its tick box (to add or take off several at once), and one you added: ✕ forgets it (it leaves your list too)
|
|
2286
2324
|
const tick = (id) => h('input', { type: 'checkbox', className: 'pick', checked: pickedOf(p.name).has(id), 'data-model': id, 'aria-label': `select ${id}`, onchange: (e) => (e.target.checked ? pickedOf(p.name).add(id) : pickedOf(p.name).delete(id), drawPicks()) })
|
|
@@ -2288,7 +2326,7 @@ function buildCatalog(s) {
|
|
|
2288
2326
|
h('button', { className: 'small try', textContent: 'Test', title: `send ${id} "Hello" and see what was sent and what came back`, onclick: () => hello(p.name, id) }),
|
|
2289
2327
|
!p.added.includes(id) ? null :
|
|
2290
2328
|
h('button', { className: 'forget', textContent: '✕', title: 'forget this model', 'aria-label': `forget ${id}`, onclick: async () => {
|
|
2291
|
-
if (placeOf(p.name, id) !== undefined && !confirm(`Forget ${id}? It leaves
|
|
2329
|
+
if (placeOf(p.name, id) !== undefined && !confirm(`Forget ${id}? It leaves the list too.`)) return
|
|
2292
2330
|
if (placeOf(p.name, id) !== undefined) await saveOrder(S.order.filter((t) => t.provider !== p.name || t.model !== id), `${id} removed`)
|
|
2293
2331
|
act('/api/provider/added', { name: p.name, model: id, remove: true }, `forgot ${id}`)
|
|
2294
2332
|
} }))
|
|
@@ -2299,7 +2337,7 @@ function buildCatalog(s) {
|
|
|
2299
2337
|
const id = box.value.trim()
|
|
2300
2338
|
if (!id) return
|
|
2301
2339
|
const at = placeOf(p.name, id)
|
|
2302
|
-
if (at !== undefined) return showRow(p.name, id, `${id} is already in
|
|
2340
|
+
if (at !== undefined) return showRow(p.name, id, `${id} is already in the list (#${at + 1})`)
|
|
2303
2341
|
if (listed.has(id) || yours.includes(id)) return showRow(p.name, id, `${p.name} already has ${id}: click it to add it`)
|
|
2304
2342
|
box.value = ''
|
|
2305
2343
|
addModel(p.name, id)
|
|
@@ -2321,7 +2359,7 @@ function buildCatalog(s) {
|
|
|
2321
2359
|
h('span', { className: 'tag inlist' }),
|
|
2322
2360
|
h('span', { className: 'meta mono', textContent: p.baseUrl, title: `${p.baseUrl} · key ${p.key || 'none'}` })),
|
|
2323
2361
|
h('form', { className: 'by-name', onsubmit: addByName },
|
|
2324
|
-
h('input', { type: 'text', name: 'name', placeholder: 'model name', 'aria-label': `add a model to ${p.name} by its name`, title: `a model's exact name: added to
|
|
2362
|
+
h('input', { type: 'text', name: 'name', placeholder: 'model name', 'aria-label': `add a model to ${p.name} by its name`, title: `a model's exact name: added to the list, also one ${p.name} doesn't list` }),
|
|
2325
2363
|
h('button', { className: 'small', textContent: 'Add' })),
|
|
2326
2364
|
h('button', { className: 'small', textContent: 'Edit', title: 'its address and key, its model list, delete it', onclick: () => openForm(p) })),
|
|
2327
2365
|
// what's listed first; loading and errors under it (the models already shown stay where they are)
|
|
@@ -2337,7 +2375,7 @@ function buildCatalog(s) {
|
|
|
2337
2375
|
m.off && !ids.length ? h('div', { className: 'cat-note', textContent: "Its list is off: add a model by its name, in the box above." }) : null,
|
|
2338
2376
|
m.loading ? h('div', { className: 'cat-note', textContent: 'Loading its models…' }) : null)
|
|
2339
2377
|
}))
|
|
2340
|
-
if (freeOnly && !$('p-list').querySelector('section')) put($('p-list'), h('div', { className: 'cat-note', textContent: "
|
|
2378
|
+
if (freeOnly && !$('p-list').querySelector('section')) put($('p-list'), h('div', { className: 'cat-note', textContent: "No provider lists a model at $0. (A provider whose model list has no prices can't say what's free: Free only leaves those out.)" }))
|
|
2341
2379
|
}
|
|
2342
2380
|
// --- Your models page: the list as a table; sorted by several columns at once (each a tie-break
|
|
2343
2381
|
// for the ones before it), the sort kept in this browser ---
|
|
@@ -2349,7 +2387,7 @@ const can = (t) => ({ tools: t.tested ? t.tested.mode === 'tools' : t.known?.too
|
|
|
2349
2387
|
const COLS = {
|
|
2350
2388
|
model: { label: 'Model', first: 'up', get: (t) => t.model, words: ['A→Z', 'Z→A'] },
|
|
2351
2389
|
// a provider's priority: your ranking's first is the highest
|
|
2352
|
-
provider: { label: 'Provider', first: 'down', get: (t) => -(RANKED.get(t.provider) ?? 1e6), words: ['
|
|
2390
|
+
provider: { label: 'Provider', first: 'down', get: (t) => -(RANKED.get(t.provider) ?? 1e6), words: ['the ranking, reversed', 'the ranking'] },
|
|
2353
2391
|
context: { label: 'Context', first: 'down', get: (t) => t.tested?.context ?? t.known?.context ?? null, words: ['smallest first', 'biggest first'] },
|
|
2354
2392
|
abilities: { label: 'Abilities', first: 'down', get: (t) => Object.values(can(t)).filter(Boolean).length, words: ['fewest first', 'most first'] },
|
|
2355
2393
|
tools: { label: 'Tools', first: 'down', get: (t) => can(t).tools, words: ['without first', 'with first'] },
|
|
@@ -2477,7 +2515,7 @@ let filterBar = null
|
|
|
2477
2515
|
function filterBarOf(order, counts = {}) {
|
|
2478
2516
|
if (!filterBar) {
|
|
2479
2517
|
let typing = 0
|
|
2480
|
-
const toggle = (key, label, about) => h('label', { className: 'f-tog', title: about }, h('input', { type: 'checkbox', 'data-f': key, onchange: (e) => setFilter({ [key]: e.target.checked }) }), label)
|
|
2518
|
+
const toggle = (key, label, about, icon) => h('label', { className: 'f-tog', title: `${label}: ${about}` }, h('input', { type: 'checkbox', 'data-f': key, 'aria-label': label, onchange: (e) => setFilter({ [key]: e.target.checked }) }), ic(icon), h('span', { className: 'lt', textContent: label }))
|
|
2481
2519
|
filterBar = h('div', { className: 'mt-filters' },
|
|
2482
2520
|
h('label', { className: 'f-search' },
|
|
2483
2521
|
h('span', { className: 'f-icon', 'aria-hidden': 'true', textContent: '⌕' }),
|
|
@@ -2487,11 +2525,11 @@ function filterBarOf(order, counts = {}) {
|
|
|
2487
2525
|
h('select', { className: 'f-context', 'aria-label': 'Filter by context window', onchange: (e) => setFilter({ context: Number(e.target.value) }) },
|
|
2488
2526
|
CONTEXTS.map(([v, l]) => h('option', { value: v, textContent: v ? `Context ${l}` : l }))),
|
|
2489
2527
|
h('span', { className: 'f-togs' },
|
|
2490
|
-
toggle('tools', 'Tools', 'only models that call tools'),
|
|
2491
|
-
toggle('thinking', 'Thinking', 'only models that think'),
|
|
2492
|
-
toggle('images', 'Images', 'only models that see images'),
|
|
2493
|
-
toggle('free', 'Free', 'only models that cost nothing, in and out'),
|
|
2494
|
-
toggle('helpers', 'Helpers', 'only
|
|
2528
|
+
toggle('tools', 'Tools', 'only models that call tools', 'wrench'),
|
|
2529
|
+
toggle('thinking', 'Thinking', 'only models that think', 'bulb'),
|
|
2530
|
+
toggle('images', 'Images', 'only models that see images', 'image'),
|
|
2531
|
+
toggle('free', 'Free', 'only models that cost nothing, in and out', 'tag'),
|
|
2532
|
+
toggle('helpers', 'Helpers', 'only the helpers (the models #1 can start for side jobs), and the ones suggested', 'sparkles')))
|
|
2495
2533
|
}
|
|
2496
2534
|
const bar = filterBar
|
|
2497
2535
|
const focused = (el) => document.activeElement === el
|
|
@@ -2551,38 +2589,45 @@ function drawMine(s) {
|
|
|
2551
2589
|
// Save list: the models HeartCode uses become the ones shown, in the order shown. Filtered: only
|
|
2552
2590
|
// those (asked first; the others stay under Providers, to add back any time)
|
|
2553
2591
|
const saveList = () => {
|
|
2554
|
-
if (filtered && !confirm(`HeartCode will use only these ${n(view.length)}, in this order.\n\nThe other ${n(order.length - view.length)} stay under Providers: add any back
|
|
2592
|
+
if (filtered && !confirm(`HeartCode will use only these ${n(view.length)}, in this order.\n\nThe other ${n(order.length - view.length)} stay under Providers: add any back at any time.`)) return
|
|
2555
2593
|
return keep(view)
|
|
2556
2594
|
}
|
|
2557
2595
|
const removePicked = () => {
|
|
2558
2596
|
const rest = order.filter((t) => !PICKED.has(keyOf(t)))
|
|
2559
2597
|
const k = order.length - rest.length
|
|
2560
|
-
if (!confirm(`Take ${k} model${k === 1 ? '' : 's'} off
|
|
2598
|
+
if (!confirm(`Take ${k} model${k === 1 ? '' : 's'} off the list?${!rest.length ? ' None is left then: HeartCode has no model to use until one is chosen.' : rest[0] !== order[0] ? ` HeartCode then uses ${rest[0].provider} · ${rest[0].model}.` : ''} (They stay under their providers.)`)) return
|
|
2561
2599
|
PICKED.clear()
|
|
2562
2600
|
saveOrder(withOff(rest), `${k} removed${rest.length ? '' : ': no model chosen now'}`)
|
|
2563
2601
|
}
|
|
2564
2602
|
const pickedList = order.filter((t) => PICKED.has(keyOf(t)))
|
|
2565
2603
|
|
|
2566
2604
|
// --- the page's header: how a model is picked (left), what's known about the models (right) ---
|
|
2567
|
-
$('mt-lead').textContent = 'The models HeartCode uses, in
|
|
2605
|
+
$('mt-lead').textContent = 'The models HeartCode uses, in order: #1 answers, the next one when it fails.'
|
|
2568
2606
|
const busy = locked()
|
|
2569
2607
|
$('mt-actions').inert = busy
|
|
2570
2608
|
// the order helpers are picked in when #1 starts them: your list's, or your provider ranking's
|
|
2571
2609
|
const helperOrder = (by) => api('/api/helper-order', { by, rank: RANK }).then((r) => ((S.helperOrder = r.helperOrder), drawMine(S)), (e) => toast(e.message, true))
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2610
|
+
// who chooses the helpers: HeartCode (from the tests and the rankings, again when those change) or you
|
|
2611
|
+
const chooser = h('label', { className: 'h-order', title: 'Automatic: HeartCode chooses the helpers and what each is for, from the models that answered their test and the rankings, and again whenever those change. Manual: switched on and given their jobs by hand in the Helper column.' },
|
|
2612
|
+
h('span', { className: 'mt-setl' }, ic('sparkles'), h('span', { className: 'lt', textContent: 'Helpers' })),
|
|
2613
|
+
h('select', { id: 'h-auto', onchange: (e) => setAuto(e.target.value === 'auto', e.target) },
|
|
2614
|
+
[['auto', 'Automatic'], ['manual', 'Manual']].map(([v, t]) => h('option', { value: v, textContent: t, selected: (S.helpersAuto ? 'auto' : 'manual') === v }))))
|
|
2615
|
+
const orderBy = h('span', { className: 'h-order', title: 'Used: the order #1 takes helpers in' }, h('span', { className: 'mt-setl' }, ic('bars'), h('span', { className: 'lt', textContent: 'Used' })),
|
|
2616
|
+
h('div', { className: 'seg', role: 'radiogroup', 'aria-label': 'The order helpers are used in' },
|
|
2617
|
+
[['own', 'in list order', 'when #1 starts a helper, it takes the first one that fits the job, in the list\'s order'], ['provider', 'by provider', 'when #1 starts a helper, it takes them by the provider ranking (Order providers), each provider\'s in the list\'s order. The list itself stays as it is'], ['score', 'by score', 'when #1 starts a helper, it takes the best ranked first: its best place in LMArena\'s public rankings for coding, web apps, long real tasks and hard prompts (Update model info). Models not ranked come after, in the list\'s order']].map(([v, t, about]) =>
|
|
2575
2618
|
h('label', { className: (S.helperOrder ?? 'own') === v ? 'on' : '', title: about },
|
|
2576
|
-
h('input', { type: 'radio', name: 'helper-order', checked: (S.helperOrder ?? 'own') === v, onchange: () => helperOrder(v) }), t))))
|
|
2619
|
+
h('input', { type: 'radio', name: 'helper-order', checked: (S.helperOrder ?? 'own') === v, disabled: v === 'provider' && !order.some((t) => t.provider !== order[0]?.provider), onchange: () => helperOrder(v) }), t))))
|
|
2577
2620
|
put($('mt-actions'),
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
h('button', { className: 'small', textContent:
|
|
2621
|
+
((why) => h('span', { title: why ?? '' }, h('button', { className: 'small', textContent: 'Order providers', disabled: Boolean(why), title: why ? '' : 'drag the providers into order; the Provider column sorts by it', onclick: openRanking })))( // disabled: why, on a span (a disabled button shows no tooltip in every browser)
|
|
2622
|
+
!order.some((t) => t.provider !== order[0]?.provider) ? 'All the models are from one provider: nothing to order' : null),
|
|
2623
|
+
h('button', { className: 'small', textContent: 'Update model info', disabled: !order.length, title: `what each model can do (context, tools, thinking, images, price) from models.dev, and its places in LMArena's public rankings (coding, web apps, vision${S.rankings ? `; rankings from ${new Date(S.rankings.fetched).toLocaleDateString()}` : ''})`, onclick: () => lookUp() }),
|
|
2624
|
+
h('button', { className: 'small', textContent: filtered ? `Test ${n(shown.length)}` : 'Test all', disabled: testingAll || !shown.length, title: `send ${filtered ? 'the models shown' : 'each model'} a short message to see which really answer, and how fast`, onclick: () => tryAll(filtered ? shown : order) }),
|
|
2625
|
+
// not on the helpers' view: they're not a list to keep only
|
|
2626
|
+
filtered && FILTER.helpers ? null : h('button', { className: 'small primary', textContent: filtered ? `Use only these ${n(view.length)}` : 'Save list', disabled: !view.length || order.length < 2, title: filtered ? `HeartCode uses only these ${n(view.length)}, in the order shown (the others stay under Providers)` : 'save the list as shown: HeartCode uses them in this order (#1 first)', onclick: saveList }))
|
|
2582
2627
|
|
|
2583
|
-
// --- the list's settings:
|
|
2628
|
+
// --- row 2, the list's settings: when a model fails (left), the helpers (right); an icon and a short label each ---
|
|
2584
2629
|
const ro = s.rotation
|
|
2585
|
-
const cell = (label, about, ...control) => h('label', { className: 'mt-set', title: about }, h('span', { className: 'mt-setl', textContent: label }), h('span', { className: 'mt-setc' }, ...control))
|
|
2630
|
+
const cell = (icon, label, about, ...control) => h('label', { className: 'mt-set', title: `${label}: ${about}` }, h('span', { className: 'mt-setl' }, ic(icon), h('span', { className: 'lt', textContent: label })), h('span', { className: 'mt-setc' }, ...control))
|
|
2586
2631
|
// a whole number setting (seconds), with its limits from the server (SPEED_LIMITS)
|
|
2587
2632
|
const LIMITS = { replyStart: [5, 600], replyIdle: [10, 1800] }
|
|
2588
2633
|
const num = (name, label, said) => h('input', { type: 'number', className: 'tries', 'aria-label': label, min: LIMITS[name][0], max: LIMITS[name][1], value: S.settings[name], onchange: (e) => {
|
|
@@ -2591,43 +2636,40 @@ function drawMine(s) {
|
|
|
2591
2636
|
if (!(v >= lo && v <= hi)) return (e.target.value = S.settings[name]), toast(`a whole number, ${lo} to ${hi}`, true)
|
|
2592
2637
|
act('/api/setting', { name, value: v }, said(v))
|
|
2593
2638
|
} })
|
|
2594
|
-
const secsCell = (label, name, about, unit, said) => cell(label, about, num(name, label, said), h('span', { className: 'unit', textContent: unit }))
|
|
2639
|
+
const secsCell = (icon, label, name, about, unit, said) => cell(icon, label, about, num(name, label, said), h('span', { className: 'unit', textContent: unit }))
|
|
2595
2640
|
const settings = h('div', { className: 'mt-sets', inert: busy },
|
|
2596
2641
|
h('div', { className: 'mt-mode-sets' },
|
|
2597
|
-
cell('If one fails', ro.on === 'retries' ? 'a rate limit or outage: that model
|
|
2642
|
+
cell('swap', 'If one fails', ro.on === 'retries' ? 'a rate limit or outage: that model gets that many tries in all before the next one; any other error moves on at once' : "any error moves on at once, to the next model (after an error from its provider: another provider's first)",
|
|
2598
2643
|
h('select', { onchange: (e) => saveOrder(S.order, 'saved', { on: e.target.value }) },
|
|
2599
2644
|
[['failure', 'go to the next'], ['retries', 'retry it first']].map(([v, t]) => h('option', { value: v, textContent: t, selected: ro.on === v }))),
|
|
2600
2645
|
ro.on === 'retries' ? h('input', { type: 'number', className: 'tries', 'aria-label': 'tries', title: 'tries of the same model first (rate limits, outages)', min: 1, max: 20, value: ro.retries, onchange: (e) => saveOrder(S.order, 'saved', { retries: Number(e.target.value) }) }) : null),
|
|
2601
|
-
secsCell('Give up
|
|
2602
|
-
secsCell('
|
|
2603
|
-
cell('Tests wait', 'how long a test waits for each answer',
|
|
2646
|
+
secsCell('clock', 'Give up', 'replyStart', "a model that hasn't started answering (text, thinking or a tool call) in this many seconds counts as failed (a streamed reply: a model set up without streaming waits for its whole reply)", 's', (v) => `a model that hasn't started answering in ${v}s counts as failed`),
|
|
2647
|
+
secsCell('pause', 'Stalled', 'replyIdle', 'a reply that stops sending anything for this many seconds is stalled: tried again, or the next model', 's', (v) => `a reply silent for ${v}s counts as stalled`),
|
|
2648
|
+
cell('hourglass', 'Tests wait', 'how long a test waits for each answer',
|
|
2604
2649
|
h('input', { type: 'number', className: 'tries', min: 1, max: 600, step: 1, value: S.settings.testTimeout ?? 10, 'aria-label': 'Test timeout in seconds', onchange: (e) => {
|
|
2605
2650
|
const v = Math.round(Number(e.target.value))
|
|
2606
2651
|
if (!(v >= 1 && v <= 600)) return (e.target.value = S.settings.testTimeout ?? 10), toast('a whole number of seconds, 1 to 600', true)
|
|
2607
2652
|
act('/api/setting', { name: 'testTimeout', value: v }, `tests wait ${v} second${v === 1 ? '' : 's'} for an answer`)
|
|
2608
|
-
} }), h('span', { className: 'unit', textContent: '
|
|
2609
|
-
cell('New message
|
|
2653
|
+
} }), h('span', { className: 'unit', textContent: 's' })),
|
|
2654
|
+
cell('send', 'New message', 'the model a new message goes to first: #1, or the last one that worked',
|
|
2610
2655
|
h('select', { onchange: (e) => saveOrder(S.order, 'saved', { next: e.target.value }) },
|
|
2611
|
-
[['first', '#1'], ['stay', '
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
[['auto', 'picked for you'], ['manual', 'you pick']].map(([v, t]) => h('option', { value: v, textContent: t, selected: (S.helpersAuto ? 'auto' : 'manual') === v }))))))
|
|
2656
|
+
[['first', '#1'], ['stay', 'last working']].map(([v, t]) => h('option', { value: v, textContent: t, selected: ro.next === v })))),
|
|
2657
|
+
h('span', { className: 'mt-div', 'aria-hidden': 'true' }),
|
|
2658
|
+
chooser, orderBy))
|
|
2615
2659
|
|
|
2616
2660
|
// --- beside the filters: what's shown · what you do with it (the sorts show in the column heads) ---
|
|
2617
2661
|
const line = h('div', { className: 'mt-line' },
|
|
2618
|
-
h('span', { className: 'count', title: SORT.length ? `sorted by ${SORT.map(({ key, dir }) => `${COLS[key].label} ${COLS[key].words[dir === 'up' ? 0 : 1]}`).join(', then ')}; ties keep
|
|
2619
|
-
filtering() || SORT.length ? h('button', { className: 'small ghost', textContent: 'Clear', title: 'every filter and the sort off:
|
|
2620
|
-
order.length > 1 ? drawHelperBar() : null
|
|
2621
|
-
h('button', { className: 'small', textContent: filtered ? `Test ${n(shown.length)}` : 'Test all', disabled: testingAll || !shown.length, title: `send ${filtered ? 'the models shown' : 'each model'} a short message to see which really answer, and how fast`, onclick: () => tryAll(filtered ? shown : order) }),
|
|
2622
|
-
// not on the helpers' view: they're not a list to keep only
|
|
2623
|
-
filtered && FILTER.helpers ? null : h('button', { className: 'small primary', textContent: filtered ? `Use only these ${n(view.length)}` : 'Save list', disabled: !view.length || order.length < 2, title: filtered ? `HeartCode uses only these ${n(view.length)}, in the order shown (the others stay under Providers)` : S.settings.modelChoice === 'fit' ? 'keep the order shown: the orchestrator sees the others in this order, and a failed model goes to the next' : 'save your list as shown: HeartCode uses them in this order (#1 first)', onclick: saveList }))
|
|
2662
|
+
h('span', { className: 'count', title: SORT.length ? `sorted by ${SORT.map(({ key, dir }) => `${COLS[key].label} ${COLS[key].words[dir === 'up' ? 0 : 1]}`).join(', then ')}; ties keep the list order` : '' }, filtered ? [h('b', { textContent: n(shown.length) }), ` of ${n(order.length)}`] : [h('b', { textContent: n(order.length) }), ` model${order.length === 1 ? '' : 's'}`]),
|
|
2663
|
+
filtering() || SORT.length ? h('button', { className: 'small ghost', textContent: 'Clear', title: 'every filter and the sort off: the whole list, in order', onclick: clearView }) : null,
|
|
2664
|
+
order.length > 1 ? drawHelperBar() : null)
|
|
2624
2665
|
|
|
2625
2666
|
// --- the table ---
|
|
2626
2667
|
const all = view.length > 0 && view.every((t) => PICKED.has(keyOf(t)))
|
|
2627
|
-
|
|
2668
|
+
// icon: a narrow column named by an icon (its name in the tooltip)
|
|
2669
|
+
const head = (key, align, icon) => {
|
|
2628
2670
|
const at = SORT.findIndex((x) => x.key === key)
|
|
2629
|
-
return h('button', { type: 'button', className: (at >= 0 ? 'on ' : '') + (align || ''), title: `sort by ${COLS[key].label.toLowerCase()} (after the ones already sorted by) · click again: reversed · again: off`, onclick: (e) => clickSort(key, e.currentTarget) },
|
|
2630
|
-
COLS[key].label, at >= 0 ? h('span', { className: 'dir', textContent: ` ${SORT[at].dir === 'up' ? '↑' : '↓'}${SORT.length > 1 ? at + 1 : ''}` }) : '')
|
|
2671
|
+
return h('button', { type: 'button', className: (at >= 0 ? 'on ' : '') + (align || ''), 'aria-label': COLS[key].label, title: `${icon ? `${COLS[key].label}: ` : ''}sort by ${COLS[key].label.toLowerCase()} (after the ones already sorted by) · click again: reversed · again: off`, onclick: (e) => clickSort(key, e.currentTarget) },
|
|
2672
|
+
icon ? ic(icon) : COLS[key].label, at >= 0 ? h('span', { className: 'dir', textContent: ` ${SORT[at].dir === 'up' ? '↑' : '↓'}${SORT.length > 1 ? at + 1 : ''}` }) : '')
|
|
2631
2673
|
}
|
|
2632
2674
|
const selectAll = h('input', { type: 'checkbox', checked: all, indeterminate: PICKED.size > 0 && !all, title: all ? 'select none' : 'select all shown', 'aria-label': 'select all shown', onchange: () => (all ? PICKED.clear() : view.forEach((t) => PICKED.add(keyOf(t))), (lastPicked = null), drawMine(S)) })
|
|
2633
2675
|
// the columns' names; with models selected, what to do with them instead (the checkbox stays)
|
|
@@ -2640,7 +2682,7 @@ function drawMine(s) {
|
|
|
2640
2682
|
h('button', { className: 'small ghost', textContent: 'Invert', title: "select the ones shown that aren't selected, unselect the ones that are", onclick: () => (view.forEach((t) => (PICKED.has(keyOf(t)) ? PICKED.delete(keyOf(t)) : PICKED.add(keyOf(t)))), (lastPicked = null), drawMine(S)) }),
|
|
2641
2683
|
h('button', { className: 'small ghost', textContent: 'Select none', onclick: () => (PICKED.clear(), drawMine(S)) })))
|
|
2642
2684
|
: h('div', { className: 'mt mt-h' }, h('span'), selectAll,
|
|
2643
|
-
h('span', { textContent: '#', title: 'its place in
|
|
2685
|
+
h('span', { textContent: '#', title: 'its place in the list' }), head('model'), head('provider'), h('span', { textContent: 'Helper', title: '#1 can hand a part of a task to a helper. Switch a model on, and pick what it\'s good at: UI & visuals, Code & logic, Big & hard, Quick & cheap (hover an icon to see what it covers): #1 is told, and picks by it. None switched on: helpers run on the model that answers.' }), head('context', 'num'), head('tools', 'mid', 'wrench'), head('thinking', 'mid', 'bulb'), head('images', 'mid', 'image'), head('coding', 'num', 'code'), head('web', 'num', 'globe'), head('vision', 'num', 'eye'), head('price', 'num'), head('works'), h('span', { className: 'num', textContent: '' }))
|
|
2644
2686
|
const table = view.length ? h('ol', { className: 'mtable' + (view.length < 2 || busy ? '' : ' drag') }) : null
|
|
2645
2687
|
// ticked or not; with Shift, every row from the last one ticked to this one
|
|
2646
2688
|
const pick = (i, e) => {
|
|
@@ -2683,7 +2725,7 @@ function drawMine(s) {
|
|
|
2683
2725
|
h('button', { type: 'button', className: 'mt-more-l', 'aria-label': 'scroll the table left', title: 'more columns to the left', onclick: (e) => slide(e.currentTarget, -1) }, '‹'),
|
|
2684
2726
|
h('span', { textContent: 'More columns' }),
|
|
2685
2727
|
h('button', { type: 'button', className: 'mt-more-r', 'aria-label': 'scroll the table right', title: 'more columns to the right (or Shift + scroll, or swipe)', onclick: (e) => slide(e.currentTarget, 1) }, '›'))))
|
|
2686
|
-
: empty('No models in
|
|
2728
|
+
: empty('No models in the list yet. ', h('a', { href: '#providers', textContent: 'Choose some under Providers' }), '.'))
|
|
2687
2729
|
if (typing && document.activeElement !== typing) {
|
|
2688
2730
|
typing.focus({ preventScroll: true })
|
|
2689
2731
|
if (caret !== null && typing.setSelectionRange) typing.setSelectionRange(caret, caret)
|
|
@@ -2712,15 +2754,15 @@ const yes = (v) => h('span', { className: (v ? 'yes' : 'no') + ' mid', textConte
|
|
|
2712
2754
|
const RANK_OF = { coding: 'coding', web: 'web apps (WebDev)', vision: 'vision' }
|
|
2713
2755
|
const rankCell = (t, k) => {
|
|
2714
2756
|
const r = t.ranks?.[k]
|
|
2715
|
-
if (!r) return h('span', { className: 'num rk', textContent: '–', title: S.rankings ?
|
|
2716
|
-
return h('span', { className: 'num rk' + (r.rank / r.of <= 0.1 ? ' top' : ''), title: `${r.score != null ? `score ${r.score}${r.votes ? ` from ${r.votes.toLocaleString()} votes` : ''}, ` : ''}#${r.rank} of ${r.of} models in LMArena's ${RANK_OF[k]} ranking (as "${r.as}")${r.score == null ? '. Update model info for the scores' : ''}` },
|
|
2717
|
-
|
|
2757
|
+
if (!r) return h('span', { className: 'num rk', textContent: '–', title: S.rankings ? `${COLS[k].label}: not in LMArena's ${RANK_OF[k]} ranking` : 'no scores yet: Update model info, at the top' })
|
|
2758
|
+
return h('span', { className: 'num rk' + (r.rank / r.of <= 0.1 ? ' top' : ''), title: `${COLS[k].label}: ${r.score != null ? `score ${r.score}${r.votes ? ` from ${r.votes.toLocaleString()} votes` : ''}, ` : ''}#${r.rank} of ${r.of} models in LMArena's ${RANK_OF[k]} ranking (as "${r.as}")${r.score == null ? '. Update model info for the scores' : ''}` },
|
|
2759
|
+
`#${r.rank}`)
|
|
2718
2760
|
}
|
|
2719
2761
|
const src = (t) => {
|
|
2720
2762
|
const x = t.tested
|
|
2721
2763
|
if (!x) return h('div', { className: 'src', textContent: 'looking it up…' })
|
|
2722
2764
|
if (x.source === 'assumed') return h('div', { className: 'src warn', title: "models.dev doesn't know it: Retry, or set up what it can do" }, 'not found', retry(t), h('button', { className: 'small', textContent: 'Set up', onclick: () => openSetup(t) }))
|
|
2723
|
-
return h('div', { className: 'src' }, Object.keys(x.set ?? {}).length ? 'set by
|
|
2765
|
+
return h('div', { className: 'src' }, Object.keys(x.set ?? {}).length ? 'set by hand' : x.source === 'models.dev' ? 'models.dev' : FROM[x.source], h('button', { className: 'small', textContent: 'Edit', onclick: () => openSetup(t) }))
|
|
2724
2766
|
}
|
|
2725
2767
|
// a row of the table: one model of your list, in the order shown (at: its place in your order)
|
|
2726
2768
|
const money = (x) => (x == null ? '–' : x === 0 ? '$0' : usd(x))
|
|
@@ -2777,25 +2819,27 @@ function helperCell(t, at) {
|
|
|
2777
2819
|
const sug = HSUG?.[k] ?? []
|
|
2778
2820
|
const busy = locked()
|
|
2779
2821
|
return h('span', { className: 'hp' + (jobs ? '' : ' off') },
|
|
2780
|
-
h('span', { className: SAVING.has(`${k}|on`) ? 'saving' : '', title: jobs ? 'a helper: #1 can start it for side jobs (click: not a helper)' : 'not a helper (click: #1 can start it for side jobs)' },
|
|
2822
|
+
h('span', { className: SAVING.has(`${k}|on`) ? 'saving' : '', title: jobs ? 'a helper: #1 can start it for side jobs (click: not a helper)' : Object.keys(helpers()).length ? 'not a helper (click: #1 can start it for side jobs)' : 'no helpers ticked: #1 can start any model in the list (click: only ticked ones)' },
|
|
2781
2823
|
sw({ checked: Boolean(jobs), disabled: busy, 'aria-label': `${t.model} is a helper`, onchange: (e) => setHelper(k, e.target.checked ? (jobs ?? []) : null, 'on') })),
|
|
2782
2824
|
Object.entries(S.jobs ?? {}).map(([j, [label, , covers]]) => {
|
|
2783
2825
|
const has = Boolean(jobs?.includes(j))
|
|
2784
2826
|
const sugd = !has && sug.includes(j)
|
|
2785
|
-
const pill = h('button', { type: 'button', className: 'jp' + (has ? ' on' : sugd ? ' sug' : '') + (SAVING.has(`${k}|${j}`) ? ' saving' : ''), disabled: busy, 'aria-pressed': String(has), 'aria-label': `${label}: ${covers}`, onclick: () => setHelper(k, has ? jobs.filter((x) => x !== j) : [...(jobs ?? []), j], j) },
|
|
2827
|
+
const pill = h('button', { type: 'button', className: 'jp' + (has ? ' on' : sugd ? ' sug' : '') + (SAVING.has(`${k}|${j}`) ? ' saving' : ''), disabled: busy, 'aria-pressed': String(has), 'aria-label': `${label}: ${covers}`, onclick: () => setHelper(k, has ? jobs.filter((x) => x !== j) : [...(jobs ?? []), j], j) }, ic(JOB_ICON[j]))
|
|
2786
2828
|
// what the pill means, and what a click does here
|
|
2787
2829
|
return withTip(pill, () => [
|
|
2788
|
-
at === 0 ? h('div', { className: 'tcover', textContent: '#1 answers
|
|
2789
|
-
h('div', { className: 'tjob', textContent: label }),
|
|
2830
|
+
at === 0 ? h('div', { className: 'tcover', textContent: '#1 answers; as a helper it\'s started when another model is answering.' }) : null,
|
|
2831
|
+
h('div', { className: 'tjob', textContent: `${label}${has ? ' · picked' : sugd ? ' · suggested' : ''}` }),
|
|
2790
2832
|
h('div', { className: 'tcover', textContent: covers }),
|
|
2791
2833
|
sugd ? h('div', { className: 'tcover', textContent: `Suggested from ${SUGGEST_WHY[j]}.` }) : null,
|
|
2792
|
-
S.helpersAuto && has ? h('div', { className: 'tcover', textContent: '
|
|
2793
|
-
h('div', { className: 'thint', textContent: (has ? `Click: ${t.model} isn't picked for this any more` : `Click: #1 gives these jobs to ${t.model}${jobs ? '' : ' (it becomes a helper)'}`) + (S.helpersAuto ? ' · from then on
|
|
2834
|
+
S.helpersAuto && has ? h('div', { className: 'tcover', textContent: 'Chosen automatically, from the rankings and the tests.' }) : null,
|
|
2835
|
+
h('div', { className: 'thint', textContent: (has ? `Click: ${t.model} isn't picked for this any more` : `Click: #1 gives these jobs to ${t.model}${jobs ? '' : ' (it becomes a helper)'}`) + (S.helpersAuto ? ' · from then on: Manual' : '') }),
|
|
2794
2836
|
])
|
|
2795
2837
|
}))
|
|
2796
2838
|
}
|
|
2839
|
+
// each job's icon (its name and what it covers: the tooltip)
|
|
2840
|
+
const JOB_ICON = { ui: 'monitor', code: 'code', hard: 'mountain', quick: 'zap' }
|
|
2797
2841
|
// what each pill's suggestions go by (said in its tooltip)
|
|
2798
|
-
const SUGGEST_WHY = { ui: 'its place in the top half of the web-app ranking (LMArena)', code: 'its place in the top half of the coding ranking (LMArena)', hard: 'it thinks with a context of 128k or more, or its place in the top half of the ranking for long real tasks or the hardest prompts (LMArena)', quick: 'its test:
|
|
2842
|
+
const SUGGEST_WHY = { ui: 'its place in the top half of the web-app ranking (LMArena)', code: 'its place in the top half of the coding ranking (LMArena)', hard: 'it thinks with a context of 128k or more, or its place in the top half of the ranking for long real tasks or the hardest prompts (LMArena)', quick: 'its test: as fast as the middle one or faster (or nothing else fits it)' }
|
|
2799
2843
|
// Helpers are picked from the models that answered their test: how many did
|
|
2800
2844
|
const working = () => S.order.filter((t) => TRIES[keyOf(t)]?.ok && !TRIES[keyOf(t)].going).length
|
|
2801
2845
|
// No test yet: ask before testing them all (each gets a short message, which a paid model charges for);
|
|
@@ -2805,7 +2849,7 @@ function testFirst(then) {
|
|
|
2805
2849
|
const n = (x) => x.toLocaleString()
|
|
2806
2850
|
const paid = S.order.filter((t) => t.price && (t.price.input > 0 || t.price.output > 0)).length
|
|
2807
2851
|
const unknown = S.order.filter((t) => !t.price).length
|
|
2808
|
-
$('h-test-cost').textContent = `Test all sends each of
|
|
2852
|
+
$('h-test-cost').textContent = `Test all sends each of the ${n(S.order.length)} models a short message. ${paid ? `${n(paid)} of them aren't free: each charges for its few tokens. ` : ''}${unknown ? `${n(unknown)} have no price we know of, and may charge too. ` : ''}When it's done, helpers are ${then === 'suggest' ? 'suggested' : 'picked'} from the ones that worked.`
|
|
2809
2853
|
$('h-test-go').onclick = () => {
|
|
2810
2854
|
$('h-test').close()
|
|
2811
2855
|
afterTests = then
|
|
@@ -2838,7 +2882,7 @@ async function suggestNow(b) {
|
|
|
2838
2882
|
if (b) b.disabled = false
|
|
2839
2883
|
if (!r) return
|
|
2840
2884
|
HSUG = Object.keys(r.suggest).length ? r.suggest : null
|
|
2841
|
-
if (!HSUG) return toast(working() ? 'Nothing more to suggest' : '
|
|
2885
|
+
if (!HSUG) return toast(working() ? 'Nothing more to suggest' : 'No model worked in the test: nothing to pick from', !working())
|
|
2842
2886
|
setFilter({ helpers: true }) // your helpers and the suggested ones, together: not lost among the rest
|
|
2843
2887
|
}
|
|
2844
2888
|
// The toolbar's helpers part: suggestions waiting (take all · dismiss), or Suggest helpers and Clear
|
|
@@ -2847,7 +2891,7 @@ function drawHelperBar() {
|
|
|
2847
2891
|
helperBar ??= h('span', { className: 'hbar' })
|
|
2848
2892
|
const order = S.order
|
|
2849
2893
|
const n = Object.keys(helpers()).length
|
|
2850
|
-
const busy = (b) => Object.assign(b, { disabled: true, textContent: 'Saving…' })
|
|
2894
|
+
const busy = (b) => Object.assign(b, { disabled: true, textContent: 'Saving…' }) // its icon and label give way
|
|
2851
2895
|
put(helperBar,
|
|
2852
2896
|
HSUG ? h('span', { className: 'hsug', title: 'shown dashed in the Helper column: click one to take just that' }, ic('sparkles'),
|
|
2853
2897
|
h('span', { textContent: `${Object.keys(HSUG).length} suggested` }),
|
|
@@ -2860,12 +2904,12 @@ function drawHelperBar() {
|
|
|
2860
2904
|
saveHelpers(next, [], `${took.length} model${took.length === 1 ? ' is a helper' : 's are helpers'} now`).then(() => drawMine(S))
|
|
2861
2905
|
} }),
|
|
2862
2906
|
h('button', { className: 'small ghost', textContent: 'Dismiss', onclick: () => ((HSUG = null), drawMine(S)) })) : null,
|
|
2863
|
-
!HSUG && !S.helpersAuto ? h('button', { className: 'small', title: working() ? `suggest
|
|
2864
|
-
!HSUG && n ? h('button', { className: 'small ghost',
|
|
2865
|
-
if (!confirm(`Clear
|
|
2907
|
+
!HSUG && !S.helpersAuto ? h('button', { className: 'small', title: working() ? `suggest helpers from the ${working()} models that answered their test (their provider switched on), each with what it's good at that it doesn't have yet (from the rankings, its test, thinking and context): shown first, to take or not` : 'suggest helpers: the models are tested first (helpers are picked from the ones that answer)', onclick: (e) => (working() ? suggestNow(e.currentTarget) : testFirst('suggest')), 'aria-label': 'Suggest helpers' }, ic('sparkles'), h('span', { className: 'lt', textContent: 'Suggest helpers' })) : null,
|
|
2908
|
+
!HSUG && n ? h('button', { className: 'small ghost', 'aria-label': 'Clear helpers', title: `Clear helpers: no model a helper (${n} now): #1 can then start any model again, as before`, onclick: (e) => {
|
|
2909
|
+
if (!confirm(`Clear the ${n} helper${n === 1 ? '' : 's'}? #1 can then start any model again, as before.`)) return
|
|
2866
2910
|
busy(e.currentTarget)
|
|
2867
|
-
saveHelpers({}, [], 'no helpers:
|
|
2868
|
-
} }) : null)
|
|
2911
|
+
saveHelpers({}, [], 'no helpers: #1 can start any model again').then(() => (FILTER.helpers ? setFilter({ helpers: false }) : drawMine(S))) // no helpers left to show only
|
|
2912
|
+
} }, ic('x'), h('span', { className: 'lt', textContent: 'Clear helpers' })) : null)
|
|
2869
2913
|
return helperBar
|
|
2870
2914
|
}
|
|
2871
2915
|
|
|
@@ -2878,12 +2922,12 @@ function tableRow(t, at, pick) {
|
|
|
2878
2922
|
// where what it can do comes from, when that's worth a look: not known to models.dev (a guess), or set by you
|
|
2879
2923
|
const tag = !x ? h('span', { className: 'tag', textContent: '…', title: 'looking it up in models.dev' })
|
|
2880
2924
|
: x.source === 'assumed' ? h('button', { type: 'button', className: 'tag warn', textContent: 'unknown', title: "models.dev doesn't know it: what it can do is a guess. Click to set it up", onclick: () => openSetup(t) })
|
|
2881
|
-
: Object.keys(x.set ?? {}).length ? h('button', { type: 'button', className: 'tag', textContent: 'edited', title: 'what it can do: set by
|
|
2925
|
+
: Object.keys(x.set ?? {}).length ? h('button', { type: 'button', className: 'tag', textContent: 'edited', title: 'what it can do: set by hand (click to change)', onclick: () => openSetup(t) }) : null
|
|
2882
2926
|
const busy = locked()
|
|
2883
2927
|
return h('li', { className: 'in' + (picked ? ' picked' : '') + (isOff(t.provider) ? ' off' : ''), 'data-key': `${t.provider}/${t.model}`, title: isOff(t.provider) ? `${t.provider} is switched off: HeartCode skips this model until it's on` : '' },
|
|
2884
2928
|
h('span', { className: 'grip', textContent: '⋮⋮', 'aria-hidden': 'true' }),
|
|
2885
2929
|
h('input', { type: 'checkbox', checked: picked, disabled: busy, 'aria-label': `select ${t.model}`, title: 'select (Shift: and every row up to the last one selected)', onclick: (e) => (e.preventDefault(), pick(e)) }),
|
|
2886
|
-
h('span', { className: 'n', textContent: `#${at + 1}`, title: SORT.length || filtering() ? 'its place in
|
|
2930
|
+
h('span', { className: 'n', textContent: `#${at + 1}`, title: SORT.length || filtering() ? 'its place in the list' : '' }),
|
|
2887
2931
|
h('span', { className: 'm' }, h('span', { className: 'name', textContent: t.model, title: t.model }), tag),
|
|
2888
2932
|
h('span', { className: 'p', textContent: isOff(t.provider) ? `${t.provider} · off` : t.provider, title: t.provider }),
|
|
2889
2933
|
helperCell(t, at),
|
|
@@ -2896,7 +2940,7 @@ function tableRow(t, at, pick) {
|
|
|
2896
2940
|
h('button', { type: 'button', className: 'small ghost ib k-test row-test', disabled: going || busy, title: going ? 'testing…' : 'Test: send it a short message to see that it really answers', 'aria-label': `test ${t.model}`, onclick: () => tryModel(t) }, ic(going ? 'clock' : 'play')),
|
|
2897
2941
|
h('button', { type: 'button', className: 'small ghost ib k-info', title: 'Request: send it "Hello" and see exactly what was sent and what came back', 'aria-label': `raw request to ${t.model}`, onclick: () => hello(t.provider, t.model) }, ic('eye')),
|
|
2898
2942
|
h('button', { type: 'button', className: 'small ghost ib k-edit', disabled: busy, title: 'Edit what it can do: context, tool calls, thinking, images (or look it up in models.dev again)', 'aria-label': `edit ${t.model}`, onclick: () => openSetup(t) }, ic('pencil')),
|
|
2899
|
-
h('button', { type: 'button', className: 'small ghost ib k-del', disabled: busy, title: 'Remove it from
|
|
2943
|
+
h('button', { type: 'button', className: 'small ghost ib k-del', disabled: busy, title: 'Remove it from the list (it stays under its provider)', 'aria-label': `remove ${t.model}`, onclick: () => removeMine(t.provider, t.model) }, ic('trash'))))
|
|
2900
2944
|
}
|
|
2901
2945
|
|
|
2902
2946
|
// your list changed: the rows and counts it touches, in place
|
|
@@ -2910,7 +2954,7 @@ function markCatalog() {
|
|
|
2910
2954
|
const n = S.order.filter((t) => t.provider === sec.dataset.provider).length
|
|
2911
2955
|
const tag = sec.querySelector('.inlist')
|
|
2912
2956
|
tag.hidden = !n
|
|
2913
|
-
tag.textContent = `${n} in
|
|
2957
|
+
tag.textContent = `${n} in the list${inUse()?.provider === sec.dataset.provider ? ' · in use' : ''}`
|
|
2914
2958
|
}
|
|
2915
2959
|
drawPicks()
|
|
2916
2960
|
}
|
|
@@ -2918,12 +2962,12 @@ function markCatalog() {
|
|
|
2918
2962
|
function drawUsing(s) {
|
|
2919
2963
|
const o = s.order.filter((t) => !isOff(t.provider))
|
|
2920
2964
|
$('using').hidden = page() === 'providers' // there it's on the page itself
|
|
2921
|
-
put($('using'), o.length ? [h('span', { className: 'k', textContent: 'HeartCode uses' }), h('b', { textContent: o[0].model }), h('span', { className: 'k', textContent: `${o[0].provider}${o.length > 1 ? ` · ${o.length - 1} fallback${o.length > 2 ? 's' : ''}` : ''}` })] : s.order.length ? [h('span', { className: 'k', textContent: 'The providers of all
|
|
2965
|
+
put($('using'), o.length ? [h('span', { className: 'k', textContent: 'HeartCode uses' }), h('b', { textContent: o[0].model }), h('span', { className: 'k', textContent: `${o[0].provider}${o.length > 1 ? ` · ${o.length - 1} fallback${o.length > 2 ? 's' : ''}` : ''}` })] : s.order.length ? [h('span', { className: 'k', textContent: 'The providers of all the models are switched off' }), h('a', { href: '#providers', textContent: 'Switch one on' })] : [h('span', { className: 'k', textContent: 'No model chosen yet' }), h('a', { href: '#providers', textContent: 'Choose one' })])
|
|
2922
2966
|
}
|
|
2923
2967
|
|
|
2924
2968
|
// --- General ---
|
|
2925
2969
|
const PERM_INFO = { all: ['Everything', 'Edits files and runs commands without asking'], commands: ['Edits only', 'Edits files; asks before running commands'], ask: ['Ask first', 'Asks before every edit and command'] }
|
|
2926
|
-
const THEME_INFO = { dark: ["
|
|
2970
|
+
const THEME_INFO = { dark: ["The terminal's background", ['#1f2328', '#d4d4d8', '#ff6b9d', '#7aa2f7']], light: ['White background', ['#fafbfc', '#24292f', '#d6336c', '#0969da']], midnight: ['Deep blue background', ['#1a1b26', '#c0caf5', '#ff7ab2', '#7aa2f7']], mono: ['No colors: bold and dim', ['#000000', '#bbbbbb', '#ffffff', '#777777']] }
|
|
2927
2971
|
const TOGGLE_INFO = { autoCompact: 'Compact long conversations', director: 'Let the model set things up', format: 'Format files after edits', lsp: 'Language server checks', updateCheck: 'Check for updates', mouse: 'HeartCode takes the mouse' }
|
|
2928
2972
|
function choices(id, list, cur, name) {
|
|
2929
2973
|
put($(id), list.map(([v, title, desc, colors]) => h('label', { className: 'choice' + (v === cur ? ' on' : '') },
|
|
@@ -2965,9 +3009,9 @@ function drawVoice(s) {
|
|
|
2965
3009
|
put($('v-src'), h('option', { value: '', textContent: 'This machine (whisper-cli)' }), names.map((n) => h('option', { value: n, textContent: `${n} (its transcription API)` })))
|
|
2966
3010
|
$('v-src').value = v.provider && names.includes(v.provider) ? v.provider : ''
|
|
2967
3011
|
const remote = Boolean($('v-src').value)
|
|
2968
|
-
$('v-src-about').textContent = remote ? 'Sent to that provider to turn into text: fast, needs its key.' : 'Runs on
|
|
3012
|
+
$('v-src-about').textContent = remote ? 'Sent to that provider to turn into text: fast, needs its key.' : 'Runs on this computer: private, free, slower. Needs whisper-cli and a model.'
|
|
2969
3013
|
$('v-model-about').textContent = remote ? 'Its speech-to-text model, like whisper-large-v3 (Groq) or whisper-1 (OpenAI).' : 'A whisper model file (ggml-….bin). Empty: the best one in ~/.whisper-models.'
|
|
2970
|
-
$('v-lang-about').textContent = remote ? '
|
|
3014
|
+
$('v-lang-about').textContent = remote ? 'The language spoken, like en or bn. Empty: worked out from the speech.' : 'The language spoken, like en or bn; auto works it out. Empty: English.'
|
|
2971
3015
|
$('v-model').placeholder = remote ? 'whisper-large-v3' : 'auto'
|
|
2972
3016
|
$('v-lang').placeholder = remote ? 'auto' : 'en'
|
|
2973
3017
|
for (const [id, k] of [['v-model', 'model'], ['v-lang', 'language']]) if (document.activeElement !== $(id)) $(id).value = v[k] ?? ''
|
|
@@ -2988,7 +3032,7 @@ $('v-lang').onchange = () => saveVoice('voice language saved')
|
|
|
2988
3032
|
// is typed in its own row: a box with Test and Add while there's none (or Change was pressed), else the
|
|
2989
3033
|
// address with Change, Test and Remove.
|
|
2990
3034
|
const ENGINE_INFO = {
|
|
2991
|
-
searxng: '
|
|
3035
|
+
searxng: 'A self-hosted instance: private, and no other site\'s limits. Its JSON API is used when it has it on.',
|
|
2992
3036
|
searx: 'Many engines at once, through public instances from searx.space. Broad; some instances are busy.',
|
|
2993
3037
|
duckduckgo: 'Broad results from its HTML page. Blocked on some networks.',
|
|
2994
3038
|
mwmbl: 'An open, non-profit index of its own. Fast; smaller than the big engines.',
|
|
@@ -2996,11 +3040,11 @@ const ENGINE_INFO = {
|
|
|
2996
3040
|
npm: 'Packages: for libraries and tools. Up to 3 results.',
|
|
2997
3041
|
github: 'Repositories: for projects and examples. Up to 3 results.',
|
|
2998
3042
|
}
|
|
2999
|
-
const wsInput = h('input', { type: 'text', placeholder: 'http://192.168.1.10:8888 or https://search.example.com', spellcheck: false, autocomplete: 'off', 'aria-label': '
|
|
3043
|
+
const wsInput = h('input', { type: 'text', placeholder: 'http://192.168.1.10:8888 or https://search.example.com', spellcheck: false, autocomplete: 'off', 'aria-label': 'SearXNG address' })
|
|
3000
3044
|
let wsEditing = false
|
|
3001
3045
|
const wsCancel = () => ((wsEditing = false), wsInput.blur(), drawSearch(S))
|
|
3002
3046
|
const wsSave = async (url) => {
|
|
3003
|
-
const r = await act('/api/search', { searxng: url }, url.trim() ? '
|
|
3047
|
+
const r = await act('/api/search', { searxng: url }, url.trim() ? 'SearXNG saved: it is asked first' : 'SearXNG removed')
|
|
3004
3048
|
if (r) (wsEditing = false), wsInput.blur(), S && drawSearch(S)
|
|
3005
3049
|
}
|
|
3006
3050
|
const wsTest = async (url) => {
|
|
@@ -3061,9 +3105,9 @@ function drawNotify(s) {
|
|
|
3061
3105
|
const focused = document.activeElement === $('tg-token')
|
|
3062
3106
|
if (!t.connected) {
|
|
3063
3107
|
put($('tg-setup'), h('ol', { className: 'tg-steps' },
|
|
3064
|
-
h('li', {}, 'In Telegram, open ', h('a', { href: 'https://t.me/BotFather', target: '_blank', rel: 'noopener', textContent: '@BotFather' }), ', send ', h('span', { className: 'mono', textContent: '/newbot' }), ', pick a name, and copy the token it gives
|
|
3108
|
+
h('li', {}, 'In Telegram, open ', h('a', { href: 'https://t.me/BotFather', target: '_blank', rel: 'noopener', textContent: '@BotFather' }), ', send ', h('span', { className: 'mono', textContent: '/newbot' }), ', pick a name, and copy the token it gives.'),
|
|
3065
3109
|
h('li', {}, tokenRow('Paste the token here')),
|
|
3066
|
-
h('li', { className: t.bot ? '' : 'muted' }, t.bot ? ['Open ', h('a', { href: `https://t.me/${t.bot}`, target: '_blank', rel: 'noopener', textContent: `@${t.bot}` }), ' and press ', h('b', { textContent: 'Start' }), ' (or send it any message), then ', h('button', { className: 'small', type: 'button', textContent: 'Find
|
|
3110
|
+
h('li', { className: t.bot ? '' : 'muted' }, t.bot ? ['Open ', h('a', { href: `https://t.me/${t.bot}`, target: '_blank', rel: 'noopener', textContent: `@${t.bot}` }), ' and press ', h('b', { textContent: 'Start' }), ' (or send it any message), then ', h('button', { className: 'small', type: 'button', textContent: 'Find the chat', onclick: () => tgConnect(true) })] : 'Then press Start in the bot, so HeartCode knows where to send.')))
|
|
3067
3111
|
$('tg-token').value = typed
|
|
3068
3112
|
if (focused) $('tg-token').focus()
|
|
3069
3113
|
} else {
|
|
@@ -3083,13 +3127,13 @@ function drawNotify(s) {
|
|
|
3083
3127
|
const TG_EVENT_INFO = {
|
|
3084
3128
|
done: 'The task, how long it took, and the answer.',
|
|
3085
3129
|
failed: 'The task and the error.',
|
|
3086
|
-
waiting: 'The question or permission it stopped at,
|
|
3130
|
+
waiting: 'The question or permission it stopped at, to come back to and answer.',
|
|
3087
3131
|
}
|
|
3088
3132
|
async function tgConnect(again = false) {
|
|
3089
3133
|
const token = again === true ? '' : $('tg-token')?.value.trim()
|
|
3090
3134
|
const r = await act('/api/telegram/connect', { token })
|
|
3091
3135
|
if (!r) return
|
|
3092
|
-
toast(r.found ? `Connected: sending to ${r.found}` : r.telegram?.bot ? `Token works. Now press Start in @${r.telegram.bot}, then Find
|
|
3136
|
+
toast(r.found ? `Connected: sending to ${r.found}` : r.telegram?.bot ? `Token works. Now press Start in @${r.telegram.bot}, then Find the chat` : 'Saved')
|
|
3093
3137
|
}
|
|
3094
3138
|
|
|
3095
3139
|
// --- Logging: the two switches, how much of each request; the requests logged (live) ---
|
|
@@ -3288,7 +3332,7 @@ async function openReq(r) {
|
|
|
3288
3332
|
h('div', { className: 'l1', style: 'display:flex;gap:8px;align-items:center;flex-wrap:wrap' }, resultTag(d), h('b', { className: 'mono', textContent: d.model }), placeTag(d)),
|
|
3289
3333
|
h('dl', { className: 'kv' },
|
|
3290
3334
|
row('When', new Date(d.at).toLocaleString()), row('Provider', d.provider), row('Address', d.url),
|
|
3291
|
-
row('Where in
|
|
3335
|
+
row('Where in the list', d.of > 1 ? `#${d.place} of ${d.of}${d.place > 1 ? ' (a fallback: the ones before it failed)' : ''}` : null),
|
|
3292
3336
|
row('For', d.purpose === 'test' ? 'testing the model' : d.purpose === 'btw' ? 'a /btw question' : 'the conversation'), row('Tab', d.tab),
|
|
3293
3337
|
row('Took', secs(d.ms)), row('First token after', secs(d.firstTokenMs)), row('Tokens', tokensOf(d.usage)), row('Finished because', d.finishReason),
|
|
3294
3338
|
row('HTTP status', d.status), row('File', `${S?.logs.requests ?? ''}/${r.run}/${r.file}`)),
|
|
@@ -3325,7 +3369,7 @@ const PROMPT_KINDS = [
|
|
|
3325
3369
|
['agent', 'Notes & replies', 'What HeartCode adds or answers while the model works', (p) => !p.title && p.id.startsWith('agent/') && !p.id.startsWith('agent/tool-')],
|
|
3326
3370
|
['guided', 'Guided mode', 'For models without tool calls: they write their actions as text', (p) => !p.title && p.id.startsWith('guided/')],
|
|
3327
3371
|
['compact', 'Summaries', 'Compacting a long conversation into a summary', (p) => p.id.startsWith('compact/')],
|
|
3328
|
-
['tests', 'Tests', 'What Test asks
|
|
3372
|
+
['tests', 'Tests', 'What Test asks the models', (p) => p.id.startsWith('tests/')],
|
|
3329
3373
|
]
|
|
3330
3374
|
// a prompt's name to read: "output-cut" → "Output cut", a tool's by the tool's own name ("tool-read_file" → "read_file")
|
|
3331
3375
|
const promptName = (p) => {
|
|
@@ -3347,20 +3391,20 @@ function drawPrompts(s) {
|
|
|
3347
3391
|
const all = s.prompts.filter(is)
|
|
3348
3392
|
return h('label', { className: v === promptKind && !promptQuery ? 'on' : '', title: about },
|
|
3349
3393
|
h('input', { type: 'radio', name: 'r-kind', checked: v === promptKind, onchange: () => ((promptKind = v), (promptQuery = $('r-search').value = ''), (SEL.prompts = null), drawPrompts(S)) }),
|
|
3350
|
-
t, h('span', { className: 'r-count', textContent: String(all.length) }), all.some((p) => p.changed) ? h('span', { className: 'dot', title: 'some changed
|
|
3394
|
+
t, h('span', { className: 'r-count', textContent: String(all.length) }), all.some((p) => p.changed) ? h('span', { className: 'dot', title: 'some changed' }) : null)
|
|
3351
3395
|
}))
|
|
3352
3396
|
const aboutOf = (p) => promptParts(p).about || (p.id.startsWith('agent/tool-') ? `What the model is told the ${promptName(p)} tool does` : '')
|
|
3353
|
-
const item = (p) => ({ id: p.id, title: promptName(p), sub: aboutOf(p), badge: p.changed ? h('span', { className: 'tag brand', textContent: '
|
|
3397
|
+
const item = (p) => ({ id: p.id, title: promptName(p), sub: aboutOf(p), badge: p.changed ? h('span', { className: 'tag brand', textContent: 'changed' }) : null, p })
|
|
3354
3398
|
const shown = s.prompts.filter(match)
|
|
3355
3399
|
const groups = promptQuery ? PROMPT_KINDS.map(([, t, , is]) => ({ title: t, items: shown.filter(is).map(item) })) : [{ items: shown.map(item) }]
|
|
3356
3400
|
masterDetail('prompts', $('r-items'), $('r-detail'), groups, (x) => {
|
|
3357
|
-
if (!x) return h('div', { className: 'card' }, h('h2', { textContent: promptMine ? 'None changed yet' : 'No prompt matches' }), h('p', { className: 'sub', textContent: promptMine ? "
|
|
3401
|
+
if (!x) return h('div', { className: 'card' }, h('h2', { textContent: promptMine ? 'None changed yet' : 'No prompt matches' }), h('p', { className: 'sub', textContent: promptMine ? "HeartCode's prompts are used as they come. A prompt changed and saved shows here." : 'Try other words, or clear the search.' }))
|
|
3358
3402
|
const p = x.p
|
|
3359
3403
|
const { vars } = promptParts(p)
|
|
3360
3404
|
const about = aboutOf(p)
|
|
3361
3405
|
const kind = kindOf(p)
|
|
3362
3406
|
const ta = editor('prompts', p.id, p.text)
|
|
3363
|
-
const undo = h('button', { className: 'ghost', textContent: 'Undo
|
|
3407
|
+
const undo = h('button', { className: 'ghost', textContent: 'Undo the changes', onclick: () => (saved('prompts', p.id), drawPrompts(S)) })
|
|
3364
3408
|
const unsaved = h('span', { className: 'tag need', textContent: 'not saved' })
|
|
3365
3409
|
const dirty = () => {
|
|
3366
3410
|
const changed = DRAFTS.prompts[p.id] !== undefined
|
|
@@ -3383,9 +3427,9 @@ function drawPrompts(s) {
|
|
|
3383
3427
|
h('div', { className: 'k-head' },
|
|
3384
3428
|
h('h2', { textContent: promptName(p) }),
|
|
3385
3429
|
h('span', { className: 'tag brand', textContent: kind?.[1] ?? '' }),
|
|
3386
|
-
h('span', { className: 'tag', textContent: p.changed ? '
|
|
3430
|
+
h('span', { className: 'tag', textContent: p.changed ? 'changed' : "HeartCode's" }),
|
|
3387
3431
|
unsaved),
|
|
3388
|
-
h('div', { className: 'k-path mono', textContent: p.changed ? `${p.id} ·
|
|
3432
|
+
h('div', { className: 'k-path mono', textContent: p.changed ? `${p.id} · changed, in ${s.home}/prompts/${p.id.split('/')[0]}.md` : p.id }),
|
|
3389
3433
|
about ? [h('label', { className: 'f', textContent: 'What it is' }), h('p', { className: 'r-about', textContent: about })] : null,
|
|
3390
3434
|
vars.length ? [h('label', { className: 'f', textContent: 'Placeholders' }),
|
|
3391
3435
|
h('div', { className: 'r-vars', onmouseleave: () => (hint.textContent = HINT) }, vars.map(({ v, text }) => h('button', { className: 'r-var mono', textContent: `{{${v}}}`, 'aria-label': `Put {{${v}}} in the prompt${text ? `: ${text}` : ''}`, onmouseenter: () => show(v, text), onfocus: () => show(v, text), onclick: () => insert(v) }))),
|
|
@@ -3396,7 +3440,7 @@ function drawPrompts(s) {
|
|
|
3396
3440
|
h('button', { className: 'primary', textContent: 'Save', onclick: () => saveItem('prompts', p.id, '/api/prompt', { id: p.id, text: ta.value }, 'saved: used from the next message') }),
|
|
3397
3441
|
undo,
|
|
3398
3442
|
h('span', { className: 'spacer' }),
|
|
3399
|
-
p.changed ? h('button', { textContent: "Reset to HeartCode's", onclick: () => confirm("Put HeartCode's prompt back?
|
|
3443
|
+
p.changed ? h('button', { textContent: "Reset to HeartCode's", onclick: () => confirm("Put HeartCode's prompt back? The changed one is deleted.") && saveItem('prompts', p.id, '/api/prompt', { id: p.id, text: null }, "HeartCode's prompt again") }) : null))
|
|
3400
3444
|
}, { tabs: false })
|
|
3401
3445
|
}
|
|
3402
3446
|
|
|
@@ -3429,7 +3473,7 @@ function drawMcp(s) {
|
|
|
3429
3473
|
put($('c-list'), h('h2', { textContent: 'Servers' }), h('p', { className: 'sub', textContent: 'Remote ones (a URL) may need signing in; local ones don\'t. Tick a flag off to start it without that flag; switch a server off to keep it without using it.' }),
|
|
3430
3474
|
s.mcp.length ? s.mcp.map((m) => h('div', { className: 'opt mcp-row' },
|
|
3431
3475
|
tile(m.remote ? 'globe' : m.name.includes('chrome') || m.name.includes('browser') ? 'globe' : m.name.includes('computer') ? 'cpu' : 'plug', m.on ? 'teal' : 'gray'),
|
|
3432
|
-
h('div', { className: 't' }, h('b', {}, m.name, ' ', h('span', { className: 'tag', textContent: m.from }), m.remote ? authTag(m.auth) : null), m.description ? h('span', { textContent: m.description }) : null, h('div', { className: 'mono muted', style: 'word-break:break-all;margin-top:3px', textContent: m.what }), m.from === 'yours' && !m.remote ? mcpFlags(m) : null),
|
|
3476
|
+
h('div', { className: 't' }, h('b', {}, m.name, ' ', h('span', { className: 'tag', textContent: m.from === 'yours' ? 'custom' : m.from }), m.remote ? authTag(m.auth) : null), m.description ? h('span', { textContent: m.description }) : null, h('div', { className: 'mono muted', style: 'word-break:break-all;margin-top:3px', textContent: m.what }), m.from === 'yours' && !m.remote ? mcpFlags(m) : null),
|
|
3433
3477
|
m.remote ? h('button', { className: 'small', textContent: m.auth === 'in' ? 'Sign in again' : 'Sign in', onclick: () => act('/api/mcp/login', { name: m.name }, `signed in to ${m.name}`) }) : null,
|
|
3434
3478
|
m.from === 'yours' ? h('button', { className: 'small danger', textContent: 'Remove', onclick: () => confirm(`Remove the MCP server ${m.name}?`) && act('/api/mcp/remove', { name: m.name }, `removed ${m.name}`) }) : null,
|
|
3435
3479
|
sw({ checked: m.on, 'aria-label': `${m.name} on`, onchange: (e) => act('/api/mcp/toggle', { name: m.name, on: e.target.checked }, `${m.name}: ${e.target.checked ? 'on' : 'off'}`) }))) : h('div', { className: 'empty', textContent: 'No MCP servers.' }))
|
|
@@ -3440,8 +3484,8 @@ function drawMcp(s) {
|
|
|
3440
3484
|
}
|
|
3441
3485
|
|
|
3442
3486
|
// --- skills: a form (name, who uses it, what it's for, the prompt); SKILL.md is made from it ---
|
|
3443
|
-
const USES = [['both', '
|
|
3444
|
-
const USE_TAG = { both: '
|
|
3487
|
+
const USES = [['both', 'Typed or the model', 'typed as /skill:name, or used by the model when it fits'], ['me', 'Only typed', 'only when typed as /skill:name'], ['model', 'Only the model', 'when it fits; not typed'], ['always', 'Always on', 'in every message: how to work, not a task']]
|
|
3488
|
+
const USE_TAG = { both: 'typed + model', me: 'typed only', model: 'model', always: 'always on' } // who uses it, in a word or two (the list and the panel)
|
|
3445
3489
|
function parseSkill(text) {
|
|
3446
3490
|
const m = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(text)
|
|
3447
3491
|
const out = { description: '', use: 'both', extra: [], body: (m ? m[2] : text).replace(/^\s*\n/, '') }
|
|
@@ -3458,8 +3502,8 @@ const NEW = { name: '', description: '', use: 'both', extra: [], body: '' }
|
|
|
3458
3502
|
function newSkill() {
|
|
3459
3503
|
const f = skillForm('+new', NEW, { isNew: true })
|
|
3460
3504
|
const first = !S.skills.length
|
|
3461
|
-
put($('k-form'), h('h2', { id: 'k-title', textContent: first ? 'Make
|
|
3462
|
-
first ? h('p', { className: 'sub', textContent: 'A skill is a prompt
|
|
3505
|
+
put($('k-form'), h('h2', { id: 'k-title', textContent: first ? 'Make the first skill' : 'New skill' }),
|
|
3506
|
+
first ? h('p', { className: 'sub', textContent: 'A skill is a prompt used again and again, like "review this" or "write the release notes". Skills from Claude Code and others: /import in HeartCode.' }) : null,
|
|
3463
3507
|
f.el,
|
|
3464
3508
|
h('div', { className: 'actions' },
|
|
3465
3509
|
h('button', { textContent: 'Cancel', onclick: () => $('k-form').close() }),
|
|
@@ -3485,10 +3529,10 @@ function skillForm(id, start, { isNew, readOnly }) {
|
|
|
3485
3529
|
const uses = h('div', {}, h('div', { className: 'seg', role: 'radiogroup', 'aria-label': 'Who uses it' }, USES.map(([v, t, sub]) => h('label', { className: d.use === v ? 'on' : '', title: sub },
|
|
3486
3530
|
h('input', { type: 'radio', name: `use-${id}`, checked: d.use === v, disabled: readOnly, onchange: () => ((d.use = v), touch(), (useAbout.textContent = sub), uses.querySelectorAll('.seg label').forEach((c) => c.classList.toggle('on', c.querySelector('input').checked))) }),
|
|
3487
3531
|
t))), useAbout)
|
|
3488
|
-
const body = grow(h('textarea', { className: 'editor', spellcheck: false, readOnly, value: d.body, placeholder: 'What the model should do. $ARGUMENTS is
|
|
3532
|
+
const body = grow(h('textarea', { className: 'editor', spellcheck: false, readOnly, value: d.body, placeholder: 'What the model should do. $ARGUMENTS is the text typed after /skill:name: "/skill:review the login page" gives "the login page".', oninput: (e) => ((d.body = e.target.value), touch()) }), 220)
|
|
3489
3533
|
return { d, el: [
|
|
3490
3534
|
h('div', { className: 'row' },
|
|
3491
|
-
isNew ? h('div', { className: 'grow' }, h('label', { className: 'f', textContent:
|
|
3535
|
+
isNew ? h('div', { className: 'grow' }, h('label', { className: 'f', textContent: 'Name: typed as /skill:name' }), field('name', { placeholder: 'review' })) : null,
|
|
3492
3536
|
h('div', { className: 'grow', style: 'flex:3' }, h('label', { className: 'f', textContent: 'What it does (the model reads this to know when to use it)' }), about)),
|
|
3493
3537
|
h('label', { className: 'f', textContent: 'Who uses it' }), uses,
|
|
3494
3538
|
h('label', { className: 'f', textContent: 'The prompt' }), body,
|
|
@@ -3554,8 +3598,8 @@ function drawSkills(s) {
|
|
|
3554
3598
|
if (e.key === 'Enter') install()
|
|
3555
3599
|
}
|
|
3556
3600
|
$('k-import').onclick = openImport
|
|
3557
|
-
masterDetail('skills', $('k-items'), $('k-detail'), [{ title: mine.length && theirs.length ? '
|
|
3558
|
-
if (!x) return h('div', { className: 'card' }, h('h2', { textContent: 'No skills yet' }), h('p', { className: 'sub', textContent: 'A skill is a prompt
|
|
3601
|
+
masterDetail('skills', $('k-items'), $('k-detail'), [{ title: mine.length && theirs.length ? 'Custom' : '', items: mine.map(item) }, { title: 'From projects', items: theirs.map(item) }], (x) => {
|
|
3602
|
+
if (!x) return h('div', { className: 'card' }, h('h2', { textContent: 'No skills yet' }), h('p', { className: 'sub', textContent: 'A skill is a prompt used again and again, like "review this" or "write the release notes". Make one with + New skill, install one above, or bring them from Claude Code and others with Import from other tools.' }))
|
|
3559
3603
|
const k = x.k
|
|
3560
3604
|
const f = skillForm(k.name, parseSkill(k.text), { readOnly: !k.mine })
|
|
3561
3605
|
const files = k.files ?? []
|
|
@@ -3563,7 +3607,7 @@ function drawSkills(s) {
|
|
|
3563
3607
|
h('div', { className: 'k-head' },
|
|
3564
3608
|
h('h2', { className: 'mono', textContent: '/skill:' + k.name }),
|
|
3565
3609
|
h('span', { className: 'tag brand', textContent: USE_TAG[k.use] ?? k.use, title: (USES.find(([v]) => v === k.use) ?? [])[2] ?? '' }),
|
|
3566
|
-
h('span', { className: 'tag', textContent: k.mine ? '
|
|
3610
|
+
h('span', { className: 'tag', textContent: k.mine ? 'custom' : 'from a project: read only' }),
|
|
3567
3611
|
files.length ? h('span', { className: 'tag', textContent: `${files.length} file${files.length === 1 ? '' : 's'}` }) : null),
|
|
3568
3612
|
h('div', { className: 'k-path mono', textContent: k.path ?? '' }),
|
|
3569
3613
|
f.el,
|
|
@@ -3746,7 +3790,7 @@ showPage()
|
|
|
3746
3790
|
drawPresets()
|
|
3747
3791
|
if (!token) put($('page-providers'), h('h1', { textContent: 'Open the link HeartCode printed' }), h('p', { className: 'lead', textContent: 'It has the key to this page: /settings in HeartCode, or heart settings.' }))
|
|
3748
3792
|
else {
|
|
3749
|
-
job('state', { where: ['page'], what: 'Loading
|
|
3793
|
+
job('state', { where: ['page'], what: 'Loading the settings', detail: 'providers, models, logging, prompts, MCP servers, skills' })
|
|
3750
3794
|
api('/api/state').then(render, (e) => toast(e.message, true)).finally(() => job('state'))
|
|
3751
3795
|
.then(() => api('/api/tests', {}))
|
|
3752
3796
|
.then(({ results, run }) => (Object.assign(TRIES, results), showRun(run)))
|