Skip to content

Commit

Permalink
Update chat_to_files.py
Browse files Browse the repository at this point in the history
I ran into issues where i was moving the file around and renaming it but renamed it back before i launched gpt engineer and ran into it an error because the file was not in the file_dict. This will address that. I am also making a comment in this issue gpt-engineer-org#928
  • Loading branch information
miqueet authored Jan 3, 2024
1 parent cf209b5 commit cec6cb8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gpt_engineer/core/chat_to_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ def overwrite_code_with_edits(chat: str, files_dict: FilesDict):
The code object to apply edits to.
"""
edits = parse_edits(chat)
for edit in edits:
filename = edit.filename
if filename not in files_dict:
# Log a verbose error message and return gracefully rather than failing
logger.error(f"File '{filename}' not found in files_dict. Cannot apply edits from chat.")
return
edits = parse_edits(chat)
apply_edits(edits, files_dict)


Expand Down

0 comments on commit cec6cb8

Please sign in to comment.