Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rocktimsaikia committed Apr 9, 2023
1 parent 6e34e8b commit c166d02
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/utils/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const getPrompt = (locale: string, diff: string) => `Write a git commit message
const getTokens = (prompt: string, model: TiktokenModel) => {
const encoder = encoding_for_model(model);
const tokens = encoder.encode(prompt).length;
// Free the encoder to avoid possible memory leaks.
encoder.free();
return tokens;
};
Expand Down

0 comments on commit c166d02

Please sign in to comment.