File tree Expand file tree Collapse file tree 4 files changed +13
-9
lines changed Expand file tree Collapse file tree 4 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 15
15
# change this if your app use a different name
16
16
KH_PACKAGE_NAME = "kotaemon_app"
17
17
18
- KH_APP_VERSION = config ("KH_APP_VERSION" , "local" )
18
+ KH_APP_VERSION = config ("KH_APP_VERSION" , None )
19
19
if not KH_APP_VERSION :
20
20
try :
21
21
# Caution: This might produce the wrong version
22
22
# https://stackoverflow.com/a/59533071
23
23
KH_APP_VERSION = version (KH_PACKAGE_NAME )
24
- except Exception as e :
25
- print ( f"Failed to get app version: { e } " )
24
+ except Exception :
25
+ KH_APP_VERSION = "local"
26
26
27
27
# App can be ran from anywhere and it's not trivial to decide where to store app data.
28
28
# So let's use the same directory as the flowsetting.py file.
Original file line number Diff line number Diff line change 3
3
from decouple import config
4
4
5
5
PDFJS_VERSION_DIST : str = config ("PDFJS_VERSION_DIST" , "pdfjs-4.0.379-dist" )
6
- PDFJS_PREBUILT_DIR : Path = Path (__file__ ).parent / "prebuilt" / PDFJS_VERSION_DIST
6
+ PDFJS_PREBUILT_DIR : Path = config (
7
+ "PDFJS_PREBUILT_DIR" , Path (__file__ ).parent / "prebuilt" / PDFJS_VERSION_DIST
8
+ )
Original file line number Diff line number Diff line change @@ -170,7 +170,8 @@ function download_and_unzip() {
170
170
}
171
171
172
172
function launch_ui() {
173
- python $( pwd) /app.py || {
173
+ local pdfjs_prebuilt_dir=$1
174
+ PDFJS_PREBUILT_DIR=" $pdfjs_prebuilt_dir " python $( pwd) /app.py || {
174
175
echo " " && echo " Will exit now..."
175
176
exit 1
176
177
}
@@ -217,7 +218,7 @@ print_highlight "Setting up a local model"
217
218
setup_local_model
218
219
219
220
print_highlight " Launching Kotaemon in your browser, please wait..."
220
- launch_ui
221
+ launch_ui $target_pdf_js_dir
221
222
222
223
deactivate_conda_env
223
224
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- # Functions for better code organization
3
+ # functions for better code organization
4
4
function check_path_for_spaces() {
5
5
if [[ $PWD =~ \ ]]; then
6
6
echo " The current workdir has whitespace which can lead to unintended behaviour. Please modify your path and continue later."
@@ -171,7 +171,8 @@ function download_and_unzip() {
171
171
}
172
172
173
173
function launch_ui() {
174
- python $( pwd) /app.py || {
174
+ local pdfjs_prebuilt_dir=$1
175
+ PDFJS_PREBUILT_DIR=" $pdfjs_prebuilt_dir " python $( pwd) /app.py || {
175
176
echo " " && echo " Will exit now..."
176
177
exit 1
177
178
}
@@ -221,7 +222,7 @@ print_highlight "Setting up a local model"
221
222
setup_local_model
222
223
223
224
print_highlight " Launching Kotaemon in your browser, please wait..."
224
- launch_ui
225
+ launch_ui $target_pdf_js_dir
225
226
226
227
deactivate_conda_env
227
228
You can’t perform that action at this time.
0 commit comments