Skip to content

Commit

Permalink
(bump:patch) dynamic help page
Browse files Browse the repository at this point in the history
  • Loading branch information
lone17 committed Apr 27, 2024
1 parent 43a0d89 commit 18b1d5b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
10 changes: 10 additions & 0 deletions docs/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# About Kotaemon

An open-source tool for you to chat with your documents.

[Source Code](https://github.com/Cinnamon/kotaemon) |
[Live Demo](https://huggingface.co/spaces/lone17/kotaemon-app)

[User Guide](https://cinnamon.github.io/kotaemon/) |
[Developer Guide](https://cinnamon.github.io/kotaemon/development/) |
[Feedback](https://github.com/Cinnamon/kotaemon/issues)
3 changes: 3 additions & 0 deletions flowsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
KH_USER_DATA_DIR = KH_APP_DATA_DIR / "user_data"
KH_USER_DATA_DIR.mkdir(parents=True, exist_ok=True)

# doc directory
KH_DOC_DIR = this_dir / "docs"

# HF models can be big, let's store them in the app data directory so that it's easier
# for users to manage their storage.
# ref: https://huggingface.co/docs/huggingface_hub/en/guides/manage-cache
Expand Down
33 changes: 21 additions & 12 deletions libs/ktem/ktem/pages/help.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
from pathlib import Path

import gradio as gr
import requests
from theflow.settings import settings


class HelpPage:
def __init__(self, app):
self._app = app
self.md_dir = Path(__file__).parent.parent / "assets" / "md"
self.doc_dir = Path(__file__).parents[4] / "docs"
self.doc_dir = Path(settings.KH_DOC_DIR)

with gr.Accordion("About"):
with (self.md_dir / "about.md").open(encoding="utf-8") as fi:
gr.Markdown(fi.read())
if self.doc_dir.exists():
with gr.Accordion("About"):
with (self.doc_dir / "about.md").open(encoding="utf-8") as fi:
gr.Markdown(fi.read())

with gr.Accordion("User Guide"):
with (self.doc_dir / "usage.md").open(encoding="utf-8") as fi:
gr.Markdown(fi.read())
with gr.Accordion("User Guide"):
with (self.doc_dir / "usage.md").open(encoding="utf-8") as fi:
gr.Markdown(fi.read())

with gr.Accordion("Changelogs"):
gr.Markdown(self.get_changelogs())
changelogs = self.get_changelogs()
if changelogs:
with gr.Accordion("Changelogs"):
gr.Markdown(changelogs)

def get_changelogs(self):
with (self.md_dir / "changelogs.md").open(encoding="utf-8") as fi:
return fi.read()
latest_release_url = (
"https://api.github.com/repos/Cinnamon/kotaemon/releases/latest"
)
res = requests.get(latest_release_url).json()
changelogs = res.get("body", "")

return changelogs

0 comments on commit 18b1d5b

Please sign in to comment.