File tree 1 file changed +21
-1
lines changed
1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 6
6
from werkzeug .security import generate_password_hash
7
7
from server .app .utils .diskcache_client import diskcache_client
8
8
from server .constant .constants import SQLITE_DB_DIR , SQLITE_DB_NAME
9
+ from dotenv import load_dotenv
9
10
10
11
11
12
os .makedirs (SQLITE_DB_DIR , exist_ok = True )
12
13
13
14
15
+ def init_chroma_db ():
16
+ # Load environment variables from .env file
17
+ load_dotenv (override = True )
18
+ try :
19
+ from server .constant .env_constants import check_env_variables
20
+ check_env_variables ()
21
+ from server .rag .index .embedder .document_embedder import document_embedder
22
+ return True
23
+ except Exception as e :
24
+ print (f"[ERROR] init_chroma_db is failed, the exception is { e } " )
25
+ return False
26
+
27
+
14
28
def create_table ():
15
29
conn = sqlite3 .connect (f'{ SQLITE_DB_DIR } /{ SQLITE_DB_NAME } ' )
16
30
cur = conn .cursor ()
@@ -323,6 +337,12 @@ def init_bot_setting():
323
337
init_admin_account ()
324
338
print ('Initialize the bot settings' )
325
339
init_bot_setting ()
340
+ print ('SQLite init Done!\n \n ' )
326
341
327
- print ('Done!' )
328
342
343
+ print ("Init Chroma DB" )
344
+ ret = init_chroma_db ()
345
+ if ret :
346
+ print ("Init Chroma DB Done!" )
347
+ else :
348
+ print ("Init Chroma DB Failed!" )
You can’t perform that action at this time.
0 commit comments