Skip to content

Commit

Permalink
added fallback for null cost and usage values
Browse files Browse the repository at this point in the history
  • Loading branch information
bekossy committed May 13, 2024
1 parent 638384b commit 6b2c66b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions agenta-web/src/lib/helpers/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ export const formatNumber = (value = 0) => {
}

export const formatCurrency = (value: number) => {
return intlCurrency.format(value)
if (value === null) {
return "-"
} else {
return intlCurrency.format(value)
}
}

export const formatLatency = (value = 0) => {
return `${Math.round(value * 1000)}ms`
}

export const formatTokenUsage = (value: number) => {
if (value === 0) {
if (value === null) {
return "-"
} else {
return value
Expand Down

0 comments on commit 6b2c66b

Please sign in to comment.