edit message token

This commit is contained in:
2023-07-08 14:23:56 +08:00
parent e2f78987a3
commit 86699511df
2 changed files with 12 additions and 1 deletions

View File

@@ -346,6 +346,7 @@ export default function ChatBOX(props: {
chatStore={chatStore} chatStore={chatStore}
setChatStore={setChatStore} setChatStore={setChatStore}
messageIndex={messageIndex} messageIndex={messageIndex}
update_total_tokens={update_total_tokens}
/> />
))} ))}
{chatStore.develop_mode && ( {chatStore.develop_mode && (

View File

@@ -6,6 +6,7 @@ interface Props {
messageIndex: number; messageIndex: number;
chatStore: ChatStore; chatStore: ChatStore;
setChatStore: (cs: ChatStore) => void; setChatStore: (cs: ChatStore) => void;
update_total_tokens: () => void;
} }
export default function Message(props: Props) { export default function Message(props: Props) {
const { chatStore, messageIndex, setChatStore } = props; const { chatStore, messageIndex, setChatStore } = props;
@@ -70,7 +71,16 @@ export default function Message(props: Props) {
</div> </div>
{chatStore.develop_mode && ( {chatStore.develop_mode && (
<div> <div>
token {chatStore.history[messageIndex].token} token{" "}
<input
value={chat.token}
className='w-20'
onChange={(event: any) => {
chat.token = parseInt(event.target.value);
props.update_total_tokens();
setChatStore({ ...chatStore });
}}
/>
<button <button
onClick={() => { onClick={() => {
chatStore.history.splice(messageIndex, 1); chatStore.history.splice(messageIndex, 1);