Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
230f787d
"src/vscode:/vscode.git/clone" did not exist on "36a2b2f3fe06dfdbdd92f286938b6235815e73ff"
Commit
230f787d
authored
Feb 22, 2024
by
Jannik Streidl
Browse files
first draft
parent
5fd1acbd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
149 additions
and
6 deletions
+149
-6
bun.lockb
bun.lockb
+0
-0
src/lib/components/chat/Settings/Interface.svelte
src/lib/components/chat/Settings/Interface.svelte
+28
-1
src/lib/components/chat/WhatsChangedModal.svelte
src/lib/components/chat/WhatsChangedModal.svelte
+76
-0
src/lib/components/common/Modal.svelte
src/lib/components/common/Modal.svelte
+2
-4
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+2
-0
src/lib/constants.ts
src/lib/constants.ts
+23
-1
src/lib/stores/index.ts
src/lib/stores/index.ts
+13
-0
src/routes/(app)/+page.svelte
src/routes/(app)/+page.svelte
+5
-0
No files found.
bun.lockb
View file @
230f787d
No preview for this file type
src/lib/components/chat/Settings/Interface.svelte
View file @
230f787d
<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 @@
...
@@ -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 @@
...
@@ -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 @@
...
@@ -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 @@
...
@@ -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>
...
...
src/lib/components/chat/WhatsChangedModal.svelte
0 → 100644
View file @
230f787d
<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>
src/lib/components/common/Modal.svelte
View file @
230f787d
<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 @@
...
@@ -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(
...
...
src/lib/components/layout/Sidebar.svelte
View file @
230f787d
...
@@ -16,6 +16,7 @@
...
@@ -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 @@
...
@@ -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'}
...
...
src/lib/constants.ts
View file @
230f787d
...
@@ -12,7 +12,29 @@ export const IMAGES_API_BASE_URL = `${WEBUI_BASE_URL}/images/api/v1`;
...
@@ -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
=
[
...
...
src/lib/stores/index.ts
View file @
230f787d
...
@@ -32,3 +32,16 @@ export const documents = writable([
...
@@ -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
);
src/routes/(app)/+page.svelte
View file @
230f787d
...
@@ -14,6 +14,7 @@
...
@@ -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 @@
...
@@ -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 @@
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment