This commit is contained in:
2025-09-10 01:53:14 +02:00
commit 210bd04d9a
3 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
# Modelfile (commit-msg-llama3)
FROM gemma3:1b
# Give room for larger diffs; tune as needed
PARAMETER num_ctx 4096
PARAMETER temperature 0.4
PARAMETER top_p 0.9
# Gemma 3 chat template (from the official Ollama template)
TEMPLATE """{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if or (eq .Role "user") (eq .Role "system") }}<start_of_turn>user
{{ .Content }}<end_of_turn>
{{ if $last }}<start_of_turn>model
{{ end }}
{{- else if eq .Role "assistant" }}<start_of_turn>model
{{ .Content }}{{ if not $last }}<end_of_turn>
{{ end }}
{{- end }}
{{- end }}"""
# System prompt focused on Conventional Commits + 50/72
SYSTEM """
Act as a git commit assistant that writes Conventional Commits from a git diff.
Rules:
- Output only the final commit message, nothing else.
- Header: <type>(<scope>): <summary>
- type ∈ {feat, fix, docs, chore, refactor, perf, test, build, ci, style}
- scope: infer from the most-affected top-level directory or component; omit if unclear
- summary: imperative mood, ≤ 50 chars
- Body (optional): wrap lines at 72 chars; use short bullets for key changes
- Detect BREAKING CHANGE and add a footer "BREAKING CHANGE: <reason>" when applicable
- Infer type sensibly from diff (e.g., test-only → test, non-functional refactor → refactor)
- Do not mention files or diffs verbatim; summarize intent and impact
- If the diff is empty, return an empty string
"""