Skip to content

Commit

Permalink
fix: improved patch warning message on large patches
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Oct 2, 2024
1 parent 86bf9b5 commit 5e635b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gptme/tools/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ def execute_patch(
warnings = []
if full_file_tokens < patch_tokens:
warnings.append(
"Note: The patch was larger than the file. Consider using the save tool instead."
"Note: The patch was larger than the file. In the future, try writing smaller patches or use the save tool instead."
)
warnings_str = ("\n" + "\n".join(warnings)) if warnings else ""
warnings_str = ("\n".join(warnings) + "\n") if warnings else ""

yield Message("system", f"Patch applied to {fn}{warnings_str}")
yield Message("system", f"{warnings_str}Patch successfully applied to {fn}")
except (ValueError, FileNotFoundError) as e:
yield Message("system", f"Patch failed: {e.args[0]}")

Expand Down

0 comments on commit 5e635b6

Please sign in to comment.