diff --git a/runtime/datamate-python/app/module/annotation/schema/template.py b/runtime/datamate-python/app/module/annotation/schema/template.py index a36d1f3ef..891b2d25b 100644 --- a/runtime/datamate-python/app/module/annotation/schema/template.py +++ b/runtime/datamate-python/app/module/annotation/schema/template.py @@ -14,6 +14,7 @@ class LabelDefinition(BaseModel): options: Optional[List[str]] = Field(None, description="选项列表(用于choices类型)") labels: Optional[List[str]] = Field(None, description="标签列表(用于rectanglelabels等类型)") required: bool = Field(False, description="是否必填") + choice: Optional[str] = Field(None, description="选项设置") description: Optional[str] = Field(None, description="标签描述") model_config = ConfigDict(populate_by_name=True) diff --git a/runtime/datamate-python/app/module/annotation/service/template.py b/runtime/datamate-python/app/module/annotation/service/template.py index e5474924d..e9b5976e0 100644 --- a/runtime/datamate-python/app/module/annotation/service/template.py +++ b/runtime/datamate-python/app/module/annotation/service/template.py @@ -55,7 +55,10 @@ def generate_label_studio_config(config: TemplateConfiguration) -> str: # 添加可选属性 if label.required: label_attrs.append('required="true"') - + + if label.choice: + label_attrs.append(f'choice="{label.choice}"') + tag_type = label.type.capitalize() if label.type else "Choices" # 检查是否需要子元素