Farid Karimli
commited on
Commit
·
5b69151
1
Parent(s):
0a9be4e
missing arguments and student.json
Browse files
.gitignore
CHANGED
@@ -181,4 +181,6 @@ code/storage/models/
|
|
181 |
**/private/students.json
|
182 |
|
183 |
**/apps/*/storage/logs/*
|
184 |
-
**/apps/*/private/*
|
|
|
|
|
|
181 |
**/private/students.json
|
182 |
|
183 |
**/apps/*/storage/logs/*
|
184 |
+
**/apps/*/private/*
|
185 |
+
|
186 |
+
.idea/
|
apps/ai_tutor/app.py
CHANGED
@@ -33,6 +33,8 @@ GITHUB_REPO = config["misc"]["github_repo"]
|
|
33 |
DOCS_WEBSITE = config["misc"]["docs_website"]
|
34 |
ALL_TIME_TOKENS_ALLOCATED = config["token_config"]["all_time_tokens_allocated"]
|
35 |
TOKENS_LEFT = config["token_config"]["tokens_left"]
|
|
|
|
|
36 |
|
37 |
GOOGLE_CLIENT_ID = OAUTH_GOOGLE_CLIENT_ID
|
38 |
GOOGLE_CLIENT_SECRET = OAUTH_GOOGLE_CLIENT_SECRET
|
@@ -283,7 +285,9 @@ async def post_signin(request: Request):
|
|
283 |
if "last_message_time" in user_details.metadata and "admin" not in get_user_role(
|
284 |
user_info["email"]
|
285 |
):
|
286 |
-
cooldown, _ = await check_user_cooldown(
|
|
|
|
|
287 |
if cooldown:
|
288 |
user_details.metadata["in_cooldown"] = True
|
289 |
return RedirectResponse("/cooldown")
|
|
|
33 |
DOCS_WEBSITE = config["misc"]["docs_website"]
|
34 |
ALL_TIME_TOKENS_ALLOCATED = config["token_config"]["all_time_tokens_allocated"]
|
35 |
TOKENS_LEFT = config["token_config"]["tokens_left"]
|
36 |
+
COOLDOWN_TIME = config["token_config"]["cooldown_time"]
|
37 |
+
REGEN_TIME = config["token_config"]["regen_time"]
|
38 |
|
39 |
GOOGLE_CLIENT_ID = OAUTH_GOOGLE_CLIENT_ID
|
40 |
GOOGLE_CLIENT_SECRET = OAUTH_GOOGLE_CLIENT_SECRET
|
|
|
285 |
if "last_message_time" in user_details.metadata and "admin" not in get_user_role(
|
286 |
user_info["email"]
|
287 |
):
|
288 |
+
cooldown, _ = await check_user_cooldown(
|
289 |
+
user_details, current_datetime, COOLDOWN_TIME, TOKENS_LEFT, REGEN_TIME
|
290 |
+
)
|
291 |
if cooldown:
|
292 |
user_details.metadata["in_cooldown"] = True
|
293 |
return RedirectResponse("/cooldown")
|
apps/ai_tutor/chainlit_app.py
CHANGED
@@ -40,6 +40,10 @@ AGENT = "Agent"
|
|
40 |
YOU = "User"
|
41 |
ERROR = "Error"
|
42 |
|
|
|
|
|
|
|
|
|
43 |
# set config
|
44 |
config = config_manager.get_config().dict()
|
45 |
|
@@ -393,7 +397,7 @@ class Chatbot:
|
|
393 |
if user.metadata["tokens_left"] <= 0 and "admin" not in user.metadata["role"]:
|
394 |
current_datetime = get_time()
|
395 |
cooldown, cooldown_end_time = await check_user_cooldown(
|
396 |
-
user, current_datetime
|
397 |
)
|
398 |
if cooldown:
|
399 |
# get time left in cooldown
|
|
|
40 |
YOU = "User"
|
41 |
ERROR = "Error"
|
42 |
|
43 |
+
COOLDOWN_TIME = config_manager.get_config().dict()["token_config"]["cooldown_time"]
|
44 |
+
TOKENS_LEFT = config_manager.get_config().dict()["token_config"]["tokens_left"]
|
45 |
+
REGEN_TIME = config_manager.get_config().dict()["token_config"]["regen_time"]
|
46 |
+
|
47 |
# set config
|
48 |
config = config_manager.get_config().dict()
|
49 |
|
|
|
397 |
if user.metadata["tokens_left"] <= 0 and "admin" not in user.metadata["role"]:
|
398 |
current_datetime = get_time()
|
399 |
cooldown, cooldown_end_time = await check_user_cooldown(
|
400 |
+
user, current_datetime, COOLDOWN_TIME, TOKENS_LEFT, REGEN_TIME
|
401 |
)
|
402 |
if cooldown:
|
403 |
# get time left in cooldown
|
apps/ai_tutor/config/config_manager.py
CHANGED
@@ -24,7 +24,8 @@ class VectorStoreConfig(BaseModel):
|
|
24 |
db_option: str = "RAGatouille" # Options: [FAISS, Chroma, RAGatouille, RAPTOR]
|
25 |
db_path: str = "vectorstores"
|
26 |
model: str = (
|
27 |
-
|
|
|
28 |
)
|
29 |
search_top_k: conint(gt=0) = 3
|
30 |
score_threshold: confloat(ge=0.0, le=1.0) = 0.2
|
|
|
24 |
db_option: str = "RAGatouille" # Options: [FAISS, Chroma, RAGatouille, RAPTOR]
|
25 |
db_path: str = "vectorstores"
|
26 |
model: str = (
|
27 |
+
# Options: [sentence-transformers/all-MiniLM-L6-v2, text-embedding-ada-002]
|
28 |
+
"sentence-transformers/all-MiniLM-L6-v2"
|
29 |
)
|
30 |
search_top_k: conint(gt=0) = 3
|
31 |
score_threshold: confloat(ge=0.0, le=1.0) = 0.2
|
apps/ai_tutor/public/files/students_encrypted.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"
|
|
|
1 |
+
{"0645db6f7b415e3b04a4fc327151c3c7bbcd25ec546ee0b3604957b571a79bc2": ["instructor", "bu"], "51ebf87ac51618300acfef8bfa9768fdee40e2d3f39cfb4ae8a76722ee336de4": ["admin", "instructor", "bu"], "7810b25bef84317130e2a59da978ee716bb96f6a8a9296c051b7ad4108aa8e6a": ["instructor", "bu"], "a95f36e2700c554639d3522834b47733f5ed1f05c5a43d04ac2575571dd43563": ["student", "bu"]}
|