Merge branch 'main' into gitignore

This commit is contained in:
Paul Gauthier 2023-07-16 18:06:01 -03:00
commit 6f7936e5f8
6 changed files with 41 additions and 4 deletions

View file

@ -1,5 +1,9 @@
# Release history # Release history
### GitHub main branch
-
### v0.9.0 ### v0.9.0
- Support for the OpenAI models in [Azure](https://aider.chat/docs/faq.html#azure) - Support for the OpenAI models in [Azure](https://aider.chat/docs/faq.html#azure)

View file

@ -115,7 +115,7 @@ Aider has some ability to help GPT figure out which files to edit all by itself,
* Large changes are best performed as a sequence of thoughtful bite sized steps, where you plan out the approach and overall design. Walk GPT through changes like you might with a junior dev. Ask for a refactor to prepare, then ask for the actual change. Spend the time to ask for code quality/structure improvements. * Large changes are best performed as a sequence of thoughtful bite sized steps, where you plan out the approach and overall design. Walk GPT through changes like you might with a junior dev. Ask for a refactor to prepare, then ask for the actual change. Spend the time to ask for code quality/structure improvements.
* Use Control-C to safely interrupt GPT if it isn't providing a useful response. The partial response remains in the conversation, so you can refer to it when you reply to GPT with more information or direction. * Use Control-C to safely interrupt GPT if it isn't providing a useful response. The partial response remains in the conversation, so you can refer to it when you reply to GPT with more information or direction.
* Use the `/run` command to run tests, linters, etc and show the output to GPT so it can fix any issues. * Use the `/run` command to run tests, linters, etc and show the output to GPT so it can fix any issues.
* Enter a multiline chat message by entering `{` alone on the first line. End the multiline message with `}` alone on the last line. * Use Meta-ENTER (Esc+ENTER in some environments) to enter multiline chat messages. Or enter `{` alone on the first line to start a multiline message and `}` alone on the last line to end it.
* If your code is throwing an error, share the error output with GPT using `/run` or by pasting it into the chat. Let GPT figure out and fix the bug. * If your code is throwing an error, share the error output with GPT using `/run` or by pasting it into the chat. Let GPT figure out and fix the bug.
* GPT knows about a lot of standard tools and libraries, but may get some of the fine details wrong about APIs and function arguments. You can paste doc snippets into the chat to resolve these issues. * GPT knows about a lot of standard tools and libraries, but may get some of the fine details wrong about APIs and function arguments. You can paste doc snippets into the chat to resolve these issues.
* [Aider will notice if you launch it on a git repo with uncommitted changes and offer to commit them before proceeding](https://aider.chat/docs/faq.html#how-does-aider-use-git). * [Aider will notice if you launch it on a git repo with uncommitted changes and offer to commit them before proceeding](https://aider.chat/docs/faq.html#how-does-aider-use-git).

View file

@ -407,8 +407,8 @@ class Coder:
if cmds: if cmds:
matching_commands, _, _ = cmds matching_commands, _, _ = cmds
if len(matching_commands) == 1: if len(matching_commands) == 1:
cmd = matching_commands[0] cmd = matching_commands[0][1:]
if cmd in ("/exit", "/commit"): if cmd in "add clear commit diff drop exit help ls tokens".split():
return return
if not self.dirty_commits: if not self.dirty_commits:

View file

@ -5,6 +5,7 @@ from pathlib import Path
from prompt_toolkit.completion import Completer, Completion from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.history import FileHistory from prompt_toolkit.history import FileHistory
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.lexers import PygmentsLexer from prompt_toolkit.lexers import PygmentsLexer
from prompt_toolkit.shortcuts import CompleteStyle, PromptSession, prompt from prompt_toolkit.shortcuts import CompleteStyle, PromptSession, prompt
from prompt_toolkit.styles import Style from prompt_toolkit.styles import Style
@ -203,7 +204,13 @@ class InputOutput:
if self.input_history_file is not None: if self.input_history_file is not None:
session_kwargs["history"] = FileHistory(self.input_history_file) session_kwargs["history"] = FileHistory(self.input_history_file)
session = PromptSession(**session_kwargs) kb = KeyBindings()
@kb.add("escape", "c-m", eager=True)
def _(event):
event.current_buffer.insert_text("\n")
session = PromptSession(key_bindings=kb, **session_kwargs)
line = session.prompt() line = session.prompt()
if line and line[0] == "{" and not multiline_input: if line and line[0] == "{" and not multiline_input:

View file

@ -1,6 +1,12 @@
# Installing aider # Installing aider
- [pip install aider-chat](#pip-install-aider-chat)
- [Provide your OpenAI API key](#provide-your-openai-api-key)
- [Install git](#install-git)
- [Install universal ctags (optional)](#install-universal-ctags-optional)
- [Add aider to your editor (optional)](#add-aider-to-your-editor-optional)
## pip install aider-chat ## pip install aider-chat
Install the “aider-chat” package with pip from one of these sources: Install the “aider-chat” package with pip from one of these sources:

View file

@ -24,6 +24,26 @@ class TestCoder(unittest.TestCase):
def tearDown(self): def tearDown(self):
self.patcher.stop() self.patcher.stop()
def test_should_dirty_commit(self):
# Mock the IO object
mock_io = MagicMock()
with GitTemporaryDirectory():
repo = git.Repo(Path.cwd())
fname = Path("new.txt")
fname.touch()
repo.git.add(str(fname))
repo.git.commit("-m", "new")
# Initialize the Coder object with the mocked IO and mocked repo
coder = Coder.create(models.GPT4, None, mock_io)
fname.write_text("hi")
self.assertTrue(coder.should_dirty_commit("hi"))
self.assertFalse(coder.should_dirty_commit("/exit"))
self.assertFalse(coder.should_dirty_commit("/help"))
def test_check_for_file_mentions(self): def test_check_for_file_mentions(self):
# Mock the IO object # Mock the IO object
mock_io = MagicMock() mock_io = MagicMock()