0e0782a452
feat(kg-extraction): 实现 Python 抽取器 FastAPI 接口
...
实现功能:
- 创建 kg_extraction/interface.py(FastAPI 路由)
- 实现 POST /api/kg/extract(单条文本抽取)
- 实现 POST /api/kg/extract/batch(批量抽取,最多 50 条)
- 集成到 FastAPI 主路由(/api/kg/ 前缀)
技术实现:
- 配置管理:从环境变量读取 LLM 配置(API Key、Base URL、Model、Temperature)
- 安全性:
- API Key 使用 SecretStr 保护
- 错误信息脱敏(使用 trace_id,不暴露原始异常)
- 请求文本不写入日志(使用 SHA-256 hash)
- 强制要求 X-User-Id 头(鉴权边界)
- 超时控制:
- kg_llm_timeout_seconds(60秒)
- kg_llm_max_retries(2次)
- 输入校验:
- graph_id 和 source_id 使用 UUID pattern
- source_type 使用 Enum(4个值)
- allowed_nodes/relationships 元素使用正则约束(ASCII,1-50字符)
- 审计日志:记录 caller、trace_id、text_hash
代码审查:
- 经过 3 轮 Codex 审查和 2 轮 Claude 修复
- 所有问题已解决(5个 P1/P2 + 3个 P3)
- 语法检查通过
API 端点:
- POST /api/kg/extract:单条文本抽取
- POST /api/kg/extract/batch:批量抽取(最多 50 条)
配置环境变量:
- KG_LLM_API_KEY:LLM API 密钥
- KG_LLM_BASE_URL:自定义端点(可选)
- KG_LLM_MODEL:模型名称(默认 gpt-4o-mini)
- KG_LLM_TEMPERATURE:生成温度(默认 0.0)
- KG_LLM_TIMEOUT_SECONDS:超时时间(默认 60)
- KG_LLM_MAX_RETRIES:重试次数(默认 2)
2026-02-17 22:01:06 +08:00
ab957ab53d
feat(dataset): 添加PDF文本提取功能支持
...
- 新增dataset模块路由配置
- 添加PdfTextExtractRequest和PdfTextExtractResponse数据传输对象
- 实现PDF文本提取接口,支持从PDF文件中提取文本内容
- 集成数据库会话管理和异步处理能力
2026-01-29 11:45:23 +08:00
hefanli
63f4e3e447
refactor: modify data collection to python implementation ( #214 )
...
* feature: LabelStudio jumps without login
* refactor: modify data collection to python implementation
* refactor: modify data collection to python implementation
* refactor: modify data collection to python implementation
* refactor: modify data collection to python implementation
* refactor: modify data collection to python implementation
* refactor: modify data collection to python implementation
* fix: remove terrabase dependency
* feature: add the collection task executions page and the collection template page
* fix: fix the collection task creation
* fix: fix the collection task creation
2025-12-30 18:48:43 +08:00
hefanli
1d19cd3a62
feature: add data-evaluation
...
* feature: add evaluation task management function
* feature: add evaluation task detail page
* fix: delete duplicate definition for table t_model_config
* refactor: rename package synthesis to ratio
* refactor: add eval file table and refactor related code
* fix: calling large models in parallel during evaluation
2025-12-04 09:23:54 +08:00
Dallas98
8b164cb012
feat: Implement data synthesis task management with database models and API endpoints ( #122 )
2025-12-02 15:23:58 +08:00
hefanli
08bd4eca5c
feature:增加数据配比功能 ( #52 )
...
* refactor: 修改调整数据归集实现,删除无用代码,优化代码结构
* feature: 每天凌晨00:00扫描所有数据集,检查数据集是否超过了预设的保留天数,超出保留天数的数据集调用删除接口进行删除
* fix: 修改删除数据集文件的逻辑,上传到数据集中的文件会同时删除数据库中的记录和文件系统中的文件,归集过来的文件仅删除数据库中的记录
* fix: 增加参数校验和接口定义,删除不使用的接口
* fix: 数据集统计数据默认为0
* feature: 数据集状态增加流转,创建时为草稿状态,上传文件或者归集文件后修改为活动状态
* refactor: 修改分页查询归集任务的代码
* fix: 更新后重新执行;归集任务执行增加事务控制
* feature: 创建归集任务时能够同步创建数据集,更新归集任务时能更新到指定数据集
* fix: 创建归集任务不需要创建数据集时不应该报错
* fix: 修复删除文件时数据集的统计数据不变动
* feature: 查询数据集详情时能够获取到文件标签分布
* fix: tags为空时不进行分析
* fix: 状态修改为ACTIVE
* fix: 修改解析tag的方法
* feature: 实现创建、分页查询、删除配比任务
* feature: 实现创建、分页查询、删除配比任务的前端交互
* fix: 修复进度计算异常导致的页面报错
2025-11-03 10:17:39 +08:00
Jason Wang
e0884ab048
Develop py update schema ( #37 )
...
* feature: implement endpoints with multi-level response models
* refactor: move `/health` and `/config` endpoints to system module, remove example from base schemas
* refactor: remove unused get_standard_response_model()
2025-10-30 16:24:37 +08:00
Jason Wang
2f7341dc1f
refactor: Reorganize datamate-python ( #34 )
...
refactor: Reorganize datamate-python (previously label-studio-adapter) into a DDD style structure.
2025-10-30 01:32:59 +08:00