From 86699511df6df0c49a0cdb56300eb2f6e5461e45 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Sat, 8 Jul 2023 14:23:56 +0800 Subject: [PATCH] edit message token --- src/chatbox.tsx | 1 + src/message.tsx | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/chatbox.tsx b/src/chatbox.tsx index 65a1a13..e5f3ec1 100644 --- a/src/chatbox.tsx +++ b/src/chatbox.tsx @@ -346,6 +346,7 @@ export default function ChatBOX(props: { chatStore={chatStore} setChatStore={setChatStore} messageIndex={messageIndex} + update_total_tokens={update_total_tokens} /> ))} {chatStore.develop_mode && ( diff --git a/src/message.tsx b/src/message.tsx index 8c99740..d85b854 100644 --- a/src/message.tsx +++ b/src/message.tsx @@ -6,6 +6,7 @@ interface Props { messageIndex: number; chatStore: ChatStore; setChatStore: (cs: ChatStore) => void; + update_total_tokens: () => void; } export default function Message(props: Props) { const { chatStore, messageIndex, setChatStore } = props; @@ -70,7 +71,16 @@ export default function Message(props: Props) { {chatStore.develop_mode && (
- token {chatStore.history[messageIndex].token} + token{" "} + { + chat.token = parseInt(event.target.value); + props.update_total_tokens(); + setChatStore({ ...chatStore }); + }} + />