tokmon 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +11 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -96,6 +96,7 @@ async function parseFile(path, since) {
|
|
|
96
96
|
const u = obj.message.usage;
|
|
97
97
|
entries.push({
|
|
98
98
|
ts,
|
|
99
|
+
msgId: obj.message.id ?? "",
|
|
99
100
|
model: obj.message.model ?? "unknown",
|
|
100
101
|
cost: costOf(obj.message.model ?? "", u),
|
|
101
102
|
input: u.input_tokens ?? 0,
|
|
@@ -138,7 +139,14 @@ async function loadEntries(since) {
|
|
|
138
139
|
}
|
|
139
140
|
}));
|
|
140
141
|
}
|
|
141
|
-
|
|
142
|
+
const all = chunks.flat();
|
|
143
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
144
|
+
return all.filter((e) => {
|
|
145
|
+
if (!e.msgId) return true;
|
|
146
|
+
if (seenIds.has(e.msgId)) return false;
|
|
147
|
+
seenIds.add(e.msgId);
|
|
148
|
+
return true;
|
|
149
|
+
});
|
|
142
150
|
}
|
|
143
151
|
function sum(entries) {
|
|
144
152
|
let cost = 0, tokens2 = 0;
|
|
@@ -585,7 +593,7 @@ function App({ interval: cliInterval }) {
|
|
|
585
593
|
if (!dashboard) return /* @__PURE__ */ jsx(Box, { padding: 1, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Loading..." }) });
|
|
586
594
|
const rawTableData = table ? [table.daily, table.weekly, table.monthly][view] : [];
|
|
587
595
|
const tableData = sortRows(rawTableData, sort);
|
|
588
|
-
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1,
|
|
596
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, height: rows, children: [
|
|
589
597
|
/* @__PURE__ */ jsxs(Box, { justifyContent: "space-between", children: [
|
|
590
598
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
591
599
|
/* @__PURE__ */ jsxs(Text, { bold: true, color: "greenBright", children: [
|
|
@@ -593,7 +601,7 @@ function App({ interval: cliInterval }) {
|
|
|
593
601
|
" tokmon"
|
|
594
602
|
] }),
|
|
595
603
|
/* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
596
|
-
" \xB7 ",
|
|
604
|
+
" \xB7 every ",
|
|
597
605
|
cliInterval ? cliInterval / 1e3 : cfg.interval,
|
|
598
606
|
"s"
|
|
599
607
|
] })
|