From 156d08120c4904fba431f510367d298a4ca0db30 Mon Sep 17 00:00:00 2001 From: Arthur Monnet Date: Wed, 2 Oct 2024 18:00:40 +0200 Subject: [PATCH 01/14] first commit --- .idea/.gitignore | 8 ++++++++ .idea/ai-commit.iml | 8 ++++++++ .idea/modules.xml | 8 ++++++++ .idea/php.xml | 19 +++++++++++++++++++ .idea/vcs.xml | 6 ++++++ package-lock.json | 4 ++-- 6 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/ai-commit.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/php.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/ai-commit.iml b/.idea/ai-commit.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/ai-commit.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..78d30ce --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..f324872 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 390a3ca..a7b7ebb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ai-commit", - "version": "2.1.1", + "version": "2.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ai-commit", - "version": "2.1.1", + "version": "2.2.0", "license": "MIT", "dependencies": { "chatgpt": "^5.0.0", From 35caf892135d3b992b4cf9b4c18165b923477daf Mon Sep 17 00:00:00 2001 From: Arthur Monnet Date: Fri, 4 Oct 2024 15:12:22 +0200 Subject: [PATCH 02/14] feat: enhance diff parsing and introduce interactive commit process - Add `gpt-3-encoder` import and define `MAX_TOKENS` in `index.js` - Implement `parseDiffByFile` function to handle large diffs - Modify `generateAICommit` to manage diffs exceeding `MAX_TOKENS`, with user confirmations - Refactor `sendMessage` in `openai.js` for improved readability - Update prompts in commit generation functions for clarity - Add `getPromptForDiffSummary` method to summarize git diffs per file - Decrease `MAX_TOKENS` in `openai.js` from 128k to 4k with adjustable note --- index.js | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- openai.js | 118 ++++++++++++++++++++++++++------------------------- 2 files changed, 181 insertions(+), 60 deletions(-) diff --git a/index.js b/index.js index 10daddd..a0c97e9 100755 --- a/index.js +++ b/index.js @@ -8,8 +8,10 @@ import { addGitmojiToCommitMessage } from './gitmoji.js'; import { AI_PROVIDER, MODEL, args } from "./config.js" import openai from "./openai.js" import ollama from "./ollama.js" +import { encode } from 'gpt-3-encoder'; const REGENERATE_MSG = "♻️ Regenerate Commit Messages"; +const MAX_TOKENS = 4000; // Vous pouvez ajuster cette valeur si nécessaire console.log('Ai provider: ', AI_PROVIDER); @@ -170,6 +172,33 @@ const filterLockFiles = (diff) => { return filteredLines.join('\n'); }; +function parseDiffByFile(diff) { + const files = []; + const lines = diff.split('\n'); + let currentFile = null; + let currentDiff = []; + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + const diffGitMatch = line.match(/^diff --git a\/(.+?) b\/(.+)$/); + if (diffGitMatch) { + // Début d'un nouveau fichier + if (currentFile) { + files.push({ filename: currentFile, diff: currentDiff.join('\n') }); + } + currentFile = diffGitMatch[2]; + currentDiff = [line]; + } else if (currentFile) { + currentDiff.push(line); + } + } + // Ajouter le dernier fichier + if (currentFile && currentDiff.length) { + files.push({ filename: currentFile, diff: currentDiff.join('\n') }); + } + return files; +} + + async function generateAICommit() { const isGitRepository = checkGitRepository(); @@ -196,9 +225,97 @@ async function generateAICommit() { process.exit(1); } - args.list - ? await generateListCommits(diff) - : await generateSingleCommit(diff); + const prompt = getPromptForSingleCommit(diff); + + const numTokens = encode(prompt).length; + + if (numTokens > MAX_TOKENS) { + // Diviser le diff par fichier et générer des résumés + console.log("The commit diff is too large for the ChatGPT API. Splitting by files..."); + + // Parse diff into per-file diffs + const fileDiffs = parseDiffByFile(diff); + + const summaries = []; + + for (const { filename, diff: fileDiff } of fileDiffs) { + const summaryPrompt = provider.getPromptForDiffSummary(fileDiff, filename, { language }); + const numTokens = encode(summaryPrompt).length; + + if (numTokens > MAX_TOKENS) { + console.log(`Skipping ${filename} because its diff is too large.`); + continue; + } + + if (!await provider.filterApi({ prompt: summaryPrompt, filterFee: args['filter-fee'] })) continue; + + const summary = await provider.sendMessage(summaryPrompt, { apiKey, model: MODEL }); + + summaries.push(`- **${filename}**: ${summary}`); + } + + if (summaries.length === 0) { + console.log("No files to summarize."); + process.exit(1); + } + + // Générer le message de commit à partir des résumés + const summariesText = summaries.join('\n'); + + const commitPrompt = + `Based on the following summaries of changes, create a useful commit message in ${language} language` + + (commitType ? ` with commit type '${commitType}'. ` : ". ") + + "Use the summaries below to create the commit message. Do not preface the commit with anything, use the present tense, return the full sentence, and use the conventional commits specification (: ):\n\n" + + summariesText; + + if (!await provider.filterApi({ prompt: commitPrompt, filterFee: args['filter-fee'] })) process.exit(1); + + const commitMessage = await provider.sendMessage(commitPrompt, { apiKey, model: MODEL }); + + let finalCommitMessage = processEmoji(commitMessage, args.emoji); + + if (args.template) { + finalCommitMessage = processTemplate({ + template: args.template, + commitMessage: finalCommitMessage, + }) + + console.log( + `Proposed Commit With Template:\n------------------------------\n${finalCommitMessage}\n------------------------------` + ); + } else { + console.log( + `Proposed Commit:\n------------------------------\n${finalCommitMessage}\n------------------------------` + ); + } + + if (args.force) { + makeCommit(finalCommitMessage); + return; + } + + const answer = await inquirer.prompt([ + { + type: "confirm", + name: "continue", + message: "Do you want to continue?", + default: true, + }, + ]); + + if (!answer.continue) { + console.log("Commit aborted by user 🙅‍♂️"); + process.exit(1); + } + + makeCommit(finalCommitMessage); + + } else { + // Procéder comme d'habitude si le diff n'est pas trop grand + args.list + ? await generateListCommits(diff) + : await generateSingleCommit(diff); + } } await generateAICommit(); diff --git a/openai.js b/openai.js index 8740cf4..2e5ec39 100644 --- a/openai.js +++ b/openai.js @@ -1,79 +1,83 @@ import { ChatGPTAPI } from "chatgpt"; - import { encode } from 'gpt-3-encoder'; import inquirer from "inquirer"; import { AI_PROVIDER } from "./config.js" const FEE_PER_1K_TOKENS = 0.02; -const MAX_TOKENS = 128000; +const MAX_TOKENS = 4000; // Vous pouvez ajuster cette valeur si nécessaire //this is the approximate cost of a completion (answer) fee from CHATGPT const FEE_COMPLETION = 0.001; const openai = { - sendMessage: async (input, {apiKey, model}) => { - console.log("prompting chat gpt..."); - console.log("prompt: ", input); - const api = new ChatGPTAPI({ - apiKey, - completionParams: { - model: "gpt-4-1106-preview", - }, - }); - const { text } = await api.sendMessage(input); - - return text; - }, - - getPromptForSingleCommit: (diff, {commitType, language}) => { + sendMessage: async (input, {apiKey, model}) => { + console.log("prompting chat gpt..."); + console.log("prompt: ", input); + const api = new ChatGPTAPI({ + apiKey, + completionParams: { + model: "gpt-4-1106-preview", + }, + }); + const { text } = await api.sendMessage(input); - return ( - "I want you to act as the author of a commit message in git." + - `I'll enter a git diff, and your job is to convert it into a useful commit message in ${language} language` + - (commitType ? ` with commit type '${commitType}'. ` : ". ") + - "Do not preface the commit with anything, use the present tense, return the full sentence, and use the conventional commits specification (: ): " + - '\n\n'+ - diff - ); - }, + return text; + }, - getPromptForMultipleCommits: (diff, {commitType, numOptions, language}) => { - const prompt = - "I want you to act as the author of a commit message in git." + - `I'll enter a git diff, and your job is to convert it into a useful commit message in ${language} language` + - (commitType ? ` with commit type '${commitType}.', ` : ", ") + - `and make ${numOptions} options that are separated by ";".` + - "For each option, use the present tense, return the full sentence, and use the conventional commits specification (: ):" + - diff; + getPromptForSingleCommit: (diff, {commitType, language}) => { + return ( + "I want you to act as the author of a commit message in git. " + + `I'll enter a git diff, and your job is to convert it into a useful commit message in ${language} language` + + (commitType ? ` with commit type '${commitType}'. ` : ". ") + + "Do not preface the commit with anything, use the present tense, return the full sentence, and use the conventional commits specification (: ): " + + '\n\n'+ + diff + ); + }, - return prompt; - }, + getPromptForMultipleCommits: (diff, {commitType, numOptions, language}) => { + const prompt = + "I want you to act as the author of a commit message in git. " + + `I'll enter a git diff, and your job is to convert it into a useful commit message in ${language} language` + + (commitType ? ` with commit type '${commitType}.', ` : ", ") + + `and make ${numOptions} options that are separated by ";".` + + "For each option, use the present tense, return the full sentence, and use the conventional commits specification (: ):" + + diff; - filterApi: async ({ prompt, numCompletion = 1, filterFee }) => { - const numTokens = encode(prompt).length; - const fee = numTokens / 1000 * FEE_PER_1K_TOKENS + (FEE_COMPLETION * numCompletion); + return prompt; + }, - if (numTokens > MAX_TOKENS) { - console.log("The commit diff is too large for the ChatGPT API. Max 4k tokens or ~8k characters. "); - return false; - } + // Nouvelle méthode pour générer le prompt de résumé du diff + getPromptForDiffSummary: (diff, filename, {language}) => { + return ( + `Summarize the following git diff for the file '${filename}' in ${language} language. Be concise and focus on the main changes:\n\n` + + diff + ); + }, - if (filterFee) { - console.log(`This will cost you ~$${+fee.toFixed(3)} for using the API.`); - const answer = await inquirer.prompt([ - { - type: "confirm", - name: "continue", - message: "Do you want to continue 💸?", - default: true, - }, - ]); - if (!answer.continue) return false; - } + filterApi: async ({ prompt, numCompletion = 1, filterFee }) => { + const numTokens = encode(prompt).length; + const fee = numTokens / 1000 * FEE_PER_1K_TOKENS + (FEE_COMPLETION * numCompletion); - return true; -} + if (numTokens > MAX_TOKENS) { + console.log("The commit diff is too large for the ChatGPT API. Max 4k tokens or ~8k characters. "); + return false; + } + if (filterFee) { + console.log(`This will cost you ~$${+fee.toFixed(3)} for using the API.`); + const answer = await inquirer.prompt([ + { + type: "confirm", + name: "continue", + message: "Do you want to continue 💸?", + default: true, + }, + ]); + if (!answer.continue) return false; + } + return true; + } }; export default openai; From 33381915bf444b08f26b6a4fbfe0434e382956ef Mon Sep 17 00:00:00 2001 From: Arthur Monnet Date: Fri, 4 Oct 2024 16:02:34 +0200 Subject: [PATCH 03/14] =?UTF-8?q?=F0=9F=9A=91=20fix:=20increase=20MAX=5FTO?= =?UTF-8?q?KENS=20to=20128000=20in=20index.js=20and=20openai.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 2 +- openai.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index a0c97e9..f9eff37 100755 --- a/index.js +++ b/index.js @@ -11,7 +11,7 @@ import ollama from "./ollama.js" import { encode } from 'gpt-3-encoder'; const REGENERATE_MSG = "♻️ Regenerate Commit Messages"; -const MAX_TOKENS = 4000; // Vous pouvez ajuster cette valeur si nécessaire +const MAX_TOKENS = 128000; console.log('Ai provider: ', AI_PROVIDER); diff --git a/openai.js b/openai.js index 2e5ec39..8319bd4 100644 --- a/openai.js +++ b/openai.js @@ -4,7 +4,7 @@ import inquirer from "inquirer"; import { AI_PROVIDER } from "./config.js" const FEE_PER_1K_TOKENS = 0.02; -const MAX_TOKENS = 4000; // Vous pouvez ajuster cette valeur si nécessaire +const MAX_TOKENS = 128000; //this is the approximate cost of a completion (answer) fee from CHATGPT const FEE_COMPLETION = 0.001; From 13499fe05e20ec55e4260a08bb85c3b1d81e2b80 Mon Sep 17 00:00:00 2001 From: Arthur Monnet Date: Fri, 4 Oct 2024 16:08:31 +0200 Subject: [PATCH 04/14] =?UTF-8?q?=F0=9F=9A=91=20fix:=20update=20console=20?= =?UTF-8?q?log=20to=20dynamically=20display=20token=20and=20character=20li?= =?UTF-8?q?mits=20in=20openai.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openai.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openai.js b/openai.js index 8319bd4..9bf5499 100644 --- a/openai.js +++ b/openai.js @@ -59,7 +59,7 @@ const openai = { const fee = numTokens / 1000 * FEE_PER_1K_TOKENS + (FEE_COMPLETION * numCompletion); if (numTokens > MAX_TOKENS) { - console.log("The commit diff is too large for the ChatGPT API. Max 4k tokens or ~8k characters. "); + console.log(`The commit diff is too large for the ChatGPT API. Max ${MAX_TOKENS/1000}k tokens or ~${MAX_TOKENS/500} characters.`); return false; } From 5177af24bab3ecef835ef6128bfad0ef04e15a07 Mon Sep 17 00:00:00 2001 From: Arthur <78175924+Arthur-MONNET@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:14:29 +0200 Subject: [PATCH 05/14] Delete .idea/.gitignore --- .idea/.gitignore | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml From c126e43bf38fcc7f322f380180e06628a962662d Mon Sep 17 00:00:00 2001 From: Arthur <78175924+Arthur-MONNET@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:14:39 +0200 Subject: [PATCH 06/14] Delete .idea/ai-commit.iml --- .idea/ai-commit.iml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/ai-commit.iml diff --git a/.idea/ai-commit.iml b/.idea/ai-commit.iml deleted file mode 100644 index c956989..0000000 --- a/.idea/ai-commit.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file From 756c8e5837cd8a76c972f8da780213255c7b6f78 Mon Sep 17 00:00:00 2001 From: Arthur <78175924+Arthur-MONNET@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:14:53 +0200 Subject: [PATCH 07/14] Delete .idea/modules.xml --- .idea/modules.xml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/modules.xml diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 78d30ce..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file From 70960d6672456f19405eda4b3a1aefdd5a5803b6 Mon Sep 17 00:00:00 2001 From: Arthur <78175924+Arthur-MONNET@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:15:09 +0200 Subject: [PATCH 08/14] Delete .idea/php.xml --- .idea/php.xml | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 .idea/php.xml diff --git a/.idea/php.xml b/.idea/php.xml deleted file mode 100644 index f324872..0000000 --- a/.idea/php.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file From 94de501299b6e8b5ec7198a496c403215f3c44b9 Mon Sep 17 00:00:00 2001 From: Arthur <78175924+Arthur-MONNET@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:15:20 +0200 Subject: [PATCH 09/14] Delete .idea/vcs.xml --- .idea/vcs.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 4bdfb7fcad0d3b2cb325306a91baebb1ad24d622 Mon Sep 17 00:00:00 2001 From: Arthur Monnet Date: Fri, 4 Oct 2024 16:23:09 +0200 Subject: [PATCH 10/14] =?UTF-8?q?=F0=9F=94=A7=20chore:=20update=20.gitigno?= =?UTF-8?q?re=20to=20ignore=20'.idea/'=20directory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 6704566..dd1a86e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ + # Logs logs *.log @@ -40,6 +41,7 @@ build/Release # Dependency directories node_modules/ jspm_packages/ +.idea/ # TypeScript v1 declaration files typings/ From a5d910f1771a42e06e1ea0d14c6f3f2e606db131 Mon Sep 17 00:00:00 2001 From: Arthur Monnet Date: Fri, 4 Oct 2024 16:27:40 +0200 Subject: [PATCH 11/14] fix: update dependencies to latest versions --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index dead2b0..0e417be 100644 --- a/package.json +++ b/package.json @@ -31,9 +31,9 @@ }, "homepage": "https://github.com/insulineru/ai-commit#readme", "dependencies": { - "chatgpt": "^5.0.0", - "dotenv": "^16.0.3", + "chatgpt": "^5.2.5", + "dotenv": "^16.4.5", "gpt-3-encoder": "^1.1.4", - "inquirer": "^9.1.4" + "inquirer": "^11.1.0" } } From 1675f162a848f4e368083f0a81389abff4da9c6b Mon Sep 17 00:00:00 2001 From: Arthur Monnet Date: Mon, 7 Oct 2024 11:21:55 +0200 Subject: [PATCH 12/14] fix: update comments and improve function descriptions for clarity - Replace French comments with their English equivalents in `index.js`. - Clarify the functionality of code blocks with updated comments in both `index.js` and `openai.js`. - Introduce a new function description for generating prompts from diffs in `openai.js`. --- index.js | 10 +++++----- openai.js | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index f9eff37..db1d63a 100755 --- a/index.js +++ b/index.js @@ -181,7 +181,7 @@ function parseDiffByFile(diff) { const line = lines[i]; const diffGitMatch = line.match(/^diff --git a\/(.+?) b\/(.+)$/); if (diffGitMatch) { - // Début d'un nouveau fichier + // New file diff if (currentFile) { files.push({ filename: currentFile, diff: currentDiff.join('\n') }); } @@ -191,7 +191,7 @@ function parseDiffByFile(diff) { currentDiff.push(line); } } - // Ajouter le dernier fichier + // Add the last file if (currentFile && currentDiff.length) { files.push({ filename: currentFile, diff: currentDiff.join('\n') }); } @@ -230,7 +230,7 @@ async function generateAICommit() { const numTokens = encode(prompt).length; if (numTokens > MAX_TOKENS) { - // Diviser le diff par fichier et générer des résumés + // Split the diff by file and generate summaries console.log("The commit diff is too large for the ChatGPT API. Splitting by files..."); // Parse diff into per-file diffs @@ -259,7 +259,7 @@ async function generateAICommit() { process.exit(1); } - // Générer le message de commit à partir des résumés + // Combine summaries into a single prompt const summariesText = summaries.join('\n'); const commitPrompt = @@ -311,7 +311,7 @@ async function generateAICommit() { makeCommit(finalCommitMessage); } else { - // Procéder comme d'habitude si le diff n'est pas trop grand + // Proceed as usual if the diff is not too large args.list ? await generateListCommits(diff) : await generateSingleCommit(diff); diff --git a/openai.js b/openai.js index 9bf5499..86fbca1 100644 --- a/openai.js +++ b/openai.js @@ -5,7 +5,7 @@ import { AI_PROVIDER } from "./config.js" const FEE_PER_1K_TOKENS = 0.02; const MAX_TOKENS = 128000; -//this is the approximate cost of a completion (answer) fee from CHATGPT +// this is the approximate cost of a completion (answer) fee from CHATGPT const FEE_COMPLETION = 0.001; const openai = { @@ -46,7 +46,7 @@ const openai = { return prompt; }, - // Nouvelle méthode pour générer le prompt de résumé du diff + // New function to prompt for a summary of the diff getPromptForDiffSummary: (diff, filename, {language}) => { return ( `Summarize the following git diff for the file '${filename}' in ${language} language. Be concise and focus on the main changes:\n\n` + From d88a68182b9ebb4fb5c68641e4a385e471955236 Mon Sep 17 00:00:00 2001 From: Arthur Monnet Date: Wed, 9 Oct 2024 10:22:48 +0200 Subject: [PATCH 13/14] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20logging=20of=20?= =?UTF-8?q?prompts=20to=20generateAICommit=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index db1d63a..21c15ea 100755 --- a/index.js +++ b/index.js @@ -227,6 +227,8 @@ async function generateAICommit() { const prompt = getPromptForSingleCommit(diff); + console.log(prompt); + const numTokens = encode(prompt).length; if (numTokens > MAX_TOKENS) { From 4adefdae31507b5c8ec83fa7acf11f046afa39ea Mon Sep 17 00:00:00 2001 From: Arthur Monnet Date: Wed, 9 Oct 2024 10:43:36 +0200 Subject: [PATCH 14/14] =?UTF-8?q?=F0=9F=9A=91=20fix:=20remove=20console.lo?= =?UTF-8?q?g=20statement=20from=20generateAICommit=20function=20to=20clean?= =?UTF-8?q?=20up=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.js b/index.js index 21c15ea..db1d63a 100755 --- a/index.js +++ b/index.js @@ -227,8 +227,6 @@ async function generateAICommit() { const prompt = getPromptForSingleCommit(diff); - console.log(prompt); - const numTokens = encode(prompt).length; if (numTokens > MAX_TOKENS) {