feat: Refine magit gptcommit prompt
This commit is contained in:
parent
993bf9fa3e
commit
c40bc23359
1 changed files with 52 additions and 0 deletions
|
@ -369,9 +369,61 @@
|
|||
("C-c C-g" . magit-gptcommit-commit-accept))
|
||||
:init
|
||||
(require 'llm-openai)
|
||||
|
||||
;; Helper function for writing a prompt for Magit GPTCommit
|
||||
(defun join-with-newlines (list)
|
||||
(mapconcat 'identity list "\n"))
|
||||
|
||||
:custom
|
||||
(llm-warn-on-nonfree nil)
|
||||
(magit-gptcommit-llm-provider (make-llm-openai-compatible :key "OPENAI-KEY" :url "http://100.64.0.3:18082/v1/"))
|
||||
|
||||
;; TODO Test different prompts
|
||||
(magit-gptcommit-prompt
|
||||
(join-with-newlines
|
||||
'(
|
||||
"You are an expert programmer writing a commit message"
|
||||
"You went over every file diff that was changed in it."
|
||||
|
||||
"First Determine the best label for the diffs."
|
||||
"Here are the labels you can choose from:"
|
||||
"- build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)"
|
||||
"- chore: Updating libraries, copyrights or other repo setting, includes updating dependencies."
|
||||
"- ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, GitHub Actions)"
|
||||
"- docs: Non-code changes, such as fixing typos or adding new documentation"
|
||||
"- feat: a commit of the type feat introduces a new feature to the codebase"
|
||||
"- fix: A commit of the type fix patches a bug in your codebase"
|
||||
"- perf: A code change that improves performance"
|
||||
"- refactor: A code change that neither fixes a bug nor adds a feature"
|
||||
"- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)"
|
||||
"- test: Adding missing tests or correcting existing tests"
|
||||
""
|
||||
"Then summarize the commit into a single specific and cohesive theme."
|
||||
"Remember to write a one line summary, no more than 50 characters."
|
||||
"If it is a simple change no need for additional lines."
|
||||
"If there are multiple unrelated or complicated changes summarize them into bullet points"
|
||||
"Remember to write an empty line between the summary and bullet points."
|
||||
""
|
||||
"Write your response using the imperative tense following the kernel git commit style guide."
|
||||
"Write a high level title."
|
||||
""
|
||||
"# Example 1:"
|
||||
"refactor: Rework transaction merging logic"
|
||||
""
|
||||
"- use functional style instead of nested for loops"
|
||||
"- cache intermediate results"
|
||||
"- use refs instead of cloning everywhere"
|
||||
""
|
||||
"# Example 2:"
|
||||
"fix: Fix off-by-one integer in loop"
|
||||
"# Example 3:"
|
||||
"style: Add missing semicolon"
|
||||
"THE FILE DIFFS:"
|
||||
"```"
|
||||
"%s"
|
||||
"```"
|
||||
"Now write Commit message in follow template: [label]:[one line of summary] :"
|
||||
)))
|
||||
;; :init
|
||||
;; (setq magit-gptcommit-llm-provider (make-llm-openai-compatible :key "OPENAI-KEY" :url "http://100.64.0.3:8080/v1/"))
|
||||
:config
|
||||
|
|
Loading…
Add table
Reference in a new issue