feat(annotation): 添加文本数据集段落切片功能

- 在前端组件中新增 segmentationEnabled 字段控制切片开关
- 为文本数据集添加段落切片配置选项,默认启用切片功能
- 在后端接口中新增 segmentation_enabled 参数传递给标注项目
- 实现切片逻辑控制,支持文本数据的自动段落分割
- 添加数据集类型判断,仅文本数据集支持切片配置
- 更新标注任务创建和编辑表单中的切片相关字段处理
This commit is contained in:
2026-01-26 12:05:21 +08:00
parent fa160164d2
commit 371df12a96
7 changed files with 218 additions and 32 deletions

View File

@@ -90,9 +90,11 @@ class DatasetMappingService:
configuration = getattr(mapping, 'configuration', None) or {}
label_config = None
description = None
segmentation_enabled = None
if isinstance(configuration, dict):
label_config = configuration.get('label_config')
description = configuration.get('description')
segmentation_enabled = configuration.get('segmentation_enabled')
# Optionally fetch full template details
template_response = None
@@ -117,6 +119,7 @@ class DatasetMappingService:
"template_id": template_id,
"template": template_response,
"label_config": label_config,
"segmentation_enabled": segmentation_enabled,
"total_count": total_count,
"annotated_count": annotated_count,
"created_at": mapping.created_at,
@@ -154,9 +157,11 @@ class DatasetMappingService:
configuration = getattr(mapping, 'configuration', None) or {}
label_config = None
description = None
segmentation_enabled = None
if isinstance(configuration, dict):
label_config = configuration.get('label_config')
description = configuration.get('description')
segmentation_enabled = configuration.get('segmentation_enabled')
# Optionally fetch full template details
template_response = None
@@ -184,6 +189,7 @@ class DatasetMappingService:
"template_id": template_id,
"template": template_response,
"label_config": label_config,
"segmentation_enabled": segmentation_enabled,
"total_count": total_count,
"annotated_count": annotated_count,
"created_at": mapping.created_at,
@@ -526,4 +532,4 @@ class DatasetMappingService:
for row in rows:
response = await self._to_response_from_row(row, include_template=include_template)
responses.append(response)
return responses, total
return responses, total