Responsive Gui - partially Workflow #61
|
|
@ -53,6 +53,20 @@ def list_prompts(session: dict=Depends(require_auth)):
|
|||
return [r2d(r) for r in cur.fetchall()]
|
||||
|
||||
|
||||
@router.get("/{prompt_id}")
|
||||
def get_prompt(prompt_id: str, session: dict=Depends(require_auth)):
|
||||
"""Get single AI prompt by ID (UUID)."""
|
||||
with get_db() as conn:
|
||||
cur = get_cursor(conn)
|
||||
cur.execute("SELECT * FROM ai_prompts WHERE id=%s", (prompt_id,))
|
||||
row = cur.fetchone()
|
||||
|
||||
if not row:
|
||||
raise HTTPException(status_code=404, detail="Prompt not found")
|
||||
|
||||
return r2d(row)
|
||||
|
||||
|
||||
@router.post("")
|
||||
def create_prompt(p: PromptCreate, session: dict=Depends(require_admin)):
|
||||
"""Create new AI prompt (admin only)."""
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user