forked from open-webui/open-webui
first draft
This commit is contained in:
parent
5fd1acbd99
commit
230f787da1
8 changed files with 149 additions and 6 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getBackendConfig } from '$lib/apis';
|
import { getBackendConfig } from '$lib/apis';
|
||||||
import { setDefaultPromptSuggestions } from '$lib/apis/configs';
|
import { setDefaultPromptSuggestions } from '$lib/apis/configs';
|
||||||
import { config, models, user } from '$lib/stores';
|
import { config, models, user, showWhatsChanged } from '$lib/stores';
|
||||||
import { createEventDispatcher, onMount } from 'svelte';
|
import { createEventDispatcher, onMount } from 'svelte';
|
||||||
import toast from 'svelte-french-toast';
|
import toast from 'svelte-french-toast';
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
@ -18,6 +18,7 @@
|
||||||
// Interface
|
// Interface
|
||||||
let promptSuggestions = [];
|
let promptSuggestions = [];
|
||||||
let showUsername = false;
|
let showUsername = false;
|
||||||
|
let enableWhatsChanged = true;
|
||||||
|
|
||||||
const toggleFullScreenMode = async () => {
|
const toggleFullScreenMode = async () => {
|
||||||
fullScreenMode = !fullScreenMode;
|
fullScreenMode = !fullScreenMode;
|
||||||
|
@ -29,6 +30,11 @@
|
||||||
saveSettings({ showUsername: showUsername });
|
saveSettings({ showUsername: showUsername });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleenableWhatsChanged = async () => {
|
||||||
|
enableWhatsChanged = !enableWhatsChanged;
|
||||||
|
saveSettings({ enableWhatsChanged: enableWhatsChanged });
|
||||||
|
};
|
||||||
|
|
||||||
const toggleTitleAutoGenerate = async () => {
|
const toggleTitleAutoGenerate = async () => {
|
||||||
titleAutoGenerate = !titleAutoGenerate;
|
titleAutoGenerate = !titleAutoGenerate;
|
||||||
saveSettings({ titleAutoGenerate: titleAutoGenerate });
|
saveSettings({ titleAutoGenerate: titleAutoGenerate });
|
||||||
|
@ -77,6 +83,7 @@
|
||||||
titleAutoGenerate = settings.titleAutoGenerate ?? true;
|
titleAutoGenerate = settings.titleAutoGenerate ?? true;
|
||||||
responseAutoCopy = settings.responseAutoCopy ?? false;
|
responseAutoCopy = settings.responseAutoCopy ?? false;
|
||||||
showUsername = settings.showUsername ?? false;
|
showUsername = settings.showUsername ?? false;
|
||||||
|
enableWhatsChanged = settings.enableWhatsChanged ?? true;
|
||||||
fullScreenMode = settings.fullScreenMode ?? false;
|
fullScreenMode = settings.fullScreenMode ?? false;
|
||||||
titleAutoGenerateModel = settings.titleAutoGenerateModel ?? '';
|
titleAutoGenerateModel = settings.titleAutoGenerateModel ?? '';
|
||||||
titleGenerationPrompt =
|
titleGenerationPrompt =
|
||||||
|
@ -179,6 +186,26 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class=" py-0.5 flex w-full justify-between">
|
||||||
|
<div class=" self-center text-xs font-medium">Show "WhatsChanged" Modal on Startup</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="p-1 px-3 text-xs flex rounded transition"
|
||||||
|
on:click={() => {
|
||||||
|
toggleenableWhatsChanged();
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
{#if enableWhatsChanged === true}
|
||||||
|
<span class="ml-2 self-center">On</span>
|
||||||
|
{:else}
|
||||||
|
<span class="ml-2 self-center">Off</span>
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr class=" dark:border-gray-700" />
|
<hr class=" dark:border-gray-700" />
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
76
src/lib/components/chat/WhatsChangedModal.svelte
Normal file
76
src/lib/components/chat/WhatsChangedModal.svelte
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import Modal from '../common/Modal.svelte';
|
||||||
|
import { WEBUI_NAME, WEB_UI_VERSION, RELEASE_NOTES } from '$lib/constants';
|
||||||
|
import { config, showWhatsChanged } from '$lib/stores';
|
||||||
|
|
||||||
|
export let show = false;
|
||||||
|
|
||||||
|
function toggleVisibility() {
|
||||||
|
showWhatsChanged.update((value) => !value);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Modal>
|
||||||
|
<div class="px-5 py-4 dark:text-gray-300">
|
||||||
|
<div class="flex justify-between items-start">
|
||||||
|
<div class="text-xl font-bold">{WEBUI_NAME}</div>
|
||||||
|
<!-- WEBUI_NAME groß und oben -->
|
||||||
|
<button class="self-center" on:click={toggleVisibility}>
|
||||||
|
<!-- SVG-Icon für Schließen-Button -->
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
fill="currentColor"
|
||||||
|
class="w-5 h-5"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class=" pb-3 flex items-center mt-2">
|
||||||
|
<!-- Container für die Elemente darunter -->
|
||||||
|
<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" />
|
||||||
|
<!-- Trennstrich -->
|
||||||
|
<div class="text-sm dark:text-gray-200">
|
||||||
|
{$config && $config.version ? $config.version : WEB_UI_VERSION}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr class=" dark:border-gray-800" />
|
||||||
|
<div class="p-4 overflow-y-scroll max-h-80">
|
||||||
|
{#if RELEASE_NOTES.length === 0}
|
||||||
|
<div class="pt-10 text-center font-bold">There are no notes given.</div>
|
||||||
|
|
||||||
|
<div class="pb-10 text-center">
|
||||||
|
Check
|
||||||
|
<a class="text-blue-500" href="https://github.com/open-webui/open-webui" target="_blank">
|
||||||
|
Open WebUI on GitHub</a
|
||||||
|
> for more information.
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
{#each RELEASE_NOTES as { title, description }}
|
||||||
|
<div class="mt-4">
|
||||||
|
<div class="font-bold">{title}</div>
|
||||||
|
<div>{description}</div>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<div class="m-4 flex justify-end pt-3 text-sm font-medium">
|
||||||
|
<button
|
||||||
|
on:click={toggleVisibility}
|
||||||
|
class=" rounded px-4 py-2 overflow-hidden group bg-green-600 relative hover:bg-gradient-to-r hover:from-green-600 hover:to-green-500 text-white hover:ring-2 hover:ring-offset-2 hover:ring-green-500 transition-all ease-out duration-300"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute right-0 w-8 h-32 -mt-12 transition-all duration-1000 transform translate-x-12 bg-white opacity-10 rotate-12 group-hover:-translate-x-40 ease"
|
||||||
|
/>
|
||||||
|
<span class="relative">Ok, let's go!</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { fade, blur } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
|
|
||||||
export let show = true;
|
export let show = true;
|
||||||
export let size = 'md';
|
export let size = 'md';
|
||||||
|
@ -35,9 +35,7 @@
|
||||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||||
<div
|
<div
|
||||||
class="fixed top-0 right-0 left-0 bottom-0 bg-black/60 w-full min-h-screen h-screen flex justify-center z-50 overflow-hidden overscroll-contain"
|
class="fixed top-0 right-0 left-0 bottom-0 bg-black/60 w-full min-h-screen h-screen flex justify-center z-50 overflow-hidden overscroll-contain"
|
||||||
on:click={() => {
|
transition:fade={{ duration: 200 }}
|
||||||
show = false;
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="m-auto rounded-xl max-w-full {sizeToWidth(
|
class="m-auto rounded-xl max-w-full {sizeToWidth(
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
updateChatById
|
updateChatById
|
||||||
} from '$lib/apis/chats';
|
} from '$lib/apis/chats';
|
||||||
import toast from 'svelte-french-toast';
|
import toast from 'svelte-french-toast';
|
||||||
|
import { slide } from 'svelte/transition';
|
||||||
|
|
||||||
let show = false;
|
let show = false;
|
||||||
let navElement;
|
let navElement;
|
||||||
|
@ -562,6 +563,7 @@
|
||||||
<div
|
<div
|
||||||
id="dropdownDots"
|
id="dropdownDots"
|
||||||
class="absolute z-40 bottom-[70px] 4.5rem rounded-lg shadow w-[240px] bg-gray-900"
|
class="absolute z-40 bottom-[70px] 4.5rem rounded-lg shadow w-[240px] bg-gray-900"
|
||||||
|
transition:slide={{ duration: 300 }}
|
||||||
>
|
>
|
||||||
<div class="py-2 w-full">
|
<div class="py-2 w-full">
|
||||||
{#if $user.role === 'admin'}
|
{#if $user.role === 'admin'}
|
||||||
|
|
|
@ -12,7 +12,29 @@ 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 RAG_API_BASE_URL = `${WEBUI_BASE_URL}/rag/api/v1`;
|
||||||
|
|
||||||
export const WEB_UI_VERSION = APP_VERSION;
|
export const WEB_UI_VERSION = APP_VERSION;
|
||||||
|
export const RELEASE_NOTES = [
|
||||||
|
{
|
||||||
|
title: ' 🖼️ Image Generation',
|
||||||
|
description:
|
||||||
|
'Generate Images using the stable-difusion-webui API. You can set this up in settings -> images.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: ' 📝 Change title generation prompt',
|
||||||
|
description:
|
||||||
|
'Change the promt used to generate titles for your chats. You can set this up in the settings -> interface.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: ' 🤖 Change embedding model',
|
||||||
|
description:
|
||||||
|
'Change the embedding model used to generate embeddings for your chats in the Dockerfile. Use any sentence transformer model from huggingface.co.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: ' 📢 This Whats Changed Popup',
|
||||||
|
description:
|
||||||
|
'This popup will show you the latest changes. You can edit it in the constants.ts file.'
|
||||||
|
}
|
||||||
|
//...
|
||||||
|
];
|
||||||
export const REQUIRED_OLLAMA_VERSION = '0.1.16';
|
export const REQUIRED_OLLAMA_VERSION = '0.1.16';
|
||||||
|
|
||||||
export const SUPPORTED_FILE_TYPE = [
|
export const SUPPORTED_FILE_TYPE = [
|
||||||
|
|
|
@ -32,3 +32,16 @@ export const documents = writable([
|
||||||
|
|
||||||
export const settings = writable({});
|
export const settings = writable({});
|
||||||
export const showSettings = writable(false);
|
export const showSettings = writable(false);
|
||||||
|
function createLocalStorageStore(key, startValue) {
|
||||||
|
const storedValue = localStorage.getItem(key);
|
||||||
|
const initialValue = storedValue ? JSON.parse(storedValue) : startValue;
|
||||||
|
|
||||||
|
const store = writable(initialValue);
|
||||||
|
|
||||||
|
store.subscribe((value) => {
|
||||||
|
localStorage.setItem(key, JSON.stringify(value));
|
||||||
|
});
|
||||||
|
|
||||||
|
return store;
|
||||||
|
}
|
||||||
|
export const showWhatsChanged = createLocalStorageStore('showWhatsChanged', true);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
chats,
|
chats,
|
||||||
chatId,
|
chatId,
|
||||||
config,
|
config,
|
||||||
|
showWhatsChanged,
|
||||||
tags as _tags
|
tags as _tags
|
||||||
} from '$lib/stores';
|
} from '$lib/stores';
|
||||||
import { copyToClipboard, splitStream } from '$lib/utils';
|
import { copyToClipboard, splitStream } from '$lib/utils';
|
||||||
|
@ -35,6 +36,7 @@
|
||||||
import Messages from '$lib/components/chat/Messages.svelte';
|
import Messages from '$lib/components/chat/Messages.svelte';
|
||||||
import ModelSelector from '$lib/components/chat/ModelSelector.svelte';
|
import ModelSelector from '$lib/components/chat/ModelSelector.svelte';
|
||||||
import Navbar from '$lib/components/layout/Navbar.svelte';
|
import Navbar from '$lib/components/layout/Navbar.svelte';
|
||||||
|
import WhatsChangedModal from '$lib/components/chat//WhatsChangedModal.svelte';
|
||||||
import { RAGTemplate } from '$lib/utils/rag';
|
import { RAGTemplate } from '$lib/utils/rag';
|
||||||
|
|
||||||
let stopResponseFlag = false;
|
let stopResponseFlag = false;
|
||||||
|
@ -797,6 +799,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="h-screen max-h-[100dvh] w-full flex flex-col">
|
<div class="h-screen max-h-[100dvh] w-full flex flex-col">
|
||||||
|
{#if $showWhatsChanged && !['pending'].includes($user.role) && $settings.enableWhatsChanged}
|
||||||
|
<WhatsChangedModal show={true} />
|
||||||
|
{/if}
|
||||||
<Navbar {title} shareEnabled={messages.length > 0} {initNewChat} {tags} {addTag} {deleteTag} />
|
<Navbar {title} shareEnabled={messages.length > 0} {initNewChat} {tags} {addTag} {deleteTag} />
|
||||||
<div class="flex flex-col flex-auto">
|
<div class="flex flex-col flex-auto">
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Reference in a new issue