Fix Step 3 router 404 and EXA_API_KEY deployment blocker

- Move Step 3 router from optional to core routers in router_manager.py
- Add direct import of step3_routes in app.py for visibility
- Make ExaService initialization optional to prevent deployment failures
- Fix 404 error on /api/onboarding/step3/discover-competitors endpoint
This commit is contained in:
ajaysi
2025-10-11 17:59:46 +05:30
parent ffa1a078f4
commit c506b1da76

View File

@@ -41,13 +41,19 @@ class ExaService:
def __init__(self):
"""Initialize the Exa Service with API credentials."""
self.api_key = os.getenv("EXA_API_KEY")
self.exa = None
self.enabled = False
if not self.api_key:
raise ValueError("Exa API key not configured. Please set EXA_API_KEY environment variable.")
logger.warning("EXA_API_KEY not configured; Exa service will be disabled")
else:
self.exa = Exa(api_key=self.api_key)
self.enabled = True
logger.info("Exa Service initialized successfully")
try:
self.exa = Exa(api_key=self.api_key)
self.enabled = True
logger.info("Exa Service initialized successfully")
except Exception as e:
logger.error(f"Failed to initialize Exa service: {e}")
self.enabled = False
async def discover_competitors(
self,