mirror of
https://github.com/open-webui/open-webui
synced 2025-03-24 22:49:22 +00:00
refac
This commit is contained in:
parent
92dd173b27
commit
1d8b3b8c51
src/lib/components
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
</script>
|
||||
|
||||
{#if file}
|
||||
<FileItemModal bind:show={showModal} {file} />
|
||||
<FileItemModal bind:show={showModal} bind:file />
|
||||
{/if}
|
||||
|
||||
<div class="relative group">
|
||||
|
Loading…
Reference in New Issue
Block a user