You've already forked DataMate
feat(annotation): 文件版本更新时支持保留标注记录(位置偏移+文字匹配迁移)
新增 AnnotationMigrator 迁移算法,在 TEXT 类型数据集的文件版本更新时, 可选通过 difflib 位置偏移映射和文字二次匹配将旧版本标注迁移到新版本上。 前端版本切换对话框增加"保留标注"复选框(仅 TEXT 类型显示),后端 API 增加 preserveAnnotations 参数,完全向后兼容。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -220,6 +220,18 @@ class FileVersionCheckResponse(BaseModel):
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
|
||||
|
||||
class UseNewVersionRequest(BaseModel):
|
||||
"""使用新版本请求"""
|
||||
|
||||
preserve_annotations: bool = Field(
|
||||
False,
|
||||
alias="preserveAnnotations",
|
||||
description="是否尝试保留标注(基于文字匹配迁移)",
|
||||
)
|
||||
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
|
||||
|
||||
class UseNewVersionResponse(BaseModel):
|
||||
"""使用新版本响应"""
|
||||
|
||||
@@ -231,5 +243,11 @@ class UseNewVersionResponse(BaseModel):
|
||||
..., alias="currentFileVersion", description="当前文件版本"
|
||||
)
|
||||
message: str = Field(..., description="操作结果消息")
|
||||
migrated_count: Optional[int] = Field(
|
||||
None, alias="migratedCount", description="成功迁移的标注数量"
|
||||
)
|
||||
failed_count: Optional[int] = Field(
|
||||
None, alias="failedCount", description="无法迁移的标注数量"
|
||||
)
|
||||
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
|
||||
Reference in New Issue
Block a user