49f99527cc
feat(auto-annotation): add LLM-based annotation operators
...
Add three new LLM-powered auto-annotation operators:
- LLMTextClassification: Text classification using LLM
- LLMNamedEntityRecognition: Named entity recognition with type validation
- LLMRelationExtraction: Relation extraction with entity and relation type validation
Key features:
- Load LLM config from t_model_config table via modelId parameter
- Lazy loading of LLM configuration on first execute()
- Result validation with whitelist checking for entity/relation types
- Fault-tolerant: returns empty results on LLM failure instead of throwing
- Fully compatible with existing Worker pipeline
Files added:
- runtime/ops/annotation/_llm_utils.py: Shared LLM utilities
- runtime/ops/annotation/llm_text_classification/: Text classification operator
- runtime/ops/annotation/llm_named_entity_recognition/: NER operator
- runtime/ops/annotation/llm_relation_extraction/: Relation extraction operator
Files modified:
- runtime/ops/annotation/__init__.py: Register 3 new operators
- runtime/python-executor/datamate/auto_annotation_worker.py: Add to Worker whitelist
- frontend/src/pages/DataAnnotation/OperatorCreate/hooks/useOperatorOperations.ts: Add to frontend whitelist
2026-02-10 15:22:23 +08:00
8ffa131fad
feat(annotation): 自动标注任务支持非图像类型数据集(TEXT/AUDIO/VIDEO)
...
移除自动标注任务创建流程中的 IMAGE-only 限制,使 TEXT、AUDIO、VIDEO
类型数据集均可用于自动标注任务。
- 新增数据库迁移:t_dm_auto_annotation_tasks 表添加 dataset_type 列
- 后端 schema/API/service 全链路传递 dataset_type
- Worker 动态构建 sample key(image/text/audio/video)和输出目录
- 前端移除数据集类型校验,下拉框显示数据集类型标识
- 输出数据集继承源数据集类型,不再硬编码为 IMAGE
- 保持向后兼容:默认值为 IMAGE,worker 有元数据回退和目录 fallback
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-02-09 23:23:05 +08:00
807c2289e2
feat(annotation): 文件版本更新时支持保留标注记录(位置偏移+文字匹配迁移)
...
新增 AnnotationMigrator 迁移算法,在 TEXT 类型数据集的文件版本更新时,
可选通过 difflib 位置偏移映射和文字二次匹配将旧版本标注迁移到新版本上。
前端版本切换对话框增加"保留标注"复选框(仅 TEXT 类型显示),后端 API
增加 preserveAnnotations 参数,完全向后兼容。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-02-09 19:42:59 +08:00
71f8f7d1c3
feat: 实现任务拆分和分配功能
...
## 功能概述
实现完整的任务拆分、分配和进度跟踪功能,支持将任务拆分为子任务并分配给不同用户。
## Phase 1: 数据库层
- 新增 t_task_meta 表(任务元数据协调表)
- 新增 t_task_assignment_log 表(分配日志表)
- 新增 3 个权限条目(read/write/assign)
- 新增 SQLAlchemy ORM 模型
## Phase 2: 后端 API (Java)
- 新增 task-coordination-service 模块(32 个文件)
- 实现 11 个 API 端点:
- 任务查询(列表、子任务、我的任务)
- 任务拆分(支持 4 种策略)
- 任务分配(单个、批量、重新分配、撤回)
- 进度管理(查询、更新、聚合)
- 分配日志
- 集成权限控制和路由规则
## Phase 3: 前端 UI (React + TypeScript)
- 新增 10 个文件(模型、API、组件、页面)
- 实现 5 个核心组件:
- SplitTaskDialog - 任务拆分对话框
- AssignTaskDialog - 任务分配对话框
- BatchAssignDialog - 批量分配对话框
- TaskProgressPanel - 进度面板
- AssignmentLogDrawer - 分配记录
- 实现 2 个页面:
- TaskCoordination - 任务管理主页
- MyTasks - 我的任务页面
- 集成侧边栏菜单和路由
## 问题修复
- 修复 getMyTasks 分页参数缺失
- 修复子任务 assignee 信息缺失(批量查询优化)
- 修复 proportion 精度计算(余量分配)
## 技术亮点
- 零侵入设计:通过独立协调表实现,不修改现有模块
- 批量查询优化:避免 N+1 查询问题
- 4 种拆分策略:按比例/数量/文件/手动
- 进度自动聚合:子任务更新自动聚合到父任务
- 权限细粒度控制:read/write/assign 三级权限
## 验证
- Maven 编译:✅ 零错误
- TypeScript 编译:✅ 零错误
- Vite 生产构建:✅ 成功
2026-02-09 00:42:34 +08:00
78624915b7
feat(annotation): 添加标注任务算子编排前端页面和测试算子
...
## 功能概述
为标注任务通用算子编排功能添加完整的前端界面,包括任务创建、列表管理、详情查看等功能,并提供测试算子用于功能验证。
## 改动内容
### 前端功能
#### 1. 算子编排页面
- 新增两步创建流程:
- 第一步:基本信息(数据集选择、任务名称等)
- 第二步:算子编排(选择算子、配置参数、预览 pipeline)
- 核心文件:
- frontend/src/pages/DataAnnotation/OperatorCreate/CreateTask.tsx
- frontend/src/pages/DataAnnotation/OperatorCreate/hooks/useOperatorOperations.ts
- frontend/src/pages/DataAnnotation/OperatorCreate/hooks/useDragOperators.ts
- frontend/src/pages/DataAnnotation/OperatorCreate/hooks/useCreateStepTwo.tsx
#### 2. UI 组件
- 算子库(OperatorLibrary):显示可用算子,支持分类筛选
- 编排区(OperatorOrchestration):拖拽排序算子
- 参数面板(OperatorConfig):配置算子参数
- Pipeline 预览(PipelinePreview):预览算子链
- 核心文件:frontend/src/pages/DataAnnotation/OperatorCreate/components/
#### 3. 任务列表管理
- 在数据标注首页同一 Tab 中添加任务列表
- 支持状态筛选(pending/running/completed/failed/stopped)
- 支持关键词搜索
- 支持轮询刷新
- 支持停止任务
- 支持下载结果
- 核心文件:frontend/src/pages/DataAnnotation/Home/components/AutoAnnotationTaskList.tsx
#### 4. 任务详情抽屉
- 点击任务名打开详情抽屉
- 显示任务基本信息(名称、状态、进度、时间等)
- 显示 pipeline 配置(算子链和参数)
- 显示错误信息(如果失败)
- 显示产物路径和下载按钮
- 核心文件:frontend/src/pages/DataAnnotation/Home/components/AutoAnnotationTaskDetailDrawer.tsx
#### 5. API 集成
- 封装自动标注任务相关接口:
- list:获取任务列表
- create:创建任务
- detail:获取任务详情
- delete:删除任务
- stop:停止任务
- download:下载结果
- 核心文件:frontend/src/pages/DataAnnotation/annotation.api.ts
#### 6. 路由配置
- 新增路由:/data/annotation/create-auto-task
- 集成到数据标注首页
- 核心文件:
- frontend/src/routes/routes.ts
- frontend/src/pages/DataAnnotation/Home/DataAnnotation.tsx
#### 7. 算子模型增强
- 新增 runtime 字段用于标注算子筛选
- 核心文件:frontend/src/pages/OperatorMarket/operator.model.ts
### 后端功能
#### 1. 测试算子(test_annotation_marker)
- 功能:在图片上绘制测试标记并输出 JSON 标注
- 用途:测试标注功能是否正常工作
- 实现文件:
- runtime/ops/annotation/test_annotation_marker/process.py
- runtime/ops/annotation/test_annotation_marker/metadata.yml
- runtime/ops/annotation/test_annotation_marker/__init__.py
#### 2. 算子注册
- 将测试算子注册到 annotation ops 包
- 添加到运行时白名单
- 核心文件:
- runtime/ops/annotation/__init__.py
- runtime/python-executor/datamate/auto_annotation_worker.py
#### 3. 数据库初始化
- 添加测试算子到数据库
- 添加算子分类关联
- 核心文件:scripts/db/data-operator-init.sql
### 问题修复
#### 1. outputDir 默认值覆盖问题
- 问题:前端设置空字符串默认值导致 worker 无法注入真实输出目录
- 解决:过滤掉空/null 的 outputDir,确保 worker 能注入真实输出目录
- 修改位置:frontend/src/pages/DataAnnotation/OperatorCreate/hooks/useOperatorOperations.ts
#### 2. targetClasses 默认值类型问题
- 问题:YOLO 算子 metadata 中 targetClasses 默认值是字符串 '[]' 而不是列表
- 解决:改为列表 []
- 修改位置:runtime/ops/annotation/image_object_detection_bounding_box/metadata.yml
## 关键特性
### 用户体验
- 统一的算子编排界面(与数据清洗保持一致)
- 直观的拖拽操作
- 实时的 pipeline 预览
- 完整的任务管理功能
### 功能完整性
- 任务创建:两步流程,清晰明了
- 任务管理:列表展示、状态筛选、搜索
- 任务操作:停止、下载
- 任务详情:完整的信息展示
### 可测试性
- 提供测试算子用于功能验证
- 支持快速测试标注流程
## 验证结果
- ESLint 检查:✅ 通过
- 前端构建:✅ 通过(10.91s)
- 功能测试:✅ 所有功能正常
## 部署说明
1. 执行数据库初始化脚本(如果是新环境)
2. 重启前端服务
3. 重启后端服务(如果修改了 worker 白名单)
## 使用说明
1. 进入数据标注页面
2. 点击创建自动标注任务
3. 选择数据集和文件
4. 从算子库拖拽算子到编排区
5. 配置算子参数
6. 预览 pipeline
7. 提交任务
8. 在任务列表中查看进度
9. 点击任务名查看详情
10. 下载标注结果
## 相关文件
- 前端页面:frontend/src/pages/DataAnnotation/OperatorCreate/
- 任务管理:frontend/src/pages/DataAnnotation/Home/components/
- API 集成:frontend/src/pages/DataAnnotation/annotation.api.ts
- 测试算子:runtime/ops/annotation/test_annotation_marker/
- 数据库脚本:scripts/db/data-operator-init.sql
2026-02-08 08:17:35 +08:00
2f49fc4199
feat(annotation): 支持通用算子编排的数据标注功能
...
## 功能概述
将数据标注模块从固定 YOLO 算子改造为支持通用算子编排,实现与数据清洗模块类似的灵活算子组合能力。
## 改动内容
### 第 1 步:数据库改造(DDL)
- 新增 SQL migration 脚本:scripts/db/data-annotation-operator-pipeline-migration.sql
- 修改 t_dm_auto_annotation_tasks 表:
- 新增字段:task_mode, executor_type, pipeline, output_dataset_id, created_by, stop_requested, started_at, heartbeat_at, run_token
- 新增索引:idx_status_created, idx_created_by
- 创建 t_dm_annotation_task_operator_instance 表:用于存储算子实例详情
### 第 2 步:API 层改造
- 扩展请求模型(schema/auto.py):
- 新增 OperatorPipelineStep 模型
- 支持 pipeline 字段,保留旧 YOLO 字段向后兼容
- 实现多写法归一(operatorId/operator_id/id, overrides/settingsOverride/settings_override)
- 修改任务创建服务(service/auto.py):
- 新增 validate_file_ids() 校验方法
- 新增 _to_pipeline() 兼容映射方法
- 写入新字段并集成算子实例表
- 修复 fileIds 去重准确性问题
- 新增 API 路由(interface/auto.py):
- 新增 /operator-tasks 系列接口
- 新增 stop API 接口(/auto/{id}/stop 和 /operator-tasks/{id}/stop)
- 保留旧 /auto 接口向后兼容
- ORM 模型对齐(annotation_management.py):
- AutoAnnotationTask 新增所有 DDL 字段
- 新增 AnnotationTaskOperatorInstance 模型
- 状态定义补充 stopped
### 第 3 步:Runtime 层改造
- 修改 worker 执行逻辑(auto_annotation_worker.py):
- 实现原子任务抢占机制(run_token)
- 从硬编码 YOLO 改为通用 pipeline 执行
- 新增算子解析和实例化能力
- 支持 stop_requested 检查
- 保留 legacy_yolo 模式向后兼容
- 支持多种算子调用方式(execute 和 __call__)
### 第 4 步:灰度发布
- 完善 YOLO 算子元数据(metadata.yml):
- 补齐 raw_id, language, modal, inputs, outputs, settings 字段
- 注册标注算子(__init__.py):
- 将 YOLO 算子注册到 OPERATORS 注册表
- 确保 annotation 包被正确加载
- 新增白名单控制:
- 支持环境变量 AUTO_ANNOTATION_OPERATOR_WHITELIST
- 灰度发布时可限制可用算子
## 关键特性
### 向后兼容
- 旧 /auto 接口完全保留
- 旧请求参数自动映射到 pipeline
- legacy_yolo 模式确保旧逻辑正常运行
### 新功能
- 支持通用 pipeline 编排
- 支持多算子组合
- 支持任务停止控制
- 支持白名单灰度发布
### 可靠性
- 原子任务抢占(防止重复执行)
- 完整的错误处理和状态管理
- 详细的审计追踪(算子实例表)
## 部署说明
1. 执行 DDL:mysql < scripts/db/data-annotation-operator-pipeline-migration.sql
2. 配置环境变量:AUTO_ANNOTATION_OPERATOR_WHITELIST=ImageObjectDetectionBoundingBox
3. 重启服务:datamate-runtime 和 datamate-backend-python
## 验证步骤
1. 兼容模式验证:使用旧 /auto 接口创建任务
2. 通用编排验证:使用新 /operator-tasks 接口创建 pipeline 任务
3. 原子 claim 验证:检查 run_token 机制
4. 停止验证:测试 stop API
5. 白名单验证:测试算子白名单拦截
## 相关文件
- DDL: scripts/db/data-annotation-operator-pipeline-migration.sql
- API: runtime/datamate-python/app/module/annotation/
- Worker: runtime/python-executor/datamate/auto_annotation_worker.py
- 算子: runtime/ops/annotation/image_object_detection_bounding_box/
2026-02-07 22:35:33 +08:00
3dd4035005
feat: 完善数据标注导出格式兼容性验证
...
- 后端:添加 YOLO 格式对 TEXT 数据集的限制验证
- 后端:统一 COCO/YOLO 兼容性校验规则(仅允许图像类或目标检测类数据集)
- 后端:修复 datasetType 字段传递,在任务列表响应中补充 dataset_type
- 前端:在导出对话框中禁用 TEXT 数据集的 COCO/YOLO 选项
- 前端:添加 datasetType 和 labelingType 字段传递
- 前端:对齐前后端 COCO/YOLO 兼容性规则
- 前端:优化提示文案,明确说明格式适用范围
修改文件:
- runtime/datamate-python/app/module/annotation/service/export.py
- runtime/datamate-python/app/module/annotation/service/mapping.py
- runtime/datamate-python/app/module/annotation/schema/mapping.py
- frontend/src/pages/DataAnnotation/Home/ExportAnnotationDialog.tsx
- frontend/src/pages/DataAnnotation/Home/DataAnnotation.tsx
- frontend/src/pages/DataAnnotation/annotation.const.tsx
2026-02-07 16:05:57 +08:00
36b410ba7b
feat(annotation): 添加导出格式与数据集类型的兼容性检查
...
- 实现 COCO 格式导出前的数据集类型验证
- COCO 格式仅适用于图像类和目标检测类数据集
- 文本类数据集尝试导出 COCO 格式时返回 HTTP 400 错误
- 添加清晰的错误提示信息,建议使用其他格式
新增功能:
- 数据集类型常量定义(TEXT、IMAGE、OBJECT_DETECTION)
- COCO 兼容类型集合
- 类型值标准化方法
- 数据集类型查询方法
- 模板标注类型解析方法
- 导出格式兼容性验证方法
相关文件:
- runtime/datamate-python/app/module/annotation/service/export.py (+94, -7)
Reviewed-by: Codex AI
2026-02-07 16:05:57 +08:00
e862925a06
feat(export): 添加逻辑路径构建功能支持文件管理
...
- 在导出服务中实现_build_logical_path方法用于构建相对路径
- 更新数据集文件记录以包含logical_path字段
- 在比率任务服务中实现build_logical_path静态方法
- 将逻辑路径信息添加到数据集文件记录中
- 规范化路径处理并替换反斜杠为正斜杠
- 添加无效路径验证防止目录遍历安全问题
2026-02-06 18:46:44 +08:00
05752678cc
feat(dataset): 添加PDF提取服务中的逻辑路径构建功能
...
- 移除重复的csv导入语句
- 添加_build_logical_path方法用于构建文件逻辑路径
- 在_create_text_file_record方法中增加logical_path参数
- 更新记录创建调用以传递逻辑路径参数
- 验证逻辑路径不为空并抛出相应异常
- 将逻辑路径存储到数据集文件记录中
2026-02-06 18:30:44 +08:00
38e58ba864
Merge branch 'rbac' into lsf
2026-02-06 15:44:43 +08:00
cd5f5ef6da
fix(annotation): fix use_new_version to support files without annotation
...
Problem:
use_new_version returned 404 annotation not found for files without
annotation, preventing users from switching to new versions.
Solution:
1. Query latest file by logical_path
2. Update LabelingProjectFile to point to latest version
3. If annotation exists: clear it and update file_id
4. If no annotation: just update project file snapshot
5. Return new file_id in response
2026-02-06 15:22:57 +08:00
1f6c821cbc
fix(annotation): show new version warning even without annotation
...
Change has_new_version logic to compare current file version with
latest version, regardless of whether annotation exists.
Before: Only show warning if annotation exists and version is outdated
After: Show warning if current file is not the latest version
This ensures users are informed when viewing an old file version,
even if they haven't started annotating yet.
2026-02-06 15:17:51 +08:00
44a1f2193f
fix(annotation): fix file version check to compare with latest version by logical path
...
Problem:
check_file_version was comparing annotation version with the passed
file_id's version, but when files are updated, new file records are
created with higher versions and old ones are marked ARCHIVED.
Solution:
1. Query the latest ACTIVE file by logical_path
2. Compare annotation version with latest file version
3. Return latestFileId so frontend can switch to new version
Changes:
- check_file_version now queries latest version by logical_path
- Added latest_file_id to FileVersionCheckResponse schema
- Updated descriptions to clarify currentFileVersion is latest version
Database scenario:
- old file: id=6dae9f2f, version=1, status=ARCHIVED
- new file: id=3365b4e7, version=3, status=ACTIVE
- Both have same logical_path='rufus.ini'
- Now correctly detects version 3 > annotation version
2026-02-06 15:11:54 +08:00
6a4c4ae3d7
feat(auth): 为数据管理和RAG服务增加资源访问控制
...
- 在DatasetApplicationService中注入ResourceAccessService并添加所有权验证
- 在KnowledgeSetApplicationService中注入ResourceAccessService并添加所有权验证
- 修改DatasetRepository接口和实现类,增加按创建者过滤的方法
- 修改KnowledgeSetRepository接口和实现类,增加按创建者过滤的方法
- 在RAG索引器服务中添加知识库访问权限检查和作用域过滤
- 更新实体元对象处理器以使用请求用户上下文获取当前用户
- 在前端设置页面添加用户权限管理功能和角色权限控制
- 为Python标注服务增加用户上下文和数据集访问权限验证
2026-02-06 14:58:46 +08:00
c6dccf5e29
fix(python): remove datetime.UTC usage for Python 3.10 compatibility
...
Replace datetime.datetime.now(datetime.UTC) with datetime.datetime.now()
to fix compatibility issues with Python 3.10 and earlier versions.
datetime.UTC is only available in Python 3.11+, causing 500 errors
in production environment.
Files fixed:
- app/module/dataset/service/pdf_extract.py
- app/module/generation/service/export_service.py
2026-02-06 13:34:27 +08:00
fbc83b5610
revert(db): remove Alembic migration system
...
Remove Alembic database migration system in favor of delta scripts:
Deleted:
- runtime/datamate-python/alembic.ini (config file)
- runtime/datamate-python/alembic/env.py (environment config)
- runtime/datamate-python/alembic/script.py.mako (migration template)
- runtime/datamate-python/alembic/versions/20250205_0001_add_file_version.py (migration)
Modified:
- scripts/db/data-annotation-init.sql
- Removed alembic_version table creation and version insertion
- Kept file_version column in t_dm_annotation_results
Rationale:
- Alembic migration testing failed in production
- Delta scripts are simpler and more reliable for this project
- SQL init scripts contain complete schema including latest changes
2026-02-06 13:29:44 +08:00
f8f9faaa06
feat(runtime): 添加 Pillow 图像处理库依赖
...
- 在 poetry.lock 中新增 pillow 包及其所有版本的依赖信息
- 支持多种操作系统平台包括 macOS、Linux、Windows 和 iOS
- 支持多种架构包括 x86_64、arm64、aarch64 和 win32
- 支持 Python 版本从 3.9 到 3.14 的完整兼容性
- 包含多种文件格式如 wheel 和 tar.gz 校验信息
- 添加了文档、测试和类型检查相关的可选依赖配置
2026-02-06 13:21:01 +08:00
719f54bf2e
feat(annotation): 完善文件版本管理和标注同步功能
...
- 将 useNewVersionUsingPost 重命名为 applyNewVersionUsingPost
- 添加 fileVersionCheckSeqRef 避免版本检查竞态条件
- 移除 checkingFileVersion 状态变量的渲染依赖
- 在文件版本信息中添加 annotationVersionUnknown 字段
- 修复前端文件版本比较显示的 JSX 语法
- 添加历史标注缺少版本信息的提示显示
- 配置 Alembic 异步数据库迁移环境支持 aiomysql
- 添加文件版本未知状态的后端判断逻辑
- 实现标注清除时的段落注释清理功能
- 添加知识库同步钩子到版本更新流程
2026-02-05 23:22:49 +08:00
48cf49d064
feat(db): update SQL init script and Alembic migration for compatibility
...
Update data-annotation-init.sql and Alembic migration to support both new and old deployments:
SQL Initialization Script (data-annotation-init.sql):
- Add file_version column to t_dm_annotation_results table
- Add Alembic version table creation and version insertion
- New deployments using this script will have latest schema and Alembic version marked
Alembic Migration (20250205_0001_add_file_version.py):
- Add column_exists() helper function to detect if column already exists
- Add compatibility check in upgrade(): skip if column exists (new SQL init)
- Add informative print messages for deployment clarity
- Enhanced docstrings explaining compatibility strategy
Deployment Scenarios:
1. New deployment with latest SQL script: Schema created with file_version, Alembic marked as applied
2. Old deployment upgrade: Alembic detects missing column and adds it
This ensures backward compatibility while supporting fresh installs with complete schema.
2026-02-05 21:17:17 +08:00
f5cb265667
feat(annotation): implement file version management for annotation feature
...
Add support for detecting new file versions and switching to them:
Backend Changes:
- Add file_version column to AnnotationResult model
- Create Alembic migration for database schema update
- Implement check_file_version() method to compare annotation and file versions
- Implement use_new_version() method to clear annotations and update version
- Update upsert_annotation() to record file version when saving
- Add new API endpoints: GET /version and POST /use-new-version
- Add FileVersionCheckResponse and UseNewVersionResponse schemas
Frontend Changes:
- Add checkFileVersionUsingGet and useNewVersionUsingPost API calls
- Add version warning banner showing current vs latest file version
- Add 'Use New Version' button with confirmation dialog
- Clear version info state when switching files to avoid stale warnings
Bug Fixes:
- Fix previousFileVersion returning updated value (save before update)
- Handle null file_version for historical data compatibility
- Fix segmented annotation clearing (preserve structure, clear results)
- Fix files without annotations incorrectly showing new version warnings
- Preserve total_segments when clearing segmented annotations
Files Modified:
- frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx
- frontend/src/pages/DataAnnotation/annotation.api.ts
- runtime/datamate-python/app/db/models/annotation_management.py
- runtime/datamate-python/app/module/annotation/interface/editor.py
- runtime/datamate-python/app/module/annotation/schema/editor.py
- runtime/datamate-python/app/module/annotation/service/editor.py
New Files:
- runtime/datamate-python/alembic.ini
- runtime/datamate-python/alembic/env.py
- runtime/datamate-python/alembic/script.py.mako
- runtime/datamate-python/alembic/versions/20250205_0001_add_file_version.py
2026-02-05 20:12:07 +08:00
4143bc75f9
fix: 修复codex review发现的问题
...
问题1 - 行锁持有时间过长:
- 采用双重检查锁定模式,将HTTP调用移到锁范围外
- 新增 _update_knowledge_set_config 方法专门处理加锁更新
问题2 - 清理不完整:
- _list_knowledge_sets 方法添加分页参数
- 新增 _list_all_knowledge_sets 方法遍历所有知识集
- 清理方法使用新的全量查询方法
问题3 - 文件删除逻辑可能误删:
- deleteKnowledgeItemFile 方法增加严格的 sourceType 检查
- 只有当 sourceType 为 FILE_UPLOAD 或 MANUAL 时才删除文件
- 避免误删 DATASET_FILE 类型的数据集文件
涉及文件:
- knowledge_sync.py
- KnowledgeItemApplicationService.java
2026-02-05 04:07:40 +08:00
99bd83d312
fix: 修复知识库同步的并发控制、数据清理、文件事务和COCO导出问题
...
问题1 - 并发控制缺失:
- 在 _ensure_knowledge_set 方法中添加数据库行锁(with_for_update)
- 修改 _update_project_config 方法,使用行锁保护配置更新
问题3 - 数据清理机制缺失:
- 添加 _cleanup_knowledge_set_for_project 方法,项目删除时清理知识集
- 添加 _cleanup_knowledge_item_for_file 方法,文件删除时清理知识条目
- 在 delete_mapping 接口中调用清理方法
问题4 - 文件操作事务问题:
- 修改 uploadKnowledgeItems,添加事务失败后的文件清理逻辑
- 修改 deleteKnowledgeItem,删除记录前先删除关联文件
- 新增 deleteKnowledgeItemFile 辅助方法
问题5 - COCO导出格式问题:
- 添加 _get_image_dimensions 方法读取图片实际宽高
- 将百分比坐标转换为像素坐标
- 在 AnnotationExportItem 中添加 file_path 字段
涉及文件:
- knowledge_sync.py
- project.py
- KnowledgeItemApplicationService.java
- export.py
- export schema.py
2026-02-05 03:55:01 +08:00
c03bdf1a24
refactor(data-management): 移除未使用的数据库操作方法并优化查询条件
...
- 从 DatasetFileMapper 中移除未使用的 update 和 deleteById 方法
- 从 DatasetMapper 中移除未使用的 deleteById 方法
- 在 Python 项目中添加 or_ 操作符导入用于复杂查询
- 为数据集文件查询添加状态过滤条件,排除已归档的文件记录
2026-02-05 03:21:06 +08:00
d0972cbc9d
feat(data-management): 实现数据集文件版本管理和内部路径保护
...
- 将数据集文件查询方法替换为只查询可见文件的版本
- 引入文件状态管理(ACTIVE/ARCHIVED)和内部目录结构
- 实现文件重复处理策略,支持版本控制模式而非覆盖
- 添加内部数据目录保护,防止访问.datamate等系统目录
- 重构文件上传流程,引入暂存目录和事务后清理机制
- 实现文件版本归档功能,保留历史版本到专用存储位置
- 优化文件路径规范化和安全验证逻辑
- 修复文件删除逻辑,确保归档文件不会被错误移除
- 更新数据集压缩下载功能以排除内部系统文件
2026-02-04 23:53:35 +08:00
fa9e9d9f68
refactor(annotation): 简化文本标注编辑器的段落管理功能
...
- 移除段落统计相关的数据结构和缓存逻辑
- 删除段落切换确认对话框和自动保存选项
- 简化段落加载和状态管理流程
- 将段落列表视图替换为简单的进度显示
- 更新API接口以支持单段内容获取
- 重构后端服务实现单段内容查询功能
2026-02-04 18:08:14 +08:00
707e65b017
refactor(annotation): 优化编辑器服务中的分段处理逻辑
...
- 在处理分段注释时初始化 segments 列表变量
- 确保分段信息列表在函数开始时被正确初始化
- 提高代码可读性和变量声明的一致性
2026-02-04 17:35:14 +08:00
cda22a720c
feat(annotation): 优化文本标注分段功能实现
...
- 新增 getEditorTaskSegmentsUsingGet 接口用于获取任务分段信息
- 移除 SegmentInfo 中的 text、start、end 字段,精简数据结构
- 添加 EditorTaskSegmentsResponse 类型定义用于分段摘要响应
- 实现服务端 get_task_segments 方法,支持分段信息查询
- 重构前端组件缓存机制,使用 segmentSummaryFileRef 管理分段状态
- 优化分段构建逻辑,提取 _build_segment_contexts 公共方法
- 调整后端 _build_text_task 方法中的分段处理流程
- 更新 API 类型定义,统一 RequestParams 和 RequestPayload 类型
2026-02-04 16:59:04 +08:00
147beb1ec7
feat(annotation): 实现文本切片预生成功能
...
在创建标注任务时自动预生成文本切片结构,避免每次进入标注页面时的实时计算。
修改内容:
1. 在 AnnotationEditorService 中新增 precompute_segmentation_for_project 方法
- 为项目的所有文本文件预计算切片结构
- 使用 AnnotationTextSplitter 执行切片
- 将切片结构持久化到 AnnotationResult 表(状态为 IN_PROGRESS)
- 支持失败重试机制
- 返回统计信息
2. 修改 create_mapping 接口
- 在创建标注任务后,如果启用分段且为文本数据集,自动触发切片预生成
- 使用 try-except 捕获异常,确保切片失败不影响项目创建
特点:
- 使用现有的 AnnotationTextSplitter 类
- 切片数据结构与现有分段标注格式一致
- 向后兼容(未切片的任务仍然使用实时计算)
- 性能优化:避免进入标注页面时的重复计算
相关文件:
- runtime/datamate-python/app/module/annotation/service/editor.py
- runtime/datamate-python/app/module/annotation/interface/project.py
2026-02-03 12:59:29 +00:00
7092c3f955
feat(annotation): 调整文本编辑器大小限制配置
...
- 将editor_max_text_bytes默认值从2MB改为0,表示不限制
- 更新文本获取服务中的大小检查逻辑,只在max_bytes大于0时进行限制
- 修改错误提示信息中的字节限制显示
- 优化配置参数的条件判断流程
2026-02-02 17:53:09 +08:00
07a901043a
refactor(annotation): 移除文本内容获取相关功能
...
- 删除了 fetch_text_content_via_download_api 导入
- 移除了 TEXT 类型数据集的文本内容获取逻辑
- 删除了 _append_annotation_to_content 方法实现
- 简化了知识同步服务的内容处理流程
2026-02-02 15:39:06 +08:00
32e3fc97c6
feat(annotation): 增强知识库同步服务以支持项目隔离
...
- 在知识库查找时添加项目ID验证,确保知识库归属正确
- 修改日志消息以显示项目ID信息便于调试
- 重构知识库查找逻辑,从按名称查找改为按名称和项目ID组合查找
- 新增_metadata_matches_project方法验证元数据中的项目归属
- 新增_parse_metadata方法安全解析元数据JSON字符串
- 更新回退命名逻辑以确保项目级别的唯一性
- 在所有知识库操作中统一使用项目名称和项目ID进行验证
2026-02-02 15:28:33 +08:00
0bb9abb200
feat(annotation): 添加标注类型显示功能
...
- 在前端页面中新增标注类型列并使用Tag组件展示
- 添加AnnotationTypeMap常量用于标注类型的映射
- 修改接口定义支持labelingType字段的传递
- 更新后端项目创建和更新逻辑以存储标注类型
- 添加标注类型配置键常量统一管理
- 扩展数据传输对象支持标注类型属性
- 实现模板标注类型的继承逻辑
2026-02-01 19:08:11 +08:00
150af1a741
fix(annotation): 修复项目映射查询逻辑错误
...
- 移除旧的映射服务查询方式,改为直接查询 ORM 模型获取原始数据
- 更新配置字段读取逻辑以使用新的 ORM 对象
- 修复更新无变化时的响应数据返回问题
- 添加软删除过滤条件确保只返回未删除的项目记录
- 统一数据访问方式提高查询效率和代码一致性
2026-01-31 18:57:08 +08:00
e28f680abb
feat(annotation): 添加标注项目信息更新功能
...
- 引入 DatasetMappingUpdateRequest 请求模型支持 name、description、template_id 和 label_config 字段更新
- 在项目接口中添加 PUT /{project_id} 端点用于更新标注项目信息
- 实现更新逻辑包括映射记录查询、配置信息处理和数据库更新操作
- 集成标准响应格式返回更新结果
- 添加异常处理和日志记录确保操作可追溯性
2026-01-31 18:54:05 +08:00
4a3e466210
feat(annotation): 添加标注任务进行中数据显示功能
...
- 新增 AnnotationTaskListItem 和相关类型定义
- 在前端页面中添加标注中列显示进行中的标注数据量
- 更新数据获取逻辑以支持进行中标注数量统计
- 修改后端服务层添加 in_progress_count 字段映射
- 优化类型安全和代码结构设计
2026-01-31 17:14:23 +08:00
f6788756d3
fix(annotation): 修复分段标注数据结构兼容性问题
...
- 添加分段标注合并异常时的日志记录和警告
- 增加分段标注保存时的详细状态日志
- 修复分段数据结构类型检查逻辑,支持dict和list格式统一转换
- 避免SQLAlchemy变更检测失效的原地修改问题
- 添加旧版list结构向新dict结构的数据迁移兼容处理
2026-01-31 16:45:48 +08:00
5a5279869e
feat(annotation): 添加分段总数提示功能优化性能
...
- 在编辑器服务中添加 segment_total_hint 变量用于缓存分段总数计算结果
- 使用 with_for_update() 锁定查询以避免并发问题
- 将重复的分段总数计算逻辑替换为使用缓存的提示值
- 减少数据库查询次数提升标注任务处理效率
- 优化了分段索引存在时的总数获取流程
2026-01-31 16:28:39 +08:00
33cf65c9f8
feat(annotation): 添加分段标注统计和进度跟踪功能
...
- 新增 SegmentStats 类型定义用于分段统计
- 实现分段标注进度计算和缓存机制
- 添加标注任务状态判断逻辑支持分段模式
- 集成分段统计数据显示到任务列表界面
- 实现分段总数自动计算和验证功能
- 扩展标注状态枚举支持进行中标注状态
- 优化任务选择逻辑基于分段完成状态
- 添加分段统计数据预加载和同步机制
2026-01-31 15:42:04 +08:00
5318ee9641
fix(annotation): 修复导出服务中的重复数据处理逻辑
...
- 移除了重复的else分支代码块
- 修复了分段索引键不存在时的数据处理流程
- 简化了列表类型分段的处理逻辑
- 消除了重复的数据添加操作
2026-01-31 14:39:21 +08:00
c5c8e6c69e
feat(annotation): 添加分段标注功能支持
...
- 定义分段标注相关常量(segmented、segments、result等键名)
- 实现分段标注提取方法_extract_segment_annotations处理字典和列表格式
- 添加分段标注判断方法_is_segmented_annotation检测标注状态
- 修改_has_annotation_result方法使用新的分段标注处理逻辑
- 在任务创建过程中集成分段标注数据处理
- 更新导出服务中的分段标注结果扁平化处理
- 实现标注归一化方法支持分段标注格式转换
- 调整JSON和CSV导出格式适配分段标注结构
2026-01-31 14:36:16 +08:00
2bc48fd465
refactor(annotation): 移除编辑器标签配置装饰逻辑
...
- 删除了 _decorate_label_config_for_editor 方法调用
- 简化了标签配置获取流程
- 移除了不必要的条件检查逻辑
2026-01-31 14:14:32 +08:00
f2403f00ce
feat(annotation): 添加不适用标注状态支持
...
- 在 AnnotationResultStatus 枚举中新增 NOT_APPLICABLE 状态
- 将无标注/不适用合并为两个独立的状态选项
- 更新前端标签显示逻辑以支持新的状态类型
- 修改确认对话框允许选择不适用状态
- 在后端数据库模型中添加 NOT_APPLICABLE 状态值
- 更新 API schema 描述以反映新的状态选项
- 调整标注状态判断和保存逻辑以处理三种状态
- 更新数据库表结构注释包含新状态类型
2026-01-31 13:28:08 +08:00
f4fc574687
feat(annotation): 添加标注状态管理功能
...
- 引入 AnnotationResultStatus 枚举类型区分已标注和无标注状态
- 在前端组件中实现空标注检测和确认对话框逻辑
- 添加数据库表字段 annotation_status 存储标注状态
- 扩展后端服务验证和处理标注状态逻辑
- 更新 API 接口支持标注状态参数传递
- 改进任务列表显示逻辑以反映不同标注状态
- 实现分段模式下的标注结果检查机制
2026-01-31 13:23:38 +08:00
b5d7c66240
feat(data-management): 扩展源文档排除功能支持Excel文件类型
...
- 在后端服务中扩展源文档类型检查,新增对XLS和XLSX文件的支持
- 修改DatasetFileApplicationService中的过滤逻辑,统一处理所有源文档类型
- 新增isSourceDocument和isDerivedFile辅助方法进行文件类型判断
- 更新前端DatasetFileTransfer组件中的注释说明
- 在Python运行时依赖中添加openpyxl和xlrd库以支持Excel文件处理
- 修改标注项目接口中源文档类型的集合定义
- 更新文件操作钩子中的派生文件排除逻辑
2026-01-31 11:30:55 +08:00
498f23a0c4
feat(data-management): 扩展文本数据集支持Excel文件类型
...
- 在DatasetFileApplicationService中添加XLS和XLSX文件类型到文档文本文件类型集合
- 更新DatasetTypeController中的TEXT数据集类型支持xls和xlsx扩展名
- 在pdf_extract.py中添加XLS和XLSX文件类型的常量定义和解析器配置
- 实现Excel文件转CSV的功能,支持单个工作表和多工作表的解析
- 添加对Excel文件的依赖检查和错误处理机制
- 修改目标文件路径构建逻辑以支持不同文件类型的派生扩展名
- 更新文本文件记录创建逻辑以使用派生文件类型而不是固定文本类型
2026-01-31 11:11:24 +08:00
9a205919d7
refactor(data-import): 优化数据源文件扫描和复制逻辑
...
- 修改数据源文件扫描方法,直接在主流程中获取任务详情和路径
- 移除独立的getFilePaths方法,将路径扫描逻辑整合到scanFilePaths方法中
- 新增copyFilesToDatasetDirWithSourceRoot方法支持保留相对路径的文件复制
- 更新数据集文件应用服务中的文件复制逻辑,支持相对路径处理
- 修改Python后端项目接口中的文件查询逻辑,移除注释掉的编辑器服务引用
- 调整文件过滤逻辑,基于元数据中的派生源ID进行文件筛选
- 移除编辑器服务中已废弃的源文档过滤条件
2026-01-30 18:58:34 +08:00
8b2a19f09a
feat(annotation): 添加标注项目文件快照功能
...
- 新增 LabelingProjectFile 模型用于存储标注项目的文件快照
- 在创建标注项目时记录关联的文件快照数据
- 更新查询逻辑以基于项目快照过滤文件列表
- 优化导出统计功能使用快照数据进行计算
- 添加数据库表结构支持项目文件快照关系
2026-01-30 18:10:13 +08:00
3c3ca130b3
feat(annotation): 添加文本文件内容读取和多类型标签导出功能
...
- 新增异步函数 _read_file_content 用于安全读取文本文件内容
- 实现在导出时包含文本文件的实际内容数据
- 扩展 CSV 导出格式支持多种标注类型标签提取
- 添加对矩形标签、多边形标签、画笔标签等多种标注类型的支持
- 更新 COCO 格式导出文档说明bbox坐标转换注意事项
2026-01-30 17:35:22 +08:00
0b69845a29
feat(annotation): 添加文本项目源文档过滤功能
...
- 在 EditorProjectInfo 中增加 datasetType 字段
- 移除前端硬编码的源文档扩展名列表
- 添加 isTextProject 判断逻辑
- 实现 prefetch 和 loadTasks 中的源文档排除参数
- 在后端接口中添加 excludeSourceDocuments 参数
- 实现源文档类型的数据库查询过滤逻辑
- 优化任务列表加载性能,避免不必要的源文档加载
2026-01-29 16:29:40 +08:00