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

Function formatUsage

components/MessageView.tsx:1357–1370  ·  view source on GitHub ↗
(usage: {
  input: number;
  output: number;
  cacheRead: number;
  cacheWrite: number;
  cost: { total: number };
})

Source from the content-addressed store, hash-verified

1355}
1356
1357function formatUsage(usage: {
1358 input: number;
1359 output: number;
1360 cacheRead: number;
1361 cacheWrite: number;
1362 cost: { total: number };
1363}): string {
1364 const parts = [];
1365 if (usage.input) parts.push(`${usage.input.toLocaleString()} in`);
1366 if (usage.output) parts.push(`${usage.output.toLocaleString()} out`);
1367 if (usage.cacheRead) parts.push(`${usage.cacheRead.toLocaleString()} cache`);
1368 if (usage.cost?.total) parts.push(`$${usage.cost.total.toFixed(4)}`);
1369 return parts.join(" · ");
1370}
1371
1372function BashExecutionView({ message, sessionId }: { message: BashExecutionMessage; sessionId?: string }) {
1373 const [fullOutput, setFullOutput] = useState<string | null>(null);

Callers 1

AssistantMessageViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected