small fix, check that dataUrls are valid, when there is only text on the clipboard

This commit is contained in:
dialmedu 2023-11-24 01:57:29 -05:00
parent cfc47ab1f4
commit b59acc0dd0

View File

@ -106,7 +106,9 @@ function ImageUpload({ setReferenceImages }: Props) {
// Convert images to data URLs and set the prompt images state
Promise.all(files.map((file) => fileToDataURL(file)))
.then((dataUrls) => {
setReferenceImages(dataUrls.map((dataUrl) => dataUrl as string));
if(dataUrls.length > 0) {
setReferenceImages(dataUrls.map((dataUrl) => dataUrl as string));
}
})
.catch((error) => {
// TODO: Display error to user