mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 06:12:26 +00:00
fix compaction issues
This commit is contained in:
7
packages/opencode/src/util/token.ts
Normal file
7
packages/opencode/src/util/token.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export namespace Token {
|
||||
const CHARS_PER_TOKEN = 4
|
||||
|
||||
export function estimate(input: string) {
|
||||
return Math.max(0, Math.round((input || "").length / CHARS_PER_TOKEN))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user