feat(annotation): 优化标注编辑器的标签配置获取逻辑

- 优先使用项目配置中的label_config(用户编辑版本)
- 其次使用模板默认配置作为备选方案
- 支持从项目配置字典中获取label_config字段
- 保持向后兼容性,当项目配置无效时回退到模板配置
This commit is contained in:
2026-01-19 16:34:20 +08:00
parent 4df48e08c8
commit 70ea998564

View File

@@ -96,7 +96,12 @@ class AnnotationEditorService:
if not supported:
unsupported_reason = f"当前仅支持 TEXT,项目数据类型为: {dataset_type or 'UNKNOWN'}"
label_config = await self._get_label_config(project.template_id)
# 优先使用项目配置中的label_config(用户编辑版本),其次使用模板默认配置
label_config = None
if project.configuration and isinstance(project.configuration, dict):
label_config = project.configuration.get("label_config")
if not label_config:
label_config = await self._get_label_config(project.template_id)
return EditorProjectInfo(
projectId=project.id,