{$i18n.t(`A new version (v{{LATEST_VERSION}}) is now available.`, {
@@ -35,6 +35,7 @@
class=" hover:text-blue-900 dark:hover:text-blue-300 transition"
on:click={() => {
console.log('closeToast');
+ localStorage.setItem('dismissedUpdateToast', Date.now().toString());
dispatch('closeToast');
}}
>
diff --git a/src/lib/stores/index.ts b/src/lib/stores/index.ts
index 5fe44edc0..b96bf4a98 100644
--- a/src/lib/stores/index.ts
+++ b/src/lib/stores/index.ts
@@ -19,7 +19,9 @@ export const activeUserCount: Writable
= writable(null);
export const USAGE_POOL: Writable = writable(null);
export const theme = writable('system');
+
export const chatId = writable('');
+export const chatTitle = writable('');
export const chats = writable([]);
export const pinnedChats = writable([]);
diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte
index a59d0bd53..ad2f085cf 100644
--- a/src/routes/(app)/+layout.svelte
+++ b/src/routes/(app)/+layout.svelte
@@ -46,6 +46,7 @@
import { compareVersion } from '$lib/utils';
import UpdateInfoToast from '$lib/components/layout/UpdateInfoToast.svelte';
+ import { fade } from 'svelte/transition';
const i18n = getContext('i18n');
@@ -53,6 +54,8 @@
let DB = null;
let localDBChats = [];
+ let version;
+
const getModels = async () => {
return _getModels(localStorage.token);
};
@@ -195,10 +198,20 @@
temporaryChatEnabled.set(true);
}
+ // Check for version updates
if ($user.role === 'admin') {
- checkForVersionUpdates();
- }
+ // Check if the user has dismissed the update toast in the last 24 hours
+ if (localStorage.dismissedUpdateToast) {
+ const dismissedUpdateToast = new Date(Number(localStorage.dismissedUpdateToast));
+ const now = new Date();
+ if (now - dismissedUpdateToast > 24 * 60 * 60 * 1000) {
+ await checkForVersionUpdates();
+ }
+ } else {
+ await checkForVersionUpdates();
+ }
+ }
await tick();
}
@@ -206,28 +219,24 @@
});
const checkForVersionUpdates = async () => {
- const version = await getVersionUpdates(localStorage.token).catch((error) => {
+ version = await getVersionUpdates(localStorage.token).catch((error) => {
return {
current: WEBUI_VERSION,
latest: WEBUI_VERSION
};
});
-
- if (compareVersion(version.latest, version.current)) {
- toast.custom(UpdateInfoToast, {
- duration: Number.POSITIVE_INFINITY,
- position: 'bottom-right',
- componentProps: {
- version
- }
- });
- }
};
+{#if version && compareVersion(version.latest, version.current)}
+
+
+
+{/if}
+