You've already forked DataMate
feat(annotation): 扩展标注模板功能支持多模态数据类型
- 扩展数据类型支持包括pdf/chat/html/table等多种格式 - 新增标注类型涵盖asr/ner/object-detection等专业领域 - 添加label_config字段用于Label Studio XML配置存储 - 更新模板分类体系为audio-speech/chat/computer-vision/nlp等 - 实现预定义label_config优先使用的配置加载逻辑 - 完善数据库初始化脚本包含多模态标注模板数据
This commit is contained in:
@@ -333,10 +333,10 @@ class AnnotationTemplateService:
|
||||
def _to_response(self, template: AnnotationTemplate) -> AnnotationTemplateResponse:
|
||||
"""
|
||||
转换为响应对象
|
||||
|
||||
|
||||
Args:
|
||||
template: 数据库模型对象
|
||||
|
||||
|
||||
Returns:
|
||||
模板响应对象
|
||||
"""
|
||||
@@ -344,13 +344,16 @@ class AnnotationTemplateService:
|
||||
from typing import cast, Dict, Any
|
||||
config_dict = cast(Dict[str, Any], template.configuration)
|
||||
config = TemplateConfiguration(**config_dict)
|
||||
|
||||
# 动态生成Label Studio XML配置
|
||||
label_config = self.generate_label_studio_config(config)
|
||||
|
||||
|
||||
# 优先使用预定义的 label_config,否则动态生成
|
||||
if template.label_config:
|
||||
label_config = template.label_config
|
||||
else:
|
||||
label_config = self.generate_label_studio_config(config)
|
||||
|
||||
# 使用model_validate从ORM对象创建响应对象
|
||||
response = AnnotationTemplateResponse.model_validate(template)
|
||||
response.configuration = config
|
||||
response.label_config = label_config # type: ignore
|
||||
|
||||
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user