Package io.github.jbastgen.stemma.app.ai
Class PromptTemplates
java.lang.Object
io.github.jbastgen.stemma.app.ai.PromptTemplates
The texts Stemma puts around what it sends to an AI service. The defaults are built in; a template the user edited
is a file
<name>.txt in the prompts folder of the configuration, so it can be edited, copied and shared like
any file. Deleting the file (or "Reset" in the settings) brings the default back.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancustomised(String name) Whether the user changed the template.defaultText(String name) The ready-made text of the template.The template to use: the user's if there is one, else the default.names()The names of all templates, in display order.voidRemoves the user's text, so the ready-made one applies again.voidStores the user's text for the template.The name of the template shown to the user.static StringwithLanguage(String template, String language) Puts the language of the suggested message into a template:{language}is replaced by the name (empty = the language of the recent commit messages); a template that has no{language}(an older, edited one) gets a closing sentence.
-
Constructor Details
-
PromptTemplates
- Parameters:
dir- the folder of the templates the user changed; the ready-made ones are in the code
-
-
Method Details
-
names
The names of all templates, in display order. -
title
The name of the template shown to the user. -
defaultText
The ready-made text of the template. -
get
The template to use: the user's if there is one, else the default. -
customised
Whether the user changed the template. -
save
Stores the user's text for the template.- Throws:
IOException- for an unknown template or when the file cannot be written
-
reset
Removes the user's text, so the ready-made one applies again.- Throws:
IOException
-
withLanguage
Puts the language of the suggested message into a template:{language}is replaced by the name (empty = the language of the recent commit messages); a template that has no{language}(an older, edited one) gets a closing sentence.
-