mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 13:40:55 +00:00
feat: bulk document upload
This commit is contained in:
parent
7f3ba3d2ac
commit
0682a4a361
@ -89,20 +89,19 @@
|
|||||||
const inputFiles = e.dataTransfer?.files;
|
const inputFiles = e.dataTransfer?.files;
|
||||||
|
|
||||||
if (inputFiles && inputFiles.length > 0) {
|
if (inputFiles && inputFiles.length > 0) {
|
||||||
const file = inputFiles[0];
|
for (const file of inputFiles) {
|
||||||
console.log(file, file.name.split('.').at(-1));
|
console.log(file, file.name.split('.').at(-1));
|
||||||
if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) {
|
if (
|
||||||
reader.readAsDataURL(file);
|
SUPPORTED_FILE_TYPE.includes(file['type']) ||
|
||||||
} else if (
|
SUPPORTED_FILE_EXTENSIONS.includes(file.name.split('.').at(-1))
|
||||||
SUPPORTED_FILE_TYPE.includes(file['type']) ||
|
) {
|
||||||
SUPPORTED_FILE_EXTENSIONS.includes(file.name.split('.').at(-1))
|
uploadDoc(file);
|
||||||
) {
|
} else {
|
||||||
uploadDoc(file);
|
toast.error(
|
||||||
} else {
|
`Unknown File Type '${file['type']}', but accepting and treating as plain text`
|
||||||
toast.error(
|
);
|
||||||
`Unknown File Type '${file['type']}', but accepting and treating as plain text`
|
uploadDoc(file);
|
||||||
);
|
}
|
||||||
uploadDoc(file);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toast.error(`File not found.`);
|
toast.error(`File not found.`);
|
||||||
@ -153,20 +152,23 @@
|
|||||||
id="upload-doc-input"
|
id="upload-doc-input"
|
||||||
bind:files={inputFiles}
|
bind:files={inputFiles}
|
||||||
type="file"
|
type="file"
|
||||||
|
multiple
|
||||||
hidden
|
hidden
|
||||||
on:change={async (e) => {
|
on:change={async (e) => {
|
||||||
if (inputFiles && inputFiles.length > 0) {
|
if (inputFiles && inputFiles.length > 0) {
|
||||||
const file = inputFiles[0];
|
for (const file of inputFiles) {
|
||||||
if (
|
console.log(file, file.name.split('.').at(-1));
|
||||||
SUPPORTED_FILE_TYPE.includes(file['type']) ||
|
if (
|
||||||
SUPPORTED_FILE_EXTENSIONS.includes(file.name.split('.').at(-1))
|
SUPPORTED_FILE_TYPE.includes(file['type']) ||
|
||||||
) {
|
SUPPORTED_FILE_EXTENSIONS.includes(file.name.split('.').at(-1))
|
||||||
uploadDoc(file);
|
) {
|
||||||
} else {
|
uploadDoc(file);
|
||||||
toast.error(
|
} else {
|
||||||
`Unknown File Type '${file['type']}', but accepting and treating as plain text`
|
toast.error(
|
||||||
);
|
`Unknown File Type '${file['type']}', but accepting and treating as plain text`
|
||||||
uploadDoc(file);
|
);
|
||||||
|
uploadDoc(file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inputFiles = null;
|
inputFiles = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user