fix: FastAPI routing conflict for /placeholders endpoint
All checks were successful
Deploy Development / deploy (push) Successful in 49s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 15s

Backend:
- Moved /placeholders endpoint BEFORE /{prompt_id} catch-all
- Prevents "placeholders" being parsed as UUID parameter
- Fixes 500 Internal Server Error preventing placeholder loading

Frontend:
- PlaceholderPicker can now load ~120+ system placeholders

Root Cause:
- FastAPI matches routes in order
- Generic /{prompt_id} was catching /placeholders first
- psycopg2 error: invalid input syntax for type uuid: "placeholders"

Version: 0.9p (workflow module)
Part 3: End Node Template Engine

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lars 2026-04-09 16:19:46 +02:00
parent d2eaab277e
commit 1a9fb99411

View File

@ -53,6 +53,20 @@ def list_prompts(session: dict=Depends(require_auth)):
return [r2d(r) for r in cur.fetchall()]
@router.get("/placeholders")
def list_placeholders_endpoint(session: dict=Depends(require_auth)):
"""
Get grouped catalog of available placeholders with descriptions and examples.
Returns:
Dict mapping category to list of {key, description, example}
IMPORTANT: This endpoint MUST be defined BEFORE /{prompt_id} to avoid routing conflict.
"""
profile_id = session['profile_id']
return get_placeholder_catalog(profile_id)
@router.get("/{prompt_id}")
def get_prompt(prompt_id: str, session: dict=Depends(require_auth)):
"""Get single AI prompt by ID (UUID)."""