Wrap response in JSONResponse for proper serialization

- Import JSONResponse from fastapi.responses
- Explicitly wrap response dict in JSONResponse
- Add logging to confirm JSONResponse is being returned
- This ensures FastAPI properly serializes the response dict
- Fixes potential serialization issues causing client-side errors
parent 94f17378
...@@ -110,7 +110,11 @@ class RequestHandler: ...@@ -110,7 +110,11 @@ class RequestHandler:
handler.record_success() handler.record_success()
logger.info(f"=== RequestHandler.handle_chat_completion END ===") logger.info(f"=== RequestHandler.handle_chat_completion END ===")
return response
# Import JSONResponse to explicitly wrap the response
from fastapi.responses import JSONResponse
logger.info(f"Returning JSONResponse with response")
return JSONResponse(content=response)
except Exception as e: except Exception as e:
handler.record_failure() handler.record_failure()
raise HTTPException(status_code=500, detail=str(e)) raise HTTPException(status_code=500, detail=str(e))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment