diff --git a/api/openai.py b/api/openai.py index ad57f48..6c64685 100644 --- a/api/openai.py +++ b/api/openai.py @@ -8,7 +8,8 @@ gpt4_whitelist_role_ids, bot_vip_ids, paid_service_all_channels, - use_helicone + use_helicone, + disable_prompt_moderation ) from structlog import get_logger from servicemodules.serviceConstants import Services, openai_channel_ids @@ -63,6 +64,9 @@ def is_text_risky(self, text: str) -> bool: See https://platform.openai.com/docs/guides/moderation/quickstart for details""" + if disable_prompt_moderation: + return False + if CURL_REQUEST: try: http_response = requests.post( diff --git a/config.py b/config.py index 864a61f..4d6e709 100644 --- a/config.py +++ b/config.py @@ -159,6 +159,7 @@ def getenv_unique_set(var_name: str, default: T = frozenset()) -> Union[frozense be_shy: bool channel_whitelist: Optional[frozenset[str]] bot_error_channel_id: str +disable_prompt_moderation: bool is_rob_server = getenv_bool("IS_ROB_SERVER") if is_rob_server: @@ -220,6 +221,7 @@ def getenv_unique_set(var_name: str, default: T = frozenset()) -> Union[frozense "production": "1017527224540344380", "development": "1017531179664150608" }[ENVIRONMENT_TYPE] + disable_prompt_moderation = False else: # user-configured from dotenv discord_guild = getenv("DISCORD_GUILD") @@ -259,6 +261,7 @@ def getenv_unique_set(var_name: str, default: T = frozenset()) -> Union[frozense be_shy = getenv_bool("BE_SHY") channel_whitelist = getenv_unique_set("CHANNEL_WHITELIST", None) bot_error_channel_id = getenv("BOT_ERROR_CHANNEL_ID", bot_private_channel_id) + disable_prompt_moderation = getenv_bool("DISABLE_PROMPT_MODERATION") discord_token: str = getenv("DISCORD_TOKEN") database_path: str = getenv("DATABASE_PATH")