magpie-multi-usage 0.1.2 → 0.3.0
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/README.md +3 -1
- package/README.zh-CN.md +3 -1
- package/package.json +1 -1
- package/src/aggregator.mjs +271 -2
- package/src/github-store.mjs +1 -1
- package/src/http-server.mjs +21 -1
- package/src/sync-engine.mjs +26 -5
- package/src/ui/app.css +54 -4
- package/src/ui/app.js +277 -43
- package/src/ui/dashboard-state.mjs +131 -0
- package/src/ui/icons/azure-color.svg +1 -0
- package/src/ui/icons/bedrock-color.svg +1 -0
- package/src/ui/icons/claude-color.svg +1 -0
- package/src/ui/icons/deepseek-color.svg +1 -0
- package/src/ui/icons/gemini-color.svg +1 -0
- package/src/ui/icons/groq.svg +1 -0
- package/src/ui/icons/kimi.svg +1 -0
- package/src/ui/icons/mimocode.svg +1 -0
- package/src/ui/icons/minimax-color.svg +1 -0
- package/src/ui/icons/mistral-color.svg +1 -0
- package/src/ui/icons/openai.svg +1 -0
- package/src/ui/icons/openrouter.svg +1 -0
- package/src/ui/icons/qwen-color.svg +1 -0
- package/src/ui/icons/stepfun.svg +1 -0
- package/src/ui/icons/xai.svg +1 -0
- package/src/ui/icons/zhipu-color.svg +1 -0
- package/src/ui/index.html +2 -1
- package/src/ui/view-model.mjs +247 -3
package/src/ui/app.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
+
applySummaryResult,
|
|
3
|
+
beginSummaryRequest,
|
|
4
|
+
failSummaryRequest,
|
|
5
|
+
} from "./dashboard-state.mjs";
|
|
6
|
+
import {
|
|
7
|
+
buildTrendAxisModel,
|
|
2
8
|
extractDeviceWarnings,
|
|
3
9
|
formatCompactTokens,
|
|
4
10
|
formatCoverageWindow,
|
|
5
11
|
formatExactNumber,
|
|
6
12
|
formatPercent,
|
|
7
13
|
formatTimestamp,
|
|
14
|
+
formatTrendPointTitle,
|
|
8
15
|
formatUsd,
|
|
16
|
+
isUnverifiedEmptyTrendPoint,
|
|
9
17
|
resolveLang,
|
|
10
18
|
statusLabel,
|
|
19
|
+
summarySelectionKey,
|
|
11
20
|
t,
|
|
21
|
+
trendFocusTarget,
|
|
22
|
+
trendLabelEvery,
|
|
23
|
+
vendorIconForModel,
|
|
24
|
+
vendorIconForProvider,
|
|
12
25
|
} from "./view-model.mjs";
|
|
13
26
|
|
|
14
27
|
const TOKEN_HEADER = "X-Multi-Usage-Token";
|
|
@@ -30,6 +43,13 @@ const state = {
|
|
|
30
43
|
breakdownTab: "agents",
|
|
31
44
|
loading: false,
|
|
32
45
|
summary: null,
|
|
46
|
+
summarySelection: null,
|
|
47
|
+
chartStale: false,
|
|
48
|
+
requestError: null,
|
|
49
|
+
trendFocusIndex: 0,
|
|
50
|
+
deviceChoices: [],
|
|
51
|
+
pendingSelection: null,
|
|
52
|
+
sync: null,
|
|
33
53
|
config: null,
|
|
34
54
|
clearTokenRequested: false,
|
|
35
55
|
requestGen: 0,
|
|
@@ -123,6 +143,14 @@ function svgIcon(pathD) {
|
|
|
123
143
|
return svg;
|
|
124
144
|
}
|
|
125
145
|
|
|
146
|
+
function vendorIcon(key) {
|
|
147
|
+
const img = document.createElement("img");
|
|
148
|
+
img.src = `./icons/${key}.svg`;
|
|
149
|
+
img.alt = "";
|
|
150
|
+
img.className = "vendor-logo";
|
|
151
|
+
return img;
|
|
152
|
+
}
|
|
153
|
+
|
|
126
154
|
function formatCallsLabel(count) {
|
|
127
155
|
const n = Number(count) || 0;
|
|
128
156
|
const formatted = formatExactNumber(n);
|
|
@@ -152,6 +180,8 @@ function renderStaticText() {
|
|
|
152
180
|
document.getElementById("devices-heading").textContent = t(state.lang, "devicesHeading");
|
|
153
181
|
document.getElementById("devices-meta").textContent = t(state.lang, "devicesHint");
|
|
154
182
|
document.getElementById("breakdown-meta").textContent = t(state.lang, "sortedByTokens");
|
|
183
|
+
document.getElementById("trend-section").setAttribute("aria-label", t(state.lang, "trendHeading"));
|
|
184
|
+
document.getElementById("trend-keyboard-hint").textContent = t(state.lang, "trendKeyboardHint");
|
|
155
185
|
|
|
156
186
|
document.getElementById("drawer-title").textContent = t(state.lang, "drawerTitle");
|
|
157
187
|
document.getElementById("drawer-close").setAttribute("aria-label", t(state.lang, "close"));
|
|
@@ -259,6 +289,13 @@ function renderBanners(summary) {
|
|
|
259
289
|
const box = document.getElementById("banners");
|
|
260
290
|
box.replaceChildren();
|
|
261
291
|
|
|
292
|
+
if (state.requestError) {
|
|
293
|
+
const err = el("div", "banner banner-warn");
|
|
294
|
+
err.appendChild(el("span", "dot dot-error"));
|
|
295
|
+
err.appendChild(el("span", "", state.requestError));
|
|
296
|
+
box.appendChild(err);
|
|
297
|
+
}
|
|
298
|
+
|
|
262
299
|
if (summary.sync && !summary.sync.repoConfigured) {
|
|
263
300
|
const info = el("div", "banner banner-info");
|
|
264
301
|
info.appendChild(el("span", "dot dot-ok"));
|
|
@@ -326,35 +363,108 @@ function renderKpis(summary) {
|
|
|
326
363
|
}
|
|
327
364
|
}
|
|
328
365
|
|
|
366
|
+
function legacyTrend(summary) {
|
|
367
|
+
const daily = summary.daily || [];
|
|
368
|
+
return {
|
|
369
|
+
bucket: "day",
|
|
370
|
+
points: daily.map((entry) => ({
|
|
371
|
+
...entry,
|
|
372
|
+
key: entry.day,
|
|
373
|
+
label: typeof entry.day === "string" ? entry.day.slice(5) : String(entry.day || ""),
|
|
374
|
+
})),
|
|
375
|
+
dailyOnly: null,
|
|
376
|
+
availability: "ok",
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function appendDailyOnlyNote(container, dailyOnly) {
|
|
381
|
+
if (!dailyOnly) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
const text = [
|
|
385
|
+
t(state.lang, "trendDailyOnly"),
|
|
386
|
+
dailyOnly.day || "",
|
|
387
|
+
`${formatCompactTokens(dailyOnly.totalTokens)} ${t(state.lang, "tokensUnit")}`,
|
|
388
|
+
formatCallsLabel(dailyOnly.calls),
|
|
389
|
+
formatUsd(dailyOnly.cost),
|
|
390
|
+
].filter(Boolean).join(" · ");
|
|
391
|
+
container.appendChild(el("div", "trend-note", text));
|
|
392
|
+
}
|
|
393
|
+
|
|
329
394
|
function renderTrendChart(summary) {
|
|
330
395
|
const container = document.getElementById("trend-container");
|
|
331
396
|
const readout = document.getElementById("trend-readout");
|
|
332
397
|
const peakEl = document.getElementById("trend-peak");
|
|
333
398
|
container.replaceChildren();
|
|
334
399
|
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
400
|
+
const trend = summary.trend && Array.isArray(summary.trend.points)
|
|
401
|
+
? summary.trend
|
|
402
|
+
: legacyTrend(summary);
|
|
403
|
+
const points = trend.points || [];
|
|
404
|
+
const dailyOnly = trend.dailyOnly || null;
|
|
405
|
+
const availability = trend.availability || "ok";
|
|
406
|
+
|
|
407
|
+
const notices = [];
|
|
408
|
+
if (state.chartStale) {
|
|
409
|
+
notices.push(t(state.lang, "trendStale"));
|
|
410
|
+
}
|
|
411
|
+
if (availability === "partial") {
|
|
412
|
+
notices.push(t(state.lang, "trendPartial"));
|
|
413
|
+
}
|
|
414
|
+
const noticeText = notices.join(" · ");
|
|
415
|
+
const withNotices = (text) => (noticeText ? `${noticeText} · ${text}` : text);
|
|
416
|
+
|
|
417
|
+
if (availability === "unavailable") {
|
|
418
|
+
readout.textContent = noticeText;
|
|
419
|
+
peakEl.textContent = "";
|
|
420
|
+
container.appendChild(el("div", "empty-state", t(state.lang, "trendUnavailable")));
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (points.length === 0) {
|
|
425
|
+
readout.textContent = noticeText;
|
|
338
426
|
peakEl.textContent = "";
|
|
339
|
-
|
|
427
|
+
const message = trend.bucket === "hour" && dailyOnly
|
|
428
|
+
? t(state.lang, "trendNoHourly")
|
|
429
|
+
: t(state.lang, "trendEmpty");
|
|
430
|
+
container.appendChild(el("div", "empty-state", message));
|
|
431
|
+
appendDailyOnlyNote(container, dailyOnly);
|
|
340
432
|
return;
|
|
341
433
|
}
|
|
342
434
|
|
|
343
|
-
const defaultReadout = t(state.lang, "trendHint");
|
|
435
|
+
const defaultReadout = withNotices(t(state.lang, "trendHint"));
|
|
344
436
|
readout.textContent = defaultReadout;
|
|
345
437
|
|
|
346
|
-
const peak =
|
|
438
|
+
const peak = points.reduce((max, point) => Math.max(max, Number(point.totalTokens) || 0), 0);
|
|
347
439
|
const scalePeak = Math.max(1, peak);
|
|
348
440
|
peakEl.textContent = formatCompactTokens(peak);
|
|
349
441
|
|
|
350
442
|
const bars = el("div", "bars");
|
|
443
|
+
bars.setAttribute("role", "group");
|
|
444
|
+
bars.setAttribute("aria-label", t(state.lang, "trendHeading"));
|
|
445
|
+
bars.setAttribute("aria-describedby", "trend-keyboard-hint");
|
|
351
446
|
const labels = el("div", "labels");
|
|
352
|
-
const n =
|
|
353
|
-
const every =
|
|
447
|
+
const n = points.length;
|
|
448
|
+
const every = trendLabelEvery(n);
|
|
449
|
+
const axisLabels = buildTrendAxisModel(points, { bucket: trend.bucket, every });
|
|
450
|
+
let activeIndex = Number.isInteger(state.trendFocusIndex) && state.trendFocusIndex >= 0 && state.trendFocusIndex < n
|
|
451
|
+
? state.trendFocusIndex
|
|
452
|
+
: 0;
|
|
453
|
+
state.trendFocusIndex = activeIndex;
|
|
454
|
+
const barNodes = [];
|
|
455
|
+
const detailTexts = [];
|
|
456
|
+
|
|
457
|
+
const applyActiveBar = (nextIndex) => {
|
|
458
|
+
activeIndex = nextIndex;
|
|
459
|
+
state.trendFocusIndex = nextIndex;
|
|
460
|
+
barNodes.forEach((node, nodeIndex) => {
|
|
461
|
+
node.tabIndex = nodeIndex === nextIndex ? 0 : -1;
|
|
462
|
+
});
|
|
463
|
+
};
|
|
354
464
|
|
|
355
|
-
|
|
356
|
-
const total = Number(
|
|
357
|
-
const output = Number(
|
|
465
|
+
points.forEach((point, idx) => {
|
|
466
|
+
const total = Number(point.totalTokens) || 0;
|
|
467
|
+
const output = Number(point.output) || 0;
|
|
358
468
|
const promptPart = Math.max(0, total - output);
|
|
359
469
|
|
|
360
470
|
const bar = el("div", "bar");
|
|
@@ -365,23 +475,66 @@ function renderTrendChart(summary) {
|
|
|
365
475
|
bar.appendChild(outEl);
|
|
366
476
|
bar.appendChild(inEl);
|
|
367
477
|
|
|
368
|
-
const
|
|
478
|
+
const title = formatTrendPointTitle(point);
|
|
479
|
+
const summaryText = isUnverifiedEmptyTrendPoint(point, availability)
|
|
480
|
+
? `${title} · ${t(state.lang, "trendNoVerifiedPoint")}`
|
|
481
|
+
: `${title} · ${formatCompactTokens(total)} ${t(state.lang, "tokensUnit")} · ${formatCallsLabel(point.calls)} · ${formatUsd(point.cost)}`;
|
|
369
482
|
bar.title = summaryText;
|
|
483
|
+
barNodes.push(bar);
|
|
484
|
+
detailTexts.push(summaryText);
|
|
485
|
+
bars.appendChild(bar);
|
|
486
|
+
|
|
487
|
+
const axis = axisLabels[idx];
|
|
488
|
+
const labelNode = el("span");
|
|
489
|
+
if (axis.show) {
|
|
490
|
+
if (axis.compactLabel && axis.compactLabel !== axis.fullLabel) {
|
|
491
|
+
labelNode.appendChild(el("span", "axis-full", axis.fullLabel));
|
|
492
|
+
labelNode.appendChild(el("span", "axis-compact", axis.compactLabel));
|
|
493
|
+
} else {
|
|
494
|
+
labelNode.textContent = axis.fullLabel;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
labels.appendChild(labelNode);
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
barNodes.forEach((bar, idx) => {
|
|
501
|
+
bar.tabIndex = idx === activeIndex ? 0 : -1;
|
|
502
|
+
bar.setAttribute("role", "img");
|
|
503
|
+
bar.setAttribute("aria-label", detailTexts[idx]);
|
|
504
|
+
bar.setAttribute("aria-keyshortcuts", "ArrowLeft ArrowRight ArrowUp ArrowDown Home End");
|
|
505
|
+
bar.addEventListener("focus", () => {
|
|
506
|
+
applyActiveBar(idx);
|
|
507
|
+
readout.textContent = withNotices(detailTexts[idx]);
|
|
508
|
+
});
|
|
509
|
+
bar.addEventListener("blur", (event) => {
|
|
510
|
+
if (event.relatedTarget && bars.contains(event.relatedTarget)) {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
readout.textContent = defaultReadout;
|
|
514
|
+
});
|
|
515
|
+
bar.addEventListener("keydown", (event) => {
|
|
516
|
+
const target = trendFocusTarget(idx, event.key, n);
|
|
517
|
+
if (target === null) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
event.preventDefault();
|
|
521
|
+
applyActiveBar(target);
|
|
522
|
+
barNodes[target].focus();
|
|
523
|
+
});
|
|
370
524
|
bar.addEventListener("mouseenter", () => {
|
|
371
|
-
readout.textContent =
|
|
525
|
+
readout.textContent = withNotices(detailTexts[idx]);
|
|
372
526
|
});
|
|
373
527
|
bar.addEventListener("mouseleave", () => {
|
|
374
|
-
|
|
528
|
+
const focusedIndex = barNodes.indexOf(document.activeElement);
|
|
529
|
+
readout.textContent = focusedIndex >= 0
|
|
530
|
+
? withNotices(detailTexts[focusedIndex])
|
|
531
|
+
: defaultReadout;
|
|
375
532
|
});
|
|
376
|
-
bars.appendChild(bar);
|
|
377
|
-
|
|
378
|
-
const shortDay = typeof d.day === "string" && d.day.length === 10 ? d.day.slice(5) : String(d.day || "");
|
|
379
|
-
const showLast = idx === n - 1 && (n - 1) % every >= every / 2;
|
|
380
|
-
labels.appendChild(el("span", "", idx % every === 0 || showLast ? shortDay : ""));
|
|
381
533
|
});
|
|
382
534
|
|
|
383
535
|
container.appendChild(bars);
|
|
384
536
|
container.appendChild(labels);
|
|
537
|
+
appendDailyOnlyNote(container, dailyOnly);
|
|
385
538
|
}
|
|
386
539
|
|
|
387
540
|
function renderDevicesList(summary) {
|
|
@@ -513,7 +666,13 @@ function renderBreakdownList(summary) {
|
|
|
513
666
|
for (const item of rows.slice(0, 12)) {
|
|
514
667
|
const row = el("div", "row stat");
|
|
515
668
|
const ic = el("span", "ic");
|
|
516
|
-
|
|
669
|
+
let logoKey = "";
|
|
670
|
+
if (state.breakdownTab === "models") {
|
|
671
|
+
logoKey = vendorIconForModel(item.name);
|
|
672
|
+
} else if (state.breakdownTab === "providers") {
|
|
673
|
+
logoKey = vendorIconForProvider(item.name);
|
|
674
|
+
}
|
|
675
|
+
ic.appendChild(logoKey ? vendorIcon(logoKey) : svgIcon(iconPath));
|
|
517
676
|
row.appendChild(ic);
|
|
518
677
|
|
|
519
678
|
const who = el("div", "who");
|
|
@@ -566,6 +725,13 @@ function renderDashboard() {
|
|
|
566
725
|
if (!summary) {
|
|
567
726
|
return;
|
|
568
727
|
}
|
|
728
|
+
if (state.summarySelection !== summarySelectionKey(state.range, state.device)) {
|
|
729
|
+
state.summary = null;
|
|
730
|
+
state.summarySelection = null;
|
|
731
|
+
state.chartStale = false;
|
|
732
|
+
renderSummaryPlaceholder("trendUnavailable", "summaryUnavailable");
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
569
735
|
|
|
570
736
|
renderHeaderCost(summary);
|
|
571
737
|
renderDeviceTabs(summary.devices || []);
|
|
@@ -577,6 +743,55 @@ function renderDashboard() {
|
|
|
577
743
|
renderSyncFooter(summary);
|
|
578
744
|
}
|
|
579
745
|
|
|
746
|
+
function renderSummaryPlaceholder(kpiKey, chartKey) {
|
|
747
|
+
document.getElementById("usage-cost").replaceChildren();
|
|
748
|
+
renderDeviceTabs(state.deviceChoices || []);
|
|
749
|
+
renderBanners({ devices: [], sync: state.sync || null });
|
|
750
|
+
document.getElementById("kpi-strip").replaceChildren(el("div", "empty-state", t(state.lang, kpiKey)));
|
|
751
|
+
const container = document.getElementById("trend-container");
|
|
752
|
+
container.replaceChildren(el("div", "empty-state", t(state.lang, chartKey)));
|
|
753
|
+
document.getElementById("trend-readout").textContent = "";
|
|
754
|
+
document.getElementById("trend-peak").textContent = "";
|
|
755
|
+
document.getElementById("devices-list").replaceChildren(el("div", "empty-state", t(state.lang, "noRows")));
|
|
756
|
+
document.getElementById("breakdown-list").replaceChildren(el("div", "empty-state", t(state.lang, "noRows")));
|
|
757
|
+
document.getElementById("sync-footer").replaceChildren();
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
function renderSummaryPending() {
|
|
761
|
+
renderSummaryPlaceholder("trendLoading", "trendLoading");
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
function renderSummaryUnavailable() {
|
|
765
|
+
renderSummaryPlaceholder("summaryUnavailable", "trendUnavailable");
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
function handleSummarySuccess(gen, reqRange, reqDevice, result) {
|
|
769
|
+
if (!applySummaryResult(state, {
|
|
770
|
+
gen,
|
|
771
|
+
range: reqRange,
|
|
772
|
+
device: reqDevice,
|
|
773
|
+
result,
|
|
774
|
+
})) {
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
state.sync = result.sync || state.sync || null;
|
|
778
|
+
renderDashboard();
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
function handleSummaryFailure(gen, reqRange, reqDevice, message) {
|
|
782
|
+
const outcome = failSummaryRequest(state, {
|
|
783
|
+
gen,
|
|
784
|
+
range: reqRange,
|
|
785
|
+
device: reqDevice,
|
|
786
|
+
message,
|
|
787
|
+
});
|
|
788
|
+
if (outcome === "retained") {
|
|
789
|
+
renderDashboard();
|
|
790
|
+
} else if (outcome === "unavailable") {
|
|
791
|
+
renderSummaryUnavailable();
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
|
|
580
795
|
function setFeedback(text, kind = "ok") {
|
|
581
796
|
const box = document.getElementById("drawer-feedback");
|
|
582
797
|
if (!text) {
|
|
@@ -668,6 +883,10 @@ async function syncLocalOnBoot() {
|
|
|
668
883
|
const gen = ++state.requestGen;
|
|
669
884
|
const reqRange = state.range;
|
|
670
885
|
const reqDevice = state.device;
|
|
886
|
+
const { invalidated } = beginSummaryRequest(state, { range: reqRange, device: reqDevice, gen });
|
|
887
|
+
if (invalidated) {
|
|
888
|
+
renderSummaryPending();
|
|
889
|
+
}
|
|
671
890
|
try {
|
|
672
891
|
const result = await apiFetch("./api/refresh", {
|
|
673
892
|
method: "POST",
|
|
@@ -678,12 +897,11 @@ async function syncLocalOnBoot() {
|
|
|
678
897
|
pull: false,
|
|
679
898
|
},
|
|
680
899
|
});
|
|
681
|
-
if (
|
|
682
|
-
|
|
683
|
-
renderDashboard();
|
|
900
|
+
if (result.summary) {
|
|
901
|
+
handleSummarySuccess(gen, reqRange, reqDevice, result.summary);
|
|
684
902
|
}
|
|
685
|
-
} catch {
|
|
686
|
-
|
|
903
|
+
} catch (err) {
|
|
904
|
+
handleSummaryFailure(gen, reqRange, reqDevice, err.message);
|
|
687
905
|
} finally {
|
|
688
906
|
state.loading = false;
|
|
689
907
|
renderRefreshButton();
|
|
@@ -694,20 +912,16 @@ async function loadSummary() {
|
|
|
694
912
|
const gen = ++state.requestGen;
|
|
695
913
|
const reqRange = state.range;
|
|
696
914
|
const reqDevice = state.device;
|
|
915
|
+
const { invalidated } = beginSummaryRequest(state, { range: reqRange, device: reqDevice, gen });
|
|
916
|
+
if (invalidated) {
|
|
917
|
+
renderSummaryPending();
|
|
918
|
+
}
|
|
697
919
|
try {
|
|
698
920
|
const qs = new URLSearchParams({ range: reqRange, device: reqDevice });
|
|
699
921
|
const result = await apiFetch(`./api/summary?${qs.toString()}`);
|
|
700
|
-
|
|
701
|
-
return;
|
|
702
|
-
}
|
|
703
|
-
state.summary = result;
|
|
704
|
-
renderDashboard();
|
|
922
|
+
handleSummarySuccess(gen, reqRange, reqDevice, result);
|
|
705
923
|
} catch (err) {
|
|
706
|
-
|
|
707
|
-
return;
|
|
708
|
-
}
|
|
709
|
-
const banners = document.getElementById("banners");
|
|
710
|
-
banners.replaceChildren(el("div", "banner banner-warn", err.message));
|
|
924
|
+
handleSummaryFailure(gen, reqRange, reqDevice, err.message);
|
|
711
925
|
}
|
|
712
926
|
}
|
|
713
927
|
|
|
@@ -720,18 +934,20 @@ async function triggerRefresh() {
|
|
|
720
934
|
const gen = ++state.requestGen;
|
|
721
935
|
const reqRange = state.range;
|
|
722
936
|
const reqDevice = state.device;
|
|
937
|
+
const { invalidated } = beginSummaryRequest(state, { range: reqRange, device: reqDevice, gen });
|
|
938
|
+
if (invalidated) {
|
|
939
|
+
renderSummaryPending();
|
|
940
|
+
}
|
|
723
941
|
try {
|
|
724
942
|
const result = await apiFetch("./api/refresh", {
|
|
725
943
|
method: "POST",
|
|
726
944
|
body: { range: reqRange, device: reqDevice },
|
|
727
945
|
});
|
|
728
|
-
if (
|
|
729
|
-
|
|
730
|
-
renderDashboard();
|
|
946
|
+
if (result.summary) {
|
|
947
|
+
handleSummarySuccess(gen, reqRange, reqDevice, result.summary);
|
|
731
948
|
}
|
|
732
949
|
} catch (err) {
|
|
733
|
-
|
|
734
|
-
banners.replaceChildren(el("div", "banner banner-warn", err.message));
|
|
950
|
+
handleSummaryFailure(gen, reqRange, reqDevice, err.message);
|
|
735
951
|
} finally {
|
|
736
952
|
state.loading = false;
|
|
737
953
|
renderRefreshButton();
|
|
@@ -794,17 +1010,32 @@ async function handleSaveSettings(event) {
|
|
|
794
1010
|
btn.disabled = true;
|
|
795
1011
|
btn.textContent = t(state.lang, "saving");
|
|
796
1012
|
setFeedback("");
|
|
1013
|
+
let refreshGen = null;
|
|
1014
|
+
let refreshRange = null;
|
|
1015
|
+
let refreshDevice = null;
|
|
797
1016
|
try {
|
|
798
1017
|
const payload = readFormPayload();
|
|
799
1018
|
const saved = await apiFetch("./api/config", { method: "POST", body: payload });
|
|
800
1019
|
populateSettingsForm(saved);
|
|
1020
|
+
|
|
1021
|
+
refreshRange = state.range;
|
|
1022
|
+
refreshDevice = state.device;
|
|
1023
|
+
refreshGen = ++state.requestGen;
|
|
1024
|
+
const { invalidated } = beginSummaryRequest(state, {
|
|
1025
|
+
range: refreshRange,
|
|
1026
|
+
device: refreshDevice,
|
|
1027
|
+
gen: refreshGen,
|
|
1028
|
+
});
|
|
1029
|
+
if (invalidated) {
|
|
1030
|
+
renderSummaryPending();
|
|
1031
|
+
}
|
|
1032
|
+
|
|
801
1033
|
const refreshed = await apiFetch("./api/refresh", {
|
|
802
1034
|
method: "POST",
|
|
803
|
-
body: { range:
|
|
1035
|
+
body: { range: refreshRange, device: refreshDevice },
|
|
804
1036
|
});
|
|
805
1037
|
if (refreshed.summary) {
|
|
806
|
-
|
|
807
|
-
renderDashboard();
|
|
1038
|
+
handleSummarySuccess(refreshGen, refreshRange, refreshDevice, refreshed.summary);
|
|
808
1039
|
}
|
|
809
1040
|
const syncErrors = [
|
|
810
1041
|
refreshed.local?.error,
|
|
@@ -817,6 +1048,9 @@ async function handleSaveSettings(event) {
|
|
|
817
1048
|
setFeedback(t(state.lang, "savedSuccess"), "ok");
|
|
818
1049
|
}
|
|
819
1050
|
} catch (err) {
|
|
1051
|
+
if (refreshGen !== null) {
|
|
1052
|
+
handleSummaryFailure(refreshGen, refreshRange, refreshDevice, err.message);
|
|
1053
|
+
}
|
|
820
1054
|
setFeedback(err.message, "err");
|
|
821
1055
|
} finally {
|
|
822
1056
|
btn.disabled = false;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure UI request-lifecycle helpers for the dashboard. Keeping the
|
|
3
|
+
* selection/race logic here makes pending replacement, late responses,
|
|
4
|
+
* same-selection last-good retention, and navigation recovery executable in
|
|
5
|
+
* Node without a browser DOM.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { summarySelectionKey } from "./view-model.mjs";
|
|
9
|
+
|
|
10
|
+
const SUMMARY_DEVICE_FIELDS = ["deviceId", "displayName", "status", "isLocal"];
|
|
11
|
+
|
|
12
|
+
export function formatDayInTimeZone(value, timeZone) {
|
|
13
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
14
|
+
if (Number.isNaN(date.getTime())) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
return new Intl.DateTimeFormat("en-CA", {
|
|
19
|
+
timeZone,
|
|
20
|
+
year: "numeric",
|
|
21
|
+
month: "2-digit",
|
|
22
|
+
day: "2-digit",
|
|
23
|
+
}).format(date);
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function summaryChartDay(summary) {
|
|
30
|
+
const trendEnd = summary?.trend?.endDay;
|
|
31
|
+
if (typeof trendEnd === "string" && trendEnd) {
|
|
32
|
+
return trendEnd;
|
|
33
|
+
}
|
|
34
|
+
const boundsEnd = summary?.bounds?.endDay;
|
|
35
|
+
return typeof boundsEnd === "string" && boundsEnd ? boundsEnd : null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* All-history charts have no bounded end day. Finite ranges can be reused only
|
|
40
|
+
* in the server-reported timezone, so a browser in a different host timezone
|
|
41
|
+
* cannot mislabel yesterday's chart as today's.
|
|
42
|
+
*/
|
|
43
|
+
export function isSummaryChartCurrent(summary, now = new Date()) {
|
|
44
|
+
const chartDay = summaryChartDay(summary);
|
|
45
|
+
if (!chartDay) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
const zone = typeof summary?.reportingTimeZone === "string"
|
|
49
|
+
? summary.reportingTimeZone.trim()
|
|
50
|
+
: "";
|
|
51
|
+
if (!zone) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return formatDayInTimeZone(now, zone) === chartDay;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function selectDeviceChoices(devices = []) {
|
|
58
|
+
return devices
|
|
59
|
+
.filter((device) => device && typeof device.deviceId === "string" && device.deviceId)
|
|
60
|
+
.map((device) => {
|
|
61
|
+
const choice = {};
|
|
62
|
+
for (const field of SUMMARY_DEVICE_FIELDS) {
|
|
63
|
+
choice[field] = device[field];
|
|
64
|
+
}
|
|
65
|
+
choice.displayName = typeof choice.displayName === "string" && choice.displayName
|
|
66
|
+
? choice.displayName
|
|
67
|
+
: choice.deviceId;
|
|
68
|
+
choice.status = typeof choice.status === "string" && choice.status ? choice.status : "empty";
|
|
69
|
+
choice.isLocal = Boolean(choice.isLocal);
|
|
70
|
+
return choice;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function beginSummaryRequest(state, { range, device, gen }) {
|
|
75
|
+
state.requestGen = gen;
|
|
76
|
+
const key = summarySelectionKey(range, device);
|
|
77
|
+
state.pendingSelection = key;
|
|
78
|
+
state.requestError = null;
|
|
79
|
+
|
|
80
|
+
if (state.summary && state.summarySelection !== key) {
|
|
81
|
+
state.summary = null;
|
|
82
|
+
state.summarySelection = null;
|
|
83
|
+
state.chartStale = false;
|
|
84
|
+
return { key, invalidated: true };
|
|
85
|
+
}
|
|
86
|
+
return { key, invalidated: false };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function isCurrentSummaryRequest(state, { gen, range, device }) {
|
|
90
|
+
return state.requestGen === gen
|
|
91
|
+
&& state.range === range
|
|
92
|
+
&& state.device === device
|
|
93
|
+
&& state.pendingSelection === summarySelectionKey(range, device);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function applySummaryResult(state, { gen, range, device, result }) {
|
|
97
|
+
if (!result || !isCurrentSummaryRequest(state, { gen, range, device })) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
state.summary = result;
|
|
101
|
+
state.summarySelection = summarySelectionKey(range, device);
|
|
102
|
+
state.chartStale = false;
|
|
103
|
+
state.requestError = null;
|
|
104
|
+
state.pendingSelection = null;
|
|
105
|
+
state.deviceChoices = selectDeviceChoices(result.devices || []);
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns "retained" when the previous chart is still for this exact selection
|
|
111
|
+
* and its chart day is still current, "unavailable" when the chart must be
|
|
112
|
+
* dropped, and "ignored" for a late response from a superseded request.
|
|
113
|
+
*/
|
|
114
|
+
export function failSummaryRequest(state, { gen, range, device, message, now = new Date() }) {
|
|
115
|
+
if (!isCurrentSummaryRequest(state, { gen, range, device })) {
|
|
116
|
+
return "ignored";
|
|
117
|
+
}
|
|
118
|
+
state.pendingSelection = null;
|
|
119
|
+
state.requestError = message;
|
|
120
|
+
const key = summarySelectionKey(range, device);
|
|
121
|
+
|
|
122
|
+
if (state.summary && state.summarySelection === key && isSummaryChartCurrent(state.summary, now)) {
|
|
123
|
+
state.chartStale = true;
|
|
124
|
+
return "retained";
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
state.summary = null;
|
|
128
|
+
state.summarySelection = null;
|
|
129
|
+
state.chartStale = false;
|
|
130
|
+
return "unavailable";
|
|
131
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Azure</title><path d="M7.242 1.613A1.11 1.11 0 018.295.857h6.977L8.03 22.316a1.11 1.11 0 01-1.052.755h-5.43a1.11 1.11 0 01-1.053-1.466L7.242 1.613z" fill="url(#lobe-icons-azure-0-_R_0_)"></path><path d="M18.397 15.296H7.4a.51.51 0 00-.347.882l7.066 6.595c.206.192.477.298.758.298h6.226l-2.706-7.775z" fill="#0078D4"></path><path d="M15.272.857H7.497L0 23.071h7.775l1.596-4.73 5.068 4.73h6.665l-2.707-7.775h-7.998L15.272.857z" fill="url(#lobe-icons-azure-1-_R_0_)"></path><path d="M17.193 1.613a1.11 1.11 0 00-1.052-.756h-7.81.035c.477 0 .9.304 1.052.756l6.748 19.992a1.11 1.11 0 01-1.052 1.466h-.12 7.895a1.11 1.11 0 001.052-1.466L17.193 1.613z" fill="url(#lobe-icons-azure-2-_R_0_)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-azure-0-_R_0_" x1="8.247" x2="1.002" y1="1.626" y2="23.03"><stop stop-color="#114A8B"></stop><stop offset="1" stop-color="#0669BC"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-azure-1-_R_0_" x1="14.042" x2="12.324" y1="15.302" y2="15.888"><stop stop-opacity=".3"></stop><stop offset=".071" stop-opacity=".2"></stop><stop offset=".321" stop-opacity=".1"></stop><stop offset=".623" stop-opacity=".05"></stop><stop offset="1" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-azure-2-_R_0_" x1="12.841" x2="20.793" y1="1.626" y2="22.814"><stop stop-color="#3CCBF4"></stop><stop offset="1" stop-color="#2892DF"></stop></linearGradient></defs></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Bedrock</title><defs><linearGradient id="lobe-icons-bedrock-_R_0_" x1="80%" x2="20%" y1="20%" y2="80%"><stop offset="0%" stop-color="#6350FB"></stop><stop offset="50%" stop-color="#3D8FFF"></stop><stop offset="100%" stop-color="#9AD8F8"></stop></linearGradient></defs><path d="M13.05 15.513h3.08c.214 0 .389.177.389.394v1.82a1.704 1.704 0 011.296 1.661c0 .943-.755 1.708-1.685 1.708-.931 0-1.686-.765-1.686-1.708 0-.807.554-1.484 1.297-1.662v-1.425h-2.69v4.663a.395.395 0 01-.188.338l-2.69 1.641a.385.385 0 01-.405-.002l-4.926-3.086a.395.395 0 01-.185-.336V16.3L2.196 14.87A.395.395 0 012 14.555L2 14.528V9.406c0-.14.073-.27.192-.34l2.465-1.462V4.448c0-.129.062-.249.165-.322l.021-.014L9.77 1.058a.385.385 0 01.407 0l2.69 1.675a.395.395 0 01.185.336V7.6h3.856V5.683a1.704 1.704 0 01-1.296-1.662c0-.943.755-1.708 1.685-1.708.931 0 1.685.765 1.685 1.708 0 .807-.553 1.484-1.296 1.662v2.311a.391.391 0 01-.389.394h-4.245v1.806h6.624a1.69 1.69 0 011.64-1.313c.93 0 1.685.764 1.685 1.707 0 .943-.754 1.708-1.685 1.708a1.69 1.69 0 01-1.64-1.314H13.05v1.937h4.953l.915 1.18a1.66 1.66 0 01.84-.227c.931 0 1.685.764 1.685 1.707 0 .943-.754 1.708-1.685 1.708-.93 0-1.685-.765-1.685-1.708 0-.346.102-.668.276-.937l-.724-.935H13.05v1.806zM9.973 1.856L7.93 3.122V6.09h-.778V3.604L5.435 4.669v2.945l2.11 1.36L9.712 7.61V5.334h.778V7.83c0 .136-.07.263-.184.335L7.963 9.638v2.081l1.422 1.009-.446.646-1.406-.998-1.53 1.005-.423-.66 1.605-1.055v-1.99L5.038 8.29l-2.26 1.34v1.676l1.972-1.189.398.677-2.37 1.429V14.3l2.166 1.258 2.27-1.368.397.677-2.176 1.311V19.3l1.876 1.175 2.365-1.426.398.678-2.017 1.216 1.918 1.201 2.298-1.403v-5.78l-4.758 2.893-.4-.675 5.158-3.136V3.289L9.972 1.856zM16.13 18.47a.913.913 0 00-.908.92c0 .507.406.918.908.918a.913.913 0 00.907-.919.913.913 0 00-.907-.92zm3.63-3.81a.913.913 0 00-.908.92c0 .508.406.92.907.92a.913.913 0 00.908-.92.913.913 0 00-.908-.92zm1.555-4.99a.913.913 0 00-.908.92c0 .507.407.918.908.918a.913.913 0 00.907-.919.913.913 0 00-.907-.92zM17.296 3.1a.913.913 0 00-.907.92c0 .508.406.92.907.92a.913.913 0 00.908-.92.913.913 0 00-.908-.92z" fill="url(#lobe-icons-bedrock-_R_0_)" fill-rule="nonzero"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Claude</title><path d="M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z" fill="#D97757" fill-rule="nonzero"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>DeepSeek</title><path d="M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.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-.156-.708-.311-.955-.65-.172-.241-.219-.51-.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.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z" fill="#4D6BFE"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Gemini</title><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="#3186FF"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#lobe-icons-gemini-0-_R_0_)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#lobe-icons-gemini-1-_R_0_)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#lobe-icons-gemini-2-_R_0_)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-gemini-0-_R_0_" x1="7" x2="11" y1="15.5" y2="12"><stop stop-color="#08B962"></stop><stop offset="1" stop-color="#08B962" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-gemini-1-_R_0_" x1="8" x2="11.5" y1="5.5" y2="11"><stop stop-color="#F94543"></stop><stop offset="1" stop-color="#F94543" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-gemini-2-_R_0_" x1="3.5" x2="17.5" y1="13.5" y2="12"><stop stop-color="#FABC12"></stop><stop offset=".46" stop-color="#FABC12" stop-opacity="0"></stop></linearGradient></defs></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Groq</title><path d="M12.036 2c-3.853-.035-7 3-7.036 6.781-.035 3.782 3.055 6.872 6.908 6.907h2.42v-2.566h-2.292c-2.407.028-4.38-1.866-4.408-4.23-.029-2.362 1.901-4.298 4.308-4.326h.1c2.407 0 4.358 1.915 4.365 4.278v6.305c0 2.342-1.944 4.25-4.323 4.279a4.375 4.375 0 01-3.033-1.252l-1.851 1.818A7 7 0 0012.029 22h.092c3.803-.056 6.858-3.083 6.879-6.816v-6.5C18.907 4.963 15.817 2 12.036 2z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Kimi</title><path d="M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"></path><path d="M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="currentColor" height="1em" style="flex:none;line-height:1" viewBox="10 28 108 72" width="1em" xmlns="http://www.w3.org/2000/svg"><title>mimocode</title><g><path d="M26.74,43.69l8.75-10.85h-4.72l-6.45,7.96-6.45-7.96h-4.72l8.75,10.85.03.04-9.11,11.24h5.03l6.46-8.26,6.46,8.26h5.03l-9.11-11.24.03-.04ZM39.75,30.35c-1.52,0-2.51,1.12-2.51,2.48s.99,2.48,2.51,2.48,2.51-1.12,2.51-2.48-.99-2.48-2.51-2.48ZM37.75,54.97h3.99v-17.57h-3.99v17.57ZM60.02,44.36v10.61h-3.99v-1.76c-1.16,1.36-2.93,2.19-5.67,2.19-1.26,0-5.49-.72-5.96-4.97-.45-4.06,2.9-6.78,9.17-6.78h2.45c0-2.16-.99-3.48-3.68-3.53-2.19-.04-4.02.82-5.37,2l-1.57-3.01c2.04-1.77,5.29-2.81,8.68-2.39,5.56.68,5.94,5.28,5.94,7.63ZM56.02,46.94h-1.95c-4.21,0-5.8,1.35-5.65,2.89.14,1.5,1.51,2.16,3.18,2.16,2.85,0,4.42-2.79,4.42-4.55v-.49ZM80.1,46.12c0,5.15-3.52,9.38-8.92,9.38s-8.92-4.24-8.92-9.38,3.52-9.38,8.92-9.38,8.92,4.24,8.92,9.38ZM76.11,46.12c0-3.66-2.17-5.81-4.93-5.81s-4.93,2.15-4.93,5.81,2.17,5.81,4.93,5.81,4.93-2.15,4.93-5.81ZM110.58,54.97h3.99v-17.57h-3.99v17.57ZM112.57,30.35c-1.52,0-2.51,1.12-2.51,2.48s.99,2.48,2.51,2.48,2.51-1.12,2.51-2.48-.99-2.48-2.51-2.48ZM101.27,36.63c-2.49,0-4.31,1.03-5.3,3.2-.94-2.32-2.89-3.2-4.78-3.2-1.71,0-3.97.77-4.73,2.82v-2.05h-3.91v17.57h3.99v-10.47c0-1.29.42-4.19,3.17-4.19s3.21,2.89,3.21,4.19v10.47h3.99v-10.47c0-1.29.42-4.19,3.21-4.19s3.17,2.89,3.17,4.19v10.47h3.99v-11.42c0-4.58-2.74-6.92-6.03-6.92Z"/><g><path d="M44.57,75.97v19.37c0,1.07-.87,1.93-1.93,1.93s-1.93-.87-1.93-1.93v-19.37c0-1.07.87-1.93,1.93-1.93s1.93.87,1.93,1.93Z"/><path d="M14.77,82.82h0c-1.07,0-1.93.87-1.93,1.93v10.6c0,1.07.87,1.93,1.93,1.93h0c1.07,0,1.93-.87,1.93-1.93v-10.6c0-1.07-.87-1.93-1.93-1.93Z"/><path d="M36.6,75.77s0-.05-.01-.08c0-.04,0-.07-.02-.11,0-.03-.01-.06-.02-.09,0-.03-.01-.06-.02-.09,0-.03-.02-.06-.03-.09-.01-.03-.02-.06-.03-.09-.01-.03-.03-.05-.04-.08-.01-.03-.03-.06-.04-.09-.01-.03-.03-.05-.04-.08-.02-.03-.03-.06-.05-.09-.02-.03-.04-.05-.06-.08-.02-.02-.03-.05-.05-.07-.04-.05-.08-.1-.13-.14h0s-.09-.09-.14-.13c-.02-.02-.05-.03-.07-.05-.03-.02-.05-.04-.08-.06-.03-.02-.05-.03-.08-.05-.03-.02-.05-.03-.08-.05-.03-.01-.06-.03-.09-.04-.03-.01-.06-.03-.09-.04-.03-.01-.06-.02-.08-.03-.03-.01-.06-.02-.1-.03-.03,0-.06-.01-.08-.02-.03,0-.07-.02-.1-.02-.03,0-.06,0-.09-.01-.03,0-.06-.01-.1-.01-.05,0-.11,0-.16,0,0,0-.02,0-.03,0-.01,0-.02,0-.03,0-.05,0-.11,0-.16,0-.03,0-.07,0-.1.01-.03,0-.06,0-.09.01-.04,0-.07.02-.11.03-.03,0-.05.01-.08.02-.03.01-.07.02-.1.04-.03,0-.05.02-.08.03-.03.01-.06.03-.09.04-.03.01-.05.02-.08.04-.03.02-.06.03-.09.05-.02.01-.05.03-.07.04-.03.02-.06.05-.1.07-.02.01-.04.03-.06.04-.05.04-.1.08-.14.13l-8.59,8.59-8.59-8.59c-.75-.75-1.98-.75-2.73,0h0c-.75.75-.75,1.98,0,2.73l9.96,9.96c.76.76,1.98.76,2.73,0l6.66-6.66v14.73c0,1.07.87,1.93,1.93,1.93s1.93-.87,1.93-1.93v-19.39c0-.06,0-.13,0-.19Z"/><path d="M50.6,82.82c-1.07,0-1.93.87-1.93,1.93v10.6c0,1.07.87,1.93,1.93,1.93s1.93-.87,1.93-1.93v-10.6c0-1.07-.87-1.93-1.93-1.93Z"/><path d="M72.44,75.77s0-.05-.01-.08c0-.04,0-.07-.02-.11,0-.03-.01-.06-.02-.09,0-.03-.01-.06-.02-.09,0-.03-.02-.06-.03-.09-.01-.03-.02-.06-.03-.09-.01-.03-.03-.05-.04-.08-.01-.03-.03-.06-.04-.09-.01-.03-.03-.05-.04-.08-.02-.03-.03-.06-.05-.09-.02-.03-.04-.05-.06-.08-.02-.02-.03-.05-.05-.07-.04-.05-.08-.1-.13-.14h0s-.09-.09-.14-.13c-.02-.02-.05-.03-.07-.05-.03-.02-.05-.04-.08-.06-.03-.02-.05-.03-.08-.05-.03-.02-.05-.03-.08-.05-.03-.01-.06-.03-.09-.04-.03-.01-.06-.03-.09-.04-.03-.01-.06-.02-.08-.03-.03-.01-.06-.02-.1-.03-.03,0-.05-.01-.08-.02-.03,0-.07-.02-.1-.02-.03,0-.06,0-.09-.01-.03,0-.06-.01-.1-.01-.05,0-.11,0-.16,0,0,0-.02,0-.03,0h0s-.02,0-.03,0c-.05,0-.11,0-.16,0-.03,0-.07,0-.1.01-.03,0-.06,0-.09.01-.04,0-.07.02-.11.03-.03,0-.05.01-.08.02-.03.01-.07.02-.1.04-.03,0-.05.02-.08.03-.03.01-.06.03-.09.04-.03.01-.05.02-.08.04-.03.02-.06.03-.09.05-.02.01-.05.03-.07.04-.03.02-.06.05-.1.07-.02.01-.04.03-.06.04-.05.04-.1.08-.14.13l-8.59,8.59-8.59-8.59c-.75-.75-1.98-.75-2.73,0h0c-.75.75-.75,1.98,0,2.73l9.96,9.96c.76.76,1.98.76,2.73,0l6.66-6.66v14.73c0,1.07.87,1.93,1.93,1.93h0c1.07,0,1.93-.87,1.93-1.93v-19.39c0-.06,0-.13,0-.19Z"/><path d="M90.74,92.98c-3.04,1.46-6.8.89-9.27-1.57-2.46-2.46-3.03-6.22-1.57-9.27.4-.83.14-1.82-.6-2.37h0c-.98-.74-2.39-.38-2.92.73-2.13,4.49-1.28,10.02,2.34,13.65s9.16,4.48,13.65,2.34c1.11-.53,1.46-1.94.73-2.92-.55-.73-1.54-.99-2.37-.6Z"/><path d="M95.7,77.18c-3.63-3.63-9.16-4.48-13.65-2.34-1.11.53-1.46,1.94-.73,2.92.55.73,1.54.99,2.37.6,3.04-1.46,6.8-.89,9.27,1.57,2.46,2.46,3.03,6.22,1.57,9.27-.4.83-.14,1.82.6,2.37.98.74,2.39.38,2.92-.73,2.13-4.49,1.28-10.02-2.34-13.65Z"/></g></g></svg>
|