diff --git a/README.md b/README.md index a160704..e374bb2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ # 🚀 BitQuant by OpenGradient -**BitQuant** is a open-source AI agent framework for building quantitative AI agents. It leverages specialized models for ML-powered analytics, trading, portfolio management, and more—all through a natural language interface. BitQuant exposes a REST API that turns user inputs like "What is the current risk profile on Bitcoin?" or "Optimize my portfolio for maximum risk-adjusted returns" into actionable insights. +**BitQuant** is an open-source AI agent framework for building quantitative AI agents. It leverages specialized models for ML-powered analytics, trading, portfolio management, and more—all through a natural language interface. BitQuant exposes a REST API that turns user inputs like "What is the current risk profile on Bitcoin?" or "Optimize my portfolio for maximum risk-adjusted returns" into actionable insights. --- diff --git a/server/fastapi_server.py b/server/fastapi_server.py index 6d01da8..9ec33e2 100644 --- a/server/fastapi_server.py +++ b/server/fastapi_server.py @@ -171,7 +171,23 @@ async def generic_exception_handler(request: Request, exc: Exception): logging.error(f"500 Error: {str(exc)}") logging.error(f"Traceback: {error_traceback}") logging.error(f"Request Path: {request.url.path}") - logging.error(f"Request Body: {await request.body()}") + logging.error(f"Request Method: {request.method}") + + # Safely attempt to read request body for debugging + # Note: Request body may already be consumed, so we wrap in try-except + # Also limit body size to prevent logging large payloads + try: + body = await request.body() + # Only log body in development or if it's small (< 1KB) + # This prevents logging sensitive data and large payloads + max_body_log_size = 1024 + if len(body) <= max_body_log_size: + logging.error(f"Request Body: {body.decode('utf-8', errors='ignore')}") + else: + logging.error(f"Request Body: [Too large to log ({len(body)} bytes)]") + except Exception as body_error: + # Request body may have already been consumed + logging.error(f"Could not read request body: {str(body_error)}") return JSONResponse( status_code=500,