Skip to content

Commit

Permalink
fix: Fix slice call in the content truncation logic which was resulti…
Browse files Browse the repository at this point in the history
…ng in excessive usage of context tokens. Fixes #94
  • Loading branch information
MohamedBassem committed Apr 15, 2024
1 parent 81e0b28 commit 4629dac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/workers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function readPDFText(buffer: Buffer): Promise<{
export function truncateContent(content: string, length = 1500) {
let words = content.split(" ");
if (words.length > length) {
words = words.slice(length);
words = words.slice(0, length);
content = words.join(" ");
}
return content;
Expand Down

0 comments on commit 4629dac

Please sign in to comment.