Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -371,7 +371,6 @@ async def upload_document(
|
|
| 371 |
):
|
| 372 |
"""Upload and process a legal document"""
|
| 373 |
try:
|
| 374 |
-
print("Working upload")
|
| 375 |
# Validate file
|
| 376 |
if not file.filename:
|
| 377 |
raise HTTPException(status_code=400, detail="No file provided")
|
|
@@ -455,8 +454,7 @@ async def get_session_status(session_id: str):
|
|
| 455 |
if not session:
|
| 456 |
raise HTTPException(status_code=404, detail="Session not found")
|
| 457 |
|
| 458 |
-
# ---
|
| 459 |
-
# Convert all datetime objects to ISO 8601 strings
|
| 460 |
session["_id"] = str(session["_id"])
|
| 461 |
if session.get("created_at"):
|
| 462 |
session["created_at"] = session["created_at"].isoformat()
|
|
@@ -464,7 +462,6 @@ async def get_session_status(session_id: str):
|
|
| 464 |
session["updated_at"] = session["updated_at"].isoformat()
|
| 465 |
if session.get("processing_completed_at"):
|
| 466 |
session["processing_completed_at"] = session["processing_completed_at"].isoformat()
|
| 467 |
-
# --- END FIX ---
|
| 468 |
|
| 469 |
# Add processing progress info
|
| 470 |
if session["status"] == "completed":
|
|
@@ -526,12 +523,10 @@ async def get_processing_results(session_id: str):
|
|
| 526 |
for chunk in chunks_metadata:
|
| 527 |
chunk["_id"] = str(chunk["_id"])
|
| 528 |
|
| 529 |
-
# ---
|
| 530 |
-
# Convert potential datetime object to an ISO 8601 string to make it JSON serializable
|
| 531 |
processing_completed_at = session.get("processing_completed_at")
|
| 532 |
if processing_completed_at:
|
| 533 |
processing_completed_at = processing_completed_at.isoformat()
|
| 534 |
-
# --- END FIX ---
|
| 535 |
|
| 536 |
return JSONResponse(
|
| 537 |
status_code=200,
|
|
|
|
| 371 |
):
|
| 372 |
"""Upload and process a legal document"""
|
| 373 |
try:
|
|
|
|
| 374 |
# Validate file
|
| 375 |
if not file.filename:
|
| 376 |
raise HTTPException(status_code=400, detail="No file provided")
|
|
|
|
| 454 |
if not session:
|
| 455 |
raise HTTPException(status_code=404, detail="Session not found")
|
| 456 |
|
| 457 |
+
# --- FIX: Convert all datetime objects to ISO 8601 strings ---
|
|
|
|
| 458 |
session["_id"] = str(session["_id"])
|
| 459 |
if session.get("created_at"):
|
| 460 |
session["created_at"] = session["created_at"].isoformat()
|
|
|
|
| 462 |
session["updated_at"] = session["updated_at"].isoformat()
|
| 463 |
if session.get("processing_completed_at"):
|
| 464 |
session["processing_completed_at"] = session["processing_completed_at"].isoformat()
|
|
|
|
| 465 |
|
| 466 |
# Add processing progress info
|
| 467 |
if session["status"] == "completed":
|
|
|
|
| 523 |
for chunk in chunks_metadata:
|
| 524 |
chunk["_id"] = str(chunk["_id"])
|
| 525 |
|
| 526 |
+
# --- FIX: Convert potential datetime object to an ISO 8601 string ---
|
|
|
|
| 527 |
processing_completed_at = session.get("processing_completed_at")
|
| 528 |
if processing_completed_at:
|
| 529 |
processing_completed_at = processing_completed_at.isoformat()
|
|
|
|
| 530 |
|
| 531 |
return JSONResponse(
|
| 532 |
status_code=200,
|