Spaces:
Running
Running
v0.6.1: redesigned Model Manager with Hugging Face avatars
Browse files- README.md +1 -1
- css/app.css +134 -52
- index.html +17 -19
- js/config.js +8 -7
- js/logos.js +0 -14
- js/main.js +4 -3
- js/model-manager.js +152 -97
- js/remote-llm.js +17 -17
- sw.js +3 -2
- vendor/avatars/anthropic.png +0 -0
- vendor/avatars/cerebras.png +0 -0
- vendor/avatars/deepseek.png +0 -0
- vendor/avatars/fireworks.png +0 -0
- vendor/avatars/google.png +0 -0
- vendor/avatars/groq.png +0 -0
- vendor/avatars/huggingface.png +0 -0
- vendor/avatars/ibm.png +0 -0
- vendor/avatars/liquidai.png +0 -0
- vendor/avatars/lmstudio.png +0 -0
- vendor/avatars/mistral.png +0 -0
- vendor/avatars/ollama.png +0 -0
- vendor/avatars/openai.png +0 -0
- vendor/avatars/openrouter.png +0 -0
- vendor/avatars/qwen.png +0 -0
- vendor/avatars/together.png +0 -0
- vendor/avatars/xai.png +0 -0
README.md
CHANGED
|
@@ -96,4 +96,4 @@ Each API model keeps its own key, only until you close the tab unless you turn o
|
|
| 96 |
- LFM3-1.7B and LFM3-Omni-2B: [LFM Open License v1.0](https://huggingface.co/LiquidAI/LFM3-1.7B-ONNX/blob/main/LICENSE). Qwen3, Qwen3.5 and Granite 4.0: Apache-2.0. No weights are re-hosted here: your browser downloads them directly from the repositories linked above.
|
| 97 |
- CheerpX: proprietary, free for personal and open-source projects. It is **not** included in this Space. Each visitor's browser loads it from Leaning Technologies' CDN and caches it locally.
|
| 98 |
- The Debian disk image (`disk/`) contains Debian packages under their respective free licenses.
|
| 99 |
-
- Provider
|
|
|
|
| 96 |
- LFM3-1.7B and LFM3-Omni-2B: [LFM Open License v1.0](https://huggingface.co/LiquidAI/LFM3-1.7B-ONNX/blob/main/LICENSE). Qwen3, Qwen3.5 and Granite 4.0: Apache-2.0. No weights are re-hosted here: your browser downloads them directly from the repositories linked above.
|
| 97 |
- CheerpX: proprietary, free for personal and open-source projects. It is **not** included in this Space. Each visitor's browser loads it from Leaning Technologies' CDN and caches it locally.
|
| 98 |
- The Debian disk image (`disk/`) contains Debian packages under their respective free licenses.
|
| 99 |
+
- Provider and model-maker icons are each organization's own Hugging Face avatar, bundled with the app so they work offline. They are trademarks of their owners and are shown only to identify them.
|
css/app.css
CHANGED
|
@@ -506,60 +506,135 @@ dialog[open] { animation: pop .14s ease-out; }
|
|
| 506 |
button.brand-model { border: 0; background: none; padding: 2px 6px; margin: -2px -6px; border-radius: 6px; cursor: pointer; font: inherit; color: inherit; }
|
| 507 |
button.brand-model:hover { background: var(--surface-2); }
|
| 508 |
|
| 509 |
-
/*
|
| 510 |
-
.
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
.
|
| 516 |
-
|
| 517 |
-
.
|
| 518 |
-
.
|
| 519 |
-
.
|
| 520 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 521 |
|
| 522 |
/* Model Manager */
|
| 523 |
-
#mm, #api-edit { max-height: calc(100dvh - 32px); overflow-y: auto; }
|
| 524 |
-
#mm { width: min(
|
| 525 |
-
#api-edit { width: min(
|
| 526 |
-
.mm-
|
| 527 |
-
.mm-
|
| 528 |
-
.mm-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 532 |
}
|
| 533 |
-
.mm-
|
| 534 |
-
.mm-
|
| 535 |
-
|
| 536 |
-
.
|
| 537 |
-
.
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
.
|
| 543 |
-
.
|
| 544 |
-
.
|
| 545 |
-
.
|
| 546 |
-
.
|
| 547 |
-
|
| 548 |
-
.
|
| 549 |
-
.
|
| 550 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 551 |
|
| 552 |
/* API model editor */
|
| 553 |
-
.providers { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap:
|
| 554 |
.provider {
|
| 555 |
-
display: flex; align-items: center; gap:
|
| 556 |
-
border: 1px solid var(--border); background: var(--surface); font-size:
|
|
|
|
| 557 |
}
|
| 558 |
.provider span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
| 559 |
-
.provider:hover { background: var(--surface-2); }
|
| 560 |
-
.provider.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
|
| 561 |
-
.ae-
|
| 562 |
-
.
|
|
|
|
|
|
|
|
|
|
| 563 |
.ae-base-summary { margin: 0 0 12px; font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
|
| 564 |
.field-inline { display: flex; gap: 8px; }
|
| 565 |
.field-inline input { flex: 1; }
|
|
@@ -567,17 +642,12 @@ button.brand-model:hover { background: var(--surface-2); }
|
|
| 567 |
.callout.info { border-color: color-mix(in srgb, var(--focus) 45%, var(--border)); }
|
| 568 |
.callout.info .callout-title svg { color: var(--focus); }
|
| 569 |
|
| 570 |
-
@media (max-width: 560px) {
|
| 571 |
-
.mm-row { grid-template-columns: auto 1fr; }
|
| 572 |
-
.mm-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; min-width: 0; }
|
| 573 |
-
.mm-progress-text { margin-right: auto; text-align: left; align-self: center; }
|
| 574 |
-
}
|
| 575 |
#tog-thinking:disabled { opacity: .45; cursor: not-allowed; }
|
| 576 |
|
| 577 |
/* ---------- narrow screens ---------- */
|
| 578 |
@media (max-width: 900px) {
|
| 579 |
body { grid-template-rows: auto auto 1fr; }
|
| 580 |
-
.brand-sep, .brand-model, .brand-device { display: none; }
|
| 581 |
.status { gap: 12px; }
|
| 582 |
.status-text { display: none; }
|
| 583 |
.tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--surface); padding: 0 8px; }
|
|
@@ -599,3 +669,15 @@ button.brand-model:hover { background: var(--surface-2); }
|
|
| 599 |
/* Code should show exactly what is typed: no programming ligatures (=> stays =>). */
|
| 600 |
code, pre, kbd, .mono, .tool-label, .crumbs, .vw-path, .hex, #terminal * { font-variant-ligatures: none !important; font-feature-settings: "liga" 0, "calt" 0 !important; }
|
| 601 |
.btn.block.secondary { white-space: normal; height: auto; min-height: 42px; padding: 8px 14px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 506 |
button.brand-model { border: 0; background: none; padding: 2px 6px; margin: -2px -6px; border-radius: 6px; cursor: pointer; font: inherit; color: inherit; }
|
| 507 |
button.brand-model:hover { background: var(--surface-2); }
|
| 508 |
|
| 509 |
+
/* avatars: each organization's Hugging Face avatar on a white backing, like an app icon */
|
| 510 |
+
.avatar {
|
| 511 |
+
--av: 36px;
|
| 512 |
+
flex: none; position: relative; width: var(--av); height: var(--av); border-radius: calc(var(--av) * .26);
|
| 513 |
+
background: #fff; overflow: hidden; display: inline-grid; place-items: center; isolation: isolate;
|
| 514 |
+
}
|
| 515 |
+
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
| 516 |
+
/* a hairline drawn inside the tile, so light logos keep an edge without a visible outline */
|
| 517 |
+
.avatar::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .07); pointer-events: none; }
|
| 518 |
+
.avatar.glyph { background: var(--surface-3); color: var(--text-2); }
|
| 519 |
+
.avatar.glyph::after { box-shadow: none; }
|
| 520 |
+
.avatar.glyph svg { width: 45%; height: 45%; fill: none; stroke: currentColor; stroke-width: 2; }
|
| 521 |
+
.avatar.xs { --av: 18px; }
|
| 522 |
+
.avatar.sm { --av: 28px; }
|
| 523 |
+
.avatar.md { --av: 40px; }
|
| 524 |
+
.avatar.lg { --av: 48px; }
|
| 525 |
+
button.brand-model { display: inline-flex; align-items: center; gap: 7px; }
|
| 526 |
|
| 527 |
/* Model Manager */
|
| 528 |
+
#mm, #api-edit { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
|
| 529 |
+
#mm { width: min(720px, calc(100% - 32px)); padding-bottom: 6px; }
|
| 530 |
+
#api-edit { width: min(600px, calc(100% - 32px)); }
|
| 531 |
+
.mm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 18px 4px 24px; }
|
| 532 |
+
.mm-head h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
|
| 533 |
+
.mm-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--text-3); }
|
| 534 |
+
|
| 535 |
+
.mm-summary {
|
| 536 |
+
display: flex; align-items: center; gap: 14px; margin: 14px 24px 0; padding: 14px 16px;
|
| 537 |
+
border-radius: 16px; border: 1px solid var(--border);
|
| 538 |
+
background: linear-gradient(135deg, color-mix(in srgb, var(--ok) 9%, var(--surface)), var(--surface) 65%);
|
| 539 |
+
}
|
| 540 |
+
.mm-summary.empty { background: var(--surface-2); border-style: dashed; border-color: var(--border-strong); }
|
| 541 |
+
.summary-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); flex: none; }
|
| 542 |
+
.summary-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
|
| 543 |
+
.summary-text { flex: 1; min-width: 0; }
|
| 544 |
+
.summary-label { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
|
| 545 |
+
.summary-title { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
|
| 546 |
+
.summary-sub { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
|
| 547 |
+
|
| 548 |
+
.mm-tabs { display: flex; gap: 4px; margin: 18px 24px 0; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
|
| 549 |
+
.mm-tab {
|
| 550 |
+
flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; border: 0; border-radius: 9px;
|
| 551 |
+
background: none; color: var(--text-2); font-weight: 550; font-size: 13px; transition: background .15s, color .15s, box-shadow .15s;
|
| 552 |
+
}
|
| 553 |
+
.mm-tab svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
|
| 554 |
+
.mm-tab .count { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--text-3); font-variant-numeric: tabular-nums; }
|
| 555 |
+
.mm-tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 0 0 1px var(--border); }
|
| 556 |
+
.mm-tab[aria-selected="true"] .count { background: var(--primary); color: var(--primary-ink); }
|
| 557 |
+
.mm-tab:not([aria-selected="true"]):hover { color: var(--text); }
|
| 558 |
+
|
| 559 |
+
.mm-panel { padding: 14px 24px 12px; }
|
| 560 |
+
.mm-banner {
|
| 561 |
+
display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; font-size: 12.5px; line-height: 1.5;
|
| 562 |
+
color: var(--text-2); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border));
|
| 563 |
}
|
| 564 |
+
.mm-banner svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--warn); fill: none; stroke: currentColor; stroke-width: 2; }
|
| 565 |
+
.mm-foot { margin: 14px 2px 4px; font-size: 12px; line-height: 1.55; color: var(--text-3); }
|
| 566 |
+
|
| 567 |
+
.mc-list { display: flex; flex-direction: column; gap: 10px; }
|
| 568 |
+
.mc {
|
| 569 |
+
position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 16px;
|
| 570 |
+
border-radius: 16px; border: 1px solid var(--border); background: var(--surface);
|
| 571 |
+
transition: border-color .15s, box-shadow .15s, transform .15s;
|
| 572 |
+
}
|
| 573 |
+
.mc:hover { border-color: var(--border-strong); box-shadow: 0 6px 20px -12px rgba(0, 0, 0, .25); }
|
| 574 |
+
.mc.active { border-color: color-mix(in srgb, var(--ok) 60%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 14%, transparent); }
|
| 575 |
+
.mc-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
| 576 |
+
.mc-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
| 577 |
+
.mc-name { font-weight: 650; font-size: 14.5px; letter-spacing: -.01em; }
|
| 578 |
+
.mc-by { font-size: 12px; color: var(--text-3); }
|
| 579 |
+
.mc-note { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
|
| 580 |
+
.mc-error { margin-top: 8px; font-size: 12px; color: var(--bad); }
|
| 581 |
+
.mc-actions { display: flex; align-items: center; gap: 6px; }
|
| 582 |
+
.mc-icons { display: inline-flex; gap: 2px; }
|
| 583 |
+
.icon-btn.sm { width: 30px; height: 30px; }
|
| 584 |
+
.icon-btn.sm svg { width: 15px; height: 15px; }
|
| 585 |
+
|
| 586 |
+
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
|
| 587 |
+
.chip {
|
| 588 |
+
display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; max-width: 100%;
|
| 589 |
+
font-size: 11.5px; font-weight: 500; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border);
|
| 590 |
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
| 591 |
+
}
|
| 592 |
+
.chip svg { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; }
|
| 593 |
+
.chip.muted { color: var(--text-3); }
|
| 594 |
+
.chip.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 30%, var(--border)); }
|
| 595 |
+
.chip.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); }
|
| 596 |
+
.chip.mono { font-family: var(--mono); font-size: 11px; }
|
| 597 |
+
|
| 598 |
+
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11px; font-weight: 600; }
|
| 599 |
+
.pill.accent { color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong); }
|
| 600 |
+
.pill.live { height: 30px; padding: 0 12px; color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--border)); font-size: 12px; }
|
| 601 |
+
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); animation: live 2s ease-in-out infinite; }
|
| 602 |
+
@keyframes live { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok) 0%, transparent); } }
|
| 603 |
+
|
| 604 |
+
.mc-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
|
| 605 |
+
.mc-progress .bar { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
|
| 606 |
+
.mc-progress .bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--focus), color-mix(in srgb, var(--focus) 55%, var(--ok))); transition: width .25s ease; }
|
| 607 |
+
.mc-progress-text { font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
| 608 |
+
|
| 609 |
+
.add-card {
|
| 610 |
+
display: flex; align-items: center; gap: 16px; width: 100%; margin-top: 10px; padding: 16px; text-align: left;
|
| 611 |
+
border-radius: 16px; border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text);
|
| 612 |
+
transition: border-color .15s, background .15s;
|
| 613 |
+
}
|
| 614 |
+
.add-card:hover { border-color: var(--text-3); background: var(--surface-2); }
|
| 615 |
+
.avatar-stack { display: inline-flex; flex: none; }
|
| 616 |
+
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
|
| 617 |
+
.avatar-stack .avatar + .avatar { margin-left: -9px; }
|
| 618 |
+
.add-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
| 619 |
+
.add-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
|
| 620 |
+
.add-title svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; }
|
| 621 |
+
.add-sub { font-size: 12px; color: var(--text-3); }
|
| 622 |
|
| 623 |
/* API model editor */
|
| 624 |
+
.providers { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 8px; margin-bottom: 14px; }
|
| 625 |
.provider {
|
| 626 |
+
display: flex; align-items: center; gap: 10px; padding: 8px 10px; min-width: 0; border-radius: 12px; text-align: left;
|
| 627 |
+
border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 550; color: var(--text);
|
| 628 |
+
transition: border-color .15s, background .15s, box-shadow .15s;
|
| 629 |
}
|
| 630 |
.provider span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
| 631 |
+
.provider:hover { background: var(--surface-2); border-color: var(--border-strong); }
|
| 632 |
+
.provider.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--surface-2); }
|
| 633 |
+
.ae-chosen { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
|
| 634 |
+
.field-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
|
| 635 |
+
.ae-keylink a { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
|
| 636 |
+
.ae-keylink a:hover { color: var(--text); }
|
| 637 |
+
.ae-keylink svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
|
| 638 |
.ae-base-summary { margin: 0 0 12px; font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
|
| 639 |
.field-inline { display: flex; gap: 8px; }
|
| 640 |
.field-inline input { flex: 1; }
|
|
|
|
| 642 |
.callout.info { border-color: color-mix(in srgb, var(--focus) 45%, var(--border)); }
|
| 643 |
.callout.info .callout-title svg { color: var(--focus); }
|
| 644 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 645 |
#tog-thinking:disabled { opacity: .45; cursor: not-allowed; }
|
| 646 |
|
| 647 |
/* ---------- narrow screens ---------- */
|
| 648 |
@media (max-width: 900px) {
|
| 649 |
body { grid-template-rows: auto auto 1fr; }
|
| 650 |
+
.brand-sep, .brand-model, button.brand-model, .brand-device { display: none; }
|
| 651 |
.status { gap: 12px; }
|
| 652 |
.status-text { display: none; }
|
| 653 |
.tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--surface); padding: 0 8px; }
|
|
|
|
| 669 |
/* Code should show exactly what is typed: no programming ligatures (=> stays =>). */
|
| 670 |
code, pre, kbd, .mono, .tool-label, .crumbs, .vw-path, .hex, #terminal * { font-variant-ligatures: none !important; font-feature-settings: "liga" 0, "calt" 0 !important; }
|
| 671 |
.btn.block.secondary { white-space: normal; height: auto; min-height: 42px; padding: 8px 14px; }
|
| 672 |
+
|
| 673 |
+
@media (max-width: 560px) {
|
| 674 |
+
.mm-head { padding: 18px 14px 2px 18px; }
|
| 675 |
+
.mm-summary, .mm-tabs { margin-left: 16px; margin-right: 16px; }
|
| 676 |
+
.mm-panel { padding: 12px 16px 10px; }
|
| 677 |
+
.mc { grid-template-columns: auto 1fr; padding: 14px; gap: 12px; }
|
| 678 |
+
.mc-actions { grid-column: 1 / -1; justify-content: flex-end; }
|
| 679 |
+
.mc-actions .btn.primary { flex: 1; height: 36px; }
|
| 680 |
+
.mm-tab { font-size: 12.5px; gap: 6px; }
|
| 681 |
+
.providers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
| 682 |
+
.add-card { flex-direction: column; align-items: flex-start; }
|
| 683 |
+
}
|
index.html
CHANGED
|
@@ -44,6 +44,10 @@
|
|
| 44 |
<symbol id="i-minimize" viewBox="0 0 24 24"><path d="M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7"/></symbol>
|
| 45 |
<symbol id="i-cpu" viewBox="0 0 24 24"><rect x="6" y="6" width="12" height="12" rx="2"/><path d="M9 2v4M15 2v4M9 18v4M15 18v4M2 9h4M2 15h4M18 9h4M18 15h4"/></symbol>
|
| 46 |
<symbol id="i-plus" viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></symbol>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
<symbol id="i-open" viewBox="0 0 24 24"><path d="M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></symbol>
|
| 48 |
</defs>
|
| 49 |
</svg>
|
|
@@ -221,25 +225,16 @@
|
|
| 221 |
</dialog>
|
| 222 |
|
| 223 |
<dialog id="mm" class="mm" aria-labelledby="mm-title">
|
| 224 |
-
<div class="
|
| 225 |
-
<
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
<div class="mm-active" id="mm-active"></div>
|
| 229 |
-
<div class="dlg-section">
|
| 230 |
-
<div class="section-label">On this device</div>
|
| 231 |
-
<p class="dlg-lede">Runs on your GPU with WebGPU and works offline once downloaded. Bigger models are more capable but slower and need more graphics memory.</p>
|
| 232 |
-
<div id="mm-local-note"></div>
|
| 233 |
-
<div class="mm-list" id="mm-local"></div>
|
| 234 |
-
</div>
|
| 235 |
-
<div class="dlg-section">
|
| 236 |
-
<div class="mm-section-head">
|
| 237 |
-
<div class="section-label">API models</div>
|
| 238 |
-
<button type="button" class="btn small" id="mm-add-api"><svg><use href="#i-plus"/></svg>Add API model</button>
|
| 239 |
</div>
|
| 240 |
-
<
|
| 241 |
-
<div class="mm-list" id="mm-api"></div>
|
| 242 |
</div>
|
|
|
|
|
|
|
|
|
|
| 243 |
</dialog>
|
| 244 |
|
| 245 |
<dialog id="api-edit" class="api-edit" aria-labelledby="ae-title">
|
|
@@ -251,10 +246,13 @@
|
|
| 251 |
<div class="dlg-section">
|
| 252 |
<div class="section-label">Provider</div>
|
| 253 |
<div class="providers" id="ae-providers"></div>
|
| 254 |
-
<
|
| 255 |
<p class="ae-base-summary" id="ae-base-summary"><span class="mono" id="ae-base-shown"></span> <button type="button" class="linkish plain" id="ae-base-edit">Change URL</button></p>
|
| 256 |
<label class="field" id="ae-base-row"><span class="field-label">Base URL</span><input id="ae-base" type="url" placeholder="https://api.example.com/v1" spellcheck="false" autocomplete="off"></label>
|
| 257 |
-
<
|
|
|
|
|
|
|
|
|
|
| 258 |
<div class="field">
|
| 259 |
<span class="field-label">Model ID</span>
|
| 260 |
<div class="field-inline">
|
|
|
|
| 44 |
<symbol id="i-minimize" viewBox="0 0 24 24"><path d="M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7"/></symbol>
|
| 45 |
<symbol id="i-cpu" viewBox="0 0 24 24"><rect x="6" y="6" width="12" height="12" rx="2"/><path d="M9 2v4M15 2v4M9 18v4M15 18v4M2 9h4M2 15h4M18 9h4M18 15h4"/></symbol>
|
| 46 |
<symbol id="i-plus" viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></symbol>
|
| 47 |
+
<symbol id="i-layers" viewBox="0 0 24 24"><path d="m12 2 10 5-10 5L2 7z"/><path d="m2 17 10 5 10-5M2 12l10 5 10-5"/></symbol>
|
| 48 |
+
<symbol id="i-key" viewBox="0 0 24 24"><circle cx="7.5" cy="15.5" r="4.5"/><path d="m10.7 12.3 9.8-9.8M16 7l3 3M19 4l2 2"/></symbol>
|
| 49 |
+
<symbol id="i-pencil" viewBox="0 0 24 24"><path d="M17 3a2.8 2.8 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5z"/></symbol>
|
| 50 |
+
<symbol id="i-trash" viewBox="0 0 24 24"><path d="M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6"/></symbol>
|
| 51 |
<symbol id="i-open" viewBox="0 0 24 24"><path d="M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></symbol>
|
| 52 |
</defs>
|
| 53 |
</svg>
|
|
|
|
| 225 |
</dialog>
|
| 226 |
|
| 227 |
<dialog id="mm" class="mm" aria-labelledby="mm-title">
|
| 228 |
+
<div class="mm-head">
|
| 229 |
+
<div>
|
| 230 |
+
<h2 id="mm-title">Model Manager</h2>
|
| 231 |
+
<p class="mm-sub">Choose the model that drives the agent. Linux always runs on this device.</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
</div>
|
| 233 |
+
<button class="icon-btn" type="button" id="mm-close" aria-label="Close"><svg><use href="#i-x"/></svg></button>
|
|
|
|
| 234 |
</div>
|
| 235 |
+
<div class="mm-summary" id="mm-active"></div>
|
| 236 |
+
<div class="mm-tabs" id="mm-tabs" role="tablist"></div>
|
| 237 |
+
<div class="mm-panel" id="mm-panel" role="tabpanel"></div>
|
| 238 |
</dialog>
|
| 239 |
|
| 240 |
<dialog id="api-edit" class="api-edit" aria-labelledby="ae-title">
|
|
|
|
| 246 |
<div class="dlg-section">
|
| 247 |
<div class="section-label">Provider</div>
|
| 248 |
<div class="providers" id="ae-providers"></div>
|
| 249 |
+
<div class="ae-chosen" id="ae-chosen"></div>
|
| 250 |
<p class="ae-base-summary" id="ae-base-summary"><span class="mono" id="ae-base-shown"></span> <button type="button" class="linkish plain" id="ae-base-edit">Change URL</button></p>
|
| 251 |
<label class="field" id="ae-base-row"><span class="field-label">Base URL</span><input id="ae-base" type="url" placeholder="https://api.example.com/v1" spellcheck="false" autocomplete="off"></label>
|
| 252 |
+
<div class="field" id="ae-key-row">
|
| 253 |
+
<span class="field-label-row"><label class="field-label" for="ae-key">API key</label><span class="ae-keylink" id="ae-keylink"></span></span>
|
| 254 |
+
<input id="ae-key" type="password" spellcheck="false" autocomplete="off">
|
| 255 |
+
</div>
|
| 256 |
<div class="field">
|
| 257 |
<span class="field-label">Model ID</span>
|
| 258 |
<div class="field-inline">
|
js/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
// Central configuration. Everything that pins a version or a location lives here.
|
| 2 |
-
export const APP_VERSION = "0.6.
|
| 3 |
|
| 4 |
// --- Local language models (loaded from the Hugging Face Hub, cached in Cache Storage) ---
|
| 5 |
// Each runs on WebGPU through transformers.js. `chunks` is how many external weight files
|
|
@@ -10,15 +10,16 @@ export const APP_VERSION = "0.6.0";
|
|
| 10 |
// textConfig: load config.json's text_config as the model config,
|
| 11 |
// chatTemplateFile: the chat template lives in chat_template.jinja,
|
| 12 |
// emptyInputs: required graph inputs to feed as empty tensors ({name: [type, dims]}).
|
|
|
|
| 13 |
export const MODEL_DEVICE = "webgpu";
|
| 14 |
export const LOCAL_MODELS = [
|
| 15 |
{
|
| 16 |
-
id: "lfm3-1.7b", label: "LFM3 1.7B", repo: "LiquidAI/LFM3-1.7B-ONNX", dtype: "q4f16", chunks: 1,
|
| 17 |
bytes: 1_383_000_000, contextMax: 262_144, thinking: true, by: "Liquid AI", license: "LFM Open License",
|
| 18 |
note: "The default. Fast hybrid model, good at tool use.",
|
| 19 |
},
|
| 20 |
{
|
| 21 |
-
id: "lfm3-omni-2b", label: "LFM3 Omni 2B", repo: "LiquidAI/LFM3-Omni-2B-ONNX", dtype: "q4f16", chunks: 1,
|
| 22 |
file: "decoder", textConfig: true, chatTemplateFile: true,
|
| 23 |
emptyInputs: {
|
| 24 |
image_features: ["float32", [0, 2048]], video_features: ["float32", [0, 2048]],
|
|
@@ -28,22 +29,22 @@ export const LOCAL_MODELS = [
|
|
| 28 |
note: "The language part of Liquid AI's omni model: bigger than LFM3 1.7B, so stronger but slower. Text only here; its image and audio parts aren't downloaded.",
|
| 29 |
},
|
| 30 |
{
|
| 31 |
-
id: "qwen3.5-0.8b", label: "Qwen3.5 0.8B", repo: "onnx-community/Qwen3.5-0.8B-Text-ONNX", dtype: "q4f16", chunks: 1,
|
| 32 |
bytes: 470_000_000, contextMax: 262_144, thinking: true, by: "Qwen", license: "Apache-2.0",
|
| 33 |
note: "Smallest download and GPU memory use. Best chance on weak GPUs and phones; less capable.",
|
| 34 |
},
|
| 35 |
{
|
| 36 |
-
id: "qwen3-1.7b", label: "Qwen3 1.7B", repo: "onnx-community/Qwen3-1.7B-ONNX", dtype: "q4f16", chunks: 0,
|
| 37 |
bytes: 1_426_000_000, contextMax: 40_960, thinking: true, by: "Qwen", license: "Apache-2.0",
|
| 38 |
note: "Similar size to LFM3, strong reasoning.",
|
| 39 |
},
|
| 40 |
{
|
| 41 |
-
id: "granite-4.0-1b", label: "Granite 4.0 1B", repo: "onnx-community/granite-4.0-1b-ONNX-web", dtype: "q4f16", chunks: 1,
|
| 42 |
bytes: 1_247_000_000, contextMax: 131_072, thinking: false, by: "IBM", license: "Apache-2.0",
|
| 43 |
note: "Hybrid model built for tool calling. No reasoning mode.",
|
| 44 |
},
|
| 45 |
{
|
| 46 |
-
id: "qwen3-4b", label: "Qwen3 4B", repo: "onnx-community/Qwen3-4B-ONNX", dtype: "q4f16", chunks: 2,
|
| 47 |
bytes: 2_833_000_000, contextMax: 40_960, thinking: true, by: "Qwen", license: "Apache-2.0",
|
| 48 |
note: "Most capable, but slow. Needs a desktop GPU with about 4 GB of memory.",
|
| 49 |
},
|
|
|
|
| 1 |
// Central configuration. Everything that pins a version or a location lives here.
|
| 2 |
+
export const APP_VERSION = "0.6.1";
|
| 3 |
|
| 4 |
// --- Local language models (loaded from the Hugging Face Hub, cached in Cache Storage) ---
|
| 5 |
// Each runs on WebGPU through transformers.js. `chunks` is how many external weight files
|
|
|
|
| 10 |
// textConfig: load config.json's text_config as the model config,
|
| 11 |
// chatTemplateFile: the chat template lives in chat_template.jinja,
|
| 12 |
// emptyInputs: required graph inputs to feed as empty tensors ({name: [type, dims]}).
|
| 13 |
+
// `avatar` is the maker's Hugging Face avatar in vendor/avatars/.
|
| 14 |
export const MODEL_DEVICE = "webgpu";
|
| 15 |
export const LOCAL_MODELS = [
|
| 16 |
{
|
| 17 |
+
id: "lfm3-1.7b", avatar: "liquidai", label: "LFM3 1.7B", repo: "LiquidAI/LFM3-1.7B-ONNX", dtype: "q4f16", chunks: 1,
|
| 18 |
bytes: 1_383_000_000, contextMax: 262_144, thinking: true, by: "Liquid AI", license: "LFM Open License",
|
| 19 |
note: "The default. Fast hybrid model, good at tool use.",
|
| 20 |
},
|
| 21 |
{
|
| 22 |
+
id: "lfm3-omni-2b", avatar: "liquidai", label: "LFM3 Omni 2B", repo: "LiquidAI/LFM3-Omni-2B-ONNX", dtype: "q4f16", chunks: 1,
|
| 23 |
file: "decoder", textConfig: true, chatTemplateFile: true,
|
| 24 |
emptyInputs: {
|
| 25 |
image_features: ["float32", [0, 2048]], video_features: ["float32", [0, 2048]],
|
|
|
|
| 29 |
note: "The language part of Liquid AI's omni model: bigger than LFM3 1.7B, so stronger but slower. Text only here; its image and audio parts aren't downloaded.",
|
| 30 |
},
|
| 31 |
{
|
| 32 |
+
id: "qwen3.5-0.8b", avatar: "qwen", label: "Qwen3.5 0.8B", repo: "onnx-community/Qwen3.5-0.8B-Text-ONNX", dtype: "q4f16", chunks: 1,
|
| 33 |
bytes: 470_000_000, contextMax: 262_144, thinking: true, by: "Qwen", license: "Apache-2.0",
|
| 34 |
note: "Smallest download and GPU memory use. Best chance on weak GPUs and phones; less capable.",
|
| 35 |
},
|
| 36 |
{
|
| 37 |
+
id: "qwen3-1.7b", avatar: "qwen", label: "Qwen3 1.7B", repo: "onnx-community/Qwen3-1.7B-ONNX", dtype: "q4f16", chunks: 0,
|
| 38 |
bytes: 1_426_000_000, contextMax: 40_960, thinking: true, by: "Qwen", license: "Apache-2.0",
|
| 39 |
note: "Similar size to LFM3, strong reasoning.",
|
| 40 |
},
|
| 41 |
{
|
| 42 |
+
id: "granite-4.0-1b", avatar: "ibm", label: "Granite 4.0 1B", repo: "onnx-community/granite-4.0-1b-ONNX-web", dtype: "q4f16", chunks: 1,
|
| 43 |
bytes: 1_247_000_000, contextMax: 131_072, thinking: false, by: "IBM", license: "Apache-2.0",
|
| 44 |
note: "Hybrid model built for tool calling. No reasoning mode.",
|
| 45 |
},
|
| 46 |
{
|
| 47 |
+
id: "qwen3-4b", avatar: "qwen", label: "Qwen3 4B", repo: "onnx-community/Qwen3-4B-ONNX", dtype: "q4f16", chunks: 2,
|
| 48 |
bytes: 2_833_000_000, contextMax: 40_960, thinking: true, by: "Qwen", license: "Apache-2.0",
|
| 49 |
note: "Most capable, but slow. Needs a desktop GPU with about 4 GB of memory.",
|
| 50 |
},
|
js/logos.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
// Brand logos from Simple Icons (https://simpleicons.org, v16.37.0), CC0-1.0.
|
| 2 |
-
// The marks themselves are trademarks of their owners and are shown only to identify
|
| 3 |
-
// each provider. Generated; each entry is a single 24x24 SVG path plus the brand color.
|
| 4 |
-
export const LOGOS = {
|
| 5 |
-
"anthropic": { title: "Anthropic", hex: "#191919", path: "M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z" },
|
| 6 |
-
"huggingface": { title: "Hugging Face", hex: "#FFD21E", path: "M12.025 1.13c-5.77 0-10.449 4.647-10.449 10.378 0 1.112.178 2.181.503 3.185.064-.222.203-.444.416-.577a.96.96 0 0 1 .524-.15c.293 0 .584.124.84.284.278.173.48.408.71.694.226.282.458.611.684.951v-.014c.017-.324.106-.622.264-.874s.403-.487.762-.543c.3-.047.596.06.787.203s.31.313.4.467c.15.257.212.468.233.542.01.026.653 1.552 1.657 2.54.616.605 1.01 1.223 1.082 1.912.055.537-.096 1.059-.38 1.572.637.121 1.294.187 1.967.187.657 0 1.298-.063 1.921-.178-.287-.517-.44-1.041-.384-1.581.07-.69.465-1.307 1.081-1.913 1.004-.987 1.647-2.513 1.657-2.539.021-.074.083-.285.233-.542.09-.154.208-.323.4-.467a1.08 1.08 0 0 1 .787-.203c.359.056.604.29.762.543s.247.55.265.874v.015c.225-.34.457-.67.683-.952.23-.286.432-.52.71-.694.257-.16.547-.284.84-.285a.97.97 0 0 1 .524.151c.228.143.373.388.43.625l.006.04a10.3 10.3 0 0 0 .534-3.273c0-5.731-4.678-10.378-10.449-10.378M8.327 6.583a1.5 1.5 0 0 1 .713.174 1.487 1.487 0 0 1 .617 2.013c-.183.343-.762-.214-1.102-.094-.38.134-.532.914-.917.71a1.487 1.487 0 0 1 .69-2.803m7.486 0a1.487 1.487 0 0 1 .689 2.803c-.385.204-.536-.576-.916-.71-.34-.12-.92.437-1.103.094a1.487 1.487 0 0 1 .617-2.013 1.5 1.5 0 0 1 .713-.174m-10.68 1.55a.96.96 0 1 1 0 1.921.96.96 0 0 1 0-1.92m13.838 0a.96.96 0 1 1 0 1.92.96.96 0 0 1 0-1.92M8.489 11.458c.588.01 1.965 1.157 3.572 1.164 1.607-.007 2.984-1.155 3.572-1.164.196-.003.305.12.305.454 0 .886-.424 2.328-1.563 3.202-.22-.756-1.396-1.366-1.63-1.32q-.011.001-.02.006l-.044.026-.01.008-.03.024q-.018.017-.035.036l-.032.04a1 1 0 0 0-.058.09l-.014.025q-.049.088-.11.19a1 1 0 0 1-.083.116 1.2 1.2 0 0 1-.173.18q-.035.029-.075.058a1.3 1.3 0 0 1-.251-.243 1 1 0 0 1-.076-.107c-.124-.193-.177-.363-.337-.444-.034-.016-.104-.008-.2.022q-.094.03-.216.087-.06.028-.125.063l-.13.074q-.067.04-.136.086a3 3 0 0 0-.135.096 3 3 0 0 0-.26.219 2 2 0 0 0-.12.121 2 2 0 0 0-.106.128l-.002.002a2 2 0 0 0-.09.132l-.001.001a1.2 1.2 0 0 0-.105.212q-.013.036-.024.073c-1.139-.875-1.563-2.317-1.563-3.203 0-.334.109-.457.305-.454m.836 10.354c.824-1.19.766-2.082-.365-3.194-1.13-1.112-1.789-2.738-1.789-2.738s-.246-.945-.806-.858-.97 1.499.202 2.362c1.173.864-.233 1.45-.685.64-.45-.812-1.683-2.896-2.322-3.295s-1.089-.175-.938.647 2.822 2.813 2.562 3.244-1.176-.506-1.176-.506-2.866-2.567-3.49-1.898.473 1.23 2.037 2.16c1.564.932 1.686 1.178 1.464 1.53s-3.675-2.511-4-1.297c-.323 1.214 3.524 1.567 3.287 2.405-.238.839-2.71-1.587-3.216-.642-.506.946 3.49 2.056 3.522 2.064 1.29.33 4.568 1.028 5.713-.624m5.349 0c-.824-1.19-.766-2.082.365-3.194 1.13-1.112 1.789-2.738 1.789-2.738s.246-.945.806-.858.97 1.499-.202 2.362c-1.173.864.233 1.45.685.64.451-.812 1.683-2.896 2.322-3.295s1.089-.175.938.647-2.822 2.813-2.562 3.244 1.176-.506 1.176-.506 2.866-2.567 3.49-1.898-.473 1.23-2.037 2.16c-1.564.932-1.686 1.178-1.464 1.53s3.675-2.511 4-1.297c.323 1.214-3.524 1.567-3.287 2.405.238.839 2.71-1.587 3.216-.642.506.946-3.49 2.056-3.522 2.064-1.29.33-4.568 1.028-5.713-.624" },
|
| 7 |
-
"openrouter": { title: "OpenRouter", hex: "#94A3B8", path: "M16.778 1.844v1.919q-.569-.026-1.138-.032-.708-.008-1.415.037c-1.93.126-4.023.728-6.149 2.237-2.911 2.066-2.731 1.95-4.14 2.75-.396.223-1.342.574-2.185.798-.841.225-1.753.333-1.751.333v4.229s.768.108 1.61.333c.842.224 1.789.575 2.185.799 1.41.798 1.228.683 4.14 2.75 2.126 1.509 4.22 2.11 6.148 2.236.88.058 1.716.041 2.555.005v1.918l7.222-4.168-7.222-4.17v2.176c-.86.038-1.611.065-2.278.021-1.364-.09-2.417-.357-3.979-1.465-2.244-1.593-2.866-2.027-3.68-2.508.889-.518 1.449-.906 3.822-2.59 1.56-1.109 2.614-1.377 3.978-1.466.667-.044 1.418-.017 2.278.02v2.176L24 6.014Z" },
|
| 8 |
-
"mistralai": { title: "Mistral AI", hex: "#FA520F", path: "M17.143 3.429v3.428h-3.429v3.429h-3.428V6.857H6.857V3.43H3.43v13.714H0v3.428h10.286v-3.428H6.857v-3.429h3.429v3.429h3.429v-3.429h3.428v3.429h-3.428v3.428H24v-3.428h-3.43V3.429z" },
|
| 9 |
-
"googlegemini": { title: "Google Gemini", hex: "#8E75B2", path: "M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81" },
|
| 10 |
-
"deepseek": { title: "DeepSeek", hex: "#5786FE", path: "M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45" },
|
| 11 |
-
"ollama": { title: "Ollama", hex: "#000000", path: "M16.361 10.26a.894.894 0 0 0-.558.47l-.072.148.001.207c0 .193.004.217.059.353.076.193.152.312.291.448.24.238.51.3.872.205a.86.86 0 0 0 .517-.436.752.752 0 0 0 .08-.498c-.064-.453-.33-.782-.724-.897a1.06 1.06 0 0 0-.466 0zm-9.203.005c-.305.096-.533.32-.65.639a1.187 1.187 0 0 0-.06.52c.057.309.31.59.598.667.362.095.632.033.872-.205.14-.136.215-.255.291-.448.055-.136.059-.16.059-.353l.001-.207-.072-.148a.894.894 0 0 0-.565-.472 1.02 1.02 0 0 0-.474.007Zm4.184 2c-.131.071-.223.25-.195.383.031.143.157.288.353.407.105.063.112.072.117.136.004.038-.01.146-.029.243-.02.094-.036.194-.036.222.002.074.07.195.143.253.064.052.076.054.255.059.164.005.198.001.264-.03.169-.082.212-.234.15-.525-.052-.243-.042-.28.087-.355.137-.08.281-.219.324-.314a.365.365 0 0 0-.175-.48.394.394 0 0 0-.181-.033c-.126 0-.207.03-.355.124l-.085.053-.053-.032c-.219-.13-.259-.145-.391-.143a.396.396 0 0 0-.193.032zm.39-2.195c-.373.036-.475.05-.654.086-.291.06-.68.195-.951.328-.94.46-1.589 1.226-1.787 2.114-.04.176-.045.234-.045.53 0 .294.005.357.043.524.264 1.16 1.332 2.017 2.714 2.173.3.033 1.596.033 1.896 0 1.11-.125 2.064-.727 2.493-1.571.114-.226.169-.372.22-.602.039-.167.044-.23.044-.523 0-.297-.005-.355-.045-.531-.288-1.29-1.539-2.304-3.072-2.497a6.873 6.873 0 0 0-.855-.031zm.645.937a3.283 3.283 0 0 1 1.44.514c.223.148.537.458.671.662.166.251.26.508.303.82.02.143.01.251-.043.482-.08.345-.332.705-.672.957a3.115 3.115 0 0 1-.689.348c-.382.122-.632.144-1.525.138-.582-.006-.686-.01-.853-.042-.57-.107-1.022-.334-1.35-.68-.264-.28-.385-.535-.45-.946-.03-.192.025-.509.137-.776.136-.326.488-.73.836-.963.403-.269.934-.46 1.422-.512.187-.02.586-.02.773-.002zm-5.503-11a1.653 1.653 0 0 0-.683.298C5.617.74 5.173 1.666 4.985 2.819c-.07.436-.119 1.04-.119 1.503 0 .544.064 1.24.155 1.721.02.107.031.202.023.208a8.12 8.12 0 0 1-.187.152 5.324 5.324 0 0 0-.949 1.02 5.49 5.49 0 0 0-.94 2.339 6.625 6.625 0 0 0-.023 1.357c.091.78.325 1.438.727 2.04l.13.195-.037.064c-.269.452-.498 1.105-.605 1.732-.084.496-.095.629-.095 1.294 0 .67.009.803.088 1.266.095.555.288 1.143.503 1.534.071.128.243.393.264.407.007.003-.014.067-.046.141a7.405 7.405 0 0 0-.548 1.873c-.062.417-.071.552-.071.991 0 .56.031.832.148 1.279L3.42 24h1.478l-.05-.091c-.297-.552-.325-1.575-.068-2.597.117-.472.25-.819.498-1.296l.148-.29v-.177c0-.165-.003-.184-.057-.293a.915.915 0 0 0-.194-.25 1.74 1.74 0 0 1-.385-.543c-.424-.92-.506-2.286-.208-3.451.124-.486.329-.918.544-1.154a.787.787 0 0 0 .223-.531c0-.195-.07-.355-.224-.522a3.136 3.136 0 0 1-.817-1.729c-.14-.96.114-2.005.69-2.834.563-.814 1.353-1.336 2.237-1.475.199-.033.57-.028.776.01.226.04.367.028.512-.041.179-.085.268-.19.374-.431.093-.215.165-.333.36-.576.234-.29.46-.489.822-.729.413-.27.884-.467 1.352-.561.17-.035.25-.04.569-.04.319 0 .398.005.569.04a4.07 4.07 0 0 1 1.914.997c.117.109.398.457.488.602.034.057.095.177.132.267.105.241.195.346.374.43.14.068.286.082.503.045.343-.058.607-.053.943.016 1.144.23 2.14 1.173 2.581 2.437.385 1.108.276 2.267-.296 3.153-.097.15-.193.27-.333.419-.301.322-.301.722-.001 1.053.493.539.801 1.866.708 3.036-.062.772-.26 1.463-.533 1.854a2.096 2.096 0 0 1-.224.258.916.916 0 0 0-.194.25c-.054.109-.057.128-.057.293v.178l.148.29c.248.476.38.823.498 1.295.253 1.008.231 2.01-.059 2.581a.845.845 0 0 0-.044.098c0 .006.329.009.732.009h.73l.02-.074.036-.134c.019-.076.057-.3.088-.516.029-.217.029-1.016 0-1.258-.11-.875-.295-1.57-.597-2.226-.032-.074-.053-.138-.046-.141.008-.005.057-.074.108-.152.376-.569.607-1.284.724-2.228.031-.26.031-1.378 0-1.628-.083-.645-.182-1.082-.348-1.525a6.083 6.083 0 0 0-.329-.7l-.038-.064.131-.194c.402-.604.636-1.262.727-2.04a6.625 6.625 0 0 0-.024-1.358 5.512 5.512 0 0 0-.939-2.339 5.325 5.325 0 0 0-.95-1.02 8.097 8.097 0 0 1-.186-.152.692.692 0 0 1 .023-.208c.208-1.087.201-2.443-.017-3.503-.19-.924-.535-1.658-.98-2.082-.354-.338-.716-.482-1.15-.455-.996.059-1.8 1.205-2.116 3.01a6.805 6.805 0 0 0-.097.726c0 .036-.007.066-.015.066a.96.96 0 0 1-.149-.078A4.857 4.857 0 0 0 12 3.03c-.832 0-1.687.243-2.456.698a.958.958 0 0 1-.148.078c-.008 0-.015-.03-.015-.066a6.71 6.71 0 0 0-.097-.725C8.997 1.392 8.337.319 7.46.048a2.096 2.096 0 0 0-.585-.041Zm.293 1.402c.248.197.523.759.682 1.388.03.113.06.244.069.292.007.047.026.152.041.233.067.365.098.76.102 1.24l.002.475-.12.175-.118.178h-.278c-.324 0-.646.041-.954.124l-.238.06c-.033.007-.038-.003-.057-.144a8.438 8.438 0 0 1 .016-2.323c.124-.788.413-1.501.696-1.711.067-.05.079-.049.157.013zm9.825-.012c.17.126.358.46.498.888.28.854.36 2.028.212 3.145-.019.14-.024.151-.057.144l-.238-.06a3.693 3.693 0 0 0-.954-.124h-.278l-.119-.178-.119-.175.002-.474c.004-.669.066-1.19.214-1.772.157-.623.434-1.185.68-1.382.078-.062.09-.063.159-.012z" },
|
| 12 |
-
"lmstudio": { title: "LM Studio", hex: "#000000", path: "M14.025 0c3.492 0 5.237 0 6.571.68a6.24 6.24 0 0 1 2.725 2.724C24 4.738 24 6.484 24 9.975v4.05c0 3.492 0 5.237-.68 6.571a6.24 6.24 0 0 1-2.724 2.725c-1.334.679-3.08.679-6.571.679h-4.05c-3.492 0-5.237 0-6.571-.68A6.24 6.24 0 0 1 .68 20.597C0 19.262 0 17.516 0 14.025v-4.05c0-3.492 0-5.237.68-6.571A6.23 6.23 0 0 1 3.404.68C4.738 0 6.484 0 9.975 0zM7.688 16.313a1.313 1.313 0 0 0 0 2.625h11.625a1.313 1.313 0 0 0 0-2.625zm-3-3.75a1.313 1.313 0 0 0 0 2.624h11.625a1.313 1.313 0 0 0 0-2.624zm3-3.75a1.313 1.313 0 0 0 0 2.624h11.625a1.313 1.313 0 0 0 0-2.624zm-3-3.75a1.313 1.313 0 0 0 0 2.625h11.625a1.313 1.313 0 0 0 0-2.625z" },
|
| 13 |
-
"perplexity": { title: "Perplexity", hex: "#1FB8CD", path: "M22.3977 7.0896h-2.3106V.0676l-7.5094 6.3542V.1577h-1.1554v6.1966L4.4904 0v7.0896H1.6023v10.3976h2.8882V24l6.932-6.3591v6.2005h1.1554v-6.0469l6.9318 6.1807v-6.4879h2.8882V7.0896zm-3.4657-4.531v4.531h-5.355l5.355-4.531zm-13.2862.0676 4.8691 4.4634H5.6458V2.6262zM2.7576 16.332V8.245h7.8476l-6.1149 6.1147v1.9723H2.7576zm2.8882 5.0404v-3.8852h.0001v-2.6488l5.7763-5.7764v7.0111l-5.7764 5.2993zm12.7086.0248-5.7766-5.1509V9.0618l5.7766 5.7766v6.5588zm2.8882-5.0652h-1.733v-1.9723L13.3948 8.245h7.8478v8.087z" },
|
| 14 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/main.js
CHANGED
|
@@ -2,7 +2,7 @@ import { DEFAULTS, MODEL_DEVICE, APP_VERSION, LOCAL_MODELS, findModel } from "./
|
|
| 2 |
import * as setup from "./setup.js";
|
| 3 |
import { LLM } from "./llm.js";
|
| 4 |
import { RemoteLLM, findPreset, loadApiKey, migrateLegacyKey } from "./remote-llm.js";
|
| 5 |
-
import { createModelManager } from "./model-manager.js";
|
| 6 |
import { VM } from "./vm.js";
|
| 7 |
import { Agent } from "./agent.js";
|
| 8 |
import { renderMarkdown } from "./markdown.js";
|
|
@@ -421,7 +421,8 @@ function retryLocalModel() {
|
|
| 421 |
}
|
| 422 |
|
| 423 |
function setBackendLabels() {
|
| 424 |
-
|
|
|
|
| 425 |
$("#gpu-name").textContent = usingApi() ? "API" : activeLocal() ? (MODEL_DEVICE === "webgpu" ? "WebGPU" : MODEL_DEVICE) : "";
|
| 426 |
$("#gpu-name").hidden = !settings.activeModel;
|
| 427 |
}
|
|
@@ -746,7 +747,7 @@ $("#set-model").addEventListener("click", () => { dlg.close(); models.open(); })
|
|
| 746 |
|
| 747 |
// ---------- Model Manager ----------
|
| 748 |
const models = createModelManager({
|
| 749 |
-
settings, saveSettings, h, fmtBytes, setup,
|
| 750 |
activate: activateModel,
|
| 751 |
isActive,
|
| 752 |
isMobile,
|
|
|
|
| 2 |
import * as setup from "./setup.js";
|
| 3 |
import { LLM } from "./llm.js";
|
| 4 |
import { RemoteLLM, findPreset, loadApiKey, migrateLegacyKey } from "./remote-llm.js";
|
| 5 |
+
import { createModelManager, avatarTile } from "./model-manager.js";
|
| 6 |
import { VM } from "./vm.js";
|
| 7 |
import { Agent } from "./agent.js";
|
| 8 |
import { renderMarkdown } from "./markdown.js";
|
|
|
|
| 421 |
}
|
| 422 |
|
| 423 |
function setBackendLabels() {
|
| 424 |
+
const av = activeApi() ? findPreset(activeApi().preset).avatar : activeLocal()?.avatar;
|
| 425 |
+
$("#model-name").replaceChildren(...(settings.activeModel ? [avatarTile(av, "xs", icon("plus"))] : []), h("span", {}, activeLabel()));
|
| 426 |
$("#gpu-name").textContent = usingApi() ? "API" : activeLocal() ? (MODEL_DEVICE === "webgpu" ? "WebGPU" : MODEL_DEVICE) : "";
|
| 427 |
$("#gpu-name").hidden = !settings.activeModel;
|
| 428 |
}
|
|
|
|
| 747 |
|
| 748 |
// ---------- Model Manager ----------
|
| 749 |
const models = createModelManager({
|
| 750 |
+
settings, saveSettings, h, icon, fmtBytes, setup,
|
| 751 |
activate: activateModel,
|
| 752 |
isActive,
|
| 753 |
isMobile,
|
js/model-manager.js
CHANGED
|
@@ -1,37 +1,27 @@
|
|
| 1 |
// The Model Manager: one place to download, remove and switch local models, and to add,
|
| 2 |
// edit, test and switch between any number of API models.
|
| 3 |
import { LOCAL_MODELS } from "./config.js";
|
| 4 |
-
import { LOGOS } from "./logos.js";
|
| 5 |
import { API_PRESETS, findPreset, RemoteLLM, loadApiKey, saveApiKey, deleteApiKey, apiKeyRemembered } from "./remote-llm.js";
|
| 6 |
|
| 7 |
-
const
|
| 8 |
|
| 9 |
-
/
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
export function
|
| 14 |
const tile = document.createElement("span");
|
| 15 |
-
tile.className =
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
path.setAttribute("d", l.path);
|
| 24 |
-
// Near-black marks follow the text color so they stay visible in dark mode.
|
| 25 |
-
const dark = parseInt(l.hex.slice(1), 16) < 0x333333;
|
| 26 |
-
path.setAttribute("fill", dark ? "currentColor" : l.hex);
|
| 27 |
-
svg.append(path);
|
| 28 |
-
tile.append(svg);
|
| 29 |
} else {
|
| 30 |
-
|
| 31 |
-
tile.
|
| 32 |
-
tile.style.background = m.bg;
|
| 33 |
-
tile.textContent = m.text;
|
| 34 |
-
if (m.text.length > 2) tile.classList.add("small-text");
|
| 35 |
}
|
| 36 |
return tile;
|
| 37 |
}
|
|
@@ -40,19 +30,25 @@ const newId = () => "api-" + Math.random().toString(36).slice(2, 10);
|
|
| 40 |
const hostOf = (url) => { try { return new URL(url).host; } catch { return url; } };
|
| 41 |
|
| 42 |
/**
|
| 43 |
-
* deps: { settings, saveSettings, h, fmtBytes, setup, activate(sel) -> Promise,
|
| 44 |
-
*
|
| 45 |
*/
|
| 46 |
export function createModelManager(deps) {
|
| 47 |
-
const { settings, saveSettings, h, fmtBytes, setup } = deps;
|
| 48 |
const dlg = document.getElementById("mm");
|
| 49 |
const editDlg = document.getElementById("api-edit");
|
| 50 |
const downloads = new Map(); // model id -> { loaded, total, ctrl, error }
|
| 51 |
const cached = new Map(); // model id -> bytes in Cache Storage
|
| 52 |
let busy = null; // id being activated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
// ---------- manager ----------
|
| 55 |
-
async function open() {
|
|
|
|
| 56 |
render();
|
| 57 |
if (!dlg.open) dlg.showModal();
|
| 58 |
await refreshCached();
|
|
@@ -68,79 +64,135 @@ export function createModelManager(deps) {
|
|
| 68 |
const isDownloaded = (m) => (cached.get(m.id) ?? 0) > 0;
|
| 69 |
|
| 70 |
function render() {
|
| 71 |
-
|
| 72 |
-
const
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
|
|
|
|
|
|
| 79 |
const gpu = deps.gpuNote();
|
| 80 |
-
|
| 81 |
-
gpu && !gpu.ok ? h("
|
| 82 |
-
deps.isMobile() ? h("
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
...(settings.apiModels.length ? settings.apiModels.map(apiRow)
|
| 87 |
-
: [h("p", { class: "mm-empty" }, "No API models yet. Add one to use OpenAI, Anthropic, Gemini, OpenRouter, Hugging Face and more. Linux still runs on this device.")]),
|
| 88 |
-
);
|
| 89 |
}
|
| 90 |
|
| 91 |
-
function
|
| 92 |
const sel = { kind: "local", id: m.id };
|
| 93 |
const d = downloads.get(m.id);
|
| 94 |
const inUse = deps.isActive(sel);
|
| 95 |
const have = isDownloaded(m);
|
| 96 |
-
const
|
| 97 |
-
|
| 98 |
-
!m.thinking ? h("span", { class: "mo-tag" }, "No reasoning") : null,
|
| 99 |
-
inUse ? h("span", { class: "mo-tag on" }, "In use") : null,
|
| 100 |
-
];
|
| 101 |
let actions;
|
| 102 |
-
if (
|
| 103 |
-
|
| 104 |
-
actions = [
|
| 105 |
-
h("span", { class: "mm-progress-text" }, `${pct}% · ${fmtBytes(d.loaded)} of ${fmtBytes(d.total)}`),
|
| 106 |
-
h("button", { class: "btn small", type: "button", onclick: () => d.ctrl.abort() }, "Cancel"),
|
| 107 |
-
];
|
| 108 |
} else if (have) {
|
| 109 |
actions = [
|
| 110 |
-
inUse ?
|
| 111 |
-
|
|
|
|
| 112 |
];
|
| 113 |
} else {
|
| 114 |
-
actions = [h("button", { class: "btn small primary", type: "button", onclick: () => download(m) },
|
| 115 |
}
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
h("div", { class: "
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
}
|
| 127 |
|
| 128 |
-
function
|
| 129 |
const p = findPreset(a.preset);
|
| 130 |
const sel = { kind: "api", id: a.id };
|
| 131 |
const inUse = deps.isActive(sel);
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
h("div", { class: "
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
}
|
| 143 |
|
|
|
|
| 144 |
async function use(sel) {
|
| 145 |
busy = sel.id;
|
| 146 |
render();
|
|
@@ -154,22 +206,22 @@ export function createModelManager(deps) {
|
|
| 154 |
const d = { loaded: 0, total: m.bytes, ctrl, error: null };
|
| 155 |
downloads.set(m.id, d);
|
| 156 |
render();
|
| 157 |
-
let
|
| 158 |
try {
|
| 159 |
await setup.requestPersistence();
|
| 160 |
await setup.downloadModel(m, {
|
| 161 |
signal: ctrl.signal,
|
| 162 |
onProgress: (loaded, total) => {
|
| 163 |
d.loaded = loaded; d.total = total;
|
| 164 |
-
const row = dlg.querySelector(`[data-local="${m.id}"]`);
|
| 165 |
const now = performance.now();
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
|
|
|
| 173 |
},
|
| 174 |
});
|
| 175 |
downloads.delete(m.id);
|
|
@@ -229,16 +281,19 @@ export function createModelManager(deps) {
|
|
| 229 |
$e("ae-providers").replaceChildren(...API_PRESETS.map((p) => h("button", {
|
| 230 |
type: "button", class: "provider" + (p.id === preset.id ? " on" : ""), "aria-pressed": String(p.id === preset.id), title: p.label,
|
| 231 |
onclick: () => { preset = p; renderProviders(); syncPreset(true); },
|
| 232 |
-
},
|
| 233 |
}
|
| 234 |
|
| 235 |
function syncPreset(fill) {
|
| 236 |
if (fill) { $e("ae-base").value = preset.baseUrl; $e("ae-models").replaceChildren(); }
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
$e("ae-base-row").hidden = preset.id !== "custom" && !!preset.baseUrl && $e("ae-base").value === preset.baseUrl;
|
| 238 |
$e("ae-key-row").hidden = !!preset.noKey;
|
| 239 |
-
$e("ae-
|
| 240 |
-
|
| 241 |
-
preset.keysUrl ? h("a", { href: preset.keysUrl, target: "_blank", rel: "noopener" }, `Get your ${preset.label} API key`) : null);
|
| 242 |
$e("ae-base-shown").textContent = $e("ae-base").value;
|
| 243 |
$e("ae-base-summary").hidden = !$e("ae-base-row").hidden;
|
| 244 |
}
|
|
@@ -246,7 +301,7 @@ export function createModelManager(deps) {
|
|
| 246 |
const form = () => ({
|
| 247 |
baseUrl: $e("ae-base").value.trim(),
|
| 248 |
model: $e("ae-model").value.trim(),
|
| 249 |
-
key:
|
| 250 |
headers: preset.headers,
|
| 251 |
});
|
| 252 |
|
|
@@ -256,7 +311,6 @@ export function createModelManager(deps) {
|
|
| 256 |
editDlg.addEventListener("click", (e) => { if (e.target === editDlg) editDlg.close(); });
|
| 257 |
dlg.addEventListener("click", (e) => { if (e.target === dlg) dlg.close(); });
|
| 258 |
$e("mm-close").addEventListener("click", () => dlg.close());
|
| 259 |
-
$e("mm-add-api").addEventListener("click", () => openEditor(null));
|
| 260 |
|
| 261 |
$e("ae-load-models").addEventListener("click", async () => {
|
| 262 |
const f = form();
|
|
@@ -302,6 +356,7 @@ export function createModelManager(deps) {
|
|
| 302 |
saveSettings();
|
| 303 |
saveApiKey(entry.id, f.key, $e("ae-remember").checked);
|
| 304 |
editDlg.close();
|
|
|
|
| 305 |
render();
|
| 306 |
const sel = { kind: "api", id: entry.id };
|
| 307 |
// New entries are put to use; edits of the active one reconnect with the new settings.
|
|
|
|
| 1 |
// The Model Manager: one place to download, remove and switch local models, and to add,
|
| 2 |
// edit, test and switch between any number of API models.
|
| 3 |
import { LOCAL_MODELS } from "./config.js";
|
|
|
|
| 4 |
import { API_PRESETS, findPreset, RemoteLLM, loadApiKey, saveApiKey, deleteApiKey, apiKeyRemembered } from "./remote-llm.js";
|
| 5 |
|
| 6 |
+
const AVATAR_BASE = new URL("../vendor/avatars/", import.meta.url).href;
|
| 7 |
|
| 8 |
+
/**
|
| 9 |
+
* A rounded tile with an organization's Hugging Face avatar (vendor/avatars/<name>.png) on
|
| 10 |
+
* a white backing, like an app icon; without an avatar, a neutral tile with a glyph.
|
| 11 |
+
*/
|
| 12 |
+
export function avatarTile(name, size = "", glyph = null) {
|
| 13 |
const tile = document.createElement("span");
|
| 14 |
+
tile.className = `avatar ${size}`.trim();
|
| 15 |
+
if (name) {
|
| 16 |
+
const img = document.createElement("img");
|
| 17 |
+
img.src = AVATAR_BASE + name + ".png";
|
| 18 |
+
img.alt = "";
|
| 19 |
+
img.loading = "lazy";
|
| 20 |
+
img.decoding = "async";
|
| 21 |
+
tile.append(img);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
} else {
|
| 23 |
+
tile.classList.add("glyph");
|
| 24 |
+
if (glyph) tile.append(glyph);
|
|
|
|
|
|
|
|
|
|
| 25 |
}
|
| 26 |
return tile;
|
| 27 |
}
|
|
|
|
| 30 |
const hostOf = (url) => { try { return new URL(url).host; } catch { return url; } };
|
| 31 |
|
| 32 |
/**
|
| 33 |
+
* deps: { settings, saveSettings, h, icon, fmtBytes, setup, activate(sel) -> Promise,
|
| 34 |
+
* isActive(sel), gpuNote() -> {ok, text} | null, isMobile() }
|
| 35 |
*/
|
| 36 |
export function createModelManager(deps) {
|
| 37 |
+
const { settings, saveSettings, h, icon, fmtBytes, setup } = deps;
|
| 38 |
const dlg = document.getElementById("mm");
|
| 39 |
const editDlg = document.getElementById("api-edit");
|
| 40 |
const downloads = new Map(); // model id -> { loaded, total, ctrl, error }
|
| 41 |
const cached = new Map(); // model id -> bytes in Cache Storage
|
| 42 |
let busy = null; // id being activated
|
| 43 |
+
let tab = "local";
|
| 44 |
+
|
| 45 |
+
const chip = (iconName, text, cls = "") => h("span", { class: `chip ${cls}`.trim() }, iconName ? icon(iconName) : null, text);
|
| 46 |
+
const pill = (text, cls = "") => h("span", { class: `pill ${cls}`.trim() }, text);
|
| 47 |
+
const activePill = () => h("span", { class: "pill live" }, h("i", { class: "dot" }), "Active");
|
| 48 |
|
| 49 |
// ---------- manager ----------
|
| 50 |
+
async function open(which) {
|
| 51 |
+
tab = which ?? (settings.activeModel?.kind === "api" ? "api" : "local");
|
| 52 |
render();
|
| 53 |
if (!dlg.open) dlg.showModal();
|
| 54 |
await refreshCached();
|
|
|
|
| 64 |
const isDownloaded = (m) => (cached.get(m.id) ?? 0) > 0;
|
| 65 |
|
| 66 |
function render() {
|
| 67 |
+
renderSummary();
|
| 68 |
+
const downloadedCount = LOCAL_MODELS.filter(isDownloaded).length;
|
| 69 |
+
document.getElementById("mm-tabs").replaceChildren(
|
| 70 |
+
tabButton("local", "On this device", downloadedCount ? `${downloadedCount}/${LOCAL_MODELS.length}` : String(LOCAL_MODELS.length), "cpu"),
|
| 71 |
+
tabButton("api", "API models", String(settings.apiModels.length), "globe"));
|
| 72 |
+
const panel = document.getElementById("mm-panel");
|
| 73 |
+
panel.replaceChildren(...(tab === "local" ? localPanel() : apiPanel()).filter(Boolean));
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
function tabButton(id, label, count, iconName) {
|
| 77 |
+
return h("button", { type: "button", role: "tab", class: "mm-tab", "aria-selected": String(tab === id),
|
| 78 |
+
onclick: () => { tab = id; render(); } }, icon(iconName), label, h("span", { class: "count" }, count));
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
function renderSummary() {
|
| 82 |
+
const a = settings.activeModel;
|
| 83 |
+
const local = a?.kind === "local" ? LOCAL_MODELS.find((m) => m.id === a.id) : null;
|
| 84 |
+
const api = a?.kind === "api" ? settings.apiModels.find((x) => x.id === a.id) : null;
|
| 85 |
+
const el = document.getElementById("mm-active");
|
| 86 |
+
if (!local && !api) {
|
| 87 |
+
el.className = "mm-summary empty";
|
| 88 |
+
el.replaceChildren(
|
| 89 |
+
h("span", { class: "summary-icon" }, icon("cpu")),
|
| 90 |
+
h("div", {}, h("div", { class: "summary-title" }, "No model yet"),
|
| 91 |
+
h("div", { class: "summary-sub" }, "Download a model to run on your GPU, or add an API model. Then press Use.")));
|
| 92 |
+
return;
|
| 93 |
+
}
|
| 94 |
+
const p = api ? findPreset(api.preset) : null;
|
| 95 |
+
el.className = "mm-summary";
|
| 96 |
+
el.replaceChildren(
|
| 97 |
+
avatarTile(local ? local.avatar : p.avatar, "md", icon("plus")),
|
| 98 |
+
h("div", { class: "summary-text" },
|
| 99 |
+
h("div", { class: "summary-label" }, "Active model"),
|
| 100 |
+
h("div", { class: "summary-title" }, local ? local.label : api.name),
|
| 101 |
+
h("div", { class: "summary-sub" }, local ? `${local.by} · runs on this device with WebGPU` : `${p.label} API · ${api.model}`)),
|
| 102 |
+
activePill());
|
| 103 |
+
}
|
| 104 |
|
| 105 |
+
// ---------- local models ----------
|
| 106 |
+
function localPanel() {
|
| 107 |
const gpu = deps.gpuNote();
|
| 108 |
+
return [
|
| 109 |
+
gpu && !gpu.ok ? h("div", { class: "mm-banner" }, icon("alert"), h("span", {}, gpu.text)) : null,
|
| 110 |
+
deps.isMobile() ? h("div", { class: "mm-banner" }, icon("alert"), h("span", {}, "On phones, local models usually don't fit in graphics memory. Qwen3.5 0.8B is your best bet, or use an API model.")) : null,
|
| 111 |
+
h("div", { class: "mc-list" }, LOCAL_MODELS.map(localCard)),
|
| 112 |
+
h("p", { class: "mm-foot" }, "Local models run on your GPU with WebGPU and keep working offline once downloaded. Bigger models are smarter but slower and need more graphics memory."),
|
| 113 |
+
];
|
|
|
|
|
|
|
|
|
|
| 114 |
}
|
| 115 |
|
| 116 |
+
function localCard(m) {
|
| 117 |
const sel = { kind: "local", id: m.id };
|
| 118 |
const d = downloads.get(m.id);
|
| 119 |
const inUse = deps.isActive(sel);
|
| 120 |
const have = isDownloaded(m);
|
| 121 |
+
const downloading = d && !d.error;
|
| 122 |
+
|
|
|
|
|
|
|
|
|
|
| 123 |
let actions;
|
| 124 |
+
if (downloading) {
|
| 125 |
+
actions = [h("button", { class: "btn small", type: "button", onclick: () => d.ctrl.abort() }, "Cancel")];
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
} else if (have) {
|
| 127 |
actions = [
|
| 128 |
+
inUse ? activePill()
|
| 129 |
+
: h("button", { class: "btn small primary", type: "button", disabled: busy != null, onclick: () => use(sel) }, busy === m.id ? "Loading…" : "Use"),
|
| 130 |
+
h("button", { class: "icon-btn sm", type: "button", title: `Remove ${m.label}`, "aria-label": `Remove ${m.label}`, onclick: () => remove(m) }, icon("trash")),
|
| 131 |
];
|
| 132 |
} else {
|
| 133 |
+
actions = [h("button", { class: "btn small primary", type: "button", onclick: () => download(m) }, icon("download"), "Download")];
|
| 134 |
}
|
| 135 |
+
|
| 136 |
+
const pct = d?.total ? Math.round((d.loaded / d.total) * 100) : 0;
|
| 137 |
+
return h("div", { class: "mc" + (inUse ? " active" : "") + (downloading ? " busy" : ""), "data-local": m.id },
|
| 138 |
+
avatarTile(m.avatar, "lg"),
|
| 139 |
+
h("div", { class: "mc-body" },
|
| 140 |
+
h("div", { class: "mc-title" },
|
| 141 |
+
h("span", { class: "mc-name" }, m.label),
|
| 142 |
+
m.id === LOCAL_MODELS[0].id ? pill("Recommended", "accent") : null),
|
| 143 |
+
h("div", { class: "mc-by" }, `by ${m.by}`),
|
| 144 |
+
h("p", { class: "mc-note" }, m.note),
|
| 145 |
+
h("div", { class: "chips" },
|
| 146 |
+
have ? chip("check", "Downloaded", "ok") : chip("download", fmtBytes(m.bytes)),
|
| 147 |
+
chip("layers", `${Math.round(m.contextMax / 1024)}k context`),
|
| 148 |
+
chip("brain", m.thinking ? "Reasoning" : "No reasoning", m.thinking ? "" : "muted"),
|
| 149 |
+
chip(null, m.license, "muted")),
|
| 150 |
+
downloading ? h("div", { class: "mc-progress" },
|
| 151 |
+
h("div", { class: "bar" }, h("i", { style: `width:${pct}%` })),
|
| 152 |
+
h("span", { class: "mc-progress-text" }, `${pct}% · ${fmtBytes(d.loaded)} of ${fmtBytes(d.total)}`)) : null,
|
| 153 |
+
d?.error ? h("div", { class: "mc-error" }, d.error) : null),
|
| 154 |
+
h("div", { class: "mc-actions" }, actions));
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
// ---------- API models ----------
|
| 158 |
+
function apiPanel() {
|
| 159 |
+
const stack = ["openrouter", "openai", "anthropic", "google", "huggingface"];
|
| 160 |
+
const add = h("button", { type: "button", class: "add-card", onclick: () => openEditor(null) },
|
| 161 |
+
h("span", { class: "avatar-stack" }, stack.map((a) => avatarTile(a, "sm"))),
|
| 162 |
+
h("span", { class: "add-text" },
|
| 163 |
+
h("span", { class: "add-title" }, icon("plus"), "Add an API model"),
|
| 164 |
+
h("span", { class: "add-sub" }, `${API_PRESETS.length - 1} providers, from OpenAI and Anthropic to Ollama on your own computer`)));
|
| 165 |
+
return [
|
| 166 |
+
settings.apiModels.length ? h("div", { class: "mc-list" }, settings.apiModels.map(apiCard)) : null,
|
| 167 |
+
add,
|
| 168 |
+
h("p", { class: "mm-foot" }, "Only the model runs on the provider's servers: the agent needs internet, and the provider receives your messages and the command output. Linux stays on this device. Keys are sent only to their own provider."),
|
| 169 |
+
];
|
| 170 |
}
|
| 171 |
|
| 172 |
+
function apiCard(a) {
|
| 173 |
const p = findPreset(a.preset);
|
| 174 |
const sel = { kind: "api", id: a.id };
|
| 175 |
const inUse = deps.isActive(sel);
|
| 176 |
+
const keyless = !p.noKey && !loadApiKey(a.id);
|
| 177 |
+
return h("div", { class: "mc" + (inUse ? " active" : ""), "data-api": a.id },
|
| 178 |
+
avatarTile(p.avatar, "lg", icon("plus")),
|
| 179 |
+
h("div", { class: "mc-body" },
|
| 180 |
+
h("div", { class: "mc-title" }, h("span", { class: "mc-name" }, a.name)),
|
| 181 |
+
h("div", { class: "mc-by" }, `${p.label} API`),
|
| 182 |
+
h("div", { class: "chips" },
|
| 183 |
+
chip("cpu", a.model, "mono"),
|
| 184 |
+
chip("globe", hostOf(a.baseUrl), "muted"),
|
| 185 |
+
p.noKey ? null : keyless ? chip("key", "Key needed", "warn") : chip("key", apiKeyRemembered(a.id) ? "Key saved" : "Key for this tab", "muted")),
|
| 186 |
+
keyless ? h("div", { class: "mc-error" }, "The key was only kept for an earlier tab. Edit to enter it again.") : null),
|
| 187 |
+
h("div", { class: "mc-actions" },
|
| 188 |
+
inUse ? activePill()
|
| 189 |
+
: h("button", { class: "btn small primary", type: "button", disabled: busy != null, onclick: () => use(sel) }, busy === a.id ? "Connecting…" : "Use"),
|
| 190 |
+
h("span", { class: "mc-icons" },
|
| 191 |
+
h("button", { class: "icon-btn sm", type: "button", title: "Edit", "aria-label": `Edit ${a.name}`, onclick: () => openEditor(a) }, icon("pencil")),
|
| 192 |
+
h("button", { class: "icon-btn sm", type: "button", title: "Delete", "aria-label": `Delete ${a.name}`, onclick: () => removeApi(a) }, icon("trash")))));
|
| 193 |
}
|
| 194 |
|
| 195 |
+
// ---------- actions ----------
|
| 196 |
async function use(sel) {
|
| 197 |
busy = sel.id;
|
| 198 |
render();
|
|
|
|
| 206 |
const d = { loaded: 0, total: m.bytes, ctrl, error: null };
|
| 207 |
downloads.set(m.id, d);
|
| 208 |
render();
|
| 209 |
+
let lastPaint = 0;
|
| 210 |
try {
|
| 211 |
await setup.requestPersistence();
|
| 212 |
await setup.downloadModel(m, {
|
| 213 |
signal: ctrl.signal,
|
| 214 |
onProgress: (loaded, total) => {
|
| 215 |
d.loaded = loaded; d.total = total;
|
|
|
|
| 216 |
const now = performance.now();
|
| 217 |
+
const card = dlg.querySelector(`[data-local="${m.id}"]`);
|
| 218 |
+
if (!card || now - lastPaint < 100) return;
|
| 219 |
+
lastPaint = now;
|
| 220 |
+
const pct = total ? Math.round((loaded / total) * 100) : 0;
|
| 221 |
+
const bar = card.querySelector(".mc-progress .bar i");
|
| 222 |
+
if (bar) bar.style.width = pct + "%";
|
| 223 |
+
const t = card.querySelector(".mc-progress-text");
|
| 224 |
+
if (t) t.textContent = `${pct}% · ${fmtBytes(loaded)} of ${fmtBytes(total)}`;
|
| 225 |
},
|
| 226 |
});
|
| 227 |
downloads.delete(m.id);
|
|
|
|
| 281 |
$e("ae-providers").replaceChildren(...API_PRESETS.map((p) => h("button", {
|
| 282 |
type: "button", class: "provider" + (p.id === preset.id ? " on" : ""), "aria-pressed": String(p.id === preset.id), title: p.label,
|
| 283 |
onclick: () => { preset = p; renderProviders(); syncPreset(true); },
|
| 284 |
+
}, avatarTile(p.avatar, "sm", icon("plus")), h("span", {}, p.label))));
|
| 285 |
}
|
| 286 |
|
| 287 |
function syncPreset(fill) {
|
| 288 |
if (fill) { $e("ae-base").value = preset.baseUrl; $e("ae-models").replaceChildren(); }
|
| 289 |
+
$e("ae-chosen").replaceChildren(
|
| 290 |
+
avatarTile(preset.avatar, "md", icon("plus")),
|
| 291 |
+
h("div", {}, h("div", { class: "summary-title" }, preset.label),
|
| 292 |
+
h("div", { class: "summary-sub" }, preset.hint ?? (preset.noKey ? "Runs on your computer." : "OpenAI-compatible API."))));
|
| 293 |
$e("ae-base-row").hidden = preset.id !== "custom" && !!preset.baseUrl && $e("ae-base").value === preset.baseUrl;
|
| 294 |
$e("ae-key-row").hidden = !!preset.noKey;
|
| 295 |
+
$e("ae-keylink").replaceChildren(preset.keysUrl
|
| 296 |
+
? h("a", { href: preset.keysUrl, target: "_blank", rel: "noopener" }, `Get your ${preset.label} API key`, icon("open")) : "");
|
|
|
|
| 297 |
$e("ae-base-shown").textContent = $e("ae-base").value;
|
| 298 |
$e("ae-base-summary").hidden = !$e("ae-base-row").hidden;
|
| 299 |
}
|
|
|
|
| 301 |
const form = () => ({
|
| 302 |
baseUrl: $e("ae-base").value.trim(),
|
| 303 |
model: $e("ae-model").value.trim(),
|
| 304 |
+
key: $e("ae-key").value.trim(),
|
| 305 |
headers: preset.headers,
|
| 306 |
});
|
| 307 |
|
|
|
|
| 311 |
editDlg.addEventListener("click", (e) => { if (e.target === editDlg) editDlg.close(); });
|
| 312 |
dlg.addEventListener("click", (e) => { if (e.target === dlg) dlg.close(); });
|
| 313 |
$e("mm-close").addEventListener("click", () => dlg.close());
|
|
|
|
| 314 |
|
| 315 |
$e("ae-load-models").addEventListener("click", async () => {
|
| 316 |
const f = form();
|
|
|
|
| 356 |
saveSettings();
|
| 357 |
saveApiKey(entry.id, f.key, $e("ae-remember").checked);
|
| 358 |
editDlg.close();
|
| 359 |
+
tab = "api";
|
| 360 |
render();
|
| 361 |
const sel = { kind: "api", id: entry.id };
|
| 362 |
// New entries are put to use; edits of the active one reconnect with the new settings.
|
js/remote-llm.js
CHANGED
|
@@ -8,29 +8,29 @@
|
|
| 8 |
import { parseAssistant } from "./toolcalls.js";
|
| 9 |
|
| 10 |
// Providers with an OpenAI-compatible Chat Completions API that accept requests from web
|
| 11 |
-
// pages (CORS preflight checked for each). `
|
| 12 |
-
//
|
| 13 |
export const API_PRESETS = [
|
| 14 |
-
{ id: "openrouter", label: "OpenRouter", baseUrl: "https://openrouter.ai/api/v1",
|
| 15 |
hint: "Hundreds of models from every major lab behind one key." },
|
| 16 |
-
{ id: "openai", label: "OpenAI", baseUrl: "https://api.openai.com/v1",
|
| 17 |
-
{ id: "anthropic", label: "Anthropic", baseUrl: "https://api.anthropic.com/v1",
|
| 18 |
headers: { "anthropic-dangerous-direct-browser-access": "true" }, hint: "Uses Anthropic's OpenAI-compatible endpoint." },
|
| 19 |
-
{ id: "gemini", label: "Google Gemini", baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai",
|
| 20 |
-
{ id: "huggingface", label: "Hugging Face", baseUrl: "https://router.huggingface.co/v1",
|
| 21 |
hint: "Inference Providers: open models from many hosts. Use a token with the Inference permission." },
|
| 22 |
-
{ id: "groq", label: "Groq", baseUrl: "https://api.groq.com/openai/v1",
|
| 23 |
-
{ id: "mistral", label: "Mistral AI", baseUrl: "https://api.mistral.ai/v1",
|
| 24 |
-
{ id: "deepseek", label: "DeepSeek", baseUrl: "https://api.deepseek.com/v1",
|
| 25 |
-
{ id: "xai", label: "xAI", baseUrl: "https://api.x.ai/v1",
|
| 26 |
-
{ id: "together", label: "Together AI", baseUrl: "https://api.together.xyz/v1",
|
| 27 |
-
{ id: "fireworks", label: "Fireworks AI", baseUrl: "https://api.fireworks.ai/inference/v1",
|
| 28 |
-
{ id: "cerebras", label: "Cerebras", baseUrl: "https://api.cerebras.ai/v1",
|
| 29 |
-
{ id: "ollama", label: "Ollama", baseUrl: "http://localhost:11434/v1",
|
| 30 |
hint: "Runs on your computer. Start it with OLLAMA_ORIGINS set to this page's address; Chrome may ask to allow access to local devices." },
|
| 31 |
-
{ id: "lmstudio", label: "LM Studio", baseUrl: "http://localhost:1234/v1",
|
| 32 |
hint: "Runs on your computer. Turn on CORS in LM Studio's server settings; Chrome may ask to allow access to local devices." },
|
| 33 |
-
{ id: "custom", label: "Other", baseUrl: "",
|
| 34 |
];
|
| 35 |
export const findPreset = (id) => API_PRESETS.find((p) => p.id === id) ?? API_PRESETS[API_PRESETS.length - 1];
|
| 36 |
|
|
|
|
| 8 |
import { parseAssistant } from "./toolcalls.js";
|
| 9 |
|
| 10 |
// Providers with an OpenAI-compatible Chat Completions API that accept requests from web
|
| 11 |
+
// pages (CORS preflight checked for each). `avatar` is the provider's Hugging Face avatar
|
| 12 |
+
// in vendor/avatars/ (none for "Other").
|
| 13 |
export const API_PRESETS = [
|
| 14 |
+
{ id: "openrouter", label: "OpenRouter", baseUrl: "https://openrouter.ai/api/v1", avatar: "openrouter", keysUrl: "https://openrouter.ai/keys",
|
| 15 |
hint: "Hundreds of models from every major lab behind one key." },
|
| 16 |
+
{ id: "openai", label: "OpenAI", baseUrl: "https://api.openai.com/v1", avatar: "openai", keysUrl: "https://platform.openai.com/api-keys" },
|
| 17 |
+
{ id: "anthropic", label: "Anthropic", baseUrl: "https://api.anthropic.com/v1", avatar: "anthropic", keysUrl: "https://console.anthropic.com/settings/keys",
|
| 18 |
headers: { "anthropic-dangerous-direct-browser-access": "true" }, hint: "Uses Anthropic's OpenAI-compatible endpoint." },
|
| 19 |
+
{ id: "gemini", label: "Google Gemini", baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai", avatar: "google", keysUrl: "https://aistudio.google.com/apikey" },
|
| 20 |
+
{ id: "huggingface", label: "Hugging Face", baseUrl: "https://router.huggingface.co/v1", avatar: "huggingface", keysUrl: "https://huggingface.co/settings/tokens",
|
| 21 |
hint: "Inference Providers: open models from many hosts. Use a token with the Inference permission." },
|
| 22 |
+
{ id: "groq", label: "Groq", baseUrl: "https://api.groq.com/openai/v1", avatar: "groq", keysUrl: "https://console.groq.com/keys" },
|
| 23 |
+
{ id: "mistral", label: "Mistral AI", baseUrl: "https://api.mistral.ai/v1", avatar: "mistral", keysUrl: "https://console.mistral.ai/api-keys" },
|
| 24 |
+
{ id: "deepseek", label: "DeepSeek", baseUrl: "https://api.deepseek.com/v1", avatar: "deepseek", keysUrl: "https://platform.deepseek.com/api_keys" },
|
| 25 |
+
{ id: "xai", label: "xAI", baseUrl: "https://api.x.ai/v1", avatar: "xai", keysUrl: "https://console.x.ai" },
|
| 26 |
+
{ id: "together", label: "Together AI", baseUrl: "https://api.together.xyz/v1", avatar: "together", keysUrl: "https://api.together.ai/settings/api-keys" },
|
| 27 |
+
{ id: "fireworks", label: "Fireworks AI", baseUrl: "https://api.fireworks.ai/inference/v1", avatar: "fireworks", keysUrl: "https://fireworks.ai/account/api-keys" },
|
| 28 |
+
{ id: "cerebras", label: "Cerebras", baseUrl: "https://api.cerebras.ai/v1", avatar: "cerebras", keysUrl: "https://cloud.cerebras.ai" },
|
| 29 |
+
{ id: "ollama", label: "Ollama", baseUrl: "http://localhost:11434/v1", avatar: "ollama", noKey: true,
|
| 30 |
hint: "Runs on your computer. Start it with OLLAMA_ORIGINS set to this page's address; Chrome may ask to allow access to local devices." },
|
| 31 |
+
{ id: "lmstudio", label: "LM Studio", baseUrl: "http://localhost:1234/v1", avatar: "lmstudio", noKey: true,
|
| 32 |
hint: "Runs on your computer. Turn on CORS in LM Studio's server settings; Chrome may ask to allow access to local devices." },
|
| 33 |
+
{ id: "custom", label: "Other", baseUrl: "", hint: "Any OpenAI-compatible Chat Completions API." },
|
| 34 |
];
|
| 35 |
export const findPreset = (id) => API_PRESETS.find((p) => p.id === id) ?? API_PRESETS[API_PRESETS.length - 1];
|
| 36 |
|
sw.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
// (__vm__/disk.ext2), backed by the chunks the setup screen stored in Cache Storage.
|
| 7 |
// 4. Adds the cross-origin isolation headers (COOP/COEP) that SharedArrayBuffer,
|
| 8 |
// CheerpX and multi-threaded WASM need, even when a host forgets to send them.
|
| 9 |
-
const SHELL_VERSION = "lwa-shell-0.6.
|
| 10 |
const CX_ORIGIN = "https://cxrtnc.leaningtech.com";
|
| 11 |
const CX_CACHE_PREFIX = "lwa-cheerpx-";
|
| 12 |
const DISK_CACHE = "lwa-disk";
|
|
@@ -18,10 +18,11 @@ const chunkKey = (i) => SCOPE + "__vm__/chunk/" + i;
|
|
| 18 |
const SHELL_FILES = [
|
| 19 |
"./", "index.html", "css/app.css", "icon.svg",
|
| 20 |
"js/config.js", "js/config-defaults.js", "js/main.js", "js/setup.js", "js/vm.js", "js/agent.js", "js/llm.js",
|
| 21 |
-
"js/llm-worker.js", "js/llm-engine.js", "js/lazy-weights.js", "js/remote-llm.js", "js/model-manager.js", "js/
|
| 22 |
"vendor/transformers.min.js", "vendor/highlight.min.js",
|
| 23 |
"vendor/ort/ort-wasm-simd-threaded.asyncify.mjs", "vendor/ort/ort-wasm-simd-threaded.asyncify.wasm",
|
| 24 |
"vendor/xterm/xterm.mjs", "vendor/xterm/xterm.css", "vendor/xterm/addon-fit.mjs",
|
|
|
|
| 25 |
"vendor/fonts/inter-latin.woff2", "vendor/fonts/inter-latin-ext.woff2", "vendor/fonts/jetbrains-mono-latin.woff2",
|
| 26 |
];
|
| 27 |
|
|
|
|
| 6 |
// (__vm__/disk.ext2), backed by the chunks the setup screen stored in Cache Storage.
|
| 7 |
// 4. Adds the cross-origin isolation headers (COOP/COEP) that SharedArrayBuffer,
|
| 8 |
// CheerpX and multi-threaded WASM need, even when a host forgets to send them.
|
| 9 |
+
const SHELL_VERSION = "lwa-shell-0.6.1";
|
| 10 |
const CX_ORIGIN = "https://cxrtnc.leaningtech.com";
|
| 11 |
const CX_CACHE_PREFIX = "lwa-cheerpx-";
|
| 12 |
const DISK_CACHE = "lwa-disk";
|
|
|
|
| 18 |
const SHELL_FILES = [
|
| 19 |
"./", "index.html", "css/app.css", "icon.svg",
|
| 20 |
"js/config.js", "js/config-defaults.js", "js/main.js", "js/setup.js", "js/vm.js", "js/agent.js", "js/llm.js",
|
| 21 |
+
"js/llm-worker.js", "js/llm-engine.js", "js/lazy-weights.js", "js/remote-llm.js", "js/model-manager.js", "js/prompts.js", "js/toolcalls.js", "js/markdown.js", "js/files.js",
|
| 22 |
"vendor/transformers.min.js", "vendor/highlight.min.js",
|
| 23 |
"vendor/ort/ort-wasm-simd-threaded.asyncify.mjs", "vendor/ort/ort-wasm-simd-threaded.asyncify.wasm",
|
| 24 |
"vendor/xterm/xterm.mjs", "vendor/xterm/xterm.css", "vendor/xterm/addon-fit.mjs",
|
| 25 |
+
"vendor/avatars/anthropic.png", "vendor/avatars/cerebras.png", "vendor/avatars/deepseek.png", "vendor/avatars/fireworks.png", "vendor/avatars/google.png", "vendor/avatars/groq.png", "vendor/avatars/huggingface.png", "vendor/avatars/ibm.png", "vendor/avatars/liquidai.png", "vendor/avatars/lmstudio.png", "vendor/avatars/mistral.png", "vendor/avatars/ollama.png", "vendor/avatars/openai.png", "vendor/avatars/openrouter.png", "vendor/avatars/qwen.png", "vendor/avatars/together.png", "vendor/avatars/xai.png",
|
| 26 |
"vendor/fonts/inter-latin.woff2", "vendor/fonts/inter-latin-ext.woff2", "vendor/fonts/jetbrains-mono-latin.woff2",
|
| 27 |
];
|
| 28 |
|
vendor/avatars/anthropic.png
ADDED
|
|
vendor/avatars/cerebras.png
ADDED
|
|
vendor/avatars/deepseek.png
ADDED
|
|
vendor/avatars/fireworks.png
ADDED
|
|
vendor/avatars/google.png
ADDED
|
|
vendor/avatars/groq.png
ADDED
|
|
vendor/avatars/huggingface.png
ADDED
|
|
vendor/avatars/ibm.png
ADDED
|
|
vendor/avatars/liquidai.png
ADDED
|
|
vendor/avatars/lmstudio.png
ADDED
|
|
vendor/avatars/mistral.png
ADDED
|
|
vendor/avatars/ollama.png
ADDED
|
|
vendor/avatars/openai.png
ADDED
|
|
vendor/avatars/openrouter.png
ADDED
|
|
vendor/avatars/qwen.png
ADDED
|
|
vendor/avatars/together.png
ADDED
|
|
vendor/avatars/xai.png
ADDED
|
|