fix bug on completion with empty history
This commit is contained in:
@@ -169,9 +169,11 @@ export default function ChatBOX(props: {
|
||||
if (data.usage.prompt_tokens) {
|
||||
const userMessageToken = data.usage.prompt_tokens - aboveToken;
|
||||
console.log("set user message token");
|
||||
if (chatStore.history.filter((msg) => !msg.hide).length > 0) {
|
||||
chatStore.history.filter((msg) => !msg.hide).slice(-1)[0].token =
|
||||
userMessageToken;
|
||||
}
|
||||
}
|
||||
|
||||
chatStore.history.push({
|
||||
role: "assistant",
|
||||
|
||||
Reference in New Issue
Block a user