ytrsoymr commited on
Commit
77ff9bf
·
verified ·
1 Parent(s): 88248bc

Update config.py

Browse files
Files changed (1) hide show
  1. config.py +33 -20
config.py CHANGED
@@ -1,20 +1,33 @@
1
- import os
2
- from dotenv import load_dotenv
3
- import uuid
4
-
5
- # Load environment variables from a .env file
6
- load_dotenv()
7
-
8
- # Google GenAI API Key
9
- GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
10
-
11
- # SQLite Database File Path
12
- DB_PATH = os.getenv("DB_PATH", "chats_data/sqlite.db") # Default file if not set
13
-
14
- # LangChain Configuration
15
- MODEL_NAME = "gemini-1.5-pro"
16
- TEMP = 0.7 # Model temperature
17
-
18
- # Function to generate a new session ID (UUID)
19
- def generate_session_id():
20
- return str(uuid.uuid4())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from dotenv import load_dotenv
3
+ import uuid
4
+
5
+ # Load environment variables from a .env file
6
+ load_dotenv()
7
+
8
+ # Google GenAI API Key
9
+ GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
10
+
11
+ # SQLite Database File Path
12
+ DB_PATH = os.getenv("DB_PATH", "chats_data/sqlite.db") # Default file if not set
13
+
14
+ # LangChain Configuration
15
+ MODEL_NAME = "gemini-1.5-pro"
16
+ TEMP = 0.7 # Model temperature
17
+
18
+ # Function to generate a persistent user ID
19
+ def generate_user_id():
20
+ """Generates or retrieves a persistent user ID."""
21
+ user_id_file = "user_id.txt"
22
+
23
+ # Check if a user ID already exists
24
+ if os.path.exists(user_id_file):
25
+ with open(user_id_file, "r") as f:
26
+ return f.read().strip()
27
+
28
+ # Generate a new user ID and save it
29
+ new_user_id = str(uuid.uuid4())
30
+ with open(user_id_file, "w") as f:
31
+ f.write(new_user_id)
32
+
33
+ return new_user_id