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.
split_file() rework
Maiko Bossuyt36d455c20e52
diff --git a/scripts/file_operations.py b/scripts/file_operations.pyindex db4702c526..c12774b9d9 100644--- a/scripts/file_operations.py+++ b/scripts/file_operations.py@@ -35,15 +35,12 @@ def split_file(content, max_length=4000, overlap=0):while start < content_length:end = start + max_length- chunk = content[start:end]+ if end + overlap < content_length:+ chunk = content[start:end+overlap]+ else:+ chunk = content[start:content_length]yield chunkstart += max_length - overlap- if start + max_length > content_length:- start = content_length - max_length- end = content_length- chunk = content[start:end]- yield chunk- breakdef read_file(filename):"""Read a file and return the contents"""