You've already forked DataMate
feat: data annotation page adaptation to backend API. Improve labeling project creation module.
* feat: data annotation page adaptation to the backend API. * feat: Implement labeling configuration editor and enhance annotation task creation form
This commit is contained in:
@@ -1,17 +1,27 @@
|
||||
from pydantic import Field
|
||||
from pydantic import Field, BaseModel
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
from app.module.shared.schema import BaseResponseModel
|
||||
from app.module.shared.schema import StandardResponse
|
||||
|
||||
class _DatasetMappingBase(BaseResponseModel):
|
||||
"""数据集映射 基础模型"""
|
||||
dataset_id: str = Field(..., description="源数据集ID")
|
||||
|
||||
class DatasetMappingCreateRequest(_DatasetMappingBase):
|
||||
"""数据集映射 创建 请求模型"""
|
||||
pass
|
||||
class DatasetMappingCreateRequest(BaseModel):
|
||||
"""数据集映射 创建 请求模型
|
||||
|
||||
Accept both snake_case and camelCase field names from frontend JSON by
|
||||
declaring explicit aliases. Frontend sends `datasetId`, `name`,
|
||||
`description` (camelCase), so provide aliases so pydantic will map them
|
||||
to the internal attributes used in the service code (dataset_id, name,
|
||||
description).
|
||||
"""
|
||||
dataset_id: str = Field(..., alias="datasetId", description="源数据集ID")
|
||||
name: Optional[str] = Field(None, alias="name", description="标注项目名称")
|
||||
description: Optional[str] = Field(None, alias="description", description="标注项目描述")
|
||||
|
||||
class Config:
|
||||
# allow population by field name when constructing model programmatically
|
||||
allow_population_by_field_name = True
|
||||
|
||||
class DatasetMappingCreateResponse(BaseResponseModel):
|
||||
"""数据集映射 创建 响应模型"""
|
||||
@@ -23,7 +33,8 @@ class DatasetMappingUpdateRequest(BaseResponseModel):
|
||||
"""数据集映射 更新 请求模型"""
|
||||
dataset_id: Optional[str] = Field(None, description="源数据集ID")
|
||||
|
||||
class DatasetMappingResponse(_DatasetMappingBase):
|
||||
class DatasetMappingResponse(BaseModel):
|
||||
dataset_id: str = Field(..., description="源数据集ID")
|
||||
"""数据集映射 查询 响应模型"""
|
||||
id: str = Field(..., description="映射UUID")
|
||||
labeling_project_id: str = Field(..., description="标注项目ID")
|
||||
|
||||
Reference in New Issue
Block a user