mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 01:40:15 +01:00
feat: enhance token formatting and reset logic for new conversations
This commit is contained in:
parent
0b84a25536
commit
01ca9b1655
2 changed files with 13 additions and 2 deletions
|
|
@ -5,10 +5,10 @@ import { cn } from '~/utils';
|
|||
|
||||
function formatTokens(n: number): string {
|
||||
if (n >= 1000000) {
|
||||
return `${(n / 1000000).toFixed(1)}M`;
|
||||
return `${(n / 1000000).toFixed(1).replace(/\.0$/, '')}M`;
|
||||
}
|
||||
if (n >= 1000) {
|
||||
return `${(n / 1000).toFixed(1)}K`;
|
||||
return `${(n / 1000).toFixed(1).replace(/\.0$/, '')}K`;
|
||||
}
|
||||
return n.toString();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue