Skip to content

Commit

Permalink
Update lib/ai.js
Browse files Browse the repository at this point in the history
Co-authored-by: KobeN <[email protected]>
  • Loading branch information
DavertMik and kobenguyent authored Mar 16, 2024
1 parent a73f21b commit f12aeb0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ai.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class AiAssistant {
// this approach was tested via https://platform.openai.com/tokenizer
// we need it to display current usage tokens usage so users could analyze effectiveness of AI

const inputString = messages.map(m => m.content).join(' ');
const inputString = messages.map(m => m.content).join(' ').trim();
const numWords = (inputString.match(/[^\s\-:=]+/g) || []).length;

// 2.5 token is constant for average HTML input
Expand Down

0 comments on commit f12aeb0

Please sign in to comment.