Unverified Commit 72354e06 authored by Timothy Jaeryang Baek's avatar Timothy Jaeryang Baek Committed by GitHub
Browse files

Merge pull request #2476 from open-webui/dev

0.2.0
parents 36e2a5e6 207e2503
......@@ -60,7 +60,7 @@
await goto('/');
}
loaded = true;
if (($config?.trusted_header_auth ?? false) || $config?.auth === false) {
if (($config?.features.auth_trusted_header ?? false) || $config?.features.auth === false) {
await signInHandler();
}
});
......@@ -102,7 +102,7 @@
</div> -->
<div class="w-full sm:max-w-md px-10 min-h-screen flex flex-col text-center">
{#if ($config?.trusted_header_auth ?? 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"
......@@ -194,25 +194,27 @@
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
</button>
<div class=" mt-4 text-sm text-center">
{mode === 'signin'
? $i18n.t("Don't have an account?")
: $i18n.t('Already have an account?')}
<button
class=" font-medium underline"
type="button"
on:click={() => {
if (mode === 'signin') {
mode = 'signup';
} else {
mode = 'signin';
}
}}
>
{mode === 'signin' ? $i18n.t('Sign up') : $i18n.t('Sign in')}
</button>
</div>
{#if $config?.features.enable_signup}
<div class=" mt-4 text-sm text-center">
{mode === 'signin'
? $i18n.t("Don't have an account?")
: $i18n.t('Already have an account?')}
<button
class=" font-medium underline"
type="button"
on:click={() => {
if (mode === 'signin') {
mode = 'signup';
} else {
mode = 'signin';
}
}}
>
{mode === 'signin' ? $i18n.t('Sign up') : $i18n.t('Sign in')}
</button>
</div>
{/if}
</div>
</form>
</div>
......
<script lang="ts">
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
onMount(async () => {
window.addEventListener('message', async (event) => {
if (
![
'https://ollamahub.com',
'https://www.ollamahub.com',
'https://openwebui.com',
'https://www.openwebui.com',
'http://localhost:5173'
].includes(event.origin)
)
return;
const modelfile = JSON.parse(event.data);
sessionStorage.modelfile = JSON.stringify(modelfile);
goto('/workspace/modelfiles/create');
});
if (window.opener ?? false) {
window.opener.postMessage('loaded', '*');
}
});
</script>
<script lang="ts">
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
onMount(async () => {
window.addEventListener('message', async (event) => {
if (
![
'https://ollamahub.com',
'https://www.ollamahub.com',
'https://openwebui.com',
'https://www.openwebui.com',
'http://localhost:5173'
].includes(event.origin)
)
return;
const prompts = JSON.parse(event.data);
sessionStorage.modelfile = JSON.stringify(prompts);
goto('/workspace/prompts/create');
});
if (window.opener ?? false) {
window.opener.postMessage('loaded', '*');
}
});
</script>
......@@ -5,7 +5,7 @@
import dayjs from 'dayjs';
import { modelfiles, settings, chatId, WEBUI_NAME } from '$lib/stores';
import { settings, chatId, WEBUI_NAME, models } from '$lib/stores';
import { convertMessagesToHistory } from '$lib/utils';
import { getChatByShareId } from '$lib/apis/chats';
......@@ -14,6 +14,7 @@
import Navbar from '$lib/components/layout/Navbar.svelte';
import { getUserById } from '$lib/apis/users';
import { error } from '@sveltejs/kit';
import { getModels } from '$lib/apis';
const i18n = getContext('i18n');
......@@ -27,17 +28,6 @@
let showModelSelector = false;
let selectedModels = [''];
let selectedModelfiles = {};
$: selectedModelfiles = selectedModels.reduce((a, tagName, i, arr) => {
const modelfile =
$modelfiles.filter((modelfile) => modelfile.tagName === tagName)?.at(0) ?? undefined;
return {
...a,
...(modelfile && { [tagName]: modelfile })
};
}, {});
let chat = null;
let user = null;
......@@ -69,10 +59,6 @@
if (await loadSharedChat()) {
await tick();
loaded = true;
window.setTimeout(() => scrollToBottom(), 0);
const chatInput = document.getElementById('chat-textarea');
chatInput?.focus();
} else {
await goto('/');
}
......@@ -84,6 +70,7 @@
//////////////////////////
const loadSharedChat = async () => {
await models.set(await getModels(localStorage.token));
await chatId.set($page.params.id);
chat = await getChatByShareId(localStorage.token, $chatId).catch(async (error) => {
await goto('/');
......@@ -111,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();
......@@ -168,7 +149,6 @@
chatId={$chatId}
readOnly={true}
{selectedModels}
{selectedModelfiles}
{processing}
bind:history
bind:messages
......
......@@ -18,7 +18,11 @@ import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()],
define: {
APP_VERSION: JSON.stringify(process.env.npm_package_version)
APP_VERSION: JSON.stringify(process.env.npm_package_version),
APP_BUILD_HASH: JSON.stringify(process.env.APP_BUILD_HASH || 'dev-build')
},
build: {
sourcemap: true
},
worker: {
format: 'es'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment