Skip to content

Commit

Permalink
feat: ET-1441: update generateCommitMessageFromGitDiff.ts to use MAX_…
Browse files Browse the repository at this point in the history
…TOKENS_OUTPUT from config for calculating MAX_REQUEST_TOKENS value
  • Loading branch information
Matthew Salter committed Nov 21, 2023
1 parent c9e39df commit 3ae73e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/generateCommitMessageFromGitDiff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { tokenCount } from './utils/tokenCount';

const config = getConfig();
const MAX_TOKENS_INPUT = config?.OCO_TOKENS_MAX_INPUT || 4096;
const MAX_TOKENS_OUTPUT = config?.OCO_TOKENS_MAX_INPUT || 500;

const generateCommitMessageChatCompletionPrompt = async (
diff: string,
Expand Down Expand Up @@ -51,7 +52,7 @@ export const generateCommitMessageByDiff = async (
MAX_TOKENS_INPUT -
ADJUSTMENT_FACTOR -
INIT_MESSAGES_PROMPT_LENGTH -
config?.OCO_TOKENS_MAX_OUTPUT;
MAX_TOKENS_OUTPUT;

if (tokenCount(diff) >= MAX_REQUEST_TOKENS) {
const commitMessagePromises = await getCommitMsgsPromisesFromFileDiffs(
Expand Down

0 comments on commit 3ae73e2

Please sign in to comment.