Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
97d68a6a
Commit
97d68a6a
authored
Apr 20, 2024
by
Timothy J. Baek
Browse files
feat: multiple files input
Co-Authored-By:
Entaigner
<
61445450+entaigner@users.noreply.github.com
>
parent
cd79afb4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
38 deletions
+42
-38
src/lib/components/chat/MessageInput.svelte
src/lib/components/chat/MessageInput.svelte
+42
-38
No files found.
src/lib/components/chat/MessageInput.svelte
View file @
97d68a6a
...
...
@@ -328,10 +328,10 @@
];
};
const inputFiles = e.dataTransfer?.files;
const inputFiles =
Array.from(
e.dataTransfer?.files
)
;
if (inputFiles && inputFiles.length > 0) {
const file = inputFiles[0];
inputFiles.forEach((file) => {
console.log(file, file.name.split('.').at(-1));
if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) {
reader.readAsDataURL(file);
...
...
@@ -349,6 +349,7 @@
);
uploadDoc(file);
}
});
} else {
toast.error($i18n.t(`File not found.`));
}
...
...
@@ -467,6 +468,7 @@
bind:files={inputFiles}
type="file"
hidden
multiple
on:change={async () => {
let reader = new FileReader();
reader.onload = (event) => {
...
...
@@ -482,7 +484,8 @@
};
if (inputFiles && inputFiles.length > 0) {
const file = inputFiles[0];
const _inputFiles = Array.from(inputFiles);
_inputFiles.forEach((file) => {
if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) {
reader.readAsDataURL(file);
} else if (
...
...
@@ -501,6 +504,7 @@
uploadDoc(file);
filesInputElement.value = '';
}
});
} else {
toast.error($i18n.t(`File not found.`));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment