Skip to content

Commit affc11a

Browse files
committed
feat: fallback to deriving cost from messages rather than defaulting to 0
1 parent 96212fa commit affc11a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • packages/opencode/src/cli/cmd/tui/routes/session

‎packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function Sidebar(props: { sessionID: string; overlay?: boolean }) {
4141
)
4242

4343
const cost = createMemo(() => {
44-
const total = session().cost ?? 0
44+
const total = session().cost ?? messages().reduce((sum, x) => sum + (x.role === "assistant" ? x.cost : 0), 0)
4545
return new Intl.NumberFormat("en-US", {
4646
style: "currency",
4747
currency: "USD",

0 commit comments

Comments
 (0)