Commit graph

3031 commits

Author SHA1 Message Date
Paul Gauthier
81288908f4 Added tags queries 2023-09-01 14:04:22 -07:00
Paul Gauthier
fa6ae80653 Merge branch 'main' into sitter-map 2023-09-01 12:00:48 -07:00
paul-gauthier
30a3cc0847
Merge pull request #199 from joshuavial/openrouter
Openrouter compatibility
2023-08-31 17:17:28 -07:00
Paul Gauthier
d832860599 Merge branch 'main' into sitter-map 2023-08-26 17:37:15 -07:00
Paul Gauthier
94c8ce117d initial 2023-08-26 17:20:12 -07:00
Paul Gauthier
bcf4a55714 copy 2023-08-25 07:16:40 -07:00
Joshua Vial
6405193a95 docs for openrouter 2023-08-23 22:26:14 +12:00
Joshua Vial
0826e116da cleaning up openrouter code 2023-08-23 22:03:09 +12:00
Joshua Vial
668a0500ff test openrouter model properties 2023-08-23 21:50:00 +12:00
Joshua Vial
d1e0a196b5 Add test for creating models from OpenRouter API. 2023-08-23 21:32:00 +12:00
Joshua Vial
abbc93678b finishing openrouter integration 2023-08-23 21:26:27 +12:00
JV
1fc2abe3d0 save model to ChatSummary 2023-08-23 14:39:12 +12:00
JV
8fca0f27ee add caching of openrouter model details 2023-08-23 14:39:12 +12:00
JV
a39829c5f8 adding todo notes 2023-08-23 14:39:12 +12:00
JV
22f3349862 Refactored the code to use a global variable to store the OpenAI instance and added a helper function to determine the edit format for a given model. 2023-08-23 14:39:12 +12:00
JV
a0d6efc13c dynamically get pricing and context length for openrouter models 2023-08-23 14:39:12 +12:00
JV
041f3a4a38 initial code for working with openrouter 2023-08-23 14:39:12 +12:00
Paul Gauthier
8c580dd332 set version to 0.13.1-dev 2023-08-22 08:04:24 -07:00
Paul Gauthier
5eebde1d06 version bump to 0.13.0 2023-08-22 08:03:58 -07:00
Paul Gauthier
7e77a2b89f Updated HISTORY 2023-08-22 07:50:31 -07:00
Paul Gauthier
968095b36d Updated HISTORY 2023-08-22 07:45:17 -07:00
Paul Gauthier
6b41581f91 added header_max, more whitespace 2023-08-22 07:45:06 -07:00
Paul Gauthier
057aa0a736 prettier 2023-08-20 15:11:12 -07:00
Paul Gauthier
189446b04e roughed in tree-sitter 2023-08-20 14:11:06 -07:00
Paul Gauthier
de0cfe4d39 refac to remove ctags 2023-08-19 19:24:42 -07:00
Paul Gauthier
e15b0b04d4 copy 2023-08-19 19:12:55 -07:00
Paul Gauthier
d7443e21b9 copy 2023-08-19 19:12:35 -07:00
Paul Gauthier
963bc83a9c Late-bind importing sounddevice, as it was slowing down aider startup 2023-08-19 15:18:46 -07:00
Paul Gauthier
4846317ef1 Merge remote-tracking branch 'origin/main' 2023-08-19 11:43:23 -07:00
Paul Gauthier
354b216bbe added /voice to docs 2023-08-19 11:42:56 -07:00
paul-gauthier
34159648d7
Update README.md 2023-08-19 08:46:39 -07:00
Paul Gauthier
b6a329c934 Updated HISTORY 2023-08-19 07:33:35 -07:00
Paul Gauthier
5c538327c3 update tests 2023-08-19 07:23:00 -07:00
Paul Gauthier
45de64535a add missing import 2023-08-19 07:17:50 -07:00
Paul Gauthier
0e9e037c06 aider: Change all the --foo/--no-foo switches to use the parser.add_argument('--feature', action=argparse.BooleanOptionalAction) convention.
# Aider chat conversation:

USER: change all the --foo/--no-foo switches to use the `parser.add_argument('--feature', action=argparse.BooleanOptionalAction)` convention

ASSISTANT: To implement this change, we need to modify the `aider/main.py` file. We will replace all instances of `--foo` and `--no-foo` switches with the `parser.add_argument('--feature', action=argparse.BooleanOptionalAction)` convention.

Here are the changes:

```python
aider/main.py
<<<<<<< HEAD
    output_group.add_argument(
        "--pretty",
        action="store_true",
        default=True,
        help="Enable pretty, colorized output (default: True)",
    )
    output_group.add_argument(
        "--no-pretty",
        action="store_false",
        dest="pretty",
        help="Disable pretty, colorized output",
    )
    output_group.add_argument(
        "--no-stream",
        action="store_false",
        dest="stream",
        default=True,
        help="Disable streaming responses",
    )
    git_group.add_argument(
        "--no-git",
        action="store_false",
        dest="git",
        default=True,
        help="Do not look for a git repo",
    )
    git_group.add_argument(
        "--auto-commits",
        action="store_true",
        dest="auto_commits",
        default=True,
        help="Enable auto commit of GPT changes (default: True)",
    )
    git_group.add_argument(
        "--no-auto-commits",
        action="store_false",
        dest="auto_commits",
        help="Disable auto commit of GPT changes (implies --no-dirty-commits)",
    )
    git_group.add_argument(
        "--dirty-commits",
        action="store_true",
        dest="dirty_commits",
        help="Enable commits when repo is found dirty",
        default=True,
    )
    git_group.add_argument(
        "--no-dirty-commits",
        action="store_false",
        dest="dirty_commits",
        help="Disable commits when repo is found dirty",
    )
    git_group.add_argument(
        "--dry-run",
        action="store_true",
        help="Perform a dry run without modifying files (default: False)",
        default=False,
    )
=======
    output_group.add_argument(
        "--pretty",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable pretty, colorized output (default: True)",
    )
    output_group.add_argument(
        "--stream",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable streaming responses (default: True)",
    )
    git_group.add_argument(
        "--git",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable looking for a git repo (default: True)",
    )
    git_group.add_argument(
        "--auto-commits",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable auto commit of GPT changes (default: True)",
    )
    git_group.add_argument(
        "--dirty-commits",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable commits when repo is found dirty (default: True)",
    )
    git_group.add_argument(
        "--dry-run",
        action=argparse.BooleanOptionalAction,
        default=False,
        help="Enable/disable performing a dry run without modifying files (default: False)",
    )
>>>>>>> updated
```

Please note that the `argparse.BooleanOptionalAction` was introduced in Python 3.9. If you're using an older version of Python, you might need to upgrade or use a different approach.

USER: InvalidEditBlock: edit failed!

aider/main.py does not contain the *exact sequence* of HEAD lines you specified.
Try again.
DO NOT skip blank lines, comments, docstrings, etc!
The HEAD block needs to be EXACTLY the same as the lines in aider/main.py with nothing missing!

aider/main.py does not contain these 58 exact lines in a row:
```
    output_group.add_argument(
        "--pretty",
        action="store_true",
        default=True,
        help="Enable pretty, colorized output (default: True)",
    )
    output_group.add_argument(
        "--no-pretty",
        action="store_false",
        dest="pretty",
        help="Disable pretty, colorized output",
    )
    output_group.add_argument(
        "--no-stream",
        action="store_false",
        dest="stream",
        default=True,
        help="Disable streaming responses",
    )
    git_group.add_argument(
        "--no-git",
        action="store_false",
        dest="git",
        default=True,
        help="Do not look for a git repo",
    )
    git_group.add_argument(
        "--auto-commits",
        action="store_true",
        dest="auto_commits",
        default=True,
        help="Enable auto commit of GPT changes (default: True)",
    )
    git_group.add_argument(
        "--no-auto-commits",
        action="store_false",
        dest="auto_commits",
        help="Disable auto commit of GPT changes (implies --no-dirty-commits)",
    )
    git_group.add_argument(
        "--dirty-commits",
        action="store_true",
        dest="dirty_commits",
        help="Enable commits when repo is found dirty",
        default=True,
    )
    git_group.add_argument(
        "--no-dirty-commits",
        action="store_false",
        dest="dirty_commits",
        help="Disable commits when repo is found dirty",
    )
    git_group.add_argument(
        "--dry-run",
        action="store_true",
        help="Perform a dry run without modifying files (default: False)",
        default=False,
    )
```

ASSISTANT: I apologize for the confusion. It seems I made a mistake in grouping the changes. The arguments are not all together in the file, they are spread out in different argument groups. I will correct this and provide the changes in separate edit blocks for each argument group.

Here are the corrected changes:

```python
aider/main.py
<<<<<<< HEAD
    output_group.add_argument(
        "--pretty",
        action="store_true",
        default=True,
        help="Enable pretty, colorized output (default: True)",
    )
    output_group.add_argument(
        "--no-pretty",
        action="store_false",
        dest="pretty",
        help="Disable pretty, colorized output",
    )
    output_group.add_argument(
        "--no-stream",
        action="store_false",
        dest="stream",
        default=True,
        help="Disable streaming responses",
    )
=======
    output_group.add_argument(
        "--pretty",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable pretty, colorized output (default: True)",
    )
    output_group.add_argument(
        "--stream",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable streaming responses (default: True)",
    )
>>>>>>> updated
```

```python
aider/main.py
<<<<<<< HEAD
    git_group.add_argument(
        "--no-git",
        action="store_false",
        dest="git",
        default=True,
        help="Do not look for a git repo",
    )
    git_group.add_argument(
        "--auto-commits",
        action="store_true",
        dest="auto_commits",
        default=True,
        help="Enable auto commit of GPT changes (default: True)",
    )
    git_group.add_argument(
        "--no-auto-commits",
        action="store_false",
        dest="auto_commits",
        help="Disable auto commit of GPT changes (implies --no-dirty-commits)",
    )
    git_group.add_argument(
        "--dirty-commits",
        action="store_true",
        dest="dirty_commits",
        help="Enable commits when repo is found dirty",
        default=True,
    )
    git_group.add_argument(
        "--no-dirty-commits",
        action="store_false",
        dest="dirty_commits",
        help="Disable commits when repo is found dirty",
    )
    git_group.add_argument(
        "--dry-run",
        action="store_true",
        help="Perform a dry run without modifying files (default: False)",
        default=False,
    )
=======
    git_group.add_argument(
        "--git",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable looking for a git repo (default: True)",
    )
    git_group.add_argument(
        "--auto-commits",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable auto commit of GPT changes (default: True)",
    )
    git_group.add_argument(
        "--dirty-commits",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable commits when repo is found dirty (default: True)",
    )
    git_group.add_argument(
        "--dry-run",
        action=argparse.BooleanOptionalAction,
        default=False,
        help="Enable/disable performing a dry run without modifying files (default: False)",
    )
>>>>>>> updated
```

Please note that the `argparse.BooleanOptionalAction` was introduced in Python 3.9. If you're using an older version of Python, you might need to upgrade or use a different approach.
2023-08-19 07:16:37 -07:00
Paul Gauthier
66e04bde3d copy 2023-08-19 06:47:39 -07:00
Paul Gauthier
ae8d04a95f Handle diff of file not yet part of repo 2023-08-18 13:20:27 -07:00
paul-gauthier
9933ad85b0
Merge pull request #207 from paul-gauthier/late-bind-commits
Only commit dirty files if GPT tries to edit them #200
2023-08-18 10:43:06 -07:00
Paul Gauthier
2737cbde06 ssh 2023-08-18 10:35:42 -07:00
Paul Gauthier
4e45d1597d Updated HISTORY 2023-08-18 10:31:50 -07:00
Paul Gauthier
b56340db6a Updated FAQ 2023-08-18 10:30:34 -07:00
Paul Gauthier
cd830cbc3c noop 2023-08-18 10:16:17 -07:00
Paul Gauthier
285536105e Properly handle all diff cases 2023-08-18 10:07:47 -07:00
Paul Gauthier
7af82ba185 keep track of the files which need dirty commits 2023-08-18 09:50:18 -07:00
Paul Gauthier
752e47a886 better tests, small cleanups 2023-08-18 09:43:40 -07:00
Paul Gauthier
95fb55b9d9 test_gpt_edit_to_dirty_file 2023-08-18 09:17:07 -07:00
Paul Gauthier
93795c085a make sure newly created files don't just get committed 2023-08-18 08:01:14 -07:00
Paul Gauthier
83f084a800 aider: Added assertion to check if repo.iter_commits(repo.active_branch.name) raises git.exc.GitCommandError.
# Aider chat conversation:

ASSISTANT: I understand that you want to complete the TODO task in the `test_new_file_edit_one_commit` method in the `tests/test_coder.py` file. However, the task is not clear. The TODO comment says:

```python
### TODO: assert that the next line raises git.exc.GitCommandError
```

This suggests that the following line of code should raise a `git.exc.GitCommandError` exception:

```python
repo.iter_commits(repo.active_branch.name)
```

To complete this task, we need to add a test assertion that checks if this line of code raises the `git.exc.GitCommandError` exception. We can use the `assertRaises` method from the `unittest.TestCase` class to do this.

Here is the change that needs to be made:

<source>python
tests/test_coder.py
<<<<<<< HEAD
            ### TODO: assert that the next line raises git.exc.GitCommandError
            repo.iter_commits(repo.active_branch.name)
=======
            with self.assertRaises(git.exc.GitCommandError):
                repo.iter_commits(repo.active_branch.name)
>>>>>>> updated
</source>

This change will add an assertion that checks if the `repo.iter_commits(repo.active_branch.name)` line of code raises a `git.exc.GitCommandError` exception. If the line of code does not raise this exception, the test will fail.
2023-08-18 08:00:04 -07:00
Paul Gauthier
f722394db6 Assert that the file exists before iterating through commits. 2023-08-18 08:00:03 -07:00
Paul Gauthier
d09e85adc2 Also ensure commit msg only depends on diffs from the GPT edited file. 2023-08-18 07:55:42 -07:00