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
9e60d039
Unverified
Commit
9e60d039
authored
May 18, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
May 18, 2024
Browse files
Merge pull request #2318 from idomamia/feat/rtl-layout-chat-support
Add RTL layout chat support
parents
04925407
27c59d98
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
38 additions
and
6 deletions
+38
-6
src/lib/components/chat/MessageInput.svelte
src/lib/components/chat/MessageInput.svelte
+1
-0
src/lib/components/chat/Messages/CodeBlock.svelte
src/lib/components/chat/Messages/CodeBlock.svelte
+1
-1
src/lib/components/chat/Messages/Name.svelte
src/lib/components/chat/Messages/Name.svelte
+1
-1
src/lib/components/chat/Messages/ProfileImage.svelte
src/lib/components/chat/Messages/ProfileImage.svelte
+3
-1
src/lib/components/chat/Messages/ResponseMessage.svelte
src/lib/components/chat/Messages/ResponseMessage.svelte
+2
-2
src/lib/components/chat/Messages/UserMessage.svelte
src/lib/components/chat/Messages/UserMessage.svelte
+1
-1
src/lib/components/chat/Settings/Interface.svelte
src/lib/components/chat/Settings/Interface.svelte
+25
-0
src/lib/i18n/locales/en-US/translation.json
src/lib/i18n/locales/en-US/translation.json
+3
-0
src/lib/stores/index.ts
src/lib/stores/index.ts
+1
-0
No files found.
src/lib/components/chat/MessageInput.svelte
View file @
9e60d039
...
...
@@ -584,6 +584,7 @@
}}
/>
<form
dir={$settings?.chatDirection}
class=" flex flex-col relative w-full rounded-3xl px-1.5 bg-gray-50 dark:bg-gray-850 dark:text-gray-100"
on:submit|preventDefault={() => {
submitPrompt(prompt, user);
...
...
src/lib/components/chat/Messages/CodeBlock.svelte
View file @
9e60d039
...
...
@@ -272,7 +272,7 @@ __builtins__.input = input`);
</script>
{#if code}
<div class="mb-4">
<div class="mb-4"
dir="ltr"
>
<div
class="flex justify-between bg-[#202123] text-white text-xs px-4 pt-1 pb-0.5 rounded-t-lg overflow-x-auto"
>
...
...
src/lib/components/chat/Messages/Name.svelte
View file @
9e60d039
<div class=" self-center font-bold mb-0.5 line-clamp-1">
<div class=" self-center font-bold mb-0.5 line-clamp-1
contents
">
<slot />
</div>
src/lib/components/chat/Messages/ProfileImage.svelte
View file @
9e60d039
<script lang="ts">
import { settings } from '$lib/stores';
import { WEBUI_BASE_URL } from '$lib/constants';
export let src = '/user.png';
</script>
<div class=
" mr-3"
>
<div class=
{$settings?.chatDirection === 'LTR' ? "mr-3" : "ml-3"}
>
<img
crossorigin="anonymous"
src={src.startsWith(WEBUI_BASE_URL) ||
...
...
src/lib/components/chat/Messages/ResponseMessage.svelte
View file @
9e60d039
...
...
@@ -332,7 +332,7 @@
<CitationsModal bind:show={showCitationModal} citation={selectedCitation} />
{#key message.id}
<div class=" flex w-full message-{message.id}" id="message-{message.id}">
<div class=" flex w-full message-{message.id}" id="message-{message.id}"
dir="{$settings.chatDirection}"
>
<ProfileImage
src={modelfiles[message.model]?.imageUrl ??
($i18n.language === 'dg-DG' ? `/doge.png` : `${WEBUI_BASE_URL}/static/favicon.png`)}
...
...
@@ -495,7 +495,7 @@
class=" flex justify-start overflow-x-auto buttons text-gray-600 dark:text-gray-500"
>
{#if siblings.length > 1}
<div class="flex self-center">
<div class="flex self-center"
dir="ltr"
>
<button
class="self-center p-1 hover:bg-black/5 dark:hover:bg-white/5 dark:hover:text-white hover:text-black rounded-md transition"
on:click={() => {
...
...
src/lib/components/chat/Messages/UserMessage.svelte
View file @
9e60d039
...
...
@@ -54,7 +54,7 @@
};
</script>
<div class=" flex w-full user-message">
<div class=" flex w-full user-message"
dir="{$settings.chatDirection}"
>
{#if !($settings?.chatBubble ?? true)}
<ProfileImage
src={message.user
...
...
src/lib/components/chat/Settings/Interface.svelte
View file @
9e60d039
...
...
@@ -23,6 +23,7 @@
let promptSuggestions = [];
let showUsername = false;
let chatBubble = true;
let chatDirection: 'LTR' | 'RTL' = 'LTR';
const toggleSplitLargeChunks = async () => {
splitLargeChunks = !splitLargeChunks;
...
...
@@ -76,6 +77,11 @@
}
};
const toggleChangeChatDirection = async () => {
chatDirection = chatDirection === 'LTR' ? 'RTL' : 'LTR';
saveSettings({chatDirection});
};
const updateInterfaceHandler = async () => {
if ($user.role === 'admin') {
promptSuggestions = await setDefaultPromptSuggestions(localStorage.token, promptSuggestions);
...
...
@@ -114,6 +120,7 @@
chatBubble = settings.chatBubble ?? true;
fullScreenMode = settings.fullScreenMode ?? false;
splitLargeChunks = settings.splitLargeChunks ?? false;
chatDirection = settings.chatDirection ?? 'LTR';
});
</script>
...
...
@@ -255,6 +262,24 @@
</div>
</div>
<div>
<div class=" py-0.5 flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Chat direction')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
on:click={toggleChangeChatDirection}
type="button"
>
{#if chatDirection === 'LTR'}
<span class="ml-2 self-center">{$i18n.t('LTR')}</span>
{:else}
<span class="ml-2 self-center">{$i18n.t('RTL')}</span>
{/if}
</button>
</div>
</div>
<hr class=" dark:border-gray-700" />
<div>
...
...
src/lib/i18n/locales/en-US/translation.json
View file @
9e60d039
...
...
@@ -68,6 +68,7 @@
"Change Password"
:
""
,
"Chat"
:
""
,
"Chat Bubble UI"
:
""
,
"Chat direction"
:
""
,
"Chat History"
:
""
,
"Chat History is off for this browser."
:
""
,
"Chats"
:
""
,
...
...
@@ -246,6 +247,7 @@
"Light"
:
""
,
"Listening..."
:
""
,
"LLMs can make mistakes. Verify important information."
:
""
,
"LTR"
:
""
,
"Made by OpenWebUI Community"
:
""
,
"Make sure to enclose them with"
:
""
,
"Manage LiteLLM Models"
:
""
,
...
...
@@ -361,6 +363,7 @@
"Role"
:
""
,
"Rosé Pine"
:
""
,
"Rosé Pine Dawn"
:
""
,
"RTL"
:
""
,
"Save"
:
""
,
"Save & Create"
:
""
,
"Save & Update"
:
""
,
...
...
src/lib/stores/index.ts
View file @
9e60d039
...
...
@@ -84,6 +84,7 @@ type Settings = {
notificationEnabled
?:
boolean
;
title
?:
TitleSettings
;
splitLargeDeltas
?:
boolean
;
chatDirection
:
'
LTR
'
|
'
RTL
'
;
system
?:
string
;
requestFormat
?:
string
;
...
...
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