fix: paste image chat input

This commit is contained in:
Faisal Amir 2025-08-15 22:33:21 +07:00
parent 050d38c0ab
commit 9f39f0cdb8

View File

@ -350,10 +350,11 @@ const ChatInput = ({ model, className, initialMessage }: ChatInputProps) => {
const file = item.getAsFile()
if (file) {
files.push(file)
}
processedCount++
// When all files are collected, process them
if (processedCount === imageItems.length) {
// When all items are processed, handle the valid files
if (processedCount === imageItems.length && files.length > 0) {
const syntheticEvent = {
target: {
files: files,
@ -362,7 +363,6 @@ const ChatInput = ({ model, className, initialMessage }: ChatInputProps) => {
handleFileChange(syntheticEvent)
}
}
})
}
}