From 71a2c3d00d2373d4c2ea08d32e7db50ec409ccc3 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Wed, 2 Jul 2025 08:33:35 -0400 Subject: [PATCH] improve(hermes): enhance context setup for coherent conversations - Provide full page content to Hermes instead of just preview - Include complete page context in initial system message - Tell Hermes to maintain context for future questions in conversation - Enable Hermes to reference specific details, names, and topics from page - Fix issue where follow-up questions lacked proper page context - Should now be able to answer questions about Nathan and other page details --- src/ui.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/ui.js b/src/ui.js index 6ddd025..28fb386 100644 --- a/src/ui.js +++ b/src/ui.js @@ -1361,17 +1361,23 @@ async function openHermesModalNew() { const pageContent = extractWebpageContent(); const pageTitle = document.title || window.location.hostname; - // Generate contextual intro message using Hermes - const contextPrompt = `You are Hermes AI, embedded on a webpage. Generate a warm, welcoming 3-paragraph introduction message that: + // Generate contextual intro message using Hermes with full page context + const contextPrompt = `You are Hermes AI, powered by Nous Research, embedded on this specific webpage. You have full access to analyze and discuss the page content. -1. First paragraph: Introduce yourself as Hermes AI (powered by Nous Research) and acknowledge the specific page/content the user is viewing -2. Second paragraph: Explain how you can help with this specific page content and related topics -3. Third paragraph: Invite questions and explain your capabilities +PAGE INFORMATION: +Title: "${pageTitle}" +URL: ${window.location.href} -Page title: "${pageTitle}" -Page content preview: "${pageContent.substring(0, 1000)}..." +FULL PAGE CONTENT: +${pageContent} -Keep it conversational, helpful, and specific to this page context. Use a friendly tone and make it clear you understand what page they're on.`; +INSTRUCTIONS: +1. Generate a warm, welcoming 3-paragraph introduction that shows you understand this specific page +2. Reference specific details from the content (names, topics, projects mentioned) +3. Explain how you can help with this page's content and related topics +4. Keep this context in mind for all future questions in this conversation + +Remember: You have access to the full page content above, so you can answer detailed questions about anything mentioned on this page, including specific people, projects, or concepts discussed.`; let response = ''; for await (const chunk of sendMessage(contextPrompt)) {