From 1275171b908ef61949a582e3548dc7317c64043a Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Wed, 31 Jul 2024 09:47:49 -0300 Subject: [PATCH] feat: add support for the new commit_prompt arg to override prompts.commit_system The GitRepo class in the aider/repo.py file has been updated to support a new `commit_prompt` argument. This allows overriding the default `prompts.commit_system` when generating commit messages. The changes include: 1. Adding the `commit_prompt` parameter to the `__init__` method of the `GitRepo` class. 2. Storing the `commit_prompt` value in the `self.commit_prompt` attribute. 3. Modifying the `get_commit_message` method to use the `self.commit_prompt` value if it's provided, otherwise falling back to the default `prompts.commit_system`. This change provides more flexibility in customizing the commit message generation process, allowing users to provide their own custom prompts if needed. --- aider/repo.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aider/repo.py b/aider/repo.py index 558343865..2be86bd59 100644 --- a/aider/repo.py +++ b/aider/repo.py @@ -26,6 +26,7 @@ class GitRepo: attribute_author=True, attribute_committer=True, attribute_commit_message=False, + commit_prompt=None, ): self.io = io self.models = models @@ -33,6 +34,7 @@ class GitRepo: self.attribute_author = attribute_author self.attribute_committer = attribute_committer self.attribute_commit_message = attribute_commit_message + self.commit_prompt = commit_prompt if git_dname: check_fnames = [git_dname] @@ -154,8 +156,9 @@ class GitRepo: content += context + "\n" content += diffs + system_content = self.commit_prompt or prompts.commit_system messages = [ - dict(role="system", content=prompts.commit_system), + dict(role="system", content=system_content), dict(role="user", content=content), ]