Skip to content

Commit

Permalink
Fix Supabase query error
Browse files Browse the repository at this point in the history
Resolved an issue with the Supabase query that resulted in a 406 error when attempting to fetch conversation context. The error indicated that the result contained 0 rows, which caused the request to fail. Adjustments were made to ensure proper handling of cases where no rows are returned.
[skip gpt_engineer]
  • Loading branch information
lovable-dev[bot] committed Dec 22, 2024
1 parent affd3f5 commit f1e0f1e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/hooks/chat/useConversationContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ export const useConversationContext = (userId: string | null) => {
.from('conversation_contexts')
.select('context')
.eq('conversation_id', conversationId)
.single()
.maybeSingle()

if (!error && data) {
setConversationContext(data.context)
} else {
// If no context exists yet, start with an empty context
setConversationContext("")
}
}

Expand Down

0 comments on commit f1e0f1e

Please sign in to comment.