From ea864d18f4d901c7462153c2316df0aea34ff80d Mon Sep 17 00:00:00 2001 From: di-sukharev Date: Wed, 29 Mar 2023 09:35:35 +0800 Subject: [PATCH] refactor(generateCommitMessageFromGitDiff.ts): update INIT_MESSAGES_PROMPT to improve readability and remove unnecessary line breaks --- src/generateCommitMessageFromGitDiff.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/generateCommitMessageFromGitDiff.ts b/src/generateCommitMessageFromGitDiff.ts index 992b1e1..6788aa0 100644 --- a/src/generateCommitMessageFromGitDiff.ts +++ b/src/generateCommitMessageFromGitDiff.ts @@ -15,18 +15,19 @@ const INIT_MESSAGES_PROMPT: Array = [ { role: ChatCompletionRequestMessageRoleEnum.System, content: `You are to act as the author of a commit message in git. Your mission is to create clean and comprehensive commit messages in the conventional commit convention. I'll send you an output of 'git diff --staged' command, and you convert it into a commit message. - ${ - config?.emoji - ? 'Use Gitmoji convention to preface the commit' - : 'Do not preface the commit with anything' - }. ${ - config?.description - ? 'Add a short description of why the commit is done after the commit message. Don\'t start it with "This commit", just describe the changes' - : "Don't add any descriptions to the commit, only commit message" - }. - Use the present tense. - Lines must not be longer 74 characters. - Use ${translation.localLanguage} to answer.` +${ + config?.emoji + ? 'Use Gitmoji convention to preface the commit' + : 'Do not preface the commit with anything' +}. +${ + config?.description + ? 'Add a short description of why the commit is done after the commit message. Don\'t start it with "This commit", just describe the changes' + : "Don't add any descriptions to the commit, only commit message" +}. +Use the present tense. +Lines must not be longer 74 characters. +Use ${translation.localLanguage} to answer.` }, { role: ChatCompletionRequestMessageRoleEnum.User,