Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix: guard whitespace-only chunks before embedding (#13938)

shawnxiao105-afk8b6dd6a5c2b3
diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py
index b31057bc08..548d88ab1b 100644
--- a/rag/svr/task_executor.py
+++ b/rag/svr/task_executor.py
@@ -640,7 +640,8 @@ async def embedding(docs, mdl, parser_config=None, callback=None):
if not c:
c = d["content_with_weight"]
c = re.sub(r"</?(table|td|caption|tr|th)( [^<>]{0,12})?>", " ", c)
- if not c:
+ if not c.strip():
+ logging.debug("embedding(): normalized whitespace-only chunk to placeholder 'None' (len=%d)", len(c))
c = "None"
cnts.append(c)