feat: language support via locale config (#96)
Co-authored-by: hiroki osame <hiroki.osame@gmail.com>
This commit is contained in:
committed by
GitHub
parent
4876e8d966
commit
58ce61eab8
@@ -58,17 +58,18 @@ const sanitizeMessage = (message: string) => message.trim().replace(/[\n\r]/g, '
|
||||
|
||||
const deduplicateMessages = (array: string[]) => Array.from(new Set(array));
|
||||
|
||||
const promptTemplate = 'Write an insightful but concise Git commit message in a complete sentence in present tense for the following diff without prefacing it with anything:';
|
||||
const getPrompt = (locale: string, diff: string) => `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}:\n${diff}`;
|
||||
|
||||
const model = 'text-davinci-003';
|
||||
const encoder = encodingForModel(model);
|
||||
|
||||
export const generateCommitMessage = async (
|
||||
apiKey: string,
|
||||
locale: string,
|
||||
diff: string,
|
||||
completions: number,
|
||||
) => {
|
||||
const prompt = `${promptTemplate}\n${diff}`;
|
||||
const prompt = getPrompt(locale, diff);
|
||||
|
||||
/**
|
||||
* text-davinci-003 has a token limit of 4000
|
||||
|
||||
Reference in New Issue
Block a user