""" 统一响应 Schema """ from __future__ import annotations from typing import Any, Generic, TypeVar from pydantic import BaseModel T = TypeVar("T") class ApiResponse(BaseModel, Generic[T]): code: int = 200 data: T | None = None message: str = "ok" def ok(data: Any = None, message: str = "ok") -> dict: """快捷返回成功响应""" return {"code": 200, "data": data, "message": message}