refactor(ai): remove quick chips drawer to keep chat view clean and minimal (v3.8.37)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "3.8.36",
|
||||
"version": "3.8.37",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -39,31 +39,6 @@
|
||||
return 'edu_space_udeci_chat_usr_' + getUserId();
|
||||
}
|
||||
|
||||
const ROLE_CHIPS = {
|
||||
admin: [
|
||||
{ label: "📊 Métricas del Sistema", query: "¿Cuáles son las estadísticas y métricas generales del sistema?" },
|
||||
{ label: "⚙️ Configuración Global", query: "¿Cómo configuro el servidor LLM y los parámetros de IA?" },
|
||||
{ label: "🛡️ Roles y Usuarios", query: "¿Cómo administro los usuarios y roles RBAC?" },
|
||||
{ label: "📍 Ocupación de Sedes", query: "¿Cuál es el estado de ocupación de las sedes y aulas?" }
|
||||
],
|
||||
bedelia: [
|
||||
{ label: "🔄 Flujo 9 Pasos", query: "¿Cuáles son los 9 pasos del flujo de Bedelía?" },
|
||||
{ label: "⚠️ Conflictos Áulicos", query: "¿Cómo funciona la matriz de conflictos y aforo?" },
|
||||
{ label: "🧬 Optimizador IA", query: "¿Cómo uso el optimizador genético de aulas?" },
|
||||
{ label: "📑 Importar Sheets", query: "¿Cómo uso el importador de Google Sheets?" }
|
||||
],
|
||||
docente: [
|
||||
{ label: "📝 Notas de Alumnos", query: "¿Cuáles son las notas y calificaciones de mis alumnos?" },
|
||||
{ label: "📅 Hitos y Exámenes", query: "¿Cuáles son los hitos evaluativos y fechas de examen programadas?" },
|
||||
{ label: "📍 Mis Comisiones", query: "¿Cuáles son mis comisiones a cargo y aulas asignadas?" }
|
||||
],
|
||||
alumno: [
|
||||
{ label: "📍 Próxima Presencial", query: "¿Cuándo y dónde es mi próxima clase presencial?" },
|
||||
{ label: "📊 Mis Notas", query: "¿Cuáles son mis notas, calificaciones y regularidad en mis materias?" },
|
||||
{ label: "📚 Mis Materias", query: "¿En qué materias y comisiones estoy inscripto?" }
|
||||
]
|
||||
};
|
||||
|
||||
function getUserRole() {
|
||||
const container = getContainer();
|
||||
const rawRole = (container ? container.getAttribute('data-user-role') : 'alumno') || 'alumno';
|
||||
@@ -296,10 +271,8 @@
|
||||
const textarea = document.getElementById('aiChatInput');
|
||||
const typing = document.getElementById('aiChatTyping');
|
||||
const sendBtn = document.getElementById('aiChatSendBtn');
|
||||
const chipsDrawer = document.getElementById('aiChatQuickChips');
|
||||
|
||||
if (textarea) textarea.value = '';
|
||||
if (chipsDrawer) chipsDrawer.classList.add('d-none');
|
||||
|
||||
appendMessage('user', queryText, [], true);
|
||||
|
||||
@@ -351,26 +324,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function populateRoleChips() {
|
||||
const chipsContainer = document.getElementById('aiRoleChipsContainer');
|
||||
if (!chipsContainer || chipsContainer.children.length > 0) return;
|
||||
|
||||
const role = getUserRole();
|
||||
const chips = ROLE_CHIPS[role] || ROLE_CHIPS.alumno;
|
||||
|
||||
chips.forEach(c => {
|
||||
const btn = document.createElement('button');
|
||||
btn.type = 'button';
|
||||
btn.className = 'ai-chip-pill';
|
||||
btn.textContent = c.label;
|
||||
btn.setAttribute('data-query', c.query);
|
||||
btn.addEventListener('click', () => {
|
||||
sendQuery(c.query);
|
||||
});
|
||||
chipsContainer.appendChild(btn);
|
||||
});
|
||||
}
|
||||
|
||||
function initChat() {
|
||||
const launcher = document.getElementById('aiChatLauncher');
|
||||
const panel = document.getElementById('aiChatPanel');
|
||||
@@ -378,10 +331,7 @@
|
||||
const backBtn = document.getElementById('aiChatBackBtn');
|
||||
const closeBtn = document.getElementById('aiChatCloseBtn');
|
||||
const clearBtn = document.getElementById('aiChatClearBtn');
|
||||
const chipsToggleBtn = document.getElementById('aiChatChipsToggleBtn');
|
||||
const plusBtn = document.getElementById('aiChatPlusBtn');
|
||||
const chipsDrawer = document.getElementById('aiChatQuickChips');
|
||||
const closeChipsBtn = document.getElementById('aiChatCloseChipsBtn');
|
||||
const textarea = document.getElementById('aiChatInput');
|
||||
const handleBar = document.getElementById('aiSheetHandleBar');
|
||||
|
||||
@@ -399,8 +349,6 @@
|
||||
document.body.classList.add('ai-chat-mobile-open');
|
||||
}
|
||||
|
||||
populateRoleChips();
|
||||
|
||||
setTimeout(() => {
|
||||
const messagesContainer = document.getElementById('aiChatMessages');
|
||||
if (messagesContainer) messagesContainer.scrollTop = messagesContainer.scrollHeight;
|
||||
@@ -414,7 +362,6 @@
|
||||
launcher.classList.remove('chat-open');
|
||||
document.body.classList.remove('ai-chat-mobile-open');
|
||||
|
||||
if (chipsDrawer) chipsDrawer.classList.add('d-none');
|
||||
if ('speechSynthesis' in window && window.speechSynthesis.speaking) {
|
||||
window.speechSynthesis.cancel();
|
||||
}
|
||||
@@ -459,17 +406,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Drawer de consultas rápidas (+)
|
||||
function toggleChips() {
|
||||
if (!chipsDrawer) return;
|
||||
populateRoleChips();
|
||||
chipsDrawer.classList.toggle('d-none');
|
||||
// Botón + enfoca el campo de entrada
|
||||
if (plusBtn && textarea) {
|
||||
plusBtn.addEventListener('click', () => {
|
||||
textarea.focus();
|
||||
});
|
||||
}
|
||||
if (plusBtn) plusBtn.addEventListener('click', toggleChips);
|
||||
if (chipsToggleBtn) chipsToggleBtn.addEventListener('click', toggleChips);
|
||||
if (closeChipsBtn) closeChipsBtn.addEventListener('click', () => {
|
||||
chipsDrawer.classList.add('d-none');
|
||||
});
|
||||
|
||||
// Manejo del Teclado Virtual en Dispositivos Móviles (visualViewport)
|
||||
if (window.visualViewport) {
|
||||
|
||||
+3
-3
@@ -86,9 +86,9 @@ const env = nunjucks.configure(path.join(__dirname, '../views'), {
|
||||
});
|
||||
|
||||
// Versiones institucionales del sistema
|
||||
const APP_VERSION = '3.8.36';
|
||||
const FRONTEND_VERSION = '3.8.36';
|
||||
const BACKEND_VERSION = '3.8.36';
|
||||
const APP_VERSION = '3.8.37';
|
||||
const FRONTEND_VERSION = '3.8.37';
|
||||
const BACKEND_VERSION = '3.8.37';
|
||||
|
||||
env.addGlobal('app_version', APP_VERSION);
|
||||
env.addGlobal('frontend_version', FRONTEND_VERSION);
|
||||
|
||||
@@ -49,14 +49,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Botones de Acción Derecha: Nuevo Chat + Opciones + Cerrar -->
|
||||
<!-- Botones de Acción Derecha: Nuevo Chat + Cerrar -->
|
||||
<div class="d-flex align-items-center gap-1">
|
||||
<button type="button" class="ai-btn-circle" id="aiChatClearBtn" title="Nueva conversación" aria-label="Nueva conversación">
|
||||
<i class="bi bi-pencil-square fs-6"></i>
|
||||
</button>
|
||||
<button type="button" class="ai-btn-circle" id="aiChatChipsToggleBtn" title="Temas de ayuda" aria-label="Temas sugeridos">
|
||||
<i class="bi bi-sliders fs-6"></i>
|
||||
</button>
|
||||
<button type="button" class="ai-btn-circle d-none d-md-inline-flex" id="aiChatCloseBtn" title="Cerrar ventana" aria-label="Cerrar">
|
||||
<i class="bi bi-x-lg fs-6"></i>
|
||||
</button>
|
||||
@@ -68,17 +65,6 @@
|
||||
<small class="text-muted d-block text-center">UdeCi usa inteligencia artificial para responderte.</small>
|
||||
</div>
|
||||
|
||||
<!-- Panel Desplegable de Temas / Sugerencias Rápidas (+) -->
|
||||
<div id="aiChatQuickChips" class="ai-quick-chips-drawer d-none px-3 py-2 border-bottom">
|
||||
<div class="d-flex align-items-center justify-content-between mb-1">
|
||||
<span class="small fw-semibold text-muted text-uppercase" style="font-size:0.68rem; letter-spacing:0.05em;">Consultas Rápidas</span>
|
||||
<button type="button" class="btn-close btn-close-sm" id="aiChatCloseChipsBtn" aria-label="Ocultar"></button>
|
||||
</div>
|
||||
<div class="ai-chips-container d-flex flex-wrap gap-1" id="aiRoleChipsContainer">
|
||||
<!-- Se inyectan dinámicamente según el rol -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Área de Conversación (Mensajes) -->
|
||||
<div class="ai-chat-messages px-3 py-2" id="aiChatMessages" tabindex="0">
|
||||
<!-- Conversación generada dinámicamente -->
|
||||
@@ -282,30 +268,6 @@
|
||||
color: #64748B !important;
|
||||
}
|
||||
|
||||
/* Drawer de Chips / Consultas Rápidas */
|
||||
.ai-quick-chips-drawer {
|
||||
background: #F8FAFC;
|
||||
max-height: 180px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.ai-chip-pill {
|
||||
font-size: 0.76rem;
|
||||
padding: 5px 12px;
|
||||
border-radius: 20px;
|
||||
background: #FFFFFF;
|
||||
border: 1px solid #CBD5E1;
|
||||
color: #1E293B;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
font-weight: 500;
|
||||
}
|
||||
.ai-chip-pill:hover {
|
||||
background: #B43E8E;
|
||||
border-color: #B43E8E;
|
||||
color: #FFFFFF;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* Área de Mensajes */
|
||||
.ai-chat-messages {
|
||||
flex: 1 1 auto;
|
||||
@@ -532,19 +494,6 @@
|
||||
[data-bs-theme="dark"] .ai-chat-disclaimer small {
|
||||
color: #94A3B8 !important;
|
||||
}
|
||||
[data-bs-theme="dark"] .ai-quick-chips-drawer {
|
||||
background: #131D31;
|
||||
border-bottom-color: #1E293B;
|
||||
}
|
||||
[data-bs-theme="dark"] .ai-chip-pill {
|
||||
background: #1E293B;
|
||||
border-color: #334155;
|
||||
color: #F8FAFC;
|
||||
}
|
||||
[data-bs-theme="dark"] .ai-chip-pill:hover {
|
||||
background: #B43E8E;
|
||||
border-color: #B43E8E;
|
||||
}
|
||||
[data-bs-theme="dark"] .ai-chat-messages {
|
||||
background: #0F172A;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user