(bump:patch) Feat: Show app version in the Help page (#68)
* typo * show version in the Help page * update docs * pump duckduckgo-search * allow app version to be set by env var
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
from importlib.metadata import version
|
||||
from inspect import currentframe, getframeinfo
|
||||
from pathlib import Path
|
||||
|
||||
@@ -14,6 +15,15 @@ this_dir = Path(this_file).parent
|
||||
# change this if your app use a different name
|
||||
KH_PACKAGE_NAME = "kotaemon_app"
|
||||
|
||||
KH_APP_VERSION = os.environ.get("KH_APP_VERSION", None)
|
||||
if not KH_APP_VERSION:
|
||||
try:
|
||||
# Caution: This might produce the wrong version
|
||||
# https://stackoverflow.com/a/59533071
|
||||
KH_APP_VERSION = version(KH_PACKAGE_NAME)
|
||||
except Exception as e:
|
||||
print(f"Failed to get app version: {e}")
|
||||
|
||||
# App can be ran from anywhere and it's not trivial to decide where to store app data.
|
||||
# So let's use the same directory as the flowsetting.py file.
|
||||
KH_APP_DATA_DIR = this_dir / "ktem_app_data"
|
||||
|
Reference in New Issue
Block a user