Commit graph

3222 commits

Author SHA1 Message Date
Paul Gauthier
3aa17c46dd set version to 0.18.2-dev 2023-12-14 12:21:50 -08:00
Paul Gauthier
52fdb17e96 version bump to 0.18.1 2023-12-14 12:21:20 -08:00
Paul Gauthier
ab24bce3b4 Updated HISTORY 2023-12-14 12:20:48 -08:00
Paul Gauthier
92f4100c92 be careful about too much convo history, avoid swamping the model with too much context 2023-12-08 12:11:57 -08:00
Paul Gauthier
560759f0c0 show the repomap before the added files 2023-12-08 09:18:03 -08:00
Paul Gauthier
cab7460f94 catch 404s from azure on models.list 2023-12-07 07:44:21 -08:00
Paul Gauthier
ad092152d0 Revert "max_apply_update_errors = 1 for quick benchmark"
This reverts commit fd71b6a4a5.
2023-12-07 07:43:06 -08:00
Paul Gauthier
fd71b6a4a5 max_apply_update_errors = 1 for quick benchmark 2023-12-06 14:35:57 -08:00
Paul Gauthier
fb7a7acb73 Merge remote-tracking branch 'origin/main' 2023-12-06 14:15:46 -08:00
paul-gauthier
1f07c8f48d
Merge pull request #391 from paul-gauthier/openai-upgrade
Openai upgrade
2023-12-06 14:13:33 -08:00
Paul Gauthier
fc9e956340 added pre-commit to dev-reqs 2023-12-06 14:11:32 -08:00
Paul Gauthier
ff96369ed6 cleanup 2023-12-06 14:09:32 -08:00
Paul Gauthier
67e6fed9eb Merge branch 'main' into openai-upgrade 2023-12-06 09:32:32 -08:00
Paul Gauthier
bce0279ae6 fixed test_main_message_adds_to_input_history 2023-12-06 09:32:01 -08:00
Paul Gauthier
9d2f89dd75 fix test 2023-12-06 09:30:19 -08:00
Paul Gauthier
922a56b194 Merge branch 'main' into openai-upgrade 2023-12-06 09:26:05 -08:00
Paul Gauthier
b85ed45504 add deployment_id to AzureOpenAI call per @itlackey 2023-12-06 09:22:04 -08:00
Paul Gauthier
57ab2cc9da Revert "implement deployment id"
This reverts commit b107db98fa.
2023-12-06 09:20:53 -08:00
paul-gauthier
5cd0efecee
Merge pull request #380 from VariousForks/message_as_file_with_unittest 2023-12-05 15:03:57 -08:00
Your Name
4692a689fe Improvements: flag -f (not -mf); unitest improvements. 2023-12-05 23:55:10 +01:00
Your Name
13ac5f0b60 Add --message-file flag and unit test
This commit introduces the `--message-file` flag to the `aider` tool, allowing users to specify a file containing the message to send to GPT. This feature processes the reply and then exits, disabling the chat mode. The implementation includes reading the content of the specified file and using it as the prompt message.

Additionally, a unit test has been added to `tests/test_main.py` to ensure the correct functionality of the `--message-file` flag. The test includes necessary mocks to handle non-interactive environments and verifies that the tool behaves as expected when a message file is provided.

This enhancement improves the usability of the `aider` tool for users who prefer or require non-interactive execution, such as in scripting or automated workflows.
2023-12-05 23:55:10 +01:00
Your Name
743179a4bd aider: Add --message-file flag to specify a file containing the message to send GPT, process reply, then exit (disables chat mode).
# Aider chat conversation:

USER: Am I correct that currently if one wants to launch aider from commandline , the way to go is to use --message flag that allows providing prompt as command line parameter?

ASSISTANT: Yes, you are correct. The `--message` or `-m` flag can be used to provide a single message to send to GPT, process the reply, and then exit the application. This flag disables the interactive chat mode and is suitable for scripting or when you want to issue a single command without entering the interactive chat session.

USER: Is there a way to run prompt from command line like `--message` or `-m` however by providing prompt as file ?

ASSISTANT: Currently, there is no direct command-line option in the `aider` tool to provide a prompt from a file. The `--message` or `-m` flag only accepts a string as an argument. If you want to provide a prompt from a file, you would need to read the content of the file and pass it as a string to the `--message` flag.

However, this functionality can be added to the `aider` tool by implementing a new command-line option that reads the content of a specified file and uses it as the prompt message.

Would you like me to implement this feature for you? If so, please provide the `aider/main.py` file, and I will suggest the necessary changes.

USER: How would you name such flag to match current convention and how would you describe it?

ASSISTANT: Following the current naming convention used in the `aider` tool, a suitable name for the flag that allows providing a prompt from a file could be `--message-file` or `-mf`. This flag would be described as:

"Specify a file containing the message to send to GPT, process the reply, then exit (disables chat mode)."

This description aligns with the existing `--message` flag while clearly indicating that the input is expected to be a file containing the message rather than a direct string input.

USER: could you please add such flag?

ASSISTANT: To add the `--message-file` flag to the `aider` tool, we need to modify the `aider/main.py` file. Please add the `aider/main.py` file to the chat so I can provide you with the necessary changes.

USER: could you please add such flag?

ASSISTANT: To add the `--message-file` flag to the `aider` tool, we need to modify the `aider/main.py` file. Please add the `aider/main.py` file to the chat so I can provide you with the necessary changes.

USER: could you please add such flag?

ASSISTANT: To add the `--message-file` flag to the `aider` tool, we need to modify the `aider/main.py` file. Please add the `aider/main.py` file to the chat so I can provide you with the necessary changes.

USER: I added these *read-write* files: /home/gw-t490/github/VariousForks/aider-patching-for-pull-requests/aider/main.py

ASSISTANT: Great, now that you've added the `aider/main.py` file, I will provide you with the necessary changes to implement the `--message-file` flag.

We will need to:

1. Add a new command-line argument `--message-file` to the argument parser.
2. Read the content of the file specified by `--message-file` and pass it to the `coder.run()` method.

Here are the *SEARCH/REPLACE* blocks for the changes:

aider/main.py
```python
<<<<<<< SEARCH
    other_group.add_argument(
        "--message",
        "--msg",
        "-m",
        metavar="COMMAND",
        help="Specify a single message to send GPT, process reply then exit (disables chat mode)",
    )
=======
    other_group.add_argument(
        "--message",
        "--msg",
        "-m",
        metavar="COMMAND",
        help="Specify a single message to send GPT, process reply then exit (disables chat mode)",
    )
    other_group.add_argument(
        "--message-file",
        "-mf",
        metavar="MESSAGE_FILE",
        help="Specify a file containing the message to send GPT, process reply, then exit (disables chat mode)",
    )
>>>>>>> REPLACE
```

aider/main.py
```python
<<<<<<< SEARCH
    if args.message:
        io.tool_output()
        coder.run(with_message=args.message)
    else:
        coder.run()
=======
    if args.message:
        io.tool_output()
        coder.run(with_message=args.message)
    elif args.message_file:
        try:
            with open(args.message_file, 'r', encoding='utf-8') as file:
                message_from_file = file.read()
            io.tool_output()
            coder.run(with_message=message_from_file)
        except FileNotFoundError:
            io.tool_error(f"Message file not found: {args.message_file}")
            return 1
        except IOError as e:
            io.tool_error(f"Error reading message file: {e}")
            return 1
    else:
        coder.run()
>>>>>>> REPLACE
```

These changes will add the `--message-file` flag to the argument parser and handle the case where a message file is provided. If the file is found and can be read, its content will be used as the message to send to GPT. If there is an error reading the file, an error message will be displayed, and the program will exit with a status code of 1.
2023-12-05 23:55:10 +01:00
paul-gauthier
93236e2e7e
Merge pull request #378 from VariousForks/log_message_arg_patch_2023-11-27_unit_test
Fixes #374 - logging add_to_input_history if args.message is used. (and unit test)
2023-12-05 13:19:44 -08:00
Paul Gauthier
b107db98fa implement deployment id 2023-12-05 11:31:17 -08:00
Paul Gauthier
bf03f43b44 fixed benchmark 2023-12-05 11:21:11 -08:00
Paul Gauthier
d92a93221c fixed test_wholefile 2023-12-05 11:11:48 -08:00
Paul Gauthier
5b21d5704a fixed test_sendchat 2023-12-05 11:08:14 -08:00
Paul Gauthier
2ed0c8fb66 fixed test_repo 2023-12-05 10:58:44 -08:00
Paul Gauthier
a68d3d8a20 fixed test_models 2023-12-05 10:56:03 -08:00
Paul Gauthier
23e6c4ee55 fixed test_coder 2023-12-05 10:51:50 -08:00
Paul Gauthier
fb07b784f6 move to gpt-3.5-turbo-1106 2023-12-05 10:28:27 -08:00
Paul Gauthier
6ebc142377 roughed in openai 1.x 2023-12-05 07:37:05 -08:00
Your Name
3e81cb1c6b Fixes #374 - test_main.py += unit test for --message flag.
Fixes https://github.com/paul-gauthier/aider/issues/374
2023-11-30 13:20:22 +01:00
Your Name
015ffa13e1 Fixes #374 - logging add_to_input_history if args.message is used.
Fixes https://github.com/paul-gauthier/aider/issues/374
2023-11-30 13:19:54 +01:00
Paul Gauthier
fd34766aa9 copy 2023-11-28 09:07:24 -08:00
Paul Gauthier
b26a4aa5d2 Updated install to reference MattFlower's VSCode plugin #68 2023-11-27 15:06:55 -08:00
Paul Gauthier
ef8ced4cac added more kind words 2023-11-27 11:53:39 -08:00
Paul Gauthier
ec95cd2d76 allow longer conversation histories for models with larger context windows 2023-11-27 10:55:36 -08:00
Paul Gauthier
4192e78bcd Merge remote-tracking branch 'origin/main' 2023-11-27 10:47:15 -08:00
paul-gauthier
390c2dcea0
Merge pull request #371 from zestysoft/fix-benchmark-docs 2023-11-25 13:19:30 -08:00
Ian Brown
049eb9966d
Use expected exercism-python destination
Signed-off-by: Ian Brown <ian@zestysoft.com>
2023-11-25 12:11:12 -08:00
Paul Gauthier
e771adbff5 Refactor model_ids to be sorted in check_model_availability function. 2023-11-21 14:08:17 -08:00
Paul Gauthier
3d65217bed set version to 0.18.1-dev 2023-11-17 15:51:31 -08:00
Paul Gauthier
93f45a6d6b version bump to 0.18.0 2023-11-17 15:51:07 -08:00
Paul Gauthier
ffaa1a03d6 aider: Add logic to compare commit dates of main and origin/main and print a message explaining which one is behind.
# Aider chat conversation:

USER: if main != origin/main, explain which one is behind

ASSISTANT: To implement this feature, we need to modify `scripts/versionbump.py`. We will add additional logic to the `check_main_branch_up_to_date` function to compare the commit dates of `main` and `origin/main` and print a message explaining which one is behind.

Here is the *SEARCH/REPLACE* block for the changes:

scripts/versionbump.py
```python
<<<<<<< SEARCH
        if local_main != origin_main:
            print("Error: The main branch is not up to date with origin/main. Please pull the latest changes.")
            sys.exit(1)
=======
        if local_main != origin_main:
            local_date = subprocess.run(["git", "show", "-s", "--format=%ci", "main"], capture_output=True, text=True).stdout.strip()
            origin_date = subprocess.run(["git", "show", "-s", "--format=%ci", "origin/main"], capture_output=True, text=True).stdout.strip()
            local_date = datetime.datetime.strptime(local_date, "%Y-%m-%d %H:%M:%S %z")
            origin_date = datetime.datetime.strptime(origin_date, "%Y-%m-%d %H:%M:%S %z")
            if local_date < origin_date:
                print("Error: The local main branch is behind origin/main. Please pull the latest changes.")
            elif local_date > origin_date:
                print("Error: The origin/main branch is behind the local main branch. Please push your changes.")
            else:
                print("Error: The main branch and origin/main have diverged.")
            sys.exit(1)
>>>>>>> REPLACE
```

Please note that we need to import the `datetime` module at the beginning of the file to use `datetime.datetime.strptime`. Here is the *SEARCH/REPLACE* block for adding the import:

scripts/versionbump.py
```python
<<<<<<< SEARCH
import argparse
import re
import subprocess
import sys
=======
import argparse
import datetime
import re
import subprocess
import sys
>>>>>>> REPLACE
```

These changes will compare the commit dates and print a message explaining which branch is behind if they are not in sync.
2023-11-17 15:50:37 -08:00
Paul Gauthier
21b80d0c06 aider: Added logging to print out the commit hashes for local_main and origin_main before the comparison to diagnose the issue with the script reporting that the main branch is not up to date with origin/main even though it is.
# Aider chat conversation:

USER: it's printing Error: The main branch is not up to date with origin/main. even though main is up to date with origin/main

ASSISTANT: To address the issue you're experiencing with the script reporting that the main branch is not up to date with `origin/main` even though it is, we should add additional logging to the script to help diagnose the problem. We can print out the commit hashes for `local_main` and `origin_main` before the comparison to see what the script is actually getting from the `git` commands.

Let's modify the `scripts/versionbump.py` file to add this logging.

Here is the *SEARCH/REPLACE* block:

scripts/versionbump.py
```python
<<<<<<< SEARCH
        local_main = subprocess.run(["git", "rev-parse", "main"], capture_output=True, text=True).stdout.strip()
        origin_main = subprocess.run(["git", "rev-parse", "origin/main"], capture_output=True, text=True).stdout.strip()
        if local_main != origin_main:
            print("Error: The main branch is not up to date with origin/main.")
=======
        local_main = subprocess.run(["git", "rev-parse", "main"], capture_output=True, text=True).stdout.strip()
        print(f"Local main commit hash: {local_main}")
        origin_main = subprocess.run(["git", "rev-parse", "origin/main"], capture_output=True, text=True).stdout.strip()
        print(f"Origin main commit hash: {origin_main}")
        if local_main != origin_main:
            print("Error: The main branch is not up to date with origin/main. Please pull the latest changes.")
>>>>>>> REPLACE
```

This change will print out the commit hashes for both `local_main` and `origin_main` before the script checks if they are the same. This should help you diagnose why the script thinks the branches are not in sync. If the hashes are indeed the same, but the script still reports an error, it could be an issue with the script's logic or the environment in which it's being run.
2023-11-17 15:48:59 -08:00
Paul Gauthier
3bd716e46d Updated HISTORY 2023-11-17 15:47:42 -08:00
Paul Gauthier
52fcdc4b09 aider: Add Git checks before version bumping.
# Aider chat conversation:

USER: before changing the repo, check that we are on the main branch, check that the working dir is not dirty, fetch the latest changes from origin and confirm that the main branch is up to date (don't merge it though). if any of these fail, exit with an error.

ASSISTANT: To implement these checks in the `scripts/versionbump.py` file, we will need to add the necessary Git operations before proceeding with the version bumping logic. Here are the steps we will follow:

1. Import the `sys` module to exit the script with an error if needed.
2. Add a function to check the current Git branch and ensure it is 'main'.
3. Add a function to check if the working directory is clean.
4. Add a function to fetch the latest changes from the origin and check if the 'main' branch is up to date.
5. Call these functions at the beginning of the `main()` function.

Here are the *SEARCH/REPLACE* blocks for the changes:

scripts/versionbump.py
```python
<<<<<<< SEARCH
import argparse
import re
import subprocess
=======
import argparse
import re
import subprocess
import sys
>>>>>>> REPLACE
```

scripts/versionbump.py
```python
<<<<<<< SEARCH
    args = parser.parse_args()
    dry_run = args.dry_run
=======
    # Function to check if we are on the main branch
    def check_branch():
        branch = subprocess.run(["git", "rev-parse", "--abbrev-ref", "HEAD"], capture_output=True, text=True).stdout.strip()
        if branch != "main":
            print("Error: Not on the main branch.")
            sys.exit(1)

    # Function to check if the working directory is clean
    def check_working_directory_clean():
        status = subprocess.run(["git", "status", "--porcelain"], capture_output=True, text=True).stdout
        if status:
            print("Error: Working directory is not clean.")
            sys.exit(1)

    # Function to fetch the latest changes and check if the main branch is up to date
    def check_main_branch_up_to_date():
        subprocess.run(["git", "fetch", "origin"], check=True)
        local_main = subprocess.run(["git", "rev-parse", "main"], capture_output=True, text=True).stdout.strip()
        origin_main = subprocess.run(["git", "rev-parse", "origin/main"], capture_output=True, text=True).stdout.strip()
        if local_main != origin_main:
            print("Error: The main branch is not up to date with origin/main.")
            sys.exit(1)

    args = parser.parse_args()
    dry_run = args.dry_run

    # Perform checks before proceeding
    check_branch()
    check_working_directory_clean()
    check_main_branch_up_to_date()
>>>>>>> REPLACE
```

These changes will ensure that the script checks for the current branch, the cleanliness of the working directory, and whether the 'main' branch is up to date with the origin before proceeding with the version bumping process. If any of these checks fail, the script will exit with an error message.
2023-11-17 15:41:43 -08:00
paul-gauthier
92f03b5f7d
Update README.md 2023-11-17 15:01:27 -08:00
Paul Gauthier
bf6cd8294e handle submodules (or other dirs) which are git tracked #336 2023-11-15 13:34:29 -08:00