Skip to content

Commit

Permalink
Merge branch 'Aider-AI:main' into moa
Browse files Browse the repository at this point in the history
  • Loading branch information
gembancud authored Jan 21, 2025
2 parents a3be0db + 2873f6c commit 42737c4
Show file tree
Hide file tree
Showing 49 changed files with 1,435 additions and 735 deletions.
38 changes: 33 additions & 5 deletions .github/workflows/docker-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ on:
push:
paths-ignore:
- 'aider/website/**'
- README.md
- HISTORY.md
- 'README.md'
- 'HISTORY.md'
- '.github/workflows/*'
- '!.github/workflows/docker-build-test.yml'
branches:
- main
pull_request:
paths-ignore:
- 'aider/website/**'
- README.md
- 'README.md'
- 'HISTORY.md'
- '.github/workflows/*'
- '!.github/workflows/docker-build-test.yml'
branches:
- main

Expand All @@ -31,12 +36,24 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push Docker images
- name: Build Docker images (PR)
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: false
target: aider

- name: Build Docker images (Push)
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v5
with:
context: .
Expand All @@ -46,7 +63,18 @@ jobs:
tags: ${{ secrets.DOCKERHUB_USERNAME }}/aider:dev
target: aider

- name: Build and push Docker full image
- name: Build Docker full image (PR)
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: false
target: aider-full

- name: Build Docker full image (Push)
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v5
with:
context: .
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- "main"
paths:
- "aider/website/**"
- ".github/workflows/pages.yml"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -55,10 +56,9 @@ jobs:
env:
JEKYLL_ENV: production
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: "aider/website/_site/"
path: "aider/website/_site"

# Deployment job
deploy:
Expand All @@ -70,7 +70,7 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/ubuntu-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ on:
push:
paths-ignore:
- 'aider/website/**'
- README.md
- HISTORY.md
- 'README.md'
- 'HISTORY.md'
- '.github/workflows/*'
- '!.github/workflows/ubuntu-tests.yml'
branches:
- main
pull_request:
paths-ignore:
- 'aider/website/**'
- README.md
- 'README.md'
- 'HISTORY.md'
- '.github/workflows/*'
- '!.github/workflows/ubuntu-tests.yml'
branches:
- main

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/windows-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ on:
push:
paths-ignore:
- 'aider/website/**'
- README.md
- HISTORY.md
- 'README.md'
- 'HISTORY.md'
- '.github/workflows/*'
- '!.github/workflows/windows-tests.yml'
branches:
- main
pull_request:
paths-ignore:
- 'aider/website/**'
- README.md
- 'README.md'
- 'HISTORY.md'
- '.github/workflows/*'
- '!.github/workflows/windows-tests.yml'
branches:
- main

Expand Down
19 changes: 17 additions & 2 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
# Release history

### v0.72.1

- Fix model metadata for `openrouter/deepseek/deepseek-r1`

### v0.72.0

- Support for DeepSeek R1.
- Use shortcut: `--model r1`
- Also via OpenRouter: `--model openrouter/deepseek/deepseek-r1`
- Added Kotlin syntax support to repo map, by Paul Walker.
- Added `--line-endings` for file writing, by Titusz Pan.
- Added examples_as_sys_msg=True for GPT-4o models, improves benchmark scores.
- Bumped all dependencies, to pick up litellm support for o1 system messages.
- Bugfix for turn taking when reflecting lint/test errors.
- Aider wrote 52% of the code in this release.

### Aider v0.71.1

- Fix permissions issue in Docker images.
- Added read-only file announcements to chat.
- Added read-only file announcements.
- Bugfix: ASCII fallback for unicode errors.
- Bugfix: integer indices for list slicing in repomap calculations.
- Aider wrote 83% of the code in this release.

### Aider v0.71.0

Expand Down
2 changes: 1 addition & 1 deletion aider/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from packaging import version

__version__ = "0.71.2.dev"
__version__ = "0.72.2.dev"
safe_version = __version__

try:
Expand Down
6 changes: 6 additions & 0 deletions aider/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,12 @@ def get_parser(default_config_files, git_root):
default="utf-8",
help="Specify the encoding for input and output (default: utf-8)",
)
group.add_argument(
"--line-endings",
choices=["platform", "lf", "crlf"],
default="platform",
help="Line endings to use when writing files (default: platform)",
)
group.add_argument(
"-c",
"--config",
Expand Down
16 changes: 9 additions & 7 deletions aider/coders/base_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ def __init__(

self.summarizer_thread = None
self.summarized_done_messages = []
self.summarizing_messages = None

if not self.done_messages and restore_chat_history:
history_md = self.io.read_text(self.io.chat_history_file)
Expand Down Expand Up @@ -957,8 +958,9 @@ def summarize_start(self):
self.summarizer_thread.start()

def summarize_worker(self):
self.summarizing_messages = list(self.done_messages)
try:
self.summarized_done_messages = self.summarizer.summarize(self.done_messages)
self.summarized_done_messages = self.summarizer.summarize(self.summarizing_messages)
except ValueError as err:
self.io.tool_warning(err.args[0])

Expand All @@ -972,7 +974,9 @@ def summarize_end(self):
self.summarizer_thread.join()
self.summarizer_thread = None

self.done_messages = self.summarized_done_messages
if self.summarizing_messages == self.done_messages:
self.done_messages = self.summarized_done_messages
self.summarizing_messages = None
self.summarized_done_messages = []

def move_back_cur_messages(self, message):
Expand Down Expand Up @@ -1346,6 +1350,8 @@ def send_message(self, inp):
self.num_exhausted_context_windows += 1
return

self.add_assistant_reply_to_cur_messages()

if self.partial_response_function_call:
args = self.parse_partial_args()
if args:
Expand Down Expand Up @@ -1378,8 +1384,6 @@ def send_message(self, inp):

edited = self.apply_updates()

self.update_cur_messages()

if edited:
self.aider_edited_files.update(edited)
saved_message = self.auto_commit(edited)
Expand All @@ -1400,7 +1404,6 @@ def send_message(self, inp):
ok = self.io.confirm_ask("Attempt to fix lint errors?")
if ok:
self.reflected_message = lint_errors
self.update_cur_messages()
return

shared_output = self.run_shell_commands()
Expand All @@ -1417,7 +1420,6 @@ def send_message(self, inp):
ok = self.io.confirm_ask("Attempt to fix test errors?")
if ok:
self.reflected_message = test_errors
self.update_cur_messages()
return

def reply_completed(self):
Expand Down Expand Up @@ -1493,7 +1495,7 @@ def lint_edited(self, fnames):

return res

def update_cur_messages(self):
def add_assistant_reply_to_cur_messages(self):
if self.partial_response_content:
self.cur_messages += [dict(role="assistant", content=self.partial_response_content)]
if self.partial_response_function_call:
Expand Down
2 changes: 1 addition & 1 deletion aider/coders/single_wholefile_func_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, *args, **kwargs):
self.gpt_prompts = SingleWholeFileFunctionPrompts()
super().__init__(*args, **kwargs)

def update_cur_messages(self, edited):
def add_assistant_reply_to_cur_messages(self, edited):
if edited:
self.cur_messages += [
dict(role="assistant", content=self.gpt_prompts.redacted_edit_message)
Expand Down
2 changes: 1 addition & 1 deletion aider/coders/wholefile_func_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, *args, **kwargs):
self.gpt_prompts = WholeFileFunctionPrompts()
super().__init__(*args, **kwargs)

def update_cur_messages(self, edited):
def add_assistant_reply_to_cur_messages(self, edited):
if edited:
self.cur_messages += [
dict(role="assistant", content=self.gpt_prompts.redacted_edit_message)
Expand Down
2 changes: 1 addition & 1 deletion aider/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ def cmd_code(self, args):
return self._generic_chat_command(args, self.coder.main_model.edit_format)

def cmd_architect(self, args):
"""Enter architect mode to discuss high-level design and architecture. If no prompt provided, switches to architect mode.""" # noqa
"""Enter architect/editor mode using 2 different models. If no prompt provided, switches to architect/editor mode.""" # noqa
return self._generic_chat_command(args, "architect")

def _generic_chat_command(self, args, edit_format):
Expand Down
8 changes: 7 additions & 1 deletion aider/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ def tokenize(self, messages):
return sized

def summarize(self, messages, depth=0):
messages = self.summarize_real(messages)
if messages and messages[-1]["role"] != "assistant":
messages.append(dict(role="assistant", content="Ok."))
return messages

def summarize_real(self, messages, depth=0):
if not self.models:
raise ValueError("No models available for summarization")

Expand Down Expand Up @@ -88,7 +94,7 @@ def summarize(self, messages, depth=0):
if summary_tokens + tail_tokens < self.max_tokens:
return result

return self.summarize(result, depth + 1)
return self.summarize_real(result, depth + 1)

def summarize_all(self, messages):
content = ""
Expand Down
20 changes: 15 additions & 5 deletions aider/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def __init__(
completion_menu_current_bg_color=None,
code_theme="default",
encoding="utf-8",
line_endings="platform",
dry_run=False,
llm_history_file=None,
editingmode=EditingMode.EMACS,
Expand Down Expand Up @@ -244,6 +245,15 @@ def __init__(
self.chat_history_file = None

self.encoding = encoding
valid_line_endings = {"platform", "lf", "crlf"}
if line_endings not in valid_line_endings:
raise ValueError(
f"Invalid line_endings value: {line_endings}. "
f"Must be one of: {', '.join(valid_line_endings)}"
)
self.newline = (
None if line_endings == "platform" else "\n" if line_endings == "lf" else "\r\n"
)
self.dry_run = dry_run

current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
Expand Down Expand Up @@ -342,10 +352,6 @@ def read_text(self, filename, silent=False):
try:
with open(str(filename), "r", encoding=self.encoding) as f:
return f.read()
except OSError as err:
if not silent:
self.tool_error(f"{filename}: unable to read: {err}")
return
except FileNotFoundError:
if not silent:
self.tool_error(f"{filename}: file not found error")
Expand All @@ -354,6 +360,10 @@ def read_text(self, filename, silent=False):
if not silent:
self.tool_error(f"{filename}: is a directory")
return
except OSError as err:
if not silent:
self.tool_error(f"{filename}: unable to read: {err}")
return
except UnicodeError as e:
if not silent:
self.tool_error(f"{filename}: {e}")
Expand All @@ -375,7 +385,7 @@ def write_text(self, filename, content, max_retries=5, initial_delay=0.1):
delay = initial_delay
for attempt in range(max_retries):
try:
with open(str(filename), "w", encoding=self.encoding) as f:
with open(str(filename), "w", encoding=self.encoding, newline=self.newline) as f:
f.write(content)
return # Successfully wrote the file
except PermissionError as err:
Expand Down
1 change: 1 addition & 0 deletions aider/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ def get_io(pretty):
code_theme=args.code_theme,
dry_run=args.dry_run,
encoding=args.encoding,
line_endings=args.line_endings,
llm_history_file=args.llm_history_file,
editingmode=editing_mode,
fancy_input=args.fancy_input,
Expand Down
Loading

0 comments on commit 42737c4

Please sign in to comment.