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

@ -2,9 +2,9 @@
import { onMount } from 'svelte';
import { Confetti } from 'svelte-confetti';
import { config } from '$lib/stores';
import { WEBUI_NAME, config } from '$lib/stores';
import { WEBUI_NAME, WEB_UI_VERSION } from '$lib/constants';
import { WEBUI_VERSION } from '$lib/constants';
import { getChangelog } from '$lib/apis';
import Modal from './common/Modal.svelte';
@ -23,7 +23,7 @@
<div class="px-5 py-4 dark:text-gray-300">
<div class="flex justify-between items-start">
<div class="text-xl font-bold">
Whats New in {WEBUI_NAME}
Whats New in {$WEBUI_NAME}
<Confetti x={[-1, -0.25]} y={[0, 0.5]} />
</div>
<button
@ -48,7 +48,7 @@
<div class="text-sm dark:text-gray-200">Release Notes</div>
<div class="flex self-center w-[1px] h-6 mx-2.5 bg-gray-200 dark:bg-gray-700" />
<div class="text-sm dark:text-gray-200">
v{WEB_UI_VERSION}
v{WEBUI_VERSION}
</div>
</div>
</div>

View file

@ -1,4 +1,5 @@
<script lang="ts">
import { WEBUI_BASE_URL } from '$lib/constants';
import { onMount } from 'svelte';
export let models = [];
@ -27,14 +28,16 @@
>
{#if model in modelfiles}
<img
src={modelfiles[model]?.imageUrl ?? './favicon.png'}
src={modelfiles[model]?.imageUrl ?? `${WEBUI_BASE_URL}/static/favicon.png`}
alt="modelfile"
class=" w-14 rounded-full border-[1px] border-gray-200 dark:border-none"
draggable="false"
/>
{:else}
<img
src={models.length === 1 ? '/favicon.png' : '/favicon.png'}
src={models.length === 1
? `${WEBUI_BASE_URL}/static/favicon.png`
: `${WEBUI_BASE_URL}/static/favicon.png`}
class=" w-14 rounded-full border-[1px] border-gray-200 dark:border-none"
alt="logo"
draggable="false"

View file

@ -298,7 +298,9 @@
{#key message.id}
<div class=" flex w-full message-{message.id}">
<ProfileImage src={modelfiles[message.model]?.imageUrl ?? '/favicon.png'} />
<ProfileImage
src={modelfiles[message.model]?.imageUrl ?? `${WEBUI_BASE_URL}/static/favicon.png`}
/>
<div class="w-full overflow-hidden">
<Name>

View file

@ -1,7 +1,7 @@
<script lang="ts">
import { getOllamaVersion } from '$lib/apis/ollama';
import { WEBUI_NAME, WEB_UI_VERSION } from '$lib/constants';
import { config, showChangelog } from '$lib/stores';
import { WEBUI_VERSION } from '$lib/constants';
import { WEBUI_NAME, config, showChangelog } from '$lib/stores';
import { onMount } from 'svelte';
let ollamaVersion = '';
@ -17,13 +17,13 @@
<div>
<div class=" mb-2.5 text-sm font-medium flex space-x-2 items-center">
<div>
{WEBUI_NAME} Version
{$WEBUI_NAME} Version
</div>
</div>
<div class="flex w-full">
<div class="flex-1 text-xs text-gray-700 dark:text-gray-200 flex space-x-1.5 items-center">
<div>
v{WEB_UI_VERSION}
v{WEBUI_VERSION}
</div>
<button

View file

@ -3,8 +3,8 @@
import toast from 'svelte-french-toast';
import { createModel, deleteModel, pullModel } from '$lib/apis/ollama';
import { WEBUI_API_BASE_URL, WEBUI_NAME } from '$lib/constants';
import { models, user } from '$lib/stores';
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
import { WEBUI_NAME, models, user } from '$lib/stores';
import { splitStream } from '$lib/utils';
export let getModels: Function;
@ -59,9 +59,9 @@
} else {
toast.success(`Model '${modelName}' has been successfully downloaded.`);
const notification = new Notification(WEBUI_NAME, {
const notification = new Notification($WEBUI_NAME, {
body: `Model '${modelName}' has been successfully downloaded.`,
icon: '/favicon.png'
icon: `${WEBUI_BASE_URL}/static/favicon.png`
});
models.set(await getModels());

View file

@ -4,14 +4,13 @@
const { saveAs } = fileSaver;
import { getChatById } from '$lib/apis/chats';
import { chatId, modelfiles, settings } from '$lib/stores';
import { WEBUI_NAME, chatId, modelfiles, settings } from '$lib/stores';
import ShareChatModal from '../chat/ShareChatModal.svelte';
import TagInput from '../common/Tags/TagInput.svelte';
import Tags from '../common/Tags.svelte';
import { WEBUI_NAME } from '$lib/constants';
export let initNewChat: Function;
export let title: string = WEBUI_NAME;
export let title: string = $WEBUI_NAME;
export let shareEnabled: boolean = false;
export let tags = [];
@ -102,7 +101,7 @@
</div>
<div class=" flex-1 self-center font-medium line-clamp-1">
<div>
{title != '' ? title : WEBUI_NAME}
{title != '' ? title : $WEBUI_NAME}
</div>
</div>

View file

@ -17,6 +17,7 @@
} from '$lib/apis/chats';
import toast from 'svelte-french-toast';
import { slide } from 'svelte/transition';
import { WEBUI_BASE_URL } from '$lib/constants';
let show = false;
let navElement;
@ -114,7 +115,11 @@
>
<div class="flex self-center">
<div class="self-center mr-1.5">
<img src="/favicon.png" class=" w-7 -translate-x-1.5 rounded-full" alt="logo" />
<img
src="{WEBUI_BASE_URL}/static/favicon.png"
class=" w-7 -translate-x-1.5 rounded-full"
alt="logo"
/>
</div>
<div class=" self-center font-medium text-sm">New Chat</div>

View file

@ -1,7 +1,7 @@
import { dev } from '$app/environment';
// import { version } from '../../package.json';
export const WEBUI_NAME = 'Open WebUI';
export const APP_NAME = 'Open WebUI';
export const WEBUI_BASE_URL = dev ? `http://${location.hostname}:8080` : ``;
export const WEBUI_API_BASE_URL = `${WEBUI_BASE_URL}/api/v1`;
@ -11,7 +11,7 @@ export const AUDIO_API_BASE_URL = `${WEBUI_BASE_URL}/audio/api/v1`;
export const IMAGES_API_BASE_URL = `${WEBUI_BASE_URL}/images/api/v1`;
export const RAG_API_BASE_URL = `${WEBUI_BASE_URL}/rag/api/v1`;
export const WEB_UI_VERSION = APP_VERSION;
export const WEBUI_VERSION = APP_VERSION;
export const REQUIRED_OLLAMA_VERSION = '0.1.16';
export const SUPPORTED_FILE_TYPE = [

View file

@ -1,6 +1,8 @@
import { APP_NAME } from '$lib/constants';
import { writable } from 'svelte/store';
// Backend
export const WEBUI_NAME = writable(APP_NAME);
export const config = writable(undefined);
export const user = writable(undefined);