From 5f0481fecefffb4af45b1a862b18711f44840429 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Thu, 27 Jul 2023 10:26:55 +0800 Subject: [PATCH] fix re-generate only delete assistant message --- src/chatbox.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/chatbox.tsx b/src/chatbox.tsx index cfae0ba..9f9a9df 100644 --- a/src/chatbox.tsx +++ b/src/chatbox.tsx @@ -460,7 +460,9 @@ export default function ChatBOX(props: { disabled={showGenerating || !chatStore.apiKey} onClick={async () => { const messageIndex = chatStore.history.length - 1; - chatStore.history[messageIndex].hide = true; + if (chatStore.history[messageIndex].role === "assistant") { + chatStore.history[messageIndex].hide = true; + } //chatStore.totalTokens = update_total_tokens();