A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
feat: tagging prompt hardening
Mohamed Bassem9ceb077c8712
diff --git a/packages/shared/prompts.ts b/packages/shared/prompts.tsindex 0c800210..a0dbad82 100644--- a/packages/shared/prompts.ts+++ b/packages/shared/prompts.ts@@ -26,13 +26,20 @@ export function buildImagePrompt();return `-You are an expert whose responsibility is to help with automatic text tagging for a read-it-later/bookmarking app.+You are an expert whose responsibility is to help with automatic tagging for a read-it-later/bookmarking app.Analyze the attached image and suggest relevant tags that describe its key themes, topics, and main ideas. The rules are:-- Aim for a variety of tags, including broad categories, specific keywords, and potential sub-genres.+- Prefer concrete, durable tags: named products, technologies, projects, standards, subject areas, and important concepts.+- Include only retrieval-worthy tags that describe the saved item's intended content, not incidental UI or page chrome.- The tags must be in ${lang}.-- If the tag is not generic enough, don't include it.+- Keep each tag short: ideally 1-3 words. Do not include parenthetical explanations, comma-separated examples, or long descriptive phrases inside a tag.+- Prefer durable subject tags over one-off facts, examples, source organizations, page sections, or implementation details unless they are central to the whole item.+- Do NOT generate any tags if the image is mainly:+ - A screenshot of an error, unavailable, forbidden, unauthorized, not found, DNS, timeout, or service failure page+ - A Cloudflare/security check, CAPTCHA, bot check, anti-DDoS challenge, browser verification, or access-blocked page+ - Boilerplate content such as cookie consent, login walls, GDPR notices, navigation menus, or a blank/empty image+ In these cases, return an empty tags array. Do not tag the failure/interstitial page itself.- Aim for 10-15 tags.-- If there are no good tags, don't emit any.+- If there are no good tags, leave the array empty.${curatedInstruction}${potentialRelevantTagsInstruction}${tagStyleInstruction}@@ -60,12 +67,16 @@ export function constructTextTaggingPrompt(return `You are an expert whose responsibility is to help with automatic tagging for a read-it-later/bookmarking app.Analyze the TEXT_CONTENT below and suggest relevant tags that describe its key themes, topics, and main ideas. The rules are:-- Aim for a variety of tags, including broad categories, specific keywords, and potential sub-genres.+- Prefer concrete, durable tags: named products, technologies, projects, standards, subject areas, and important concepts.+- Include only retrieval-worthy tags that describe the saved item's intended content, not incidental page chrome.- The tags must be in ${lang}.-- If the tag is not generic enough, don't include it.-- Do NOT generate tags related to:- - An error page (404, 403, blocked, not found, dns errors)- - Boilerplate content (cookie consent, login walls, GDPR notices)+- Keep each tag short: ideally 1-3 words. Do not include parenthetical explanations, comma-separated examples, or long descriptive phrases inside a tag.+- Prefer durable subject tags over one-off facts, examples, source organizations, page sections, or implementation details unless they are central to the whole item.+- Do NOT generate any tags if the content is mainly:+ - An error, unavailable, forbidden, unauthorized, not found, DNS, timeout, or service failure page+ - A Cloudflare/security check, CAPTCHA, bot check, anti-DDoS challenge, browser verification, or access-blocked page+ - Boilerplate content such as cookie consent, login walls, GDPR notices, navigation menus, or empty pages+ In these cases, return an empty tags array. Do not tag the failure/interstitial page itself.- Aim for 3-5 tags.- If there are no good tags, leave the array empty.${curatedInstruction}