This commit is contained in:
Timothy J. Baek 2024-09-26 04:05:28 +02:00
parent 78d6647885
commit c754c53906
2 changed files with 11 additions and 12 deletions

View File

@ -14,7 +14,7 @@
</script> </script>
<div <div
class="flex items-start bg-[--info-bg] border border-[--info-border] text-[--info-text] rounded-lg px-3.5 py-3 text-xs" class="flex items-start bg-[#F1F8FE] dark:bg-[#020C1D] border border-[3371D5] dark:border-[#03113B] text-[#3371D5] dark:text-[#6795EC] rounded-lg px-3.5 py-3 text-xs max-w-80 pr-2 w-full shadow-lg"
> >
<div class="flex-1 font-medium"> <div class="flex-1 font-medium">
{$i18n.t(`A new version (v{{LATEST_VERSION}}) is now available.`, { {$i18n.t(`A new version (v{{LATEST_VERSION}}) is now available.`, {

View File

@ -46,6 +46,7 @@
import { compareVersion } from '$lib/utils'; import { compareVersion } from '$lib/utils';
import UpdateInfoToast from '$lib/components/layout/UpdateInfoToast.svelte'; import UpdateInfoToast from '$lib/components/layout/UpdateInfoToast.svelte';
import { fade } from 'svelte/transition';
const i18n = getContext('i18n'); const i18n = getContext('i18n');
@ -53,6 +54,8 @@
let DB = null; let DB = null;
let localDBChats = []; let localDBChats = [];
let version;
const getModels = async () => { const getModels = async () => {
return _getModels(localStorage.token); return _getModels(localStorage.token);
}; };
@ -216,28 +219,24 @@
}); });
const checkForVersionUpdates = async () => { const checkForVersionUpdates = async () => {
const version = await getVersionUpdates(localStorage.token).catch((error) => { version = await getVersionUpdates(localStorage.token).catch((error) => {
return { return {
current: WEBUI_VERSION, current: WEBUI_VERSION,
latest: WEBUI_VERSION latest: WEBUI_VERSION
}; };
}); });
if (compareVersion(version.latest, version.current)) {
toast.custom(UpdateInfoToast, {
duration: Number.POSITIVE_INFINITY,
position: 'bottom-right',
componentProps: {
version
}
});
}
}; };
</script> </script>
<SettingsModal bind:show={$showSettings} /> <SettingsModal bind:show={$showSettings} />
<ChangelogModal bind:show={$showChangelog} /> <ChangelogModal bind:show={$showChangelog} />
{#if version && compareVersion(version.latest, version.current)}
<div class=" absolute bottom-8 right-8 z-50" in:fade={{ duration: 100 }}>
<UpdateInfoToast {version} />
</div>
{/if}
<div class="app relative"> <div class="app relative">
<div <div
class=" text-gray-700 dark:text-gray-100 bg-white dark:bg-gray-900 h-screen max-h-[100dvh] overflow-auto flex flex-row" class=" text-gray-700 dark:text-gray-100 bg-white dark:bg-gray-900 h-screen max-h-[100dvh] overflow-auto flex flex-row"