mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 23:41:12 +08:00
Fix: reject empty/space-only content in update_chunk API (#14082)
Closes #6541 ### What problem does this PR solve? Add content validation to `update_chunk` (SDK and non-SDK) to reject empty or whitespace-only content before it reaches the embedding model. **Before:** Calling `update_chunk` with space-only content (like `" "`, `""`, `"\n"`) bypassed validation and was sent directly to the embedding model, which returned an error. This was the same bug previously fixed for `add_chunk` in #6390, but `update_chunk` was missed. **After:** Empty/whitespace-only content is caught by validation and returns an error: `` `content` is required `` ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -71,3 +71,7 @@ def clean_markdown_block(text):
|
||||
|
||||
# Return text with surrounding whitespace removed
|
||||
return text.strip()
|
||||
|
||||
|
||||
def is_content_empty(content: str) -> bool:
|
||||
return content is None or not str(content).strip()
|
||||
|
||||
Reference in New Issue
Block a user