remove: update_total_token()
All checks were successful
Build static content / build (push) Successful in 8m10s

This commit is contained in:
2024-10-15 18:19:51 +08:00
parent a763355420
commit 6aca74a7b4
4 changed files with 11 additions and 24 deletions

View File

@@ -81,6 +81,16 @@ export function App() {
console.log("saved chat", selectedChatIndex, chatStore);
(await db).put(STORAGE_NAME, chatStore, selectedChatIndex);
// update total tokens
chatStore.totalTokens = calculate_token_length(
chatStore.systemMessageContent,
);
for (const msg of chatStore.history
.filter(({ hide }) => !hide)
.slice(chatStore.postBeginIndex)) {
chatStore.totalTokens += msg.token;
}
_setChatStore(chatStore);
};
useEffect(() => {