Skip to content

Commit

Permalink
feat: add toggle dark mode button on main Chat UI (#423)
Browse files Browse the repository at this point in the history
* feat: add toggle dark mode button on main UI

* docs: update docs
  • Loading branch information
taprosoft authored Oct 22, 2024
1 parent 764fe59 commit f2f192e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/) |
Expand Down
8 changes: 7 additions & 1 deletion libs/ktem/ktem/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ button.selected {
}

mark {
background-color: #1496bb;
background-color: #10b981;
}

/* clpse */
Expand Down Expand Up @@ -157,6 +157,12 @@ mark {
display: block !important;
}

#toggle-dark-button {
position: fixed;
top: 6px;
right: 40px;
}

.scrollable {
overflow-y: auto;
}
Expand Down
13 changes: 13 additions & 0 deletions libs/ktem/ktem/assets/icons/dark_mode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion libs/ktem/ktem/assets/md/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/) |
Expand Down
20 changes: 19 additions & 1 deletion libs/ktem/ktem/pages/chat/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f2f192e

Please sign in to comment.