Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix: paste image chat input

Faisal Amir9f39f0cdb880
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<HTMLInputElement>
- // When all files are collected, process them
- if (processedCount === imageItems.length) {
- const syntheticEvent = {
- target: {
- files: files,
- },
- } as unknown as React.ChangeEvent<HTMLInputElement>
-
- handleFileChange(syntheticEvent)
- }
+ handleFileChange(syntheticEvent)
}
})
}