mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-04 14:50:30 +08:00
Fix: accept empty value as 0 chunk (#14220)
### What problem does this PR solve? Fix: accept empty value as 0 chunk ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -656,16 +656,25 @@ async def run_dataflow(task: dict):
|
||||
return
|
||||
|
||||
embedding_token_consumption = chunks.get("embedding_token_consumption", 0)
|
||||
if chunks.get("chunks"):
|
||||
# The output key may exist with an empty payload; check presence, not truthiness.
|
||||
if "chunks" in chunks:
|
||||
chunks = copy.deepcopy(chunks["chunks"])
|
||||
elif chunks.get("json"):
|
||||
elif "json" in chunks:
|
||||
chunks = copy.deepcopy(chunks["json"])
|
||||
elif chunks.get("markdown"):
|
||||
chunks = [{"text": [chunks["markdown"]]}]
|
||||
elif chunks.get("text"):
|
||||
chunks = [{"text": [chunks["text"]]}]
|
||||
elif chunks.get("html"):
|
||||
chunks = [{"text": [chunks["html"]]}]
|
||||
elif "markdown" in chunks:
|
||||
chunks = [{"text": [chunks["markdown"]]}] if chunks["markdown"] else []
|
||||
elif "text" in chunks:
|
||||
chunks = [{"text": [chunks["text"]]}] if chunks["text"] else []
|
||||
elif "html" in chunks:
|
||||
chunks = [{"text": [chunks["html"]]}] if chunks["html"] else []
|
||||
else:
|
||||
chunks = []
|
||||
|
||||
# An empty normalized payload means "nothing parsed", so stop before embedding/indexing.
|
||||
if not chunks:
|
||||
PipelineOperationLogService.create(document_id=doc_id, pipeline_id=dataflow_id,
|
||||
task_type=PipelineTaskType.PARSE, dsl=str(pipeline))
|
||||
return
|
||||
|
||||
keys = [k for o in chunks for k in list(o.keys())]
|
||||
if not any([re.match(r"q_[0-9]+_vec", k) for k in keys]):
|
||||
|
||||
Reference in New Issue
Block a user