From 87344adf2902d40427e928f51658d24e8d5efbb3 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 19 Mar 2024 14:21:46 -0700 Subject: [PATCH] refac --- backend/config.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/backend/config.py b/backend/config.py index feb65305b..be51f3065 100644 --- a/backend/config.py +++ b/backend/config.py @@ -289,12 +289,11 @@ DEFAULT_PROMPT_SUGGESTIONS = ( DEFAULT_USER_ROLE = os.getenv("DEFAULT_USER_ROLE", "pending") -USER_PERMISSIONS_CHAT_DELETION = os.getenv('USER_PERMISSIONS_CHAT_DELETION', 'True') +USER_PERMISSIONS_CHAT_DELETION = ( + os.environ.get("USER_PERMISSIONS_CHAT_DELETION", "True").lower() == "true" +) -if USER_PERMISSIONS_CHAT_DELETION not in ('True', 'False'): - raise ValueError(ERROR_MESSAGES.INCORRECT_FORMAT(" (e.g., True/False).")) - -USER_PERMISSIONS = {"chat": {"deletion": USER_PERMISSIONS_CHAT_DELETION == 'True'}} +USER_PERMISSIONS = {"chat": {"deletion": USER_PERMISSIONS_CHAT_DELETION}} MODEL_FILTER_ENABLED = os.environ.get("MODEL_FILTER_ENABLED", False)