mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-08 04:22:20 +08:00
@@ -590,6 +590,10 @@ class TaskHandler:
|
||||
logging.info(progress_message)
|
||||
ctx.progress_cb(msg=progress_message)
|
||||
|
||||
toc_thread = None
|
||||
if ctx.parser_id.lower() == "naive" and ctx.parser_config.get("toc_extraction", False):
|
||||
toc_thread = asyncio.create_task(asyncio.to_thread(self._build_toc, ctx, chunks, ctx.progress_cb))
|
||||
|
||||
# Insert chunks
|
||||
chunk_count = len(set([chunk["id"] for chunk in chunks]))
|
||||
start_ts = timer()
|
||||
@@ -615,6 +619,11 @@ class TaskHandler:
|
||||
|
||||
ctx.progress_cb(msg="Indexing done ({:.2f}s).".format(timer() - start_ts))
|
||||
|
||||
toc_chunk = await self._process_toc_thread(toc_thread)
|
||||
if toc_chunk:
|
||||
ctx.recording_context.record("toc_chunk", [toc_chunk])
|
||||
await post_processor.insert_toc_chunk(toc_chunk, chunk_service)
|
||||
|
||||
if ctx.has_canceled_func(task_id):
|
||||
abort_doc_chunking_counter(task_doc_id)
|
||||
ctx.progress_cb(-1, msg="Task has been canceled.")
|
||||
|
||||
Reference in New Issue
Block a user