Skip to content

Commit cebb286

Browse files
committed
Merge main
2 parents 3bfe2b3 + 9378a4e commit cebb286

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ export function Evals({ runs }: { runs: EvalRun[] }) {
103103
<TableRow key={run.id}>
104104
<TableCell title={run.description ?? undefined}>
105105
<div className="font-sans">{run.label}</div>
106-
<div className="text-xs opacity-50">{formatTokens(run.contextWindow ?? 0)}</div>
106+
<div className="text-xs opacity-50">{formatTokens(run.contextWindow)}</div>
107107
</TableCell>
108108
<TableCell className="border-r">
109109
<div className="flex flex-row gap-2">
110-
<div>{formatCurrency(run.inputPrice ?? 0)}</div>
110+
<div>{formatCurrency(run.inputPrice)}</div>
111111
<div className="opacity-25">/</div>
112-
<div>{formatCurrency(run.outputPrice ?? 0)}</div>
112+
<div>{formatCurrency(run.outputPrice)}</div>
113113
</div>
114114
</TableCell>
115115
<TableCell className="font-mono">{formatDuration(run.taskMetrics.duration)}</TableCell>

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ 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+
11+
return formatter.format(amount)
12+
}
713

814
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)