chore(.gitignore): add client/public/images/ to ignore list (#417)

refactor(chatgpt-client.js): free encoder memory after use
feat(chatgpt-client.tokens.js): add script to test memory usage of ChatGPTClient
This commit is contained in:
Danny Avila 2023-06-02 00:08:19 -04:00 committed by GitHub
parent 4705975e59
commit 7fbf27c5aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 91 additions and 0 deletions

View file

@ -81,6 +81,7 @@ const askClient = async ({
try {
usage.completion_tokens = (enc.encode(res.response)).length;
enc.free();
usage.total_tokens = usage.prompt_tokens + usage.completion_tokens;
res.usage = usage;
} catch (e) {