Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

Round request cost totals to cents in prompt reports

Abi Rajabcc497eec8e4
diff --git a/frontend/src/components/evals/PromptReportsPage.tsx b/frontend/src/components/evals/PromptReportsPage.tsx
index 622b0c41..97468729 100644
--- a/frontend/src/components/evals/PromptReportsPage.tsx
+++ b/frontend/src/components/evals/PromptReportsPage.tsx
@@ -86,8 +86,9 @@ function formatTimestamp(isoTimestamp: string): string {
function formatCost(costUsd: number | null): string {
if (costUsd === null) return "—";
+ // Round to cents; flag sub-cent totals so a real cost never reads as $0.00.
if (costUsd > 0 && costUsd < 0.01) return "<$0.01";
- return `$${costUsd.toFixed(costUsd < 1 ? 4 : 2)}`;
+ return `$${costUsd.toFixed(2)}`;
}
function groupBySession(reports: PromptReportSummary[]): SessionGroup[] {