feat: show dash instead of zero for missing data on evals page (#7748)

Co-authored-by: Roo Code <roomote@roocode.com>
This commit is contained in:
roomote[bot] 2025-09-06 17:15:10 -04:00 committed by GitHub
parent 079b37a85d
commit 9378a4e2ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 8 deletions

View file

@ -129,15 +129,13 @@ export function Evals({
<TableRow key={run.id}>
<TableCell title={run.model?.description}>
<div className="font-sans">{run.label}</div>
<div className="text-xs opacity-50">
{formatTokens(run.modelInfo?.contextWindow ?? 0)}
</div>
<div className="text-xs opacity-50">{formatTokens(run.modelInfo?.contextWindow)}</div>
</TableCell>
<TableCell className="border-r">
<div className="flex flex-row gap-2">
<div>{formatCurrency(run.modelInfo?.inputPrice ?? 0)}</div>
<div>{formatCurrency(run.modelInfo?.inputPrice)}</div>
<div className="opacity-25">/</div>
<div>{formatCurrency(run.modelInfo?.outputPrice ?? 0)}</div>
<div>{formatCurrency(run.modelInfo?.outputPrice)}</div>
</div>
</TableCell>
<TableCell className="font-mono">{formatDuration(run.taskMetrics.duration)}</TableCell>

View file

@ -3,6 +3,11 @@ const formatter = new Intl.NumberFormat("en-US", {
currency: "USD",
})
export const formatCurrency = (amount: number) => formatter.format(amount)
export const formatCurrency = (amount: number | null | undefined) => {
if (amount === null || amount === undefined) {
return "-"
}
return formatter.format(amount)
}
export const parsePrice = (price?: string) => (price ? parseFloat(price) * 1_000_000 : undefined)

View file

@ -1,4 +1,8 @@
export const formatDuration = (durationMs: number) => {
export const formatDuration = (durationMs: number | null | undefined) => {
if (durationMs === null || durationMs === undefined) {
return "-"
}
const seconds = Math.floor(durationMs / 1000)
const hours = Math.floor(seconds / 3600)
const minutes = Math.floor((seconds % 3600) / 60)

View file

@ -1,4 +1,8 @@
export const formatTokens = (tokens: number, decimals = 0) => {
export const formatTokens = (tokens: number | null | undefined, decimals = 0) => {
if (tokens === null || tokens === undefined) {
return "-"
}
if (tokens < 1000) {
return tokens.toString()
}