-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
See components/chat/Chat.tsx:
useEffect(() => {
// TODO: HANDLE DATABASE ERRORS.
const fetchMessages = async () => {
const msgs = await db.history.readAll()
setMessages(msgs.map(msg => ({
role : msg.role,
content : msg.content
} as Message)))
setIsTyping(false)
}
const fetchKey = async () => {
const keys = await db.keys.readAll()
if (keys.length === 0) {
// TODO: SHOW DIALOG
return
}
setClient(new OpenAI({
baseURL: "https://openrouter.ai/api/v1",
dangerouslyAllowBrowser: true,
apiKey: keys[0].key_hash,
}))
}
fetchMessages()
fetchKey()
}, [])We want to implement error messages whenever the app fails to fetch from the database. There are examples of how to do this in:
/components/DatabaseProvider.tsx(line 42) -- this one handles custom error messages./components/editor/Editor.tsx(line 96)/components/chat/Settings.tsx(line 30)
Metadata
Metadata
Assignees
Labels
No labels