SCGR commited on
Commit
3cc2bc5
·
1 Parent(s): 28718ff

prompt POST method

Browse files
Files changed (1) hide show
  1. py_backend/app/main.py +15 -0
py_backend/app/main.py CHANGED
@@ -68,6 +68,21 @@ async def list_prompts_no_slash():
68
  finally:
69
  db.close()
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
 
73
  @app.get("/health", include_in_schema=False, response_class=JSONResponse)
 
68
  finally:
69
  db.close()
70
 
71
+ @app.post("/api/prompts", include_in_schema=False)
72
+ async def create_prompt_no_slash(prompt_data: dict):
73
+ """Handle POST /api/prompts without trailing slash to prevent 307 redirect"""
74
+ from app.routers.prompts import create_prompt
75
+ from app.database import SessionLocal
76
+ from app.schemas import PromptCreate
77
+
78
+ db = SessionLocal()
79
+ try:
80
+ # Convert dict to PromptCreate schema
81
+ prompt_create = PromptCreate(**prompt_data)
82
+ return create_prompt(prompt_create, db)
83
+ finally:
84
+ db.close()
85
+
86
 
87
 
88
  @app.get("/health", include_in_schema=False, response_class=JSONResponse)