diff --git a/aider/coders/wholefile_coder.py b/aider/coders/wholefile_coder.py index 9e74097e8..632f49fe8 100644 --- a/aider/coders/wholefile_coder.py +++ b/aider/coders/wholefile_coder.py @@ -44,7 +44,7 @@ class WholeFileCoder(Coder): full_path = (Path(self.root) / fname).absolute() if mode == "diff" and full_path.exists(): - orig_lines = full_path.readlines() + orig_lines = full_path.read_text().splitlines() show_diff = diffs.diff_partial_update( orig_lines, @@ -93,7 +93,7 @@ class WholeFileCoder(Coder): full_path = (Path(self.root) / fname).absolute() if mode == "diff" and full_path.exists(): - orig_lines = full_path.readlines() + orig_lines = full_path.read_text.splitlines() show_diff = diffs.diff_partial_update( orig_lines, diff --git a/aider/coders/wholefile_prompts.py b/aider/coders/wholefile_prompts.py index 2882d4dcb..eaf1f3e9b 100644 --- a/aider/coders/wholefile_prompts.py +++ b/aider/coders/wholefile_prompts.py @@ -17,17 +17,19 @@ Once you understand the request you MUST: system_reminder = """ To return code you MUST use this *file listing* format: -exact/path/to/filename.js +path/to/filename.js ```javascript -// file content goes in the +// entire file content goes in the // triple backticked fenced block ``` -Every *file listing* must start with the full path! -Every *file listing* must be fenced w/triple backticks with the correct code language. +Every *file listing* MUST use this format: +- First line: the filename with any required path! +- Second line: opening triple backtick fence with the correct code language. +- Final line: closing triple backtick fence. To suggest changes to a file you MUST return a *file listing* that contains the entire content of the file. -Create a new file you MUST return a *file listing* which includes an appropriate path/filename. +Create a new file you MUST return a *file listing* which includes an appropriate filename, including any required path. """ files_content_prefix = "Here is the current content of the files:\n" diff --git a/scripts/benchmark.py b/scripts/benchmark.py index 19d7c7c08..e5ef0fcca 100644 --- a/scripts/benchmark.py +++ b/scripts/benchmark.py @@ -116,6 +116,11 @@ def main(): projected_cost = avg_cost * total_tests dump(projected_cost) + print( + f"Cost: ${avg_cost:.4f} average, ${total_cost:.2f} total," + f" ${projected_cost:.2f} projected" + ) + duration += results["duration"] avg_duration = duration / completed_tests dump(avg_duration)