diff --git a/public/src/uncloseai-embed-modal.js b/public/src/uncloseai-embed-modal.js index e837e9d..cebc2ec 100644 --- a/public/src/uncloseai-embed-modal.js +++ b/public/src/uncloseai-embed-modal.js @@ -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}