Merge branch 'main' into issue-73

This commit is contained in:
Paul Gauthier 2023-07-11 09:36:34 -07:00
commit 1f83a89192
5 changed files with 44 additions and 13 deletions

View file

@ -3,6 +3,10 @@
### Next release ### Next release
- Added `--dark-mode` to select colors suitable for a dark terminal background - Added `--dark-mode` to select colors suitable for a dark terminal background
- Reorganized the `--help` output
- Bugfix so that aider throws an exception when OpenAI returns InvalidRequest
- Bugfix/improvement to /add and /drop to recurse selected directories
- Bugfix for live diff output when using "whole" edit format
### v0.8.2 ### v0.8.2

View file

@ -176,4 +176,8 @@ This minimizes your use of the context window, as well as costs.
* "Aider ... has easily quadrupled my coding productivity." -- [SOLAR_FIELDS](https://news.ycombinator.com/item?id=36212100) * "Aider ... has easily quadrupled my coding productivity." -- [SOLAR_FIELDS](https://news.ycombinator.com/item?id=36212100)
* "What an amazing tool. It's incredible." -- [valyagolev](https://github.com/paul-gauthier/aider/issues/6#issue-1722897858) * "What an amazing tool. It's incredible." -- [valyagolev](https://github.com/paul-gauthier/aider/issues/6#issue-1722897858)
* "It was WAY faster than I would be getting off the ground and making the first few working versions." -- [Daniel Feldman](https://twitter.com/d_feldman/status/1662295077387923456) * "It was WAY faster than I would be getting off the ground and making the first few working versions." -- [Daniel Feldman](https://twitter.com/d_feldman/status/1662295077387923456)
* "Amazing project, definitely the best AI coding assistant I've used." -- [joshuavial](https://github.com/paul-gauthier/aider/issues/84)
## FAQ
For more information, see the [FAQ](https://aider.chat/docs/faq.html).

View file

@ -58,7 +58,7 @@ class WholeFileCoder(Coder):
full_path = (Path(self.root) / fname).absolute() full_path = (Path(self.root) / fname).absolute()
if mode == "diff": if mode == "diff":
output += self.do_live_diff(full_path, new_lines) output += self.do_live_diff(full_path, new_lines, True)
else: else:
edits.append((fname, fname_source, new_lines)) edits.append((fname, fname_source, new_lines))
@ -105,7 +105,7 @@ class WholeFileCoder(Coder):
if fname is not None: if fname is not None:
# ending an existing block # ending an existing block
full_path = (Path(self.root) / fname).absolute() full_path = (Path(self.root) / fname).absolute()
output += self.do_live_diff(full_path, new_lines) output += self.do_live_diff(full_path, new_lines, False)
return "\n".join(output) return "\n".join(output)
if fname: if fname:
@ -128,14 +128,14 @@ class WholeFileCoder(Coder):
return edited return edited
def do_live_diff(self, full_path, new_lines): def do_live_diff(self, full_path, new_lines, final):
if full_path.exists(): if full_path.exists():
orig_lines = self.io.read_text(full_path).splitlines(keepends=True) orig_lines = self.io.read_text(full_path).splitlines(keepends=True)
show_diff = diffs.diff_partial_update( show_diff = diffs.diff_partial_update(
orig_lines, orig_lines,
new_lines, new_lines,
final=True, final=final,
).splitlines() ).splitlines()
output = show_diff output = show_diff
else: else:

View file

@ -6,8 +6,8 @@
Aider does not officially support use with LLMs other than OpenAI's gpt-3.5-turbo and gpt-4 Aider does not officially support use with LLMs other than OpenAI's gpt-3.5-turbo and gpt-4
and their variants. and their variants.
It generally requires some model-specific tuning to get prompts and It seems to require model-specific tuning to get prompts and
editing formats working well. For example, GPT-3.5 and GPT-4 use very editing formats working well with a new model. For example, GPT-3.5 and GPT-4 use very
different prompts and editing formats in aider right now. different prompts and editing formats in aider right now.
Adopting new LLMs will probably require a similar effort to tailor the Adopting new LLMs will probably require a similar effort to tailor the
prompting and edit formats. prompting and edit formats.
@ -16,11 +16,13 @@ That said, aider does provide some features to experiment with other models.
If you can make the model accessible via an OpenAI compatible API, If you can make the model accessible via an OpenAI compatible API,
you can use `--openai-api-base` to connect to a different API endpoint. you can use `--openai-api-base` to connect to a different API endpoint.
Here is are some Here are some
[GitHub issues which may contain relevant information](https://github.com/paul-gauthier/aider/issues?q=is%3Aissue+%22openai-api-base%22+). [GitHub issues which may contain relevant information](https://github.com/paul-gauthier/aider/issues?q=is%3Aissue+%22openai-api-base%22+).
[LocalAI](https://github.com/go-skynet/LocalAI) [LocalAI](https://github.com/go-skynet/LocalAI)
looks like a relevant tool to serve many local models via a compatible API: and
[SimpleAI](https://github.com/lhenault/simpleAI)
look like relevant tools to serve local models via a compatible API:
## Can I change the system prompts that aider uses? ## Can I change the system prompts that aider uses?
@ -49,6 +51,8 @@ has provided this
## How do I get ctags working? ## How do I get ctags working?
First, be aware that ctags is completely optional and not required to use aider. First, be aware that ctags is completely optional and not required to use aider.
Aider only attempts to use ctags with GPT-4,
and currently doesn't use ctags with GPT-3.5.
If you wish to use ctags, you should consult the If you wish to use ctags, you should consult the
[universal ctags repo](https://github.com/universal-ctags/ctags) [universal ctags repo](https://github.com/universal-ctags/ctags)

View file

@ -8,6 +8,7 @@ from unittest.mock import MagicMock, patch
from aider import models from aider import models
from aider.coders import Coder from aider.coders import Coder
from aider.coders.wholefile_coder import WholeFileCoder from aider.coders.wholefile_coder import WholeFileCoder
from aider.dump import dump # noqa: F401
from aider.io import InputOutput from aider.io import InputOutput
@ -76,6 +77,24 @@ class TestWholeFileCoder(unittest.TestCase):
updated_content = f.read() updated_content = f.read()
self.assertEqual(updated_content, "Updated content\n") self.assertEqual(updated_content, "Updated content\n")
def test_update_files_live_diff(self):
# Create a sample file in the temporary directory
sample_file = "sample.txt"
with open(sample_file, "w") as f:
f.write("\n".join(map(str, range(0, 100))))
# Initialize WholeFileCoder with the temporary directory
io = InputOutput(yes=True)
coder = WholeFileCoder(main_model=models.GPT35, io=io, fnames=[sample_file])
# Set the partial response content with the updated content
coder.partial_response_content = f"{sample_file}\n```\n0\n\1\n2\n"
lines = coder.update_files(mode="diff").splitlines()
# the live diff should be concise, since we haven't changed anything yet
self.assertLess(len(lines), 20)
def test_update_files_with_existing_fence(self): def test_update_files_with_existing_fence(self):
# Create a sample file in the temporary directory # Create a sample file in the temporary directory
sample_file = "sample.txt" sample_file = "sample.txt"