refactor(ai): remove quick chips drawer to keep chat view clean and minimal (v3.8.37)

This commit is contained in:
2026-10-27 22:44:49 -03:00
parent 939878c4a8
commit bd88dfdd19
8 changed files with 23 additions and 127 deletions
+5 -63
View File
@@ -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) {