Skip to content

Commit 7514c82

Browse files
NarahariRaghavavincentkoc
authored andcommitted
fix(ui): correct rounding boundary comment from 999,500 to 999,950
1 parent 8eb9faa commit 7514c82

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

ui/src/ui/chat/token-format.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe("formatCompactTokenCount", () => {
2020
});
2121

2222
it("rolls values that round up to 1000.0k over into the M branch instead of showing 1000k", () => {
23-
// Regression test: 999,500-999,999 round to "1000.0" at one-decimal
23+
// Regression test: 999,950-999,999 round to "1000.0" at one-decimal
2424
// thousands precision. Before the fix, the >= 1_000_000 branch check
2525
// ran on the raw value (which is still < 1_000_000), so these fell
2626
// through to the k branch and displayed the nonsensical "1000k".

ui/src/ui/chat/token-format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function formatCompactTokenCount(tokens: number): string {
44
return `${(tokens / 1_000_000).toFixed(1).replace(/\.0$/, "")}M`;
55
}
66
if (tokens >= 1_000) {
7-
// Values from 999,500-999,999 round to "1000.0" at one-decimal
7+
// Values from 999,950-999,999 round to "1000.0" at one-decimal
88
// thousands precision, which would display the nonsensical "1000k"
99
// instead of rolling over to the M branch above. Re-check the
1010
// rounded result before formatting.

0 commit comments

Comments
 (0)