Skip to content

Commit

Permalink
fix(prompts): description and content are swapped
Browse files Browse the repository at this point in the history
  • Loading branch information
Blarc committed Jul 19, 2024
1 parent 88c74f3 commit 5b5b47e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1,58 +1,60 @@
package com.github.blarc.ai.commits.intellij.plugin.settings.prompts

enum class DefaultPrompts(val title: String, val description: String, val content: String) {
enum class DefaultPrompts(val prompt: Prompt) {

// Generate UUIDs for game objects in Mine.py and call the function in start_game().
BASIC(
"Basic",
"Basic prompt that generates a decent commit message.",
"Write an insightful but concise Git commit message in a complete sentence in present tense for the " +
"following diff without prefacing it with anything, the response must be in the language {locale} and must " +
"NOT be longer than 74 characters. The sent text will be the differences between files, where deleted lines " +
"are prefixed with a single minus sign and added lines are prefixed with a single plus sign.\n" +
"{Use this hint to improve this commit message: \$hint\n}" +
"{diff}"
Prompt(
"Basic",
"Basic prompt that generates a decent commit message.",
"Write an insightful but concise Git commit message in a complete sentence in present tense for the " +
"following diff without prefacing it with anything, the response must be in the language {locale} and must " +
"NOT be longer than 74 characters. The sent text will be the differences between files, where deleted lines " +
"are prefixed with a single minus sign and added lines are prefixed with a single plus sign.\n" +
"{Use this hint to improve the commit message: \$hint}\n" +
"{diff}",
false
)
),

// feat: generate unique UUIDs for game objects on Mine game start
CONVENTIONAL(
"Conventional",
"Prompt for commit message in the conventional commit convention.",
"Write a commit message in the conventional commit convention. I'll send you an output " +
"of 'git diff --staged' command, and you convert it into a commit message. " +
"Lines must not be longer than 74 characters. Use {locale} language to answer. " +
"End commit title with issue number if you can get it from the branch name: " +
"{branch} in parenthesis.\n" +
"{Use this hint to improve this commit message: \$hint\n}" +
"{diff}",
Prompt(
"Conventional",
"Prompt for commit message in the conventional commit convention.",
"Write a commit message in the conventional commit convention. I'll send you an output " +
"of 'git diff --staged' command, and you convert it into a commit message. " +
"Lines must not be longer than 74 characters. Use {locale} language to answer. " +
"End commit title with issue number if you can get it from the branch name: " +
"{branch} in parenthesis.\n" +
"{Use this hint to improve the commit message: \$hint}\n" +
"{diff}",
false
)
),

// ✨ feat(mine): Generate objects UUIDs and start team timers on game start
EMOJI(
"Emoji",
"Prompt for commit message in the conventional commit convention with GitMoji convention.",
"Write a clean and comprehensive commit message in the conventional commit convention. " +
"I'll send you an output of 'git diff --staged' command, and you convert " +
"it into a commit message. " +
"Use GitMoji convention to preface the commit. " +
"Do NOT add any descriptions to the commit, only commit message. " +
"Use the present tense. " +
"Lines must not be longer than 74 characters. " +
"{Use this hint to improve this commit message: \$hint\n}" +
"Use {locale} language to answer.\n" +
"{diff}",
Prompt(
"Emoji",
"Prompt for commit message in the conventional commit convention with GitMoji convention.",
"Write a clean and comprehensive commit message in the conventional commit convention. " +
"I'll send you an output of 'git diff --staged' command, and you convert " +
"it into a commit message. " +
"Use GitMoji convention to preface the commit. " +
"Do NOT add any descriptions to the commit, only commit message. " +
"Use the present tense. " +
"Lines must not be longer than 74 characters.\n" +
"{Use this hint to improve the commit message: \$hint}\n" +
"Use {locale} language to answer.\n" +
"{diff}",
false
)
);

companion object {
fun toPromptsMap(): MutableMap<String, Prompt> {
return entries.associateBy({ it.name.lowercase() }, DefaultPrompts::toPrompt).toMutableMap()
return entries.associateBy({ it.name.lowercase() }, { it.prompt }).toMutableMap()
}
}

fun toPrompt(): Prompt {
return Prompt(
this.title,
this.content,
this.description,
false
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,27 @@ class HintRegexTest {
"Create a commit message. "
),
Arguments.of(
DefaultPrompts.BASIC.content,
DefaultPrompts.BASIC.prompt.content,
"this is a hint",
DefaultPrompts.BASIC.content.replace(
"{Use this hint to improve this commit message: \$hint\n}",
"Use this hint to improve this commit message: this is a hint\n"
DefaultPrompts.BASIC.prompt.content.replace(
"{Use this hint to improve the commit message: \$hint}\n",
"Use this hint to improve the commit message: this is a hint\n"
)
),
Arguments.of(
DefaultPrompts.CONVENTIONAL.content,
DefaultPrompts.CONVENTIONAL.prompt.content,
"this is a hint",
DefaultPrompts.CONVENTIONAL.content.replace(
"{Use this hint to improve this commit message: \$hint\n}",
"Use this hint to improve this commit message: this is a hint\n"
DefaultPrompts.CONVENTIONAL.prompt.content.replace(
"{Use this hint to improve the commit message: \$hint}\n",
"Use this hint to improve the commit message: this is a hint\n"
)
),
Arguments.of(
DefaultPrompts.EMOJI.content,
DefaultPrompts.EMOJI.prompt.content,
"this is a hint",
DefaultPrompts.EMOJI.content.replace(
"{Use this hint to improve this commit message: \$hint\n}",
"Use this hint to improve this commit message: this is a hint\n"
DefaultPrompts.EMOJI.prompt.content.replace(
"{Use this hint to improve the commit message: \$hint}\n",
"Use this hint to improve the commit message: this is a hint\n"
)
)
)
Expand Down

0 comments on commit 5b5b47e

Please sign in to comment.