feat(hermes): restore page context in modal header
- Add subtitle showing uncloseai branding and current page title - Display 'You are discussing: [page title]' context - Maintain mobile-responsive header layout with title container
This commit is contained in:
parent
2a8e020f9c
commit
af580c67ac
1 changed files with 33 additions and 3 deletions
36
src/ui.js
36
src/ui.js
|
|
@ -535,6 +535,9 @@ async function openHermesModalNew() {
|
|||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
`;
|
||||
|
||||
const titleContainer = document.createElement("div");
|
||||
titleContainer.style.cssText = `flex: 1; display: flex; flex-direction: column; gap: 4px;`;
|
||||
|
||||
const title = document.createElement("h2");
|
||||
title.textContent = "🤖 Hermes AI";
|
||||
title.style.cssText = `
|
||||
|
|
@ -542,6 +545,18 @@ async function openHermesModalNew() {
|
|||
font-size: ${isMobile ? '18px' : '20px'};
|
||||
font-weight: 600;
|
||||
`;
|
||||
|
||||
const subtitle = document.createElement("div");
|
||||
const pageTitle = document.title || window.location.hostname;
|
||||
subtitle.innerHTML = `
|
||||
<div style="font-size: 12px; opacity: 0.9; font-weight: normal; line-height: 1.3;">
|
||||
uncloseai. presents nous research's hermes large language model<br>
|
||||
<span style="opacity: 0.8;">You are discussing: ${pageTitle}</span>
|
||||
</div>
|
||||
`;
|
||||
|
||||
titleContainer.appendChild(title);
|
||||
titleContainer.appendChild(subtitle);
|
||||
|
||||
const closeBtn = document.createElement("button");
|
||||
closeBtn.textContent = "✕";
|
||||
|
|
@ -593,7 +608,7 @@ async function openHermesModalNew() {
|
|||
headerRight.appendChild(menuBtn);
|
||||
headerRight.appendChild(closeBtn);
|
||||
|
||||
header.appendChild(title);
|
||||
header.appendChild(titleContainer);
|
||||
header.appendChild(headerRight);
|
||||
|
||||
// Chat area
|
||||
|
|
@ -651,10 +666,14 @@ async function openHermesModalNew() {
|
|||
const loadModels = async () => {
|
||||
try {
|
||||
console.log("Loading models for Hermes modal...");
|
||||
const models = await fetchModelsFromEndpoints();
|
||||
console.log("Models loaded:", models);
|
||||
await fetchModelsFromEndpoints();
|
||||
console.log("Models registry updated:", modelRegistry);
|
||||
modelSelect.innerHTML = '';
|
||||
|
||||
// Get models from registry
|
||||
const models = Object.values(modelRegistry);
|
||||
console.log("Available models:", models);
|
||||
|
||||
if (models && models.length > 0) {
|
||||
models.forEach(model => {
|
||||
const option = document.createElement("option");
|
||||
|
|
@ -688,6 +707,17 @@ async function openHermesModalNew() {
|
|||
}
|
||||
};
|
||||
|
||||
// Handle model selection changes
|
||||
modelSelect.onchange = () => {
|
||||
const selectedModel = modelSelect.value;
|
||||
if (selectedModel && modelRegistry[selectedModel]) {
|
||||
// Update the global model selection
|
||||
localStorage.setItem('selectedModel', modelRegistry[selectedModel].modelName);
|
||||
localStorage.setItem('selectedEndpoint', modelRegistry[selectedModel].endpointId);
|
||||
console.log("Model changed to:", modelRegistry[selectedModel]);
|
||||
}
|
||||
};
|
||||
|
||||
modelSection.appendChild(modelLabel);
|
||||
modelSection.appendChild(modelSelect);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue