Spaces:
Build error
Build error
Merge pull request #80 from DL4DS/regen_tokens
Browse files- code/app.py +6 -8
code/app.py
CHANGED
@@ -80,7 +80,7 @@ flow = Flow.from_client_config(
|
|
80 |
|
81 |
|
82 |
def get_user_role(username: str):
|
83 |
-
return USER_ROLES.get(username, ["
|
84 |
|
85 |
|
86 |
async def get_user_info_from_cookie(request: Request):
|
@@ -245,13 +245,11 @@ async def post_signin(request: Request):
|
|
245 |
user_details.metadata["tokens_left"] = (
|
246 |
TOKENS_LEFT # set the number of tokens left for the new user
|
247 |
)
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
user_details.metadata["in_cooldown"] = False
|
254 |
-
await update_user_info(user_details)
|
255 |
|
256 |
if "last_message_time" in user_details.metadata and "admin" not in get_user_role(
|
257 |
user_info["email"]
|
|
|
80 |
|
81 |
|
82 |
def get_user_role(username: str):
|
83 |
+
return USER_ROLES.get(username, ["guest"]) # Default to "guest" role
|
84 |
|
85 |
|
86 |
async def get_user_info_from_cookie(request: Request):
|
|
|
245 |
user_details.metadata["tokens_left"] = (
|
246 |
TOKENS_LEFT # set the number of tokens left for the new user
|
247 |
)
|
248 |
+
if "all_time_tokens_allocated" not in user_details.metadata:
|
249 |
+
user_details.metadata["all_time_tokens_allocated"] = ALL_TIME_TOKENS_ALLOCATED
|
250 |
+
if "in_cooldown" not in user_details.metadata:
|
251 |
+
user_details.metadata["in_cooldown"] = False
|
252 |
+
await update_user_info(user_details)
|
|
|
|
|
253 |
|
254 |
if "last_message_time" in user_details.metadata and "admin" not in get_user_role(
|
255 |
user_info["email"]
|