Commit graph

4070 commits

Author SHA1 Message Date
Paul Gauthier
a76bf0c9fa aider: Add the -it flag to the docker run command in scripts/run.sh to run the container in interactive mode.
# Aider chat conversation:

USER: bash scripts/run.sh

ASSISTANT: Let's update the `scripts/run.sh` to ensure it correctly mounts the current directory and serves the Jekyll site.

scripts/run.sh
```python
<<<<<<< SEARCH
#!/bin/bash

# Run the Docker container
docker run --rm -v "$PWD:/srv/jekyll" -p 4000:4000 my-jekyll-site
=======
#!/bin/bash

# Run the Docker container
docker run --rm -v "$PWD:/srv/jekyll" -p 4000:4000 -it my-jekyll-site
>>>>>>> REPLACE
```

This change adds the `-it` flag to the `docker run` command, which ensures that the container runs in interactive mode and allocates a pseudo-TTY. This can be useful for debugging and interacting with the Jekyll server if needed.
2024-05-15 09:39:57 -07:00
Paul Gauthier
e41af1c28e aider: Added Gemfile for Jekyll site setup.
# Aider chat conversation:

USER: will this pickup the github pages jekyll site that is in this repy? Like the _layouts _data _posts etc dirs?

ASSISTANT: Yes, the current Dockerfile and scripts should pick up the GitHub Pages Jekyll site, including directories like `_layouts`, `_data`, `_posts`, etc., because the `COPY . /srv/jekyll` command in the Dockerfile copies the entire current directory (which should include those directories) into the Docker container.

However, to ensure everything works correctly, let's make sure the Dockerfile and scripts are set up to handle the Jekyll site properly. Here are the steps:

1. Ensure the Dockerfile is correctly set up to copy the entire site and install dependencies.
2. Ensure the build and run scripts are correctly set up to build the Docker image and run the container.

Let's review the current state of the files and make any necessary adjustments.

scripts/Dockerfile
```python
# Use the official Jekyll image from Docker Hub
FROM jekyll/jekyll:latest

# Set the working directory
WORKDIR /srv/jekyll

# Copy the current directory contents into the container at /srv/jekyll
COPY . /srv/jekyll

# Install any needed packages specified in Gemfile
RUN bundle install

# Expose port 4000 to the host
EXPOSE 4000

# Run Jekyll server
CMD ["jekyll", "serve", "--host", "0.0.0.0"]
```

scripts/build.sh
```python
#!/bin/bash

# Build the Docker image
docker build -t my-jekyll-site -f scripts/Dockerfile .
```

scripts/run.sh
```python
#!/bin/bash

# Run the Docker container
docker run --rm -v "$PWD:/srv/jekyll" -p 4000:4000 my-jekyll-site
```

These files should work as expected. The `COPY . /srv/jekyll` command in the Dockerfile will copy all the necessary Jekyll site files, including `_layouts`, `_data`, `_posts`, etc., into the Docker container. The `bundle install` command will install any dependencies specified in the `Gemfile`.

To verify, you can run the following commands in your project directory:

```sh
bash scripts/build.sh
bash scripts/run.sh
```

This will build the Docker image and start a container that serves your Jekyll site on `http://localhost:4000`. If you encounter any issues, please let me know!

USER: I ran this command:

 bash scripts/build.sh

And got this output:

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 435B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 transferring context: 101B 0.0s done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/jekyll/jekyll:latest
#3 DONE 0.6s

#4 [1/4] FROM docker.io/jekyll/jekyll:latest@sha256:400b8d1569f118bca8a3a09a25f32803b00a55d1ea241feaf5f904d66ca9c625
#4 DONE 0.0s

#5 [internal] load build context
#5 transferring context: 250.53kB 0.2s done
#5 DONE 0.2s

#6 [2/4] WORKDIR /srv/jekyll
#6 CACHED

#7 [3/4] COPY . /srv/jekyll
#7 CACHED

#8 [4/4] RUN bundle install
#8 6.277 Could not locate Gemfile
#8 ERROR: process "/bin/sh -c bundle install" did not complete successfully: exit code: 10
------
 > [4/4] RUN bundle install:
#8 6.277 Could not locate Gemfile
------
Dockerfile:11
--------------------
   9 |
  10 |     # Install any needed packages specified in Gemfile
  11 | >>> RUN bundle install
  12 |
  13 |     # Expose port 4000 to the host
--------------------
ERROR: failed to solve: process "/bin/sh -c bundle install" did not complete successfully: exit code: 10

ASSISTANT: The error indicates that the `Gemfile` is not being found in the context being copied into the Docker container. This could be because the `Gemfile` is not in the root directory of your project or it might be missing.

To resolve this, we need to ensure that the `Gemfile` is present in the root directory of your project. If it is not, you should add it. If it is present, we need to make sure it is being copied correctly.

Let's first verify that the `Gemfile` is in the root directory of your project. If it is not, please add it. If it is, we can proceed with the current Dockerfile and scripts.

Assuming the `Gemfile` is present in the root directory, the Dockerfile should work as expected. If the `Gemfile` is in a different directory, please let me know its location so we can adjust the Dockerfile accordingly.

If the `Gemfile` is missing, you can create a basic one with the following content:

Gemfile
```ruby
source 'https://rubygems.org'
gem 'jekyll'
```

Once the `Gemfile` is in place, you can re-run the build script:

```sh
bash scripts/build.sh
```

If you encounter any further issues, please let me know!

USER: please make it

ASSISTANT: Let's create the `Gemfile` in the root directory of your project.

Gemfile
```ruby
<<<<<<< SEARCH
=======
source 'https://rubygems.org'
gem 'jekyll'
>>>>>>> REPLACE
```

This `Gemfile` specifies the source for Ruby gems and includes the `jekyll` gem, which is necessary for your Jekyll site.

After adding this `Gemfile`, you can re-run the build script:

```sh
bash scripts/build.sh
```

This should resolve the issue with the missing `Gemfile` and allow the Docker image to be built successfully. If you encounter any further issues, please let me know!
2024-05-15 09:38:58 -07:00
Paul Gauthier
23348603a9 aider: Create Dockerfile and scripts to build and run the Jekyll site locally using Docker.
# Aider chat conversation:

USER: i want to render my github pages jekyll site locally. in the scripts/ dir, make me a dockerfile and scripts to build and run it.

ASSISTANT: To render your GitHub Pages Jekyll site locally using Docker, we need to create a Dockerfile and two scripts: one to build the Docker image and another to run the container.

Here are the necessary files:

1. `scripts/Dockerfile`
2. `scripts/build.sh`
3. `scripts/run.sh`

Let's create these files:

scripts/Dockerfile
```python
<<<<<<< SEARCH
=======
# Use the official Jekyll image from Docker Hub
FROM jekyll/jekyll:latest

# Set the working directory
WORKDIR /srv/jekyll

# Copy the current directory contents into the container at /srv/jekyll
COPY . /srv/jekyll

# Install any needed packages specified in Gemfile
RUN bundle install

# Expose port 4000 to the host
EXPOSE 4000

# Run Jekyll server
CMD ["jekyll", "serve", "--host", "0.0.0.0"]
>>>>>>> REPLACE
```

scripts/build.sh
```python
<<<<<<< SEARCH
=======
#!/bin/bash

# Build the Docker image
docker build -t my-jekyll-site -f scripts/Dockerfile .
>>>>>>> REPLACE
```

scripts/run.sh
```python
<<<<<<< SEARCH
=======
#!/bin/bash

# Run the Docker container
docker run --rm -v "$PWD:/srv/jekyll" -p 4000:4000 my-jekyll-site
>>>>>>> REPLACE
```

These scripts will allow you to build and run your Jekyll site locally using Docker. To use them, navigate to your project directory and run:

```sh
bash scripts/build.sh
bash scripts/run.sh
```

This will build the Docker image and start a container that serves your Jekyll site on `http://localhost:4000`.
2024-05-15 09:36:32 -07:00
Paul Gauthier
547a07fadc aider: Added scatter plot of edit_leaderboard models with released dates in _posts/2024-05-13-models-over-time.md.
# Aider chat conversation:

USER: draw a scatter plot of the edit_leaderboard models which have `released` dates. With x as the release date, y as the `pass_rate_2` and label each point with the `model` name field. use a chart style similar to the bar graph in the leaderboard.md, but we want a scatter plot for this one. put the scatter plot in the new blog post

ASSISTANT: Let's add the scatter plot to the new blog post in `_posts/2024-05-13-models-over-time.md`.

Here is the *SEARCH/REPLACE* block to add the scatter plot:

_posts/2024-05-13-models-over-time.md
```markdown
<<<<<<< SEARCH
# LLM code editing skill over time
=======
# LLM code editing skill over time

<canvas id="scatterPlot" width="800" height="450" style="margin-top: 20px"></canvas>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
  document.addEventListener('DOMContentLoaded', function () {
    var ctx = document.getElementById('scatterPlot').getContext('2d');
    var scatterData = {
      datasets: [{
        label: 'Model Performance',
        data: [
          {% for row in site.data.edit_leaderboard %}
            {% if row.released %}
              {
                x: new Date('{{ row.released }}'),
                y: {{ row.pass_rate_2 }},
                label: '{{ row.model }}'
              },
            {% endif %}
          {% endfor %}
        ],
        backgroundColor: 'rgba(54, 162, 235, 0.2)',
        borderColor: 'rgba(54, 162, 235, 1)',
        borderWidth: 1,
        pointRadius: 5,
        pointHoverRadius: 7
      }]
    };

    var scatterChart = new Chart(ctx, {
      type: 'scatter',
      data: scatterData,
      options: {
        scales: {
          xAxes: [{
            type: 'time',
            time: {
              unit: 'month',
              tooltipFormat: 'll'
            },
            scaleLabel: {
              display: true,
              labelString: 'Release Date'
            }
          }],
          yAxes: [{
            scaleLabel: {
              display: true,
              labelString: 'Pass Rate 2 (%)'
            },
            ticks: {
              beginAtZero: true
            }
          }]
        },
        tooltips: {
          callbacks: {
            label: function(tooltipItem, data) {
              var label = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index].label || '';
              return label + ': (' + tooltipItem.xLabel + ', ' + tooltipItem.yLabel + '%)';
            }
          }
        }
      }
    });
  });
</script>
>>>>>>> REPLACE
```
2024-05-15 09:32:41 -07:00
Paul Gauthier
8f36dff6d8 Added _posts/2024-05-13-models-over-time.md. 2024-05-15 09:32:40 -07:00
Paul Gauthier
72613f3b27 switch naming from openai/gpt-4o to gpt-4o 2024-05-15 06:25:30 -07:00
Paul Gauthier
edc70bdf84 Handle multiline tool_error() better 2024-05-13 11:42:22 -07:00
Paul Gauthier
ebeec04cae Updated leaderboard commands to reflect 4o is default model now 2024-05-13 11:30:09 -07:00
Paul Gauthier
b2fbafe41b docs and --4-turbo updates 2024-05-13 11:24:52 -07:00
Paul Gauthier
e909207241 set version to 0.35.1-dev 2024-05-13 11:19:29 -07:00
Paul Gauthier
aaaef12cce version bump to 0.35.0 2024-05-13 11:18:51 -07:00
Paul Gauthier
92e56355c9 Updated HISTORY 2024-05-13 11:17:41 -07:00
Paul Gauthier
b4e53da9ea copy 2024-05-13 11:13:42 -07:00
Paul Gauthier
30cb06a629 copy 2024-05-13 11:13:08 -07:00
Paul Gauthier
6be2075aad Updated HISTORY 2024-05-13 11:10:53 -07:00
Paul Gauthier
ea05cf05e1 Added --restore-chat-history 2024-05-13 11:09:28 -07:00
Paul Gauthier
6d75dc62d7 copy 2024-05-13 11:06:02 -07:00
Paul Gauthier
eea86ef4f6 copy 2024-05-13 11:05:05 -07:00
Paul Gauthier
45ea2d5871 copy 2024-05-13 11:03:12 -07:00
Paul Gauthier
5b3e9d7b05 copy 2024-05-13 10:59:14 -07:00
Paul Gauthier
8b99429dfa updated leaderboards 2024-05-13 10:58:06 -07:00
Paul Gauthier
bfba56c5f1 added 4o as default 2024-05-13 10:57:26 -07:00
Paul Gauthier
b6cd852124 added openai/ prefix 2024-05-13 10:36:07 -07:00
Paul Gauthier
7b19f767fc Added gpt-4o 2024-05-13 10:33:08 -07:00
Paul Gauthier
eea8e50c60 ask llm are you sure? when REPLACE exists 2024-05-11 16:56:14 -07:00
Paul Gauthier
90c0a5b9a4 reflect multiple messages; do not strip edit error messages 2024-05-11 16:40:37 -07:00
Paul Gauthier
0f9e314bb2 emit edit errors as proper tool_error() markdown 2024-05-11 15:38:03 -07:00
Paul Gauthier
cd78080fa5 on search/replace error ask the LLM did you mean? 2024-05-11 15:02:22 -07:00
Paul Gauthier
4841f318c1 always retry httpx errors 2024-05-11 15:01:56 -07:00
Paul Gauthier
6c45b58698 aider: Implemented find_similar_lines to fuzzy search content and return closest matching contiguous chunk of lines.
# Aider chat conversation:

USER: implement `find_similar_lines` which will fuzzy search the content for the original lines and return the contiguous chunk of lines from content which are the closest match

ASSISTANT: Here is the implementation of `find_similar_lines` to fuzzy search the content and return the closest matching contiguous chunk of lines:

aider/coders/editblock_coder.py
<source>python
<<<<<<< SEARCH
    #did_you_mean = find_similar_lines(original, content)
=======
    did_you_mean = find_similar_lines(original, content)
>>>>>>> REPLACE
</source>

aider/coders/editblock_coder.py
<source>python
<<<<<<< SEARCH
=======
def find_similar_lines(search_lines, content_lines, threshold=0.8):
    search_lines = search_lines.splitlines()
    content_lines = content_lines.splitlines()

    best_ratio = 0
    best_match = None

    for i in range(len(content_lines) - len(search_lines) + 1):
        chunk = content_lines[i:i+len(search_lines)]
        ratio = SequenceMatcher(None, search_lines, chunk).ratio()
        if ratio > best_ratio:
            best_ratio = ratio
            best_match = chunk

    if best_ratio >= threshold:
        return "\n".join(best_match)
    else:
        return ""
>>>>>>> REPLACE
</source>

This adds the `find_similar_lines` function which:

1. Splits the search lines and content lines on newlines
2. Iterates through the content lines, considering each contiguous chunk the same length as the search lines
3. Calculates the SequenceMatcher ratio between the search lines and each chunk
4. Keeps track of the chunk with the highest ratio
5. If the best ratio is above the threshold (default 0.8), it returns the best matching chunk joined back into a string
6. Otherwise it returns an empty string to indicate no close enough match was found

It also uncomments the line to call `find_similar_lines` and store the result in `did_you_mean`.

Let me know if you have any other questions!
2024-05-11 10:49:34 -07:00
Paul Gauthier
056dae6530 Removed unused find_similar_lines function call from EditBlockCoder class. 2024-05-11 10:49:33 -07:00
Paul Gauthier
fd6f31f972 Replaced find_similar_text with find_similar_lines in editblock_coder.py. 2024-05-11 10:48:45 -07:00
Paul Gauthier
d02506db16 aider: Implemented find_similar_text function to fuzzy search the content for the closest match to the original text.
# Aider chat conversation:

USER: I did `git reset --hard HEAD~1` to discard the last edits. Please wait for further instructions before attempting that change again. Feel free to ask relevant questions about why the changes were reverted.

ASSISTANT: I understand you reverted the previous changes. Before I attempt to implement the `find_similar_lines` function again, I have a few questions to ensure I follow your guidelines correctly:

1. When proposing changes, should I only modify the `aider/coders/editblock_coder.py` file since that is the only one you have explicitly added to the chat
^C KeyboardInterrupt

USER: implement `find_similar_text` which will fuzzy search the content for the original text and return the part of content which is the closest match

ASSISTANT: Here is the implementation of `find_similar_text` to fuzzy search the content for the closest match to the original text:

aider/coders/editblock_coder.py
<source>python
<<<<<<< SEARCH
=======
from difflib import SequenceMatcher

def find_similar_text(original, content):
    content_len = len(content)
    original_len = len(original)

    best_ratio = 0
    best_match = None

    for i in range(content_len - original_len + 1):
        chunk = content[i:i+original_len]
        ratio = SequenceMatcher(None, original, chunk).ratio()

        if ratio > best_ratio:
            best_ratio = ratio
            best_match = chunk

    return best_match
>>>>>>> REPLACE
</source>

This function:

1. Iterates through the content, considering each chunk of text the same length as the original
2. Calculates the SequenceMatcher ratio between the original text and each chunk
3. Keeps track of the chunk with the highest ratio
4. Returns the chunk of content that best matches the original text

It will return the portion of `content` that is the closest fuzzy match to `original`.

Let me know if you have any other questions!
2024-05-11 10:43:40 -07:00
Paul Gauthier
6d39e2c857 Replaced find_similar_lines with find_similar_text in the EditBlockCoder class. 2024-05-11 10:43:38 -07:00
Paul Gauthier
587ba4d676 Added functionality to suggest similar lines when a search block fails to match in EditBlockCoder. 2024-05-11 10:38:44 -07:00
Paul Gauthier
785259b59c try patching any of the other files in the chat 2024-05-11 10:33:46 -07:00
Paul Gauthier
5ec441dd2c More clear feedback when SEARCH/REPLACE blocks fail to match 2024-05-11 10:25:16 -07:00
Paul Gauthier
478b5c8e7c improved utils.split_chat_history_markdown 2024-05-11 08:06:16 -07:00
Paul Gauthier
602a0c7c31 refac utils.split_chat_history_markdown 2024-05-11 07:52:06 -07:00
Paul Gauthier
9fac20e432 Updated HISTORY 2024-05-11 07:49:58 -07:00
paul-gauthier
45b2ba8a10
Merge pull request #591 from paul-gauthier/restore-chat-history
Restore prior chat history on launch
2024-05-11 07:49:43 -07:00
Paul Gauthier
1098b428e6 prompt tweaks, retry on httpx.ReadTimeout 2024-05-11 07:47:53 -07:00
Paul Gauthier
3171789b1f look for mentions with trailing : 2024-05-10 19:38:05 -07:00
Paul Gauthier
4a0c0a3913 Recommend pipx upgrade command 2024-05-10 12:07:22 -07:00
Paul Gauthier
738c514168 set version to 0.34.1-dev 2024-05-10 09:15:04 -07:00
Paul Gauthier
6a452c3401 version bump to 0.34.0 2024-05-10 09:14:30 -07:00
Paul Gauthier
b2618d8bf4 Updated HISTORY 2024-05-10 09:10:54 -07:00
Paul Gauthier
bb93c2a903 fixed tests 2024-05-09 14:35:57 -07:00
Paul Gauthier
728a629789 Catch and appropriately retry *all* litellm exceptions #598 2024-05-09 14:16:09 -07:00
Paul Gauthier
b158e1c230 copy 2024-05-09 14:07:28 -07:00