fix: Do not send empty messages. (#66)

This commit is contained in:
Jared Palmer 2023-06-21 08:04:49 -07:00 committed by GitHub
commit 255ce6394e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,7 +15,7 @@ import { IconArrowElbow, IconPlus } from '@/components/ui/icons'
export interface PromptProps
extends Pick<UseChatHelpers, 'input' | 'setInput'> {
onSubmit: (value: string) => void
onSubmit: (value: string) => Promise<void>
isLoading: boolean
}
@ -38,7 +38,7 @@ export function PromptForm({
<form
onSubmit={async e => {
e.preventDefault()
if (input === '') {
if (!input?.trim()) {
return
}
setInput('')