feat: dynamically load heic2any to accelerate initial page loading speed
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { getContext, onDestroy, onMount, tick } from 'svelte';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import heic2any from 'heic2any';
|
||||
import fileSaver from 'file-saver';
|
||||
const { saveAs } = fileSaver;
|
||||
|
||||
@@ -26,7 +25,7 @@
|
||||
|
||||
import { PaneGroup, Pane, PaneResizer } from 'paneforge';
|
||||
|
||||
import { compressImage, copyToClipboard, splitStream } from '$lib/utils';
|
||||
import { compressImage, copyToClipboard, splitStream, convertHeicToJpeg } from '$lib/utils';
|
||||
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
|
||||
import { uploadFile } from '$lib/apis/files';
|
||||
import { chatCompletion, generateOpenAIChatCompletion } from '$lib/apis/openai';
|
||||
@@ -547,7 +546,7 @@ ${content}
|
||||
|
||||
reader.readAsDataURL(
|
||||
file['type'] === 'image/heic'
|
||||
? await heic2any({ blob: file, toType: 'image/jpeg' })
|
||||
? await convertHeicToJpeg(file)
|
||||
: file
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user