mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-09 03:18:18 +00:00
fix(ui): deduplicate layout-level API requests
This commit is contained in:
parent
b1d40f3409
commit
d30ecbd7cd
4 changed files with 7 additions and 23 deletions
|
|
@ -29,10 +29,10 @@
|
||||||
|
|
||||||
export let saveHandler: Function;
|
export let saveHandler: Function;
|
||||||
|
|
||||||
let updateAvailable = null;
|
let updateAvailable = false;
|
||||||
let version = {
|
let version = {
|
||||||
current: '',
|
current: WEBUI_VERSION,
|
||||||
latest: ''
|
latest: WEBUI_VERSION
|
||||||
};
|
};
|
||||||
|
|
||||||
let adminConfig = null;
|
let adminConfig = null;
|
||||||
|
|
@ -106,10 +106,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if ($config?.features?.enable_version_update_check) {
|
|
||||||
checkForVersionUpdates();
|
|
||||||
}
|
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
(async () => {
|
(async () => {
|
||||||
adminConfig = await getAdminConfig(localStorage.token);
|
adminConfig = await getAdminConfig(localStorage.token);
|
||||||
|
|
@ -129,7 +125,7 @@
|
||||||
const ldapConfig = await getLdapConfig(localStorage.token);
|
const ldapConfig = await getLdapConfig(localStorage.token);
|
||||||
ENABLE_LDAP = ldapConfig.ENABLE_LDAP;
|
ENABLE_LDAP = ldapConfig.ENABLE_LDAP;
|
||||||
|
|
||||||
banners = await getBanners(localStorage.token);
|
banners = [...$_banners];
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
import { getBanners } from '$lib/apis/configs';
|
import { getBanners } from '$lib/apis/configs';
|
||||||
import { getTerminalServers } from '$lib/apis/terminal';
|
import { getTerminalServers } from '$lib/apis/terminal';
|
||||||
import { getUserSettings } from '$lib/apis/users';
|
import { getUserSettings } from '$lib/apis/users';
|
||||||
|
import { setTextScale } from '$lib/utils/text-scale';
|
||||||
|
|
||||||
import { WEBUI_VERSION, WEBUI_API_BASE_URL } from '$lib/constants';
|
import { WEBUI_VERSION, WEBUI_API_BASE_URL } from '$lib/constants';
|
||||||
import { compareVersion } from '$lib/utils';
|
import { compareVersion } from '$lib/utils';
|
||||||
|
|
@ -105,6 +106,8 @@
|
||||||
settings.set(userSettings.ui);
|
settings.set(userSettings.ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTextScale($settings?.textScale ?? 1);
|
||||||
|
|
||||||
if (cb) {
|
if (cb) {
|
||||||
await cb();
|
await cb();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
<script>
|
<script>
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import Settings from '$lib/components/admin/Settings.svelte';
|
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
goto('/admin/settings/general');
|
goto('/admin/settings/general');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Settings />
|
|
||||||
|
|
|
||||||
|
|
@ -993,18 +993,6 @@
|
||||||
$socket?.on('events', chatEventHandler);
|
$socket?.on('events', chatEventHandler);
|
||||||
$socket?.on('events:channel', channelEventHandler);
|
$socket?.on('events:channel', channelEventHandler);
|
||||||
|
|
||||||
const userSettings = await getUserSettings(localStorage.token);
|
|
||||||
if (userSettings) {
|
|
||||||
settings.set(userSettings.ui);
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
settings.set(JSON.parse(localStorage.getItem('settings') ?? '{}'));
|
|
||||||
} catch {
|
|
||||||
settings.set({});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setTextScale($settings?.textScale ?? 1);
|
|
||||||
|
|
||||||
// Set up the token expiry check
|
// Set up the token expiry check
|
||||||
if (tokenTimer) {
|
if (tokenTimer) {
|
||||||
clearInterval(tokenTimer);
|
clearInterval(tokenTimer);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue