diff --git a/aider/prompts.py b/aider/prompts.py index 84ed75e9b..aecf29a9e 100644 --- a/aider/prompts.py +++ b/aider/prompts.py @@ -13,11 +13,13 @@ Generate a one-line commit message for those changes. The commit message should be structured as follows: : Use these for : fix, feat, build, chore, ci, docs, style, refactor, perf, test -Ensure the commit message: +Ensure the commit message:{language_instruction} - Starts with the appropriate prefix. - Is in the imperative mood (e.g., \"add feature\" not \"added feature\" or \"adding feature\"). - Does not exceed 72 characters. +Reply only with the one-line commit message, without any additional text, explanations, or line breaks. + Reply only with the one-line commit message, without any additional text, explanations, \ or line breaks. """ diff --git a/aider/repo.py b/aider/repo.py index 0438f2243..809c8e375 100644 --- a/aider/repo.py +++ b/aider/repo.py @@ -207,7 +207,12 @@ class GitRepo: if message: commit_message = message else: - commit_message = self.get_commit_message(diffs, context) + user_language = None + if coder: + user_language = coder.get_user_language() + commit_message = self.get_commit_message(diffs, context, user_language) + + # Retrieve attribute settings, prioritizing coder.args if available if coder and hasattr(coder, "args"): @@ -319,7 +324,7 @@ class GitRepo: except (ValueError, OSError): return self.repo.git_dir - def get_commit_message(self, diffs, context): + def get_commit_message(self, diffs, context, user_language=None): diffs = "# Diffs:\n" + diffs content = "" @@ -328,6 +333,11 @@ class GitRepo: content += diffs system_content = self.commit_prompt or prompts.commit_system + language_instruction = "" + if user_language: + language_instruction = f"\n- Is written in {user_language}." + system_content = system_content.format(language_instruction=language_instruction) + messages = [ dict(role="system", content=system_content), dict(role="user", content=content),