Unverified Commit 38ff3209 authored by Timothy Jaeryang Baek's avatar Timothy Jaeryang Baek Committed by GitHub
Browse files

Merge pull request #1881 from open-webui/dev

0.1.123
parents c9589e21 2789102d
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -34,6 +34,8 @@ export const documents = writable([ ...@@ -34,6 +34,8 @@ export const documents = writable([
]); ]);
export const settings: Writable<Settings> = writable({}); export const settings: Writable<Settings> = writable({});
export const showSidebar = writable(false);
export const showSettings = writable(false); export const showSettings = writable(false);
export const showChangelog = writable(false); export const showChangelog = writable(false);
...@@ -78,6 +80,7 @@ type Settings = { ...@@ -78,6 +80,7 @@ type Settings = {
saveChatHistory?: boolean; saveChatHistory?: boolean;
notificationEnabled?: boolean; notificationEnabled?: boolean;
title?: TitleSettings; title?: TitleSettings;
splitLargeDeltas?: boolean;
system?: string; system?: string;
requestFormat?: string; requestFormat?: string;
......
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
if (isCtrlPressed && event.key === '.') { if (isCtrlPressed && event.key === '.') {
event.preventDefault(); event.preventDefault();
console.log('openSettings'); console.log('openSettings');
document.getElementById('open-settings-button')?.click(); showSettings.set(!$showSettings);
} }
// Check if Ctrl + / is pressed // Check if Ctrl + / is pressed
...@@ -192,6 +192,8 @@ ...@@ -192,6 +192,8 @@
</div> </div>
<ShortcutsModal bind:show={showShortcuts} /> <ShortcutsModal bind:show={showShortcuts} />
<SettingsModal bind:show={$showSettings} />
<ChangelogModal bind:show={$showChangelog} />
<div class="app relative"> <div class="app relative">
<div <div
...@@ -292,8 +294,6 @@ ...@@ -292,8 +294,6 @@
{/if} {/if}
<Sidebar /> <Sidebar />
<SettingsModal bind:show={$showSettings} />
<ChangelogModal bind:show={$showChangelog} />
<slot /> <slot />
{/if} {/if}
</div> </div>
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
chatId, chatId,
config, config,
WEBUI_NAME, WEBUI_NAME,
tags as _tags tags as _tags,
showSidebar
} from '$lib/stores'; } from '$lib/stores';
import { copyToClipboard, splitStream } from '$lib/utils'; import { copyToClipboard, splitStream } from '$lib/utils';
...@@ -50,7 +51,9 @@ ...@@ -50,7 +51,9 @@
let currentRequestId = null; let currentRequestId = null;
let showModelSelector = true; let showModelSelector = true;
let selectedModels = ['']; let selectedModels = [''];
let atSelectedModel = '';
let selectedModelfile = null; let selectedModelfile = null;
$: selectedModelfile = $: selectedModelfile =
...@@ -144,7 +147,8 @@ ...@@ -144,7 +147,8 @@
setTimeout(() => chatInput?.focus(), 0); setTimeout(() => chatInput?.focus(), 0);
}; };
const scrollToBottom = () => { const scrollToBottom = async () => {
await tick();
if (messagesContainerElement) { if (messagesContainerElement) {
messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight; messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight;
} }
...@@ -242,7 +246,8 @@ ...@@ -242,7 +246,8 @@
const _chatId = JSON.parse(JSON.stringify($chatId)); const _chatId = JSON.parse(JSON.stringify($chatId));
await Promise.all( await Promise.all(
selectedModels.map(async (modelId) => { (atSelectedModel !== '' ? [atSelectedModel.id] : selectedModels).map(async (modelId) => {
console.log('modelId', modelId);
const model = $models.filter((m) => m.id === modelId).at(0); const model = $models.filter((m) => m.id === modelId).at(0);
if (model) { if (model) {
...@@ -536,7 +541,7 @@ ...@@ -536,7 +541,7 @@
console.log(docs); console.log(docs);
console.log(model); scrollToBottom();
const [res, controller] = await generateOpenAIChatCompletion( const [res, controller] = await generateOpenAIChatCompletion(
localStorage.token, localStorage.token,
...@@ -605,14 +610,8 @@ ...@@ -605,14 +610,8 @@
scrollToBottom(); scrollToBottom();
if (res && res.ok) { if (res && res.ok && res.body) {
const reader = res.body const textStream = await createOpenAITextStream(res.body, $settings.splitLargeChunks);
.pipeThrough(new TextDecoderStream())
.pipeThrough(splitStream('\n'))
.getReader();
const textStream = await createOpenAITextStream(reader, $settings.splitLargeChunks);
console.log(textStream);
for await (const update of textStream) { for await (const update of textStream) {
const { value, done } = update; const { value, done } = update;
...@@ -844,7 +843,11 @@ ...@@ -844,7 +843,11 @@
</title> </title>
</svelte:head> </svelte:head>
<div class="h-screen max-h-[100dvh] w-full flex flex-col"> <div
class="min-h-screen max-h-screen {$showSidebar
? 'lg:max-w-[calc(100%-260px)]'
: ''} w-full max-w-full flex flex-col"
>
<Navbar <Navbar
{title} {title}
bind:selectedModels bind:selectedModels
...@@ -855,7 +858,7 @@ ...@@ -855,7 +858,7 @@
/> />
<div class="flex flex-col flex-auto"> <div class="flex flex-col flex-auto">
<div <div
class=" pb-2.5 flex flex-col justify-between w-full flex-auto overflow-auto h-0" class=" pb-2.5 flex flex-col justify-between w-full flex-auto overflow-auto h-0 max-w-full"
id="messages-container" id="messages-container"
bind:this={messagesContainerElement} bind:this={messagesContainerElement}
on:scroll={(e) => { on:scroll={(e) => {
...@@ -873,22 +876,25 @@ ...@@ -873,22 +876,25 @@
bind:history bind:history
bind:messages bind:messages
bind:autoScroll bind:autoScroll
bind:prompt
bottomPadding={files.length > 0} bottomPadding={files.length > 0}
suggestionPrompts={selectedModelfile?.suggestionPrompts ??
$config.default_prompt_suggestions}
{sendPrompt} {sendPrompt}
{continueGeneration} {continueGeneration}
{regenerateResponse} {regenerateResponse}
/> />
</div> </div>
</div> </div>
<MessageInput
bind:files
bind:prompt
bind:autoScroll
suggestionPrompts={selectedModelfile?.suggestionPrompts ?? $config.default_prompt_suggestions}
{messages}
{submitPrompt}
{stopResponse}
/>
</div> </div>
</div> </div>
<MessageInput
bind:files
bind:prompt
bind:autoScroll
bind:selectedModel={atSelectedModel}
{messages}
{submitPrompt}
{stopResponse}
/>
This diff is collapsed.
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
import { onMount, tick, getContext } from 'svelte'; import { onMount, tick, getContext } from 'svelte';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { page } from '$app/stores'; import { page } from '$app/stores';
import { import {
models, models,
modelfiles, modelfiles,
...@@ -15,7 +14,8 @@ ...@@ -15,7 +14,8 @@
chatId, chatId,
config, config,
WEBUI_NAME, WEBUI_NAME,
tags as _tags tags as _tags,
showSidebar
} from '$lib/stores'; } from '$lib/stores';
import { copyToClipboard, splitStream, convertMessagesToHistory } from '$lib/utils'; import { copyToClipboard, splitStream, convertMessagesToHistory } from '$lib/utils';
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
// let chatId = $page.params.id; // let chatId = $page.params.id;
let showModelSelector = true; let showModelSelector = true;
let selectedModels = ['']; let selectedModels = [''];
let atSelectedModel = '';
let selectedModelfile = null; let selectedModelfile = null;
$: selectedModelfile = $: selectedModelfile =
...@@ -167,7 +169,8 @@ ...@@ -167,7 +169,8 @@
} }
}; };
const scrollToBottom = () => { const scrollToBottom = async () => {
await tick();
if (messagesContainerElement) { if (messagesContainerElement) {
messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight; messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight;
} }
...@@ -256,7 +259,7 @@ ...@@ -256,7 +259,7 @@
const _chatId = JSON.parse(JSON.stringify($chatId)); const _chatId = JSON.parse(JSON.stringify($chatId));
await Promise.all( await Promise.all(
selectedModels.map(async (modelId) => { (atSelectedModel !== '' ? [atSelectedModel.id] : selectedModels).map(async (modelId) => {
const model = $models.filter((m) => m.id === modelId).at(0); const model = $models.filter((m) => m.id === modelId).at(0);
if (model) { if (model) {
...@@ -550,6 +553,8 @@ ...@@ -550,6 +553,8 @@
console.log(docs); console.log(docs);
scrollToBottom();
const [res, controller] = await generateOpenAIChatCompletion( const [res, controller] = await generateOpenAIChatCompletion(
localStorage.token, localStorage.token,
{ {
...@@ -617,14 +622,8 @@ ...@@ -617,14 +622,8 @@
scrollToBottom(); scrollToBottom();
if (res && res.ok) { if (res && res.ok && res.body) {
const reader = res.body const textStream = await createOpenAITextStream(res.body, $settings.splitLargeChunks);
.pipeThrough(new TextDecoderStream())
.pipeThrough(splitStream('\n'))
.getReader();
const textStream = await createOpenAITextStream(reader, $settings.splitLargeChunks);
console.log(textStream);
for await (const update of textStream) { for await (const update of textStream) {
const { value, done } = update; const { value, done } = update;
...@@ -863,7 +862,11 @@ ...@@ -863,7 +862,11 @@
</svelte:head> </svelte:head>
{#if loaded} {#if loaded}
<div class="min-h-screen max-h-screen w-full flex flex-col"> <div
class="min-h-screen max-h-screen {$showSidebar
? 'lg:max-w-[calc(100%-260px)]'
: ''} w-full max-w-full flex flex-col"
>
<Navbar <Navbar
{title} {title}
{chat} {chat}
...@@ -881,7 +884,7 @@ ...@@ -881,7 +884,7 @@
/> />
<div class="flex flex-col flex-auto"> <div class="flex flex-col flex-auto">
<div <div
class=" pb-2.5 flex flex-col justify-between w-full flex-auto overflow-auto h-0" class=" pb-2.5 flex flex-col justify-between w-full flex-auto overflow-auto h-0 max-w-full"
id="messages-container" id="messages-container"
bind:this={messagesContainerElement} bind:this={messagesContainerElement}
on:scroll={(e) => { on:scroll={(e) => {
...@@ -906,17 +909,17 @@ ...@@ -906,17 +909,17 @@
/> />
</div> </div>
</div> </div>
<MessageInput
bind:files
bind:prompt
bind:autoScroll
suggestionPrompts={selectedModelfile?.suggestionPrompts ??
$config.default_prompt_suggestions}
{messages}
{submitPrompt}
{stopResponse}
/>
</div> </div>
</div> </div>
<MessageInput
bind:files
bind:prompt
bind:autoScroll
bind:selectedModel={atSelectedModel}
suggestionPrompts={selectedModelfile?.suggestionPrompts ?? $config.default_prompt_suggestions}
{messages}
{submitPrompt}
{stopResponse}
/>
{/if} {/if}
...@@ -345,7 +345,7 @@ ...@@ -345,7 +345,7 @@
// await chats.set(await getChatListByTagName(localStorage.token, tag.name)); // await chats.set(await getChatListByTagName(localStorage.token, tag.name));
}} }}
> >
<div class=" text-xs font-medium self-center line-clamp-1">{$i18n.t('add tags')}</div> <div class=" text-xs font-medium self-center line-clamp-1">add tags</div>
</button> --> </button> -->
<button <button
......
...@@ -316,7 +316,7 @@ ...@@ -316,7 +316,7 @@
</div> </div>
</div> </div>
<div class="flex flex-col gap-1 px-1 w-full"> <div class="flex flex-col gap-1 w-full">
<div class="flex w-full"> <div class="flex w-full">
<div class="overflow-hidden w-full"> <div class="overflow-hidden w-full">
<div class="max-w-full"> <div class="max-w-full">
...@@ -330,6 +330,7 @@ ...@@ -330,6 +330,7 @@
info: model info: model
}))} }))}
bind:value={selectedModelId} bind:value={selectedModelId}
className="max-w-2xl"
/> />
</div> </div>
</div> </div>
......
This diff is collapsed.
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