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
3c9fc785
Commit
3c9fc785
authored
Apr 30, 2024
by
Timothy J. Baek
Browse files
fix: styling
parent
bf2ff47d
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
499 additions
and
499 deletions
+499
-499
src/lib/components/chat/MessageInput.svelte
src/lib/components/chat/MessageInput.svelte
+470
-467
src/lib/components/chat/Messages.svelte
src/lib/components/chat/Messages.svelte
+1
-1
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+15
-18
src/lib/stores/index.ts
src/lib/stores/index.ts
+2
-0
src/routes/(app)/+page.svelte
src/routes/(app)/+page.svelte
+1
-2
src/routes/(app)/c/[id]/+page.svelte
src/routes/(app)/c/[id]/+page.svelte
+10
-11
No files found.
src/lib/components/chat/MessageInput.svelte
View file @
3c9fc785
This diff is collapsed.
Click to expand it.
src/lib/components/chat/Messages.svelte
View file @
3c9fc785
...
@@ -297,7 +297,7 @@
...
@@ -297,7 +297,7 @@
}}
}}
/>
/>
{:else}
{:else}
<div class="pt-2 pb-28">
<div class="
{$settings?.fullScreenMode ?? null ? 'w-full' : 'mx-auto'}
pt-2 pb-28">
{#key chatId}
{#key chatId}
{#each messages as message, messageIdx}
{#each messages as message, messageIdx}
<div class=" w-full">
<div class=" w-full">
...
...
src/lib/components/layout/Sidebar.svelte
View file @
3c9fc785
<script lang="ts">
<script lang="ts">
import { v4 as uuidv4 } from 'uuid';
import { goto } from '$app/navigation';
import { user, chats, settings, showSettings, chatId, tags, showSidebar } from '$lib/stores';
import fileSaver from 'file-saver';
const { saveAs } = fileSaver;
import { goto, invalidateAll } from '$app/navigation';
import { page } from '$app/stores';
import { user, chats, settings, showSettings, chatId, tags } from '$lib/stores';
import { onMount, getContext } from 'svelte';
import { onMount, getContext } from 'svelte';
const i18n = getContext('i18n');
const i18n = getContext('i18n');
...
@@ -30,6 +24,7 @@
...
@@ -30,6 +24,7 @@
import ArchivedChatsModal from './Sidebar/ArchivedChatsModal.svelte';
import ArchivedChatsModal from './Sidebar/ArchivedChatsModal.svelte';
const BREAKPOINT = 1024;
const BREAKPOINT = 1024;
let show = false;
let show = false;
let navElement;
let navElement;
...
@@ -50,7 +45,7 @@
...
@@ -50,7 +45,7 @@
let isEditing = false;
let isEditing = false;
onMount(async () => {
onMount(async () => {
show
=
window.innerWidth > BREAKPOINT;
show
Sidebar.set(
window.innerWidth > BREAKPOINT
)
;
await chats.set(await getChatList(localStorage.token));
await chats.set(await getChatList(localStorage.token));
let touchstart;
let touchstart;
...
@@ -61,10 +56,10 @@
...
@@ -61,10 +56,10 @@
const swipeDistance = Math.abs(touchend.screenX - touchstart.screenX);
const swipeDistance = Math.abs(touchend.screenX - touchstart.screenX);
if (touchstart.clientX < 40 && swipeDistance >= screenWidth / 4) {
if (touchstart.clientX < 40 && swipeDistance >= screenWidth / 4) {
if (touchend.screenX < touchstart.screenX) {
if (touchend.screenX < touchstart.screenX) {
show
=
false;
show
Sidebar.set(
false
)
;
}
}
if (touchend.screenX > touchstart.screenX) {
if (touchend.screenX > touchstart.screenX) {
show
=
true;
show
Sidebar.set(
true
)
;
}
}
}
}
}
}
...
@@ -80,8 +75,8 @@
...
@@ -80,8 +75,8 @@
};
};
const onResize = () => {
const onResize = () => {
if (show && window.innerWidth < BREAKPOINT) {
if (
$
show
Sidebar
&& window.innerWidth < BREAKPOINT) {
show
=
false;
show
Sidebar.set(
false
)
;
}
}
};
};
...
@@ -167,13 +162,15 @@
...
@@ -167,13 +162,15 @@
<div
<div
bind:this={navElement}
bind:this={navElement}
class="h-screen max-h-[100dvh] min-h-screen {show
id="sidebar"
class="h-screen max-h-[100dvh] min-h-screen {$showSidebar
? 'lg:relative w-[260px]'
? 'lg:relative w-[260px]'
: '-translate-x-[260px] w-[0px]'} bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-200 text-sm transition fixed z-50 top-0 left-0
: '-translate-x-[260px] w-[0px]'} bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-200 text-sm transition fixed z-50 top-0 left-0
"
"
data-state={$showSidebar}
>
>
<div
<div
class="py-2.5 my-auto flex flex-col justify-between h-screen max-h-[100dvh] w-[260px] {show
class="py-2.5 my-auto flex flex-col justify-between h-screen max-h-[100dvh] w-[260px] {
$
show
Sidebar
? ''
? ''
: 'invisible'}"
: 'invisible'}"
>
>
...
@@ -466,7 +463,7 @@
...
@@ -466,7 +463,7 @@
on:click={() => {
on:click={() => {
selectedChatId = chat.id;
selectedChatId = chat.id;
if (window.innerWidth < 1024) {
if (window.innerWidth < 1024) {
show
=
false;
show
Sidebar.set(
false
)
;
}
}
}}
}}
draggable="false"
draggable="false"
...
@@ -803,14 +800,14 @@
...
@@ -803,14 +800,14 @@
>
>
<Tooltip
<Tooltip
placement="right"
placement="right"
content={`${show ? $i18n.t('Close') : $i18n.t('Open')} ${$i18n.t('sidebar')}`}
content={`${
$
show
Sidebar
? $i18n.t('Close') : $i18n.t('Open')} ${$i18n.t('sidebar')}`}
touch={false}
touch={false}
>
>
<button
<button
id="sidebar-toggle-button"
id="sidebar-toggle-button"
class=" group"
class=" group"
on:click={() => {
on:click={() => {
show
= !show
;
show
Sidebar.set(!$showSidebar)
;
}}
}}
><span class="" data-state="closed"
><span class="" data-state="closed"
><div
><div
...
...
src/lib/stores/index.ts
View file @
3c9fc785
...
@@ -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
);
...
...
src/routes/(app)/+page.svelte
View file @
3c9fc785
...
@@ -877,7 +877,6 @@
...
@@ -877,7 +877,6 @@
/>
/>
</div>
</div>
</div>
</div>
<MessageInput bind:files bind:prompt bind:autoScroll {messages} {submitPrompt} {stopResponse} />
</div>
</div>
</div>
</div>
<MessageInput bind:files bind:prompt bind:autoScroll {messages} {submitPrompt} {stopResponse} />
src/routes/(app)/c/[id]/+page.svelte
View file @
3c9fc785
...
@@ -900,17 +900,16 @@
...
@@ -900,17 +900,16 @@
/>
/>
</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
suggestionPrompts={selectedModelfile?.suggestionPrompts ?? $config.default_prompt_suggestions}
{messages}
{submitPrompt}
{stopResponse}
/>
{/if}
{/if}
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