Commit graph

1387 commits

Author SHA1 Message Date
Paul Gauthier
1370da14fb track and report errors/asks during benchmarking 2023-06-26 10:33:16 -07:00
Paul Gauthier
cbfda391bb version bump to 0.7.2 2023-06-26 10:24:14 -07:00
Paul Gauthier
079682b29e Omit the "No changes are needed" redaction from commit messages with wholefile coders 2023-06-26 10:21:27 -07:00
Paul Gauthier
33cc72a0df ssh 2023-06-25 21:40:08 -07:00
Paul Gauthier
819b8b2672 tolerate missing final newline 2023-06-25 21:27:18 -07:00
Paul Gauthier
58690da8b4 fences are obfuscated so aider can modify itself 2023-06-25 20:55:10 -07:00
Paul Gauthier
0520981135 Attempt to quote diffs safely 2023-06-25 20:42:47 -07:00
Paul Gauthier
e5ad9d501f aider: Added extra backticks to the start and end of the show variable to ensure proper formatting.
# Context:
USER: do the todo
ASSISTANT: To complete the TODO task in the `diff_partial_update` function, I will find the longest string of backticks (`) that start a line in the `diff` variable. I will then add one more backtick to the start and end of the `show` variable to ensure proper formatting.

Here are the changes:

```python
aider/diffs.py
<<<<<<< ORIGINAL
    for line in diff:
        pass

    diff = "".join(diff)
    if not diff.endswith("\n"):
        diff += "\n"

    show = "```diff\n"
=======
    max_backticks = max(len(line) - len(line.lstrip("`")) for line in diff.splitlines())
    extra_backticks = "`" * (max_backticks + 1)

    diff = "".join(diff)
    if not diff.endswith("\n"):
        diff += "\n"

    show = f"{extra_backticks}diff\n"
>>>>>>> UPDATED
```

```python
aider/diffs.py
<<<<<<< ORIGINAL
    show += diff + "```\n\n"
=======
    show += diff + f"{extra_backticks}\n\n"
>>>>>>> UPDATED
```

These changes will find the longest string of backticks at the start of a line in the `diff` variable and add one more backtick to the start and end of the `show` variable.
2023-06-25 20:38:46 -07:00
Paul Gauthier
ef88cc6d55 refactor choose_fence 2023-06-25 20:34:32 -07:00
Paul Gauthier
96fda2aa9f abandon n-backticks, try some html fences 2023-06-25 20:23:36 -07:00
Paul Gauthier
9151cf03a1 quote with num_ticks 2023-06-25 19:58:17 -07:00
Paul Gauthier
a6d80e815e wip 2023-06-25 19:54:15 -07:00
Paul Gauthier
f00a1e827a Merge branch 'main' into triple-backticks 2023-06-25 19:45:03 -07:00
Paul Gauthier
52343b5340 More generic handling of GPT mangling of filenames 2023-06-25 19:40:12 -07:00
Paul Gauthier
2b8717bdb6 Merge branch 'main' into triple-backticks 2023-06-25 19:34:20 -07:00
Paul Gauthier
e8df4a55b9 version bump to 0.7.1 2023-06-25 17:55:18 -07:00
Paul Gauthier
3393f560fb make sure diffs display with newlines 2023-06-25 17:33:33 -07:00
Paul Gauthier
f625d52bec added self.fence_ticks 2023-06-25 17:03:20 -07:00
Paul Gauthier
59d99835b1 use a word for 3,4,5 backticks 2023-06-25 17:00:59 -07:00
Paul Gauthier
060cbeafff Added back "entire content" prompt" 2023-06-25 15:54:56 -07:00
Paul Gauthier
f005404ec0 Roughed in updated sys msg for whole format 2023-06-25 15:27:06 -07:00
Paul Gauthier
fad464a987 version bump to 0.7.0 2023-06-25 08:34:47 -07:00
Paul Gauthier
fe1d7aa887 path/to not /path/to 2023-06-24 20:10:17 -07:00
Paul Gauthier
b1cdb9d488 handle /path/to 2023-06-24 20:05:35 -07:00
Paul Gauthier
fe3f1c194d Added APIError 2023-06-24 20:04:49 -07:00
Paul Gauthier
8dcf819cb5 added ServiceUnavailableError for retries 2023-06-24 19:54:18 -07:00
Paul Gauthier
1acc5e04d0 fix 2023-06-24 16:34:10 -07:00
Paul Gauthier
a1f4ae6a07 Stronger prompt 2023-06-24 15:49:26 -07:00
Paul Gauthier
ac560c2877 Handle missing filenames by scanning for mentions in the text 2023-06-24 15:32:35 -07:00
Paul Gauthier
f2a03e917d Handle missing filename when only 1 in session 2023-06-24 15:13:39 -07:00
Paul Gauthier
d8294cab44 simpler 2023-06-24 14:57:40 -07:00
Paul Gauthier
1754e574fd cleanup 2023-06-24 14:53:19 -07:00
Paul Gauthier
82e19fcf1d save the file even if tick fence wasn't closed properly 2023-06-24 14:47:29 -07:00
Paul Gauthier
eaf02da46b stronger wholefile prompt about file listings; adopt allowed_to_edit in wholefile; tests 2023-06-24 14:45:43 -07:00
Paul Gauthier
b4a92e312a aider: Added a test function to test the WholeFileCoder's update_files method.
# Context:
USER: make a test for `WholeFileCoder`.updated_files
ASSISTANT: To create a test for the `WholeFileCoder`'s `update_files` method, we will add a new test function in the `tests/test_wholefile.py` file. Here's the test function:

```python
tests/test_wholefile.py
<<<<<<< ORIGINAL

=======
import os
from pathlib import Path
import tempfile
import unittest

from aider.coders.wholefile_coder import WholeFileCoder
from aider.io import InputOutput

class TestWholeFileCoder(unittest.TestCase):
    def test_update_files(self):
        with tempfile.TemporaryDirectory() as temp_dir:
            # Create a sample file in the temporary directory
            sample_file = os.path.join(temp_dir, "sample.txt")
            with open(sample_file, "w") as f:
                f.write("Original content\n")

            # Initialize WholeFileCoder with the temporary directory
            io = InputOutput()
            coder = WholeFileCoder(root=temp_dir, io=io)

            # Set the partial response content with the updated content
            coder.partial_response_content = f"{sample_file}\n```\nUpdated content\n```"

            # Call update_files method
            edited_files = coder.update_files()

            # Check if the sample file was updated
            self.assertIn("sample.txt", edited_files)

            # Check if the content of the sample file was updated
            with open(sample_file, "r") as f:
                updated_content = f.read()
            self.assertEqual(updated_content, "Updated content\n")

if __name__ == "__main__":
    unittest.main()
>>>>>>> UPDATED
```

This test function creates a temporary directory with a sample file, initializes a `WholeFileCoder` instance with the temporary directory, sets the partial response content with the updated content, calls the `update_files` method, and checks if the sample file was updated correctly.
2023-06-24 14:33:20 -07:00
Paul Gauthier
a521d4a3ce Renamed --cmd to --msg 2023-06-24 13:50:45 -07:00
Paul Gauthier
39c1aeac9e Renamed --cmd to --msg 2023-06-24 13:49:27 -07:00
Paul Gauthier
146efe3278 Allow yes to be False 2023-06-24 13:38:54 -07:00
Paul Gauthier
64dcfefbec avoid div by zero 2023-06-24 10:29:36 -07:00
Paul Gauthier
467a9cb587 more verbose 2023-06-24 08:40:19 -07:00
Paul Gauthier
86457b8097 Limit retries on bad update replies 2023-06-24 08:38:52 -07:00
Paul Gauthier
a1909611d9 Raise ValueError if gpt makes an unknown function_call 2023-06-24 08:32:12 -07:00
Paul Gauthier
cee0f528ab better 2023-06-24 07:24:41 -07:00
Paul Gauthier
7d2fc1b2d9 fixed bug in show_send_output(), more robust error handling/reporting 2023-06-24 07:24:04 -07:00
Paul Gauthier
99194e4051 Better stats for retry outcomes 2023-06-23 20:54:02 -07:00
Paul Gauthier
9e506cccb0 log with_message 2023-06-23 19:09:39 -07:00
Paul Gauthier
f23327ecf9 clearer repo-map initial message 2023-06-23 17:53:20 -07:00
Paul Gauthier
ae9ded4eaf No repo map if no repo 2023-06-23 16:10:48 -07:00
Paul Gauthier
50e715fb9a run pytest, cleanup 2023-06-23 15:40:14 -07:00
Paul Gauthier
200ff36848 Suppress Warning: no changes found in tracked files when no repo 2023-06-23 15:00:35 -07:00