You've already forked DataMate
feat: add labeling template. refactor: switch to Poetry, build and deploy of backend Python (#79)
* feat: Enhance annotation module with template management and validation - Added DatasetMappingCreateRequest and DatasetMappingUpdateRequest schemas to handle dataset mapping requests with camelCase and snake_case support. - Introduced Annotation Template schemas including CreateAnnotationTemplateRequest, UpdateAnnotationTemplateRequest, and AnnotationTemplateResponse for managing annotation templates. - Implemented AnnotationTemplateService for creating, updating, retrieving, and deleting annotation templates, including validation of configurations and XML generation. - Added utility class LabelStudioConfigValidator for validating Label Studio configurations and XML formats. - Updated database schema for annotation templates and labeling projects to include new fields and constraints. - Seeded initial annotation templates for various use cases including image classification, object detection, and text classification. * feat: Enhance TemplateForm with improved validation and dynamic field rendering; update LabelStudio config validation for camelCase support * feat: Update docker-compose.yml to mark datamate dataset volume and network as external * feat: Add tag configuration management and related components - Introduced new components for tag selection and browsing in the frontend. - Added API endpoint to fetch tag configuration from the backend. - Implemented tag configuration management in the backend, including loading from YAML. - Enhanced template service to support dynamic tag rendering based on configuration. - Updated validation utilities to incorporate tag configuration checks. - Refactored existing code to utilize the new tag configuration structure. * feat: Refactor LabelStudioTagConfig for improved configuration loading and validation * feat: Update Makefile to include backend-python-docker-build in the build process * feat: Migrate to poetry for better deps management * Add pyyaml dependency and update Dockerfile to use Poetry for dependency management - Added pyyaml (>=6.0.3,<7.0.0) to pyproject.toml dependencies. - Updated Dockerfile to install Poetry and manage dependencies using it. - Improved layer caching by copying only dependency files before the application code. - Removed unnecessary installation of build dependencies to keep the final image size small. * feat: Remove duplicated backend-python-docker-build target from Makefile * fix: airflow is not ready for adding yet * feat: update Python version to 3.12 and remove project installation step in Dockerfile
This commit is contained in:
@@ -1,8 +1,36 @@
|
||||
from pydantic import Field
|
||||
from typing import Dict, Any, List, Optional
|
||||
from pydantic import BaseModel, Field, ConfigDict
|
||||
|
||||
from app.module.shared.schema import BaseResponseModel
|
||||
from app.module.shared.schema import StandardResponse
|
||||
|
||||
class ConfigResponse(BaseResponseModel):
|
||||
"""配置信息响应模型"""
|
||||
label_studio_url: str = Field(..., description="Label Studio基础URL")
|
||||
label_studio_url: str = Field(..., description="Label Studio基础URL")
|
||||
|
||||
|
||||
class _TagAttributeConfig(BaseModel):
|
||||
"""标签属性配置"""
|
||||
type: Optional[str] = Field(None, description="属性类型: boolean/string/number")
|
||||
values: Optional[List[str]] = Field(None, description="允许的枚举值列表")
|
||||
default: Optional[Any] = Field(None, description="默认值")
|
||||
description: Optional[str] = Field(None, description="属性描述")
|
||||
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
|
||||
|
||||
class _TagDefinition(BaseModel):
|
||||
"""标签定义"""
|
||||
description: str = Field(..., description="标签描述")
|
||||
required_attrs: List[str] = Field(default_factory=list, alias="requiredAttrs", description="必需属性列表")
|
||||
optional_attrs: Dict[str, _TagAttributeConfig] = Field(default_factory=dict, alias="optionalAttrs", description="可选属性配置")
|
||||
requires_children: bool = Field(default=False, alias="requiresChildren", description="是否需要子元素")
|
||||
child_tag: Optional[str] = Field(None, alias="childTag", description="子元素标签名")
|
||||
child_required_attrs: Optional[List[str]] = Field(None, alias="childRequiredAttrs", description="子元素必需属性")
|
||||
category: Optional[str] = Field(None, description="标签分类")
|
||||
|
||||
|
||||
class TagConfigResponse(BaseResponseModel):
|
||||
"""标签配置响应"""
|
||||
objects: Dict[str, _TagDefinition] = Field(default_factory=dict, description="对象标签配置")
|
||||
controls: Dict[str, _TagDefinition] = Field(default_factory=dict, description="控件标签配置")
|
||||
Reference in New Issue
Block a user