From cb6e4656d55582245a9a187fd4398c6d504e4a24 Mon Sep 17 00:00:00 2001 From: Chenyme <118253778+chenyme@users.noreply.github.com> Date: Tue, 14 Oct 2025 10:56:52 +0800 Subject: [PATCH] fix: logger error --- app/api/v1/chat.py | 2 +- app/core/exception.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/v1/chat.py b/app/api/v1/chat.py index 9e612a8..87460e5 100644 --- a/app/api/v1/chat.py +++ b/app/api/v1/chat.py @@ -62,7 +62,7 @@ async def chat_completions( return result except GrokApiException as e: - logger.error(f"[Chat] Grok API错误: {str(e)}", extra={"details": e.details}) + logger.error(f"[Chat] Grok API错误: {str(e)} - 详情: {e.details}") raise HTTPException( status_code=500, detail={ diff --git a/app/core/exception.py b/app/core/exception.py index 52ac613..a5c179b 100644 --- a/app/core/exception.py +++ b/app/core/exception.py @@ -101,7 +101,7 @@ async def grok_api_exception_handler(_: Request, exc: GrokApiException) -> JSONR ) -async def global_exception_handler(_: Request) -> JSONResponse: +async def global_exception_handler(_: Request, exc: Exception) -> JSONResponse: """处理未捕获异常""" return JSONResponse( status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,