Skip to content

Commit

Permalink
Refactor ChatPanel component to handle form submission errors
Browse files Browse the repository at this point in the history
  • Loading branch information
miurla committed Oct 26, 2024
1 parent aaa61e4 commit 4db6c33
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/chat-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { ModelSelector } from './model-selector'
import { models } from '@/lib/types/models'
import { useLocalStorage } from '@/lib/hooks/use-local-storage'
import { getDefaultModelId } from '@/lib/utils'
import { toast } from 'sonner'

interface ChatPanelProps {
messages: UIState
Expand Down Expand Up @@ -88,6 +89,9 @@ export function ChatPanel({ messages, query, onModelChange }: ChatPanelProps) {
await handleQuerySubmit(input, formData)
} catch (error) {
console.error('Error submitting form:', error)
toast.error('Error: ' + error)

handleClear()
}
}

Expand Down

0 comments on commit 4db6c33

Please sign in to comment.