add computed page intelligence: 11 analyzers for deterministic LLM context augmentation

This commit is contained in:
russell@unturf.com 2026-02-23 14:24:11 -05:00
parent 4555e8bf98
commit c38cae3c13

View file

@ -1902,11 +1902,21 @@ async function openUncloseaiEmbeddedModalNew() {
// Set up page context for existing conversation
const pageContent = await extractWebpageContent();
const pageTitle = document.title || window.location.hostname;
const conversationContextAppend = `
// Computed intelligence: instant, no API call, free for returning users
let computedContext = "";
try {
const computedIntel = computePageIntelligence(pageContent);
computedContext = formatPageIntelligence(computedIntel);
} catch (e) {
console.warn("Computed page intelligence failed:", e);
}
const conversationContextAppend = `
${computedContext}
PAGE CONTEXT FOR THIS CONVERSATION:
You are embedded on the webpage: "${pageTitle}"
URL: ${window.location.href}
URI: ${window.location.href}
FULL PAGE CONTENT:
${pageContent}
@ -2440,7 +2450,7 @@ ${getUIText("systemPromptInstructions")} ${languageName}.${langInstruction}`;
// SECOND: Set up conversation system prompt for follow-up messages
// Include the analysis so follow-up messages inherit the classified context
const conversationContextAppend = `
${analysisContext}
${computedContext}${analysisContext}
PAGE CONTEXT FOR THIS CONVERSATION:
You are embedded on the webpage: "${pageTitle}"
URI: ${window.location.href}