Add persian lang
Some checks failed
Auto Bump and Release / auto-bump-and-release (push) Has been cancelled
style-check / pre-commit (push) Has been cancelled
unit-test / unit testing with python ${{ matrix.python-version }} (. env/bin/activate, $GITHUB_OUTPUT, ubuntu-latest, bash) (push) Has been cancelled
unit-test / unit testing with python ${{ matrix.python-version }} (3.10) (push) Has been cancelled
unit-test / unit testing with python ${{ matrix.python-version }} (3.11) (push) Has been cancelled

This commit is contained in:
Ali Abdollahian Abdollahian 2025-07-27 10:12:01 +03:30
parent 17864a439a
commit d8309edefb
9 changed files with 92 additions and 56 deletions

View File

@ -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

View File

@ -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;

View File

@ -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");

View File

@ -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,
)

View File

@ -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,

View File

@ -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("<div id='pdf-modal'></div>")
self.plot_panel = gr.Plot(visible=False)

View File

@ -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,

View File

@ -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'<div dir="rtl"> {title_text}</div>')
self.btn_toggle_dark_mode = gr.Button(
value="",
icon=f"{ASSETS_DIR}/dark_mode.svg",
@ -66,7 +66,7 @@ class ConversationControl(BasePage):
icon=f"{ASSETS_DIR}/expand.svg",
scale=1,
size="sm",
elem_classes=["no-background", "body-text-color"],
elem_classes=["no-background", "body-text-color" , "top-left-button"],
elem_id="chat-expand-button",
)
self.btn_info_expand = gr.Button(
@ -75,7 +75,7 @@ class ConversationControl(BasePage):
min_width=2,
scale=1,
size="sm",
elem_classes=["no-background", "body-text-color"],
elem_classes=["no-background", "body-text-color" , "top-left-button"],
elem_id="info-expand-button",
)
@ -102,7 +102,7 @@ class ConversationControl(BasePage):
with gr.Row() as self._new_delete:
self.cb_suggest_chat = gr.Checkbox(
value=False,
label="Suggest chat",
label=" پیشنهاد گفتگو ",
min_width=10,
scale=6,
elem_id="suggest-chat-checkbox",
@ -111,7 +111,7 @@ class ConversationControl(BasePage):
)
self.cb_is_public = gr.Checkbox(
value=False,
label="Share this conversation",
label="این گفتگو را ارسال کن",
elem_id="is-public-checkbox",
container=False,
visible=not KH_DEMO_MODE and not KH_SSO_ENABLED,

View File

@ -12,34 +12,31 @@ class ReportIssue(BasePage):
self.on_building_ui()
def on_building_ui(self):
with gr.Accordion(label="Feedback", open=False, elem_id="report-accordion"):
with gr.Accordion(label="بازخورد", open=False, elem_id="report-accordion"):
self.correctness = gr.Radio(
choices=[
("The answer is correct", "correct"),
("The answer is incorrect", "incorrect"),
(" پاسخ صحیح است ", "correct"),
(" پاسخ اشتباه است ", "incorrect"),
],
label="Correctness:",
label="صحت سنجی:",
)
self.issues = gr.CheckboxGroup(
choices=[
("The answer is offensive", "offensive"),
("The evidence is incorrect", "wrong-evidence"),
(" پاسخ نامحترمانه است ", "offensive"),
(" مدارک اشتباه است ", "wrong-evidence"),
],
label="Other issue:",
label="دیگر مشکلات:",
)
self.more_detail = gr.Textbox(
placeholder=(
"More detail (e.g. how wrong is it, what is the "
"correct answer, etc...)"
"جزئیات بیشتر (مثلا چقدر اشتباه است، پاسخ صحیح چیست، و غیره...)"
),
container=False,
lines=3,
)
gr.Markdown(
"This will send the current chat and the user settings to "
"help with investigation"
)
self.report_btn = gr.Button("Report")
alert_text = "این عمل، چت فعلی و تنظیمات کاربر را برای کمک به تحقیق ارسال خواهد کرد"
gr.Markdown(f'<div dir="rtl"> {alert_text}</div>')
self.report_btn = gr.Button("گزارش")
def report(
self,
@ -83,4 +80,4 @@ class ReportIssue(BasePage):
)
session.add(issue)
session.commit()
gr.Info("Thank you for your feedback")
gr.Info("از بازخورد شما متشکریم")