From feecd6582da4b411f9f9f4d49a443ee24c07d917 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Sat, 8 Jul 2023 14:45:21 +0800 Subject: [PATCH] esgimate token length after editing --- src/message.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/message.tsx b/src/message.tsx index f46da2b..36b1790 100644 --- a/src/message.tsx +++ b/src/message.tsx @@ -74,7 +74,7 @@ export default function Message(props: Props) { token{" "} { chat.token = parseInt(event.target.value); props.update_total_tokens(); @@ -113,6 +113,7 @@ export default function Message(props: Props) { value={chat.content} onChange={(event: any) => { chat.content = event.target.value; + chat.token = calculate_token_length(chat.content); setChatStore({ ...chatStore }); }} >