From d21ccc5627e6b59b8cae596f569af1c21b51c0d3 Mon Sep 17 00:00:00 2001 From: Abi Raja Date: Mon, 4 Dec 2023 16:50:50 -0500 Subject: [PATCH] improve code quality --- backend/main.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/backend/main.py b/backend/main.py index bef3b94..7933bdc 100644 --- a/backend/main.py +++ b/backend/main.py @@ -19,8 +19,18 @@ from prompts import assemble_prompt from routes import screenshot from access_token import validate_access_token + +# Useful for debugging purposes when you don't want to waste GPT4-Vision credits +# Setting to True will stream a mock response instead of calling the OpenAI API +# TODO: Should only be set to true when value is 'True', not any abitrary truthy value +SHOULD_MOCK_AI_RESPONSE = bool(os.environ.get("MOCK", False)) + +# Set to True when running in production (on the hosted version) +# Used as a feature flag to enable or disable certain features +IS_PROD = os.environ.get("IS_PROD", False) + # Setup Sentry (only relevant in prod) -if os.environ.get("IS_PROD"): +if IS_PROD: import sentry_sdk SENTRY_DSN = os.environ.get("SENTRY_DSN") @@ -45,17 +55,6 @@ app.add_middleware( allow_headers=["*"], ) - -# Useful for debugging purposes when you don't want to waste GPT4-Vision credits -# Setting to True will stream a mock response instead of calling the OpenAI API -# TODO: Should only be set to true when value is 'True', not any abitrary truthy value -SHOULD_MOCK_AI_RESPONSE = bool(os.environ.get("MOCK", False)) - -# Set to True when running in production (on the hosted version) -# Used as a feature flag to enable or disable certain features -IS_PROD = os.environ.get("IS_PROD", False) - - app.include_router(screenshot.router)