fix: resolve CI build failures
This commit is contained in:
30
git_commit_ai/core/prompt_builder.py
Normal file
30
git_commit_ai/core/prompt_builder.py
Normal file
@@ -0,0 +1,30 @@
|
||||
CONVENTIONAL_PROMPT = """Generate a conventional commit message for these changes.
|
||||
Format: <type>(<scope>): <description>
|
||||
|
||||
Types: feat, fix, docs, style, refactor, test, chore
|
||||
|
||||
Changes:
|
||||
{diff}
|
||||
|
||||
Recent commits for context:
|
||||
{history}
|
||||
|
||||
Respond with only the commit message."""
|
||||
|
||||
DEFAULT_PROMPT = """Generate a concise commit message for these changes.
|
||||
|
||||
Changes:
|
||||
{diff}
|
||||
|
||||
Recent commits for context:
|
||||
{history}
|
||||
|
||||
Respond with only the commit message."""
|
||||
|
||||
def build_prompt(diff, conventional=False, history=None):
|
||||
"""Build prompt for commit message generation."""
|
||||
diff_text = "\n".join(diff) if isinstance(diff, list) else str(diff)
|
||||
history_text = "\n".join(history) if history else "No previous commits"
|
||||
|
||||
template = CONVENTIONAL_PROMPT if conventional else DEFAULT_PROMPT
|
||||
return template.format(diff=diff_text, history=history_text)
|
||||
Reference in New Issue
Block a user