Fix split_file when overlap = 0, add test (#3599)

Co-authored-by: Nicholas Tindle <nick@ntindle.com>
This commit is contained in:
k-boikov
2023-05-21 04:20:03 +03:00
committed by GitHub
parent 57ea7b5216
commit bcc32cc441
2 changed files with 35 additions and 6 deletions

View File

@@ -131,7 +131,7 @@ def split_file(
while start < content_length:
end = start + max_length
if end + overlap < content_length:
chunk = content[start : end + overlap - 1]
chunk = content[start : end + max(overlap - 1, 0)]
else:
chunk = content[start:content_length]