Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix chunk creation

Maiko Bossuyt2e0b44ae05fc
diff --git a/scripts/file_operations.py b/scripts/file_operations.py
index e664fcc91d..f2a2b072d4 100644
--- a/scripts/file_operations.py
+++ b/scripts/file_operations.py
@@ -38,11 +38,12 @@ def split_file(content, max_length=4000, overlap=0):
chunk = content[start:end]
yield chunk
start += max_length - overlap
- if start + max_length - overlap >= content_length:
- break
- if end + overlap > content_length:
+ if start + max_length > content_length:
start = content_length - max_length
-
+ end = content_length
+ chunk = content[start:end]
+ yield chunk
+ break
def read_file(filename):
"""Read a file and return the contents"""