Upgrades Document Layout Analysis model. (#4054)

### What problem does this PR solve?

#4052

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
Kevin Hu
2024-12-17 11:27:19 +08:00
committed by GitHub
parent b5e4a5563c
commit ce1e855328
5 changed files with 120 additions and 3 deletions

View File

@ -247,8 +247,8 @@ def queue_tasks(doc: dict, bucket: str, name: str):
task["progress"] = 0.0
prev_tasks = TaskService.get_tasks(doc["id"])
ck_num = 0
if prev_tasks:
ck_num = 0
for task in tsks:
ck_num += reuse_prev_task_chunks(task, prev_tasks, chunking_config)
TaskService.filter_delete([Task.doc_id == doc["id"]])
@ -258,7 +258,7 @@ def queue_tasks(doc: dict, bucket: str, name: str):
chunk_ids.extend(task["chunk_ids"].split())
if chunk_ids:
settings.docStoreConn.delete({"id": chunk_ids}, search.index_name(chunking_config["tenant_id"]), chunking_config["kb_id"])
DocumentService.update_by_id(doc["id"], {"chunk_num": ck_num})
DocumentService.update_by_id(doc["id"], {"chunk_num": ck_num})
bulk_insert_into_db(Task, tsks, True)
DocumentService.begin2parse(doc["id"])