Skip to content

Commit

Permalink
fix tokens calculation in sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
kavinvalli committed Sep 27, 2024
1 parent f351a86 commit 4593bfb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ const SessionContentV2: React.FC<SessionContentV2Props> = ({
.filter((user) => user !== "" && user != null)}
models={session.traces.map((trace) => trace.request.model ?? "")}
promptTokens={session.traces.reduce(
(acc, trace) => acc + (trace?.request?.promptTokens || 0),
(acc, trace) =>
acc + (parseInt(`${trace?.request?.promptTokens}`) || 0),
0
)}
completionTokens={session.traces.reduce(
(acc, trace) => acc + (trace?.request?.promptTokens || 0),
(acc, trace) =>
acc + (parseInt(`${trace?.request?.completionTokens}`) || 0),
0
)}
sessionId={session_id as string}
Expand Down
6 changes: 5 additions & 1 deletion web/components/templates/sessions/sessionId/breadCrumbV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ export const BreadCrumbV2 = ({

<HoverCard>
<HoverCardTrigger>
<InfoIcon width={16} height={16} className="text-slate-500" />
<InfoIcon
width={16}
height={16}
className="text-slate-500 cursor-pointer"
/>
</HoverCardTrigger>
<HoverCardContent
align="start"
Expand Down

0 comments on commit 4593bfb

Please sign in to comment.