From 711b9d48a128ed339af6652571e7debfe8e08e4d Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Tue, 14 Mar 2023 22:14:10 +0800 Subject: [PATCH] fix delete 1 chat --- src/app.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app.tsx b/src/app.tsx index 84a6588..919eaea 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -181,13 +181,16 @@ export function App() { if (!confirm("Are you sure you want to delete this chat history?")) return; const oldAPIkey = allChatStore[selectedChatIndex].apiKey; + const oldSystemMessageContent = + allChatStore[selectedChatIndex].systemMessageContent; + const oldAPIEndpoint = allChatStore[selectedChatIndex].apiEndpoint; allChatStore.splice(selectedChatIndex, 1); if (allChatStore.length === 0) { allChatStore.push( newChatStore( - oldAPIkey, - allChatStore[selectedChatIndex].systemMessageContent, - allChatStore[selectedChatIndex].apiEndpoint + defaultAPIKEY() || oldAPIkey, + defaultSysMessage() || oldSystemMessageContent, + defaultAPIEndpoint() || oldAPIEndpoint ) ); setSelectedChatIndex(0);