diff --git a/backend/routers/prompts.py b/backend/routers/prompts.py index 6d999de..1d6a436 100644 --- a/backend/routers/prompts.py +++ b/backend/routers/prompts.py @@ -254,6 +254,9 @@ def import_prompts( } +# NOTE: /execute-stream MUST be defined BEFORE /{prompt_id} to avoid route conflicts +# FastAPI matches routes in order, so specific routes must come before catch-all patterns + @router.get("/{prompt_id}") def get_prompt(prompt_id: str, session: dict=Depends(require_auth)): """Get single AI prompt by ID (UUID).""" @@ -1452,7 +1455,6 @@ async def execute_unified_prompt_stream( save: bool = Query(False, description="Save result to ai_insights"), session: dict = Depends(require_auth_flexible) ): - print("[EXECUTE_STREAM] Endpoint function called!") # DEBUG """ Execute a unified prompt with Server-Sent Events (SSE) streaming. @@ -1464,7 +1466,6 @@ async def execute_unified_prompt_stream( Use this endpoint for long-running workflows (>30s) to avoid gateway timeouts. """ - print(f"[EXECUTE_STREAM] session={repr(session)}") # DEBUG profile_id = session['profile_id'] # Use default modules/timeframes (SSE doesn't support complex params) @@ -1596,7 +1597,7 @@ async def execute_unified_prompt_stream( ) -@router.post("/execute") + async def execute_unified_prompt( prompt_slug: str = Query(..., description="Slug of prompt to execute"), modules: Optional[dict] = None,