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

Function formatCompact

components/AppShell.tsx:1017–1017  ·  view source on GitHub ↗
(n: number)

Source from the content-addressed store, hash-verified

1015 ];
1016 const ctx = contextUsage ?? sessionStats.contextUsage;
1017 const formatCompact = (n: number) => n >= 1_000_000 ? `${(n / 1_000_000).toFixed(1)}M` : n >= 1000 ? `${(n / 1000).toFixed(0)}k` : String(n);
1018 const extraTokenRows = [
1019 ...(sessionStats.cost > 0 ? [["Cost", `$${sessionStats.cost.toFixed(4)}`]] : []),
1020 ...(ctx?.contextWindow ? [["Context", `${ctx.percent !== null ? `${ctx.percent.toFixed(1)}%` : "?"} / ${formatCompact(ctx.contextWindow)}`]] : []),

Callers 1

AppShellFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected