A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix(inferance): skip token slicing when content is already witin max length
Mohamed Bassem17136006c77b
diff --git a/packages/shared/prompts.ts b/packages/shared/prompts.tsindex 40f74773..0b79eb9a 100644--- a/packages/shared/prompts.ts+++ b/packages/shared/prompts.ts@@ -15,6 +15,9 @@ function calculateNumTokens(text: string) {function truncateContent(content: string, length: number) {const tokens = encoding.encode(content);+ if (tokens.length <= length) {+ return content;+ }const truncatedTokens = tokens.slice(0, length);return encoding.decode(truncatedTokens);}