Package io.github.jbastgen.stemma.app.ai
Class CommitSummary
java.lang.Object
io.github.jbastgen.stemma.app.ai.CommitSummary
The description of one or several commits: builds the prompt (from the editable template and the commit data) and
reads the answer. The answer is asked for in a simple fixed shape (
HEADLINE:, TYPE:,
SUMMARY:, FILES:); an answer in another shape is still shown, as the summary.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe prompt of the built-in default template.The kinds of change the model is asked to choose from; they match the default labels. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildPrompt(String template, String repo, String branch, List<CommitData> commits, AiConfig config) Fills the template.static StringbuildPrompt(String template, String repo, String branch, List<CommitData> commits, AiConfig config, String language) As above;languageis the English name of the language the answer is written in ({language}of the template; empty = the language of the commit messages).static CommitSummary.SummaryReads the answer; never fails: whatever does not fit the shape becomes the summary text.
-
Field Details
-
TYPES
The kinds of change the model is asked to choose from; they match the default labels. -
TEMPLATE_NAME
The prompt of the built-in default template.- See Also:
-
-
Method Details
-
buildPrompt
public static String buildPrompt(String template, String repo, String branch, List<CommitData> commits, AiConfig config) Fills the template.{repo},{branch},{commits}(author, date and message of each commit) and{diff}(the changes, shared out so that the whole prompt stays within the size limit) are replaced. Files that match the privacy patterns never appear, not even by name. -
buildPrompt
public static String buildPrompt(String template, String repo, String branch, List<CommitData> commits, AiConfig config, String language) As above;languageis the English name of the language the answer is written in ({language}of the template; empty = the language of the commit messages). A template that has no{language}gets a closing sentence, so the choice applies to it too. -
parse
Reads the answer; never fails: whatever does not fit the shape becomes the summary text.
-