Spaces:
Sleeping
Sleeping
Update backend.py
Browse files- backend.py +11 -4
backend.py
CHANGED
|
@@ -340,10 +340,17 @@ def analyze_text(text):
|
|
| 340 |
def health():
|
| 341 |
return {"response": "ok"}
|
| 342 |
|
| 343 |
-
|
| 344 |
-
async def save_report(
|
| 345 |
-
|
| 346 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
|
| 348 |
@app.on_event("startup")
|
| 349 |
def _log_routes():
|
|
|
|
| 340 |
def health():
|
| 341 |
return {"response": "ok"}
|
| 342 |
|
| 343 |
+
@app.route("/save_report/")
|
| 344 |
+
async def save_report(report: ReportData):
|
| 345 |
+
try:
|
| 346 |
+
print(f"Received report from user {report.user_id}:")
|
| 347 |
+
print(f"- Report Date: {report.reportDate}")
|
| 348 |
+
|
| 349 |
+
report_dict = report.dict()
|
| 350 |
+
|
| 351 |
+
except Exception as e:
|
| 352 |
+
print(f"Error saving report: {traceback.format_exc()}")
|
| 353 |
+
raise HTTPException(status_code=500, detail=f"Error saving report: {str(e)}")
|
| 354 |
|
| 355 |
@app.on_event("startup")
|
| 356 |
def _log_routes():
|