Allow Petals and/or OpenAI

This commit is contained in:
Webifi
2023-07-24 15:26:17 -05:00
parent ca19bab19d
commit f6380e1cc2
11 changed files with 139 additions and 64 deletions

View File

@@ -25,11 +25,16 @@
export let lastChatId = persisted('lastChatId', 0)
const chatDefaults = getChatDefaults()
export const getApiKey = (): string => {
return get(apiKeyStorage)
}
export const hasActiveModels = (): boolean => {
const globalSettings = get(globalStorage) || {}
return !!get(apiKeyStorage) || !!globalSettings.enablePetals
}
export const newChatID = (): number => {
const chats = get(chatsStorage)
const chatId = chats.reduce((maxId, chat) => Math.max(maxId, chat.id), 0) + 1