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
This commit is contained in:
parent
3cbcd64e92
commit
71a2c3d00d
1 changed files with 14 additions and 8 deletions
22
src/ui.js
22
src/ui.js
|
|
@ -1361,17 +1361,23 @@ async function openHermesModalNew() {
|
||||||
const pageContent = extractWebpageContent();
|
const pageContent = extractWebpageContent();
|
||||||
const pageTitle = document.title || window.location.hostname;
|
const pageTitle = document.title || window.location.hostname;
|
||||||
|
|
||||||
// Generate contextual intro message using Hermes
|
// Generate contextual intro message using Hermes with full page context
|
||||||
const contextPrompt = `You are Hermes AI, embedded on a webpage. Generate a warm, welcoming 3-paragraph introduction message that:
|
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
|
PAGE INFORMATION:
|
||||||
2. Second paragraph: Explain how you can help with this specific page content and related topics
|
Title: "${pageTitle}"
|
||||||
3. Third paragraph: Invite questions and explain your capabilities
|
URL: ${window.location.href}
|
||||||
|
|
||||||
Page title: "${pageTitle}"
|
FULL PAGE CONTENT:
|
||||||
Page content preview: "${pageContent.substring(0, 1000)}..."
|
${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 = '';
|
let response = '';
|
||||||
for await (const chunk of sendMessage(contextPrompt)) {
|
for await (const chunk of sendMessage(contextPrompt)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue