feat: Ability to send image without text
This commit is contained in:
parent
fd654cafdb
commit
977723f71f
@ -159,7 +159,7 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
stopListening()
|
stopListening()
|
||||||
form.onSubmit(async (value) => {
|
form.onSubmit(async (value) => {
|
||||||
if (value.message.trim().length === 0) {
|
if (value.message.trim().length === 0 && value.image.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!selectedModel || selectedModel.length === 0) {
|
if (!selectedModel || selectedModel.length === 0) {
|
||||||
@ -228,6 +228,9 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (value.message.trim().length === 0 && value.image.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
form.reset()
|
form.reset()
|
||||||
textAreaFocus()
|
textAreaFocus()
|
||||||
await sendMessage({
|
await sendMessage({
|
||||||
@ -261,7 +264,6 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
|
|||||||
onKeyDown={(e) => handleKeyDown(e)}
|
onKeyDown={(e) => handleKeyDown(e)}
|
||||||
ref={textareaRef}
|
ref={textareaRef}
|
||||||
className="px-2 py-2 w-full resize-none bg-transparent focus-within:outline-none focus:ring-0 focus-visible:ring-0 ring-0 dark:ring-0 border-0 dark:text-gray-100"
|
className="px-2 py-2 w-full resize-none bg-transparent focus-within:outline-none focus:ring-0 focus-visible:ring-0 ring-0 dark:ring-0 border-0 dark:text-gray-100"
|
||||||
required
|
|
||||||
onPaste={handlePaste}
|
onPaste={handlePaste}
|
||||||
rows={1}
|
rows={1}
|
||||||
style={{ minHeight: "40px" }}
|
style={{ minHeight: "40px" }}
|
||||||
@ -409,4 +411,4 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -75,10 +75,10 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
|
|||||||
) {
|
) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
form.onSubmit(async (value) => {
|
form.onSubmit(async (value) => {
|
||||||
await stopListening()
|
if (value.message.trim().length === 0 && value.image.length === 0) {
|
||||||
if (value.message.trim().length === 0) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
await stopListening()
|
||||||
if (!selectedModel || selectedModel.length === 0) {
|
if (!selectedModel || selectedModel.length === 0) {
|
||||||
form.setFieldError("message", t("formError.noModel"))
|
form.setFieldError("message", t("formError.noModel"))
|
||||||
return
|
return
|
||||||
@ -237,6 +237,9 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await stopListening()
|
await stopListening()
|
||||||
|
if (value.message.trim().length === 0 && value.image.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
form.reset()
|
form.reset()
|
||||||
textAreaFocus()
|
textAreaFocus()
|
||||||
await sendMessage({
|
await sendMessage({
|
||||||
@ -260,7 +263,6 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
|
|||||||
onKeyDown={(e) => handleKeyDown(e)}
|
onKeyDown={(e) => handleKeyDown(e)}
|
||||||
ref={textareaRef}
|
ref={textareaRef}
|
||||||
className="px-2 py-2 w-full resize-none bg-transparent focus-within:outline-none focus:ring-0 focus-visible:ring-0 ring-0 dark:ring-0 border-0 dark:text-gray-100"
|
className="px-2 py-2 w-full resize-none bg-transparent focus-within:outline-none focus:ring-0 focus-visible:ring-0 ring-0 dark:ring-0 border-0 dark:text-gray-100"
|
||||||
required
|
|
||||||
onPaste={handlePaste}
|
onPaste={handlePaste}
|
||||||
rows={1}
|
rows={1}
|
||||||
style={{ minHeight: "60px" }}
|
style={{ minHeight: "60px" }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user