添加任务ID跟踪功能到模板填充接口

- 在FillRequest中添加可选的task_id字段,用于任务历史跟踪
- 实现任务状态管理,包括创建、更新和错误处理
- 集成MongoDB任务记录功能,在处理过程中更新进度
- 添加任务进度更新逻辑,支持开始、处理中、成功和失败状态
- 修改模板填充服务以接收并传递task_id参数
This commit is contained in:
2026-04-10 01:27:26 +08:00
parent 858b594171
commit 0dbf74db9d
2 changed files with 49 additions and 3 deletions

View File

@@ -62,7 +62,8 @@ class TemplateFillService:
source_file_paths: Optional[List[str]] = None,
user_hint: Optional[str] = None,
template_id: Optional[str] = None,
template_file_type: Optional[str] = "xlsx"
template_file_type: Optional[str] = "xlsx",
task_id: Optional[str] = None
) -> Dict[str, Any]:
"""
填写表格模板
@@ -74,6 +75,7 @@ class TemplateFillService:
user_hint: 用户提示(如"请从合同文档中提取"
template_id: 模板文件路径(用于重新生成表头)
template_file_type: 模板文件类型
task_id: 可选的任务ID用于任务进度跟踪
Returns:
填写结果