MCPcopy Create free account
hub / github.com/agegr/pi-web / formatTokenCount

Function formatTokenCount

components/ChatInput.tsx:93–97  ·  view source on GitHub ↗
(tokens: number)

Source from the content-addressed store, hash-verified

91};
92
93function formatTokenCount(tokens: number): string {
94 if (tokens >= 1_000_000) return `${(tokens / 1_000_000).toFixed(1)}M`;
95 if (tokens >= 1_000) return `${Math.round(tokens / 1_000)}k`;
96 return tokens.toLocaleString();
97}
98
99type SlashCommandPaletteItem = SlashCommandInfo | {
100 name: string;

Callers 1

ChatInput.tsxFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected