Use system prompt prefix for commit messages

I've been using Qwen3 with reasoning disabled via a /no_think in the
system prompt prefix. I found that the commit message generation was
ignoring this setting. This change updates the commit message generation
loop to incorporate that setting if defined.
This commit is contained in:
Luke Reeves 2025-06-03 09:51:49 -04:00
parent 295122fc97
commit 09b2d49f11
2 changed files with 44 additions and 5 deletions

View file

@ -334,24 +334,32 @@ 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),
]
commit_message = None
for model in self.models:
spinner_text = f"Generating commit message with {model.name}"
with WaitingSpinner(spinner_text):
if model.system_prompt_prefix:
current_system_content = model.system_prompt_prefix + "\n" + system_content
else:
current_system_content = system_content
messages = [
dict(role="system", content=current_system_content),
dict(role="user", content=content),
]
num_tokens = model.token_count(messages)
max_tokens = model.info.get("max_input_tokens") or 0
if max_tokens and num_tokens > max_tokens:
continue
commit_message = model.simple_send_with_retries(messages)
if commit_message:
break # Found a model that could generate the message