diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte
index f60f0ede3..066272e43 100644
--- a/src/lib/components/chat/Chat.svelte
+++ b/src/lib/components/chat/Chat.svelte
@@ -700,7 +700,7 @@
childrenIds: [],
role: 'user',
content: userPrompt,
- files: _files.length > 0 ? _files : undefined,
+ files: chatFiles.length > 0 ? chatFiles : undefined,
timestamp: Math.floor(Date.now() / 1000), // Unix epoch
models: selectedModels
};
@@ -947,6 +947,12 @@
...(responseMessage?.files ?? []).filter((item) => ['web_search_results'].includes(item.type))
);
+ // Remove duplicates
+ files = files.filter(
+ (item, index, array) =>
+ array.findIndex((i) => JSON.stringify(i) === JSON.stringify(item)) === index
+ );
+
scrollToBottom();
eventTarget.dispatchEvent(
@@ -1246,6 +1252,11 @@
),
...(responseMessage?.files ?? []).filter((item) => ['web_search_results'].includes(item.type))
);
+ // Remove duplicates
+ files = files.filter(
+ (item, index, array) =>
+ array.findIndex((i) => JSON.stringify(i) === JSON.stringify(item)) === index
+ );
scrollToBottom();
diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte
index b93468470..1694ad44b 100644
--- a/src/lib/components/chat/MessageInput.svelte
+++ b/src/lib/components/chat/MessageInput.svelte
@@ -133,21 +133,8 @@
fileItem.id = uploadedFile.id;
fileItem.url = `${WEBUI_API_BASE_URL}/files/${uploadedFile.id}`;
- // TODO: Check if tools & functions have files support to skip this step to delegate file processing
- // Default Upload to VectorDB
- if (
- SUPPORTED_FILE_TYPE.includes(file['type']) ||
- SUPPORTED_FILE_EXTENSIONS.includes(file.name.split('.').at(-1))
- ) {
- processFileItem(fileItem);
- } else {
- toast.error(
- $i18n.t(`Unknown file type '{{file_type}}'. Proceeding with the file upload anyway.`, {
- file_type: file['type']
- })
- );
- processFileItem(fileItem);
- }
+ // Try to extract content of the file for retrieval, even non-supported file types
+ processFileItem(fileItem);
} else {
files = files.filter((item) => item.status !== null);
}
diff --git a/src/lib/components/common/FileItem.svelte b/src/lib/components/common/FileItem.svelte
index b86a2d37a..2dea203d5 100644
--- a/src/lib/components/common/FileItem.svelte
+++ b/src/lib/components/common/FileItem.svelte
@@ -25,7 +25,7 @@
{#if file}
-