mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 16:30:27 +00:00
Migrate AIProvider and SearchTrigger from namespace pattern to exported functions. Simplify OpenAITokenService async implementation, remove unused imports, fix enum aliases, and update placeholder text.
14 lines
No EOL
377 B
TypeScript
14 lines
No EOL
377 B
TypeScript
import type { ITokenService } from "AIClasses/ITokenService";
|
|
import { countTokens } from 'gpt-tokenizer'
|
|
|
|
export class OpenAITokenService implements ITokenService {
|
|
|
|
public countTokens(input: string): Promise<number> {
|
|
if (input.trim() === "") {
|
|
return Promise.resolve(0);
|
|
}
|
|
|
|
return Promise.resolve(countTokens(input));
|
|
}
|
|
|
|
} |