From 9f39f0cdb880a4d9e59a4b78be19b21c8312b095 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Fri, 15 Aug 2025 22:33:21 +0700 Subject: [PATCH] fix: paste image chat input --- web-app/src/containers/ChatInput.tsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/web-app/src/containers/ChatInput.tsx b/web-app/src/containers/ChatInput.tsx index 8476aca77..18b37980b 100644 --- a/web-app/src/containers/ChatInput.tsx +++ b/web-app/src/containers/ChatInput.tsx @@ -350,18 +350,18 @@ const ChatInput = ({ model, className, initialMessage }: ChatInputProps) => { const file = item.getAsFile() if (file) { files.push(file) - processedCount++ + } + processedCount++ + + // When all items are processed, handle the valid files + if (processedCount === imageItems.length && files.length > 0) { + const syntheticEvent = { + target: { + files: files, + }, + } as unknown as React.ChangeEvent - // When all files are collected, process them - if (processedCount === imageItems.length) { - const syntheticEvent = { - target: { - files: files, - }, - } as unknown as React.ChangeEvent - - handleFileChange(syntheticEvent) - } + handleFileChange(syntheticEvent) } }) }