AutoGPT: Fix file ops (vol. 2)

This commit is contained in:
Reinier van der Leer
2023-10-17 14:36:33 -07:00
parent b75b41250b
commit 27e362c6ea

View File

@@ -242,11 +242,11 @@ def append_to_file(
"""
directory = os.path.dirname(filename)
os.makedirs(directory, exist_ok=True)
with agent.workspace.open_file(filename, "a") as f:
with open(filename, "a") as f:
f.write(text)
if should_log:
with agent.workspace.open_file(filename, "r") as f:
with open(filename, "r") as f:
checksum = text_checksum(f.read())
log_operation("append", filename, agent, checksum=checksum)