Spaces:
Build error
Build error
Merge pull request #94 from DL4DS/Farid-patch
Browse files
apps/ai_tutor/chainlit_app.py
CHANGED
|
@@ -40,10 +40,6 @@ AGENT = "Agent"
|
|
| 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,7 +393,11 @@ class Chatbot:
|
|
| 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,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
)
|
| 402 |
if cooldown:
|
| 403 |
# get time left in cooldown
|
|
|
|
| 40 |
YOU = "User"
|
| 41 |
ERROR = "Error"
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
# set config
|
| 44 |
config = config_manager.get_config().dict()
|
| 45 |
|
|
|
|
| 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,
|
| 397 |
+
current_datetime,
|
| 398 |
+
self.config["token_config"]["cooldown_time"],
|
| 399 |
+
self.config["token_config"]["tokens_left"],
|
| 400 |
+
self.config["token_config"]["regen_time"],
|
| 401 |
)
|
| 402 |
if cooldown:
|
| 403 |
# get time left in cooldown
|