diff --git a/.env.example b/.env.example index 7bf9d2d..7706480 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ + # this is an example .env file, use it to create your own .env file and place it in the root of the project # settings for OpenAI diff --git a/libs/ktem/ktem/assets/css/main.css b/libs/ktem/ktem/assets/css/main.css index 5a272e6..b6de9c2 100644 --- a/libs/ktem/ktem/assets/css/main.css +++ b/libs/ktem/ktem/assets/css/main.css @@ -1,7 +1,10 @@ :root { --main-area-height: calc(100vh - 110px); + direction: rtl; } + + /* no footer */ footer { display: none !important; @@ -27,6 +30,11 @@ footer { height: 100% !important; */ } +input[type="radio"] { + margin-left: 5px; +} + +.gradio-container /* styling for header bar */ .header-bar { background-color: transparent; @@ -168,6 +176,27 @@ mark { color: var(--body-text-color); } +#chat-input textarea{ + direction: rtl; +} +#chat-input button.submit-button{ + margin-left: 3px; + margin-right: 3px; + transform: scaleX(-1); + -moz-transform: scaleX(-1); + -webkit-transform: scaleX(-1); +} + +.secondary-wrap { + position: relative; +} + +.secondary-wrap .icon-wrap{ + /* direction: ltr; */ + position:absolute; + right: 90%; +} + /* for setting right-aligned buttons */ .right-button { min-width: 200px !important; @@ -195,13 +224,13 @@ mark { #toggle-dark-button { position: fixed; top: 6px; - right: 30px; + left: 30px; } #info-expand-button { position: absolute; top: 6px; - right: 15px; + left: 30px; } /* prevent overflow of html info panel */ @@ -212,7 +241,7 @@ mark { #chat-expand-button { position: absolute; top: 6px; - right: -10px; + left: -10px; z-index: 1; } @@ -231,14 +260,14 @@ mark { position: absolute; width: 110px; top: 10px; - right: 25px; + left: 15px; } #citation-dropdown { width: min(25%, 100px); position: absolute; top: 2px; - left: 120px; + right: 120px; height: 35px; } @@ -377,9 +406,16 @@ pdfjs-viewer-element { /* Bot animation */ -.message.bot { - animation: fadein 1.0s ease-in-out forwards; -} + + + + + +/* .message.bot button{ + text-align: right; + background-color: blue; + direction: rtl !important; +} */ details.evidence { animation: fadein 0.3s ease-in-out forwards; diff --git a/libs/ktem/ktem/assets/js/main.js b/libs/ktem/ktem/assets/js/main.js index 8e63853..9585b92 100644 --- a/libs/ktem/ktem/assets/js/main.js +++ b/libs/ktem/ktem/assets/js/main.js @@ -21,7 +21,7 @@ function run() { // setup conversation dropdown placeholder let conv_dropdown = document.querySelector("#conversation-dropdown input"); - conv_dropdown.placeholder = "Browse conversation"; + conv_dropdown.placeholder = "مرور گفتگو"; // move info-expand-button let info_expand_button = document.getElementById("info-expand-button"); diff --git a/libs/ktem/ktem/index/file/ui.py b/libs/ktem/ktem/index/file/ui.py index deb1ac3..a15304e 100644 --- a/libs/ktem/ktem/index/file/ui.py +++ b/libs/ktem/ktem/index/file/ui.py @@ -40,8 +40,8 @@ chat_input_focus_js_with_submit = """ function() { let chatInput = document.querySelector("#chat-input textarea"); let chatInputSubmit = document.querySelector("#chat-input button.submit-button"); - chatInputSubmit.click(); chatInput.focus(); + chatInputSubmit.click(); } """ @@ -1631,8 +1631,8 @@ class FileSelector(BasePage): self.mode = gr.Radio( value=default_mode, choices=[ - ("Search All", "all"), - ("Search In File(s)", "select"), + (" جستجو همگانی ", "all"), + (" جستجو در فایل ها ", "select"), ], container=False, ) diff --git a/libs/ktem/ktem/main.py b/libs/ktem/ktem/main.py index f9ff6be..6bffafd 100644 --- a/libs/ktem/ktem/main.py +++ b/libs/ktem/ktem/main.py @@ -48,12 +48,12 @@ class App(BaseApp): from ktem.pages.login import LoginPage with gr.Tab( - "Welcome", elem_id="login-tab", id="login-tab" + "خوش آمدید", elem_id="login-tab", id="login-tab" ) as self._tabs["login-tab"]: self.login_page = LoginPage(self) with gr.Tab( - "Chat", + "گفتگو", elem_id="chat-tab", id="chat-tab", visible=not self.f_user_management, @@ -77,7 +77,7 @@ class App(BaseApp): setattr(self, f"_index_{index.id}", page) elif len(self.index_manager.indices) > 1: with gr.Tab( - "Files", + "فایل ها", elem_id="indices-tab", elem_classes=["fill-main-area-height", "scrollable", "indices-tab"], id="indices-tab", @@ -94,7 +94,7 @@ class App(BaseApp): if not KH_DEMO_MODE: if not KH_SSO_ENABLED: with gr.Tab( - "Resources", + "منابع", elem_id="resources-tab", id="resources-tab", visible=not self.f_user_management, @@ -103,7 +103,7 @@ class App(BaseApp): self.resources_page = ResourcesTab(self) with gr.Tab( - "Settings", + "تنظیمات", elem_id="settings-tab", id="settings-tab", visible=not self.f_user_management, @@ -112,7 +112,7 @@ class App(BaseApp): self.settings_page = SettingsPage(self) with gr.Tab( - "Help", + "راهنما", elem_id="help-tab", id="help-tab", visible=not self.f_user_management, diff --git a/libs/ktem/ktem/pages/chat/__init__.py b/libs/ktem/ktem/pages/chat/__init__.py index ba19749..fdee8a6 100644 --- a/libs/ktem/ktem/pages/chat/__init__.py +++ b/libs/ktem/ktem/pages/chat/__init__.py @@ -272,7 +272,7 @@ class ChatPage(BasePage): if len(self._app.index_manager.indices) > 0: quick_upload_label = ( - "Quick Upload" if not KH_DEMO_MODE else "Or input new paper URL" + "بارگذاری" if not KH_DEMO_MODE else "Or input new paper URL" ) with gr.Accordion(label=quick_upload_label) as _: @@ -287,9 +287,9 @@ class ChatPage(BasePage): ) self.quick_urls = gr.Textbox( placeholder=( - "Or paste URLs" + "یا آدرس وب جایگذاری کنید" if not KH_DEMO_MODE - else "Paste Arxiv URLs\n(https://arxiv.org/abs/xxx)" + else "آدرس وب جایگذاری کنید\n(https://arxiv.org/abs/xxx)" ), lines=1, container=False, @@ -314,17 +314,17 @@ class ChatPage(BasePage): self.chat_panel = ChatPanel(self._app) with gr.Accordion( - label="Chat settings", + label="تنظیمات گفتگو", elem_id="chat-settings-expand", open=False, visible=not KH_DEMO_MODE, ) as self.chat_settings: with gr.Row(elem_id="quick-setting-labels"): - gr.HTML("Reasoning method") + gr.HTML("روش استدلال") gr.HTML( - "Model", visible=not KH_DEMO_MODE and not KH_SSO_ENABLED + "مدل", visible=not KH_DEMO_MODE and not KH_SSO_ENABLED ) - gr.HTML("Language") + gr.HTML("زبان") with gr.Row(): reasoning_setting = ( @@ -372,7 +372,7 @@ class ChatPage(BasePage): if not config("USE_LOW_LLM_REQUESTS", default=False, cast=bool): self.use_mindmap = gr.State(value=True) self.use_mindmap_check = gr.Checkbox( - label="Mindmap (on)", + label="نقشه ذهنی روشن", container=False, elem_id="use-mindmap-checkbox", value=True, @@ -380,7 +380,7 @@ class ChatPage(BasePage): else: self.use_mindmap = gr.State(value=False) self.use_mindmap_check = gr.Checkbox( - label="Mindmap (off)", + label="نقشه ذهنی خاموش", container=False, elem_id="use-mindmap-checkbox", value=False, @@ -390,7 +390,7 @@ class ChatPage(BasePage): scale=INFO_PANEL_SCALES[False], elem_id="chat-info-panel" ) as self.info_column: with gr.Accordion( - label="Information panel", open=True, elem_id="info-expand" + label="پنل اطلاعات", open=True, elem_id="info-expand" ): self.modal = gr.HTML("
") self.plot_panel = gr.Plot(visible=False) diff --git a/libs/ktem/ktem/pages/chat/chat_panel.py b/libs/ktem/ktem/pages/chat/chat_panel.py index 7ced90b..db8768b 100644 --- a/libs/ktem/ktem/pages/chat/chat_panel.py +++ b/libs/ktem/ktem/pages/chat/chat_panel.py @@ -6,15 +6,15 @@ KH_DEMO_MODE = getattr(flowsettings, "KH_DEMO_MODE", False) if not KH_DEMO_MODE: PLACEHOLDER_TEXT = ( - "This is the beginning of a new conversation.\n" - "Start by uploading a file or a web URL. " - "Visit Files tab for more options (e.g: GraphRAG)." + ".این شروع یک گفتگوی جدید است\n" + ".با بارگذاری یک فایل یا یک آدرس وب شروع کنید\n " + ".برای گزینه های بیشتر به برگه فایل ها مراجعه کنید " ) else: PLACEHOLDER_TEXT = ( - "Welcome to Kotaemon Demo. " - "Start by browsing preloaded conversations to get onboard.\n" - "Check out Hint section for more tips." + ".به دموی دیتال چت خوش آمدید \n" + ".برای شروع، مکالمات قبلی بارگذاری شده را مرور کنید\n" + ".برای نکات بیشتر به بخش راهنمایی مراجعه کنید" ) @@ -28,6 +28,7 @@ class ChatPanel(BasePage): label=self._app.app_name, placeholder=PLACEHOLDER_TEXT, show_label=False, + rtl = True, elem_id="main-chat-bot", show_copy_button=True, likeable=True, @@ -37,9 +38,10 @@ class ChatPanel(BasePage): self.text_input = gr.MultimodalTextbox( interactive=True, scale=20, + rtl=True, file_count="multiple", placeholder=( - "Type a message, search the @web, or tag a file with @filename" + "یک پیام بنویسید" ), container=False, show_label=False, diff --git a/libs/ktem/ktem/pages/chat/control.py b/libs/ktem/ktem/pages/chat/control.py index fb2b50c..4b06b04 100644 --- a/libs/ktem/ktem/pages/chat/control.py +++ b/libs/ktem/ktem/pages/chat/control.py @@ -51,8 +51,8 @@ class ConversationControl(BasePage): def on_building_ui(self): with gr.Row(): - title_text = "Conversations" if not KH_DEMO_MODE else "Kotaemon Papers" - gr.Markdown("## {}".format(title_text)) + title_text = "گفتگو ها" if not KH_DEMO_MODE else "Kotaemon Papers" + gr.Markdown(f'