Spaces:
Configuration error
Configuration error
Download web/src/lib/format.ts from Jackken/deepseek-harness: direct link, hf CLI and curl.
- Browser
- Download file 373 Bytes
-
https://huggingface.co/spaces/Jackken/deepseek-harness/resolve/main/web/src/lib/format.ts
- Command line
-
hf download hf://spaces/Jackken/deepseek-harness/web/src/lib/format.ts
-
curl -L -o format.ts https://huggingface.co/spaces/Jackken/deepseek-harness/resolve/main/web/src/lib/format.ts
373 Bytes
| /** | |
| * Format a token count as a human-readable string (e.g. 1M, 128K, 4096). | |
| * Strips trailing ".0" for clean round numbers. | |
| */ | |
| export function formatTokenCount(n: number): string { | |
| if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(n % 1_000_000 === 0 ? 0 : 1)}M`; | |
| if (n >= 1_000) return `${(n / 1_000).toFixed(n % 1_000 === 0 ? 0 : 1)}K`; | |
| return String(n); | |
| } | |