16 lines
317 B
Python
16 lines
317 B
Python
from typing import Generic, TypeVar
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
class ApiResponse(BaseModel, Generic[T]):
|
|
"""与 aiclient 前端约定的统一响应结构。"""
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
ok: bool
|
|
message: str = ""
|
|
data: T | None = None
|