mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-06-27 18:51:40 +08:00
- 新增自定义异常类 BizException、NoteError 和 ProviderError - 优化了模型管理相关的逻辑,包括加载、删除和测试连接等功能 - 改进了 Douyin 下载器的错误处理 - 调整了任务重试逻辑和笔记生成的异常处理- 更新了相关组件和页面以适应新的异常处理机制
24 lines
605 B
Python
24 lines
605 B
Python
from fastapi.responses import JSONResponse
|
|
from app.utils.status_code import StatusCode
|
|
from pydantic import BaseModel
|
|
from typing import Optional, Any
|
|
|
|
|
|
from fastapi.responses import JSONResponse
|
|
|
|
class ResponseWrapper:
|
|
@staticmethod
|
|
def success(data=None, msg="success", code=0):
|
|
return JSONResponse(content={
|
|
"code": code,
|
|
"msg": msg,
|
|
"data": data
|
|
})
|
|
|
|
@staticmethod
|
|
def error(msg="error", code=500, data=None):
|
|
return JSONResponse(content={
|
|
"code": code,
|
|
"msg": msg,
|
|
"data": data
|
|
}) |