fix: 移除 settings.DEBUG 引用,修复删除 DEBUG 字段后的启动报错
- database.py: echo 改为 False - main.py: 错误响应直接显示异常信息(不再根据 DEBUG 判断) - 机器人重复图片回复增加 OCR 识别内容展示
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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)},
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user