From 8ab2747e23256106b115aa3823ad25e2c2d466d4 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sat, 2 Mar 2024 00:52:18 +0000 Subject: feature: Store full link content and index them --- packages/workers/openai.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'packages/workers/openai.ts') diff --git a/packages/workers/openai.ts b/packages/workers/openai.ts index cc456616..7dda1f9b 100644 --- a/packages/workers/openai.ts +++ b/packages/workers/openai.ts @@ -63,10 +63,20 @@ function buildPrompt( `No description found for link "${bookmark.id}". Skipping ...`, ); } + + let content = bookmark.link.content; + if (content) { + let words = content.split(" "); + if (words.length > 2000) { + words = words.slice(2000); + content = words.join(" "); + } + } return ` ${PROMPT_BASE} URL: ${bookmark.link.url} Description: ${bookmark.link.description} +Content: ${content || ""} `; } -- cgit v1.2.3-70-g09d2