Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -497,6 +497,14 @@ async def chat(request: ChatRequest):
|
|
| 497 |
|
| 498 |
# Save SINGLE chat directly to MongoDB
|
| 499 |
save_chat_to_db(request.space_id, chat)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 500 |
|
| 501 |
except Exception as e:
|
| 502 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
| 497 |
|
| 498 |
# Save SINGLE chat directly to MongoDB
|
| 499 |
save_chat_to_db(request.space_id, chat)
|
| 500 |
+
|
| 501 |
+
# ADD THIS RETURN BLOCK:
|
| 502 |
+
return {
|
| 503 |
+
"chat_id": chat_id,
|
| 504 |
+
"response": response,
|
| 505 |
+
"sources": sources,
|
| 506 |
+
"timestamp": timestamp
|
| 507 |
+
}
|
| 508 |
|
| 509 |
except Exception as e:
|
| 510 |
raise HTTPException(status_code=500, detail=str(e))
|