diff --git a/api/main.py b/api/main.py index bd45121..6d05be8 100644 --- a/api/main.py +++ b/api/main.py @@ -23,7 +23,7 @@ from api.simulation_worker import SimulationWorker from api.database import get_db_connection from api.price_data_manager import PriceDataManager from api.date_utils import validate_date_range, expand_date_range, get_max_simulation_days -from tools.deployment_config import get_deployment_mode_dict +from tools.deployment_config import get_deployment_mode_dict, log_dev_mode_startup_warning import threading import time @@ -506,4 +506,8 @@ app = create_app() if __name__ == "__main__": import uvicorn + + # Display DEV mode warning if applicable + log_dev_mode_startup_warning() + uvicorn.run(app, host="0.0.0.0", port=8080) diff --git a/main.py b/main.py index a40234b..29a56b1 100644 --- a/main.py +++ b/main.py @@ -12,7 +12,8 @@ from prompts.agent_prompt import all_nasdaq_100_symbols from tools.deployment_config import ( is_dev_mode, get_deployment_mode, - log_api_key_warning + log_api_key_warning, + log_dev_mode_startup_warning ) from api.database import initialize_dev_database @@ -108,16 +109,13 @@ async def main(config_path=None): # Initialize dev environment if needed if is_dev_mode(): - print("=" * 60) - print("🛠️ DEVELOPMENT MODE ACTIVE") - print("=" * 60) + log_dev_mode_startup_warning() log_api_key_warning() # Initialize dev database (reset unless PRESERVE_DEV_DATA=true) from tools.deployment_config import get_db_path dev_db_path = get_db_path("data/jobs.db") initialize_dev_database(dev_db_path) - print("=" * 60) # Get Agent type agent_type = config.get("agent_type", "BaseAgent") diff --git a/tools/deployment_config.py b/tools/deployment_config.py index 9e0297e..79dd66f 100644 --- a/tools/deployment_config.py +++ b/tools/deployment_config.py @@ -119,6 +119,43 @@ def log_api_key_warning() -> None: print(" This is expected if you're testing dev mode with existing .env file") +def log_dev_mode_startup_warning() -> None: + """ + Display prominent warning when server starts in DEV mode + + Warns users that: + - AI calls will be simulated/mocked + - Data may not be retained between runs + - This is a development environment + """ + if not is_dev_mode(): + return + + preserve_data = should_preserve_dev_data() + + print() + print("=" * 70) + print("⚠️ " + "DEVELOPMENT MODE WARNING".center(64) + " ⚠️") + print("=" * 70) + print() + print(" 🚧 This server is running in DEVELOPMENT mode (DEPLOYMENT_MODE=DEV)") + print() + print(" 📌 IMPORTANT:") + print(" • AI API calls will be SIMULATED (mock responses)") + print(" • No real AI model costs will be incurred") + if preserve_data: + print(" • Dev data WILL BE PRESERVED between runs (PRESERVE_DEV_DATA=true)") + else: + print(" • Dev data WILL BE RESET on each startup (PRESERVE_DEV_DATA=false)") + print(" • Using isolated dev database and data paths") + print() + print(" 💡 To use PRODUCTION mode:") + print(" Set environment variable: DEPLOYMENT_MODE=PROD") + print() + print("=" * 70) + print() + + def get_deployment_mode_dict() -> dict: """ Get deployment mode information as dictionary (for API responses)