refactor(annotation): 简化文本标注编辑器的段落管理功能

- 移除段落统计相关的数据结构和缓存逻辑
- 删除段落切换确认对话框和自动保存选项
- 简化段落加载和状态管理流程
- 将段落列表视图替换为简单的进度显示
- 更新API接口以支持单段内容获取
- 重构后端服务实现单段内容查询功能
This commit is contained in:
2026-02-04 18:08:14 +08:00
parent 707e65b017
commit fa9e9d9f68
5 changed files with 98 additions and 421 deletions

View File

@@ -19,8 +19,8 @@ from app.db.session import get_db
from app.module.annotation.schema.editor import (
EditorProjectInfo,
EditorTaskListResponse,
EditorTaskSegmentResponse,
EditorTaskResponse,
EditorTaskSegmentsResponse,
UpsertAnnotationRequest,
UpsertAnnotationResponse,
)
@@ -90,15 +90,16 @@ async def get_editor_task(
@router.get(
"/projects/{project_id}/tasks/{file_id}/segments",
response_model=StandardResponse[EditorTaskSegmentsResponse],
response_model=StandardResponse[EditorTaskSegmentResponse],
)
async def list_editor_task_segments(
async def get_editor_task_segment(
project_id: str = Path(..., description="标注项目ID(t_dm_labeling_projects.id)"),
file_id: str = Path(..., description="文件ID(t_dm_dataset_files.id)"),
segment_index: int = Query(..., ge=0, alias="segmentIndex", description="段落索引(从0开始)"),
db: AsyncSession = Depends(get_db),
):
service = AnnotationEditorService(db)
result = await service.get_task_segments(project_id, file_id)
result = await service.get_task_segment(project_id, file_id, segment_index)
return StandardResponse(code=200, message="success", data=result)