mirror of
https://github.com/open-webui/open-webui
synced 2025-05-23 14:24:22 +00:00
Merge pull request #2318 from idomamia/feat/rtl-layout-chat-support
Add RTL layout chat support
This commit is contained in:
commit
9e60d03911
@ -584,6 +584,7 @@
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<form
|
<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"
|
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={() => {
|
on:submit|preventDefault={() => {
|
||||||
submitPrompt(prompt, user);
|
submitPrompt(prompt, user);
|
||||||
|
@ -272,7 +272,7 @@ __builtins__.input = input`);
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if code}
|
{#if code}
|
||||||
<div class="mb-4">
|
<div class="mb-4" dir="ltr">
|
||||||
<div
|
<div
|
||||||
class="flex justify-between bg-[#202123] text-white text-xs px-4 pt-1 pb-0.5 rounded-t-lg overflow-x-auto"
|
class="flex justify-between bg-[#202123] text-white text-xs px-4 pt-1 pb-0.5 rounded-t-lg overflow-x-auto"
|
||||||
>
|
>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<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 />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { settings } from '$lib/stores';
|
||||||
import { WEBUI_BASE_URL } from '$lib/constants';
|
import { WEBUI_BASE_URL } from '$lib/constants';
|
||||||
|
|
||||||
export let src = '/user.png';
|
export let src = '/user.png';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class=" mr-3">
|
<div class={$settings?.chatDirection === 'LTR' ? "mr-3" : "ml-3"}>
|
||||||
<img
|
<img
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
src={src.startsWith(WEBUI_BASE_URL) ||
|
src={src.startsWith(WEBUI_BASE_URL) ||
|
||||||
|
@ -332,7 +332,7 @@
|
|||||||
<CitationsModal bind:show={showCitationModal} citation={selectedCitation} />
|
<CitationsModal bind:show={showCitationModal} citation={selectedCitation} />
|
||||||
|
|
||||||
{#key message.id}
|
{#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
|
<ProfileImage
|
||||||
src={modelfiles[message.model]?.imageUrl ??
|
src={modelfiles[message.model]?.imageUrl ??
|
||||||
($i18n.language === 'dg-DG' ? `/doge.png` : `${WEBUI_BASE_URL}/static/favicon.png`)}
|
($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"
|
class=" flex justify-start overflow-x-auto buttons text-gray-600 dark:text-gray-500"
|
||||||
>
|
>
|
||||||
{#if siblings.length > 1}
|
{#if siblings.length > 1}
|
||||||
<div class="flex self-center">
|
<div class="flex self-center" dir="ltr">
|
||||||
<button
|
<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"
|
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={() => {
|
on:click={() => {
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class=" flex w-full user-message">
|
<div class=" flex w-full user-message" dir="{$settings.chatDirection}">
|
||||||
{#if !($settings?.chatBubble ?? true)}
|
{#if !($settings?.chatBubble ?? true)}
|
||||||
<ProfileImage
|
<ProfileImage
|
||||||
src={message.user
|
src={message.user
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
let promptSuggestions = [];
|
let promptSuggestions = [];
|
||||||
let showUsername = false;
|
let showUsername = false;
|
||||||
let chatBubble = true;
|
let chatBubble = true;
|
||||||
|
let chatDirection: 'LTR' | 'RTL' = 'LTR';
|
||||||
|
|
||||||
const toggleSplitLargeChunks = async () => {
|
const toggleSplitLargeChunks = async () => {
|
||||||
splitLargeChunks = !splitLargeChunks;
|
splitLargeChunks = !splitLargeChunks;
|
||||||
@ -76,6 +77,11 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleChangeChatDirection = async () => {
|
||||||
|
chatDirection = chatDirection === 'LTR' ? 'RTL' : 'LTR';
|
||||||
|
saveSettings({chatDirection});
|
||||||
|
};
|
||||||
|
|
||||||
const updateInterfaceHandler = async () => {
|
const updateInterfaceHandler = async () => {
|
||||||
if ($user.role === 'admin') {
|
if ($user.role === 'admin') {
|
||||||
promptSuggestions = await setDefaultPromptSuggestions(localStorage.token, promptSuggestions);
|
promptSuggestions = await setDefaultPromptSuggestions(localStorage.token, promptSuggestions);
|
||||||
@ -114,6 +120,7 @@
|
|||||||
chatBubble = settings.chatBubble ?? true;
|
chatBubble = settings.chatBubble ?? true;
|
||||||
fullScreenMode = settings.fullScreenMode ?? false;
|
fullScreenMode = settings.fullScreenMode ?? false;
|
||||||
splitLargeChunks = settings.splitLargeChunks ?? false;
|
splitLargeChunks = settings.splitLargeChunks ?? false;
|
||||||
|
chatDirection = settings.chatDirection ?? 'LTR';
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -255,6 +262,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</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" />
|
<hr class=" dark:border-gray-700" />
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
"Change Password": "",
|
"Change Password": "",
|
||||||
"Chat": "",
|
"Chat": "",
|
||||||
"Chat Bubble UI": "",
|
"Chat Bubble UI": "",
|
||||||
|
"Chat direction": "",
|
||||||
"Chat History": "",
|
"Chat History": "",
|
||||||
"Chat History is off for this browser.": "",
|
"Chat History is off for this browser.": "",
|
||||||
"Chats": "",
|
"Chats": "",
|
||||||
@ -246,6 +247,7 @@
|
|||||||
"Light": "",
|
"Light": "",
|
||||||
"Listening...": "",
|
"Listening...": "",
|
||||||
"LLMs can make mistakes. Verify important information.": "",
|
"LLMs can make mistakes. Verify important information.": "",
|
||||||
|
"LTR": "",
|
||||||
"Made by OpenWebUI Community": "",
|
"Made by OpenWebUI Community": "",
|
||||||
"Make sure to enclose them with": "",
|
"Make sure to enclose them with": "",
|
||||||
"Manage LiteLLM Models": "",
|
"Manage LiteLLM Models": "",
|
||||||
@ -361,6 +363,7 @@
|
|||||||
"Role": "",
|
"Role": "",
|
||||||
"Rosé Pine": "",
|
"Rosé Pine": "",
|
||||||
"Rosé Pine Dawn": "",
|
"Rosé Pine Dawn": "",
|
||||||
|
"RTL": "",
|
||||||
"Save": "",
|
"Save": "",
|
||||||
"Save & Create": "",
|
"Save & Create": "",
|
||||||
"Save & Update": "",
|
"Save & Update": "",
|
||||||
|
@ -84,6 +84,7 @@ type Settings = {
|
|||||||
notificationEnabled?: boolean;
|
notificationEnabled?: boolean;
|
||||||
title?: TitleSettings;
|
title?: TitleSettings;
|
||||||
splitLargeDeltas?: boolean;
|
splitLargeDeltas?: boolean;
|
||||||
|
chatDirection: 'LTR' | 'RTL';
|
||||||
|
|
||||||
system?: string;
|
system?: string;
|
||||||
requestFormat?: string;
|
requestFormat?: string;
|
||||||
|
Loading…
Reference in New Issue
Block a user