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 @@ ...@@ -60,7 +60,7 @@
await goto('/'); await goto('/');
} }
loaded = true; loaded = true;
if (($config?.trusted_header_auth ?? false) || $config?.auth === false) { if (($config?.features.auth_trusted_header ?? false) || $config?.features.auth === false) {
await signInHandler(); await signInHandler();
} }
}); });
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
</div> --> </div> -->
<div class="w-full sm:max-w-md px-10 min-h-screen flex flex-col text-center"> <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=" my-auto pb-10 w-full">
<div <div
class="flex items-center justify-center gap-3 text-xl sm:text-2xl text-center font-bold dark:text-gray-200" 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 @@ ...@@ -194,25 +194,27 @@
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')} {mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
</button> </button>
<div class=" mt-4 text-sm text-center"> {#if $config?.features.enable_signup}
{mode === 'signin' <div class=" mt-4 text-sm text-center">
? $i18n.t("Don't have an account?") {mode === 'signin'
: $i18n.t('Already have an account?')} ? $i18n.t("Don't have an account?")
: $i18n.t('Already have an account?')}
<button
class=" font-medium underline" <button
type="button" class=" font-medium underline"
on:click={() => { type="button"
if (mode === 'signin') { on:click={() => {
mode = 'signup'; if (mode === 'signin') {
} else { mode = 'signup';
mode = 'signin'; } else {
} mode = 'signin';
}} }
> }}
{mode === 'signin' ? $i18n.t('Sign up') : $i18n.t('Sign in')} >
</button> {mode === 'signin' ? $i18n.t('Sign up') : $i18n.t('Sign in')}
</div> </button>
</div>
{/if}
</div> </div>
</form> </form>
</div> </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 @@ ...@@ -5,7 +5,7 @@
import dayjs from 'dayjs'; 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 { convertMessagesToHistory } from '$lib/utils';
import { getChatByShareId } from '$lib/apis/chats'; import { getChatByShareId } from '$lib/apis/chats';
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
import Navbar from '$lib/components/layout/Navbar.svelte'; import Navbar from '$lib/components/layout/Navbar.svelte';
import { getUserById } from '$lib/apis/users'; import { getUserById } from '$lib/apis/users';
import { error } from '@sveltejs/kit'; import { error } from '@sveltejs/kit';
import { getModels } from '$lib/apis';
const i18n = getContext('i18n'); const i18n = getContext('i18n');
...@@ -27,17 +28,6 @@ ...@@ -27,17 +28,6 @@
let showModelSelector = false; let showModelSelector = false;
let selectedModels = ['']; 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 chat = null;
let user = null; let user = null;
...@@ -69,10 +59,6 @@ ...@@ -69,10 +59,6 @@
if (await loadSharedChat()) { if (await loadSharedChat()) {
await tick(); await tick();
loaded = true; loaded = true;
window.setTimeout(() => scrollToBottom(), 0);
const chatInput = document.getElementById('chat-textarea');
chatInput?.focus();
} else { } else {
await goto('/'); await goto('/');
} }
...@@ -84,6 +70,7 @@ ...@@ -84,6 +70,7 @@
////////////////////////// //////////////////////////
const loadSharedChat = async () => { const loadSharedChat = async () => {
await models.set(await getModels(localStorage.token));
await chatId.set($page.params.id); await chatId.set($page.params.id);
chat = await getChatByShareId(localStorage.token, $chatId).catch(async (error) => { chat = await getChatByShareId(localStorage.token, $chatId).catch(async (error) => {
await goto('/'); await goto('/');
...@@ -111,12 +98,6 @@ ...@@ -111,12 +98,6 @@
: convertMessagesToHistory(chatContent.messages); : convertMessagesToHistory(chatContent.messages);
title = chatContent.title; 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; autoScroll = true;
await tick(); await tick();
...@@ -168,7 +149,6 @@ ...@@ -168,7 +149,6 @@
chatId={$chatId} chatId={$chatId}
readOnly={true} readOnly={true}
{selectedModels} {selectedModels}
{selectedModelfiles}
{processing} {processing}
bind:history bind:history
bind:messages bind:messages
......
...@@ -18,7 +18,11 @@ import { defineConfig } from 'vite'; ...@@ -18,7 +18,11 @@ import { defineConfig } from 'vite';
export default defineConfig({ export default defineConfig({
plugins: [sveltekit()], plugins: [sveltekit()],
define: { 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: { worker: {
format: 'es' 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