We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5c506a8 commit f315708Copy full SHA for f315708
1 file changed
ui/desktop/src/components/sessions/SessionsInsights.tsx
@@ -110,19 +110,9 @@ export function SessionInsights() {
110
};
111
112
const formatTokens = (tokens: number | undefined): string => {
113
- if (!tokens) {
114
- return '0';
115
- }
116
- if (tokens >= 1_000_000_000) {
117
- return `${(tokens / 1_000_000_000).toFixed(2)}B`;
118
119
- if (tokens >= 1_000_000) {
120
- return `${(tokens / 1_000_000).toFixed(2)}M`;
121
122
- if (tokens >= 1_000) {
123
- return `${(tokens / 1_000).toFixed(1)}K`;
124
125
- return tokens.toString();
+ return new Intl.NumberFormat('en', { notation: 'compact', maximumFractionDigits: 2 }).format(
+ tokens || 0
+ );
126
127
128
// Render skeleton loader while data is loading
0 commit comments