feat: sponsor custom name support

This commit is contained in:
Timothy J. Baek 2024-02-23 17:12:19 -08:00
parent fc330a1e8b
commit 62f67bed29
17 changed files with 94 additions and 44 deletions

View file

@ -36,6 +36,7 @@
import ModelSelector from '$lib/components/chat/ModelSelector.svelte';
import Navbar from '$lib/components/layout/Navbar.svelte';
import { RAGTemplate } from '$lib/utils/rag';
import { WEBUI_BASE_URL } from '$lib/constants';
let stopResponseFlag = false;
let autoScroll = true;
@ -334,7 +335,7 @@
content: $settings.system
}
: undefined,
...messages.filter(message => !message.deleted)
...messages.filter((message) => !message.deleted)
]
.filter((message) => message)
.map((message, idx, arr) => ({
@ -452,7 +453,7 @@
: `${model}`,
{
body: responseMessage.content,
icon: selectedModelfile?.imageUrl ?? '/favicon.png'
icon: selectedModelfile?.imageUrl ?? `${WEBUI_BASE_URL}/static/favicon.png`
}
);
}
@ -540,7 +541,7 @@
content: $settings.system
}
: undefined,
...messages.filter(message => !message.deleted)
...messages.filter((message) => !message.deleted)
]
.filter((message) => message)
.map((message, idx, arr) => ({
@ -622,7 +623,7 @@
if ($settings.notificationEnabled && !document.hasFocus()) {
const notification = new Notification(`OpenAI ${model}`, {
body: responseMessage.content,
icon: '/favicon.png'
icon: `${WEBUI_BASE_URL}/static/favicon.png`
});
}

View file

@ -37,6 +37,7 @@
import ModelSelector from '$lib/components/chat/ModelSelector.svelte';
import Navbar from '$lib/components/layout/Navbar.svelte';
import { RAGTemplate } from '$lib/utils/rag';
import { WEBUI_BASE_URL } from '$lib/constants';
let loaded = false;
@ -466,7 +467,7 @@
: `${model}`,
{
body: responseMessage.content,
icon: selectedModelfile?.imageUrl ?? '/favicon.png'
icon: selectedModelfile?.imageUrl ?? `${WEBUI_BASE_URL}/static/favicon.png`
}
);
}
@ -637,7 +638,7 @@
if ($settings.notificationEnabled && !document.hasFocus()) {
const notification = new Notification(`OpenAI ${model}`, {
body: responseMessage.content,
icon: '/favicon.png'
icon: `${WEBUI_BASE_URL}/static/favicon.png`
});
}

View file

@ -1,6 +1,6 @@
<script>
import { onMount, tick } from 'svelte';
import { config, user, theme } from '$lib/stores';
import { config, user, theme, WEBUI_NAME } from '$lib/stores';
import { goto } from '$app/navigation';
import toast, { Toaster } from 'svelte-french-toast';
@ -10,7 +10,7 @@
import '../app.css';
import '../tailwind.css';
import 'tippy.js/dist/tippy.css';
import { WEBUI_NAME } from '$lib/constants';
import { WEBUI_BASE_URL } from '$lib/constants';
let loaded = false;
@ -22,6 +22,8 @@
if (backendConfig) {
// Save Backend Status to Store
await config.set(backendConfig);
await WEBUI_NAME.set(backendConfig.name);
console.log(backendConfig);
if ($config) {
@ -55,7 +57,8 @@
</script>
<svelte:head>
<title>{WEBUI_NAME}</title>
<title>{$WEBUI_NAME}</title>
<link rel="icon" href="{WEBUI_BASE_URL}/static/favicon.png" />
<link rel="stylesheet" type="text/css" href="/themes/rosepine.css" />
<link rel="stylesheet" type="text/css" href="/themes/rosepine-dawn.css" />

View file

@ -1,8 +1,8 @@
<script>
import { goto } from '$app/navigation';
import { userSignIn, userSignUp } from '$lib/apis/auths';
import { WEBUI_API_BASE_URL, WEBUI_NAME } from '$lib/constants';
import { config, user } from '$lib/stores';
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
import { WEBUI_NAME, config, user } from '$lib/stores';
import { onMount } from 'svelte';
import toast from 'svelte-french-toast';
@ -61,7 +61,7 @@
<div class="fixed m-10 z-50">
<div class="flex space-x-2">
<div class=" self-center">
<img src="/favicon.png" class=" w-8 rounded-full" alt="logo" />
<img src="{WEBUI_BASE_URL}/static/favicon.png" class=" w-8 rounded-full" alt="logo" />
</div>
</div>
</div>
@ -90,12 +90,12 @@
}}
>
<div class=" text-xl md:text-2xl font-bold">
{mode === 'signin' ? 'Sign in' : 'Sign up'} to {WEBUI_NAME}
{mode === 'signin' ? 'Sign in' : 'Sign up'} to {$WEBUI_NAME}
</div>
{#if mode === 'signup'}
<div class=" mt-1 text-xs font-medium text-gray-500">
{WEBUI_NAME} does not make any external connections, and your data stays securely on
{$WEBUI_NAME} does not make any external connections, and your data stays securely on
your locally hosted server.
</div>
{/if}

View file

@ -1,7 +1,6 @@
<script>
import { goto } from '$app/navigation';
import { WEBUI_NAME } from '$lib/constants';
import { config } from '$lib/stores';
import { WEBUI_NAME, config } from '$lib/stores';
import { onMount } from 'svelte';
let loaded = false;
@ -20,7 +19,7 @@
<div class="absolute rounded-xl w-full h-full backdrop-blur flex justify-center">
<div class="m-auto pb-44 flex flex-col justify-center">
<div class="max-w-md">
<div class="text-center text-2xl font-medium z-50">{WEBUI_NAME} Backend Required</div>
<div class="text-center text-2xl font-medium z-50">{$WEBUI_NAME} Backend Required</div>
<div class=" mt-4 text-center text-sm w-full">
Oops! You're using an unsupported method (frontend only). Please serve the WebUI from