fix TTS button text, progress indicator z-index, and hermes introduction loading feedback

This commit is contained in:
Russell Ballestrini 2025-06-30 15:14:44 -04:00
parent c318e68b5a
commit 6e84ee58b1

View file

@ -723,7 +723,7 @@ function showProgressIndicator(message) {
progressIndicator.style.background = 'rgba(0,0,0,0.8)';
progressIndicator.style.color = 'white';
progressIndicator.style.borderRadius = '5px';
progressIndicator.style.zIndex = '1000';
progressIndicator.style.zIndex = '2002';
document.body.appendChild(progressIndicator);
}
progressIndicator.textContent = message;
@ -1302,7 +1302,7 @@ function openHermesModal() {
readPageBtn.onclick = readPageWithHermes;
const ttsBtn = document.createElement('button');
ttsBtn.textContent = '🔊 TTS';
ttsBtn.textContent = '🔊 TTS Anything';
if (USE_CUSTOM_STYLING) {
ttsBtn.style.cssText = 'padding: 6px 12px; border: 1px solid #ccc; border-radius: 4px; background: white; cursor: pointer;';
}
@ -1461,8 +1461,9 @@ function openHermesModal() {
// Generate new introduction using LLM
const introDiv = document.createElement('div');
introDiv.style.cssText = 'position: relative; margin-bottom: 10px; padding: 10px; border-radius: 5px; background: rgba(0,100,200,0.1); border-left: 4px solid #0066cc;';
introDiv.innerHTML = '<p><strong>🤖 Hermes:</strong> <em>Analyzing this page and preparing a personalized introduction...</em></p>';
introDiv.innerHTML = '<p><strong>🤖 Hermes:</strong> <em>✨ Analyzing this page and crafting a personalized introduction... This may take a moment.</em></p>';
chatBox.appendChild(introDiv);
chatBox.scrollTop = chatBox.scrollHeight;
try {
const prompt = `You are Hermes, a large language model from Nous Research. Write a friendly 2-paragraph introduction for yourself when embedded on this webpage. Be specific about this page's content and identify 2-3 key takeaways. Keep it conversational and helpful.
@ -1491,7 +1492,11 @@ Format: Start with "Greetings! I'm Hermes..." and make it sound natural and enga
} catch (error) {
console.error('Error generating introduction:', error);
introDiv.innerHTML = '<p><strong>🤖 Hermes:</strong> Greetings! I\'m Hermes, ready to help you with anything on this page or beyond!</p>';
const fallbackIntro = 'Greetings! I\'m Hermes, a large language model from Nous Research. I\'m here to help you understand this page and assist with any questions, coding, or creative tasks you might have. Feel free to ask me anything!';
introDiv.innerHTML = `<p><strong>🤖 Hermes:</strong> ${fallbackIntro}</p>`;
// Add fallback to chat history too
chatHistory.push({ role: "assistant", content: fallbackIntro });
saveConversationHistory();
}
}
}
@ -1554,7 +1559,10 @@ Format: Start with "Greetings! I'm Hermes..." and make it sound natural and enga
buffer = lines[lines.length - 1];
}
}
addHermesIntroduction();
// Call async introduction function
addHermesIntroduction().catch(error => {
console.error('Failed to add Hermes introduction:', error);
});
// Create input area
const inputArea = document.createElement('div');