From 6a7f273682961ec25478f2000e3836aeab029dcc Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Wed, 25 Dec 2024 18:04:13 +0800 Subject: [PATCH] fix: chatStore.cost is null --- src/components/Settings.tsx | 2 +- src/components/StatusBar.tsx | 4 ++-- src/pages/App.tsx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index a99076d..f590220 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -568,7 +568,7 @@ export default (props: { $ USD - {props.chatStore.cost.toFixed(4)} + {props.chatStore.cost?.toFixed(4)} diff --git a/src/components/StatusBar.tsx b/src/components/StatusBar.tsx index 30f52bd..f7ab2b1 100644 --- a/src/components/StatusBar.tsx +++ b/src/components/StatusBar.tsx @@ -59,7 +59,7 @@ const StatusBar = (props: {
  • - Cost: ${chatStore.cost.toFixed(4)} + Cost: ${chatStore.cost?.toFixed(4)}

  • @@ -122,7 +122,7 @@ const StatusBar = (props: {
    Cost
    - ${chatStore.cost.toFixed(4)} + ${chatStore.cost?.toFixed(4)}
    Accumulated: ${getTotalCost().toFixed(2)} diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 6add87f..00519e8 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -338,7 +338,7 @@ export function App() { {chatStore.history.filter(({ hide }) => !hide).length}

    - Cost: ${chatStore.cost.toFixed(4)} / $ + Cost: ${chatStore.cost?.toFixed(4)} / $ {getTotalCost().toFixed(2)}

    @@ -351,7 +351,7 @@ export function App() { {" "} {chatStore.totalTokens} - {chatStore.cost.toFixed(4)} + {chatStore.cost?.toFixed(4)}