dsh-token-usage-ledger 0.0.37 → 0.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/README.md +16 -10
- package/lib/client.js +1731 -568
- package/lib/host/aggregate.js +566 -0
- package/lib/host/backfill.d.ts +14 -0
- package/lib/host/backfill.js +30 -2
- package/lib/host/collector.d.ts +54 -3
- package/lib/host/collector.js +289 -10
- package/lib/host/ledger-io.d.ts +28 -1
- package/lib/host/ledger-io.js +54 -4
- package/lib/host/records.d.ts +18 -0
- package/lib/host/records.js +143 -1
- package/lib/host/schema.js +167 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +12 -7
- package/lib/shared/format.d.ts +19 -1
- package/lib/shared/format.js +70 -1
- package/lib/shared/protocol.d.ts +277 -3
- package/lib/shared/protocol.js +9 -2
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -31,7 +31,7 @@ __export(index_exports, {
|
|
|
31
31
|
name: () => name
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(index_exports);
|
|
34
|
-
var
|
|
34
|
+
var import_react9 = require("react");
|
|
35
35
|
|
|
36
36
|
// src/client/boundary.tsx
|
|
37
37
|
var import_react = require("react");
|
|
@@ -73,7 +73,7 @@ var ErrorBoundary = class extends import_react.Component {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
// src/client/dashboard.tsx
|
|
76
|
-
var
|
|
76
|
+
var import_react8 = require("react");
|
|
77
77
|
|
|
78
78
|
// src/shared/protocol.ts
|
|
79
79
|
function isObject(value) {
|
|
@@ -307,6 +307,44 @@ function formatDuration(milliseconds) {
|
|
|
307
307
|
const minutes = wholeMinutes % 60;
|
|
308
308
|
return minutes === 0 ? `${String(hours)}\u5C0F\u65F6` : `${String(hours)}\u5C0F\u65F6${String(minutes)}\u5206`;
|
|
309
309
|
}
|
|
310
|
+
function formatSpeed(tokensPerSecond) {
|
|
311
|
+
if (!Number.isFinite(tokensPerSecond) || tokensPerSecond <= 0) return "\u2014";
|
|
312
|
+
return `${tokensPerSecond >= 100 ? String(Math.round(tokensPerSecond)) : tokensPerSecond.toFixed(1)} tok/s`;
|
|
313
|
+
}
|
|
314
|
+
function formatShare(ratio) {
|
|
315
|
+
if (!Number.isFinite(ratio) || ratio < 0) return "\u2014";
|
|
316
|
+
return `${(ratio * 100).toFixed(1)}%`;
|
|
317
|
+
}
|
|
318
|
+
function zeroTimingTotals() {
|
|
319
|
+
return {
|
|
320
|
+
ttftMs: 0,
|
|
321
|
+
ttftSamples: 0,
|
|
322
|
+
decodeMs: 0,
|
|
323
|
+
decodeTokens: 0,
|
|
324
|
+
modelMs: 0,
|
|
325
|
+
modelSamples: 0,
|
|
326
|
+
toolMs: 0,
|
|
327
|
+
toolCalls: 0,
|
|
328
|
+
steps: 0,
|
|
329
|
+
stepSamples: 0,
|
|
330
|
+
calls: 0,
|
|
331
|
+
callsWithTiming: 0
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
function addTimingTotals(target, add) {
|
|
335
|
+
target.ttftMs += add.ttftMs;
|
|
336
|
+
target.ttftSamples += add.ttftSamples;
|
|
337
|
+
target.decodeMs += add.decodeMs;
|
|
338
|
+
target.decodeTokens += add.decodeTokens;
|
|
339
|
+
target.modelMs += add.modelMs;
|
|
340
|
+
target.modelSamples += add.modelSamples;
|
|
341
|
+
target.toolMs += add.toolMs;
|
|
342
|
+
target.toolCalls += add.toolCalls;
|
|
343
|
+
target.steps += add.steps;
|
|
344
|
+
target.stepSamples += add.stepSamples;
|
|
345
|
+
target.calls += add.calls;
|
|
346
|
+
target.callsWithTiming += add.callsWithTiming;
|
|
347
|
+
}
|
|
310
348
|
function cacheRateAxis(rates) {
|
|
311
349
|
const valid = rates.filter((rate) => Number.isFinite(rate) && rate >= 0 && rate <= 1);
|
|
312
350
|
if (valid.length === 0) return { min: 0, max: 1, ticks: [1, 0.5, 0], clippedBelow: 0 };
|
|
@@ -421,7 +459,8 @@ function bucketDaily(points, granularity) {
|
|
|
421
459
|
tokenBuckets: { ...point.tokens },
|
|
422
460
|
cost: point.cost,
|
|
423
461
|
estimated: point.estimated,
|
|
424
|
-
...point.estimatedReason === void 0 ? {} : { estimatedReason: point.estimatedReason }
|
|
462
|
+
...point.estimatedReason === void 0 ? {} : { estimatedReason: point.estimatedReason },
|
|
463
|
+
...point.perf === void 0 ? {} : { perf: { ...point.perf } }
|
|
425
464
|
}));
|
|
426
465
|
}
|
|
427
466
|
const buckets = [];
|
|
@@ -458,6 +497,11 @@ function bucketDaily(points, granularity) {
|
|
|
458
497
|
}
|
|
459
498
|
current.estimated = current.estimated || point.estimated;
|
|
460
499
|
current.endDay = point.date;
|
|
500
|
+
if (point.perf !== void 0) {
|
|
501
|
+
const perf = current.perf ?? zeroTimingTotals();
|
|
502
|
+
addTimingTotals(perf, point.perf);
|
|
503
|
+
current.perf = perf;
|
|
504
|
+
}
|
|
461
505
|
}
|
|
462
506
|
for (const bucket of buckets) {
|
|
463
507
|
bucket.longLabel = longLabelForBucket(bucket.key, granularity, bucket.endDay);
|
|
@@ -650,6 +694,17 @@ function BarChart(props) {
|
|
|
650
694
|
"aria-label": `${metric === "tokens" ? "Token" : "\u8D39\u7528"}\u6D88\u8017\u67F1\u72B6\u56FE`,
|
|
651
695
|
style: { "--dsh-tu-bar-gap": `${String(barGap)}px` }
|
|
652
696
|
},
|
|
697
|
+
(0, import_react2.createElement)(
|
|
698
|
+
"div",
|
|
699
|
+
{ className: "dsh-tu-gridlines", "aria-hidden": "true" },
|
|
700
|
+
...axis.ticks.filter((tick) => tick > 0).map(
|
|
701
|
+
(tick) => (0, import_react2.createElement)("span", {
|
|
702
|
+
key: `grid-${String(tick)}`,
|
|
703
|
+
className: "dsh-tu-gridline",
|
|
704
|
+
style: { bottom: `${String(tick / Math.max(1, axis.bound) * 100)}%` }
|
|
705
|
+
})
|
|
706
|
+
)
|
|
707
|
+
),
|
|
653
708
|
...buckets.map((bucket, index) => {
|
|
654
709
|
const value = values[index] ?? 0;
|
|
655
710
|
const percent = axis.bound === 0 ? 0 : value / axis.bound * 100;
|
|
@@ -734,11 +789,491 @@ function daySpan(bucket) {
|
|
|
734
789
|
return Math.max(1, Math.round((end - start) / 864e5) + 1);
|
|
735
790
|
}
|
|
736
791
|
|
|
792
|
+
// src/client/advanced.tsx
|
|
793
|
+
var import_react3 = require("react");
|
|
794
|
+
function polarPoint(cx, cy, radius, angle) {
|
|
795
|
+
return `${(cx + radius * Math.cos(angle)).toFixed(2)} ${(cy + radius * Math.sin(angle)).toFixed(2)}`;
|
|
796
|
+
}
|
|
797
|
+
function DualAreaTrend(props) {
|
|
798
|
+
const {
|
|
799
|
+
buckets,
|
|
800
|
+
leftValue,
|
|
801
|
+
rightValue,
|
|
802
|
+
leftLabel,
|
|
803
|
+
rightLabel,
|
|
804
|
+
formatLeft,
|
|
805
|
+
formatRight,
|
|
806
|
+
ariaLabel,
|
|
807
|
+
emptyHint
|
|
808
|
+
} = props;
|
|
809
|
+
const left = buckets.map((bucket, index) => ({ bucket, index, value: leftValue(bucket) })).filter(
|
|
810
|
+
(point) => point.value !== null && Number.isFinite(point.value)
|
|
811
|
+
);
|
|
812
|
+
const right = buckets.map((bucket, index) => ({ bucket, index, value: rightValue(bucket) })).filter(
|
|
813
|
+
(point) => point.value !== null && Number.isFinite(point.value)
|
|
814
|
+
);
|
|
815
|
+
const leftAxis = niceAxis(Math.max(0, ...left.map((point) => point.value)));
|
|
816
|
+
const rightAxis = niceAxis(Math.max(0, ...right.map((point) => point.value)));
|
|
817
|
+
const xOf = (index) => buckets.length <= 1 ? 50 : 3 + index / (buckets.length - 1) * 94;
|
|
818
|
+
const yOf = (value, bound) => bound <= 0 ? 97 : 97 - value / bound * 94;
|
|
819
|
+
const labelStride = Math.max(1, Math.ceil(buckets.length / 8));
|
|
820
|
+
const leftLine = left.map((point) => `${xOf(point.index).toFixed(2)},${yOf(point.value, leftAxis.bound).toFixed(2)}`).join(" ");
|
|
821
|
+
const rightLine = right.map((point) => `${xOf(point.index).toFixed(2)},${yOf(point.value, rightAxis.bound).toFixed(2)}`).join(" ");
|
|
822
|
+
const hasData = left.length > 0 || right.length > 0;
|
|
823
|
+
if (!hasData) return (0, import_react3.createElement)("div", { className: "dsh-tu-empty" }, emptyHint);
|
|
824
|
+
return (0, import_react3.createElement)(
|
|
825
|
+
"div",
|
|
826
|
+
{ className: "dsh-tu-dual", "data-chart": "dual-area" },
|
|
827
|
+
(0, import_react3.createElement)(
|
|
828
|
+
"div",
|
|
829
|
+
{ className: "dsh-tu-dual-legend" },
|
|
830
|
+
(0, import_react3.createElement)("span", { "data-series": "0" }, leftLabel),
|
|
831
|
+
(0, import_react3.createElement)("span", { "data-series": "2" }, rightLabel)
|
|
832
|
+
),
|
|
833
|
+
(0, import_react3.createElement)(
|
|
834
|
+
"div",
|
|
835
|
+
{ className: "dsh-tu-dual-plot" },
|
|
836
|
+
(0, import_react3.createElement)(
|
|
837
|
+
"div",
|
|
838
|
+
{ className: "dsh-tu-dual-yaxis dsh-tu-dual-yaxis-left", "aria-hidden": "true" },
|
|
839
|
+
...leftAxis.ticks.slice().reverse().map((tick) => (0, import_react3.createElement)("span", { key: `l-${String(tick)}` }, formatLeft(tick)))
|
|
840
|
+
),
|
|
841
|
+
(0, import_react3.createElement)(
|
|
842
|
+
"div",
|
|
843
|
+
{ className: "dsh-tu-dual-body" },
|
|
844
|
+
(0, import_react3.createElement)(
|
|
845
|
+
"div",
|
|
846
|
+
{ className: "dsh-tu-dual-canvas" },
|
|
847
|
+
(0, import_react3.createElement)(
|
|
848
|
+
"svg",
|
|
849
|
+
{
|
|
850
|
+
className: "dsh-tu-dual-svg",
|
|
851
|
+
viewBox: "0 0 100 100",
|
|
852
|
+
preserveAspectRatio: "none",
|
|
853
|
+
role: "img",
|
|
854
|
+
"aria-label": ariaLabel
|
|
855
|
+
},
|
|
856
|
+
(0, import_react3.createElement)("line", {
|
|
857
|
+
x1: 0,
|
|
858
|
+
y1: 50,
|
|
859
|
+
x2: 100,
|
|
860
|
+
y2: 50,
|
|
861
|
+
className: "dsh-tu-rate-grid",
|
|
862
|
+
vectorEffect: "non-scaling-stroke"
|
|
863
|
+
}),
|
|
864
|
+
left.length > 1 ? (0, import_react3.createElement)("polygon", {
|
|
865
|
+
points: `${leftLine} ${xOf(left[left.length - 1]?.index ?? 0).toFixed(2)},97 ${xOf(left[0]?.index ?? 0).toFixed(2)},97`,
|
|
866
|
+
className: "dsh-tu-dual-area",
|
|
867
|
+
"data-series": "0"
|
|
868
|
+
}) : null,
|
|
869
|
+
right.length > 1 ? (0, import_react3.createElement)("polygon", {
|
|
870
|
+
points: `${rightLine} ${xOf(right[right.length - 1]?.index ?? 0).toFixed(2)},97 ${xOf(right[0]?.index ?? 0).toFixed(2)},97`,
|
|
871
|
+
className: "dsh-tu-dual-area",
|
|
872
|
+
"data-series": "2"
|
|
873
|
+
}) : null,
|
|
874
|
+
(0, import_react3.createElement)("polyline", {
|
|
875
|
+
points: leftLine,
|
|
876
|
+
className: "dsh-tu-dual-line",
|
|
877
|
+
"data-series": "0",
|
|
878
|
+
fill: "none",
|
|
879
|
+
vectorEffect: "non-scaling-stroke"
|
|
880
|
+
}),
|
|
881
|
+
(0, import_react3.createElement)("polyline", {
|
|
882
|
+
points: rightLine,
|
|
883
|
+
className: "dsh-tu-dual-line",
|
|
884
|
+
"data-series": "2",
|
|
885
|
+
fill: "none",
|
|
886
|
+
vectorEffect: "non-scaling-stroke"
|
|
887
|
+
})
|
|
888
|
+
),
|
|
889
|
+
...left.map(
|
|
890
|
+
(point) => (0, import_react3.createElement)("span", {
|
|
891
|
+
key: `lp-${point.bucket.key}`,
|
|
892
|
+
className: "dsh-tu-dual-dot",
|
|
893
|
+
"data-series": "0",
|
|
894
|
+
style: {
|
|
895
|
+
left: `${String(xOf(point.index))}%`,
|
|
896
|
+
top: `${String(yOf(point.value, leftAxis.bound))}%`
|
|
897
|
+
},
|
|
898
|
+
title: `${point.bucket.longLabel}
|
|
899
|
+
${leftLabel} ${formatLeft(point.value)}`
|
|
900
|
+
})
|
|
901
|
+
),
|
|
902
|
+
...right.map(
|
|
903
|
+
(point) => (0, import_react3.createElement)("span", {
|
|
904
|
+
key: `rp-${point.bucket.key}`,
|
|
905
|
+
className: "dsh-tu-dual-dot",
|
|
906
|
+
"data-series": "2",
|
|
907
|
+
style: {
|
|
908
|
+
left: `${String(xOf(point.index))}%`,
|
|
909
|
+
top: `${String(yOf(point.value, rightAxis.bound))}%`
|
|
910
|
+
},
|
|
911
|
+
title: `${point.bucket.longLabel}
|
|
912
|
+
${rightLabel} ${formatRight(point.value)}`
|
|
913
|
+
})
|
|
914
|
+
)
|
|
915
|
+
),
|
|
916
|
+
(0, import_react3.createElement)(
|
|
917
|
+
"div",
|
|
918
|
+
{ className: "dsh-tu-axis" },
|
|
919
|
+
...buckets.map(
|
|
920
|
+
(bucket, index) => index % labelStride === 0 || index === buckets.length - 1 ? (0, import_react3.createElement)("span", { key: bucket.key }, bucket.label) : null
|
|
921
|
+
).filter((node) => node !== null)
|
|
922
|
+
)
|
|
923
|
+
),
|
|
924
|
+
(0, import_react3.createElement)(
|
|
925
|
+
"div",
|
|
926
|
+
{ className: "dsh-tu-dual-yaxis dsh-tu-dual-yaxis-right", "aria-hidden": "true" },
|
|
927
|
+
...rightAxis.ticks.slice().reverse().map((tick) => (0, import_react3.createElement)("span", { key: `r-${String(tick)}` }, formatRight(tick)))
|
|
928
|
+
)
|
|
929
|
+
)
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
function RadarChart(props) {
|
|
933
|
+
const { axes, series, ariaLabel, emptyHint } = props;
|
|
934
|
+
const [hover, setHover] = (0, import_react3.useState)(null);
|
|
935
|
+
const usable = series.filter(
|
|
936
|
+
(row) => row.values.length === axes.length && row.values.every((value) => Number.isFinite(value))
|
|
937
|
+
);
|
|
938
|
+
if (axes.length < 3 || usable.length === 0) {
|
|
939
|
+
return (0, import_react3.createElement)("div", { className: "dsh-tu-empty" }, emptyHint);
|
|
940
|
+
}
|
|
941
|
+
const center = 60;
|
|
942
|
+
const radius = 43;
|
|
943
|
+
const angleOf = (index) => -Math.PI / 2 + index / axes.length * Math.PI * 2;
|
|
944
|
+
const pointOf = (index, value) => polarPoint(center, center, radius * Math.max(0, Math.min(1, value)), angleOf(index));
|
|
945
|
+
const tooltip = hover === null ? null : (0, import_react3.createElement)(
|
|
946
|
+
"div",
|
|
947
|
+
{
|
|
948
|
+
className: "dsh-tu-tooltip",
|
|
949
|
+
style: {
|
|
950
|
+
left: `${String(Math.min(hover.x + 14, Math.max(0, window.innerWidth - 300)))}px`,
|
|
951
|
+
top: `${String(Math.max(8, hover.y - 120))}px`
|
|
952
|
+
}
|
|
953
|
+
},
|
|
954
|
+
(0, import_react3.createElement)("div", null, (0, import_react3.createElement)("b", null, hover.row.label)),
|
|
955
|
+
...hover.row.details.map(
|
|
956
|
+
(detail) => (0, import_react3.createElement)("div", { key: detail, className: "dsh-tu-tooltip-detail" }, detail)
|
|
957
|
+
)
|
|
958
|
+
);
|
|
959
|
+
return (0, import_react3.createElement)(
|
|
960
|
+
"div",
|
|
961
|
+
{ className: "dsh-tu-radar", "data-chart": "radar" },
|
|
962
|
+
(0, import_react3.createElement)(
|
|
963
|
+
"svg",
|
|
964
|
+
{ viewBox: "-20 0 160 120", role: "img", "aria-label": ariaLabel },
|
|
965
|
+
...[0.25, 0.5, 0.75, 1].map(
|
|
966
|
+
(ring) => (0, import_react3.createElement)("polygon", {
|
|
967
|
+
key: `ring-${String(ring)}`,
|
|
968
|
+
points: axes.map((_axis, index) => polarPoint(center, center, radius * ring, angleOf(index))).join(" "),
|
|
969
|
+
className: "dsh-tu-radar-ring"
|
|
970
|
+
})
|
|
971
|
+
),
|
|
972
|
+
...axes.map((axis, index) => {
|
|
973
|
+
const outer = polarPoint(center, center, radius, angleOf(index));
|
|
974
|
+
const label = polarPoint(center, center, radius + 10, angleOf(index));
|
|
975
|
+
const labelX = Number(label.split(" ")[0]);
|
|
976
|
+
const labelY = Number(label.split(" ")[1]);
|
|
977
|
+
const anchor = labelX < center - 1 ? "end" : labelX > center + 1 ? "start" : "middle";
|
|
978
|
+
return (0, import_react3.createElement)(
|
|
979
|
+
"g",
|
|
980
|
+
{ key: axis },
|
|
981
|
+
(0, import_react3.createElement)("line", {
|
|
982
|
+
x1: center,
|
|
983
|
+
y1: center,
|
|
984
|
+
x2: outer.split(" ")[0],
|
|
985
|
+
y2: outer.split(" ")[1],
|
|
986
|
+
className: "dsh-tu-radar-axis"
|
|
987
|
+
}),
|
|
988
|
+
(0, import_react3.createElement)(
|
|
989
|
+
"text",
|
|
990
|
+
{
|
|
991
|
+
x: labelX + (anchor === "end" ? -2 : anchor === "start" ? 2 : 0),
|
|
992
|
+
y: labelY,
|
|
993
|
+
className: "dsh-tu-radar-label",
|
|
994
|
+
textAnchor: anchor,
|
|
995
|
+
dominantBaseline: "middle"
|
|
996
|
+
},
|
|
997
|
+
axis
|
|
998
|
+
)
|
|
999
|
+
);
|
|
1000
|
+
}),
|
|
1001
|
+
...usable.map(
|
|
1002
|
+
(row) => (0, import_react3.createElement)(
|
|
1003
|
+
"g",
|
|
1004
|
+
{ key: row.key },
|
|
1005
|
+
(0, import_react3.createElement)("polygon", {
|
|
1006
|
+
points: row.values.map((value, index) => pointOf(index, value)).join(" "),
|
|
1007
|
+
className: "dsh-tu-radar-area",
|
|
1008
|
+
"data-series": String(row.colorIndex % 5)
|
|
1009
|
+
}),
|
|
1010
|
+
...row.values.map((value, index) => {
|
|
1011
|
+
const point = pointOf(index, value).split(" ");
|
|
1012
|
+
return (0, import_react3.createElement)(
|
|
1013
|
+
"g",
|
|
1014
|
+
{ key: `${row.key}-${String(index)}` },
|
|
1015
|
+
(0, import_react3.createElement)("circle", {
|
|
1016
|
+
cx: point[0],
|
|
1017
|
+
cy: point[1],
|
|
1018
|
+
r: 2.2,
|
|
1019
|
+
className: "dsh-tu-radar-dot",
|
|
1020
|
+
"data-series": String(row.colorIndex % 5)
|
|
1021
|
+
}),
|
|
1022
|
+
(0, import_react3.createElement)("circle", {
|
|
1023
|
+
cx: point[0],
|
|
1024
|
+
cy: point[1],
|
|
1025
|
+
r: 6,
|
|
1026
|
+
className: "dsh-tu-radar-hit",
|
|
1027
|
+
onMouseMove: (event) => {
|
|
1028
|
+
setHover({ x: event.clientX, y: event.clientY, row });
|
|
1029
|
+
},
|
|
1030
|
+
onMouseLeave: () => {
|
|
1031
|
+
setHover(null);
|
|
1032
|
+
}
|
|
1033
|
+
})
|
|
1034
|
+
);
|
|
1035
|
+
})
|
|
1036
|
+
)
|
|
1037
|
+
)
|
|
1038
|
+
),
|
|
1039
|
+
(0, import_react3.createElement)(
|
|
1040
|
+
"div",
|
|
1041
|
+
{ className: "dsh-tu-radar-legend" },
|
|
1042
|
+
...usable.map(
|
|
1043
|
+
(row) => (0, import_react3.createElement)(
|
|
1044
|
+
"span",
|
|
1045
|
+
{ key: row.key },
|
|
1046
|
+
(0, import_react3.createElement)("span", { className: "dsh-tu-radar-swatch", "data-series": String(row.colorIndex % 5) }),
|
|
1047
|
+
row.label
|
|
1048
|
+
)
|
|
1049
|
+
)
|
|
1050
|
+
),
|
|
1051
|
+
tooltip
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
1054
|
+
function DotPlot(props) {
|
|
1055
|
+
const { items, formatValue, emptyHint, xLabel, yLabel } = props;
|
|
1056
|
+
const max = Math.max(0, ...items.map((item) => item.count));
|
|
1057
|
+
if (max <= 0) return (0, import_react3.createElement)("div", { className: "dsh-tu-empty" }, emptyHint);
|
|
1058
|
+
return (0, import_react3.createElement)(
|
|
1059
|
+
"div",
|
|
1060
|
+
{ className: "dsh-tu-dotplot", "data-chart": "dotplot" },
|
|
1061
|
+
(0, import_react3.createElement)(
|
|
1062
|
+
"div",
|
|
1063
|
+
{ className: "dsh-tu-dotplot-area" },
|
|
1064
|
+
...items.map((item) => {
|
|
1065
|
+
const percent = item.count / max * 100;
|
|
1066
|
+
const hasValue = item.count > 0;
|
|
1067
|
+
return (0, import_react3.createElement)(
|
|
1068
|
+
"div",
|
|
1069
|
+
{
|
|
1070
|
+
key: item.label,
|
|
1071
|
+
className: "dsh-tu-dotplot-col",
|
|
1072
|
+
title: `${item.label}\uFF1A${formatValue(item.count)}`
|
|
1073
|
+
},
|
|
1074
|
+
(0, import_react3.createElement)("span", { className: "dsh-tu-dotplot-value" }, hasValue ? formatValue(item.count) : ""),
|
|
1075
|
+
(0, import_react3.createElement)(
|
|
1076
|
+
"span",
|
|
1077
|
+
{ className: "dsh-tu-dotplot-stem", style: { height: `${String(percent)}%` } },
|
|
1078
|
+
(0, import_react3.createElement)("span", {
|
|
1079
|
+
className: "dsh-tu-dotplot-dot",
|
|
1080
|
+
"data-zero": hasValue ? void 0 : "true"
|
|
1081
|
+
})
|
|
1082
|
+
)
|
|
1083
|
+
);
|
|
1084
|
+
})
|
|
1085
|
+
),
|
|
1086
|
+
(0, import_react3.createElement)(
|
|
1087
|
+
"div",
|
|
1088
|
+
{ className: "dsh-tu-dotplot-axis" },
|
|
1089
|
+
...items.map((item) => (0, import_react3.createElement)("span", { key: item.label }, item.label))
|
|
1090
|
+
),
|
|
1091
|
+
xLabel !== void 0 || yLabel !== void 0 ? (0, import_react3.createElement)(
|
|
1092
|
+
"div",
|
|
1093
|
+
{ className: "dsh-tu-dotplot-caption" },
|
|
1094
|
+
xLabel === void 0 ? null : (0, import_react3.createElement)("span", null, `\u6A2A\u8F74 ${xLabel}`),
|
|
1095
|
+
yLabel === void 0 ? null : (0, import_react3.createElement)("span", null, `\u7EB5\u8F74 ${yLabel}`)
|
|
1096
|
+
) : null
|
|
1097
|
+
);
|
|
1098
|
+
}
|
|
1099
|
+
function OutlierBarChart(props) {
|
|
1100
|
+
const { items, formatValue, emptyHint } = props;
|
|
1101
|
+
const positive = items.filter((item) => Number.isFinite(item.value) && item.value > 0).slice().sort((left, right) => right.value - left.value);
|
|
1102
|
+
if (positive.length === 0) return (0, import_react3.createElement)("div", { className: "dsh-tu-empty" }, emptyHint);
|
|
1103
|
+
const max = positive[0]?.value ?? 0;
|
|
1104
|
+
const second = positive[1]?.value ?? 0;
|
|
1105
|
+
const broken = positive.length > 1 && second > 0 && max > second * 2.5;
|
|
1106
|
+
const bound = broken ? Math.max(1, second * 1.15) : Math.max(1, max);
|
|
1107
|
+
const widthOf = (value) => broken && value === max ? 100 : Math.max(0.4, Math.min(100, value / bound * 100));
|
|
1108
|
+
return (0, import_react3.createElement)(
|
|
1109
|
+
"div",
|
|
1110
|
+
{ className: "dsh-tu-outlier-bars", "data-chart": "outlier-bars", role: "img", "aria-label": "\u5DE5\u5177\u8017\u65F6\u6392\u884C\uFF08\u65AD\u8F74\uFF09" },
|
|
1111
|
+
...positive.map((item) => {
|
|
1112
|
+
const isBrokenValue = broken && item.value === max;
|
|
1113
|
+
return (0, import_react3.createElement)(
|
|
1114
|
+
"div",
|
|
1115
|
+
{
|
|
1116
|
+
key: item.key,
|
|
1117
|
+
className: "dsh-tu-outlier-row",
|
|
1118
|
+
title: `${item.label}
|
|
1119
|
+
${item.details.join("\n")}`
|
|
1120
|
+
},
|
|
1121
|
+
(0, import_react3.createElement)("span", { className: "dsh-tu-outlier-label" }, item.label),
|
|
1122
|
+
(0, import_react3.createElement)(
|
|
1123
|
+
"span",
|
|
1124
|
+
{ className: "dsh-tu-outlier-track" },
|
|
1125
|
+
(0, import_react3.createElement)("span", {
|
|
1126
|
+
className: "dsh-tu-outlier-bar",
|
|
1127
|
+
"data-series": String(item.colorIndex % 5),
|
|
1128
|
+
"data-broken": isBrokenValue ? "true" : void 0,
|
|
1129
|
+
style: { width: `${String(widthOf(item.value))}%` }
|
|
1130
|
+
}),
|
|
1131
|
+
isBrokenValue ? (0, import_react3.createElement)("span", { className: "dsh-tu-outlier-cut" }, "//") : null
|
|
1132
|
+
),
|
|
1133
|
+
(0, import_react3.createElement)("b", { className: "dsh-tu-outlier-value" }, formatValue(item.value))
|
|
1134
|
+
);
|
|
1135
|
+
}),
|
|
1136
|
+
(0, import_react3.createElement)(
|
|
1137
|
+
"div",
|
|
1138
|
+
{ className: "dsh-tu-outlier-axis" },
|
|
1139
|
+
(0, import_react3.createElement)("span", null, "0"),
|
|
1140
|
+
(0, import_react3.createElement)("span", null, formatValue(bound / 2)),
|
|
1141
|
+
(0, import_react3.createElement)("span", null, formatValue(bound))
|
|
1142
|
+
)
|
|
1143
|
+
);
|
|
1144
|
+
}
|
|
1145
|
+
function SpeedRangeChart(props) {
|
|
1146
|
+
const { rows, formatValue, emptyHint } = props;
|
|
1147
|
+
const usable = rows.filter(
|
|
1148
|
+
(row) => Number.isFinite(row.p90) && row.p90 > 0 && Number.isFinite(row.p50) && row.p50 >= 0
|
|
1149
|
+
);
|
|
1150
|
+
if (usable.length === 0) return (0, import_react3.createElement)("div", { className: "dsh-tu-empty" }, emptyHint);
|
|
1151
|
+
const bound = Math.max(1, niceAxis(Math.max(...usable.map((row) => row.p90))).bound);
|
|
1152
|
+
const percent = (value) => Math.max(0, Math.min(100, value / bound * 100));
|
|
1153
|
+
return (0, import_react3.createElement)(
|
|
1154
|
+
"div",
|
|
1155
|
+
{ className: "dsh-tu-range", "data-chart": "speed-range" },
|
|
1156
|
+
(0, import_react3.createElement)(
|
|
1157
|
+
"div",
|
|
1158
|
+
{ className: "dsh-tu-range-rows" },
|
|
1159
|
+
...usable.map(
|
|
1160
|
+
(row) => (0, import_react3.createElement)(
|
|
1161
|
+
"div",
|
|
1162
|
+
{
|
|
1163
|
+
key: row.key,
|
|
1164
|
+
className: "dsh-tu-range-row",
|
|
1165
|
+
title: `${row.label}
|
|
1166
|
+
\u4E2D\u4F4D ${formatValue(row.p50)}
|
|
1167
|
+
25\u201375 \u5206\u4F4D ${formatValue(row.p25)}\u2013${formatValue(row.p75)}
|
|
1168
|
+
10\u201390 \u5206\u4F4D ${formatValue(row.p10)}\u2013${formatValue(row.p90)}
|
|
1169
|
+
${String(row.samples)} \u4E2A\u91C7\u6837`
|
|
1170
|
+
},
|
|
1171
|
+
(0, import_react3.createElement)("span", { className: "dsh-tu-range-label" }, row.label),
|
|
1172
|
+
(0, import_react3.createElement)(
|
|
1173
|
+
"div",
|
|
1174
|
+
{ className: "dsh-tu-range-track" },
|
|
1175
|
+
(0, import_react3.createElement)("span", {
|
|
1176
|
+
className: "dsh-tu-range-whisker",
|
|
1177
|
+
"data-series": String(row.colorIndex % 5),
|
|
1178
|
+
style: {
|
|
1179
|
+
left: `${String(percent(row.p10))}%`,
|
|
1180
|
+
width: `${String(Math.max(0.5, percent(row.p90) - percent(row.p10)))}%`
|
|
1181
|
+
}
|
|
1182
|
+
}),
|
|
1183
|
+
(0, import_react3.createElement)("span", {
|
|
1184
|
+
className: "dsh-tu-range-box",
|
|
1185
|
+
"data-series": String(row.colorIndex % 5),
|
|
1186
|
+
style: {
|
|
1187
|
+
left: `${String(percent(row.p25))}%`,
|
|
1188
|
+
width: `${String(Math.max(1, percent(row.p75) - percent(row.p25)))}%`
|
|
1189
|
+
}
|
|
1190
|
+
}),
|
|
1191
|
+
(0, import_react3.createElement)("span", {
|
|
1192
|
+
className: "dsh-tu-range-median",
|
|
1193
|
+
"data-series": String(row.colorIndex % 5),
|
|
1194
|
+
style: { left: `${String(percent(row.p50))}%` }
|
|
1195
|
+
})
|
|
1196
|
+
),
|
|
1197
|
+
(0, import_react3.createElement)("span", { className: "dsh-tu-range-value" }, formatValue(row.p50))
|
|
1198
|
+
)
|
|
1199
|
+
)
|
|
1200
|
+
),
|
|
1201
|
+
(0, import_react3.createElement)(
|
|
1202
|
+
"div",
|
|
1203
|
+
{ className: "dsh-tu-range-axis" },
|
|
1204
|
+
(0, import_react3.createElement)("span", null, "0"),
|
|
1205
|
+
(0, import_react3.createElement)("span", null, formatValue(bound / 2)),
|
|
1206
|
+
(0, import_react3.createElement)("span", null, formatValue(bound))
|
|
1207
|
+
),
|
|
1208
|
+
(0, import_react3.createElement)("div", { className: "dsh-tu-range-caption" }, "\u7BB1\u4F53 = 25\u201375 \u5206\u4F4D \xB7 \u4E2D\u7EBF = \u4E2D\u4F4D \xB7 \u7EC6\u7EBF = 10\u201390 \u5206\u4F4D \xB7 \u6A2A\u8F74 tok/s")
|
|
1209
|
+
);
|
|
1210
|
+
}
|
|
1211
|
+
function GaugeShare(props) {
|
|
1212
|
+
const { value, total, valueLabel, remainderLabel, formatValue, emptyHint } = props;
|
|
1213
|
+
if (!Number.isFinite(value) || !Number.isFinite(total) || total <= 0) {
|
|
1214
|
+
return (0, import_react3.createElement)("div", { className: "dsh-tu-empty" }, emptyHint);
|
|
1215
|
+
}
|
|
1216
|
+
const share = Math.max(0, Math.min(1, value / total));
|
|
1217
|
+
return (0, import_react3.createElement)(
|
|
1218
|
+
"div",
|
|
1219
|
+
{ className: "dsh-tu-gauge", "data-chart": "gauge" },
|
|
1220
|
+
(0, import_react3.createElement)(
|
|
1221
|
+
"svg",
|
|
1222
|
+
{ viewBox: "0 0 100 58", role: "img", "aria-label": `${valueLabel}\u5360${remainderLabel}\u4E0E${valueLabel}\u5408\u8BA1\u7684\u6BD4\u4F8B` },
|
|
1223
|
+
(0, import_react3.createElement)("path", {
|
|
1224
|
+
d: "M 10 50 A 40 40 0 0 1 90 50",
|
|
1225
|
+
pathLength: 100,
|
|
1226
|
+
className: "dsh-tu-gauge-track",
|
|
1227
|
+
fill: "none"
|
|
1228
|
+
}),
|
|
1229
|
+
(0, import_react3.createElement)("path", {
|
|
1230
|
+
d: "M 10 50 A 40 40 0 0 1 90 50",
|
|
1231
|
+
pathLength: 100,
|
|
1232
|
+
className: "dsh-tu-gauge-rest",
|
|
1233
|
+
fill: "none"
|
|
1234
|
+
}),
|
|
1235
|
+
(0, import_react3.createElement)("path", {
|
|
1236
|
+
d: "M 10 50 A 40 40 0 0 1 90 50",
|
|
1237
|
+
pathLength: 100,
|
|
1238
|
+
className: "dsh-tu-gauge-value",
|
|
1239
|
+
fill: "none",
|
|
1240
|
+
strokeDasharray: `${String(share * 100)} 100`
|
|
1241
|
+
}),
|
|
1242
|
+
(0, import_react3.createElement)(
|
|
1243
|
+
"text",
|
|
1244
|
+
{ x: 50, y: 43, className: "dsh-tu-gauge-center", textAnchor: "middle" },
|
|
1245
|
+
`${(share * 100).toFixed(1)}%`
|
|
1246
|
+
),
|
|
1247
|
+
(0, import_react3.createElement)(
|
|
1248
|
+
"text",
|
|
1249
|
+
{ x: 50, y: 53, className: "dsh-tu-gauge-caption", textAnchor: "middle" },
|
|
1250
|
+
valueLabel
|
|
1251
|
+
)
|
|
1252
|
+
),
|
|
1253
|
+
(0, import_react3.createElement)(
|
|
1254
|
+
"div",
|
|
1255
|
+
{ className: "dsh-tu-gauge-legend" },
|
|
1256
|
+
(0, import_react3.createElement)(
|
|
1257
|
+
"span",
|
|
1258
|
+
null,
|
|
1259
|
+
(0, import_react3.createElement)("span", { className: "dsh-tu-gauge-swatch", "data-series": "1" }),
|
|
1260
|
+
`${valueLabel} ${formatValue(value)}`
|
|
1261
|
+
),
|
|
1262
|
+
(0, import_react3.createElement)(
|
|
1263
|
+
"span",
|
|
1264
|
+
null,
|
|
1265
|
+
(0, import_react3.createElement)("span", { className: "dsh-tu-gauge-swatch", "data-series": "0" }),
|
|
1266
|
+
`${remainderLabel} ${formatValue(Math.max(0, total - value))}`
|
|
1267
|
+
)
|
|
1268
|
+
)
|
|
1269
|
+
);
|
|
1270
|
+
}
|
|
1271
|
+
|
|
737
1272
|
// src/client/sidebar-entry.tsx
|
|
738
|
-
var
|
|
1273
|
+
var import_react5 = require("react");
|
|
739
1274
|
|
|
740
1275
|
// src/client/icon.tsx
|
|
741
|
-
var
|
|
1276
|
+
var import_react4 = require("react");
|
|
742
1277
|
var BARS = [
|
|
743
1278
|
{ x: 3.4, y: 15.4, height: 5.6, opacity: 0.5 },
|
|
744
1279
|
{ x: 10.1, y: 12, height: 9, opacity: 0.72 },
|
|
@@ -748,7 +1283,7 @@ var TREND_END = { x: 18.7, y: 4.8 };
|
|
|
748
1283
|
function TokenUsageIcon(props) {
|
|
749
1284
|
const size = typeof props.size === "number" && props.size > 0 ? props.size : 20;
|
|
750
1285
|
const active = props.active === true;
|
|
751
|
-
return (0,
|
|
1286
|
+
return (0, import_react4.createElement)(
|
|
752
1287
|
"svg",
|
|
753
1288
|
{
|
|
754
1289
|
width: size,
|
|
@@ -763,7 +1298,7 @@ function TokenUsageIcon(props) {
|
|
|
763
1298
|
style: { display: "block", opacity: active ? 1 : 0.92 }
|
|
764
1299
|
},
|
|
765
1300
|
...BARS.map(
|
|
766
|
-
(bar) => (0,
|
|
1301
|
+
(bar) => (0, import_react4.createElement)("rect", {
|
|
767
1302
|
key: `bar-${String(bar.x)}`,
|
|
768
1303
|
x: bar.x,
|
|
769
1304
|
y: bar.y,
|
|
@@ -774,7 +1309,7 @@ function TokenUsageIcon(props) {
|
|
|
774
1309
|
opacity: bar.opacity
|
|
775
1310
|
})
|
|
776
1311
|
),
|
|
777
|
-
(0,
|
|
1312
|
+
(0, import_react4.createElement)("path", {
|
|
778
1313
|
key: "trend",
|
|
779
1314
|
d: `M 5.3 12.6 L 12 9 L ${String(TREND_END.x)} ${String(TREND_END.y)}`,
|
|
780
1315
|
stroke: "currentColor",
|
|
@@ -783,7 +1318,7 @@ function TokenUsageIcon(props) {
|
|
|
783
1318
|
strokeLinejoin: "round",
|
|
784
1319
|
opacity: 0.95
|
|
785
1320
|
}),
|
|
786
|
-
(0,
|
|
1321
|
+
(0, import_react4.createElement)("circle", {
|
|
787
1322
|
key: "trend-end",
|
|
788
1323
|
cx: TREND_END.x,
|
|
789
1324
|
cy: TREND_END.y,
|
|
@@ -797,11 +1332,11 @@ function TokenUsageIcon(props) {
|
|
|
797
1332
|
var PANEL_ID = "token-usage";
|
|
798
1333
|
var PANEL_LABEL = "Token\u6D88\u8017\u7EDF\u8BA1";
|
|
799
1334
|
function TokenUsagePanelIcon(props) {
|
|
800
|
-
return (0,
|
|
1335
|
+
return (0, import_react5.createElement)(TokenUsageIcon, { size: props.size, active: props.active });
|
|
801
1336
|
}
|
|
802
1337
|
|
|
803
1338
|
// src/client/insights.tsx
|
|
804
|
-
var
|
|
1339
|
+
var import_react6 = require("react");
|
|
805
1340
|
var STACK_SERIES = [
|
|
806
1341
|
{ key: "cacheRead", label: "\u7F13\u5B58\u547D\u4E2D" },
|
|
807
1342
|
{ key: "uncachedInput", label: "\u7F13\u5B58\u672A\u547D\u4E2D" },
|
|
@@ -817,27 +1352,27 @@ function formatRateTick(rate) {
|
|
|
817
1352
|
}
|
|
818
1353
|
function CacheCompositionChart(props) {
|
|
819
1354
|
const { buckets, emptyHint } = props;
|
|
820
|
-
const [hover, setHover] = (0,
|
|
1355
|
+
const [hover, setHover] = (0, import_react6.useState)(null);
|
|
821
1356
|
const values = buckets.map((bucket) => tokenTotal(bucket.tokenBuckets));
|
|
822
1357
|
const axis = niceAxis(Math.max(0, ...values));
|
|
823
1358
|
const hasData = values.some((value) => value > 0);
|
|
824
1359
|
const labelStride = Math.max(1, Math.ceil(buckets.length / 8));
|
|
825
1360
|
const barGap = buckets.length > 120 ? 0 : buckets.length > 60 ? 1 : 2;
|
|
826
|
-
return (0,
|
|
1361
|
+
return (0, import_react6.createElement)(
|
|
827
1362
|
"div",
|
|
828
1363
|
null,
|
|
829
|
-
(0,
|
|
1364
|
+
(0, import_react6.createElement)(
|
|
830
1365
|
"div",
|
|
831
1366
|
{ className: "dsh-tu-plot" },
|
|
832
|
-
(0,
|
|
1367
|
+
(0, import_react6.createElement)(
|
|
833
1368
|
"div",
|
|
834
1369
|
{ className: "dsh-tu-yaxis", "aria-hidden": "true" },
|
|
835
|
-
...axis.ticks.slice().reverse().map((tick) => (0,
|
|
1370
|
+
...axis.ticks.slice().reverse().map((tick) => (0, import_react6.createElement)("span", { key: `ct-${String(tick)}` }, formatTokens(tick)))
|
|
836
1371
|
),
|
|
837
|
-
(0,
|
|
1372
|
+
(0, import_react6.createElement)(
|
|
838
1373
|
"div",
|
|
839
1374
|
{ className: "dsh-tu-plot-body" },
|
|
840
|
-
(0,
|
|
1375
|
+
(0, import_react6.createElement)(
|
|
841
1376
|
"div",
|
|
842
1377
|
{
|
|
843
1378
|
className: "dsh-tu-stacked-bars",
|
|
@@ -845,9 +1380,20 @@ function CacheCompositionChart(props) {
|
|
|
845
1380
|
"aria-label": "Token \u6784\u6210\u5806\u53E0\u67F1\u72B6\u56FE\uFF1A\u7F13\u5B58\u547D\u4E2D\u3001\u672A\u547D\u4E2D\u3001\u5199\u5165\u4E0E\u8F93\u51FA",
|
|
846
1381
|
style: { "--dsh-tu-bar-gap": `${String(barGap)}px` }
|
|
847
1382
|
},
|
|
1383
|
+
(0, import_react6.createElement)(
|
|
1384
|
+
"div",
|
|
1385
|
+
{ className: "dsh-tu-gridlines", "aria-hidden": "true" },
|
|
1386
|
+
...axis.ticks.filter((tick) => tick > 0).map(
|
|
1387
|
+
(tick) => (0, import_react6.createElement)("span", {
|
|
1388
|
+
key: `grid-${String(tick)}`,
|
|
1389
|
+
className: "dsh-tu-gridline",
|
|
1390
|
+
style: { bottom: `${String(tick / Math.max(1, axis.bound) * 100)}%` }
|
|
1391
|
+
})
|
|
1392
|
+
)
|
|
1393
|
+
),
|
|
848
1394
|
...buckets.map((bucket, index) => {
|
|
849
1395
|
const stack = STACK_SERIES.filter((series) => bucket.tokenBuckets[series.key] > 0);
|
|
850
|
-
return (0,
|
|
1396
|
+
return (0, import_react6.createElement)(
|
|
851
1397
|
"div",
|
|
852
1398
|
{
|
|
853
1399
|
key: bucket.key,
|
|
@@ -866,7 +1412,7 @@ function CacheCompositionChart(props) {
|
|
|
866
1412
|
...stack.map((series) => {
|
|
867
1413
|
const value = bucket.tokenBuckets[series.key];
|
|
868
1414
|
const percent = axis.bound === 0 ? 0 : value / axis.bound * 100;
|
|
869
|
-
return (0,
|
|
1415
|
+
return (0, import_react6.createElement)("div", {
|
|
870
1416
|
key: series.key,
|
|
871
1417
|
className: "dsh-tu-stack-seg",
|
|
872
1418
|
"data-series": series.key,
|
|
@@ -879,37 +1425,37 @@ function CacheCompositionChart(props) {
|
|
|
879
1425
|
);
|
|
880
1426
|
})
|
|
881
1427
|
),
|
|
882
|
-
(0,
|
|
1428
|
+
(0, import_react6.createElement)(
|
|
883
1429
|
"div",
|
|
884
1430
|
{ className: "dsh-tu-axis" },
|
|
885
1431
|
...buckets.map(
|
|
886
|
-
(bucket, index) => index % labelStride === 0 || index === buckets.length - 1 ? (0,
|
|
1432
|
+
(bucket, index) => index % labelStride === 0 || index === buckets.length - 1 ? (0, import_react6.createElement)("span", { key: bucket.key }, bucket.label) : null
|
|
887
1433
|
).filter((node) => node !== null)
|
|
888
1434
|
)
|
|
889
1435
|
)
|
|
890
1436
|
),
|
|
891
|
-
hasData ? (0,
|
|
1437
|
+
hasData ? (0, import_react6.createElement)(
|
|
892
1438
|
"div",
|
|
893
1439
|
{ className: "dsh-tu-stack-legend" },
|
|
894
1440
|
...STACK_SERIES.filter(
|
|
895
1441
|
(series) => buckets.some((bucket) => bucket.tokenBuckets[series.key] > 0)
|
|
896
1442
|
).map(
|
|
897
|
-
(series) => (0,
|
|
1443
|
+
(series) => (0, import_react6.createElement)(
|
|
898
1444
|
"span",
|
|
899
1445
|
{ key: series.key, className: "dsh-tu-stack-legend-item" },
|
|
900
|
-
(0,
|
|
1446
|
+
(0, import_react6.createElement)("span", { className: "dsh-tu-swatch", "data-series": series.key }),
|
|
901
1447
|
series.label
|
|
902
1448
|
)
|
|
903
1449
|
)
|
|
904
1450
|
) : null,
|
|
905
|
-
hasData ? null : (0,
|
|
1451
|
+
hasData ? null : (0, import_react6.createElement)("div", { className: "dsh-tu-empty" }, emptyHint),
|
|
906
1452
|
hover === null ? null : createCompositionTooltip(hover, buckets[hover.index])
|
|
907
1453
|
);
|
|
908
1454
|
}
|
|
909
1455
|
function createCompositionTooltip(hover, bucket) {
|
|
910
1456
|
if (bucket === void 0) return null;
|
|
911
1457
|
const total = tokenTotal(bucket.tokenBuckets);
|
|
912
|
-
return (0,
|
|
1458
|
+
return (0, import_react6.createElement)(
|
|
913
1459
|
"div",
|
|
914
1460
|
{
|
|
915
1461
|
className: "dsh-tu-tooltip",
|
|
@@ -918,25 +1464,25 @@ function createCompositionTooltip(hover, bucket) {
|
|
|
918
1464
|
top: `${String(Math.max(8, hover.y - 92))}px`
|
|
919
1465
|
}
|
|
920
1466
|
},
|
|
921
|
-
(0,
|
|
922
|
-
(0,
|
|
1467
|
+
(0, import_react6.createElement)("div", null, bucket.longLabel),
|
|
1468
|
+
(0, import_react6.createElement)(
|
|
923
1469
|
"div",
|
|
924
1470
|
{ className: "dsh-tu-tooltip-head" },
|
|
925
1471
|
"\u5408\u8BA1 ",
|
|
926
|
-
(0,
|
|
1472
|
+
(0, import_react6.createElement)("b", null, `${formatTokensExact(total)} tokens`)
|
|
927
1473
|
),
|
|
928
1474
|
...STACK_SERIES.filter((series) => bucket.tokenBuckets[series.key] > 0).map((series) => {
|
|
929
1475
|
const value = bucket.tokenBuckets[series.key];
|
|
930
1476
|
const share = total === 0 ? 0 : value / total * 100;
|
|
931
|
-
return (0,
|
|
1477
|
+
return (0, import_react6.createElement)(
|
|
932
1478
|
"div",
|
|
933
1479
|
{ key: series.key, className: "dsh-tu-tooltip-row" },
|
|
934
|
-
(0,
|
|
935
|
-
(0,
|
|
936
|
-
(0,
|
|
1480
|
+
(0, import_react6.createElement)("span", { className: "dsh-tu-swatch", "data-series": series.key }),
|
|
1481
|
+
(0, import_react6.createElement)("span", { className: "dsh-tu-tooltip-label" }, series.label),
|
|
1482
|
+
(0, import_react6.createElement)("b", null, `${formatTokensExact(value)} (${share.toFixed(1)}%)`)
|
|
937
1483
|
);
|
|
938
1484
|
}),
|
|
939
|
-
(0,
|
|
1485
|
+
(0, import_react6.createElement)(
|
|
940
1486
|
"div",
|
|
941
1487
|
{ className: "dsh-tu-tooltip-subtle" },
|
|
942
1488
|
`\u8F6E\u6B21 ${String(bucket.turns)} \xB7 ${bucket.estimated ? "\u542B\u4F30\u7B97\u4EF7\u683C" : "\u4EF7\u683C\u7CBE\u786E"}`
|
|
@@ -962,26 +1508,26 @@ function CacheRateLine(props) {
|
|
|
962
1508
|
};
|
|
963
1509
|
});
|
|
964
1510
|
const labelStride = Math.max(1, Math.ceil(buckets.length / 8));
|
|
965
|
-
return (0,
|
|
1511
|
+
return (0, import_react6.createElement)(
|
|
966
1512
|
"div",
|
|
967
1513
|
null,
|
|
968
|
-
hasData ? (0,
|
|
1514
|
+
hasData ? (0, import_react6.createElement)(
|
|
969
1515
|
"div",
|
|
970
1516
|
{ className: "dsh-tu-rate-plot" },
|
|
971
|
-
(0,
|
|
1517
|
+
(0, import_react6.createElement)(
|
|
972
1518
|
"div",
|
|
973
1519
|
{ className: "dsh-tu-rate-yaxis", "aria-hidden": "true" },
|
|
974
1520
|
...axis.ticks.map(
|
|
975
|
-
(tick) => (0,
|
|
1521
|
+
(tick) => (0, import_react6.createElement)("span", { key: `rate-${String(tick)}` }, formatRateTick(tick))
|
|
976
1522
|
)
|
|
977
1523
|
),
|
|
978
|
-
(0,
|
|
1524
|
+
(0, import_react6.createElement)(
|
|
979
1525
|
"div",
|
|
980
1526
|
{ className: "dsh-tu-rate-body" },
|
|
981
|
-
(0,
|
|
1527
|
+
(0, import_react6.createElement)(
|
|
982
1528
|
"div",
|
|
983
1529
|
{ className: "dsh-tu-rate-canvas" },
|
|
984
|
-
(0,
|
|
1530
|
+
(0, import_react6.createElement)(
|
|
985
1531
|
"svg",
|
|
986
1532
|
{
|
|
987
1533
|
className: "dsh-tu-rate-svg",
|
|
@@ -990,7 +1536,7 @@ function CacheRateLine(props) {
|
|
|
990
1536
|
role: "img",
|
|
991
1537
|
"aria-label": "\u7F13\u5B58\u547D\u4E2D\u7387\u6298\u7EBF\u56FE"
|
|
992
1538
|
},
|
|
993
|
-
(0,
|
|
1539
|
+
(0, import_react6.createElement)("line", {
|
|
994
1540
|
x1: 0,
|
|
995
1541
|
y1: 50,
|
|
996
1542
|
x2: 100,
|
|
@@ -998,7 +1544,7 @@ function CacheRateLine(props) {
|
|
|
998
1544
|
className: "dsh-tu-rate-grid",
|
|
999
1545
|
vectorEffect: "non-scaling-stroke"
|
|
1000
1546
|
}),
|
|
1001
|
-
(0,
|
|
1547
|
+
(0, import_react6.createElement)("polyline", {
|
|
1002
1548
|
points: coordinates.map((point) => `${point.x},${point.y}`).join(" "),
|
|
1003
1549
|
className: "dsh-tu-rate-line",
|
|
1004
1550
|
fill: "none",
|
|
@@ -1006,7 +1552,7 @@ function CacheRateLine(props) {
|
|
|
1006
1552
|
})
|
|
1007
1553
|
),
|
|
1008
1554
|
...coordinates.map(
|
|
1009
|
-
(point) => (0,
|
|
1555
|
+
(point) => (0, import_react6.createElement)("span", {
|
|
1010
1556
|
key: point.bucket.key,
|
|
1011
1557
|
className: point.clipped ? "dsh-tu-rate-point dsh-tu-rate-point-clipped" : "dsh-tu-rate-point",
|
|
1012
1558
|
"data-clipped": point.clipped ? "true" : void 0,
|
|
@@ -1019,15 +1565,15 @@ function CacheRateLine(props) {
|
|
|
1019
1565
|
})
|
|
1020
1566
|
)
|
|
1021
1567
|
),
|
|
1022
|
-
(0,
|
|
1568
|
+
(0, import_react6.createElement)(
|
|
1023
1569
|
"div",
|
|
1024
1570
|
{ className: "dsh-tu-axis" },
|
|
1025
1571
|
...buckets.map(
|
|
1026
|
-
(bucket, index) => index % labelStride === 0 || index === buckets.length - 1 ? (0,
|
|
1572
|
+
(bucket, index) => index % labelStride === 0 || index === buckets.length - 1 ? (0, import_react6.createElement)("span", { key: bucket.key }, bucket.label) : null
|
|
1027
1573
|
).filter((node) => node !== null)
|
|
1028
1574
|
)
|
|
1029
1575
|
)
|
|
1030
|
-
) : (0,
|
|
1576
|
+
) : (0, import_react6.createElement)("div", { className: "dsh-tu-empty" }, emptyHint)
|
|
1031
1577
|
);
|
|
1032
1578
|
}
|
|
1033
1579
|
var SECTOR_LIMIT = 5;
|
|
@@ -1047,10 +1593,10 @@ function sectorArcPath(start, end, inner) {
|
|
|
1047
1593
|
}
|
|
1048
1594
|
function SectorChart(props) {
|
|
1049
1595
|
const { slices, variant, centerLabel, centerValue, primaryLabel, formatValue, ariaLabel, emptyHint } = props;
|
|
1050
|
-
const [hover, setHover] = (0,
|
|
1596
|
+
const [hover, setHover] = (0, import_react6.useState)(null);
|
|
1051
1597
|
const positive = slices.filter((slice) => slice.value > 0).sort((left, right) => right.value - left.value);
|
|
1052
1598
|
const total = positive.reduce((sum, slice) => sum + slice.value, 0);
|
|
1053
|
-
if (total <= 0) return (0,
|
|
1599
|
+
if (total <= 0) return (0, import_react6.createElement)("div", { className: "dsh-tu-empty" }, emptyHint);
|
|
1054
1600
|
const shown = positive.slice(0, SECTOR_LIMIT - 1);
|
|
1055
1601
|
const rest = positive.slice(SECTOR_LIMIT - 1);
|
|
1056
1602
|
const restValue = rest.reduce((sum, slice) => sum + slice.value, 0);
|
|
@@ -1076,16 +1622,16 @@ function SectorChart(props) {
|
|
|
1076
1622
|
});
|
|
1077
1623
|
const hovered = hover === null ? void 0 : all[hover.index];
|
|
1078
1624
|
const hoverShare = hovered === void 0 ? 0 : hovered.value / total * 100;
|
|
1079
|
-
return (0,
|
|
1625
|
+
return (0, import_react6.createElement)(
|
|
1080
1626
|
"div",
|
|
1081
1627
|
{ className: "dsh-tu-sector-chart", "data-variant": variant },
|
|
1082
|
-
(0,
|
|
1628
|
+
(0, import_react6.createElement)(
|
|
1083
1629
|
"div",
|
|
1084
1630
|
{ className: "dsh-tu-sector-canvas" },
|
|
1085
|
-
(0,
|
|
1631
|
+
(0, import_react6.createElement)(
|
|
1086
1632
|
"svg",
|
|
1087
1633
|
{ viewBox: "0 0 120 120", role: "img", "aria-label": ariaLabel },
|
|
1088
|
-
variant === "donut" ? (0,
|
|
1634
|
+
variant === "donut" ? (0, import_react6.createElement)("circle", {
|
|
1089
1635
|
cx: SECTOR_CENTER,
|
|
1090
1636
|
cy: SECTOR_CENTER,
|
|
1091
1637
|
r: (SECTOR_OUTER + inner) / 2,
|
|
@@ -1094,7 +1640,7 @@ function SectorChart(props) {
|
|
|
1094
1640
|
className: "dsh-tu-sector-track"
|
|
1095
1641
|
}) : null,
|
|
1096
1642
|
...arcs.map(
|
|
1097
|
-
(arc, index) => (0,
|
|
1643
|
+
(arc, index) => (0, import_react6.createElement)("path", {
|
|
1098
1644
|
key: arc.slice.key,
|
|
1099
1645
|
d: arc.path,
|
|
1100
1646
|
className: "dsh-tu-sector-slice",
|
|
@@ -1113,18 +1659,18 @@ function SectorChart(props) {
|
|
|
1113
1659
|
${primaryLabel} ${formatValue(arc.slice.value)} \xB7 ${(arc.slice.value / total * 100).toFixed(1)}%`
|
|
1114
1660
|
})
|
|
1115
1661
|
),
|
|
1116
|
-
variant === "donut" && centerValue !== void 0 ? (0,
|
|
1662
|
+
variant === "donut" && centerValue !== void 0 ? (0, import_react6.createElement)(
|
|
1117
1663
|
"text",
|
|
1118
1664
|
{ x: SECTOR_CENTER, y: 57, className: "dsh-tu-donut-center-value", textAnchor: "middle" },
|
|
1119
1665
|
centerValue
|
|
1120
1666
|
) : null,
|
|
1121
|
-
variant === "donut" && centerLabel !== void 0 ? (0,
|
|
1667
|
+
variant === "donut" && centerLabel !== void 0 ? (0, import_react6.createElement)(
|
|
1122
1668
|
"text",
|
|
1123
1669
|
{ x: SECTOR_CENTER, y: 71, className: "dsh-tu-donut-center-label", textAnchor: "middle" },
|
|
1124
1670
|
centerLabel
|
|
1125
1671
|
) : null
|
|
1126
1672
|
),
|
|
1127
|
-
hovered === void 0 ? null : (0,
|
|
1673
|
+
hovered === void 0 ? null : (0, import_react6.createElement)(
|
|
1128
1674
|
"div",
|
|
1129
1675
|
{
|
|
1130
1676
|
className: "dsh-tu-tooltip",
|
|
@@ -1133,33 +1679,32 @@ ${primaryLabel} ${formatValue(arc.slice.value)} \xB7 ${(arc.slice.value / total
|
|
|
1133
1679
|
top: `${String(Math.max(8, hover.y - 110))}px`
|
|
1134
1680
|
}
|
|
1135
1681
|
},
|
|
1136
|
-
(0,
|
|
1137
|
-
(0,
|
|
1682
|
+
(0, import_react6.createElement)("div", null, (0, import_react6.createElement)("b", null, hovered.label)),
|
|
1683
|
+
(0, import_react6.createElement)(
|
|
1138
1684
|
"div",
|
|
1139
1685
|
{ className: "dsh-tu-tooltip-head" },
|
|
1140
1686
|
`${primaryLabel} `,
|
|
1141
|
-
(0,
|
|
1687
|
+
(0, import_react6.createElement)("b", null, formatValue(hovered.value)),
|
|
1142
1688
|
` \xB7 ${hoverShare.toFixed(1)}%`
|
|
1143
1689
|
),
|
|
1144
1690
|
...hovered.details.map(
|
|
1145
|
-
(detail) => (0,
|
|
1691
|
+
(detail) => (0, import_react6.createElement)(
|
|
1146
1692
|
"div",
|
|
1147
1693
|
{ key: detail.label, className: "dsh-tu-tooltip-detail" },
|
|
1148
|
-
(0,
|
|
1149
|
-
(0,
|
|
1694
|
+
(0, import_react6.createElement)("span", { className: "dsh-tu-tooltip-label" }, detail.label),
|
|
1695
|
+
(0, import_react6.createElement)("b", null, detail.value)
|
|
1150
1696
|
)
|
|
1151
|
-
)
|
|
1152
|
-
(0, import_react5.createElement)("div", { className: "dsh-tu-tooltip-subtle" }, "\u60AC\u505C\u5176\u5B83\u6247\u5F62\u53EF\u67E5\u770B\u5BF9\u5E94\u5B57\u6BB5")
|
|
1697
|
+
)
|
|
1153
1698
|
)
|
|
1154
1699
|
),
|
|
1155
|
-
(0,
|
|
1700
|
+
(0, import_react6.createElement)(
|
|
1156
1701
|
"div",
|
|
1157
1702
|
{ className: "dsh-tu-sector-legend" },
|
|
1158
1703
|
...all.map(
|
|
1159
|
-
(slice) => (0,
|
|
1704
|
+
(slice) => (0, import_react6.createElement)(
|
|
1160
1705
|
"span",
|
|
1161
1706
|
{ key: slice.key, className: "dsh-tu-sector-legend-item" },
|
|
1162
|
-
(0,
|
|
1707
|
+
(0, import_react6.createElement)("span", { className: "dsh-tu-sector-swatch", "data-series": String(slice.series) }),
|
|
1163
1708
|
slice.label
|
|
1164
1709
|
)
|
|
1165
1710
|
)
|
|
@@ -1170,24 +1715,24 @@ function HBarList(props) {
|
|
|
1170
1715
|
const { items, formatValue, emptyHint } = props;
|
|
1171
1716
|
const max = Math.max(1, ...items.map((item) => item.count));
|
|
1172
1717
|
const total = items.reduce((sum, item) => sum + item.count, 0);
|
|
1173
|
-
if (total === 0) return (0,
|
|
1174
|
-
return (0,
|
|
1718
|
+
if (total === 0) return (0, import_react6.createElement)("div", { className: "dsh-tu-empty" }, emptyHint);
|
|
1719
|
+
return (0, import_react6.createElement)(
|
|
1175
1720
|
"div",
|
|
1176
1721
|
{ className: "dsh-tu-hbars" },
|
|
1177
1722
|
...items.map(
|
|
1178
|
-
(item) => (0,
|
|
1723
|
+
(item) => (0, import_react6.createElement)(
|
|
1179
1724
|
"div",
|
|
1180
1725
|
{ key: item.label, className: "dsh-tu-hbar-row" },
|
|
1181
|
-
(0,
|
|
1182
|
-
(0,
|
|
1726
|
+
(0, import_react6.createElement)("span", { className: "dsh-tu-hbar-label" }, item.label),
|
|
1727
|
+
(0, import_react6.createElement)(
|
|
1183
1728
|
"span",
|
|
1184
1729
|
{ className: "dsh-tu-hbar-track" },
|
|
1185
|
-
(0,
|
|
1730
|
+
(0, import_react6.createElement)("span", {
|
|
1186
1731
|
className: "dsh-tu-hbar-fill",
|
|
1187
1732
|
style: { width: `${String(item.count / max * 100)}%` }
|
|
1188
1733
|
})
|
|
1189
1734
|
),
|
|
1190
|
-
(0,
|
|
1735
|
+
(0, import_react6.createElement)("span", { className: "dsh-tu-hbar-value" }, formatValue(item.count))
|
|
1191
1736
|
)
|
|
1192
1737
|
)
|
|
1193
1738
|
);
|
|
@@ -1198,13 +1743,13 @@ function HourActivityChart(props) {
|
|
|
1198
1743
|
const hasData = maxCalls > 0;
|
|
1199
1744
|
const labelHours = /* @__PURE__ */ new Set([0, 3, 6, 9, 12, 15, 18, 21]);
|
|
1200
1745
|
const pad = (value) => String(value).padStart(2, "0");
|
|
1201
|
-
return (0,
|
|
1746
|
+
return (0, import_react6.createElement)(
|
|
1202
1747
|
"div",
|
|
1203
1748
|
null,
|
|
1204
|
-
hasData ? (0,
|
|
1749
|
+
hasData ? (0, import_react6.createElement)(
|
|
1205
1750
|
"div",
|
|
1206
1751
|
{ className: "dsh-tu-hour-chart" },
|
|
1207
|
-
(0,
|
|
1752
|
+
(0, import_react6.createElement)(
|
|
1208
1753
|
"div",
|
|
1209
1754
|
{
|
|
1210
1755
|
className: "dsh-tu-hour-bars",
|
|
@@ -1214,7 +1759,7 @@ function HourActivityChart(props) {
|
|
|
1214
1759
|
...hours.map((hour) => {
|
|
1215
1760
|
const level = hour.calls === 0 ? 0 : Math.max(1, Math.ceil(hour.calls / maxCalls * 4));
|
|
1216
1761
|
const height = maxCalls === 0 ? 0 : hour.calls / maxCalls * 100;
|
|
1217
|
-
return (0,
|
|
1762
|
+
return (0, import_react6.createElement)(
|
|
1218
1763
|
"div",
|
|
1219
1764
|
{
|
|
1220
1765
|
key: `hour-${String(hour.hour)}`,
|
|
@@ -1227,7 +1772,7 @@ function HourActivityChart(props) {
|
|
|
1227
1772
|
`\u8D39\u7528 ${formatMoney(hour.cost, currency)}`
|
|
1228
1773
|
].join("\n")
|
|
1229
1774
|
},
|
|
1230
|
-
(0,
|
|
1775
|
+
(0, import_react6.createElement)("div", {
|
|
1231
1776
|
className: "dsh-tu-hour-bar",
|
|
1232
1777
|
"data-level": String(level),
|
|
1233
1778
|
"data-hour": String(hour.hour),
|
|
@@ -1239,35 +1784,106 @@ function HourActivityChart(props) {
|
|
|
1239
1784
|
);
|
|
1240
1785
|
})
|
|
1241
1786
|
),
|
|
1242
|
-
(0,
|
|
1787
|
+
(0, import_react6.createElement)(
|
|
1243
1788
|
"div",
|
|
1244
1789
|
{ className: "dsh-tu-hour-axis" },
|
|
1245
1790
|
...hours.map(
|
|
1246
|
-
(hour) => (0,
|
|
1791
|
+
(hour) => (0, import_react6.createElement)(
|
|
1247
1792
|
"span",
|
|
1248
1793
|
{ key: `label-${String(hour.hour)}` },
|
|
1249
1794
|
labelHours.has(hour.hour) ? pad(hour.hour) : ""
|
|
1250
1795
|
)
|
|
1251
1796
|
)
|
|
1252
1797
|
)
|
|
1253
|
-
) : (0,
|
|
1798
|
+
) : (0, import_react6.createElement)("div", { className: "dsh-tu-empty" }, emptyHint)
|
|
1799
|
+
);
|
|
1800
|
+
}
|
|
1801
|
+
var WEEKDAY_LABELS = ["\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u65E5"];
|
|
1802
|
+
function WeekHourHeatmap(props) {
|
|
1803
|
+
const { cells, currency, emptyHint } = props;
|
|
1804
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
1805
|
+
for (const cell of cells) byKey.set(`${String(cell.weekday)}:${String(cell.hour)}`, cell);
|
|
1806
|
+
const maxCalls = Math.max(0, ...cells.map((cell) => cell.calls));
|
|
1807
|
+
const hasData = maxCalls > 0;
|
|
1808
|
+
const pad = (value) => String(value).padStart(2, "0");
|
|
1809
|
+
if (!hasData) return (0, import_react6.createElement)("div", { className: "dsh-tu-empty" }, emptyHint);
|
|
1810
|
+
const rows = [];
|
|
1811
|
+
for (let weekday = 0; weekday < 7; weekday += 1) {
|
|
1812
|
+
const rowCells = [
|
|
1813
|
+
(0, import_react6.createElement)(
|
|
1814
|
+
"span",
|
|
1815
|
+
{ key: `label-${String(weekday)}`, className: "dsh-tu-weekheat-rowlabel" },
|
|
1816
|
+
`\u5468${WEEKDAY_LABELS[weekday] ?? "?"}`
|
|
1817
|
+
)
|
|
1818
|
+
];
|
|
1819
|
+
for (let hour = 0; hour < 24; hour += 1) {
|
|
1820
|
+
const cell = byKey.get(`${String(weekday)}:${String(hour)}`);
|
|
1821
|
+
const calls = cell?.calls ?? 0;
|
|
1822
|
+
const level = calls === 0 ? 0 : Math.max(1, Math.ceil(calls / maxCalls * 4));
|
|
1823
|
+
rowCells.push(
|
|
1824
|
+
(0, import_react6.createElement)("span", {
|
|
1825
|
+
key: `cell-${String(weekday)}-${String(hour)}`,
|
|
1826
|
+
className: "dsh-tu-weekheat-cell",
|
|
1827
|
+
"data-level": String(level),
|
|
1828
|
+
title: [
|
|
1829
|
+
`\u5468${WEEKDAY_LABELS[weekday] ?? "?"} ${pad(hour)}:00\u2013${pad(hour)}:59`,
|
|
1830
|
+
`\u6A21\u578B\u8C03\u7528 ${String(calls)} \u6B21`,
|
|
1831
|
+
`\u8F6E\u6B21\u5F00\u59CB ${String(cell?.turns ?? 0)} \u6B21`,
|
|
1832
|
+
`Token ${formatTokensExact(cell?.tokens ?? 0)}`,
|
|
1833
|
+
`\u8D39\u7528 ${formatMoney(cell?.cost ?? 0, currency)}`
|
|
1834
|
+
].join("\n")
|
|
1835
|
+
})
|
|
1836
|
+
);
|
|
1837
|
+
}
|
|
1838
|
+
rows.push((0, import_react6.createElement)("div", { key: `row-${String(weekday)}`, className: "dsh-tu-weekheat-row" }, ...rowCells));
|
|
1839
|
+
}
|
|
1840
|
+
return (0, import_react6.createElement)(
|
|
1841
|
+
"div",
|
|
1842
|
+
{ className: "dsh-tu-weekheat" },
|
|
1843
|
+
(0, import_react6.createElement)(
|
|
1844
|
+
"div",
|
|
1845
|
+
{ className: "dsh-tu-weekheat-axis", "aria-hidden": "true" },
|
|
1846
|
+
(0, import_react6.createElement)("span", { className: "dsh-tu-weekheat-rowlabel" }, ""),
|
|
1847
|
+
...Array.from(
|
|
1848
|
+
{ length: 24 },
|
|
1849
|
+
(_unused, hour) => (0, import_react6.createElement)(
|
|
1850
|
+
"span",
|
|
1851
|
+
{ key: `axis-${String(hour)}` },
|
|
1852
|
+
hour % 3 === 0 ? pad(hour) : ""
|
|
1853
|
+
)
|
|
1854
|
+
)
|
|
1855
|
+
),
|
|
1856
|
+
...rows,
|
|
1857
|
+
(0, import_react6.createElement)(
|
|
1858
|
+
"div",
|
|
1859
|
+
{ className: "dsh-tu-weekheat-legend" },
|
|
1860
|
+
(0, import_react6.createElement)("span", null, "\u5C11"),
|
|
1861
|
+
...[0, 1, 2, 3, 4].map(
|
|
1862
|
+
(level) => (0, import_react6.createElement)("span", {
|
|
1863
|
+
key: `legend-${String(level)}`,
|
|
1864
|
+
className: "dsh-tu-weekheat-cell",
|
|
1865
|
+
"data-level": String(level)
|
|
1866
|
+
})
|
|
1867
|
+
),
|
|
1868
|
+
(0, import_react6.createElement)("span", null, "\u591A")
|
|
1869
|
+
)
|
|
1254
1870
|
);
|
|
1255
1871
|
}
|
|
1256
1872
|
|
|
1257
1873
|
// src/client/heatmap.tsx
|
|
1258
|
-
var
|
|
1259
|
-
var
|
|
1874
|
+
var import_react7 = require("react");
|
|
1875
|
+
var WEEKDAY_LABELS2 = ["\u5468\u4E00", "\u5468\u4E8C", "\u5468\u4E09", "\u5468\u56DB", "\u5468\u4E94", "\u5468\u516D", "\u5468\u65E5"];
|
|
1260
1876
|
function Heatmap(props) {
|
|
1261
1877
|
const { points, metric, currency, range, firstDay } = props;
|
|
1262
|
-
const [hover, setHover] = (0,
|
|
1263
|
-
const model = (0,
|
|
1878
|
+
const [hover, setHover] = (0, import_react7.useState)(null);
|
|
1879
|
+
const model = (0, import_react7.useMemo)(
|
|
1264
1880
|
() => buildModel(points, metric, range, firstDay),
|
|
1265
1881
|
[points, metric, range, firstDay]
|
|
1266
1882
|
);
|
|
1267
|
-
return (0,
|
|
1883
|
+
return (0, import_react7.createElement)(
|
|
1268
1884
|
"div",
|
|
1269
1885
|
null,
|
|
1270
|
-
(0,
|
|
1886
|
+
(0, import_react7.createElement)(
|
|
1271
1887
|
"div",
|
|
1272
1888
|
{
|
|
1273
1889
|
className: "dsh-tu-heat",
|
|
@@ -1278,15 +1894,15 @@ function Heatmap(props) {
|
|
|
1278
1894
|
// fallback rescues, collapsing every row to zero height.
|
|
1279
1895
|
style: { "--dsh-tu-cols": String(Math.max(1, model.weeks.length)) }
|
|
1280
1896
|
},
|
|
1281
|
-
(0,
|
|
1897
|
+
(0, import_react7.createElement)(
|
|
1282
1898
|
"div",
|
|
1283
1899
|
{ className: "dsh-tu-heat-weekdays", "aria-hidden": "true" },
|
|
1284
|
-
...
|
|
1900
|
+
...WEEKDAY_LABELS2.map((label) => (0, import_react7.createElement)("span", { key: label }, label))
|
|
1285
1901
|
),
|
|
1286
|
-
(0,
|
|
1902
|
+
(0, import_react7.createElement)(
|
|
1287
1903
|
"div",
|
|
1288
1904
|
{ className: "dsh-tu-heat-scroll" },
|
|
1289
|
-
(0,
|
|
1905
|
+
(0, import_react7.createElement)(
|
|
1290
1906
|
"div",
|
|
1291
1907
|
{
|
|
1292
1908
|
className: "dsh-tu-heat-grid",
|
|
@@ -1296,19 +1912,19 @@ function Heatmap(props) {
|
|
|
1296
1912
|
"aria-label": `\u6BCF\u65E5\u6D88\u8017\u65E5\u5386\u70ED\u529B\u56FE\uFF1A${range.drawnStart || "\u2014"} \u81F3 ${range.drawnEnd || "\u2014"}`
|
|
1297
1913
|
},
|
|
1298
1914
|
...model.weeks.map(
|
|
1299
|
-
(week) => (0,
|
|
1915
|
+
(week) => (0, import_react7.createElement)(
|
|
1300
1916
|
"div",
|
|
1301
1917
|
{ key: week.key, className: "dsh-tu-heat-col" },
|
|
1302
|
-
(0,
|
|
1918
|
+
(0, import_react7.createElement)(
|
|
1303
1919
|
"div",
|
|
1304
1920
|
{ className: "dsh-tu-heat-month" },
|
|
1305
|
-
week.monthLabel === void 0 ? null : (0,
|
|
1921
|
+
week.monthLabel === void 0 ? null : (0, import_react7.createElement)("span", null, week.monthLabel)
|
|
1306
1922
|
),
|
|
1307
|
-
(0,
|
|
1923
|
+
(0, import_react7.createElement)(
|
|
1308
1924
|
"div",
|
|
1309
1925
|
{ className: "dsh-tu-heat-days" },
|
|
1310
1926
|
...week.cells.map(
|
|
1311
|
-
(cell) => (0,
|
|
1927
|
+
(cell) => (0, import_react7.createElement)("div", {
|
|
1312
1928
|
key: cell.date,
|
|
1313
1929
|
className: "dsh-tu-cell",
|
|
1314
1930
|
// The day itself, so a test (or a future feature) can talk about
|
|
@@ -1333,19 +1949,19 @@ function Heatmap(props) {
|
|
|
1333
1949
|
)
|
|
1334
1950
|
)
|
|
1335
1951
|
),
|
|
1336
|
-
(0,
|
|
1952
|
+
(0, import_react7.createElement)(
|
|
1337
1953
|
"div",
|
|
1338
1954
|
{ className: "dsh-tu-legend" },
|
|
1339
|
-
(0,
|
|
1955
|
+
(0, import_react7.createElement)("span", null, "\u5C11"),
|
|
1340
1956
|
...[0, 1, 2, 3, 4].map(
|
|
1341
|
-
(level) => (0,
|
|
1957
|
+
(level) => (0, import_react7.createElement)("div", {
|
|
1342
1958
|
key: `l-${String(level)}`,
|
|
1343
1959
|
className: "dsh-tu-cell",
|
|
1344
1960
|
"data-level": String(level)
|
|
1345
1961
|
})
|
|
1346
1962
|
),
|
|
1347
|
-
(0,
|
|
1348
|
-
(0,
|
|
1963
|
+
(0, import_react7.createElement)("span", null, "\u591A"),
|
|
1964
|
+
(0, import_react7.createElement)(
|
|
1349
1965
|
"span",
|
|
1350
1966
|
{ style: { marginLeft: "10px" } },
|
|
1351
1967
|
model.max > 0 ? `\u6700\u6DF1\u8272 \u2248 ${metric === "tokens" ? formatTokens(model.scaleMax) : formatMoney(model.scaleMax, currency)} / \u5929` : "\u6682\u65E0\u6570\u636E"
|
|
@@ -1407,7 +2023,7 @@ function quantile(sorted, fraction) {
|
|
|
1407
2023
|
function createTooltip2(hover, points, currency) {
|
|
1408
2024
|
const point = points.find((candidate) => candidate.date === hover.date);
|
|
1409
2025
|
if (point === void 0) return null;
|
|
1410
|
-
return (0,
|
|
2026
|
+
return (0, import_react7.createElement)(
|
|
1411
2027
|
"div",
|
|
1412
2028
|
{
|
|
1413
2029
|
className: "dsh-tu-tooltip",
|
|
@@ -1416,11 +2032,11 @@ function createTooltip2(hover, points, currency) {
|
|
|
1416
2032
|
top: `${String(Math.max(8, hover.y - 84))}px`
|
|
1417
2033
|
}
|
|
1418
2034
|
},
|
|
1419
|
-
(0,
|
|
1420
|
-
(0,
|
|
1421
|
-
(0,
|
|
1422
|
-
(0,
|
|
1423
|
-
(0,
|
|
2035
|
+
(0, import_react7.createElement)("div", null, point.date),
|
|
2036
|
+
(0, import_react7.createElement)("div", null, "Token\uFF1A", (0, import_react7.createElement)("b", null, formatTokensExact(point.total))),
|
|
2037
|
+
(0, import_react7.createElement)("div", null, "\u8D39\u7528\uFF1A", (0, import_react7.createElement)("b", null, formatMoney(point.cost, currency))),
|
|
2038
|
+
(0, import_react7.createElement)("div", null, "\u8F6E\u6B21\uFF1A", (0, import_react7.createElement)("b", null, String(point.turns))),
|
|
2039
|
+
(0, import_react7.createElement)(
|
|
1424
2040
|
"div",
|
|
1425
2041
|
{ className: "dsh-tu-subtle" },
|
|
1426
2042
|
`\u547D\u4E2D\u7F13\u5B58 ${formatTokens(point.tokens.cacheRead)} / \u672A\u547D\u4E2D ${formatTokens(point.tokens.uncachedInput)} / \u8F93\u51FA ${formatTokens(point.tokens.output)}`
|
|
@@ -1445,27 +2061,27 @@ var GRANULARITIES = [
|
|
|
1445
2061
|
];
|
|
1446
2062
|
function TokenUsageDashboard(props) {
|
|
1447
2063
|
const onSelect = props.onSelect;
|
|
1448
|
-
const [data, setData] = (0,
|
|
1449
|
-
const [error, setError] = (0,
|
|
1450
|
-
const [loading, setLoading] = (0,
|
|
1451
|
-
const [reloadKey, setReloadKey] = (0,
|
|
1452
|
-
const [workspace, setWorkspace] = (0,
|
|
1453
|
-
const [model, setModel] = (0,
|
|
1454
|
-
const [provider, setProvider] = (0,
|
|
1455
|
-
const [granularity, setGranularity] = (0,
|
|
1456
|
-
const [preset, setPreset] = (0,
|
|
1457
|
-
const [customFrom, setCustomFrom] = (0,
|
|
1458
|
-
const [customTo, setCustomTo] = (0,
|
|
1459
|
-
const [pricingHover, setPricingHover] = (0,
|
|
1460
|
-
const [pricingPinned, setPricingPinned] = (0,
|
|
1461
|
-
const [panelInfo, setPanelInfo] = (0,
|
|
1462
|
-
const [toolPanel, setToolPanel] = (0,
|
|
1463
|
-
const [toolBusy, setToolBusy] = (0,
|
|
1464
|
-
const [toolNotice, setToolNotice] = (0,
|
|
1465
|
-
const [dismissedHealthKey, setDismissedHealthKey] = (0,
|
|
1466
|
-
const fileInputRef = (0,
|
|
1467
|
-
const [heatAnchor, setHeatAnchor] = (0,
|
|
1468
|
-
(0,
|
|
2064
|
+
const [data, setData] = (0, import_react8.useState)(null);
|
|
2065
|
+
const [error, setError] = (0, import_react8.useState)(null);
|
|
2066
|
+
const [loading, setLoading] = (0, import_react8.useState)(true);
|
|
2067
|
+
const [reloadKey, setReloadKey] = (0, import_react8.useState)(0);
|
|
2068
|
+
const [workspace, setWorkspace] = (0, import_react8.useState)(null);
|
|
2069
|
+
const [model, setModel] = (0, import_react8.useState)(null);
|
|
2070
|
+
const [provider, setProvider] = (0, import_react8.useState)(null);
|
|
2071
|
+
const [granularity, setGranularity] = (0, import_react8.useState)("day");
|
|
2072
|
+
const [preset, setPreset] = (0, import_react8.useState)("30d");
|
|
2073
|
+
const [customFrom, setCustomFrom] = (0, import_react8.useState)("");
|
|
2074
|
+
const [customTo, setCustomTo] = (0, import_react8.useState)("");
|
|
2075
|
+
const [pricingHover, setPricingHover] = (0, import_react8.useState)(false);
|
|
2076
|
+
const [pricingPinned, setPricingPinned] = (0, import_react8.useState)(false);
|
|
2077
|
+
const [panelInfo, setPanelInfo] = (0, import_react8.useState)(null);
|
|
2078
|
+
const [toolPanel, setToolPanel] = (0, import_react8.useState)(null);
|
|
2079
|
+
const [toolBusy, setToolBusy] = (0, import_react8.useState)(false);
|
|
2080
|
+
const [toolNotice, setToolNotice] = (0, import_react8.useState)(null);
|
|
2081
|
+
const [dismissedHealthKey, setDismissedHealthKey] = (0, import_react8.useState)(null);
|
|
2082
|
+
const fileInputRef = (0, import_react8.useRef)(null);
|
|
2083
|
+
const [heatAnchor, setHeatAnchor] = (0, import_react8.useState)("");
|
|
2084
|
+
(0, import_react8.useEffect)(() => {
|
|
1469
2085
|
if (!pricingPinned) return void 0;
|
|
1470
2086
|
const onPointerDown = (event) => {
|
|
1471
2087
|
const target = event.target;
|
|
@@ -1477,7 +2093,7 @@ function TokenUsageDashboard(props) {
|
|
|
1477
2093
|
document.removeEventListener("pointerdown", onPointerDown);
|
|
1478
2094
|
};
|
|
1479
2095
|
}, [pricingPinned]);
|
|
1480
|
-
(0,
|
|
2096
|
+
(0, import_react8.useEffect)(() => {
|
|
1481
2097
|
if (panelInfo === null) return void 0;
|
|
1482
2098
|
const onPointerDown = (event) => {
|
|
1483
2099
|
const target = event.target;
|
|
@@ -1489,14 +2105,14 @@ function TokenUsageDashboard(props) {
|
|
|
1489
2105
|
document.removeEventListener("pointerdown", onPointerDown);
|
|
1490
2106
|
};
|
|
1491
2107
|
}, [panelInfo]);
|
|
1492
|
-
const [spanDays, setSpanDays] = (0,
|
|
2108
|
+
const [spanDays, setSpanDays] = (0, import_react8.useState)(HEATMAP_FETCH_DAYS);
|
|
1493
2109
|
const today = dayKeyOf(/* @__PURE__ */ new Date());
|
|
1494
2110
|
const heatEnd = heatAnchor === "" ? today : heatAnchor;
|
|
1495
|
-
const requestDays = (0,
|
|
2111
|
+
const requestDays = (0, import_react8.useMemo)(
|
|
1496
2112
|
() => Math.max(spanDays, pageSpanDays(heatEnd, today)),
|
|
1497
2113
|
[spanDays, heatEnd, today]
|
|
1498
2114
|
);
|
|
1499
|
-
(0,
|
|
2115
|
+
(0, import_react8.useEffect)(() => {
|
|
1500
2116
|
const controller = new AbortController();
|
|
1501
2117
|
let cancelled = false;
|
|
1502
2118
|
setLoading(true);
|
|
@@ -1524,7 +2140,7 @@ function TokenUsageDashboard(props) {
|
|
|
1524
2140
|
controller.abort();
|
|
1525
2141
|
};
|
|
1526
2142
|
}, [workspace, model, provider, requestDays, spanDays, reloadKey]);
|
|
1527
|
-
(0,
|
|
2143
|
+
(0, import_react8.useEffect)(() => {
|
|
1528
2144
|
if (data === null || workspace === null) return;
|
|
1529
2145
|
const known = data.facets.workspaces.some(
|
|
1530
2146
|
(facet) => facet.key === workspace || (facet.paths ?? []).some((path) => path.workspace === workspace)
|
|
@@ -1532,7 +2148,7 @@ function TokenUsageDashboard(props) {
|
|
|
1532
2148
|
if (!known) setWorkspace(null);
|
|
1533
2149
|
}, [data, workspace]);
|
|
1534
2150
|
const healthKey = data === null ? "" : healthNoticeKey(data.health);
|
|
1535
|
-
(0,
|
|
2151
|
+
(0, import_react8.useEffect)(() => {
|
|
1536
2152
|
if (dismissedHealthKey !== null && dismissedHealthKey !== healthKey) {
|
|
1537
2153
|
setDismissedHealthKey(null);
|
|
1538
2154
|
}
|
|
@@ -1545,17 +2161,17 @@ function TokenUsageDashboard(props) {
|
|
|
1545
2161
|
const workspaceIsRawPath = workspace !== null && workspaceFacets.some(
|
|
1546
2162
|
(facet) => (facet.paths ?? []).some((path) => path.workspace === workspace)
|
|
1547
2163
|
);
|
|
1548
|
-
const { from, to } = (0,
|
|
2164
|
+
const { from, to } = (0, import_react8.useMemo)(
|
|
1549
2165
|
() => resolveRange(preset, rangeEnd, customFrom, customTo),
|
|
1550
2166
|
[preset, rangeEnd, customFrom, customTo]
|
|
1551
2167
|
);
|
|
1552
2168
|
const daily = data?.daily ?? [];
|
|
1553
|
-
const filteredDaily = (0,
|
|
1554
|
-
const buckets = (0,
|
|
2169
|
+
const filteredDaily = (0, import_react8.useMemo)(() => filterRange(daily, from, to), [daily, from, to]);
|
|
2170
|
+
const buckets = (0, import_react8.useMemo)(
|
|
1555
2171
|
() => bucketDaily(filteredDaily, granularity),
|
|
1556
2172
|
[filteredDaily, granularity]
|
|
1557
2173
|
);
|
|
1558
|
-
const rangeStats = (0,
|
|
2174
|
+
const rangeStats = (0, import_react8.useMemo)(() => {
|
|
1559
2175
|
let tokens = 0;
|
|
1560
2176
|
let cost = 0;
|
|
1561
2177
|
let turns = 0;
|
|
@@ -1566,10 +2182,102 @@ function TokenUsageDashboard(props) {
|
|
|
1566
2182
|
}
|
|
1567
2183
|
return { tokens, cost, turns };
|
|
1568
2184
|
}, [filteredDaily]);
|
|
1569
|
-
const streak = (0,
|
|
2185
|
+
const streak = (0, import_react8.useMemo)(() => streaks(filteredDaily), [filteredDaily]);
|
|
1570
2186
|
const currency = data?.currency ?? "CNY";
|
|
1571
2187
|
const analytics = data?.analytics;
|
|
1572
|
-
const
|
|
2188
|
+
const performance = analytics?.performance;
|
|
2189
|
+
const performanceHasData = performance !== void 0 && (performance.ttftSamples > 0 || performance.tpsSamples > 0 || performance.modelSamples > 0 || performance.toolCalls > 0 || performance.stepsTotal > 0);
|
|
2190
|
+
const stepBins = analytics?.stepBins ?? [];
|
|
2191
|
+
const toolBins = analytics?.toolBins ?? [];
|
|
2192
|
+
const routeRows = analytics?.routes ?? [];
|
|
2193
|
+
const toolRows = analytics?.tools ?? [];
|
|
2194
|
+
const weekHours = analytics?.weekHours ?? [];
|
|
2195
|
+
const timeTotal = (performance?.modelMs ?? 0) + (performance?.toolMs ?? 0);
|
|
2196
|
+
const radarRoutes = routeRows.filter((route) => route.timedCalls > 0).slice(0, 4);
|
|
2197
|
+
const axisRange = (values) => ({
|
|
2198
|
+
min: Math.min(...values),
|
|
2199
|
+
max: Math.max(...values)
|
|
2200
|
+
});
|
|
2201
|
+
const normalizeAxis = (value, min, max, invert = false) => {
|
|
2202
|
+
if (!Number.isFinite(value) || max <= min) return 1;
|
|
2203
|
+
const ratio = (value - min) / (max - min);
|
|
2204
|
+
return invert ? 1 - ratio : ratio;
|
|
2205
|
+
};
|
|
2206
|
+
const ttftRange = axisRange(radarRoutes.map((route) => route.ttftMedian));
|
|
2207
|
+
const tpsRange = axisRange(radarRoutes.map((route) => route.tpsMedian));
|
|
2208
|
+
const outputRange = axisRange(radarRoutes.map((route) => route.outputTokens));
|
|
2209
|
+
const callRange = axisRange(radarRoutes.map((route) => route.calls));
|
|
2210
|
+
const routeRadar = radarRoutes.map((route, index) => ({
|
|
2211
|
+
key: route.key,
|
|
2212
|
+
label: route.model.length === 0 ? "(\u672A\u6807\u6CE8\u6A21\u578B)" : `${route.model}${route.provider.length === 0 ? "" : ` \xB7 ${route.provider.replace(/^deepseek-/, "")}`}`,
|
|
2213
|
+
colorIndex: index % 5,
|
|
2214
|
+
values: [
|
|
2215
|
+
normalizeAxis(route.ttftMedian, ttftRange.min, ttftRange.max, true),
|
|
2216
|
+
normalizeAxis(route.tpsMedian, tpsRange.min, tpsRange.max),
|
|
2217
|
+
normalizeAxis(route.outputTokens, outputRange.min, outputRange.max),
|
|
2218
|
+
normalizeAxis(route.calls, callRange.min, callRange.max)
|
|
2219
|
+
],
|
|
2220
|
+
details: [
|
|
2221
|
+
`\u8C03\u7528 ${formatCount(route.calls)} \u6B21\uFF08${formatCount(route.timedCalls)} \u6B21\u6709\u91C7\u6837\uFF09`,
|
|
2222
|
+
`\u9996 token \u7528\u65F6\u4E2D\u4F4D ${formatDuration(route.ttftMedian)}`,
|
|
2223
|
+
`\u8F93\u51FA\u901F\u5EA6\u4E2D\u4F4D ${formatSpeed(route.tpsMedian)}`,
|
|
2224
|
+
`\u8F93\u51FA ${formatTokens(route.outputTokens)}`,
|
|
2225
|
+
`\u6A21\u578B\u7528\u65F6 ${formatDuration(route.modelMs)}`
|
|
2226
|
+
]
|
|
2227
|
+
}));
|
|
2228
|
+
const speedRanges = routeRows.filter(
|
|
2229
|
+
(route) => route.timedCalls > 0 && route.tpsMedian > 0 && route.tpsP90 !== void 0 && route.tpsP90 > 0
|
|
2230
|
+
).slice(0, 5).map((route, index) => ({
|
|
2231
|
+
key: route.key,
|
|
2232
|
+
label: route.model.length === 0 ? "(\u672A\u6807\u6CE8\u6A21\u578B)" : `${route.model}${route.provider.length === 0 ? "" : ` \xB7 ${route.provider.replace(/^deepseek-/, "")}`}`,
|
|
2233
|
+
colorIndex: index % 5,
|
|
2234
|
+
p10: route.tpsP10 ?? route.tpsP25 ?? route.tpsMedian,
|
|
2235
|
+
p25: route.tpsP25 ?? route.tpsMedian,
|
|
2236
|
+
p50: route.tpsMedian,
|
|
2237
|
+
p75: route.tpsP75 ?? route.tpsMedian,
|
|
2238
|
+
p90: route.tpsP90 ?? 0,
|
|
2239
|
+
samples: route.timedCalls
|
|
2240
|
+
}));
|
|
2241
|
+
const toolsByDuration = toolRows.filter((tool) => tool.durationMs > 0).slice().sort((left, right) => right.durationMs - left.durationMs);
|
|
2242
|
+
const topTools = toolsByDuration.slice(0, 10);
|
|
2243
|
+
const otherTools = toolsByDuration.slice(6);
|
|
2244
|
+
const toolBars = topTools.map((tool, index) => {
|
|
2245
|
+
const failures = tool.results > 0 ? tool.errors / tool.results : 0;
|
|
2246
|
+
return {
|
|
2247
|
+
key: tool.name,
|
|
2248
|
+
label: tool.name,
|
|
2249
|
+
value: tool.durationMs,
|
|
2250
|
+
colorIndex: index % 5,
|
|
2251
|
+
intensity: 0.25 + Math.min(1, failures * 2) * 0.55,
|
|
2252
|
+
details: [
|
|
2253
|
+
`\u8C03\u7528 ${formatCount(tool.calls)} \u6B21 \xB7 \u7ED3\u679C ${formatCount(tool.results)} \u6B21`,
|
|
2254
|
+
`\u5931\u8D25 ${formatCount(tool.errors)} \u6B21\uFF08${formatShare(failures)}\uFF09`,
|
|
2255
|
+
`\u5E73\u5747\u8017\u65F6 ${tool.results === 0 ? "\u2014" : formatDuration(tool.durationMs / tool.results)}`,
|
|
2256
|
+
`\u5DE5\u5177\u8017\u65F6 ${formatDuration(tool.durationMs)}`
|
|
2257
|
+
]
|
|
2258
|
+
};
|
|
2259
|
+
});
|
|
2260
|
+
if (otherTools.length > 0) {
|
|
2261
|
+
const otherCalls = otherTools.reduce((sum, tool) => sum + tool.calls, 0);
|
|
2262
|
+
const otherResults = otherTools.reduce((sum, tool) => sum + tool.results, 0);
|
|
2263
|
+
const otherErrors = otherTools.reduce((sum, tool) => sum + tool.errors, 0);
|
|
2264
|
+
const otherDuration = otherTools.reduce((sum, tool) => sum + tool.durationMs, 0);
|
|
2265
|
+
const otherFailures = otherResults > 0 ? otherErrors / otherResults : 0;
|
|
2266
|
+
toolBars.push({
|
|
2267
|
+
key: "__other-tools",
|
|
2268
|
+
label: `\u5176\u4ED6 ${String(otherTools.length)} \u4E2A`,
|
|
2269
|
+
value: otherDuration,
|
|
2270
|
+
colorIndex: 4,
|
|
2271
|
+
intensity: 0.25 + Math.min(1, otherFailures * 2) * 0.55,
|
|
2272
|
+
details: [
|
|
2273
|
+
`\u8C03\u7528 ${formatCount(otherCalls)} \u6B21 \xB7 \u7ED3\u679C ${formatCount(otherResults)} \u6B21`,
|
|
2274
|
+
`\u5931\u8D25 ${formatCount(otherErrors)} \u6B21\uFF08${formatShare(otherFailures)}\uFF09`,
|
|
2275
|
+
`\u5DE5\u5177\u8017\u65F6 ${formatDuration(otherDuration)}`,
|
|
2276
|
+
`\u5305\u542B\uFF1A${otherTools.slice(0, 6).map((tool) => `${tool.name} ${formatDuration(tool.durationMs)}`).join("\u3001")}`
|
|
2277
|
+
]
|
|
2278
|
+
});
|
|
2279
|
+
}
|
|
2280
|
+
const rangeTokens = (0, import_react8.useMemo)(() => {
|
|
1573
2281
|
const sum = { uncachedInput: 0, cacheRead: 0, cacheWrite: 0, output: 0, reasoning: 0 };
|
|
1574
2282
|
for (const point of filteredDaily) {
|
|
1575
2283
|
sum.uncachedInput += point.tokens.uncachedInput;
|
|
@@ -1588,7 +2296,6 @@ function TokenUsageDashboard(props) {
|
|
|
1588
2296
|
return input > 0 ? `${(agent.cacheRead / input * 100).toFixed(1)}%` : "\u2014";
|
|
1589
2297
|
};
|
|
1590
2298
|
const agentCost = agents.reduce((sum, agent) => sum + agent.cost, 0);
|
|
1591
|
-
const agentTurns = agents.reduce((sum, agent) => sum + agent.turns, 0);
|
|
1592
2299
|
const agentCostSlices = agents.filter((agent) => agent.cost > 0).map((agent) => ({
|
|
1593
2300
|
key: `cost-${agent.key}`,
|
|
1594
2301
|
label: agent.label,
|
|
@@ -1630,11 +2337,11 @@ function TokenUsageDashboard(props) {
|
|
|
1630
2337
|
return input > 0 ? bucket.tokenBuckets.cacheRead / input : null;
|
|
1631
2338
|
}).filter((rate) => rate !== null);
|
|
1632
2339
|
const cacheAxis = cacheRateAxis(cacheRates);
|
|
1633
|
-
const heatRange = (0,
|
|
2340
|
+
const heatRange = (0, import_react8.useMemo)(
|
|
1634
2341
|
() => heatmapWindow(daily, heatEnd, HEATMAP_SPAN_DAYS, firstDayFacet),
|
|
1635
2342
|
[daily, heatEnd, firstDayFacet]
|
|
1636
2343
|
);
|
|
1637
|
-
const pageHeat = (0,
|
|
2344
|
+
const pageHeat = (0, import_react8.useCallback)(
|
|
1638
2345
|
(deltaDays) => {
|
|
1639
2346
|
const next = shiftDay(heatEnd, deltaDays);
|
|
1640
2347
|
const newest = heatRange.coverageEnd;
|
|
@@ -1642,11 +2349,11 @@ function TokenUsageDashboard(props) {
|
|
|
1642
2349
|
},
|
|
1643
2350
|
[heatEnd, heatRange.coverageEnd]
|
|
1644
2351
|
);
|
|
1645
|
-
const pageDaily = (0,
|
|
2352
|
+
const pageDaily = (0, import_react8.useMemo)(
|
|
1646
2353
|
() => heatRange.drawnStart === "" || heatRange.drawnEnd === "" ? [] : filterRange(daily, heatRange.drawnStart, heatRange.drawnEnd),
|
|
1647
2354
|
[daily, heatRange.drawnStart, heatRange.drawnEnd]
|
|
1648
2355
|
);
|
|
1649
|
-
const onReload = (0,
|
|
2356
|
+
const onReload = (0, import_react8.useCallback)(() => {
|
|
1650
2357
|
setReloadKey((value) => value + 1);
|
|
1651
2358
|
}, []);
|
|
1652
2359
|
const closeTools = () => {
|
|
@@ -1655,15 +2362,46 @@ function TokenUsageDashboard(props) {
|
|
|
1655
2362
|
};
|
|
1656
2363
|
const handleExport = async () => {
|
|
1657
2364
|
setToolBusy(true);
|
|
1658
|
-
|
|
2365
|
+
let fileHandle = null;
|
|
1659
2366
|
try {
|
|
2367
|
+
const picker = window.showSaveFilePicker;
|
|
2368
|
+
if (picker !== void 0) {
|
|
2369
|
+
try {
|
|
2370
|
+
fileHandle = await picker.call(window, {
|
|
2371
|
+
suggestedName: backupFilename(),
|
|
2372
|
+
types: [{ description: "JSON backup", accept: { "application/json": [".json"] } }]
|
|
2373
|
+
});
|
|
2374
|
+
} catch (error2) {
|
|
2375
|
+
if (isAbortError(error2)) {
|
|
2376
|
+
setToolNotice({ kind: "info", text: "\u5DF2\u53D6\u6D88\u5BFC\u51FA" });
|
|
2377
|
+
return;
|
|
2378
|
+
}
|
|
2379
|
+
fileHandle = null;
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
setToolNotice({ kind: "info", text: "\u6B63\u5728\u5BFC\u51FA\u5168\u90E8\u6570\u636E\u2026" });
|
|
1660
2383
|
const result = await fetchBackup(API_PATH);
|
|
1661
2384
|
if (!result.ok) {
|
|
1662
2385
|
setToolNotice({ kind: "error", text: result.message });
|
|
1663
2386
|
return;
|
|
1664
2387
|
}
|
|
1665
|
-
|
|
1666
|
-
|
|
2388
|
+
if (fileHandle === null) {
|
|
2389
|
+
downloadBackup(result.data);
|
|
2390
|
+
setToolNotice({
|
|
2391
|
+
kind: "success",
|
|
2392
|
+
text: `\u5DF2\u5F00\u59CB\u4E0B\u8F7D ${String(result.data.recordCount)} \u6761\u8BB0\u5F55\uFF0C\u8BF7\u5728\u6D4F\u89C8\u5668\u4E0B\u8F7D\u4F4D\u7F6E\u786E\u8BA4\u6587\u4EF6`
|
|
2393
|
+
});
|
|
2394
|
+
return;
|
|
2395
|
+
}
|
|
2396
|
+
const writable = await fileHandle.createWritable();
|
|
2397
|
+
await writable.write(backupBlob(result.data));
|
|
2398
|
+
await writable.close();
|
|
2399
|
+
setToolNotice({ kind: "success", text: `\u5DF2\u4FDD\u5B58 ${String(result.data.recordCount)} \u6761\u8BB0\u5F55` });
|
|
2400
|
+
} catch (error2) {
|
|
2401
|
+
setToolNotice({
|
|
2402
|
+
kind: "error",
|
|
2403
|
+
text: `\u5BFC\u51FA\u5931\u8D25\uFF1A${error2 instanceof Error ? error2.message : "\u65E0\u6CD5\u5199\u5165\u6587\u4EF6"}`
|
|
2404
|
+
});
|
|
1667
2405
|
} finally {
|
|
1668
2406
|
setToolBusy(false);
|
|
1669
2407
|
}
|
|
@@ -1726,17 +2464,18 @@ function TokenUsageDashboard(props) {
|
|
|
1726
2464
|
const handleConfirmBackfill = async () => {
|
|
1727
2465
|
if (toolPanel?.kind !== "backfill") return;
|
|
1728
2466
|
setToolBusy(true);
|
|
1729
|
-
setToolNotice({ kind: "info", text: "\u6B63\u5728\u8865\u5F55\uFF0C\
|
|
2467
|
+
setToolNotice({ kind: "info", text: "\u6B63\u5728\u8865\u5F55\uFF0C\u5E76\u8865\u5168\u53EF\u8FD8\u539F\u7684\u5386\u53F2\u5B57\u6BB5\u2026" });
|
|
1730
2468
|
try {
|
|
1731
2469
|
const result = await runBackfill(API_PATH, false);
|
|
1732
2470
|
if (!result.ok) {
|
|
1733
2471
|
setToolNotice({ kind: "error", text: result.message });
|
|
1734
2472
|
return;
|
|
1735
2473
|
}
|
|
1736
|
-
const
|
|
2474
|
+
const written = result.data.written;
|
|
2475
|
+
const enriched = result.data.enriched ?? 0;
|
|
1737
2476
|
setToolNotice({
|
|
1738
2477
|
kind: "success",
|
|
1739
|
-
text:
|
|
2478
|
+
text: written === 0 && enriched === 0 ? "\u6CA1\u6709\u9700\u8981\u8865\u5F55\u6216\u8865\u5168\u7684\u8BB0\u5F55" : `\u65B0\u589E ${String(written)} \u6761\uFF1B\u8865\u5168 ${String(enriched)} \u6761\u5386\u53F2\u8BB0\u5F55`
|
|
1740
2479
|
});
|
|
1741
2480
|
setToolPanel(null);
|
|
1742
2481
|
onReload();
|
|
@@ -1746,22 +2485,22 @@ function TokenUsageDashboard(props) {
|
|
|
1746
2485
|
};
|
|
1747
2486
|
const allModelFacets = data?.facets.models ?? [];
|
|
1748
2487
|
const modelFacets = provider === null ? allModelFacets : allModelFacets.filter((facet) => facet.provider === provider);
|
|
1749
|
-
return (0,
|
|
2488
|
+
return (0, import_react8.createElement)(
|
|
1750
2489
|
"div",
|
|
1751
2490
|
{ className: "dsh-tu-root" },
|
|
1752
|
-
(0,
|
|
2491
|
+
(0, import_react8.createElement)(
|
|
1753
2492
|
"div",
|
|
1754
2493
|
{ className: "dsh-tu-shell" },
|
|
1755
|
-
(0,
|
|
2494
|
+
(0, import_react8.createElement)(
|
|
1756
2495
|
"div",
|
|
1757
2496
|
{ className: "dsh-tu-header" },
|
|
1758
|
-
(0,
|
|
1759
|
-
data === null ? null : (0,
|
|
2497
|
+
(0, import_react8.createElement)("h1", { className: "dsh-tu-title" }, PANEL_LABEL),
|
|
2498
|
+
data === null ? null : (0, import_react8.createElement)(
|
|
1760
2499
|
"span",
|
|
1761
2500
|
{ className: "dsh-tu-version", title: "\u5F53\u524D\u63D2\u4EF6\u7248\u672C" },
|
|
1762
2501
|
`v${data.pluginVersion}`
|
|
1763
2502
|
),
|
|
1764
|
-
(0,
|
|
2503
|
+
(0, import_react8.createElement)(
|
|
1765
2504
|
"span",
|
|
1766
2505
|
{ className: "dsh-tu-subtle" },
|
|
1767
2506
|
data === null ? loading ? "\u6B63\u5728\u8BFB\u53D6\u672C\u5730\u8D26\u672C\u2026" : "\u672A\u8BFB\u53D6\u5230\u6570\u636E\uFF0C\u8BF7\u70B9\u5237\u65B0\u91CD\u8BD5" : `\u8D26\u672C ${String(data.facets.records)} \u6761 \xB7 ${data.facets.firstDay || "\u2014"} ~ ${data.facets.lastDay || "\u2014"}`
|
|
@@ -1769,9 +2508,9 @@ function TokenUsageDashboard(props) {
|
|
|
1769
2508
|
// The spinning glyph is suppressed under `prefers-reduced-motion`, so the
|
|
1770
2509
|
// busy state also gets a word — otherwise the only cue left is a slightly
|
|
1771
2510
|
// dimmer icon.
|
|
1772
|
-
loading ? (0,
|
|
1773
|
-
(0,
|
|
1774
|
-
(0,
|
|
2511
|
+
loading ? (0, import_react8.createElement)("span", { className: "dsh-tu-subtle", role: "status" }, "\u6B63\u5728\u5237\u65B0\u2026") : null,
|
|
2512
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-spacer" }),
|
|
2513
|
+
(0, import_react8.createElement)("input", {
|
|
1775
2514
|
ref: fileInputRef,
|
|
1776
2515
|
type: "file",
|
|
1777
2516
|
accept: ".json,application/json",
|
|
@@ -1780,7 +2519,7 @@ function TokenUsageDashboard(props) {
|
|
|
1780
2519
|
void handlePickImport(event);
|
|
1781
2520
|
}
|
|
1782
2521
|
}),
|
|
1783
|
-
(0,
|
|
2522
|
+
(0, import_react8.createElement)(
|
|
1784
2523
|
"button",
|
|
1785
2524
|
{
|
|
1786
2525
|
type: "button",
|
|
@@ -1795,7 +2534,7 @@ function TokenUsageDashboard(props) {
|
|
|
1795
2534
|
},
|
|
1796
2535
|
exportGlyph()
|
|
1797
2536
|
),
|
|
1798
|
-
(0,
|
|
2537
|
+
(0, import_react8.createElement)(
|
|
1799
2538
|
"button",
|
|
1800
2539
|
{
|
|
1801
2540
|
type: "button",
|
|
@@ -1810,14 +2549,14 @@ function TokenUsageDashboard(props) {
|
|
|
1810
2549
|
},
|
|
1811
2550
|
importGlyph()
|
|
1812
2551
|
),
|
|
1813
|
-
(0,
|
|
2552
|
+
(0, import_react8.createElement)(
|
|
1814
2553
|
"button",
|
|
1815
2554
|
{
|
|
1816
2555
|
type: "button",
|
|
1817
2556
|
className: "dsh-tu-icon-btn",
|
|
1818
2557
|
"data-tool": "backfill",
|
|
1819
|
-
"aria-label": "\u8865\u5F55\u7F3A\u5931\u6570\u636E",
|
|
1820
|
-
title: "\u626B\u63CF\u672C\u673A\u4F1A\u8BDD\u65E5\u5FD7\uFF0C\u8865\u5F55\
|
|
2558
|
+
"aria-label": "\u8865\u5F55\u7F3A\u5931\u6570\u636E\u5E76\u8865\u5168\u5386\u53F2\u5B57\u6BB5",
|
|
2559
|
+
title: "\u626B\u63CF\u672C\u673A\u4F1A\u8BDD\u65E5\u5FD7\uFF0C\u8865\u5F55\u7F3A\u5931\u8F6E\u6B21\uFF0C\u5E76\u4E3A\u65E7\u8D26\u672C\u8865\u5168 step/\u9996 token/\u5DE5\u5177\u7B49\u65B0\u5B57\u6BB5\uFF08\u53EF\u91CD\u590D\u6267\u884C\uFF0C\u4E0D\u4F1A\u91CD\u590D\u8BA1\u6570\uFF09",
|
|
1821
2560
|
onClick: () => {
|
|
1822
2561
|
void handleScanBackfill();
|
|
1823
2562
|
},
|
|
@@ -1831,7 +2570,7 @@ function TokenUsageDashboard(props) {
|
|
|
1831
2570
|
setHover: setPricingHover,
|
|
1832
2571
|
setPinned: setPricingPinned
|
|
1833
2572
|
}),
|
|
1834
|
-
(0,
|
|
2573
|
+
(0, import_react8.createElement)(
|
|
1835
2574
|
"button",
|
|
1836
2575
|
{
|
|
1837
2576
|
type: "button",
|
|
@@ -1848,7 +2587,7 @@ function TokenUsageDashboard(props) {
|
|
|
1848
2587
|
},
|
|
1849
2588
|
refreshGlyph()
|
|
1850
2589
|
),
|
|
1851
|
-
(0,
|
|
2590
|
+
(0, import_react8.createElement)(
|
|
1852
2591
|
"button",
|
|
1853
2592
|
{
|
|
1854
2593
|
type: "button",
|
|
@@ -1876,17 +2615,17 @@ function TokenUsageDashboard(props) {
|
|
|
1876
2615
|
// selects really do change the numbers below them; each field's label
|
|
1877
2616
|
// carries a title stating exactly what it scopes, since granularity and
|
|
1878
2617
|
// date range deliberately do not touch the cumulative totals.
|
|
1879
|
-
(0,
|
|
2618
|
+
(0, import_react8.createElement)(
|
|
1880
2619
|
"div",
|
|
1881
2620
|
{ className: "dsh-tu-panel" },
|
|
1882
|
-
(0,
|
|
2621
|
+
(0, import_react8.createElement)(
|
|
1883
2622
|
"div",
|
|
1884
2623
|
{ className: "dsh-tu-filters" },
|
|
1885
|
-
(0,
|
|
2624
|
+
(0, import_react8.createElement)(
|
|
1886
2625
|
"div",
|
|
1887
2626
|
{ className: "dsh-tu-field" },
|
|
1888
|
-
(0,
|
|
1889
|
-
(0,
|
|
2627
|
+
(0, import_react8.createElement)("label", { title: "\u5F71\u54CD\u672C\u9762\u677F\u7684\u5168\u90E8\u7EDF\u8BA1\uFF1A\u7D2F\u8BA1\u5361\u7247\u3001\u56FE\u8868\u4E0E\u660E\u7EC6\u8868" }, "\u5DE5\u4F5C\u533A"),
|
|
2628
|
+
(0, import_react8.createElement)(
|
|
1890
2629
|
"select",
|
|
1891
2630
|
{
|
|
1892
2631
|
className: "dsh-tu-select",
|
|
@@ -1896,17 +2635,17 @@ function TokenUsageDashboard(props) {
|
|
|
1896
2635
|
setWorkspace(event.target.value === "" ? null : event.target.value);
|
|
1897
2636
|
}
|
|
1898
2637
|
},
|
|
1899
|
-
(0,
|
|
2638
|
+
(0, import_react8.createElement)("option", { value: "" }, "\u5168\u90E8\u5DE5\u4F5C\u533A"),
|
|
1900
2639
|
...(data?.facets.workspaces ?? []).map((facet) => {
|
|
1901
2640
|
const merged = facet.mergedCount ?? (facet.paths?.length ?? 1);
|
|
1902
|
-
return (0,
|
|
2641
|
+
return (0, import_react8.createElement)(
|
|
1903
2642
|
"option",
|
|
1904
2643
|
{ key: facet.key, value: facet.key },
|
|
1905
2644
|
`${facet.label}\uFF08${formatTokens(facet.tokens)}${merged > 1 ? ` \xB7 ${String(merged)} \u4E2A\u8DEF\u5F84` : ""}\uFF09`
|
|
1906
2645
|
);
|
|
1907
2646
|
}),
|
|
1908
2647
|
...workspaceIsRawPath && !workspaceIsFacetKey ? [
|
|
1909
|
-
(0,
|
|
2648
|
+
(0, import_react8.createElement)(
|
|
1910
2649
|
"option",
|
|
1911
2650
|
{ key: "__raw-workspace__", value: workspace ?? "" },
|
|
1912
2651
|
`${workspace ?? ""}\uFF08\u5355\u8DEF\u5F84\uFF09`
|
|
@@ -1914,15 +2653,15 @@ function TokenUsageDashboard(props) {
|
|
|
1914
2653
|
] : []
|
|
1915
2654
|
)
|
|
1916
2655
|
),
|
|
1917
|
-
(0,
|
|
2656
|
+
(0, import_react8.createElement)(
|
|
1918
2657
|
"div",
|
|
1919
2658
|
{ className: "dsh-tu-field" },
|
|
1920
|
-
(0,
|
|
2659
|
+
(0, import_react8.createElement)(
|
|
1921
2660
|
"label",
|
|
1922
2661
|
{ title: "\u5F71\u54CD\u672C\u9762\u677F\u7684\u5168\u90E8\u7EDF\u8BA1\uFF1A\u7D2F\u8BA1\u5361\u7247\u3001\u56FE\u8868\u4E0E\u660E\u7EC6\u8868" },
|
|
1923
2662
|
"\u63A5\u5165\u65B9"
|
|
1924
2663
|
),
|
|
1925
|
-
(0,
|
|
2664
|
+
(0, import_react8.createElement)(
|
|
1926
2665
|
"select",
|
|
1927
2666
|
{
|
|
1928
2667
|
className: "dsh-tu-select",
|
|
@@ -1938,9 +2677,9 @@ function TokenUsageDashboard(props) {
|
|
|
1938
2677
|
}
|
|
1939
2678
|
}
|
|
1940
2679
|
},
|
|
1941
|
-
(0,
|
|
2680
|
+
(0, import_react8.createElement)("option", { value: "" }, "\u5168\u90E8\u63A5\u5165\u65B9"),
|
|
1942
2681
|
...(data?.facets.providers ?? []).filter((facet) => facet.key !== "").map(
|
|
1943
|
-
(facet) => (0,
|
|
2682
|
+
(facet) => (0, import_react8.createElement)(
|
|
1944
2683
|
"option",
|
|
1945
2684
|
{ key: facet.key, value: facet.key },
|
|
1946
2685
|
`${facet.label}\uFF08${formatTokens(facet.tokens)}\uFF09`
|
|
@@ -1948,11 +2687,11 @@ function TokenUsageDashboard(props) {
|
|
|
1948
2687
|
)
|
|
1949
2688
|
)
|
|
1950
2689
|
),
|
|
1951
|
-
(0,
|
|
2690
|
+
(0, import_react8.createElement)(
|
|
1952
2691
|
"div",
|
|
1953
2692
|
{ className: "dsh-tu-field" },
|
|
1954
|
-
(0,
|
|
1955
|
-
(0,
|
|
2693
|
+
(0, import_react8.createElement)("label", { title: "\u5F71\u54CD\u672C\u9762\u677F\u7684\u5168\u90E8\u7EDF\u8BA1\uFF1A\u7D2F\u8BA1\u5361\u7247\u3001\u56FE\u8868\u4E0E\u660E\u7EC6\u8868" }, "\u6A21\u578B"),
|
|
2694
|
+
(0, import_react8.createElement)(
|
|
1956
2695
|
"select",
|
|
1957
2696
|
{
|
|
1958
2697
|
className: "dsh-tu-select",
|
|
@@ -1969,9 +2708,9 @@ function TokenUsageDashboard(props) {
|
|
|
1969
2708
|
}
|
|
1970
2709
|
}
|
|
1971
2710
|
},
|
|
1972
|
-
(0,
|
|
2711
|
+
(0, import_react8.createElement)("option", { value: "" }, "\u5168\u90E8\u6A21\u578B"),
|
|
1973
2712
|
...modelFacets.filter((facet) => facet.key !== "").map(
|
|
1974
|
-
(facet) => (0,
|
|
2713
|
+
(facet) => (0, import_react8.createElement)(
|
|
1975
2714
|
"option",
|
|
1976
2715
|
{ key: facet.key, value: facet.key },
|
|
1977
2716
|
// The key carries provider/model; show BOTH so two
|
|
@@ -1981,15 +2720,15 @@ function TokenUsageDashboard(props) {
|
|
|
1981
2720
|
)
|
|
1982
2721
|
)
|
|
1983
2722
|
),
|
|
1984
|
-
(0,
|
|
2723
|
+
(0, import_react8.createElement)(
|
|
1985
2724
|
"div",
|
|
1986
2725
|
{ className: "dsh-tu-field" },
|
|
1987
|
-
(0,
|
|
1988
|
-
(0,
|
|
2726
|
+
(0, import_react8.createElement)("label", { title: "\u53EA\u5F71\u54CD\u4E0B\u9762\u7684\u67F1\u72B6\u56FE\uFF1B\u7D2F\u8BA1\u5361\u7247\u4E0E\u660E\u7EC6\u8868\u4E3A\u5168\u5386\u53F2\uFF0C\u4E0D\u968F\u65E5\u671F\u53D8\u5316" }, "\u7C92\u5EA6"),
|
|
2727
|
+
(0, import_react8.createElement)(
|
|
1989
2728
|
"div",
|
|
1990
2729
|
{ className: "dsh-tu-group" },
|
|
1991
2730
|
...GRANULARITIES.map(
|
|
1992
|
-
(option) => (0,
|
|
2731
|
+
(option) => (0, import_react8.createElement)(
|
|
1993
2732
|
"button",
|
|
1994
2733
|
{
|
|
1995
2734
|
key: option.id,
|
|
@@ -2005,15 +2744,15 @@ function TokenUsageDashboard(props) {
|
|
|
2005
2744
|
)
|
|
2006
2745
|
)
|
|
2007
2746
|
),
|
|
2008
|
-
(0,
|
|
2747
|
+
(0, import_react8.createElement)(
|
|
2009
2748
|
"div",
|
|
2010
2749
|
{ className: "dsh-tu-field" },
|
|
2011
|
-
(0,
|
|
2012
|
-
(0,
|
|
2750
|
+
(0, import_react8.createElement)("label", { title: "\u53EA\u5F71\u54CD\u4E0B\u9762\u7684\u67F1\u72B6\u56FE\uFF1B\u7D2F\u8BA1\u5361\u7247\u4E0E\u660E\u7EC6\u8868\u4E3A\u5168\u5386\u53F2\uFF0C\u4E0D\u968F\u65E5\u671F\u53D8\u5316" }, "\u8303\u56F4"),
|
|
2751
|
+
(0, import_react8.createElement)(
|
|
2013
2752
|
"div",
|
|
2014
2753
|
{ className: "dsh-tu-group" },
|
|
2015
2754
|
...PRESETS.map(
|
|
2016
|
-
(option) => (0,
|
|
2755
|
+
(option) => (0, import_react8.createElement)(
|
|
2017
2756
|
"button",
|
|
2018
2757
|
{
|
|
2019
2758
|
key: option.id,
|
|
@@ -2033,14 +2772,14 @@ function TokenUsageDashboard(props) {
|
|
|
2033
2772
|
)
|
|
2034
2773
|
)
|
|
2035
2774
|
),
|
|
2036
|
-
preset !== "custom" ? null : (0,
|
|
2775
|
+
preset !== "custom" ? null : (0, import_react8.createElement)(
|
|
2037
2776
|
"div",
|
|
2038
2777
|
{ className: "dsh-tu-field" },
|
|
2039
|
-
(0,
|
|
2040
|
-
(0,
|
|
2778
|
+
(0, import_react8.createElement)("label", { title: "\u542B\u9996\u5C3E\u4E24\u5929\uFF1A\u8D77 = \u6B62 \u8868\u793A\u53EA\u770B\u8FD9\u4E00\u5929" }, "\u8D77\u6B62\u65E5\u671F"),
|
|
2779
|
+
(0, import_react8.createElement)(
|
|
2041
2780
|
"div",
|
|
2042
2781
|
{ style: { display: "flex", gap: "6px", alignItems: "center" } },
|
|
2043
|
-
(0,
|
|
2782
|
+
(0, import_react8.createElement)("input", {
|
|
2044
2783
|
className: "dsh-tu-input",
|
|
2045
2784
|
type: "date",
|
|
2046
2785
|
value: customFrom,
|
|
@@ -2054,8 +2793,8 @@ function TokenUsageDashboard(props) {
|
|
|
2054
2793
|
if (next.length > 0 && customTo.length > 0 && next > customTo) setCustomTo(next);
|
|
2055
2794
|
}
|
|
2056
2795
|
}),
|
|
2057
|
-
(0,
|
|
2058
|
-
(0,
|
|
2796
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-subtle" }, "\u81F3"),
|
|
2797
|
+
(0, import_react8.createElement)("input", {
|
|
2059
2798
|
className: "dsh-tu-input",
|
|
2060
2799
|
type: "date",
|
|
2061
2800
|
value: customTo,
|
|
@@ -2072,95 +2811,115 @@ function TokenUsageDashboard(props) {
|
|
|
2072
2811
|
),
|
|
2073
2812
|
// ---- cumulative cards. These follow the WORKSPACE/MODEL filter only:
|
|
2074
2813
|
// the date range and granularity above scope the charts, not the totals.
|
|
2075
|
-
(0,
|
|
2076
|
-
(0,
|
|
2814
|
+
(0, import_react8.createElement)("div", { className: "dsh-tu-section-title" }, "\u7D2F\u8BA1\u7528\u91CF"),
|
|
2815
|
+
(0, import_react8.createElement)(
|
|
2077
2816
|
"div",
|
|
2078
2817
|
{ className: "dsh-tu-cards" },
|
|
2079
2818
|
createCard(
|
|
2080
2819
|
"\u7D2F\u8BA1 Token",
|
|
2081
2820
|
formatTokens(data?.totals.total ?? 0),
|
|
2082
|
-
data === null ? "" : hasFilter(workspace, model) ? `\u5168\u90E8\u5386\u53F2 ${formatTokens(data.allTime.total)}` : `${formatTokensExact(data.totals.total)} tokens
|
|
2821
|
+
data === null ? "" : hasFilter(workspace, model) ? [`\u5168\u90E8\u5386\u53F2 ${formatTokens(data.allTime.total)}`] : [`${formatTokensExact(data.totals.total)} tokens`],
|
|
2083
2822
|
"blue"
|
|
2084
2823
|
),
|
|
2085
2824
|
createCard(
|
|
2086
2825
|
"\u7D2F\u8BA1\u8D39\u7528",
|
|
2087
2826
|
formatMoney(data?.totals.cost ?? 0, currency),
|
|
2088
|
-
data === null ? "" : hasFilter(workspace, model) ? `\u5168\u90E8\u5386\u53F2 ${formatMoney(data.allTime.cost, currency)}` : `${String(data.totals.turns)} \u8F6E
|
|
2827
|
+
data === null ? "" : hasFilter(workspace, model) ? [`\u5168\u90E8\u5386\u53F2 ${formatMoney(data.allTime.cost, currency)}`] : [`${String(data.totals.turns)} \u8F6E`, data.currency],
|
|
2089
2828
|
"amber"
|
|
2090
2829
|
),
|
|
2091
2830
|
createCard(
|
|
2092
2831
|
"\u7D2F\u8BA1\u8F6E\u6B21",
|
|
2093
2832
|
formatTokensExact(data?.totals.turns ?? 0),
|
|
2094
|
-
data === null ? "" : `\u6D3B\u8DC3 ${String(data.facets.activeDays)} \u5929
|
|
2833
|
+
data === null ? "" : [`\u6D3B\u8DC3 ${String(data.facets.activeDays)} \u5929`],
|
|
2095
2834
|
"violet"
|
|
2096
2835
|
),
|
|
2097
2836
|
createCard(
|
|
2098
2837
|
"\u7F13\u5B58\u547D\u4E2D\u7387",
|
|
2099
2838
|
formatPercent(data?.totals.tokens ?? void 0),
|
|
2100
|
-
"\u547D\u4E2D / \u5168\u90E8\u8F93\u5165 token",
|
|
2839
|
+
["\u547D\u4E2D / \u5168\u90E8\u8F93\u5165 token"],
|
|
2101
2840
|
"green"
|
|
2102
2841
|
),
|
|
2103
2842
|
createCard(
|
|
2104
2843
|
"\u8FDE\u7EED\u4F7F\u7528",
|
|
2105
2844
|
`${String(streak.current)} \u5929`,
|
|
2106
|
-
`\u6700\u957F ${String(streak.longest)} \u5929
|
|
2845
|
+
[`\u6700\u957F ${String(streak.longest)} \u5929`],
|
|
2107
2846
|
"rose"
|
|
2108
2847
|
),
|
|
2109
2848
|
createCard(
|
|
2110
2849
|
"\u8F93\u51FA Token",
|
|
2111
2850
|
formatTokens(data?.totals.tokens.output ?? 0),
|
|
2112
|
-
data === null ? "" : `\u63A8\u7406 ${formatTokens(data.totals.tokens.reasoning)}
|
|
2851
|
+
data === null ? "" : [`\u63A8\u7406 ${formatTokens(data.totals.tokens.reasoning)}`],
|
|
2113
2852
|
"blue"
|
|
2114
2853
|
)
|
|
2115
2854
|
),
|
|
2116
|
-
analytics === void 0 ? null : (0,
|
|
2117
|
-
analytics === void 0 ? null : (0,
|
|
2855
|
+
analytics === void 0 ? null : (0, import_react8.createElement)("div", { className: "dsh-tu-section-title" }, "\u4F7F\u7528\u6548\u7387"),
|
|
2856
|
+
analytics === void 0 ? null : (0, import_react8.createElement)(
|
|
2118
2857
|
"div",
|
|
2119
2858
|
{ className: "dsh-tu-cards", "data-cards": "insights" },
|
|
2120
2859
|
createCard(
|
|
2121
2860
|
"\u6BCF\u8F6E\u8C03\u7528",
|
|
2122
2861
|
`${formatCount(analytics.calls.medianPerTurn)} \u6B21`,
|
|
2123
|
-
|
|
2862
|
+
[`90% \u7684\u8F6E\u6B21 \u2264 ${formatCount(analytics.calls.p90PerTurn)} \u6B21`, `\u6700\u591A ${formatCount(analytics.calls.maxPerTurn)} \u6B21`],
|
|
2124
2863
|
"blue"
|
|
2125
2864
|
),
|
|
2126
2865
|
createCard(
|
|
2127
2866
|
"\u591A\u6B21\u8C03\u7528\u8F6E\u6B21",
|
|
2128
2867
|
analytics.calls.turns === 0 ? "\u2014" : `${(analytics.calls.multiCallTurns / analytics.calls.turns * 100).toFixed(0)}%`,
|
|
2129
|
-
|
|
2868
|
+
[`${formatCount(analytics.calls.multiCallTurns)} / ${formatCount(analytics.calls.turns)} \u8F6E`, "\u4E00\u8F6E\u5185 \u22652 \u6B21\u6A21\u578B\u8C03\u7528"],
|
|
2130
2869
|
"amber"
|
|
2131
2870
|
),
|
|
2132
2871
|
createCard(
|
|
2133
2872
|
"\u8F6E\u6B21\u8017\u65F6",
|
|
2134
2873
|
formatDuration(analytics.durations.median),
|
|
2135
|
-
|
|
2874
|
+
[`90% \u7684\u8F6E\u6B21 \u2264 ${formatDuration(analytics.durations.p90)}`, `\u6700\u957F ${formatDuration(analytics.durations.max)}`],
|
|
2136
2875
|
"violet"
|
|
2137
2876
|
),
|
|
2138
2877
|
createCard(
|
|
2139
2878
|
"\u4F1A\u8BDD\u6570",
|
|
2140
2879
|
formatCount(analytics.sessions.count),
|
|
2141
|
-
`\u5E73\u5747 ${analytics.sessions.averageTurns.toFixed(1)} \u8F6E/\u4F1A\u8BDD
|
|
2880
|
+
[`\u5E73\u5747 ${analytics.sessions.averageTurns.toFixed(1)} \u8F6E/\u4F1A\u8BDD`, `\u4E2D\u4F4D ${formatCount(analytics.sessions.medianTurns)} \u8F6E`],
|
|
2142
2881
|
"green"
|
|
2143
2882
|
),
|
|
2144
2883
|
createCard(
|
|
2145
2884
|
"\u6BCF\u8F6E\u8D39\u7528",
|
|
2146
2885
|
formatMoney(analytics.calls.costPerTurnMedian, currency),
|
|
2147
|
-
`\
|
|
2886
|
+
[`\u6BCF\u8F6E Token \u4E2D\u4F4D ${formatTokens(analytics.calls.tokensPerTurnMedian)}`],
|
|
2148
2887
|
"rose"
|
|
2149
|
-
)
|
|
2888
|
+
),
|
|
2889
|
+
...performance === void 0 ? [] : [
|
|
2890
|
+
createCard(
|
|
2891
|
+
"\u9996 token \u7528\u65F6",
|
|
2892
|
+
performance.ttftSamples === 0 ? "\u2014" : formatDuration(performance.ttftMedian),
|
|
2893
|
+
performance.ttftSamples === 0 ? "\u65B0\u7248\u91C7\u96C6\u540E\u624D\u6709\u6570\u636E" : [`\u4E2D\u4F4D ${formatDuration(performance.ttftMedian)}`, `\u5E73\u5747 ${formatDuration(performance.ttftAverage)}`],
|
|
2894
|
+
"blue"
|
|
2895
|
+
),
|
|
2896
|
+
createCard(
|
|
2897
|
+
"\u8F93\u51FA\u901F\u5EA6",
|
|
2898
|
+
performance.tpsSamples === 0 ? "\u2014" : formatSpeed(performance.tpsMedian),
|
|
2899
|
+
performance.tpsSamples === 0 ? "\u65B0\u7248\u91C7\u96C6\u540E\u624D\u6709\u6570\u636E" : [`\u4E2D\u4F4D ${formatSpeed(performance.tpsMedian)}`, `\u5E73\u5747 ${formatSpeed(performance.tpsAverage)}`],
|
|
2900
|
+
"green"
|
|
2901
|
+
),
|
|
2902
|
+
createCard(
|
|
2903
|
+
"\u6B65\u9AA4\u4E0E\u5DE5\u5177",
|
|
2904
|
+
performance.stepSamples === 0 ? "\u2014" : `${performance.stepsPerTurn.toFixed(1)} \u6B65/\u8F6E`,
|
|
2905
|
+
performance.stepSamples === 0 ? "\u65B0\u7248\u91C7\u96C6\u540E\u624D\u6709\u6570\u636E" : [`\u91C7\u6837 ${formatCount(performance.stepSamples)}/${formatCount(performance.coverage.records)} \u8F6E`, `\u5DE5\u5177 ${formatCount(performance.toolCalls)} \u6B21 / \u5931\u8D25 ${formatCount(performance.toolErrors)} \u6B21`],
|
|
2906
|
+
"violet"
|
|
2907
|
+
)
|
|
2908
|
+
]
|
|
2150
2909
|
),
|
|
2151
2910
|
// ---- heatmap (its own row; companion figures on the row below)
|
|
2152
|
-
(0,
|
|
2911
|
+
(0, import_react8.createElement)(
|
|
2153
2912
|
"div",
|
|
2154
2913
|
{ className: "dsh-tu-panel", "data-panel": "heatmap" },
|
|
2155
|
-
(0,
|
|
2914
|
+
(0, import_react8.createElement)(
|
|
2156
2915
|
"div",
|
|
2157
2916
|
{ className: "dsh-tu-panel-head" },
|
|
2158
|
-
(0,
|
|
2159
|
-
(0,
|
|
2160
|
-
(0,
|
|
2917
|
+
(0, import_react8.createElement)("h2", { className: "dsh-tu-panel-title" }, "\u6BCF\u65E5\u6D88\u8017\u65E5\u5386"),
|
|
2918
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-spacer" }),
|
|
2919
|
+
(0, import_react8.createElement)(
|
|
2161
2920
|
"div",
|
|
2162
2921
|
{ className: "dsh-tu-heat-bar" },
|
|
2163
|
-
(0,
|
|
2922
|
+
(0, import_react8.createElement)(
|
|
2164
2923
|
"button",
|
|
2165
2924
|
{
|
|
2166
2925
|
type: "button",
|
|
@@ -2179,7 +2938,7 @@ function TokenUsageDashboard(props) {
|
|
|
2179
2938
|
},
|
|
2180
2939
|
"\u2190 \u4E0A\u4E00\u6BB5"
|
|
2181
2940
|
),
|
|
2182
|
-
(0,
|
|
2941
|
+
(0, import_react8.createElement)(
|
|
2183
2942
|
"span",
|
|
2184
2943
|
{ className: "dsh-tu-heat-range" },
|
|
2185
2944
|
// When part of the page could not be fetched, the caption names the
|
|
@@ -2188,7 +2947,7 @@ function TokenUsageDashboard(props) {
|
|
|
2188
2947
|
// left in this panel.
|
|
2189
2948
|
heatRange.covered ? `${heatRange.start} ~ ${heatRange.end}\uFF08${String(heatRange.days)} \u5929\uFF09` : `${heatRange.drawnStart || "\u2014"} ~ ${heatRange.drawnEnd || "\u2014"}\uFF08\u5B9E\u7ED8 ${String(heatRange.drawnDays)} \u5929\uFF0C\u5176\u4F59\u672A\u53D6\u5230\uFF09`
|
|
2190
2949
|
),
|
|
2191
|
-
(0,
|
|
2950
|
+
(0, import_react8.createElement)(
|
|
2192
2951
|
"button",
|
|
2193
2952
|
{
|
|
2194
2953
|
type: "button",
|
|
@@ -2201,7 +2960,7 @@ function TokenUsageDashboard(props) {
|
|
|
2201
2960
|
},
|
|
2202
2961
|
"\u4E0B\u4E00\u6BB5 \u2192"
|
|
2203
2962
|
),
|
|
2204
|
-
heatAnchor === "" ? null : (0,
|
|
2963
|
+
heatAnchor === "" ? null : (0, import_react8.createElement)(
|
|
2205
2964
|
"button",
|
|
2206
2965
|
{
|
|
2207
2966
|
type: "button",
|
|
@@ -2214,10 +2973,10 @@ function TokenUsageDashboard(props) {
|
|
|
2214
2973
|
)
|
|
2215
2974
|
)
|
|
2216
2975
|
),
|
|
2217
|
-
(0,
|
|
2976
|
+
(0, import_react8.createElement)(
|
|
2218
2977
|
"div",
|
|
2219
2978
|
{ className: "dsh-tu-heat-layout" },
|
|
2220
|
-
(0,
|
|
2979
|
+
(0, import_react8.createElement)(Heatmap, {
|
|
2221
2980
|
points: daily,
|
|
2222
2981
|
metric: "tokens",
|
|
2223
2982
|
currency,
|
|
@@ -2230,253 +2989,391 @@ function TokenUsageDashboard(props) {
|
|
|
2230
2989
|
),
|
|
2231
2990
|
// ---- token bars: one stacked bar carries the whole composition, so the
|
|
2232
2991
|
// tiny miss/output slices are not separate targets that are hard to hover.
|
|
2233
|
-
(0,
|
|
2992
|
+
(0, import_react8.createElement)(
|
|
2234
2993
|
"div",
|
|
2235
2994
|
{ className: "dsh-tu-panel", "data-panel": "tokens" },
|
|
2236
|
-
(0,
|
|
2995
|
+
(0, import_react8.createElement)(
|
|
2237
2996
|
"div",
|
|
2238
2997
|
{ className: "dsh-tu-panel-head" },
|
|
2239
|
-
(0,
|
|
2240
|
-
(0,
|
|
2998
|
+
(0, import_react8.createElement)("h2", { className: "dsh-tu-panel-title" }, "Token \u6D88\u8017"),
|
|
2999
|
+
(0, import_react8.createElement)(
|
|
2241
3000
|
"span",
|
|
2242
3001
|
{ className: "dsh-tu-subtle" },
|
|
2243
3002
|
`${describeGranularity(granularity)} \xB7 \u5408\u8BA1 ${formatTokens(rangeStats.tokens)} tokens`
|
|
2244
3003
|
)
|
|
2245
3004
|
),
|
|
2246
|
-
(0,
|
|
3005
|
+
(0, import_react8.createElement)(CacheCompositionChart, {
|
|
2247
3006
|
buckets,
|
|
2248
3007
|
emptyHint: "\u8BE5\u8303\u56F4\u5185\u6CA1\u6709\u8BB0\u5F55\u5230 token \u6D88\u8017"
|
|
2249
3008
|
})
|
|
2250
3009
|
),
|
|
2251
3010
|
// ---- cost bars
|
|
2252
|
-
(0,
|
|
3011
|
+
(0, import_react8.createElement)(
|
|
2253
3012
|
"div",
|
|
2254
3013
|
{ className: "dsh-tu-panel", "data-panel": "cost" },
|
|
2255
|
-
(0,
|
|
3014
|
+
(0, import_react8.createElement)(
|
|
2256
3015
|
"div",
|
|
2257
3016
|
{ className: "dsh-tu-panel-head" },
|
|
2258
|
-
(0,
|
|
2259
|
-
(0,
|
|
3017
|
+
(0, import_react8.createElement)("h2", { className: "dsh-tu-panel-title" }, "\u8D39\u7528\u6D88\u8017"),
|
|
3018
|
+
(0, import_react8.createElement)(
|
|
2260
3019
|
"span",
|
|
2261
3020
|
{ className: "dsh-tu-subtle" },
|
|
2262
3021
|
`${describeGranularity(granularity)} \xB7 \u5408\u8BA1 ${formatMoney(rangeStats.cost, currency)}`
|
|
2263
3022
|
)
|
|
2264
3023
|
),
|
|
2265
|
-
(0,
|
|
3024
|
+
(0, import_react8.createElement)(BarChart, {
|
|
2266
3025
|
buckets,
|
|
2267
3026
|
metric: "cost",
|
|
2268
3027
|
currency,
|
|
2269
3028
|
emptyHint: "\u8BE5\u8303\u56F4\u5185\u6CA1\u6709\u8BB0\u5F55\u5230\u8D39\u7528"
|
|
2270
3029
|
})
|
|
2271
3030
|
),
|
|
3031
|
+
// ---- agent / pricing-window breakdowns
|
|
3032
|
+
analytics === void 0 ? null : (0, import_react8.createElement)(
|
|
3033
|
+
"div",
|
|
3034
|
+
{ className: "dsh-tu-panel", "data-panel": "agents-outcomes" },
|
|
3035
|
+
(0, import_react8.createElement)(
|
|
3036
|
+
"div",
|
|
3037
|
+
{ className: "dsh-tu-panel-head" },
|
|
3038
|
+
(0, import_react8.createElement)("h2", { className: "dsh-tu-panel-title" }, "Agent \u4E0E\u65F6\u6BB5"),
|
|
3039
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-subtle" }, "\u5F53\u524D\u7B5B\u9009 \xB7 \u5168\u5386\u53F2"),
|
|
3040
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-spacer" }),
|
|
3041
|
+
createPanelInfoButton(
|
|
3042
|
+
"agents",
|
|
3043
|
+
"Agent \u4E0E\u65F6\u6BB5\u8BF4\u660E",
|
|
3044
|
+
panelInfo === "agents",
|
|
3045
|
+
[
|
|
3046
|
+
"Agent \u540D\u79F0\uFF1Astandard=\u6807\u51C6\u6A21\u5F0F\uFF0Ccordis=\u521B\u9020\u6A21\u5F0F\uFF0Cminimal=\u6781\u7B80\u6A21\u5F0F\uFF0Ccode=\u4EE3\u7801\u6A21\u5F0F\uFF0Cptc=PTC \u6A21\u5F0F\uFF1B\u672A\u8BC6\u522B\u7684 preset \u4FDD\u7559\u539F\u59CB id\u3002",
|
|
3047
|
+
"\u9AD8\u5CF0/\u7A7A\u95F2\u6309\u6BCF\u6B21\u6A21\u578B\u8C03\u7528\u7ED3\u7B97\u65F6\u7684\u4EF7\u683C\u7A97\u53E3\u7EDF\u8BA1\uFF1B\u8D39\u7528/Token \u53EA\u7EDF\u8BA1\u8BE5\u7A97\u53E3\u5185\u7684\u8C03\u7528\u3002",
|
|
3048
|
+
"\u4E09\u5F20\u56FE\u5206\u522B\u5C55\u793A\u8D39\u7528\u5360\u6BD4\u3001\u8F6E\u6B21\u5206\u5E03\u4E0E\u9AD8\u5CF0/\u7A7A\u95F2\u8C03\u7528\uFF1B\u8D39\u7528\u5360\u6BD4\u56FE\u7528\u6811\u56FE\u5C55\u793A\u5404 Agent \u7684\u8D39\u7528\u6784\u6210\u3002"
|
|
3049
|
+
],
|
|
3050
|
+
setPanelInfo
|
|
3051
|
+
)
|
|
3052
|
+
),
|
|
3053
|
+
(0, import_react8.createElement)(
|
|
3054
|
+
"div",
|
|
3055
|
+
{ className: "dsh-tu-sector-grid" },
|
|
3056
|
+
createSubpanel(
|
|
3057
|
+
"Agent \u8D39\u7528\u5360\u6BD4",
|
|
3058
|
+
(0, import_react8.createElement)(SectorChart, {
|
|
3059
|
+
slices: agentCostSlices,
|
|
3060
|
+
variant: "donut",
|
|
3061
|
+
centerLabel: "\u7D2F\u8BA1\u8D39\u7528",
|
|
3062
|
+
centerValue: formatMoney(agentCost, currency),
|
|
3063
|
+
primaryLabel: "\u8D39\u7528",
|
|
3064
|
+
formatValue: (value) => formatMoney(value, currency),
|
|
3065
|
+
ariaLabel: "Agent \u8D39\u7528\u5360\u6BD4\u73AF\u5F62\u56FE",
|
|
3066
|
+
emptyHint: "\u6682\u65E0\u53EF\u5206\u644A\u8D39\u7528"
|
|
3067
|
+
})
|
|
3068
|
+
),
|
|
3069
|
+
createSubpanel(
|
|
3070
|
+
"Agent \u8F6E\u6B21\u5206\u5E03",
|
|
3071
|
+
(0, import_react8.createElement)(SectorChart, {
|
|
3072
|
+
slices: agentTurnSlices,
|
|
3073
|
+
variant: "pie",
|
|
3074
|
+
primaryLabel: "\u8F6E\u6B21",
|
|
3075
|
+
formatValue: (value) => formatCount(value),
|
|
3076
|
+
ariaLabel: "Agent \u8F6E\u6B21\u5360\u6BD4\u997C\u56FE",
|
|
3077
|
+
emptyHint: "\u6682\u65E0\u8F6E\u6B21\u6570\u636E"
|
|
3078
|
+
})
|
|
3079
|
+
),
|
|
3080
|
+
createSubpanel(
|
|
3081
|
+
"\u9AD8\u5CF0 / \u7A7A\u95F2\u8C03\u7528",
|
|
3082
|
+
(0, import_react8.createElement)(SectorChart, {
|
|
3083
|
+
slices: windowSlices,
|
|
3084
|
+
variant: "donut",
|
|
3085
|
+
centerLabel: "\u7D2F\u8BA1\u8C03\u7528",
|
|
3086
|
+
centerValue: formatCount(windowCalls),
|
|
3087
|
+
primaryLabel: "\u8C03\u7528",
|
|
3088
|
+
formatValue: (value) => formatCount(value),
|
|
3089
|
+
ariaLabel: "\u9AD8\u5CF0\u7A7A\u95F2\u8C03\u7528\u5360\u6BD4\u6247\u5F62\u56FE",
|
|
3090
|
+
emptyHint: "\u6682\u65E0\u65F6\u6BB5\u6570\u636E"
|
|
3091
|
+
})
|
|
3092
|
+
)
|
|
3093
|
+
)
|
|
3094
|
+
),
|
|
2272
3095
|
// ---- cache hit-rate trend (client range + granularity)
|
|
2273
|
-
(0,
|
|
3096
|
+
(0, import_react8.createElement)(
|
|
2274
3097
|
"div",
|
|
2275
3098
|
{ className: "dsh-tu-panel", "data-panel": "cache-rate" },
|
|
2276
|
-
(0,
|
|
3099
|
+
(0, import_react8.createElement)(
|
|
2277
3100
|
"div",
|
|
2278
3101
|
{ className: "dsh-tu-panel-head" },
|
|
2279
|
-
(0,
|
|
2280
|
-
(0,
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
3102
|
+
(0, import_react8.createElement)("h2", { className: "dsh-tu-panel-title" }, "\u7F13\u5B58\u547D\u4E2D\u7387\u8D8B\u52BF"),
|
|
3103
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-spacer" }),
|
|
3104
|
+
createPanelInfoButton(
|
|
3105
|
+
"cache-rate",
|
|
3106
|
+
"\u7F13\u5B58\u547D\u4E2D\u7387\u8BF4\u660E",
|
|
3107
|
+
panelInfo === "cache-rate",
|
|
3108
|
+
[
|
|
3109
|
+
"\u7F13\u5B58\u547D\u4E2D\u7387 = \u7F13\u5B58\u547D\u4E2D\u8F93\u5165 token /\uFF08\u7F13\u5B58\u547D\u4E2D + \u672A\u547D\u4E2D\u8F93\u5165\uFF09\uFF1B\u7F13\u5B58\u5199\u5165\u4E0E\u8F93\u51FA token \u4E0D\u8BA1\u5165\u5206\u6BCD\u3002",
|
|
3110
|
+
`\u7EB5\u8F74\u6309\u5F53\u524D\u6570\u636E\u81EA\u9002\u5E94\u7F29\u653E\uFF08\u5F53\u524D ${formatRateBound(cacheAxis.min)}\u2013100%\uFF09\uFF1B\u4F4E\u4E8E\u4E0B\u9650\u7684\u4F4E\u503C\u70B9\u4F1A\u663E\u793A\u5728\u5E95\u90E8\u3002`,
|
|
3111
|
+
"\u201C\u547D\u4E2D / \u672A\u547D\u4E2D / \u8F93\u51FA\u201D\u662F\u5F53\u524D\u65E5\u671F\u8303\u56F4\u5185\u7684 Token \u5408\u8BA1\uFF0C\u968F\u8303\u56F4\u4E0E\u7C92\u5EA6\u53D8\u5316\u3002"
|
|
3112
|
+
],
|
|
3113
|
+
setPanelInfo
|
|
2284
3114
|
)
|
|
2285
3115
|
),
|
|
2286
|
-
(0,
|
|
3116
|
+
(0, import_react8.createElement)(
|
|
3117
|
+
"div",
|
|
3118
|
+
{ className: "dsh-tu-kpi-strip" },
|
|
3119
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi dsh-tu-cache-stat" }, "\u547D\u4E2D ", (0, import_react8.createElement)("b", null, formatTokens(rangeTokens.cacheRead))),
|
|
3120
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi dsh-tu-cache-stat" }, "\u672A\u547D\u4E2D ", (0, import_react8.createElement)("b", null, formatTokens(rangeTokens.uncachedInput))),
|
|
3121
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi dsh-tu-cache-stat" }, "\u8F93\u51FA ", (0, import_react8.createElement)("b", null, formatTokens(rangeTokens.output))),
|
|
3122
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi dsh-tu-cache-stat" }, "\u5F53\u524D\u8303\u56F4 ", (0, import_react8.createElement)("b", null, formatPercent(rangeTokens)))
|
|
3123
|
+
),
|
|
3124
|
+
(0, import_react8.createElement)(CacheRateLine, {
|
|
2287
3125
|
buckets,
|
|
2288
3126
|
emptyHint: "\u8BE5\u8303\u56F4\u5185\u6CA1\u6709\u53EF\u8BA1\u7B97\u7684\u7F13\u5B58\u547D\u4E2D\u7387"
|
|
2289
|
-
})
|
|
2290
|
-
|
|
3127
|
+
})
|
|
3128
|
+
),
|
|
3129
|
+
// ---- response performance (v2 timing fields; absent on old payloads)
|
|
3130
|
+
performance === void 0 || !performanceHasData ? null : (0, import_react8.createElement)(
|
|
3131
|
+
"div",
|
|
3132
|
+
{ className: "dsh-tu-panel", "data-panel": "performance" },
|
|
3133
|
+
(0, import_react8.createElement)(
|
|
2291
3134
|
"div",
|
|
2292
|
-
{ className: "dsh-tu-
|
|
2293
|
-
(0,
|
|
2294
|
-
(0,
|
|
2295
|
-
(
|
|
2296
|
-
|
|
2297
|
-
"
|
|
2298
|
-
|
|
2299
|
-
|
|
3135
|
+
{ className: "dsh-tu-panel-head" },
|
|
3136
|
+
(0, import_react8.createElement)("h2", { className: "dsh-tu-panel-title" }, "\u54CD\u5E94\u6027\u80FD"),
|
|
3137
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-spacer" }),
|
|
3138
|
+
createPanelInfoButton(
|
|
3139
|
+
"performance",
|
|
3140
|
+
"\u54CD\u5E94\u6027\u80FD\u8BF4\u660E",
|
|
3141
|
+
panelInfo === "performance",
|
|
3142
|
+
[
|
|
3143
|
+
"\u9996 token \u7528\u65F6\uFF1A\u4ECE step \u5F00\u59CB\u5230\u7B2C\u4E00\u4E2A\u8F93\u51FA token\uFF1B\u8F93\u51FA\u901F\u5EA6 = \u8F93\u51FA token / \u89E3\u7801\u65F6\u957F\u3002",
|
|
3144
|
+
"\u53CC\u8F74\u56FE\u5DE6\u8F74\u662F\u9996 token \u7528\u65F6\u3001\u53F3\u8F74\u662F\u8F93\u51FA\u901F\u5EA6\uFF1B\u901F\u5EA6\u5206\u5E03\u6309\u8DEF\u7531\u5C55\u793A 25\u201375 \u5206\u4F4D\uFF08\u7BB1\u4F53\uFF09\u3001\u4E2D\u4F4D\uFF08\u4E2D\u7EBF\uFF09\u4E0E 10\u201390 \u5206\u4F4D\uFF08\u7EC6\u7EBF\uFF09\uFF0C\u4E0D\u662F\u91CD\u590D\u7684\u8F93\u51FA\u901F\u5EA6\u5747\u503C\uFF1B\u9876\u90E8\u548C\u5361\u7247\u4E3B\u503C\u53D6\u4E2D\u4F4D\uFF0C\u5361\u7247\u8865\u5145\u4E2D\u4F4D\u4E0E\u5E73\u5747\uFF0C\u4E0D\u4F7F\u7528\u52A0\u6743\u5747\u503C\uFF1B\u96F7\u8FBE\u56FE\u5404\u8F74\u6309\u5F53\u524D\u8DEF\u7531\u5F52\u4E00\u5316\uFF08\u9996 token \u7528\u65F6\u53CD\u8F6C\uFF0C\u8D8A\u5916\u8D8A\u597D\uFF09\u3002",
|
|
3145
|
+
"\u8F93\u51FA\u901F\u5EA6\u6307\u89E3\u7801\u901F\u5EA6\uFF0C\u4E0D\u7B49\u4E8E\u7AEF\u5230\u7AEF\u54CD\u5E94\u901F\u5EA6\uFF1B\u5355 chunk/\u975E\u6D41\u5F0F\u54CD\u5E94\u4F1A\u628A\u89E3\u7801\u65F6\u95F4\u538B\u5230\u6781\u77ED\u5E76\u7B97\u51FA 1000+ tok/s\uFF0C\u8FD9\u7C7B\u4E0D\u53EF\u4FE1\u6837\u672C\u5DF2\u4ECE\u901F\u5EA6\u7EDF\u8BA1\u4E2D\u6392\u9664\u3002\u9996 token \u7528\u65F6 / \u8F93\u51FA\u901F\u5EA6 / \u6A21\u578B\u7528\u65F6\u8DDF\u968F\u6A21\u578B\u6216\u63A5\u5165\u65B9\u7B5B\u9009\uFF1B\u6B65\u9AA4\u4E0E\u5DE5\u5177\u8BA1\u6570\u6309\u6574\u8F6E\u5F52\u5C5E\u3002",
|
|
3146
|
+
"\u65E7\u8BB0\u5F55\u6CA1\u6709\u91C7\u6837\u65F6\u663E\u793A \u2014 \u6216\u7A7A\u72B6\u6001\uFF0C\u53EF\u7528\u9876\u90E8\u300C\u8865\u5F55\u300D\u4ECE\u4F1A\u8BDD\u65E5\u5FD7\u8865\u5168\uFF1B\u7D2F\u8BA1\u6A21\u578B\u7528\u65F6\u662F\u5F53\u524D\u7B5B\u9009\u4E0B\u7684\u7D2F\u8BA1\u503C\u3002"
|
|
3147
|
+
],
|
|
3148
|
+
setPanelInfo
|
|
3149
|
+
)
|
|
3150
|
+
),
|
|
3151
|
+
(0, import_react8.createElement)(
|
|
3152
|
+
"div",
|
|
3153
|
+
{ className: "dsh-tu-kpi-strip" },
|
|
3154
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "\u91C7\u6837 ", (0, import_react8.createElement)("b", null, `${formatCount(performance.coverage.recordsWithTiming)}/${formatCount(performance.coverage.records)}`)),
|
|
3155
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "\u9996 token \u7528\u65F6\u4E2D\u4F4D ", (0, import_react8.createElement)("b", null, performance.ttftSamples === 0 ? "\u2014" : formatDuration(performance.ttftMedian))),
|
|
3156
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi", "data-tone": "green" }, "\u8F93\u51FA\u901F\u5EA6\u4E2D\u4F4D ", (0, import_react8.createElement)("b", null, performance.tpsSamples === 0 ? "\u2014" : formatSpeed(performance.tpsMedian))),
|
|
3157
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "\u7D2F\u8BA1\u6A21\u578B\u7528\u65F6 ", (0, import_react8.createElement)("b", null, formatDuration(performance.modelMs))),
|
|
3158
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "90% \u9996 token \u7528\u65F6 ", (0, import_react8.createElement)("b", null, performance.ttftSamples === 0 ? "\u2014" : formatDuration(performance.ttftP90)))
|
|
3159
|
+
),
|
|
3160
|
+
(0, import_react8.createElement)(
|
|
3161
|
+
"div",
|
|
3162
|
+
{ className: "dsh-tu-chart-stack" },
|
|
3163
|
+
createSubpanel(
|
|
3164
|
+
"\u9996 token \u7528\u65F6 / \u8F93\u51FA\u901F\u5EA6\u8D8B\u52BF",
|
|
3165
|
+
(0, import_react8.createElement)(DualAreaTrend, {
|
|
3166
|
+
buckets,
|
|
3167
|
+
leftValue: (bucket) => bucket.perf !== void 0 && bucket.perf.ttftSamples > 0 ? bucket.perf.ttftMs / bucket.perf.ttftSamples : null,
|
|
3168
|
+
rightValue: (bucket) => bucket.perf !== void 0 && bucket.perf.decodeMs > 0 ? bucket.perf.decodeTokens / bucket.perf.decodeMs * 1e3 : null,
|
|
3169
|
+
leftLabel: "\u9996 token \u7528\u65F6",
|
|
3170
|
+
rightLabel: "\u8F93\u51FA\u901F\u5EA6",
|
|
3171
|
+
formatLeft: (value) => formatDuration(value),
|
|
3172
|
+
formatRight: (value) => value === 0 ? "0" : formatSpeed(value),
|
|
3173
|
+
ariaLabel: "\u9996 token \u7528\u65F6\u4E0E\u8F93\u51FA\u901F\u5EA6\u53CC\u8F74\u8D8B\u52BF\u56FE",
|
|
3174
|
+
emptyHint: "\u8BE5\u8303\u56F4\u5185\u6CA1\u6709\u53EF\u7528\u7684\u901F\u5EA6\u91C7\u6837"
|
|
3175
|
+
})
|
|
3176
|
+
),
|
|
3177
|
+
createSubpanel(
|
|
3178
|
+
"\u8F93\u51FA\u901F\u5EA6\u5206\u5E03\uFF08\u6309\u8DEF\u7531\uFF0Ctok/s\uFF09",
|
|
3179
|
+
(0, import_react8.createElement)(SpeedRangeChart, {
|
|
3180
|
+
rows: speedRanges,
|
|
3181
|
+
formatValue: (value) => formatSpeed(value),
|
|
3182
|
+
emptyHint: "\u6682\u65E0\u53EF\u6BD4\u8F83\u7684\u8DEF\u7531\u901F\u5EA6\u5206\u5E03"
|
|
3183
|
+
})
|
|
3184
|
+
),
|
|
3185
|
+
createSubpanel(
|
|
3186
|
+
"\u8DEF\u7531\u6027\u80FD\uFF08\u96F7\u8FBE\uFF09",
|
|
3187
|
+
(0, import_react8.createElement)(RadarChart, {
|
|
3188
|
+
axes: ["\u9996 token \u7528\u65F6", "\u8F93\u51FA\u901F\u5EA6", "\u8F93\u51FA", "\u8C03\u7528"],
|
|
3189
|
+
series: routeRadar,
|
|
3190
|
+
ariaLabel: "\u6309\u8DEF\u7531\u5F52\u4E00\u5316\u7684\u9996 token \u7528\u65F6\u3001\u8F93\u51FA\u901F\u5EA6\u3001\u8F93\u51FA\u4E0E\u8C03\u7528\u96F7\u8FBE\u56FE",
|
|
3191
|
+
emptyHint: "\u6682\u65E0\u5E26\u65F6\u5E8F\u7684\u8DEF\u7531"
|
|
3192
|
+
})
|
|
2300
3193
|
)
|
|
2301
3194
|
)
|
|
2302
3195
|
),
|
|
2303
|
-
// ----
|
|
2304
|
-
|
|
3196
|
+
// ---- step loop / tool activity (v2)
|
|
3197
|
+
performance === void 0 || !performanceHasData ? null : (0, import_react8.createElement)(
|
|
2305
3198
|
"div",
|
|
2306
|
-
{ className: "dsh-tu-panel", "data-panel": "
|
|
2307
|
-
(0,
|
|
3199
|
+
{ className: "dsh-tu-panel", "data-panel": "tools" },
|
|
3200
|
+
(0, import_react8.createElement)(
|
|
2308
3201
|
"div",
|
|
2309
3202
|
{ className: "dsh-tu-panel-head" },
|
|
2310
|
-
(0,
|
|
2311
|
-
(0,
|
|
2312
|
-
(0, import_react7.createElement)("span", { className: "dsh-tu-spacer" }),
|
|
3203
|
+
(0, import_react8.createElement)("h2", { className: "dsh-tu-panel-title" }, "\u6B65\u9AA4\u4E0E\u5DE5\u5177"),
|
|
3204
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-spacer" }),
|
|
2313
3205
|
createPanelInfoButton(
|
|
2314
|
-
"
|
|
2315
|
-
"\
|
|
2316
|
-
panelInfo === "
|
|
3206
|
+
"tools",
|
|
3207
|
+
"\u6B65\u9AA4\u4E0E\u5DE5\u5177\u8BF4\u660E",
|
|
3208
|
+
panelInfo === "tools",
|
|
2317
3209
|
[
|
|
2318
|
-
"\
|
|
2319
|
-
"\
|
|
3210
|
+
"\u4E00\u6B65 = \u4E00\u6B21\u6A21\u578B\u8C03\u7528 + \u5B83\u8BF7\u6C42\u7684\u5DE5\u5177\u6267\u884C\uFF1B\u4E00\u6B21\u91CD\u8BD5\u4F1A\u4EA7\u751F\u65B0\u7684 attempt\uFF0C\u4F46\u4ECD\u5C5E\u4E8E\u540C\u4E00\u6B65\u3002",
|
|
3211
|
+
"\u5DE5\u5177\u53EA\u4FDD\u5B58\u540D\u79F0\u3001\u8C03\u7528/\u7ED3\u679C\u6B21\u6570\u3001\u5931\u8D25\u6B21\u6570\u4E0E\u8017\u65F6\uFF0C\u4E0D\u4FDD\u5B58\u53C2\u6570\u6216\u7ED3\u679C\u5185\u5BB9\u3002",
|
|
3212
|
+
"\u68D2\u68D2\u7CD6\u56FE = \u6BCF\u8F6E\u6B65\u9AA4\u6570 / \u6BCF\u8F6E\u5DE5\u5177\u8C03\u7528\u6570\u5206\u5E03\uFF1B\u5DE5\u5177\u8017\u65F6\u7528\u65AD\u8F74\u6A2A\u6761\uFF1A\u5F53\u6700\u5927\u503C\u660E\u663E\u9AD8\u4E8E\u5176\u4F59\u5DE5\u5177\u65F6\uFF0C\u622A\u65AD\u8BE5\u503C\u5E76\u6807\u65AD\u8F74\uFF0C\u5176\u4F59\u5DE5\u5177\u6309\u7EBF\u6027\u523B\u5EA6\uFF0C\u5177\u4F53\u622A\u65AD\u5BF9\u8C61\u968F\u6570\u636E\u53D8\u5316\u3001\u4E0D\u662F\u56FA\u5B9A\u67D0\u4E2A\u5DE5\u5177\uFF1B\u4EEA\u8868 = \u5DE5\u5177\u7528\u65F6\u5360\u6A21\u578B+\u5DE5\u5177\u7684\u6BD4\u4F8B\u3002",
|
|
3213
|
+
"\u6B65\u9AA4\u4E0E\u5DE5\u5177\u8BA1\u6570\u6309\u6574\u8F6E\u5F52\u5C5E\uFF0C\u4E0D\u53D7\u6A21\u578B\u7B5B\u9009\u5F71\u54CD\uFF1B\u9996 token \u7528\u65F6\u3001\u8F93\u51FA\u901F\u5EA6\u7B49\u8C03\u7528\u7EA7\u6307\u6807\u5219\u8DDF\u968F\u7B5B\u9009\u3002"
|
|
2320
3214
|
],
|
|
2321
3215
|
setPanelInfo
|
|
2322
3216
|
)
|
|
2323
3217
|
),
|
|
2324
|
-
(0,
|
|
3218
|
+
(0, import_react8.createElement)(
|
|
2325
3219
|
"div",
|
|
2326
|
-
{ className: "dsh-tu-
|
|
3220
|
+
{ className: "dsh-tu-kpi-strip" },
|
|
3221
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "\u6709\u91C7\u6837\u5E73\u5747 ", (0, import_react8.createElement)("b", null, `${performance.stepsPerTurn.toFixed(1)} \u6B65/\u8F6E`)),
|
|
3222
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "\u5DE5\u5177 ", (0, import_react8.createElement)("b", null, `${formatCount(performance.toolCalls)} \u6B21`)),
|
|
3223
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi", "data-tone": "rose" }, "\u5931\u8D25 ", (0, import_react8.createElement)("b", null, performance.toolCalls === 0 ? "\u2014" : formatShare(performance.toolErrorRate))),
|
|
3224
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "\u91CD\u8BD5 ", (0, import_react8.createElement)("b", null, `${formatCount(performance.retries)} \u6B21`)),
|
|
3225
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "\u7D2F\u8BA1\u5DE5\u5177\u7528\u65F6 ", (0, import_react8.createElement)("b", null, formatDuration(performance.toolMs)))
|
|
3226
|
+
),
|
|
3227
|
+
(0, import_react8.createElement)(
|
|
3228
|
+
"div",
|
|
3229
|
+
{ className: "dsh-tu-chart-stack" },
|
|
2327
3230
|
createSubpanel(
|
|
2328
|
-
"\u6BCF\u8F6E\
|
|
2329
|
-
(0,
|
|
2330
|
-
items:
|
|
3231
|
+
"\u6BCF\u8F6E\u6B65\u9AA4\u6570",
|
|
3232
|
+
(0, import_react8.createElement)(DotPlot, {
|
|
3233
|
+
items: stepBins,
|
|
2331
3234
|
formatValue: (count) => `${formatCount(count)} \u8F6E`,
|
|
2332
|
-
emptyHint: "\u6682\u65E0\
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
{ className: "dsh-tu-stat-line" },
|
|
2337
|
-
(0, import_react7.createElement)("span", null, "\u4E2D\u4F4D ", (0, import_react7.createElement)("strong", null, `${formatCount(analytics.calls.medianPerTurn)} \u6B21`)),
|
|
2338
|
-
(0, import_react7.createElement)("span", null, "90% \u7684\u8F6E\u6B21 \u2264 ", (0, import_react7.createElement)("strong", null, `${formatCount(analytics.calls.p90PerTurn)} \u6B21`)),
|
|
2339
|
-
(0, import_react7.createElement)("span", null, "\u5E73\u5747 ", (0, import_react7.createElement)("strong", null, `${analytics.calls.averagePerTurn.toFixed(1)} \u6B21`)),
|
|
2340
|
-
(0, import_react7.createElement)("span", null, "\u591A\u6B21\u8C03\u7528\u8F6E\u6B21 ", (0, import_react7.createElement)("strong", null, `${formatCount(analytics.calls.multiCallTurns)} \u8F6E`))
|
|
2341
|
-
)
|
|
3235
|
+
emptyHint: "\u6682\u65E0\u6B65\u9AA4\u6570\u636E",
|
|
3236
|
+
xLabel: "\u6BCF\u8F6E\u6B65\u9AA4\u6570",
|
|
3237
|
+
yLabel: "\u8F6E\u6B21\u6570"
|
|
3238
|
+
})
|
|
2342
3239
|
),
|
|
2343
3240
|
createSubpanel(
|
|
2344
|
-
"\u6BCF\u8F6E\
|
|
2345
|
-
(0,
|
|
2346
|
-
items:
|
|
3241
|
+
"\u6BCF\u8F6E\u5DE5\u5177\u8C03\u7528\u6570",
|
|
3242
|
+
(0, import_react8.createElement)(DotPlot, {
|
|
3243
|
+
items: toolBins,
|
|
2347
3244
|
formatValue: (count) => `${formatCount(count)} \u8F6E`,
|
|
2348
|
-
emptyHint: "\u6682\u65E0\
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
{ className: "dsh-tu-stat-line" },
|
|
2353
|
-
(0, import_react7.createElement)("span", null, "\u4E2D\u4F4D ", (0, import_react7.createElement)("strong", null, formatDuration(analytics.durations.median))),
|
|
2354
|
-
(0, import_react7.createElement)("span", null, "90% \u7684\u8F6E\u6B21 \u2264 ", (0, import_react7.createElement)("strong", null, formatDuration(analytics.durations.p90))),
|
|
2355
|
-
(0, import_react7.createElement)("span", null, "\u5E73\u5747 ", (0, import_react7.createElement)("strong", null, formatDuration(analytics.durations.average))),
|
|
2356
|
-
(0, import_react7.createElement)("span", null, "\u6700\u957F ", (0, import_react7.createElement)("strong", null, formatDuration(analytics.durations.max)))
|
|
2357
|
-
)
|
|
3245
|
+
emptyHint: "\u6682\u65E0\u5DE5\u5177\u8C03\u7528\u6570\u636E",
|
|
3246
|
+
xLabel: "\u6BCF\u8F6E\u5DE5\u5177\u8C03\u7528\u6570",
|
|
3247
|
+
yLabel: "\u8F6E\u6B21\u6570"
|
|
3248
|
+
})
|
|
2358
3249
|
)
|
|
2359
3250
|
),
|
|
2360
|
-
(0,
|
|
3251
|
+
(0, import_react8.createElement)(
|
|
2361
3252
|
"div",
|
|
2362
|
-
{ className: "dsh-tu-
|
|
2363
|
-
(
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
3253
|
+
{ className: "dsh-tu-chart-grid" },
|
|
3254
|
+
createSubpanel(
|
|
3255
|
+
"\u5DE5\u5177\u8017\u65F6\u6392\u884C\uFF08\u65AD\u8F74\uFF09",
|
|
3256
|
+
(0, import_react8.createElement)(OutlierBarChart, {
|
|
3257
|
+
items: toolBars,
|
|
3258
|
+
formatValue: (value) => formatDuration(value),
|
|
3259
|
+
emptyHint: "\u6682\u65E0\u5DE5\u5177\u8017\u65F6\u6570\u636E"
|
|
3260
|
+
})
|
|
3261
|
+
),
|
|
3262
|
+
createSubpanel(
|
|
3263
|
+
"\u5DE5\u5177\u7528\u65F6\u5360\u6BD4",
|
|
3264
|
+
(0, import_react8.createElement)(GaugeShare, {
|
|
3265
|
+
value: performance.toolMs,
|
|
3266
|
+
total: timeTotal,
|
|
3267
|
+
valueLabel: "\u5DE5\u5177",
|
|
3268
|
+
remainderLabel: "\u6A21\u578B",
|
|
3269
|
+
formatValue: (value) => formatDuration(value),
|
|
3270
|
+
emptyHint: "\u6682\u65E0\u6A21\u578B\u6216\u5DE5\u5177\u8017\u65F6\u6570\u636E"
|
|
3271
|
+
})
|
|
3272
|
+
)
|
|
2367
3273
|
)
|
|
2368
3274
|
),
|
|
2369
|
-
// ----
|
|
2370
|
-
analytics === void 0 ? null : (0,
|
|
3275
|
+
// ---- call / duration efficiency (all-time under the active filter)
|
|
3276
|
+
analytics === void 0 ? null : (0, import_react8.createElement)(
|
|
2371
3277
|
"div",
|
|
2372
|
-
{ className: "dsh-tu-panel", "data-panel": "
|
|
2373
|
-
(0,
|
|
3278
|
+
{ className: "dsh-tu-panel", "data-panel": "efficiency" },
|
|
3279
|
+
(0, import_react8.createElement)(
|
|
2374
3280
|
"div",
|
|
2375
3281
|
{ className: "dsh-tu-panel-head" },
|
|
2376
|
-
(0,
|
|
2377
|
-
(0,
|
|
2378
|
-
(0,
|
|
3282
|
+
(0, import_react8.createElement)("h2", { className: "dsh-tu-panel-title" }, "\u8C03\u7528\u4E0E\u8F6E\u6B21\u6548\u7387"),
|
|
3283
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-subtle" }, "\u5F53\u524D\u7B5B\u9009 \xB7 \u5168\u5386\u53F2"),
|
|
3284
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-spacer" }),
|
|
2379
3285
|
createPanelInfoButton(
|
|
2380
|
-
"
|
|
2381
|
-
"
|
|
2382
|
-
panelInfo === "
|
|
3286
|
+
"efficiency",
|
|
3287
|
+
"\u8C03\u7528\u4E0E\u8F6E\u6B21\u6548\u7387\u8BF4\u660E",
|
|
3288
|
+
panelInfo === "efficiency",
|
|
2383
3289
|
[
|
|
2384
|
-
"\
|
|
2385
|
-
"\
|
|
3290
|
+
"\u201C\u591A\u6B21\u8C03\u7528\u8F6E\u6B21\u201D\u6307\u4E00\u8F6E\u5BF9\u8BDD\u5185\u53D1\u751F 2 \u6B21\u53CA\u4EE5\u4E0A\u6A21\u578B\u8C03\u7528\uFF08\u5DE5\u5177\u5FAA\u73AF/\u91CD\u8BD5\uFF09\uFF0C\u4E0D\u662F\u591A\u8F6E\u5BF9\u8BDD\u3002",
|
|
3291
|
+
"\u201C90% \u7684\u8F6E\u6B21 \u2264\u201D\u8868\u793A\u4E5D\u6210\u8F6E\u6B21\u7684\u8C03\u7528\u6B21\u6570/\u8017\u65F6\u4E0D\u8D85\u8FC7\u8BE5\u503C\uFF1B\u6A2A\u8F74\u9636\u68AF\u6309\u6BCF\u8F6E\u5B9E\u9645\u6A21\u578B\u8C03\u7528\u6B21\u6570/\u8F6E\u6B21\u8017\u65F6\u5206\u7EC4\u3002"
|
|
2386
3292
|
],
|
|
2387
3293
|
setPanelInfo
|
|
2388
3294
|
)
|
|
2389
3295
|
),
|
|
2390
|
-
(0,
|
|
2391
|
-
hours: analytics.hours,
|
|
2392
|
-
currency,
|
|
2393
|
-
emptyHint: "\u6682\u65E0\u53EF\u6309\u5C0F\u65F6\u5F52\u5C5E\u7684\u8C03\u7528\u6570\u636E"
|
|
2394
|
-
}),
|
|
2395
|
-
(0, import_react7.createElement)(
|
|
3296
|
+
(0, import_react8.createElement)(
|
|
2396
3297
|
"div",
|
|
2397
|
-
{ className: "dsh-tu-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
3298
|
+
{ className: "dsh-tu-kpi-strip" },
|
|
3299
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "\u4E2D\u4F4D\u8C03\u7528 ", (0, import_react8.createElement)("b", null, `${formatCount(analytics.calls.medianPerTurn)} \u6B21`)),
|
|
3300
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "90% \u8F6E\u6B21 \u2264 ", (0, import_react8.createElement)("b", null, `${formatCount(analytics.calls.p90PerTurn)} \u6B21`)),
|
|
3301
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "\u4E2D\u4F4D\u8017\u65F6 ", (0, import_react8.createElement)("b", null, formatDuration(analytics.durations.median))),
|
|
3302
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "90% \u8017\u65F6 \u2264 ", (0, import_react8.createElement)("b", null, formatDuration(analytics.durations.p90))),
|
|
3303
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-kpi" }, "\u4F1A\u8BDD ", (0, import_react8.createElement)("b", null, `${formatCount(analytics.sessions.count)} \u4E2A`))
|
|
3304
|
+
),
|
|
3305
|
+
(0, import_react8.createElement)(
|
|
3306
|
+
"div",
|
|
3307
|
+
{ className: "dsh-tu-chart-grid" },
|
|
3308
|
+
createSubpanel(
|
|
3309
|
+
"\u6BCF\u8F6E\u6A21\u578B\u8C03\u7528\u6B21\u6570",
|
|
3310
|
+
(0, import_react8.createElement)(HBarList, {
|
|
3311
|
+
items: analytics.attemptBins,
|
|
3312
|
+
formatValue: (count) => `${formatCount(count)} \u8F6E`,
|
|
3313
|
+
emptyHint: "\u6682\u65E0\u8C03\u7528\u6570\u636E"
|
|
3314
|
+
})
|
|
3315
|
+
),
|
|
3316
|
+
createSubpanel(
|
|
3317
|
+
"\u6BCF\u8F6E\u8017\u65F6",
|
|
3318
|
+
(0, import_react8.createElement)(HBarList, {
|
|
3319
|
+
items: analytics.durationBins,
|
|
3320
|
+
formatValue: (count) => `${formatCount(count)} \u8F6E`,
|
|
3321
|
+
emptyHint: "\u6682\u65E0\u8017\u65F6\u6570\u636E"
|
|
3322
|
+
})
|
|
2405
3323
|
)
|
|
2406
3324
|
)
|
|
2407
3325
|
),
|
|
2408
|
-
// ----
|
|
2409
|
-
analytics === void 0 ? null : (0,
|
|
3326
|
+
// ---- local hour-of-day activity
|
|
3327
|
+
analytics === void 0 ? null : (0, import_react8.createElement)(
|
|
2410
3328
|
"div",
|
|
2411
|
-
{ className: "dsh-tu-panel", "data-panel": "
|
|
2412
|
-
(0,
|
|
3329
|
+
{ className: "dsh-tu-panel", "data-panel": "hours" },
|
|
3330
|
+
(0, import_react8.createElement)(
|
|
2413
3331
|
"div",
|
|
2414
3332
|
{ className: "dsh-tu-panel-head" },
|
|
2415
|
-
(0,
|
|
2416
|
-
(0,
|
|
2417
|
-
(0,
|
|
3333
|
+
(0, import_react8.createElement)("h2", { className: "dsh-tu-panel-title" }, "24 \u5C0F\u65F6\u6D3B\u8DC3\u65F6\u6BB5"),
|
|
3334
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-subtle" }, "\u672C\u5730\u65F6\u95F4 \xB7 \u5F53\u524D\u7B5B\u9009 \xB7 \u5168\u5386\u53F2"),
|
|
3335
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-spacer" }),
|
|
2418
3336
|
createPanelInfoButton(
|
|
2419
|
-
"
|
|
2420
|
-
"
|
|
2421
|
-
panelInfo === "
|
|
3337
|
+
"hours",
|
|
3338
|
+
"24 \u5C0F\u65F6\u6D3B\u8DC3\u65F6\u6BB5\u8BF4\u660E",
|
|
3339
|
+
panelInfo === "hours",
|
|
2422
3340
|
[
|
|
2423
|
-
"
|
|
2424
|
-
"\u9AD8\
|
|
2425
|
-
"\
|
|
3341
|
+
"\u6309\u6A21\u578B\u8C03\u7528\u7ED3\u7B97\u65F6\u95F4\u7684\u672C\u5730\u5C0F\u65F6\u7EDF\u8BA1\uFF1B\u4E00\u4E2A\u957F\u8F6E\u6B21\u53EF\u80FD\u8DE8\u591A\u4E2A\u5C0F\u65F6\uFF0C\u56E0\u6B64\u201C\u8F6E\u6B21\u5F00\u59CB\u201D\u4E0E\u8C03\u7528\u5C0F\u65F6\u7684\u53E3\u5F84\u4E0D\u540C\u3002",
|
|
3342
|
+
"\u67F1\u9AD8\u8868\u793A\u8BE5\u5C0F\u65F6\u5185\u7ED3\u7B97\u7684\u6A21\u578B\u8C03\u7528\u6B21\u6570\uFF1B\u4E0B\u65B9\u70ED\u529B\u56FE\u662F\u540C\u4E00\u6279\u8C03\u7528\u7684\u661F\u671F\u89C6\u89D2\u3002",
|
|
3343
|
+
"\u4E0B\u65B9\u300C\u661F\u671F \xD7 \u5C0F\u65F6\u300D\u662F\u540C\u4E00\u6279\u8C03\u7528\u7684\u53E6\u4E00\u79CD\u89C6\u89D2\uFF1A\u884C\u662F\u5468\u4E00\u81F3\u5468\u65E5\uFF0C\u5217\u662F\u672C\u5730\u5C0F\u65F6\uFF0C\u989C\u8272\u8D8A\u6DF1\u8868\u793A\u8C03\u7528\u8D8A\u591A\u3002"
|
|
2426
3344
|
],
|
|
2427
3345
|
setPanelInfo
|
|
2428
3346
|
)
|
|
2429
3347
|
),
|
|
2430
|
-
(0,
|
|
3348
|
+
(0, import_react8.createElement)(
|
|
2431
3349
|
"div",
|
|
2432
|
-
{ className: "dsh-tu-
|
|
2433
|
-
createSubpanel(
|
|
2434
|
-
"Agent \u8D39\u7528\u5360\u6BD4",
|
|
2435
|
-
(0, import_react7.createElement)(SectorChart, {
|
|
2436
|
-
slices: agentCostSlices,
|
|
2437
|
-
variant: "donut",
|
|
2438
|
-
centerLabel: "\u7D2F\u8BA1\u8D39\u7528",
|
|
2439
|
-
centerValue: formatMoney(agentCost, currency),
|
|
2440
|
-
primaryLabel: "\u8D39\u7528",
|
|
2441
|
-
formatValue: (value) => formatMoney(value, currency),
|
|
2442
|
-
ariaLabel: "Agent \u8D39\u7528\u5360\u6BD4\u6247\u5F62\u56FE",
|
|
2443
|
-
emptyHint: "\u6682\u65E0\u53EF\u5206\u644A\u8D39\u7528"
|
|
2444
|
-
})
|
|
2445
|
-
),
|
|
3350
|
+
{ className: "dsh-tu-chart-stack" },
|
|
2446
3351
|
createSubpanel(
|
|
2447
|
-
"
|
|
2448
|
-
(0,
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
formatValue: (value) => formatCount(value),
|
|
2453
|
-
ariaLabel: "Agent \u8F6E\u6B21\u5360\u6BD4\u997C\u56FE",
|
|
2454
|
-
emptyHint: "\u6682\u65E0\u8F6E\u6B21\u6570\u636E"
|
|
3352
|
+
"\u9010\u5C0F\u65F6\u8C03\u7528\uFF08\u672C\u5730\u65F6\u95F4\uFF09",
|
|
3353
|
+
(0, import_react8.createElement)(HourActivityChart, {
|
|
3354
|
+
hours: analytics.hours,
|
|
3355
|
+
currency,
|
|
3356
|
+
emptyHint: "\u6682\u65E0\u53EF\u6309\u5C0F\u65F6\u5F52\u5C5E\u7684\u8C03\u7528\u6570\u636E"
|
|
2455
3357
|
})
|
|
2456
3358
|
),
|
|
2457
3359
|
createSubpanel(
|
|
2458
|
-
"\
|
|
2459
|
-
(0,
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
centerValue: formatCount(windowCalls),
|
|
2464
|
-
primaryLabel: "\u8C03\u7528",
|
|
2465
|
-
formatValue: (value) => formatCount(value),
|
|
2466
|
-
ariaLabel: "\u9AD8\u5CF0\u7A7A\u95F2\u8C03\u7528\u5360\u6BD4\u6247\u5F62\u56FE",
|
|
2467
|
-
emptyHint: "\u6682\u65E0\u65F6\u6BB5\u6570\u636E"
|
|
3360
|
+
"\u661F\u671F \xD7 \u5C0F\u65F6",
|
|
3361
|
+
(0, import_react8.createElement)(WeekHourHeatmap, {
|
|
3362
|
+
cells: weekHours,
|
|
3363
|
+
currency,
|
|
3364
|
+
emptyHint: "\u6682\u65E0\u6309\u661F\u671F\u5F52\u5C5E\u7684\u8C03\u7528\u6570\u636E"
|
|
2468
3365
|
})
|
|
2469
3366
|
)
|
|
2470
3367
|
)
|
|
2471
3368
|
),
|
|
2472
3369
|
// ---- breakdowns
|
|
2473
|
-
(0,
|
|
3370
|
+
(0, import_react8.createElement)(
|
|
2474
3371
|
"div",
|
|
2475
3372
|
{ className: "dsh-tu-panel", "data-panel": "by-model" },
|
|
2476
|
-
(0,
|
|
3373
|
+
(0, import_react8.createElement)(
|
|
2477
3374
|
"div",
|
|
2478
3375
|
{ className: "dsh-tu-panel-head" },
|
|
2479
|
-
(0,
|
|
3376
|
+
(0, import_react8.createElement)(
|
|
2480
3377
|
"h2",
|
|
2481
3378
|
{
|
|
2482
3379
|
className: "dsh-tu-panel-title",
|
|
@@ -2487,15 +3384,26 @@ function TokenUsageDashboard(props) {
|
|
|
2487
3384
|
),
|
|
2488
3385
|
facetTable(data?.byModel ?? [], currency, "\u6A21\u578B")
|
|
2489
3386
|
),
|
|
2490
|
-
(0,
|
|
3387
|
+
(0, import_react8.createElement)(
|
|
2491
3388
|
"div",
|
|
2492
3389
|
{ className: "dsh-tu-panel", "data-panel": "by-workspace" },
|
|
2493
|
-
(0,
|
|
3390
|
+
(0, import_react8.createElement)(
|
|
2494
3391
|
"div",
|
|
2495
3392
|
{ className: "dsh-tu-panel-head" },
|
|
2496
|
-
(0,
|
|
3393
|
+
(0, import_react8.createElement)("h2", { className: "dsh-tu-panel-title" }, "\u6309\u5DE5\u4F5C\u533A"),
|
|
3394
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-spacer" }),
|
|
3395
|
+
createPanelInfoButton(
|
|
3396
|
+
"workspace",
|
|
3397
|
+
"\u6309\u5DE5\u4F5C\u533A\u8BF4\u660E",
|
|
3398
|
+
panelInfo === "workspace",
|
|
3399
|
+
[
|
|
3400
|
+
"\u540C\u540D\u5DE5\u4F5C\u533A\u5DF2\u6309\u540D\u79F0\u5408\u5E76\uFF1B\u70B9\u51FB\u884C\u5185\u300CN \u4E2A\u8DEF\u5F84\u300D\u53EF\u5C55\u5F00\u5404\u8DEF\u5F84\u5C0F\u8BA1\uFF0C\u5E76\u53EF\u53EA\u67E5\u770B\u67D0\u4E00\u6761\u8DEF\u5F84\u3002",
|
|
3401
|
+
"\u5DE5\u4F5C\u533A\u540D\u79F0\u8DDF\u968F dsh \u5F53\u524D\u6807\u9898\uFF1B\u8DEF\u5F84\u6765\u81EA\u4F1A\u8BDD\u8BB0\u5F55\uFF0C\u5408\u5E76\u53EA\u5F71\u54CD\u5C55\u793A\uFF0C\u4E0D\u6539\u8D26\u672C\u539F\u59CB\u8BB0\u5F55\u3002"
|
|
3402
|
+
],
|
|
3403
|
+
setPanelInfo
|
|
3404
|
+
)
|
|
2497
3405
|
),
|
|
2498
|
-
(0,
|
|
3406
|
+
(0, import_react8.createElement)(WorkspaceTable, {
|
|
2499
3407
|
facets: data?.byWorkspace ?? [],
|
|
2500
3408
|
currency,
|
|
2501
3409
|
onFilterPath: (path) => {
|
|
@@ -2511,7 +3419,7 @@ function heatCoverageNotes(range, ledgerFirstDay) {
|
|
|
2511
3419
|
const capped = ledgerFirstDay !== "" && range.coverageStart !== "" && ledgerFirstDay < range.coverageStart;
|
|
2512
3420
|
if (range.coverageStart === "" || range.drawnStart > range.start) {
|
|
2513
3421
|
notes.push(
|
|
2514
|
-
(0,
|
|
3422
|
+
(0, import_react8.createElement)(
|
|
2515
3423
|
"div",
|
|
2516
3424
|
{ key: "left", className: "dsh-tu-heat-note" },
|
|
2517
3425
|
capped ? `\u5DF2\u8FBE\u8BFB\u53D6\u4E0A\u9650\uFF08\u6700\u591A ${String(API_LIMITS.maxDays)} \u5929\uFF09\uFF0C${range.coverageStart} \u4E4B\u524D\u7684\u683C\u5B50\u672A\u53D6\u5230\uFF1B\u66F4\u65E9\u7684\u6570\u636E\u9700\u8981\u63D0\u9AD8\u4E0A\u9650` : `\u8D26\u672C\u81EA ${ledgerFirstDay || "\u2014"} \u8D77\uFF0C\u66F4\u65E9\u7684\u65E5\u671F\u6CA1\u6709\u8BB0\u5F55\uFF1B\u5DE6\u4FA7\u88AB\u9690\u85CF\u7684\u683C\u5B50\u8868\u793A\u300C\u672A\u53D6\u5230\u300D\uFF0C\u4E0D\u662F\u300C\u5F53\u5929\u96F6\u6D88\u8017\u300D`
|
|
@@ -2520,7 +3428,7 @@ function heatCoverageNotes(range, ledgerFirstDay) {
|
|
|
2520
3428
|
}
|
|
2521
3429
|
if (range.coverageEnd !== "" && range.drawnEnd < range.end) {
|
|
2522
3430
|
notes.push(
|
|
2523
|
-
(0,
|
|
3431
|
+
(0, import_react8.createElement)(
|
|
2524
3432
|
"div",
|
|
2525
3433
|
{ key: "right", className: "dsh-tu-heat-note" },
|
|
2526
3434
|
`\u5DF2\u53D6\u5230 ${range.coverageEnd}\uFF1B\u4E4B\u540E\u7684\u683C\u5B50\u5C1A\u672A\u53D6\u5230\uFF08\u70B9\u300C\u5237\u65B0\u300D\u91CD\u65B0\u8BFB\u53D6\uFF09`
|
|
@@ -2566,30 +3474,30 @@ function heatStats(points, currency) {
|
|
|
2566
3474
|
foot: `\u6700\u957F ${String(streak.longest)} \u5929`
|
|
2567
3475
|
}
|
|
2568
3476
|
];
|
|
2569
|
-
return (0,
|
|
3477
|
+
return (0, import_react8.createElement)(
|
|
2570
3478
|
"div",
|
|
2571
3479
|
{ className: "dsh-tu-heat-stats" },
|
|
2572
3480
|
...stats.map(
|
|
2573
|
-
(stat) => (0,
|
|
3481
|
+
(stat) => (0, import_react8.createElement)(
|
|
2574
3482
|
"div",
|
|
2575
3483
|
{ key: stat.label, className: "dsh-tu-heat-stat" },
|
|
2576
|
-
(0,
|
|
2577
|
-
(0,
|
|
2578
|
-
stat.foot.length === 0 ? null : (0,
|
|
3484
|
+
(0, import_react8.createElement)("div", { className: "dsh-tu-heat-stat-label" }, stat.label),
|
|
3485
|
+
(0, import_react8.createElement)("div", { className: "dsh-tu-heat-stat-value" }, stat.value),
|
|
3486
|
+
stat.foot.length === 0 ? null : (0, import_react8.createElement)("div", { className: "dsh-tu-heat-stat-foot" }, stat.foot)
|
|
2579
3487
|
)
|
|
2580
3488
|
)
|
|
2581
3489
|
);
|
|
2582
3490
|
}
|
|
2583
3491
|
function createToolPanel(panel, busy, onCancel, onConfirmImport, onConfirmBackfill) {
|
|
2584
|
-
const actions = (confirmLabel, onConfirm) => (0,
|
|
3492
|
+
const actions = (confirmLabel, onConfirm) => (0, import_react8.createElement)(
|
|
2585
3493
|
"div",
|
|
2586
3494
|
{ className: "dsh-tu-tool-actions" },
|
|
2587
|
-
(0,
|
|
3495
|
+
(0, import_react8.createElement)(
|
|
2588
3496
|
"button",
|
|
2589
3497
|
{ type: "button", className: "dsh-tu-btn", onClick: onCancel, disabled: busy },
|
|
2590
3498
|
"\u53D6\u6D88"
|
|
2591
3499
|
),
|
|
2592
|
-
(0,
|
|
3500
|
+
(0, import_react8.createElement)(
|
|
2593
3501
|
"button",
|
|
2594
3502
|
{
|
|
2595
3503
|
type: "button",
|
|
@@ -2604,12 +3512,12 @@ function createToolPanel(panel, busy, onCancel, onConfirmImport, onConfirmBackfi
|
|
|
2604
3512
|
)
|
|
2605
3513
|
);
|
|
2606
3514
|
if (panel.kind === "import") {
|
|
2607
|
-
return (0,
|
|
3515
|
+
return (0, import_react8.createElement)(
|
|
2608
3516
|
"div",
|
|
2609
3517
|
{ className: "dsh-tu-tool-panel", "data-tool-panel": "import" },
|
|
2610
|
-
(0,
|
|
2611
|
-
(0,
|
|
2612
|
-
(0,
|
|
3518
|
+
(0, import_react8.createElement)("h2", { className: "dsh-tu-tool-title" }, "\u5BFC\u5165\u5907\u4EFD"),
|
|
3519
|
+
(0, import_react8.createElement)("p", null, `\u6587\u4EF6\uFF1A${panel.fileName}`),
|
|
3520
|
+
(0, import_react8.createElement)(
|
|
2613
3521
|
"p",
|
|
2614
3522
|
null,
|
|
2615
3523
|
`\u5171 ${String(panel.backup.recordCount)} \u6761\u8BB0\u5F55\uFF1B\u5BFC\u5165\u53EA\u8FFD\u52A0\u7F3A\u5931\u8BB0\u5F55\uFF0C\u5DF2\u5B58\u5728/\u91CD\u590D\u4F1A\u81EA\u52A8\u8DF3\u8FC7\u3002\u5907\u4EFD\u6587\u4EF6\u5305\u542B\u4F1A\u8BDD ID\u3001\u5DE5\u4F5C\u533A\u8DEF\u5F84\u7B49\u660E\u7EC6\uFF0C\u8BF7\u59A5\u5584\u4FDD\u7BA1\u3002`
|
|
@@ -2618,30 +3526,37 @@ function createToolPanel(panel, busy, onCancel, onConfirmImport, onConfirmBackfi
|
|
|
2618
3526
|
);
|
|
2619
3527
|
}
|
|
2620
3528
|
const report = panel.preview.report;
|
|
2621
|
-
return (0,
|
|
3529
|
+
return (0, import_react8.createElement)(
|
|
2622
3530
|
"div",
|
|
2623
3531
|
{ className: "dsh-tu-tool-panel", "data-tool-panel": "backfill" },
|
|
2624
|
-
(0,
|
|
2625
|
-
(0,
|
|
3532
|
+
(0, import_react8.createElement)("h2", { className: "dsh-tu-tool-title" }, "\u8865\u5F55\u6570\u636E"),
|
|
3533
|
+
(0, import_react8.createElement)(
|
|
2626
3534
|
"p",
|
|
2627
3535
|
null,
|
|
2628
|
-
`\u626B\u63CF\u4F1A\u8BDD\u65E5\u5FD7 ${String(report.logsScanned)} \u4E2A\uFF1A\u53EF\u8865\u5F55 ${String(report.turnsBackfillable)} \u6761\uFF1B\u5DF2\u5B58\u5728 ${String(report.turnsAlreadyRecorded)} \u6761\uFF0C\u5206\u53C9\u526F\u672C ${String(report.turnsInheritedCopy)} \u6761\uFF0C\u65E0\u6CD5\u5224\u5B9A ${String(report.turnsUndecidable)} \u6761\u3002`
|
|
3536
|
+
`\u626B\u63CF\u4F1A\u8BDD\u65E5\u5FD7 ${String(report.logsScanned)} \u4E2A\uFF1A\u53EF\u8865\u5F55 ${String(report.turnsBackfillable)} \u6761\uFF0C\u53EF\u8865\u5168\u5386\u53F2\u5B57\u6BB5 ${String(report.turnsEnrichable ?? 0)} \u6761\uFF1B\u5DF2\u5B58\u5728 ${String(report.turnsAlreadyRecorded)} \u6761\uFF0C\u5206\u53C9\u526F\u672C ${String(report.turnsInheritedCopy)} \u6761\uFF0C\u65E0\u6CD5\u5224\u5B9A ${String(report.turnsUndecidable)} \u6761\u3002`
|
|
2629
3537
|
),
|
|
2630
|
-
(0,
|
|
3538
|
+
(0, import_react8.createElement)(
|
|
2631
3539
|
"p",
|
|
2632
3540
|
null,
|
|
2633
|
-
"\u8865\u5F55\u53EA\u8FFD\u52A0\u7F3A\u5931\u8BB0\u5F55\
|
|
3541
|
+
"\u8865\u5F55\u53EA\u8FFD\u52A0\u7F3A\u5931\u8BB0\u5F55\uFF1B\u5BF9\u5DF2\u6709\u8BB0\u5F55\u53EA\u8865 step/\u65F6\u95F4/\u5DE5\u5177\u7B49\u65B0\u5B57\u6BB5\uFF0C\u7EDD\u4E0D\u6539 token\u3001\u8D39\u7528\u3001\u5DE5\u4F5C\u533A\u4E0E\u4F1A\u8BDD\u8EAB\u4EFD\u3002\u53EF\u91CD\u590D\u6267\u884C\uFF0C\u4E0D\u4F1A\u91CD\u590D\u8BA1\u6570\u3002"
|
|
2634
3542
|
),
|
|
2635
3543
|
actions("\u786E\u8BA4\u8865\u5F55", onConfirmBackfill)
|
|
2636
3544
|
);
|
|
2637
3545
|
}
|
|
3546
|
+
function backupFilename() {
|
|
3547
|
+
return `token-usage-backup-${formatBackupTimestamp()}.json`;
|
|
3548
|
+
}
|
|
3549
|
+
function backupBlob(backup) {
|
|
3550
|
+
return new Blob([JSON.stringify(backup, null, 2)], { type: "application/json" });
|
|
3551
|
+
}
|
|
3552
|
+
function isAbortError(error) {
|
|
3553
|
+
return typeof error === "object" && error !== null && error.name === "AbortError";
|
|
3554
|
+
}
|
|
2638
3555
|
function downloadBackup(backup) {
|
|
2639
|
-
const
|
|
2640
|
-
const url = URL.createObjectURL(blob);
|
|
3556
|
+
const url = URL.createObjectURL(backupBlob(backup));
|
|
2641
3557
|
const anchor = document.createElement("a");
|
|
2642
|
-
const stamp = formatBackupTimestamp();
|
|
2643
3558
|
anchor.href = url;
|
|
2644
|
-
anchor.download =
|
|
3559
|
+
anchor.download = backupFilename();
|
|
2645
3560
|
anchor.style.display = "none";
|
|
2646
3561
|
document.body.appendChild(anchor);
|
|
2647
3562
|
anchor.click();
|
|
@@ -2651,10 +3566,10 @@ function downloadBackup(backup) {
|
|
|
2651
3566
|
}, 1e3);
|
|
2652
3567
|
}
|
|
2653
3568
|
function exportGlyph() {
|
|
2654
|
-
return (0,
|
|
3569
|
+
return (0, import_react8.createElement)(
|
|
2655
3570
|
"svg",
|
|
2656
3571
|
{ width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false" },
|
|
2657
|
-
(0,
|
|
3572
|
+
(0, import_react8.createElement)("path", {
|
|
2658
3573
|
d: "M8 2.6 L8 9.4 M5.2 6.6 L8 9.4 L10.8 6.6",
|
|
2659
3574
|
fill: "none",
|
|
2660
3575
|
stroke: "currentColor",
|
|
@@ -2662,7 +3577,7 @@ function exportGlyph() {
|
|
|
2662
3577
|
strokeLinecap: "round",
|
|
2663
3578
|
strokeLinejoin: "round"
|
|
2664
3579
|
}),
|
|
2665
|
-
(0,
|
|
3580
|
+
(0, import_react8.createElement)("path", {
|
|
2666
3581
|
d: "M2.8 10.6 L2.8 13.2 L13.2 13.2 L13.2 10.6",
|
|
2667
3582
|
fill: "none",
|
|
2668
3583
|
stroke: "currentColor",
|
|
@@ -2673,10 +3588,10 @@ function exportGlyph() {
|
|
|
2673
3588
|
);
|
|
2674
3589
|
}
|
|
2675
3590
|
function importGlyph() {
|
|
2676
|
-
return (0,
|
|
3591
|
+
return (0, import_react8.createElement)(
|
|
2677
3592
|
"svg",
|
|
2678
3593
|
{ width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false" },
|
|
2679
|
-
(0,
|
|
3594
|
+
(0, import_react8.createElement)("path", {
|
|
2680
3595
|
d: "M8 9.4 L8 2.6 M5.2 5.4 L8 2.6 L10.8 5.4",
|
|
2681
3596
|
fill: "none",
|
|
2682
3597
|
stroke: "currentColor",
|
|
@@ -2684,7 +3599,7 @@ function importGlyph() {
|
|
|
2684
3599
|
strokeLinecap: "round",
|
|
2685
3600
|
strokeLinejoin: "round"
|
|
2686
3601
|
}),
|
|
2687
|
-
(0,
|
|
3602
|
+
(0, import_react8.createElement)("path", {
|
|
2688
3603
|
d: "M2.8 10.6 L2.8 13.2 L13.2 13.2 L13.2 10.6",
|
|
2689
3604
|
fill: "none",
|
|
2690
3605
|
stroke: "currentColor",
|
|
@@ -2695,10 +3610,10 @@ function importGlyph() {
|
|
|
2695
3610
|
);
|
|
2696
3611
|
}
|
|
2697
3612
|
function backfillGlyph() {
|
|
2698
|
-
return (0,
|
|
3613
|
+
return (0, import_react8.createElement)(
|
|
2699
3614
|
"svg",
|
|
2700
3615
|
{ width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false" },
|
|
2701
|
-
(0,
|
|
3616
|
+
(0, import_react8.createElement)("ellipse", {
|
|
2702
3617
|
cx: 7,
|
|
2703
3618
|
cy: 4,
|
|
2704
3619
|
rx: 4.3,
|
|
@@ -2707,21 +3622,21 @@ function backfillGlyph() {
|
|
|
2707
3622
|
stroke: "currentColor",
|
|
2708
3623
|
strokeWidth: 1.5
|
|
2709
3624
|
}),
|
|
2710
|
-
(0,
|
|
3625
|
+
(0, import_react8.createElement)("path", {
|
|
2711
3626
|
d: "M2.7 4 L2.7 10.2 C2.7 11.8 4.6 12.8 7 12.8 C8.1 12.8 9.1 12.6 9.9 12.2",
|
|
2712
3627
|
fill: "none",
|
|
2713
3628
|
stroke: "currentColor",
|
|
2714
3629
|
strokeWidth: 1.5,
|
|
2715
3630
|
strokeLinecap: "round"
|
|
2716
3631
|
}),
|
|
2717
|
-
(0,
|
|
3632
|
+
(0, import_react8.createElement)("path", {
|
|
2718
3633
|
d: "M2.7 7.1 C2.7 8.8 4.6 9.8 7 9.8",
|
|
2719
3634
|
fill: "none",
|
|
2720
3635
|
stroke: "currentColor",
|
|
2721
3636
|
strokeWidth: 1.5,
|
|
2722
3637
|
strokeLinecap: "round"
|
|
2723
3638
|
}),
|
|
2724
|
-
(0,
|
|
3639
|
+
(0, import_react8.createElement)("path", {
|
|
2725
3640
|
d: "M12.8 9.4 L12.8 13.4 M10.8 11.4 L14.8 11.4",
|
|
2726
3641
|
fill: "none",
|
|
2727
3642
|
stroke: "currentColor",
|
|
@@ -2731,23 +3646,23 @@ function backfillGlyph() {
|
|
|
2731
3646
|
);
|
|
2732
3647
|
}
|
|
2733
3648
|
function refreshGlyph() {
|
|
2734
|
-
return (0,
|
|
3649
|
+
return (0, import_react8.createElement)(
|
|
2735
3650
|
"svg",
|
|
2736
3651
|
{ width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false" },
|
|
2737
3652
|
// The arrow head sits above the arc, so the ink box is ~0.7px above the
|
|
2738
3653
|
// viewBox centre: shifting the group keeps the spin centred on the glyph
|
|
2739
3654
|
// instead of wobbling around (8, 8).
|
|
2740
|
-
(0,
|
|
3655
|
+
(0, import_react8.createElement)(
|
|
2741
3656
|
"g",
|
|
2742
3657
|
{ transform: "translate(0 0.7)" },
|
|
2743
|
-
(0,
|
|
3658
|
+
(0, import_react8.createElement)("path", {
|
|
2744
3659
|
d: "M13.2 8a5.2 5.2 0 1 1-1.9-4",
|
|
2745
3660
|
fill: "none",
|
|
2746
3661
|
stroke: "currentColor",
|
|
2747
3662
|
strokeWidth: 1.5,
|
|
2748
3663
|
strokeLinecap: "round"
|
|
2749
3664
|
}),
|
|
2750
|
-
(0,
|
|
3665
|
+
(0, import_react8.createElement)("path", {
|
|
2751
3666
|
d: "M11.6 1.4 L11.6 4.4 L8.6 4.4",
|
|
2752
3667
|
fill: "none",
|
|
2753
3668
|
stroke: "currentColor",
|
|
@@ -2759,10 +3674,10 @@ function refreshGlyph() {
|
|
|
2759
3674
|
);
|
|
2760
3675
|
}
|
|
2761
3676
|
function closeGlyph() {
|
|
2762
|
-
return (0,
|
|
3677
|
+
return (0, import_react8.createElement)(
|
|
2763
3678
|
"svg",
|
|
2764
3679
|
{ width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false" },
|
|
2765
|
-
(0,
|
|
3680
|
+
(0, import_react8.createElement)("path", {
|
|
2766
3681
|
d: "M4 4 L12 12 M12 4 L4 12",
|
|
2767
3682
|
stroke: "currentColor",
|
|
2768
3683
|
strokeWidth: 1.6,
|
|
@@ -2771,10 +3686,10 @@ function closeGlyph() {
|
|
|
2771
3686
|
);
|
|
2772
3687
|
}
|
|
2773
3688
|
function infoGlyph() {
|
|
2774
|
-
return (0,
|
|
3689
|
+
return (0, import_react8.createElement)(
|
|
2775
3690
|
"svg",
|
|
2776
3691
|
{ width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false" },
|
|
2777
|
-
(0,
|
|
3692
|
+
(0, import_react8.createElement)("circle", {
|
|
2778
3693
|
cx: 8,
|
|
2779
3694
|
cy: 8,
|
|
2780
3695
|
r: 6.6,
|
|
@@ -2782,8 +3697,8 @@ function infoGlyph() {
|
|
|
2782
3697
|
stroke: "currentColor",
|
|
2783
3698
|
strokeWidth: 1.4
|
|
2784
3699
|
}),
|
|
2785
|
-
(0,
|
|
2786
|
-
(0,
|
|
3700
|
+
(0, import_react8.createElement)("circle", { cx: 8, cy: 4.9, r: 0.95, fill: "currentColor" }),
|
|
3701
|
+
(0, import_react8.createElement)("path", {
|
|
2787
3702
|
d: "M8 7.1 V11.4",
|
|
2788
3703
|
stroke: "currentColor",
|
|
2789
3704
|
strokeWidth: 1.5,
|
|
@@ -2792,10 +3707,10 @@ function infoGlyph() {
|
|
|
2792
3707
|
);
|
|
2793
3708
|
}
|
|
2794
3709
|
function createPanelInfoButton(id, title, open, paragraphs, onToggle) {
|
|
2795
|
-
return (0,
|
|
3710
|
+
return (0, import_react8.createElement)(
|
|
2796
3711
|
"div",
|
|
2797
3712
|
{ className: "dsh-tu-anchor dsh-tu-panel-info" },
|
|
2798
|
-
(0,
|
|
3713
|
+
(0, import_react8.createElement)(
|
|
2799
3714
|
"button",
|
|
2800
3715
|
{
|
|
2801
3716
|
type: "button",
|
|
@@ -2811,7 +3726,7 @@ function createPanelInfoButton(id, title, open, paragraphs, onToggle) {
|
|
|
2811
3726
|
},
|
|
2812
3727
|
infoGlyph()
|
|
2813
3728
|
),
|
|
2814
|
-
open ? (0,
|
|
3729
|
+
open ? (0, import_react8.createElement)(
|
|
2815
3730
|
"div",
|
|
2816
3731
|
{
|
|
2817
3732
|
id: `dsh-tu-info-${id}`,
|
|
@@ -2819,15 +3734,15 @@ function createPanelInfoButton(id, title, open, paragraphs, onToggle) {
|
|
|
2819
3734
|
role: "dialog",
|
|
2820
3735
|
"aria-label": title
|
|
2821
3736
|
},
|
|
2822
|
-
(0,
|
|
2823
|
-
...paragraphs.map((paragraph) => (0,
|
|
3737
|
+
(0, import_react8.createElement)("h4", null, title),
|
|
3738
|
+
...paragraphs.map((paragraph) => (0, import_react8.createElement)("p", { key: paragraph }, paragraph))
|
|
2824
3739
|
) : null
|
|
2825
3740
|
);
|
|
2826
3741
|
}
|
|
2827
3742
|
function createPricingInfoButton(data, state) {
|
|
2828
3743
|
const pricing = data?.pricing;
|
|
2829
3744
|
const { open, pinned, setHover, setPinned } = state;
|
|
2830
|
-
return (0,
|
|
3745
|
+
return (0, import_react8.createElement)(
|
|
2831
3746
|
"div",
|
|
2832
3747
|
{
|
|
2833
3748
|
className: "dsh-tu-anchor",
|
|
@@ -2838,7 +3753,7 @@ function createPricingInfoButton(data, state) {
|
|
|
2838
3753
|
setHover(false);
|
|
2839
3754
|
}
|
|
2840
3755
|
},
|
|
2841
|
-
(0,
|
|
3756
|
+
(0, import_react8.createElement)(
|
|
2842
3757
|
"button",
|
|
2843
3758
|
{
|
|
2844
3759
|
type: "button",
|
|
@@ -2853,10 +3768,10 @@ function createPricingInfoButton(data, state) {
|
|
|
2853
3768
|
setPinned(!pinned);
|
|
2854
3769
|
}
|
|
2855
3770
|
},
|
|
2856
|
-
(0,
|
|
3771
|
+
(0, import_react8.createElement)(
|
|
2857
3772
|
"svg",
|
|
2858
3773
|
{ width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false" },
|
|
2859
|
-
(0,
|
|
3774
|
+
(0, import_react8.createElement)("circle", {
|
|
2860
3775
|
cx: 8,
|
|
2861
3776
|
cy: 8,
|
|
2862
3777
|
r: 6.6,
|
|
@@ -2864,8 +3779,8 @@ function createPricingInfoButton(data, state) {
|
|
|
2864
3779
|
stroke: "currentColor",
|
|
2865
3780
|
strokeWidth: 1.4
|
|
2866
3781
|
}),
|
|
2867
|
-
(0,
|
|
2868
|
-
(0,
|
|
3782
|
+
(0, import_react8.createElement)("circle", { cx: 8, cy: 4.9, r: 0.95, fill: "currentColor" }),
|
|
3783
|
+
(0, import_react8.createElement)("path", {
|
|
2869
3784
|
d: "M8 7.1 V11.4",
|
|
2870
3785
|
stroke: "currentColor",
|
|
2871
3786
|
strokeWidth: 1.5,
|
|
@@ -2873,11 +3788,11 @@ function createPricingInfoButton(data, state) {
|
|
|
2873
3788
|
})
|
|
2874
3789
|
)
|
|
2875
3790
|
),
|
|
2876
|
-
open ? (0,
|
|
3791
|
+
open ? (0, import_react8.createElement)(
|
|
2877
3792
|
"div",
|
|
2878
3793
|
{ className: "dsh-tu-popover", role: "note" },
|
|
2879
|
-
(0,
|
|
2880
|
-
(0,
|
|
3794
|
+
(0, import_react8.createElement)("h4", null, "\u8D39\u7528\u662F\u600E\u4E48\u7B97\u51FA\u6765\u7684"),
|
|
3795
|
+
(0, import_react8.createElement)(
|
|
2881
3796
|
"div",
|
|
2882
3797
|
null,
|
|
2883
3798
|
"\u91D1\u989D = ( \u7F13\u5B58\u672A\u547D\u4E2D \xD7 \u672A\u547D\u4E2D\u4EF7 + \u7F13\u5B58\u547D\u4E2D \xD7 \u547D\u4E2D\u4EF7 + \u7F13\u5B58\u5199\u5165 \xD7 \u672A\u547D\u4E2D\u4EF7 + \u8F93\u51FA \xD7 \u8F93\u51FA\u4EF7 ) \xF7 1e6 \xD7 \u65F6\u6BB5\u500D\u7387"
|
|
@@ -2885,31 +3800,32 @@ function createPricingInfoButton(data, state) {
|
|
|
2885
3800
|
// The formula alone is not checkable: show the prices it multiplies,
|
|
2886
3801
|
// and the date they were read off the official page.
|
|
2887
3802
|
createPriceTable(pricing),
|
|
2888
|
-
(0,
|
|
3803
|
+
(0, import_react8.createElement)(
|
|
2889
3804
|
"dl",
|
|
2890
3805
|
null,
|
|
2891
|
-
(0,
|
|
2892
|
-
(0,
|
|
2893
|
-
(0,
|
|
2894
|
-
(0,
|
|
2895
|
-
(0,
|
|
2896
|
-
(0,
|
|
3806
|
+
(0, import_react8.createElement)("dt", null, "\u4EF7\u76EE\u7248\u672C"),
|
|
3807
|
+
(0, import_react8.createElement)("dd", null, `${pricing?.label ?? "\u2014"}\uFF08${pricing?.version ?? "\u2014"}\uFF09`),
|
|
3808
|
+
(0, import_react8.createElement)("dt", null, "DeepSeek \u65F6\u6BB5\u89C4\u5219"),
|
|
3809
|
+
(0, import_react8.createElement)("dd", null, pricing?.peakRule ?? "\u2014"),
|
|
3810
|
+
(0, import_react8.createElement)("dt", null, "DeepSeek \u5B98\u65B9\u5B9A\u4EF7\u9875"),
|
|
3811
|
+
(0, import_react8.createElement)(
|
|
2897
3812
|
"dd",
|
|
2898
3813
|
null,
|
|
2899
|
-
(0,
|
|
3814
|
+
(0, import_react8.createElement)("code", null, pricing?.source ?? "\u2014"),
|
|
3815
|
+
"\uFF08DeepSeek \u5B98\u65B9\uFF0C\u4E0D\u662F\u672C\u63D2\u4EF6\u5B98\u7F51\uFF09"
|
|
2900
3816
|
),
|
|
2901
|
-
(0,
|
|
2902
|
-
(0,
|
|
3817
|
+
(0, import_react8.createElement)("dt", null, "\u67E5\u8BE2\u65E5\u671F"),
|
|
3818
|
+
(0, import_react8.createElement)("dd", null, pricing?.checkedAt ?? "\u2014")
|
|
2903
3819
|
),
|
|
2904
|
-
(0,
|
|
3820
|
+
(0, import_react8.createElement)(
|
|
2905
3821
|
"div",
|
|
2906
3822
|
{ className: "dsh-tu-subtle" },
|
|
2907
3823
|
"\xB7 \u7F13\u5B58\u5199\u5165\u6309\u300C\u7F13\u5B58\u672A\u547D\u4E2D\u300D\u8BA1\u4EF7\uFF1A\u5B98\u65B9\u672A\u5355\u72EC\u516C\u5E03\u5199\u5165\u4EF7\uFF1B",
|
|
2908
|
-
(0,
|
|
3824
|
+
(0, import_react8.createElement)("br", null),
|
|
2909
3825
|
"\xB7 \u63A8\u7406 token \u5DF2\u5305\u542B\u5728\u8F93\u51FA token \u5185\uFF0C\u4E0D\u91CD\u590D\u8BA1\u4EF7\uFF1B",
|
|
2910
|
-
(0,
|
|
3826
|
+
(0, import_react8.createElement)("br", null),
|
|
2911
3827
|
"\xB7 \u6BCF\u8F6E\u6309\u5176\u5404\u81EA\u7684\u7ED3\u7B97\u65F6\u523B\u5224\u5B9A\u65F6\u6BB5\u4E0E\u4EF7\u76EE\u884C\uFF1B",
|
|
2912
|
-
(0,
|
|
3828
|
+
(0, import_react8.createElement)("br", null),
|
|
2913
3829
|
"\xB7 \u8D39\u7528\u5728\u5199\u5165\u8D26\u672C\u65F6\u51BB\u7ED3\uFF0C\u4E4B\u540E\u8C03\u4EF7\u6216\u6539\u5E01\u79CD\u90FD\u4E0D\u4F1A\u6539\u5199\u5386\u53F2\uFF08\u53EF\u7528 scripts/recompute-cost.mjs \u663E\u5F0F\u91CD\u7B97\uFF09\u3002"
|
|
2914
3830
|
)
|
|
2915
3831
|
) : null
|
|
@@ -2917,7 +3833,7 @@ function createPricingInfoButton(data, state) {
|
|
|
2917
3833
|
}
|
|
2918
3834
|
function createPriceTable(pricing) {
|
|
2919
3835
|
if (pricing === void 0 || pricing.rows.length === 0) {
|
|
2920
|
-
return (0,
|
|
3836
|
+
return (0, import_react8.createElement)("div", { className: "dsh-tu-subtle" }, "\u4EF7\u76EE\u8868\u52A0\u8F7D\u4E2D\u2026");
|
|
2921
3837
|
}
|
|
2922
3838
|
const symbol = pricing.currency === "CNY" ? "\xA5" : "$";
|
|
2923
3839
|
const per = `${symbol} / \u767E\u4E07 token`;
|
|
@@ -2934,84 +3850,89 @@ function createPriceTable(pricing) {
|
|
|
2934
3850
|
const modelChildren = [row.model];
|
|
2935
3851
|
if (showDate) {
|
|
2936
3852
|
modelChildren.push(
|
|
2937
|
-
(0,
|
|
3853
|
+
(0, import_react8.createElement)(
|
|
2938
3854
|
"div",
|
|
2939
3855
|
{ key: "date", className: "dsh-tu-subtle" },
|
|
2940
3856
|
`\u751F\u6548 ${formatEffective(row.effectiveFrom)}`
|
|
2941
3857
|
)
|
|
2942
3858
|
);
|
|
2943
3859
|
}
|
|
2944
|
-
const modelCell = (0,
|
|
3860
|
+
const modelCell = (0, import_react8.createElement)("td", { rowSpan: hasPeak ? 2 : 1 }, ...modelChildren);
|
|
2945
3861
|
const priceCells = (values) => values.map(
|
|
2946
|
-
(value, index) => (0,
|
|
3862
|
+
(value, index) => (0, import_react8.createElement)("td", { key: `v${String(index)}` }, formatUnitPrice(value))
|
|
2947
3863
|
);
|
|
2948
3864
|
if (hasPeak) {
|
|
2949
3865
|
body.push(
|
|
2950
|
-
(0,
|
|
3866
|
+
(0, import_react8.createElement)(
|
|
2951
3867
|
"tr",
|
|
2952
|
-
{ key: `${row.model}-${row.effectiveFrom}-
|
|
3868
|
+
{ key: `${row.model}-${row.effectiveFrom}-off` },
|
|
2953
3869
|
modelCell,
|
|
2954
|
-
(0,
|
|
2955
|
-
...priceCells([row.cacheHit, row.cacheMiss, row.output])
|
|
3870
|
+
(0, import_react8.createElement)("td", { className: "dsh-tu-price-window" }, "\u7A7A\u95F2"),
|
|
3871
|
+
...priceCells([row.cacheHit * ratio, row.cacheMiss * ratio, row.output * ratio])
|
|
2956
3872
|
),
|
|
2957
|
-
(0,
|
|
3873
|
+
(0, import_react8.createElement)(
|
|
2958
3874
|
"tr",
|
|
2959
|
-
{ key: `${row.model}-${row.effectiveFrom}-
|
|
2960
|
-
(0,
|
|
2961
|
-
...priceCells([row.cacheHit
|
|
3875
|
+
{ key: `${row.model}-${row.effectiveFrom}-peak` },
|
|
3876
|
+
(0, import_react8.createElement)("td", { className: "dsh-tu-price-window" }, "\u9AD8\u5CF0"),
|
|
3877
|
+
...priceCells([row.cacheHit, row.cacheMiss, row.output])
|
|
2962
3878
|
)
|
|
2963
3879
|
);
|
|
2964
3880
|
} else {
|
|
2965
3881
|
const windowLabel = allOffPeak ? "\u7A7A\u95F2" : "\u6807\u51C6";
|
|
2966
3882
|
const values = allOffPeak ? [row.cacheHit * ratio, row.cacheMiss * ratio, row.output * ratio] : [row.cacheHit, row.cacheMiss, row.output];
|
|
2967
3883
|
body.push(
|
|
2968
|
-
(0,
|
|
3884
|
+
(0, import_react8.createElement)(
|
|
2969
3885
|
"tr",
|
|
2970
3886
|
{ key: `${row.model}-${row.effectiveFrom}` },
|
|
2971
3887
|
modelCell,
|
|
2972
|
-
(0,
|
|
3888
|
+
(0, import_react8.createElement)("td", { className: "dsh-tu-price-window" }, windowLabel),
|
|
2973
3889
|
...priceCells(values)
|
|
2974
3890
|
)
|
|
2975
3891
|
);
|
|
2976
3892
|
}
|
|
2977
3893
|
}
|
|
2978
3894
|
const utcOffset = `UTC${pricing.timezoneOffsetMinutes >= 0 ? "+" : "-"}${String(Math.abs(pricing.timezoneOffsetMinutes) / 60)}`;
|
|
2979
|
-
const head = hasPeak ?
|
|
2980
|
-
const windowNote = hasPeak ? `\
|
|
2981
|
-
return (0,
|
|
3895
|
+
const head = hasPeak ? `DeepSeek \u5B98\u65B9\u4EF7\u76EE\uFF08${per}\uFF09` : allOffPeak ? `\u4EF7\u76EE\uFF08${per}\uFF1B\u5F53\u524D\u65E0\u9AD8\u5CF0\u65F6\u6BB5\uFF0C\u5168\u90E8\u6309\u7A7A\u95F2\u4EF7\u8BA1\u8D39\uFF09` : `DeepSeek \u5B98\u65B9\u4EF7\u76EE\uFF08${per}\uFF1B\u65E0\u5CF0\u8C37\u5DEE\u5F02\uFF09`;
|
|
3896
|
+
const windowNote = hasPeak ? `\u7A7A\u95F2 = \u9AD8\u5CF0 \xD7 ${String(ratio)}\uFF08\u6298\u7B97\u503C\uFF0C\u975E\u5B98\u65B9\u516C\u5E03\u4EF7\uFF09\uFF1B\u9AD8\u5CF0 = DeepSeek \u5B98\u65B9\u516C\u5E03\u4EF7\u3002\u9AD8\u5CF0\u65F6\u6BB5 ${pricing.peakWindows.join(" / ")}\uFF08${utcOffset}\uFF09\uFF0C\u5176\u4F59\u65F6\u6BB5\uFF08\u542B\u5468\u672B\uFF09\u6309\u7A7A\u95F2\u8BA1\u4EF7` : allOffPeak ? `\u5F53\u524D\u89C4\u5219\u6CA1\u6709\u9AD8\u5CF0\u65F6\u6BB5\uFF0C\u6240\u6709\u65F6\u6BB5\u6309 DeepSeek \u5B98\u65B9\u4EF7 \xD7 ${String(ratio)}\uFF08\u7A7A\u95F2\u500D\u7387\uFF09\u8BA1\u8D39` : `\u9AD8\u5CF0\u4E0E\u7A7A\u95F2\u540C\u4EF7\uFF08\u7A7A\u95F2\u500D\u7387 \xD7${String(ratio)}\uFF09`;
|
|
3897
|
+
return (0, import_react8.createElement)(
|
|
2982
3898
|
"div",
|
|
2983
3899
|
{ className: "dsh-tu-price" },
|
|
2984
|
-
(0,
|
|
2985
|
-
(0,
|
|
3900
|
+
(0, import_react8.createElement)("div", { className: "dsh-tu-price-head" }, head),
|
|
3901
|
+
(0, import_react8.createElement)(
|
|
3902
|
+
"div",
|
|
3903
|
+
{ className: "dsh-tu-subtle" },
|
|
3904
|
+
"\u9AD8\u5CF0/\u7A7A\u95F2\u65F6\u6BB5\u7EDF\u4E00\u6309 DeepSeek \u5B98\u65B9\u7684\u5317\u4EAC\u65F6\u95F4\u89C4\u5219\u5224\u5B9A\uFF0C\u4E0E\u63A5\u5165\u65B9\u65E0\u5173\uFF1B\u4E0D\u540C\u63A5\u5165\u65B9\u4E5F\u5957\u7528\u540C\u4E00\u65F6\u6BB5\u500D\u7387\u3002"
|
|
3905
|
+
),
|
|
3906
|
+
(0, import_react8.createElement)(
|
|
2986
3907
|
"table",
|
|
2987
3908
|
null,
|
|
2988
|
-
(0,
|
|
3909
|
+
(0, import_react8.createElement)(
|
|
2989
3910
|
"thead",
|
|
2990
3911
|
null,
|
|
2991
|
-
(0,
|
|
3912
|
+
(0, import_react8.createElement)(
|
|
2992
3913
|
"tr",
|
|
2993
3914
|
null,
|
|
2994
|
-
(0,
|
|
2995
|
-
(0,
|
|
2996
|
-
(0,
|
|
2997
|
-
(0,
|
|
2998
|
-
(0,
|
|
3915
|
+
(0, import_react8.createElement)("th", null, "\u6A21\u578B"),
|
|
3916
|
+
(0, import_react8.createElement)("th", { className: "dsh-tu-price-window" }, "\u65F6\u6BB5"),
|
|
3917
|
+
(0, import_react8.createElement)("th", null, "\u7F13\u5B58\u547D\u4E2D"),
|
|
3918
|
+
(0, import_react8.createElement)("th", null, "\u7F13\u5B58\u672A\u547D\u4E2D"),
|
|
3919
|
+
(0, import_react8.createElement)("th", null, "\u8F93\u51FA")
|
|
2999
3920
|
)
|
|
3000
3921
|
),
|
|
3001
|
-
(0,
|
|
3922
|
+
(0, import_react8.createElement)("tbody", null, ...body)
|
|
3002
3923
|
),
|
|
3003
3924
|
// What is NOT the official number must say so: a config override is priced
|
|
3004
3925
|
// from the deployment's own table, not from the page below.
|
|
3005
|
-
pricing.overriddenModels.length === 0 ? null : (0,
|
|
3926
|
+
pricing.overriddenModels.length === 0 ? null : (0, import_react8.createElement)(
|
|
3006
3927
|
"div",
|
|
3007
3928
|
{ className: "dsh-tu-subtle" },
|
|
3008
|
-
`\u672C\u5730\u914D\u7F6E\u8986\u76D6\u4E86 ${pricing.overriddenModels.join("\u3001")} \u7684\u4EF7\u683C\uFF0C\u4E0A\u9762\u8FD9\u51E0\u884C\u4ECD\u662F\u5B98\
|
|
3929
|
+
`\u672C\u5730\u914D\u7F6E\u8986\u76D6\u4E86 ${pricing.overriddenModels.join("\u3001")} \u7684\u4EF7\u683C\uFF0C\u4E0A\u9762\u8FD9\u51E0\u884C\u4ECD\u662F DeepSeek \u5B98\u65B9\u4EF7\uFF08\u7A7A\u95F2\u5217\u4E3A\u6309\u500D\u7387\u6298\u7B97\uFF09`
|
|
3009
3930
|
),
|
|
3010
|
-
(0,
|
|
3011
|
-
(0,
|
|
3931
|
+
(0, import_react8.createElement)("div", { className: "dsh-tu-subtle" }, windowNote),
|
|
3932
|
+
(0, import_react8.createElement)(
|
|
3012
3933
|
"div",
|
|
3013
3934
|
{ className: "dsh-tu-subtle" },
|
|
3014
|
-
`\u751F\u6548 ${formatEffective(pricing.rows[0]?.effectiveFrom ?? "")}\uFF1B\u4EE5\u4E0A\u4E3A ${pricing.checkedAt} \u67E5\u8BE2\u5230\u7684\u5B98\
|
|
3935
|
+
`\u751F\u6548 ${formatEffective(pricing.rows[0]?.effectiveFrom ?? "")}\uFF1B\u4EE5\u4E0A\u4E3A ${pricing.checkedAt} \u67E5\u8BE2\u5230\u7684 DeepSeek \u5B98\u65B9\u4EF7\u683C\uFF08\u7A7A\u95F2\u5217\u4E3A\u6298\u7B97\uFF09\u3002\u8868\u4E2D\u4EF7\u683C\u9ED8\u8BA4\u5957\u7528\u5230\u6240\u6709\u63A5\u5165\u65B9\uFF1B\u975E DeepSeek \u6A21\u578B\u82E5\u672A\u5728\u672C\u5730\u914D\u7F6E\u8986\u76D6\uFF0C\u4F1A\u6309 DeepSeek \u515C\u5E95\u4EF7\u4F30\u7B97\uFF0C\u5B9E\u9645\u8D26\u5355\u4EE5\u5BF9\u5E94\u670D\u52A1\u5546\u4E3A\u51C6`
|
|
3015
3936
|
)
|
|
3016
3937
|
);
|
|
3017
3938
|
}
|
|
@@ -3028,20 +3949,25 @@ function formatRateBound(rate) {
|
|
|
3028
3949
|
return `${Number.isInteger(percent) ? String(percent) : percent.toFixed(1)}%`;
|
|
3029
3950
|
}
|
|
3030
3951
|
function createSubpanel(title, ...children) {
|
|
3031
|
-
return (0,
|
|
3952
|
+
return (0, import_react8.createElement)(
|
|
3032
3953
|
"div",
|
|
3033
3954
|
{ className: "dsh-tu-subpanel" },
|
|
3034
|
-
(0,
|
|
3955
|
+
(0, import_react8.createElement)("h3", { className: "dsh-tu-subpanel-title" }, title),
|
|
3035
3956
|
...children
|
|
3036
3957
|
);
|
|
3037
3958
|
}
|
|
3038
3959
|
function createCard(label, value, foot, tone = "blue") {
|
|
3039
|
-
|
|
3960
|
+
const lines = typeof foot === "string" ? foot.length === 0 ? [] : [foot] : foot.slice(0, 2);
|
|
3961
|
+
return (0, import_react8.createElement)(
|
|
3040
3962
|
"div",
|
|
3041
3963
|
{ className: "dsh-tu-card", "data-tone": tone },
|
|
3042
|
-
(0,
|
|
3043
|
-
(0,
|
|
3044
|
-
|
|
3964
|
+
(0, import_react8.createElement)("div", { className: "dsh-tu-card-label" }, label),
|
|
3965
|
+
(0, import_react8.createElement)("div", { className: "dsh-tu-card-value" }, value),
|
|
3966
|
+
lines.length === 0 ? null : (0, import_react8.createElement)(
|
|
3967
|
+
"div",
|
|
3968
|
+
{ className: "dsh-tu-card-foot" },
|
|
3969
|
+
...lines.map((line, index) => (0, import_react8.createElement)("div", { key: `foot-${String(index)}` }, line))
|
|
3970
|
+
)
|
|
3045
3971
|
);
|
|
3046
3972
|
}
|
|
3047
3973
|
function platformLabel(platform) {
|
|
@@ -3050,40 +3976,32 @@ function platformLabel(platform) {
|
|
|
3050
3976
|
return "\u672A\u77E5\u5E73\u53F0";
|
|
3051
3977
|
}
|
|
3052
3978
|
function WorkspaceTable(props) {
|
|
3053
|
-
const [expanded, setExpanded] = (0,
|
|
3979
|
+
const [expanded, setExpanded] = (0, import_react8.useState)(null);
|
|
3054
3980
|
const { facets, currency, onFilterPath } = props;
|
|
3055
3981
|
if (facets.length === 0) {
|
|
3056
|
-
return (0,
|
|
3982
|
+
return (0, import_react8.createElement)("div", { className: "dsh-tu-empty" }, "\u6CA1\u6709\u6570\u636E");
|
|
3057
3983
|
}
|
|
3058
3984
|
const total = facets.reduce((sum, row) => sum + row.tokens, 0);
|
|
3059
|
-
|
|
3060
|
-
(facet) => (facet.mergedCount ?? (facet.paths?.length ?? 1)) > 1
|
|
3061
|
-
);
|
|
3062
|
-
return (0, import_react7.createElement)(
|
|
3985
|
+
return (0, import_react8.createElement)(
|
|
3063
3986
|
"div",
|
|
3064
3987
|
null,
|
|
3065
|
-
|
|
3066
|
-
"div",
|
|
3067
|
-
{ className: "dsh-tu-subtle dsh-tu-ws-note" },
|
|
3068
|
-
"\u540C\u540D\u5DE5\u4F5C\u533A\u5DF2\u6309\u540D\u79F0\u5408\u5E76\uFF1B\u70B9\u51FB\u884C\u5185\u300CN \u4E2A\u8DEF\u5F84\u300D\u53EF\u5C55\u5F00\u5404\u8DEF\u5F84\u5C0F\u8BA1\uFF0C\u5E76\u53EF\u53EA\u67E5\u770B\u67D0\u4E00\u6761\u8DEF\u5F84\u3002"
|
|
3069
|
-
) : null,
|
|
3070
|
-
(0, import_react7.createElement)(
|
|
3988
|
+
(0, import_react8.createElement)(
|
|
3071
3989
|
"table",
|
|
3072
3990
|
{ className: "dsh-tu-table" },
|
|
3073
|
-
(0,
|
|
3991
|
+
(0, import_react8.createElement)(
|
|
3074
3992
|
"thead",
|
|
3075
3993
|
null,
|
|
3076
|
-
(0,
|
|
3994
|
+
(0, import_react8.createElement)(
|
|
3077
3995
|
"tr",
|
|
3078
3996
|
null,
|
|
3079
|
-
(0,
|
|
3080
|
-
(0,
|
|
3081
|
-
(0,
|
|
3082
|
-
(0,
|
|
3083
|
-
(0,
|
|
3997
|
+
(0, import_react8.createElement)("th", null, "\u5DE5\u4F5C\u533A"),
|
|
3998
|
+
(0, import_react8.createElement)("th", null, "\u8F6E\u6B21"),
|
|
3999
|
+
(0, import_react8.createElement)("th", null, "Token"),
|
|
4000
|
+
(0, import_react8.createElement)("th", null, "\u5360\u6BD4"),
|
|
4001
|
+
(0, import_react8.createElement)("th", null, "\u8D39\u7528")
|
|
3084
4002
|
)
|
|
3085
4003
|
),
|
|
3086
|
-
(0,
|
|
4004
|
+
(0, import_react8.createElement)(
|
|
3087
4005
|
"tbody",
|
|
3088
4006
|
null,
|
|
3089
4007
|
...facets.flatMap((facet) => {
|
|
@@ -3092,15 +4010,15 @@ function WorkspaceTable(props) {
|
|
|
3092
4010
|
const share = total === 0 ? 0 : facet.tokens / total * 100;
|
|
3093
4011
|
const rowKey = facet.key.length === 0 ? "(unattributed)" : facet.key;
|
|
3094
4012
|
const rows = [
|
|
3095
|
-
(0,
|
|
4013
|
+
(0, import_react8.createElement)(
|
|
3096
4014
|
"tr",
|
|
3097
4015
|
{ key: rowKey },
|
|
3098
|
-
(0,
|
|
4016
|
+
(0, import_react8.createElement)(
|
|
3099
4017
|
"td",
|
|
3100
4018
|
{ title: facet.key },
|
|
3101
4019
|
facet.label,
|
|
3102
|
-
facet.key.length === 0 ? (0,
|
|
3103
|
-
merged > 1 ? (0,
|
|
4020
|
+
facet.key.length === 0 ? (0, import_react8.createElement)("span", { className: "dsh-tu-tag" }, "\u672A\u6807\u6CE8") : null,
|
|
4021
|
+
merged > 1 ? (0, import_react8.createElement)(
|
|
3104
4022
|
"button",
|
|
3105
4023
|
{
|
|
3106
4024
|
type: "button",
|
|
@@ -3117,43 +4035,43 @@ function WorkspaceTable(props) {
|
|
|
3117
4035
|
`${String(merged)} \u4E2A\u8DEF\u5F84`
|
|
3118
4036
|
) : null
|
|
3119
4037
|
),
|
|
3120
|
-
(0,
|
|
3121
|
-
(0,
|
|
3122
|
-
(0,
|
|
3123
|
-
(0,
|
|
4038
|
+
(0, import_react8.createElement)("td", null, formatTokensExact(facet.turns)),
|
|
4039
|
+
(0, import_react8.createElement)("td", null, formatTokensExact(facet.tokens)),
|
|
4040
|
+
(0, import_react8.createElement)("td", null, `${share.toFixed(1)}%`),
|
|
4041
|
+
(0, import_react8.createElement)("td", null, formatMoney(facet.cost, currency))
|
|
3124
4042
|
)
|
|
3125
4043
|
];
|
|
3126
4044
|
if (expanded === rowKey && paths.length > 0) {
|
|
3127
4045
|
rows.push(
|
|
3128
|
-
(0,
|
|
4046
|
+
(0, import_react8.createElement)(
|
|
3129
4047
|
"tr",
|
|
3130
4048
|
{ key: `${rowKey}-paths`, className: "dsh-tu-path-row" },
|
|
3131
|
-
(0,
|
|
4049
|
+
(0, import_react8.createElement)(
|
|
3132
4050
|
"td",
|
|
3133
4051
|
{ colSpan: 5 },
|
|
3134
|
-
(0,
|
|
4052
|
+
(0, import_react8.createElement)(
|
|
3135
4053
|
"div",
|
|
3136
4054
|
{ className: "dsh-tu-ws-paths" },
|
|
3137
4055
|
...paths.map(
|
|
3138
|
-
(path) => (0,
|
|
4056
|
+
(path) => (0, import_react8.createElement)(
|
|
3139
4057
|
"div",
|
|
3140
4058
|
{ key: path.workspace, className: "dsh-tu-ws-path" },
|
|
3141
|
-
(0,
|
|
4059
|
+
(0, import_react8.createElement)(
|
|
3142
4060
|
"span",
|
|
3143
4061
|
{ className: "dsh-tu-ws-platform" },
|
|
3144
4062
|
platformLabel(path.platform)
|
|
3145
4063
|
),
|
|
3146
|
-
(0,
|
|
4064
|
+
(0, import_react8.createElement)(
|
|
3147
4065
|
"code",
|
|
3148
4066
|
{ className: "dsh-tu-ws-raw", title: path.workspace },
|
|
3149
4067
|
path.workspace
|
|
3150
4068
|
),
|
|
3151
|
-
(0,
|
|
4069
|
+
(0, import_react8.createElement)(
|
|
3152
4070
|
"span",
|
|
3153
4071
|
{ className: "dsh-tu-ws-nums" },
|
|
3154
4072
|
`${formatTokensExact(path.turns)} \u8F6E \xB7 ${formatTokens(path.tokens)} token \xB7 ${formatMoney(path.cost, currency)}`
|
|
3155
4073
|
),
|
|
3156
|
-
(0,
|
|
4074
|
+
(0, import_react8.createElement)(
|
|
3157
4075
|
"button",
|
|
3158
4076
|
{
|
|
3159
4077
|
type: "button",
|
|
@@ -3179,63 +4097,63 @@ function WorkspaceTable(props) {
|
|
|
3179
4097
|
}
|
|
3180
4098
|
function facetTable(facets, currency, firstHeader) {
|
|
3181
4099
|
if (facets.length === 0) {
|
|
3182
|
-
return (0,
|
|
4100
|
+
return (0, import_react8.createElement)("div", { className: "dsh-tu-empty" }, "\u6CA1\u6709\u6570\u636E");
|
|
3183
4101
|
}
|
|
3184
|
-
return (0,
|
|
4102
|
+
return (0, import_react8.createElement)(
|
|
3185
4103
|
"table",
|
|
3186
4104
|
{ className: "dsh-tu-table" },
|
|
3187
|
-
(0,
|
|
4105
|
+
(0, import_react8.createElement)(
|
|
3188
4106
|
"thead",
|
|
3189
4107
|
null,
|
|
3190
|
-
(0,
|
|
4108
|
+
(0, import_react8.createElement)(
|
|
3191
4109
|
"tr",
|
|
3192
4110
|
null,
|
|
3193
|
-
(0,
|
|
3194
|
-
(0,
|
|
4111
|
+
(0, import_react8.createElement)("th", null, firstHeader),
|
|
4112
|
+
(0, import_react8.createElement)(
|
|
3195
4113
|
"th",
|
|
3196
4114
|
{
|
|
3197
4115
|
title: "dsh \u4E0A\u62A5\u7684 provider id\uFF08\u63A5\u5165\u6E20\u9053/\u8D26\u53F7\uFF09\uFF1A\u540C\u4E00\u6A21\u578B\u53EF\u80FD\u901A\u8FC7\u4E0D\u540C\u63A5\u5165\u65B9\u4F7F\u7528\uFF0C\u56E0\u6B64\u5206\u884C\u663E\u793A"
|
|
3198
4116
|
},
|
|
3199
4117
|
"\u63A5\u5165\u65B9"
|
|
3200
4118
|
),
|
|
3201
|
-
(0,
|
|
4119
|
+
(0, import_react8.createElement)(
|
|
3202
4120
|
"th",
|
|
3203
4121
|
{
|
|
3204
4122
|
title: "\u8BE5\u6A21\u578B\u53C2\u4E0E\u8FC7\u7684\u8F6E\u6B21\u6570\uFF1B\u4E00\u8F6E\u5207\u6362\u591A\u4E2A\u6A21\u578B\u4F1A\u5206\u522B\u8BA1\u5165\u591A\u884C\uFF0C\u6545\u5404\u884C\u4E4B\u548C\u53EF\u80FD\u5927\u4E8E\u7D2F\u8BA1\u8F6E\u6B21"
|
|
3205
4123
|
},
|
|
3206
4124
|
"\u8F6E\u6B21"
|
|
3207
4125
|
),
|
|
3208
|
-
(0,
|
|
3209
|
-
(0,
|
|
3210
|
-
(0,
|
|
4126
|
+
(0, import_react8.createElement)("th", null, "Token"),
|
|
4127
|
+
(0, import_react8.createElement)("th", null, "\u5360\u6BD4"),
|
|
4128
|
+
(0, import_react8.createElement)("th", null, "\u8D39\u7528")
|
|
3211
4129
|
)
|
|
3212
4130
|
),
|
|
3213
|
-
(0,
|
|
4131
|
+
(0, import_react8.createElement)(
|
|
3214
4132
|
"tbody",
|
|
3215
4133
|
null,
|
|
3216
4134
|
...facets.map((facet) => {
|
|
3217
4135
|
const total = facets.reduce((sum, row) => sum + row.tokens, 0);
|
|
3218
4136
|
const share = total === 0 ? 0 : facet.tokens / total * 100;
|
|
3219
|
-
return (0,
|
|
4137
|
+
return (0, import_react8.createElement)(
|
|
3220
4138
|
"tr",
|
|
3221
4139
|
{ key: facet.key || "(unattributed)" },
|
|
3222
|
-
(0,
|
|
4140
|
+
(0, import_react8.createElement)(
|
|
3223
4141
|
"td",
|
|
3224
4142
|
{ title: facet.key },
|
|
3225
4143
|
facet.label,
|
|
3226
|
-
facet.key.length === 0 ? (0,
|
|
4144
|
+
facet.key.length === 0 ? (0, import_react8.createElement)("span", { className: "dsh-tu-tag" }, "\u672A\u6807\u6CE8") : null
|
|
3227
4145
|
),
|
|
3228
|
-
(0,
|
|
4146
|
+
(0, import_react8.createElement)(
|
|
3229
4147
|
"td",
|
|
3230
4148
|
{
|
|
3231
4149
|
title: facet.provider === void 0 || facet.provider.length === 0 ? "\u672A\u6807\u6CE8\u63A5\u5165\u65B9" : `${facet.provider}/${facet.label}`
|
|
3232
4150
|
},
|
|
3233
4151
|
facet.provider === void 0 || facet.provider.length === 0 ? "\u2014" : facet.provider
|
|
3234
4152
|
),
|
|
3235
|
-
(0,
|
|
3236
|
-
(0,
|
|
3237
|
-
(0,
|
|
3238
|
-
(0,
|
|
4153
|
+
(0, import_react8.createElement)("td", null, formatTokensExact(facet.turns)),
|
|
4154
|
+
(0, import_react8.createElement)("td", null, formatTokensExact(facet.tokens)),
|
|
4155
|
+
(0, import_react8.createElement)("td", null, `${share.toFixed(1)}%`),
|
|
4156
|
+
(0, import_react8.createElement)("td", null, formatMoney(facet.cost, currency))
|
|
3239
4157
|
);
|
|
3240
4158
|
})
|
|
3241
4159
|
)
|
|
@@ -3255,7 +4173,7 @@ function healthNoticeKey(health) {
|
|
|
3255
4173
|
}
|
|
3256
4174
|
function createNoticeBar(tone, text, onClose) {
|
|
3257
4175
|
const alert = tone === "error" || tone === "warn";
|
|
3258
|
-
return (0,
|
|
4176
|
+
return (0, import_react8.createElement)(
|
|
3259
4177
|
"div",
|
|
3260
4178
|
{
|
|
3261
4179
|
className: "dsh-tu-notice",
|
|
@@ -3263,8 +4181,8 @@ function createNoticeBar(tone, text, onClose) {
|
|
|
3263
4181
|
role: alert ? "alert" : "status",
|
|
3264
4182
|
"aria-live": alert ? "assertive" : "polite"
|
|
3265
4183
|
},
|
|
3266
|
-
(0,
|
|
3267
|
-
(0,
|
|
4184
|
+
(0, import_react8.createElement)("span", { className: "dsh-tu-notice-text" }, text),
|
|
4185
|
+
(0, import_react8.createElement)(
|
|
3268
4186
|
"button",
|
|
3269
4187
|
{
|
|
3270
4188
|
type: "button",
|
|
@@ -3442,7 +4360,7 @@ var CSS = `
|
|
|
3442
4360
|
font-variant-numeric: tabular-nums;
|
|
3443
4361
|
word-break: break-all;
|
|
3444
4362
|
}
|
|
3445
|
-
.dsh-tu-card-foot { color: var(--dsw-alias-label-secondary); font-size: 11px; margin-top: 2px; }
|
|
4363
|
+
.dsh-tu-card-foot { display: flex; flex-direction: column; gap: 1px; color: var(--dsw-alias-label-secondary); font-size: 11px; line-height: 1.35; margin-top: 2px; }
|
|
3446
4364
|
|
|
3447
4365
|
.dsh-tu-panel {
|
|
3448
4366
|
border: 1px solid var(--dsw-alias-border-l1);
|
|
@@ -3488,6 +4406,7 @@ var CSS = `
|
|
|
3488
4406
|
gaps alone would need 800px and the row would spill past the panel. The
|
|
3489
4407
|
component sets it from the bucket count (2 / 1 / 0). */
|
|
3490
4408
|
.dsh-tu-bars {
|
|
4409
|
+
position: relative;
|
|
3491
4410
|
display: flex;
|
|
3492
4411
|
align-items: flex-end;
|
|
3493
4412
|
gap: var(--dsh-tu-bar-gap, 2px);
|
|
@@ -3514,7 +4433,10 @@ var CSS = `
|
|
|
3514
4433
|
min-height: 1px;
|
|
3515
4434
|
transition: opacity .12s ease;
|
|
3516
4435
|
}
|
|
4436
|
+
.dsh-tu-bar-col { position: relative; z-index: 1; }
|
|
3517
4437
|
.dsh-tu-bar-col:hover .dsh-tu-bar { opacity: .78; }
|
|
4438
|
+
.dsh-tu-gridlines { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
|
|
4439
|
+
.dsh-tu-gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--dsw-alias-border-l1); opacity: .7; }
|
|
3518
4440
|
.dsh-tu-bar[data-estimated="true"] { opacity: .55; }
|
|
3519
4441
|
.dsh-tu-bar[data-zero="true"] { min-height: 0; opacity: 0; }
|
|
3520
4442
|
.dsh-tu-bars[data-metric="cost"] .dsh-tu-bar {
|
|
@@ -3536,9 +4458,15 @@ var CSS = `
|
|
|
3536
4458
|
.dsh-tu-chart-grid {
|
|
3537
4459
|
display: grid;
|
|
3538
4460
|
grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
|
|
4461
|
+
gap: 20px 18px;
|
|
4462
|
+
align-items: stretch;
|
|
4463
|
+
}
|
|
4464
|
+
.dsh-tu-chart-stack {
|
|
4465
|
+
display: flex;
|
|
4466
|
+
flex-direction: column;
|
|
3539
4467
|
gap: 18px;
|
|
3540
|
-
align-items: start;
|
|
3541
4468
|
}
|
|
4469
|
+
.dsh-tu-chart-stack + .dsh-tu-chart-grid { margin-top: 18px; }
|
|
3542
4470
|
@media (max-width: 900px) {
|
|
3543
4471
|
.dsh-tu-chart-grid { grid-template-columns: minmax(0, 1fr); }
|
|
3544
4472
|
}
|
|
@@ -3551,13 +4479,13 @@ var CSS = `
|
|
|
3551
4479
|
@media (max-width: 1000px) {
|
|
3552
4480
|
.dsh-tu-sector-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
|
|
3553
4481
|
}
|
|
3554
|
-
.dsh-tu-
|
|
4482
|
+
.dsh-tu-subpanel {
|
|
4483
|
+
min-width: 0;
|
|
3555
4484
|
border: 1px solid var(--dsw-alias-border-l1);
|
|
3556
4485
|
border-radius: 10px;
|
|
3557
4486
|
padding: 12px 12px 10px;
|
|
3558
4487
|
background: var(--dsw-alias-bg-layer-2);
|
|
3559
4488
|
}
|
|
3560
|
-
.dsh-tu-subpanel { min-width: 0; }
|
|
3561
4489
|
.dsh-tu-three-grid {
|
|
3562
4490
|
display: grid;
|
|
3563
4491
|
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
|
@@ -3565,7 +4493,7 @@ var CSS = `
|
|
|
3565
4493
|
margin-top: 16px;
|
|
3566
4494
|
}
|
|
3567
4495
|
.dsh-tu-subpanel-title {
|
|
3568
|
-
margin: 0 0
|
|
4496
|
+
margin: 0 0 10px;
|
|
3569
4497
|
font-size: 12px;
|
|
3570
4498
|
font-weight: 500;
|
|
3571
4499
|
color: var(--dsw-alias-label-secondary);
|
|
@@ -3585,6 +4513,7 @@ var CSS = `
|
|
|
3585
4513
|
}
|
|
3586
4514
|
.dsh-tu-stat-line strong { color: var(--dsw-alias-label-primary); font-weight: 600; }
|
|
3587
4515
|
.dsh-tu-stacked-bars {
|
|
4516
|
+
position: relative;
|
|
3588
4517
|
display: flex;
|
|
3589
4518
|
align-items: flex-end;
|
|
3590
4519
|
gap: var(--dsh-tu-bar-gap, 2px);
|
|
@@ -3592,6 +4521,8 @@ var CSS = `
|
|
|
3592
4521
|
overflow: hidden;
|
|
3593
4522
|
}
|
|
3594
4523
|
.dsh-tu-stack-col {
|
|
4524
|
+
position: relative;
|
|
4525
|
+
z-index: 1;
|
|
3595
4526
|
flex: 1 1 0;
|
|
3596
4527
|
min-width: 0;
|
|
3597
4528
|
height: 100%;
|
|
@@ -3645,6 +4576,10 @@ var CSS = `
|
|
|
3645
4576
|
}
|
|
3646
4577
|
.dsh-tu-rate-grid { stroke: var(--dsw-alias-border-l1); stroke-width: 1; stroke-dasharray: 2 2; }
|
|
3647
4578
|
.dsh-tu-rate-line { stroke: var(--dsh-tu-cat-0); stroke-width: 1.8; }
|
|
4579
|
+
.dsh-tu-rate-line[data-series="1"] { stroke: var(--dsh-tu-cat-1); }
|
|
4580
|
+
.dsh-tu-rate-line[data-series="2"] { stroke: var(--dsh-tu-cat-2); }
|
|
4581
|
+
.dsh-tu-rate-line[data-series="3"] { stroke: var(--dsh-tu-cat-3); }
|
|
4582
|
+
.dsh-tu-rate-line[data-series="4"] { stroke: var(--dsh-tu-cat-4); }
|
|
3648
4583
|
.dsh-tu-rate-point {
|
|
3649
4584
|
position: absolute;
|
|
3650
4585
|
z-index: 1;
|
|
@@ -3656,11 +4591,235 @@ var CSS = `
|
|
|
3656
4591
|
transform: translate(-50%, -50%);
|
|
3657
4592
|
cursor: default;
|
|
3658
4593
|
}
|
|
4594
|
+
.dsh-tu-rate-point[data-series="1"] { background: var(--dsh-tu-cat-1); }
|
|
4595
|
+
.dsh-tu-rate-point[data-series="2"] { background: var(--dsh-tu-cat-2); }
|
|
4596
|
+
.dsh-tu-rate-point[data-series="3"] { background: var(--dsh-tu-cat-3); }
|
|
4597
|
+
.dsh-tu-rate-point[data-series="4"] { background: var(--dsh-tu-cat-4); }
|
|
3659
4598
|
.dsh-tu-rate-point-clipped {
|
|
3660
4599
|
background: var(--dsh-tu-cat-4);
|
|
3661
4600
|
box-shadow: 0 0 0 1px var(--dsw-alias-bg-layer-1), 0 0 0 2px color-mix(in oklab, var(--dsh-tu-cat-4) 45%, transparent);
|
|
3662
4601
|
}
|
|
3663
4602
|
|
|
4603
|
+
/* Weekday \xD7 hour heatmap: one grid, seven rows, 24 columns. The row label is
|
|
4604
|
+
the first grid column; every cell stays square-ish and shrinks with the
|
|
4605
|
+
panel instead of forcing horizontal scroll. */
|
|
4606
|
+
.dsh-tu-weekheat { margin-top: 4px; overflow-x: auto; }
|
|
4607
|
+
.dsh-tu-weekheat-axis,
|
|
4608
|
+
.dsh-tu-weekheat-row {
|
|
4609
|
+
display: grid;
|
|
4610
|
+
grid-template-columns: 34px repeat(24, minmax(14px, 1fr));
|
|
4611
|
+
gap: 3px;
|
|
4612
|
+
align-items: center;
|
|
4613
|
+
min-width: 430px;
|
|
4614
|
+
}
|
|
4615
|
+
.dsh-tu-weekheat-axis { margin-bottom: 3px; }
|
|
4616
|
+
.dsh-tu-weekheat-axis > span { color: var(--dsw-alias-label-secondary); font-size: 9px; text-align: center; }
|
|
4617
|
+
.dsh-tu-weekheat-axis .dsh-tu-weekheat-rowlabel { text-align: left; }
|
|
4618
|
+
.dsh-tu-weekheat-rowlabel {
|
|
4619
|
+
color: var(--dsw-alias-label-secondary);
|
|
4620
|
+
font-size: 10px;
|
|
4621
|
+
line-height: 12px;
|
|
4622
|
+
white-space: nowrap;
|
|
4623
|
+
}
|
|
4624
|
+
.dsh-tu-weekheat-cell {
|
|
4625
|
+
display: block;
|
|
4626
|
+
height: 13px;
|
|
4627
|
+
min-width: 10px;
|
|
4628
|
+
border-radius: 3px;
|
|
4629
|
+
background: color-mix(in oklab, var(--dsw-alias-label-secondary) 13%, transparent);
|
|
4630
|
+
}
|
|
4631
|
+
.dsh-tu-weekheat-cell[data-level="1"] { background: color-mix(in oklab, var(--dsh-tu-cat-2) 28%, transparent); }
|
|
4632
|
+
.dsh-tu-weekheat-cell[data-level="2"] { background: color-mix(in oklab, var(--dsh-tu-cat-2) 48%, transparent); }
|
|
4633
|
+
.dsh-tu-weekheat-cell[data-level="3"] { background: color-mix(in oklab, var(--dsh-tu-cat-2) 70%, transparent); }
|
|
4634
|
+
.dsh-tu-weekheat-cell[data-level="4"] { background: var(--dsh-tu-cat-2); }
|
|
4635
|
+
.dsh-tu-weekheat-cell:hover { outline: 1px solid var(--dsw-alias-label-primary); outline-offset: -1px; }
|
|
4636
|
+
.dsh-tu-weekheat-legend {
|
|
4637
|
+
display: flex;
|
|
4638
|
+
align-items: center;
|
|
4639
|
+
justify-content: flex-end;
|
|
4640
|
+
gap: 4px;
|
|
4641
|
+
margin-top: 6px;
|
|
4642
|
+
color: var(--dsw-alias-label-secondary);
|
|
4643
|
+
font-size: 10px;
|
|
4644
|
+
}
|
|
4645
|
+
.dsh-tu-weekheat-legend .dsh-tu-weekheat-cell { width: 13px; min-width: 13px; }
|
|
4646
|
+
|
|
4647
|
+
|
|
4648
|
+
/* Compact metric chips: the only text that stays outside the info popovers. */
|
|
4649
|
+
.dsh-tu-kpi-strip { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 0 0 12px; }
|
|
4650
|
+
.dsh-tu-kpi {
|
|
4651
|
+
display: inline-flex;
|
|
4652
|
+
align-items: baseline;
|
|
4653
|
+
gap: 5px;
|
|
4654
|
+
padding: 3px 9px;
|
|
4655
|
+
border: 1px solid var(--dsw-alias-border-l1);
|
|
4656
|
+
border-radius: 999px;
|
|
4657
|
+
background: var(--dsw-alias-bg-layer-2);
|
|
4658
|
+
color: var(--dsw-alias-label-secondary);
|
|
4659
|
+
font-size: 11px;
|
|
4660
|
+
}
|
|
4661
|
+
.dsh-tu-kpi b { color: var(--dsw-alias-label-primary); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
4662
|
+
.dsh-tu-kpi[data-tone="green"] b { color: var(--dsh-tu-cat-2); }
|
|
4663
|
+
.dsh-tu-kpi[data-tone="amber"] b { color: var(--dsh-tu-cat-1); }
|
|
4664
|
+
.dsh-tu-kpi[data-tone="rose"] b { color: var(--dsh-tu-cat-4); }
|
|
4665
|
+
|
|
4666
|
+
/* Dual-axis trend: TTFT and TPS share one time axis, not one value axis. */
|
|
4667
|
+
.dsh-tu-dual-legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--dsw-alias-label-secondary); font-size: 10px; margin-bottom: 2px; }
|
|
4668
|
+
.dsh-tu-dual-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; background: currentColor; }
|
|
4669
|
+
.dsh-tu-dual-legend span[data-series="0"] { color: var(--dsh-tu-cat-0); }
|
|
4670
|
+
.dsh-tu-dual-legend span[data-series="2"] { color: var(--dsh-tu-cat-2); }
|
|
4671
|
+
.dsh-tu-dual-plot { display: flex; align-items: flex-start; }
|
|
4672
|
+
.dsh-tu-dual-yaxis {
|
|
4673
|
+
width: 44px;
|
|
4674
|
+
height: 150px;
|
|
4675
|
+
display: flex;
|
|
4676
|
+
flex-direction: column;
|
|
4677
|
+
justify-content: space-between;
|
|
4678
|
+
color: var(--dsw-alias-label-secondary);
|
|
4679
|
+
font-size: 9px;
|
|
4680
|
+
font-variant-numeric: tabular-nums;
|
|
4681
|
+
}
|
|
4682
|
+
.dsh-tu-dual-yaxis span { white-space: nowrap; }
|
|
4683
|
+
.dsh-tu-dual-yaxis-left { text-align: right; padding-right: 5px; color: var(--dsh-tu-cat-0); }
|
|
4684
|
+
.dsh-tu-dual-yaxis-right { text-align: left; padding-left: 5px; color: var(--dsh-tu-cat-2); }
|
|
4685
|
+
.dsh-tu-dual-body { flex: 1 1 auto; min-width: 0; }
|
|
4686
|
+
.dsh-tu-dual-canvas { position: relative; height: 150px; }
|
|
4687
|
+
.dsh-tu-dual-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
|
|
4688
|
+
.dsh-tu-dual-line { stroke-width: 1.7; }
|
|
4689
|
+
.dsh-tu-dual-line[data-series="0"] { stroke: var(--dsh-tu-cat-0); }
|
|
4690
|
+
.dsh-tu-dual-line[data-series="2"] { stroke: var(--dsh-tu-cat-2); }
|
|
4691
|
+
.dsh-tu-dual-area { stroke: none; }
|
|
4692
|
+
.dsh-tu-dual-area[data-series="0"] { fill: var(--dsh-tu-cat-0); opacity: .10; }
|
|
4693
|
+
.dsh-tu-dual-area[data-series="2"] { fill: var(--dsh-tu-cat-2); opacity: .10; }
|
|
4694
|
+
.dsh-tu-dual-dot {
|
|
4695
|
+
position: absolute;
|
|
4696
|
+
z-index: 1;
|
|
4697
|
+
width: 4px;
|
|
4698
|
+
height: 4px;
|
|
4699
|
+
border-radius: 50%;
|
|
4700
|
+
transform: translate(-50%, -50%);
|
|
4701
|
+
box-shadow: 0 0 0 1px var(--dsw-alias-bg-layer-1);
|
|
4702
|
+
}
|
|
4703
|
+
.dsh-tu-dual-dot[data-series="0"] { background: var(--dsh-tu-cat-0); }
|
|
4704
|
+
.dsh-tu-dual-dot[data-series="2"] { background: var(--dsh-tu-cat-2); }
|
|
4705
|
+
|
|
4706
|
+
/* Ordered distribution as stems and dots. */
|
|
4707
|
+
.dsh-tu-dotplot-area { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding: 0 4px; }
|
|
4708
|
+
.dsh-tu-dotplot-col { flex: 1 1 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
|
|
4709
|
+
.dsh-tu-dotplot-value { color: var(--dsw-alias-label-secondary); font-size: 9px; height: 17px; line-height: 13px; padding-bottom: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
4710
|
+
.dsh-tu-dotplot-stem { position: relative; width: 1px; min-height: 0; margin-top: 4px; background: var(--dsw-alias-border-l1); }
|
|
4711
|
+
.dsh-tu-dotplot-dot { position: absolute; left: 50%; top: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--dsh-tu-cat-0); transform: translate(-50%, -50%); box-shadow: 0 0 0 1px var(--dsw-alias-bg-layer-1); }
|
|
4712
|
+
.dsh-tu-dotplot-dot[data-zero="true"] { width: 6px; height: 6px; background: var(--dsw-alias-label-secondary); opacity: .3; box-shadow: none; }
|
|
4713
|
+
.dsh-tu-dotplot-axis { display: flex; gap: 8px; padding: 4px 4px 0; color: var(--dsw-alias-label-secondary); font-size: 9px; }
|
|
4714
|
+
.dsh-tu-dotplot-axis span { flex: 1 1 0; text-align: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
4715
|
+
.dsh-tu-dotplot-caption { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; color: var(--dsw-alias-label-secondary); font-size: 9px; }
|
|
4716
|
+
|
|
4717
|
+
/* Horizontal ranking with a broken axis for one extreme tool outlier. */
|
|
4718
|
+
.dsh-tu-outlier-bars { display: flex; flex-direction: column; gap: 7px; }
|
|
4719
|
+
.dsh-tu-outlier-row { display: grid; grid-template-columns: 128px minmax(0, 1fr) 76px; align-items: center; gap: 10px; }
|
|
4720
|
+
.dsh-tu-outlier-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-secondary); font-size: 10px; }
|
|
4721
|
+
.dsh-tu-outlier-track { position: relative; height: 10px; border-radius: 3px; background: var(--dsw-alias-bg-layer-1); overflow: hidden; }
|
|
4722
|
+
.dsh-tu-outlier-bar { display: block; height: 100%; min-width: 1px; border-radius: 3px; opacity: .8; }
|
|
4723
|
+
.dsh-tu-outlier-bar[data-series="0"] { background: var(--dsh-tu-cat-0); }
|
|
4724
|
+
.dsh-tu-outlier-bar[data-series="1"] { background: var(--dsh-tu-cat-1); }
|
|
4725
|
+
.dsh-tu-outlier-bar[data-series="2"] { background: var(--dsh-tu-cat-2); }
|
|
4726
|
+
.dsh-tu-outlier-bar[data-series="3"] { background: var(--dsh-tu-cat-3); }
|
|
4727
|
+
.dsh-tu-outlier-bar[data-series="4"] { background: var(--dsh-tu-cat-4); }
|
|
4728
|
+
.dsh-tu-outlier-bar[data-broken="true"] { border-radius: 3px 0 0 3px; }
|
|
4729
|
+
.dsh-tu-outlier-cut { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); color: var(--dsw-alias-label-secondary); font-size: 9px; font-weight: 600; background: var(--dsw-alias-bg-layer-2); padding: 0 2px; }
|
|
4730
|
+
.dsh-tu-outlier-value { text-align: right; color: var(--dsw-alias-label-secondary); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
4731
|
+
.dsh-tu-outlier-axis { display: flex; justify-content: space-between; margin: 5px 76px 0 138px; color: var(--dsw-alias-label-secondary); font-size: 9px; font-variant-numeric: tabular-nums; }
|
|
4732
|
+
|
|
4733
|
+
/* Per-route decode-speed distribution (box-like range chart). *//* Per-route decode-speed distribution (box-like range chart). */
|
|
4734
|
+
.dsh-tu-range { padding: 2px 0; }
|
|
4735
|
+
.dsh-tu-range-rows { display: flex; flex-direction: column; gap: 10px; }
|
|
4736
|
+
.dsh-tu-range-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 66px; align-items: center; gap: 10px; }
|
|
4737
|
+
.dsh-tu-range-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-secondary); font-size: 10px; }
|
|
4738
|
+
.dsh-tu-range-track { position: relative; height: 20px; }
|
|
4739
|
+
.dsh-tu-range-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--dsw-alias-border-l1); }
|
|
4740
|
+
.dsh-tu-range-whisker { position: absolute; top: calc(50% - 1px); height: 2px; background: var(--dsh-tu-cat-0); opacity: .45; }
|
|
4741
|
+
.dsh-tu-range-whisker[data-series="1"] { background: var(--dsh-tu-cat-1); }
|
|
4742
|
+
.dsh-tu-range-whisker[data-series="2"] { background: var(--dsh-tu-cat-2); }
|
|
4743
|
+
.dsh-tu-range-whisker[data-series="3"] { background: var(--dsh-tu-cat-3); }
|
|
4744
|
+
.dsh-tu-range-whisker[data-series="4"] { background: var(--dsh-tu-cat-4); }
|
|
4745
|
+
.dsh-tu-range-box { position: absolute; top: 50%; height: 12px; transform: translateY(-50%); border-radius: 3px; opacity: .8; }
|
|
4746
|
+
.dsh-tu-range-median { position: absolute; top: 50%; width: 2px; height: 18px; transform: translate(-50%, -50%); background: var(--dsw-alias-label-primary); }
|
|
4747
|
+
.dsh-tu-range-box[data-series="0"] { background: var(--dsh-tu-cat-0); }
|
|
4748
|
+
.dsh-tu-range-box[data-series="1"] { background: var(--dsh-tu-cat-1); }
|
|
4749
|
+
.dsh-tu-range-box[data-series="2"] { background: var(--dsh-tu-cat-2); }
|
|
4750
|
+
.dsh-tu-range-box[data-series="3"] { background: var(--dsh-tu-cat-3); }
|
|
4751
|
+
.dsh-tu-range-box[data-series="4"] { background: var(--dsh-tu-cat-4); }
|
|
4752
|
+
.dsh-tu-range-value { text-align: right; color: var(--dsw-alias-label-secondary); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
4753
|
+
.dsh-tu-range-axis { display: flex; justify-content: space-between; margin: 6px 66px 0 140px; color: var(--dsw-alias-label-secondary); font-size: 9px; font-variant-numeric: tabular-nums; }
|
|
4754
|
+
.dsh-tu-range-caption { margin: 4px 66px 0 140px; color: var(--dsw-alias-label-secondary); font-size: 9px; }
|
|
4755
|
+
|
|
4756
|
+
/* Part-to-whole rectangles (tool time, expensive Turns). */
|
|
4757
|
+
.dsh-tu-treemap { position: relative; height: 300px; overflow: hidden; border-radius: 8px; background: var(--dsw-alias-bg-layer-2); }
|
|
4758
|
+
.dsh-tu-treemap-wrap { display: flex; flex-direction: column; gap: 8px; }
|
|
4759
|
+
.dsh-tu-treemap-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--dsw-alias-label-secondary); font-size: 10px; }
|
|
4760
|
+
.dsh-tu-treemap-legend-item { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
|
|
4761
|
+
.dsh-tu-treemap-legend-label { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
4762
|
+
.dsh-tu-treemap-swatch { width: 7px; height: 7px; border-radius: 2px; display: inline-block; flex: none; }
|
|
4763
|
+
.dsh-tu-treemap-swatch[data-series="0"] { background: var(--dsh-tu-cat-0); }
|
|
4764
|
+
.dsh-tu-treemap-swatch[data-series="1"] { background: var(--dsh-tu-cat-1); }
|
|
4765
|
+
.dsh-tu-treemap-swatch[data-series="2"] { background: var(--dsh-tu-cat-2); }
|
|
4766
|
+
.dsh-tu-treemap-swatch[data-series="3"] { background: var(--dsh-tu-cat-3); }
|
|
4767
|
+
.dsh-tu-treemap-swatch[data-series="4"] { background: var(--dsh-tu-cat-4); }
|
|
4768
|
+
.dsh-tu-treemap-cell {
|
|
4769
|
+
position: absolute;
|
|
4770
|
+
box-sizing: border-box;
|
|
4771
|
+
border: 1px solid var(--dsw-alias-bg-layer-1);
|
|
4772
|
+
display: flex;
|
|
4773
|
+
flex-direction: column;
|
|
4774
|
+
gap: 2px;
|
|
4775
|
+
padding: 6px;
|
|
4776
|
+
overflow: hidden;
|
|
4777
|
+
color: var(--dsw-alias-label-primary);
|
|
4778
|
+
}
|
|
4779
|
+
.dsh-tu-treemap-label { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
4780
|
+
.dsh-tu-treemap-value { color: var(--dsw-alias-label-secondary); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
4781
|
+
|
|
4782
|
+
/* Semi-circle share gauge. */
|
|
4783
|
+
.dsh-tu-gauge svg { display: block; width: min(100%, 260px); height: auto; margin: 0 auto; }
|
|
4784
|
+
.dsh-tu-gauge-track { stroke: var(--dsw-alias-border-l1); stroke-width: 10; stroke-linecap: round; }
|
|
4785
|
+
.dsh-tu-gauge-rest { stroke: var(--dsh-tu-cat-0); stroke-width: 10; stroke-linecap: round; }
|
|
4786
|
+
.dsh-tu-gauge-value { stroke: var(--dsh-tu-cat-1); stroke-width: 10; stroke-linecap: round; }
|
|
4787
|
+
.dsh-tu-gauge-center { fill: var(--dsw-alias-label-primary); font-size: 17px; font-weight: 600; }
|
|
4788
|
+
.dsh-tu-gauge-caption { fill: var(--dsw-alias-label-secondary); font-size: 7px; }
|
|
4789
|
+
.dsh-tu-gauge-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 14px; color: var(--dsw-alias-label-secondary); font-size: 10px; margin-top: 2px; }
|
|
4790
|
+
.dsh-tu-gauge-legend > span { display: inline-flex; align-items: center; gap: 4px; }
|
|
4791
|
+
.dsh-tu-gauge-swatch { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
|
|
4792
|
+
.dsh-tu-gauge-swatch[data-series="0"] { background: var(--dsh-tu-cat-0); }
|
|
4793
|
+
.dsh-tu-gauge-swatch[data-series="1"] { background: var(--dsh-tu-cat-1); }
|
|
4794
|
+
|
|
4795
|
+
/* Normalized radar for a small route set. */
|
|
4796
|
+
.dsh-tu-radar { display: flex; flex-direction: column; align-items: center; }
|
|
4797
|
+
.dsh-tu-radar svg { display: block; width: min(100%, 300px); height: auto; overflow: visible; }
|
|
4798
|
+
.dsh-tu-radar-ring { fill: none; stroke: var(--dsw-alias-border-l1); stroke-width: .6; }
|
|
4799
|
+
.dsh-tu-radar-axis { stroke: var(--dsw-alias-border-l1); stroke-width: .5; }
|
|
4800
|
+
.dsh-tu-radar-label { fill: var(--dsw-alias-label-secondary); font-size: 6.5px; }
|
|
4801
|
+
.dsh-tu-radar-area { stroke-width: .8; }
|
|
4802
|
+
.dsh-tu-radar-area[data-series="0"] { fill: var(--dsh-tu-cat-0); stroke: var(--dsh-tu-cat-0); opacity: .14; }
|
|
4803
|
+
.dsh-tu-radar-area[data-series="1"] { fill: var(--dsh-tu-cat-1); stroke: var(--dsh-tu-cat-1); opacity: .14; }
|
|
4804
|
+
.dsh-tu-radar-area[data-series="2"] { fill: var(--dsh-tu-cat-2); stroke: var(--dsh-tu-cat-2); opacity: .14; }
|
|
4805
|
+
.dsh-tu-radar-area[data-series="3"] { fill: var(--dsh-tu-cat-3); stroke: var(--dsh-tu-cat-3); opacity: .14; }
|
|
4806
|
+
.dsh-tu-radar-area[data-series="4"] { fill: var(--dsh-tu-cat-4); stroke: var(--dsh-tu-cat-4); opacity: .14; }
|
|
4807
|
+
.dsh-tu-radar-dot { pointer-events: none; }
|
|
4808
|
+
.dsh-tu-radar-hit { fill: transparent; pointer-events: all; cursor: crosshair; }
|
|
4809
|
+
.dsh-tu-radar-dot[data-series="0"] { fill: var(--dsh-tu-cat-0); }
|
|
4810
|
+
.dsh-tu-radar-dot[data-series="1"] { fill: var(--dsh-tu-cat-1); }
|
|
4811
|
+
.dsh-tu-radar-dot[data-series="2"] { fill: var(--dsh-tu-cat-2); }
|
|
4812
|
+
.dsh-tu-radar-dot[data-series="3"] { fill: var(--dsh-tu-cat-3); }
|
|
4813
|
+
.dsh-tu-radar-dot[data-series="4"] { fill: var(--dsh-tu-cat-4); }
|
|
4814
|
+
.dsh-tu-radar-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; color: var(--dsw-alias-label-secondary); font-size: 9px; margin-top: 2px; }
|
|
4815
|
+
.dsh-tu-radar-legend > span { display: inline-flex; align-items: center; gap: 4px; }
|
|
4816
|
+
.dsh-tu-radar-swatch { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
|
|
4817
|
+
.dsh-tu-radar-swatch[data-series="0"] { background: var(--dsh-tu-cat-0); }
|
|
4818
|
+
.dsh-tu-radar-swatch[data-series="1"] { background: var(--dsh-tu-cat-1); }
|
|
4819
|
+
.dsh-tu-radar-swatch[data-series="2"] { background: var(--dsh-tu-cat-2); }
|
|
4820
|
+
.dsh-tu-radar-swatch[data-series="3"] { background: var(--dsh-tu-cat-3); }
|
|
4821
|
+
.dsh-tu-radar-swatch[data-series="4"] { background: var(--dsh-tu-cat-4); }
|
|
4822
|
+
|
|
3664
4823
|
.dsh-tu-donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
|
|
3665
4824
|
.dsh-tu-donut { width: 148px; flex: 0 0 148px; }
|
|
3666
4825
|
.dsh-tu-donut svg { display: block; width: 100%; height: auto; }
|
|
@@ -3767,8 +4926,11 @@ var CSS = `
|
|
|
3767
4926
|
}
|
|
3768
4927
|
|
|
3769
4928
|
.dsh-tu-hour-chart { margin-top: 4px; }
|
|
4929
|
+
.dsh-tu-hour-chart { overflow-x: auto; overflow-y: hidden; }
|
|
3770
4930
|
.dsh-tu-hour-bars {
|
|
3771
4931
|
display: flex;
|
|
4932
|
+
margin-left: 37px;
|
|
4933
|
+
min-width: 393px;
|
|
3772
4934
|
align-items: flex-end;
|
|
3773
4935
|
gap: 3px;
|
|
3774
4936
|
height: 112px;
|
|
@@ -3804,6 +4966,8 @@ var CSS = `
|
|
|
3804
4966
|
background: linear-gradient(180deg, var(--dsh-tu-cat-4), var(--dsh-tu-cat-3));
|
|
3805
4967
|
}
|
|
3806
4968
|
.dsh-tu-hour-axis {
|
|
4969
|
+
margin-left: 37px;
|
|
4970
|
+
min-width: 393px;
|
|
3807
4971
|
display: flex;
|
|
3808
4972
|
gap: 3px;
|
|
3809
4973
|
margin-top: 4px;
|
|
@@ -4308,7 +5472,6 @@ var CSS = `
|
|
|
4308
5472
|
}
|
|
4309
5473
|
|
|
4310
5474
|
/* ---- workspace breakdown: merged rows + per-path detail ------------------ */
|
|
4311
|
-
.dsh-tu-ws-note { margin: 0 0 10px; }
|
|
4312
5475
|
.dsh-tu-path-row > td {
|
|
4313
5476
|
padding: 2px 0 8px;
|
|
4314
5477
|
text-align: left;
|
|
@@ -4367,22 +5530,22 @@ function warnRegistrationFailure(what, error) {
|
|
|
4367
5530
|
console.warn(`[token-usage] could not register ${what}; only this plugin's UI is affected (${detail})`);
|
|
4368
5531
|
}
|
|
4369
5532
|
function DashboardFallback(props) {
|
|
4370
|
-
return (0,
|
|
5533
|
+
return (0, import_react9.createElement)(
|
|
4371
5534
|
"div",
|
|
4372
5535
|
{ className: "dsh-tu-root" },
|
|
4373
|
-
(0,
|
|
5536
|
+
(0, import_react9.createElement)(
|
|
4374
5537
|
"div",
|
|
4375
5538
|
{ className: "dsh-tu-shell" },
|
|
4376
|
-
(0,
|
|
5539
|
+
(0, import_react9.createElement)(
|
|
4377
5540
|
"div",
|
|
4378
5541
|
{ className: "dsh-tu-panel dsh-tu-boundary" },
|
|
4379
|
-
(0,
|
|
4380
|
-
(0,
|
|
5542
|
+
(0, import_react9.createElement)("h2", { className: "dsh-tu-panel-title" }, PANEL_LABEL),
|
|
5543
|
+
(0, import_react9.createElement)(
|
|
4381
5544
|
"div",
|
|
4382
5545
|
{ className: "dsh-tu-empty" },
|
|
4383
5546
|
"\u7EDF\u8BA1\u9762\u677F\u6E32\u67D3\u5931\u8D25\u3002\u8BE5\u95EE\u9898\u53EA\u5F71\u54CD\u672C\u63D2\u4EF6\uFF0C\u4E0D\u5F71\u54CD dsh \u5176\u5B83\u529F\u80FD\uFF1B\u53EF\u8FD4\u56DE\u5BF9\u8BDD\u540E\u91CD\u8BD5\uFF0C\u6216\u91CD\u542F\u5E94\u7528\u3002"
|
|
4384
5547
|
),
|
|
4385
|
-
(0,
|
|
5548
|
+
(0, import_react9.createElement)(
|
|
4386
5549
|
"button",
|
|
4387
5550
|
{
|
|
4388
5551
|
type: "button",
|
|
@@ -4398,17 +5561,17 @@ function DashboardFallback(props) {
|
|
|
4398
5561
|
);
|
|
4399
5562
|
}
|
|
4400
5563
|
function DashboardEntry(props) {
|
|
4401
|
-
return (0,
|
|
5564
|
+
return (0, import_react9.createElement)(
|
|
4402
5565
|
ErrorBoundary,
|
|
4403
|
-
{ fallback: (0,
|
|
4404
|
-
(0,
|
|
5566
|
+
{ fallback: (0, import_react9.createElement)(DashboardFallback, props) },
|
|
5567
|
+
(0, import_react9.createElement)(TokenUsageDashboard, props)
|
|
4405
5568
|
);
|
|
4406
5569
|
}
|
|
4407
5570
|
function PanelIconEntry(props) {
|
|
4408
|
-
return (0,
|
|
5571
|
+
return (0, import_react9.createElement)(
|
|
4409
5572
|
ErrorBoundary,
|
|
4410
5573
|
{ fallback: null },
|
|
4411
|
-
(0,
|
|
5574
|
+
(0, import_react9.createElement)(TokenUsagePanelIcon, props)
|
|
4412
5575
|
);
|
|
4413
5576
|
}
|
|
4414
5577
|
function apply(ctx) {
|