Skip to content

Commit

Permalink
ui(navbar): improve cost breakdown clarity and add accumulated cost t…
Browse files Browse the repository at this point in the history
…racking
  • Loading branch information
heimoshuiyu committed Feb 7, 2025
1 parent 6bf80d8 commit bac80f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
13 changes: 11 additions & 2 deletions src/components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,22 @@ const Navbar: React.FC = () => {
<div className="flex items-center gap-2">
<ReceiptIcon className="w-4 h-4" />
<span className="text-sm font-medium">
Generated Tokens: {chatStore.totalTokens.toString()}
Total Tokens: {chatStore.totalTokens.toString()}
</span>
</div>
<div className="flex items-center gap-2">
<WalletIcon className="w-4 h-4" />
<span className="text-sm font-medium">
Cost: ${getTotalCost().toFixed(2)}
Session Cost: ${chatStore.cost.toFixed(2)}
</span>
</div>
</div>
<div className="flex justify-between items-center px-4 py-2 border-b">
<div></div>
<div className="flex items-center gap-2">
<WalletIcon className="w-4 h-4" />
<span className="text-sm font-medium">
Accumulated Cost: ${getTotalCost().toFixed(2)}
</span>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Chatbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,8 @@ export default function ChatBOX() {
</Button>
)}
</p>
<p className="p-2 my-2 text-center opacity-50 dark:text-white">
{chatStore.postBeginIndex !== 0 && (
{chatStore.postBeginIndex !== 0 && (
<p className="p-2 my-2 text-center opacity-50 dark:text-white">
<Alert variant="default">
<InfoIcon className="h-4 w-4" />
<AlertTitle>{Tr("Chat History Notice")}</AlertTitle>
Expand All @@ -597,8 +597,8 @@ export default function ChatBOX() {
{chatStore.postBeginIndex}
</AlertDescription>
</Alert>
)}
</p>
</p>
)}
<VersionHint />
{showRetry && (
<p className="text-right p-2 my-2 dark:text-white">
Expand Down

0 comments on commit bac80f3

Please sign in to comment.