From 8152494fdc79ee1a9d5506c126777b5bb87f0c0c Mon Sep 17 00:00:00 2001 From: EduBrain Dev Date: Tue, 14 Apr 2026 14:03:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=20settings.DEBUG=20?= =?UTF-8?q?=E5=BC=95=E7=94=A8=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=20DEBUG=20=E5=AD=97=E6=AE=B5=E5=90=8E=E7=9A=84=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - database.py: echo 改为 False - main.py: 错误响应直接显示异常信息(不再根据 DEBUG 判断) - 机器人重复图片回复增加 OCR 识别内容展示 --- app/database.py | 4 ++-- app/main.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/database.py b/app/database.py index 57cea68..0586d02 100644 --- a/app/database.py +++ b/app/database.py @@ -33,13 +33,13 @@ if IS_SQLITE: engine = create_async_engine( f"sqlite+aiosqlite:///{sqlite_path}", - echo=settings.DEBUG, + echo=False, ) else: # PostgreSQL 配置 engine = create_async_engine( DB_URL, - echo=settings.DEBUG, + echo=False, poolclass=NullPool, pool_pre_ping=True, ) diff --git a/app/main.py b/app/main.py index 08dc202..6052517 100644 --- a/app/main.py +++ b/app/main.py @@ -208,7 +208,7 @@ async def global_exception_handler(request: Request, exc: Exception) -> JSONResp logger.error("未处理异常: %s", exc, exc_info=True) return JSONResponse( status_code=500, - content={"detail": "服务器内部错误", "message": str(exc) if settings.DEBUG else "请稍后重试"}, + content={"detail": "服务器内部错误", "message": str(exc)}, )