fix: edit msg token length

This commit is contained in:
2023-11-09 13:16:13 +08:00
parent 415b7a02d8
commit 1033298187
3 changed files with 13 additions and 7 deletions

View File

@@ -57,6 +57,7 @@ function EditMessage(props: EditMessageProps) {
if (typeof chat.content === "string") return;
chat.content[index].text = event.target.value;
chat.token = calculate_token_length(chat.content);
console.log("calculated token length", chat.token);
setChatStore({ ...chatStore });
}}
onKeyPress={(event: any) => {
@@ -129,6 +130,7 @@ function EditMessage(props: EditMessageProps) {
const obj = chat.content[index].image_url;
if (obj === undefined) return;
obj.detail = obj.detail === "high" ? "low" : "high";
chat.token = calculate_token_length(chat.content);
setChatStore({ ...chatStore });
}}
>