From 71d550dd26bab4fbe58bf094b857c7356dd631cf Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 30 Jun 2025 15:20:41 +0400 Subject: [PATCH] enh: offline mode --- backend/open_webui/main.py | 1 + .../components/admin/Settings/General.svelte | 24 +++++++++++-------- src/lib/components/chat/Settings/About.svelte | 22 ++++++++++------- src/routes/(app)/+layout.svelte | 2 +- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index ae6d7f363d..96b04aaed8 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -1546,6 +1546,7 @@ async def get_app_config(request: Request): "name": app.state.WEBUI_NAME, "version": VERSION, "default_locale": str(DEFAULT_LOCALE), + "offline_mode": OFFLINE_MODE, "oauth": { "providers": { name: config.get("name", name) diff --git a/src/lib/components/admin/Settings/General.svelte b/src/lib/components/admin/Settings/General.svelte index 132d5c5327..faad41d9b3 100644 --- a/src/lib/components/admin/Settings/General.svelte +++ b/src/lib/components/admin/Settings/General.svelte @@ -90,7 +90,9 @@ }; onMount(async () => { - checkForVersionUpdates(); + if (!$config?.offline_mode) { + checkForVersionUpdates(); + } await Promise.all([ (async () => { @@ -160,15 +162,17 @@ - + {#if !$config?.offline_mode} + + {/if} diff --git a/src/lib/components/chat/Settings/About.svelte b/src/lib/components/chat/Settings/About.svelte index d4c3723077..936cb6d06c 100644 --- a/src/lib/components/chat/Settings/About.svelte +++ b/src/lib/components/chat/Settings/About.svelte @@ -38,7 +38,9 @@ return ''; }); - checkForVersionUpdates(); + if (!$config?.offline_mode) { + checkForVersionUpdates(); + } }); @@ -80,14 +82,16 @@ - + {#if $config?.offline_mode} + + {/if} diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 123de9f632..2687fd54c0 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -228,7 +228,7 @@ } // Check for version updates - if ($user?.role === 'admin') { + if ($user?.role === 'admin' && !$config?.offline_mode) { // Check if the user has dismissed the update toast in the last 24 hours if (localStorage.dismissedUpdateToast) { const dismissedUpdateToast = new Date(Number(localStorage.dismissedUpdateToast));