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}
setChatStore={setChatStore}
messageIndex={messageIndex}
update_total_tokens={update_total_tokens}
/>
))}
{chatStore.develop_mode && (

View File

@@ -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) {
</div>
{chatStore.develop_mode && (
<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
onClick={() => {
chatStore.history.splice(messageIndex, 1);