Move chat state values out of settings

This commit is contained in:
Webifi
2023-05-28 15:54:45 -05:00
parent bf00f23596
commit c436fc6299
4 changed files with 21 additions and 25 deletions

View File

@@ -30,7 +30,9 @@
name: `Chat ${chatId}`,
settings: {} as ChatSettings,
messages: [],
usage: {} as Record<Model, Usage>
usage: {} as Record<Model, Usage>,
startSession: false,
sessionStarted: false,
})
chatsStorage.set(chats)
// Apply defaults and prepare it to start
@@ -90,6 +92,8 @@
const usageMap:Record<Model, Usage> = {}
chat.usage = usageMap
}
if (chat.startSession === undefined) chat.startSession = false
if (chat.sessionStarted === undefined) chat.sessionStarted = !!chat.messages.find(m => m.role === 'user')
chatsStorage.set(chats)
}