[fix]Fix the display issue of semantic chunking for streaming output
This commit is contained in:
@@ -200,6 +200,7 @@ async def run_pilot_extraction(
|
|||||||
# 进度回调:输出每个分块的结果
|
# 进度回调:输出每个分块的结果
|
||||||
if progress_callback:
|
if progress_callback:
|
||||||
for dlg in chunked_dialogs:
|
for dlg in chunked_dialogs:
|
||||||
|
if hasattr(dlg, 'chunks') and dlg.chunks:
|
||||||
for i, chunk in enumerate(dlg.chunks):
|
for i, chunk in enumerate(dlg.chunks):
|
||||||
chunk_result = {
|
chunk_result = {
|
||||||
"chunk_index": i + 1,
|
"chunk_index": i + 1,
|
||||||
@@ -208,10 +209,10 @@ async def run_pilot_extraction(
|
|||||||
"dialog_id": dlg.id,
|
"dialog_id": dlg.id,
|
||||||
"chunker_strategy": memory_config.chunker_strategy,
|
"chunker_strategy": memory_config.chunker_strategy,
|
||||||
}
|
}
|
||||||
await progress_callback("text_preprocessing_chunking", f"分块 {i + 1} 处理完成", chunk_result)
|
await progress_callback("text_preprocessing_result", f"分块 {i + 1} 处理完成", chunk_result)
|
||||||
|
|
||||||
preprocessing_summary = {
|
preprocessing_summary = {
|
||||||
"total_chunks": sum(len(dlg.chunks) for dlg in chunked_dialogs),
|
"total_chunks": sum(len(dlg.chunks) for dlg in chunked_dialogs if hasattr(dlg, 'chunks') and dlg.chunks),
|
||||||
"total_dialogs": len(chunked_dialogs),
|
"total_dialogs": len(chunked_dialogs),
|
||||||
"chunker_strategy": memory_config.chunker_strategy,
|
"chunker_strategy": memory_config.chunker_strategy,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user