Allow zero chunk overlap in recursive chunker #4258
Merged
+10
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes: #3207
Motivation
chunk_overlap=0was treated as falsy and fell back to default overlap, preventing users from setting zero overlap.orto select fallback values.Description
chunk_size = chunk_size or self.chunk_sizeandoverlap = overlap or self.chunk_overlapwith explicitif ... is Nonechecks inastrbot/core/knowledge_base/chunking/recursive.py.chunk_overlap=0is accepted as a valid value while onlyNonetriggers the default.astrbot/core/knowledge_base/chunking/recursive.pyand the change is a small defensive check.Testing
Codex Task
Summary by Sourcery
Bug Fixes:
chunk_size和chunk_overlap的处理方式,使得显式传入 0 时不再触发使用默认值。Original summary in English
Summary by Sourcery
Bug Fixes: