Skip to content

Commit

Permalink
chore(logs): do not show time until last message if it is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
geclos committed Nov 11, 2024
1 parent d305e7c commit 57d66c1
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ function ProviderLogsMetadata({
) ?? {},
[providerLogs],
)
const duration = useMemo(() => {
const timeInMs = (documentLog.duration ?? 0) - (providerLog.duration ?? 0)
if (timeInMs <= 0) return

return formatDuration(timeInMs)
}, [documentLog.duration, providerLog.duration])

return (
<>
Expand Down Expand Up @@ -139,12 +145,10 @@ function ProviderLogsMetadata({
) : (
<MetadataItem label='Cost' value='-' />
)}
{(providerLogs?.length ?? 0) > 0 && (
{duration && (
<MetadataItem
label='Time until last message'
value={formatDuration(
(documentLog.duration ?? 0) - (providerLog.duration ?? 0),
)}
value={duration}
loading={providersLoading}
/>
)}
Expand Down

0 comments on commit 57d66c1

Please sign in to comment.