From c5f13cfdda360a86f438da07eb173fb219e31a83 Mon Sep 17 00:00:00 2001 From: Yanyutin753 <132346501+Yanyutin753@users.noreply.github.com> Date: Sun, 19 May 2024 19:10:00 +0800 Subject: [PATCH] =?UTF-8?q?=E2=AD=90=20Expend=20upload=20image=20file=20ty?= =?UTF-8?q?pes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/components/chat/MessageInput.svelte | 4 ++-- src/lib/components/chat/Settings/Account.svelte | 2 +- src/routes/(app)/workspace/modelfiles/create/+page.svelte | 2 +- src/routes/(app)/workspace/modelfiles/edit/+page.svelte | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index f8050030a..543b196f5 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -357,7 +357,7 @@ if (inputFiles && inputFiles.length > 0) { inputFiles.forEach((file) => { console.log(file, file.name.split('.').at(-1)); - if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) { + if (['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(file['type'])) { let reader = new FileReader(); reader.onload = (event) => { files = [ @@ -547,7 +547,7 @@ if (inputFiles && inputFiles.length > 0) { const _inputFiles = Array.from(inputFiles); _inputFiles.forEach((file) => { - if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) { + if (['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(file['type'])) { let reader = new FileReader(); reader.onload = (event) => { files = [ diff --git a/src/lib/components/chat/Settings/Account.svelte b/src/lib/components/chat/Settings/Account.svelte index 978c1b9b6..4b02f082c 100644 --- a/src/lib/components/chat/Settings/Account.svelte +++ b/src/lib/components/chat/Settings/Account.svelte @@ -127,7 +127,7 @@ if ( files.length > 0 && - ['image/gif', 'image/jpeg', 'image/png'].includes(files[0]['type']) + ['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(files[0]['type']) ) { reader.readAsDataURL(files[0]); } diff --git a/src/routes/(app)/workspace/modelfiles/create/+page.svelte b/src/routes/(app)/workspace/modelfiles/create/+page.svelte index c1356d406..f7fe523a0 100644 --- a/src/routes/(app)/workspace/modelfiles/create/+page.svelte +++ b/src/routes/(app)/workspace/modelfiles/create/+page.svelte @@ -339,7 +339,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); if ( inputFiles && inputFiles.length > 0 && - ['image/gif', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type']) + ['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type']) ) { reader.readAsDataURL(inputFiles[0]); } else { diff --git a/src/routes/(app)/workspace/modelfiles/edit/+page.svelte b/src/routes/(app)/workspace/modelfiles/edit/+page.svelte index 272c07736..d2f0a1c10 100644 --- a/src/routes/(app)/workspace/modelfiles/edit/+page.svelte +++ b/src/routes/(app)/workspace/modelfiles/edit/+page.svelte @@ -238,7 +238,7 @@ if ( inputFiles && inputFiles.length > 0 && - ['image/gif', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type']) + ['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type']) ) { reader.readAsDataURL(inputFiles[0]); } else {