Skip to content

Commit 9378a4e

Browse files
feat: show dash instead of zero for missing data on evals page (#7748)
Co-authored-by: Roo Code <[email protected]>
1 parent 079b37a commit 9378a4e

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

apps/web-roo-code/src/app/evals/evals.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,13 @@ export function Evals({
129129
<TableRow key={run.id}>
130130
<TableCell title={run.model?.description}>
131131
<div className="font-sans">{run.label}</div>
132-
<div className="text-xs opacity-50">
133-
{formatTokens(run.modelInfo?.contextWindow ?? 0)}
134-
</div>
132+
<div className="text-xs opacity-50">{formatTokens(run.modelInfo?.contextWindow)}</div>
135133
</TableCell>
136134
<TableCell className="border-r">
137135
<div className="flex flex-row gap-2">
138-
<div>{formatCurrency(run.modelInfo?.inputPrice ?? 0)}</div>
136+
<div>{formatCurrency(run.modelInfo?.inputPrice)}</div>
139137
<div className="opacity-25">/</div>
140-
<div>{formatCurrency(run.modelInfo?.outputPrice ?? 0)}</div>
138+
<div>{formatCurrency(run.modelInfo?.outputPrice)}</div>
141139
</div>
142140
</TableCell>
143141
<TableCell className="font-mono">{formatDuration(run.taskMetrics.duration)}</TableCell>

apps/web-roo-code/src/lib/format-currency.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ const formatter = new Intl.NumberFormat("en-US", {
33
currency: "USD",
44
})
55

6-
export const formatCurrency = (amount: number) => formatter.format(amount)
6+
export const formatCurrency = (amount: number | null | undefined) => {
7+
if (amount === null || amount === undefined) {
8+
return "-"
9+
}
10+
return formatter.format(amount)
11+
}
712

813
export const parsePrice = (price?: string) => (price ? parseFloat(price) * 1_000_000 : undefined)

apps/web-roo-code/src/lib/format-duration.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
export const formatDuration = (durationMs: number) => {
1+
export const formatDuration = (durationMs: number | null | undefined) => {
2+
if (durationMs === null || durationMs === undefined) {
3+
return "-"
4+
}
5+
26
const seconds = Math.floor(durationMs / 1000)
37
const hours = Math.floor(seconds / 3600)
48
const minutes = Math.floor((seconds % 3600) / 60)

apps/web-roo-code/src/lib/format-tokens.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
export const formatTokens = (tokens: number, decimals = 0) => {
1+
export const formatTokens = (tokens: number | null | undefined, decimals = 0) => {
2+
if (tokens === null || tokens === undefined) {
3+
return "-"
4+
}
5+
26
if (tokens < 1000) {
37
return tokens.toString()
48
}

0 commit comments

Comments
 (0)