Merge remote-tracking branch 'upstream/dev' into feat/oauth

This commit is contained in:
Jun Siang Cheah
2024-05-27 18:14:43 +01:00
77 changed files with 1400 additions and 411 deletions
+13 -1
View File
@@ -22,6 +22,7 @@
prompts,
documents,
tags,
banners,
showChangelog,
config
} from '$lib/stores';
@@ -33,6 +34,8 @@
import ShortcutsModal from '$lib/components/chat/ShortcutsModal.svelte';
import ChangelogModal from '$lib/components/ChangelogModal.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import { getBanners } from '$lib/apis/configs';
import { getUserSettings } from '$lib/apis/users';
const i18n = getContext('i18n');
@@ -70,7 +73,13 @@
// IndexedDB Not Found
}
settings.set(JSON.parse(localStorage.getItem('settings') ?? '{}'));
const userSettings = await getUserSettings(localStorage.token);
if (userSettings) {
await settings.set(userSettings.ui);
} else {
await settings.set(JSON.parse(localStorage.getItem('settings') ?? '{}'));
}
await Promise.all([
(async () => {
@@ -82,6 +91,9 @@
(async () => {
documents.set(await getDocs(localStorage.token));
})(),
(async () => {
banners.set(await getBanners(localStorage.token));
})(),
(async () => {
tags.set(await getAllChatTags(localStorage.token));
})()
+3 -3
View File
@@ -88,7 +88,7 @@
}
await checkOauthCallback();
loaded = true;
if (($config?.auth_trusted_header ?? false) || $config?.auth === false) {
if (($config?.features.auth_trusted_header ?? false) || $config?.features.auth === false) {
await signInHandler();
}
});
@@ -130,7 +130,7 @@
</div> -->
<div class="w-full sm:max-w-md px-10 min-h-screen flex flex-col text-center">
{#if ($config?.auth_trusted_header ?? false) || $config?.auth === false}
{#if ($config?.features.auth_trusted_header ?? false) || $config?.features.auth === false}
<div class=" my-auto pb-10 w-full">
<div
class="flex items-center justify-center gap-3 text-xl sm:text-2xl text-center font-bold dark:text-gray-200"
@@ -222,7 +222,7 @@
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
</button>
{#if $config.enable_signup}
{#if $config?.features.enable_signup}
<div class=" mt-4 text-sm text-center">
{mode === 'signin'
? $i18n.t("Don't have an account?")
-6
View File
@@ -98,12 +98,6 @@
: convertMessagesToHistory(chatContent.messages);
title = chatContent.title;
let _settings = JSON.parse(localStorage.getItem('settings') ?? '{}');
await settings.set({
..._settings,
system: chatContent.system ?? _settings.system,
options: chatContent.options ?? _settings.options
});
autoScroll = true;
await tick();