diff --git a/src/app.html b/src/app.html index 9dc420cb6..5875db45e 100644 --- a/src/app.html +++ b/src/app.html @@ -4,6 +4,18 @@ + + %sveltekit.head%
diff --git a/src/lib/components/chat/SettingsModal.svelte b/src/lib/components/chat/SettingsModal.svelte index 2c5c133f1..d1f2415bf 100644 --- a/src/lib/components/chat/SettingsModal.svelte +++ b/src/lib/components/chat/SettingsModal.svelte @@ -14,6 +14,7 @@ // General let API_BASE_URL = BUILD_TIME_API_BASE_URL; let system = ''; + let theme = 'dark'; // Models let modelTag = ''; @@ -74,6 +75,19 @@ } }; + const toggleTheme = async () => { + if (theme === 'dark') { + theme = 'light'; + } else { + theme = 'dark'; + } + + localStorage.theme = theme; + + document.documentElement.classList.remove(theme === 'dark' ? 'light' : 'dark'); + document.documentElement.classList.add(theme); + }; + const pullModelHandler = async () => { const res = await fetch(`${API_BASE_URL}/pull`, { method: 'POST', @@ -182,6 +196,7 @@ let settings = JSON.parse(localStorage.getItem('settings') ?? '{}'); console.log(settings); + theme = localStorage.theme ?? 'dark'; API_BASE_URL = settings.API_BASE_URL ?? BUILD_TIME_API_BASE_URL; system = settings.system ?? ''; @@ -197,8 +212,8 @@