Count file diff by token, not by length of string (#63)
* 1.1.23 * 1.1.24 * feat(package.json): add @dqbd/tiktoken dependency refactor(generateCommitMessageFromGitDiff.ts): add tokenCount function to count the number of tokens in a string refactor(generateCommitMessageFromGitDiff.ts): change the way the length of INIT_MESSAGES_PROMPT is calculated to use tokenCount function refactor(generateCommitMessageFromGitDiff.ts): change the way the length of diff is calculated to use tokenCount function refactor(generateCommitMessageFromGitDiff.ts): rename function parameter from diff to fileDiff and update function calls accordingly feat(generateCommitMessageFromGitDiff.ts): add tokenCount function to count tokens in fileDiff and use it to check if fileDiff is bigger than MAX_REQ_TOKENS feat(utils): add tokenCount function to count the number of tokens in a string refactor(utils/mergeStrings.ts): use tokenCount function to count the number of tokens in a string instead of checking the length of the concatenated string --------- Co-authored-by: di-sukharev <dim.sukharev@gmail.com>
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^0.6.1",
|
||||
"@dqbd/tiktoken": "^1.0.2",
|
||||
"axios": "^1.3.4",
|
||||
"chalk": "^5.2.0",
|
||||
"cleye": "^1.3.2",
|
||||
|
||||
Reference in New Issue
Block a user