improve code quality

This commit is contained in:
Abi Raja 2023-12-04 16:50:50 -05:00
parent 737062d091
commit d21ccc5627

View File

@ -19,8 +19,18 @@ from prompts import assemble_prompt
from routes import screenshot from routes import screenshot
from access_token import validate_access_token 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) # Setup Sentry (only relevant in prod)
if os.environ.get("IS_PROD"): if IS_PROD:
import sentry_sdk import sentry_sdk
SENTRY_DSN = os.environ.get("SENTRY_DSN") SENTRY_DSN = os.environ.get("SENTRY_DSN")
@ -45,17 +55,6 @@ app.add_middleware(
allow_headers=["*"], 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) app.include_router(screenshot.router)