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