Allow the application name to be configurable in settings (#80)

* Make app name configurable

* Use app name in browser tab
This commit is contained in:
trducng 2024-05-20 22:37:24 +07:00 committed by GitHub
parent 04e602161b
commit 56dfc8fb53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View File

@ -35,6 +35,7 @@ class BaseApp:
def __init__(self): def __init__(self):
self.dev_mode = getattr(settings, "KH_MODE", "") == "dev" self.dev_mode = getattr(settings, "KH_MODE", "") == "dev"
self.app_name = getattr(settings, "KH_APP_NAME", "Kotaemon")
self.f_user_management = getattr(settings, "KH_FEATURE_USER_MANAGEMENT", False) self.f_user_management = getattr(settings, "KH_FEATURE_USER_MANAGEMENT", False)
self._theme = gr.Theme.from_hub("lone17/kotaemon") self._theme = gr.Theme.from_hub("lone17/kotaemon")
@ -158,7 +159,7 @@ class BaseApp:
with gr.Blocks( with gr.Blocks(
theme=self._theme, theme=self._theme,
css=self._css, css=self._css,
title="Kotaemon", title=self.app_name,
analytics_enabled=False, analytics_enabled=False,
) as demo: ) as demo:
self.app = demo self.app = demo

View File

@ -9,7 +9,7 @@ class ChatPanel(BasePage):
def on_building_ui(self): def on_building_ui(self):
self.chatbot = gr.Chatbot( self.chatbot = gr.Chatbot(
label="Kotaemon", label=self._app.app_name,
placeholder=( placeholder=(
"This is the beginning of a new conversation.\nMake sure to have added" "This is the beginning of a new conversation.\nMake sure to have added"
" a LLM by following the instructions in the Help tab." " a LLM by following the instructions in the Help tab."

View File

@ -31,7 +31,7 @@ class LoginPage(BasePage):
self.on_building_ui() self.on_building_ui()
def on_building_ui(self): def on_building_ui(self):
gr.Markdown("# Welcome to Kotaemon") gr.Markdown(f"# Welcome to {self._app.app_name}!")
self.usn = gr.Textbox(label="Username", visible=False) self.usn = gr.Textbox(label="Username", visible=False)
self.pwd = gr.Textbox(label="Password", type="password", visible=False) self.pwd = gr.Textbox(label="Password", type="password", visible=False)
self.btn_login = gr.Button("Login", visible=False) self.btn_login = gr.Button("Login", visible=False)