fix: chatStore.cost is null

This commit is contained in:
2024-12-25 18:04:13 +08:00
parent 60b1481dab
commit 6a7f273682
3 changed files with 5 additions and 5 deletions

View File

@@ -568,7 +568,7 @@ export default (props: {
$ USD $ USD
</span> </span>
<span className="text-lg font-bold leading-none sm:text-3xl"> <span className="text-lg font-bold leading-none sm:text-3xl">
{props.chatStore.cost.toFixed(4)} {props.chatStore.cost?.toFixed(4)}
</span> </span>
</div> </div>
</div> </div>

View File

@@ -59,7 +59,7 @@ const StatusBar = (props: {
<li> <li>
<p> <p>
<BanknotesIcon className="h-4 w-4" /> <BanknotesIcon className="h-4 w-4" />
Cost: ${chatStore.cost.toFixed(4)} Cost: ${chatStore.cost?.toFixed(4)}
</p> </p>
</li> </li>
</ul> </ul>
@@ -122,7 +122,7 @@ const StatusBar = (props: {
</div> </div>
<div className="stat-title">Cost</div> <div className="stat-title">Cost</div>
<div className="stat-value text-base"> <div className="stat-value text-base">
${chatStore.cost.toFixed(4)} ${chatStore.cost?.toFixed(4)}
</div> </div>
<div className="stat-desc"> <div className="stat-desc">
Accumulated: ${getTotalCost().toFixed(2)} Accumulated: ${getTotalCost().toFixed(2)}

View File

@@ -338,7 +338,7 @@ export function App() {
{chatStore.history.filter(({ hide }) => !hide).length} {chatStore.history.filter(({ hide }) => !hide).length}
</p> </p>
<p> <p>
Cost: ${chatStore.cost.toFixed(4)} / $ Cost: ${chatStore.cost?.toFixed(4)} / $
{getTotalCost().toFixed(2)} {getTotalCost().toFixed(2)}
</p> </p>
</PopoverContent> </PopoverContent>
@@ -351,7 +351,7 @@ export function App() {
<WholeWordIcon className="w-4 h-4 mr-2" />{" "} <WholeWordIcon className="w-4 h-4 mr-2" />{" "}
{chatStore.totalTokens} {chatStore.totalTokens}
<CircleDollarSignIcon className="w-4 h-4 mx-2" /> <CircleDollarSignIcon className="w-4 h-4 mx-2" />
{chatStore.cost.toFixed(4)} {chatStore.cost?.toFixed(4)}
</MenubarTrigger> </MenubarTrigger>
<MenubarContent> <MenubarContent>
<MenubarItem> <MenubarItem>