From d4e6e53279ab3cace9ab796fcc45968b7b9decc8 Mon Sep 17 00:00:00 2001 From: BetaHuhn Date: Thu, 31 Aug 2023 16:51:55 +0200 Subject: [PATCH] fix: prompt from previous chat being used for new one --- src/components/Layout.tsx | 1 + src/routes/ChatRoute.tsx | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index d8050d3..32b970e 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -239,6 +239,7 @@ export function Layout() { const item = await detaDB.chats.put({ description: "New Chat", + prompt: null, totalTokens: 0, createdAt: new Date().toISOString(), }, generateKey()) diff --git a/src/routes/ChatRoute.tsx b/src/routes/ChatRoute.tsx index 8c3754a..fdf23d2 100644 --- a/src/routes/ChatRoute.tsx +++ b/src/routes/ChatRoute.tsx @@ -66,8 +66,8 @@ export function ChatRoute() { const { chat, setChat } = useChat() useEffect(() => { - if (chat?.prompt) { - setPromptKey(chat.prompt) + if (chat) { + setPromptKey(chat.prompt ?? null) } }, [chat]);