fix: prompt from previous chat being used for new one

This commit is contained in:
BetaHuhn 2023-08-31 16:51:55 +02:00
parent cee5664bc7
commit d4e6e53279
2 changed files with 3 additions and 2 deletions

View file

@ -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())

View file

@ -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]);