From f31d55d493a1d7267b2b5763717d77a69fb955ea Mon Sep 17 00:00:00 2001 From: Tadashi Date: Tue, 22 Oct 2024 17:56:32 +0700 Subject: [PATCH 1/2] feat: add toggle dark mode button on main UI --- libs/ktem/ktem/assets/css/main.css | 8 +++++++- libs/ktem/ktem/assets/icons/dark_mode.svg | 13 +++++++++++++ libs/ktem/ktem/pages/chat/control.py | 20 +++++++++++++++++++- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 libs/ktem/ktem/assets/icons/dark_mode.svg diff --git a/libs/ktem/ktem/assets/css/main.css b/libs/ktem/ktem/assets/css/main.css index da83e8306..8eb6d3ca1 100644 --- a/libs/ktem/ktem/assets/css/main.css +++ b/libs/ktem/ktem/assets/css/main.css @@ -102,7 +102,7 @@ button.selected { } mark { - background-color: #1496bb; + background-color: #10b981; } /* clpse */ @@ -157,6 +157,12 @@ mark { display: block !important; } +#toggle-dark-button { + position: fixed; + top: 6px; + right: 40px; +} + .scrollable { overflow-y: auto; } diff --git a/libs/ktem/ktem/assets/icons/dark_mode.svg b/libs/ktem/ktem/assets/icons/dark_mode.svg new file mode 100644 index 000000000..19b0b636a --- /dev/null +++ b/libs/ktem/ktem/assets/icons/dark_mode.svg @@ -0,0 +1,13 @@ + + + + ic_fluent_dark_theme_24_regular + Created with Sketch. + + + + + + + + diff --git a/libs/ktem/ktem/pages/chat/control.py b/libs/ktem/ktem/pages/chat/control.py index 989c8ec7d..c1182dfd8 100644 --- a/libs/ktem/ktem/pages/chat/control.py +++ b/libs/ktem/ktem/pages/chat/control.py @@ -38,7 +38,25 @@ def __init__(self, app): self.on_building_ui() def on_building_ui(self): - gr.Markdown("## Conversations") + with gr.Row(): + gr.Markdown("## Conversations") + self.btn_toggle_dark_mode = gr.Button( + value="", + icon=f"{ASSETS_DIR}/dark_mode.svg", + scale=1, + size="sm", + elem_classes=["no-background", "body-text-color"], + elem_id="toggle-dark-button", + ) + self.btn_toggle_dark_mode.click( + None, + js=""" + () => { + document.body.classList.toggle('dark'); + } + """, + ) + self.conversation_id = gr.State(value="") self.conversation = gr.Dropdown( label="Chat sessions", From 972042bafba4d24609049e8eb732d95689075e08 Mon Sep 17 00:00:00 2001 From: Tadashi Date: Tue, 22 Oct 2024 18:41:38 +0700 Subject: [PATCH 2/2] docs: update docs --- docs/about.md | 2 +- libs/ktem/ktem/assets/md/about.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/about.md b/docs/about.md index fca006720..5c55dad74 100644 --- a/docs/about.md +++ b/docs/about.md @@ -4,7 +4,7 @@ An open-source tool for chatting with your documents. Built with both end users developers in mind. [Source Code](https://github.com/Cinnamon/kotaemon) | -[Live Demo](https://huggingface.co/spaces/lone17/kotaemon-app) +[Live Demo](https://huggingface.co/spaces/cin-model/kotaemon-demo) [User Guide](https://cinnamon.github.io/kotaemon/) | [Developer Guide](https://cinnamon.github.io/kotaemon/development/) | diff --git a/libs/ktem/ktem/assets/md/about.md b/libs/ktem/ktem/assets/md/about.md index 8c69d9629..02a542e5a 100644 --- a/libs/ktem/ktem/assets/md/about.md +++ b/libs/ktem/ktem/assets/md/about.md @@ -3,7 +3,7 @@ An open-source tool for you to chat with your documents. [Source Code](https://github.com/Cinnamon/kotaemon) | -[Demo](https://huggingface.co/spaces/lone17/kotaemon-app) +[Demo](https://huggingface.co/spaces/cin-model/kotaemon-demo) [User Guide](https://cinnamon.github.io/kotaemon/) | [Developer Guide](https://cinnamon.github.io/kotaemon/development/) |