Commit graph

2795 commits

Author SHA1 Message Date
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
Paul Gauthier
b7cb006958 test_only_commit_gpt_edited_file 2023-08-18 07:52:25 -07:00
Paul Gauthier
1460cd0055 test_new_file_edit_one_commit 2023-08-18 07:46:39 -07:00
Paul Gauthier
e608a351f0 standardize on abs_root_path(), simplify get/apply_edit 2023-08-18 07:20:15 -07:00
Paul Gauthier
f45bcbf8eb make reference to repo conditional 2023-08-18 07:11:42 -07:00
Paul Gauthier
8f26c27921 just diff the named files on commit 2023-08-18 07:09:16 -07:00
Paul Gauthier
389bf9310c commit just the edited files, treat named files outside git as dirty 2023-08-18 07:05:48 -07:00
Paul Gauthier
d89316147a do not add new files to git 2023-08-17 16:31:21 -07:00
Paul Gauthier
14d19e22b2 improved tests 2023-08-17 11:28:43 -07:00
Paul Gauthier
17c275b987 improved tests 2023-08-17 11:23:45 -07:00
Paul Gauthier
fbc4a49c24 Removed support for func based coders 2023-08-17 11:19:49 -07:00
Paul Gauthier
3401395e61 fix wholefile tests 2023-08-17 11:08:50 -07:00
Paul Gauthier
fef5a7b917 only check tracked files if there is a repo 2023-08-17 10:44:33 -07:00
Paul Gauthier
6c2923ff70 remove test for should_dirty_commit 2023-08-17 10:43:12 -07:00
Paul Gauthier
0a653d34d3 cleanup 2023-08-17 10:40:56 -07:00
Paul Gauthier
d981de5f5f do the commit before applying edits 2023-08-17 10:40:01 -07:00
Paul Gauthier
2455676a44 refactor to enumerate files to be edited, then make the edits 2023-08-17 10:07:22 -07:00
Paul Gauthier
43047c3835 Updated python versions for Ubuntu and Windows tests. 2023-08-17 08:34:57 -07:00
Paul Gauthier
fb82a20d60 aider: Add python_requires='>=3.9' to setup.py.
# Aider chat conversation:

USER: Add python_requires='>=3.8'

ASSISTANT: To add the `python_requires='>=3.8'` to the `setup
^C KeyboardInterrupt

USER: Add python_requires='>=3.9'

ASSISTANT: To add the `python_requires='>=3.9'` to the `setup.py` file, we need to modify the `setup()` function call to include this new argument.

Here is the *edit block* for this change:

```python
setup.py
<<<<<<< HEAD
setup(
    name="aider-chat",
    version=__version__,
    packages=find_packages(),
    include_package_data=True,
    install_requires=requirements,
    entry_points={
        "console_scripts": [
            "aider = aider.main:main",
        ],
    },
    description="aider is GPT powered coding in your terminal",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/paul-gauthier/aider",
)
=======
setup(
    name="aider-chat",
    version=__version__,
    packages=find_packages(),
    include_package_data=True,
    install_requires=requirements,
    python_requires='>=3.9',
    entry_points={
        "console_scripts": [
            "aider = aider.main:main",
        ],
    },
    description="aider is GPT powered coding in your terminal",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/paul-gauthier/aider",
)
>>>>>>> updated
```
This change ensures that the package will not be installed on Python versions lower than 3.9.
2023-08-17 08:34:21 -07:00
Paul Gauthier
6e9fbdcb6a fixed spurious "Adding to git" messages when running aider in subdir of repo 2023-08-17 08:32:44 -07:00
Paul Gauthier
6359376953 Updated HISTORY 2023-08-16 12:05:29 -07:00
Paul Gauthier
f62e3e2c90 copy 2023-08-14 15:09:29 -03:00
Paul Gauthier
46e72001b0 Merge branch 'main' into languages-switch 2023-08-14 15:07:11 -03:00
Paul Gauthier
ef764fefc8 default to auto 2023-08-14 15:07:08 -03:00
Paul Gauthier
097a9ebf20 aider: The JavaScript code now adds the mdurl as an href on the <a> tag.
# Aider chat conversation:

USER: have the js add the mdurl as an href on the <a>

ASSISTANT: To add the `mdurl` as an `href` on the `<a>` tag, we need to modify the `share/index.md` file.

Here are the steps:

1. Find the `<a>` tag that we want to modify.
2. Add a JavaScript code snippet that will get the `mdurl` from the URL parameters and set it as the `href` of the `<a>` tag.

Here is the *edit block* for the change:

<source>markdown
share/index.md
<<<<<<< HEAD
A user has shared the following transcript of a pair programming chat session
created using <a href="https://aider.chat">aider</a>.
=======
A user has shared the following
^C KeyboardInterrupt

USER: have the js add the mdurl as an href on the <a>

ASSISTANT: To add the `mdurl` as an `href` on the `<a>` tag, we need to modify the `share/index.md` file.

Here are the steps:

1. Find the `<a>` tag that we want to modify.
2. Add a JavaScript code snippet that will get the `mdurl` from the URL parameters and set it as the `href` of the `<a>` tag.

Here is the *edit block* for the change:

<source>markdown
share/index.md
<<<<<<< HEAD
The transcript is based on <a id="mdurl">this chat transcript data</a>.
=======
The transcript is based on <a id="mdurl" href="">this chat transcript data</a>.
>>>>>>> updated
</source>

<source>javascript
share/index.md
<<<<<<< HEAD
    var conv = urlParams.get('mdurl');
    if (!conv) {
        return;
    }
=======
    var conv = urlParams.get('mdurl');
    if (!conv) {
        return;
    }
    document.getElementById('mdurl').href = conv;
>>>>>>> updated
</source>
2023-08-14 14:40:47 -03:00
Paul Gauthier
56a97c4c13 copy 2023-08-14 14:35:24 -03:00
Paul Gauthier
c07013abf4 finished roughing in --voice-language 2023-08-14 14:18:37 -03:00
Paul Gauthier
bddcdd39a8 Refactor record_and_transcribe method in voice.py to accept a language parameter. 2023-08-14 14:11:31 -03:00
Paul Gauthier
23579d4741 Refactor voice recording and transcription to allow for specifying the language. 2023-08-14 14:11:03 -03:00
Paul Gauthier
f4e1c1010b aider: Accept voice_language param in __init__, pass to Commands.
# Aider chat conversation:

USER: accept voice_language param in __ini__, pass to Commands

ASSISTANT: To implement this change, we need to modify the following files:

1. `aider/coders/base_coder.py`: We need to modify the `__init__` method of the `Coder` class to accept a new parameter `voice_language`. We also need to pass this new parameter to the `Commands` class.

Here are the changes:

```python
aider/coders/base_coder.py
<<<<<<< HEAD
    def __init__(
        self,
        main_model,
        io,
        fnames=None,
        git_dname=None,
        pretty=True,
        show_diffs=False,
        auto_commits=True,
        dirty_commits=True,
        dry_run=False,
        map_tokens=1024,
        verbose=False,
        assistant_output_color="blue",
        code_theme="default",
        stream=True,
        use_git=True,
    ):
=======
    def __init__(
        self,
        main_model,
        io,
        fnames=None,
        git_dname=None,
        pretty=True,
        show_diffs=False,
        auto_commits=True,
        dirty_commits=True,
        dry_run=False,
        map_tokens=1024,
        verbose=False,
        assistant_output_color="blue",
        code_theme="default",
        stream=True,
        use_git=True,
        voice_language=None,
    ):
>>>>>>> updated
```

```python
aider/coders/base_coder.py
<<<<<<< HEAD
        self.commands = Commands(self.io, self)
=======
        self.commands = Commands(self.io, self, voice_language)
>>>>>>> updated
```

Please confirm these changes.
2023-08-14 14:09:45 -03:00
Paul Gauthier
625b251530 Change help message for voice language option to include "use auto to detect". 2023-08-14 14:08:38 -03:00
Paul Gauthier
8749adf511 aider: Add --voice-language switch with default "en" and pass it into Coder.
# Aider chat conversation:

USER: add --voice-language switch with default "en" and pass it into `Coder`

ASSISTANT: To add the `--voice-language` switch, we need to modify the `aider/main.py` file. We will add the argument in the `core_group` section of the argument parser. Then, we will pass this argument to the `Coder` class.

Here are the changes:

```python
aider/main.py
<<<<<<< HEAD
    core_group.add_argument(
        "-3",
        action="store_const",
        dest="model",
        const=models.GPT35_16k.name,
        help=f"Use {models.GPT35_16k.name} model for the main chat (gpt-4 is better)",
    )
=======
    core_group.add_argument(
        "-3",
        action="store_const",
        dest="model",
        const=models.GPT35_16k.name,
        help=f"Use {models.GPT35_16k.name} model for the main chat (gpt-4 is better)",
    )
    core_group.add_argument(
        "--voice-language",
        metavar="VOICE_LANGUAGE",
        default="en",
        help="Specify the language for voice (default: en)",
    )
>>>>>>> updated
```

```python
aider/main.py
<<<<<<< HEAD
    try:
        coder = Coder.create(
            main_model,
            args.edit_format,
            io,
            ##
            fnames=fnames,
            git_dname=git_dname,
            pretty=args.pretty,
            show_diffs=args.show_diffs,
            auto_commits=args.auto_commits,
            dirty_commits=args.dirty_commits,
            dry_run=args.dry_run,
            map_tokens=args.map_tokens,
            verbose=args.verbose,
            assistant_output_color=args.assistant_output_color,
            code_theme=args.code_theme,
            stream=args.stream,
            use_git=args.git,
        )
    except ValueError as err:
        io.tool_error(str(err))
        return 1
=======
    try:
        coder = Coder.create(
            main_model,
            args.edit_format,
            io,
            ##
            fnames=fnames,
            git_dname=git_dname,
            pretty=args.pretty,
            show_diffs=args.show_diffs,
            auto_commits=args.auto_commits,
            dirty_commits=args.dirty_commits,
            dry_run=args.dry_run,
            map_tokens=args.map_tokens,
            verbose=args.verbose,
            assistant_output_color=args.assistant_output_color,
            code_theme=args.code_theme,
            stream=args.stream,
            use_git=args.git,
            voice_language=args.voice_language,
        )
    except ValueError as err:
        io.tool_error(str(err))
        return 1
>>>>>>> updated
```

Please note that the `Coder` class and its subclasses (`EditBlockCoder`, `EditBlockFunctionCoder`, `SingleWholeFileFunctionCoder`, `WholeFileCoder`, `WholeFileFunctionCoder`) need to be updated to accept and use the `voice_language` argument. These changes are not shown here as the `Coder` class and its subclasses are not provided in the *read-write* files.
2023-08-14 14:08:04 -03:00
Paul Gauthier
33969d67c8 copy 2023-08-14 13:53:24 -03:00
Paul Gauthier
d4fc9a803a copy 2023-08-14 08:24:55 -03:00
Paul Gauthier
fcb209c5aa refac 2023-08-11 11:16:31 -03:00
Paul Gauthier
b6b271b70c pass the input history as a prompt to whisper 2023-08-11 11:03:37 -03:00
Paul Gauthier
9815d14368 rename 2023-08-11 10:49:27 -03:00