feat: arquitectura RAG embebida y asistente UdeCi con botones interactivos (SDD-010, v3.8.25)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "3.8.24",
|
||||
"version": "3.8.25",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,13 +1,32 @@
|
||||
/**
|
||||
* ai-chat-widget.js - Lógica interactiva del Asistente IA (SDD-009)
|
||||
* Maneja el estado conversacional, llamadas AJAX al backend FastAPI,
|
||||
* persistencia de sesión y renderizado accesible de mensajes.
|
||||
* ai-chat-widget.js - Lógica interactiva de UdeCi (SDD-010)
|
||||
* Asistente y Tutor Virtual de UniCABA con soporte RAG,
|
||||
* respuestas concisas y botones de opciones interactivas.
|
||||
*/
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
let isProcessing = false;
|
||||
const STORAGE_KEY = 'edu_space_ai_chat_messages_v1';
|
||||
const STORAGE_KEY = 'edu_space_udeci_chat_history_v2';
|
||||
|
||||
const ROLE_CHIPS = {
|
||||
docente: [
|
||||
{ label: "📍 Aulas y Meet", query: "¿Dónde consulto mis aulas asignadas y salas de Meet?" },
|
||||
{ label: "📝 Actas Gradebook", query: "¿Cómo cargo notas y cierro actas de regularidad?" },
|
||||
{ label: "👥 Ver Comisiones", query: "¿Dónde veo la lista de alumnos inscriptos?" }
|
||||
],
|
||||
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 de aulas?" },
|
||||
{ label: "📑 Importar Sheets", query: "¿Cómo uso el importador de Google Sheets?" }
|
||||
],
|
||||
alumno: [
|
||||
{ label: "📍 ¿Dónde curso hoy?", query: "¿En qué aula curso hoy mis materias?" },
|
||||
{ label: "📚 Mis Materias", query: "¿Dónde consulto mis asignaturas inscriptas?" },
|
||||
{ label: "📊 Calificaciones", query: "¿Cómo veo mis notas y regularidad?" }
|
||||
]
|
||||
};
|
||||
|
||||
function getContainer() {
|
||||
return document.getElementById('aiChatContainer');
|
||||
@@ -15,17 +34,20 @@
|
||||
|
||||
function getUserRole() {
|
||||
const container = getContainer();
|
||||
return (container ? container.getAttribute('data-user-role') : 'alumno') || 'alumno';
|
||||
const rawRole = (container ? container.getAttribute('data-user-role') : 'alumno') || 'alumno';
|
||||
const r = rawRole.toLowerCase();
|
||||
if (r.includes('docente') || r.includes('profesor') || r.includes('teacher')) return 'docente';
|
||||
if (r.includes('bedelia') || r.includes('admin')) return 'bedelia';
|
||||
return 'alumno';
|
||||
}
|
||||
|
||||
function getWelcomeMessage(role) {
|
||||
const r = (role || 'alumno').toLowerCase();
|
||||
if (r.includes('docente') || r.includes('profesor') || r.includes('teacher')) {
|
||||
return "¡Hola! 👋 Soy tu <strong>Tutor de Edu-Space</strong> para Docentes. Puedo orientarte sobre cómo consultar tus aulas asignadas, cargar calificaciones en el <strong>Gradebook</strong>, cerrar actas de regularidad y gestionar enlaces de Google Meet. ¿En qué puedo asistirte?";
|
||||
} else if (r.includes('bedelia') || r.includes('admin')) {
|
||||
return "¡Hola! 👋 Soy el <strong>Asistente Técnico de Bedelía</strong>. Puedo ayudarte con el <strong>flujo secuencial de 9 pasos</strong>, matriz de conflictos áulicos, el Optimizador Genético, importación masiva de Google Sheets y la cola de Moodle 4.1. ¿Qué tarea deseas revisar?";
|
||||
if (role === 'docente') {
|
||||
return "¡Hola! Soy **UdeCi**, tu tutor de Edu-Space para docentes. Puedo orientarte sobre asignaciones de aulas, el Gradebook y clases virtuales.";
|
||||
} else if (role === 'bedelia') {
|
||||
return "¡Hola! Soy **UdeCi**, tu asistente de soporte técnico para Bedelía. Puedo guiarte en el circuito de 9 pasos, resolución de conflictos y Moodle.";
|
||||
} else {
|
||||
return "¡Hola! 👋 Soy tu <strong>Tutor de Cursada</strong>. Puedo ayudarte a consultar en qué aula o sala virtual cursas hoy, ver tus horarios semanales, verificar materias inscriptas y notas académicas. ¿Cuál es tu consulta?";
|
||||
return "¡Hola! Soy **UdeCi**, tu tutor virtual de cursada. Puedo ayudarte a consultar en qué aula cursas hoy, horarios y notas.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,107 +85,73 @@
|
||||
return escaped;
|
||||
}
|
||||
|
||||
function appendMessage(role, content, save = true) {
|
||||
function appendMessage(role, content, options = [], save = true) {
|
||||
const messagesContainer = document.getElementById('aiChatMessages');
|
||||
if (!messagesContainer) return;
|
||||
|
||||
const isUser = role === 'user';
|
||||
const msgDiv = document.createElement('div');
|
||||
msgDiv.className = `ai-msg ${isUser ? 'ai-msg-user' : 'ai-msg-assistant'}`;
|
||||
msgDiv.innerHTML = isUser ? renderMarkdown(content) : renderMarkdown(content);
|
||||
|
||||
let html = renderMarkdown(content);
|
||||
|
||||
// Si es mensaje del asistente y tiene opciones, renderizar botones interactivos
|
||||
if (!isUser && options && options.length > 0) {
|
||||
html += '<div class="ai-msg-options">';
|
||||
options.forEach(opt => {
|
||||
const cleanOpt = opt.replace(/^[📍📝👥🔄⚠️🧬📑📚📊❓]\s*/, '').trim();
|
||||
html += `<button type="button" class="ai-option-btn" data-query="${opt}">${opt}</button>`;
|
||||
});
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
msgDiv.innerHTML = html;
|
||||
messagesContainer.appendChild(msgDiv);
|
||||
messagesContainer.scrollTop = messagesContainer.scrollHeight;
|
||||
|
||||
// Asignar listeners a los botones de opciones dentro de la burbuja
|
||||
msgDiv.querySelectorAll('.ai-option-btn').forEach(btn => {
|
||||
btn.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
const q = this.getAttribute('data-query');
|
||||
if (q) sendQuery(q);
|
||||
});
|
||||
});
|
||||
|
||||
if (save) {
|
||||
const history = loadHistory();
|
||||
history.push({ role, content });
|
||||
history.push({ role, content, options });
|
||||
saveHistory(history);
|
||||
}
|
||||
}
|
||||
|
||||
function initChat() {
|
||||
const launcher = document.getElementById('aiChatLauncher');
|
||||
const panel = document.getElementById('aiChatPanel');
|
||||
const closeBtn = document.getElementById('aiChatCloseBtn');
|
||||
const clearBtn = document.getElementById('aiChatClearBtn');
|
||||
const textarea = document.getElementById('aiChatInput');
|
||||
const form = document.getElementById('aiChatForm');
|
||||
function populateHeaderChips(role) {
|
||||
const headerChips = document.getElementById('aiQuickChipsHeader');
|
||||
if (!headerChips) return;
|
||||
headerChips.innerHTML = '';
|
||||
|
||||
if (!launcher || !panel) return;
|
||||
|
||||
// Toggle panel
|
||||
launcher.addEventListener('click', () => {
|
||||
const isHidden = panel.classList.contains('d-none');
|
||||
if (isHidden) {
|
||||
panel.classList.remove('d-none');
|
||||
launcher.style.transform = 'scale(0.9)';
|
||||
setTimeout(() => {
|
||||
if (textarea) textarea.focus();
|
||||
}, 100);
|
||||
} else {
|
||||
panel.classList.add('d-none');
|
||||
launcher.style.transform = '';
|
||||
}
|
||||
const chips = ROLE_CHIPS[role] || ROLE_CHIPS.alumno;
|
||||
chips.forEach(chip => {
|
||||
const btn = document.createElement('button');
|
||||
btn.type = 'button';
|
||||
btn.className = 'ai-quick-chip';
|
||||
btn.textContent = chip.label;
|
||||
btn.title = chip.query;
|
||||
btn.addEventListener('click', () => sendQuery(chip.query));
|
||||
headerChips.appendChild(btn);
|
||||
});
|
||||
|
||||
if (closeBtn) {
|
||||
closeBtn.addEventListener('click', () => {
|
||||
panel.classList.add('d-none');
|
||||
launcher.style.transform = '';
|
||||
});
|
||||
}
|
||||
|
||||
// Limpiar conversación
|
||||
if (clearBtn) {
|
||||
clearBtn.addEventListener('click', () => {
|
||||
if (confirm('¿Deseas reiniciar la conversación con el tutor?')) {
|
||||
sessionStorage.removeItem(STORAGE_KEY);
|
||||
const messagesContainer = document.getElementById('aiChatMessages');
|
||||
if (messagesContainer) messagesContainer.innerHTML = '';
|
||||
const role = getUserRole();
|
||||
appendMessage('assistant', getWelcomeMessage(role), false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Cargar historial previo o mensaje de bienvenida
|
||||
const history = loadHistory();
|
||||
const role = getUserRole();
|
||||
if (history.length > 0) {
|
||||
history.forEach(msg => appendMessage(msg.role, msg.content, false));
|
||||
} else {
|
||||
appendMessage('assistant', getWelcomeMessage(role), false);
|
||||
}
|
||||
|
||||
// Auto-resize de textarea y atajo Enter
|
||||
if (textarea) {
|
||||
textarea.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
if (form) form.dispatchEvent(new Event('submit', { cancelable: true }));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.handleAiChatSubmit = async function(e) {
|
||||
if (e) e.preventDefault();
|
||||
if (isProcessing) return;
|
||||
async function sendQuery(queryText) {
|
||||
if (!queryText || isProcessing) return;
|
||||
|
||||
const textarea = document.getElementById('aiChatInput');
|
||||
const typing = document.getElementById('aiChatTyping');
|
||||
const sendBtn = document.getElementById('aiChatSendBtn');
|
||||
if (!textarea) return;
|
||||
|
||||
const query = textarea.value.trim();
|
||||
if (!query) return;
|
||||
if (textarea) textarea.value = '';
|
||||
appendMessage('user', queryText, [], true);
|
||||
|
||||
// Limpiar campo de texto y mostrar mensaje del usuario
|
||||
textarea.value = '';
|
||||
appendMessage('user', query, true);
|
||||
|
||||
// Bloquear UI e indicar escritura
|
||||
isProcessing = true;
|
||||
if (typing) typing.classList.remove('d-none');
|
||||
if (sendBtn) sendBtn.disabled = true;
|
||||
@@ -187,19 +175,93 @@
|
||||
|
||||
const data = await res.json();
|
||||
if (res.ok && data.response) {
|
||||
appendMessage('assistant', data.response, true);
|
||||
appendMessage('assistant', data.response, data.quick_options || [], true);
|
||||
} else {
|
||||
const errorMsg = data.detail || data.message || 'El motor de IA local no está respondiendo en este momento.';
|
||||
appendMessage('assistant', `⚠️ <em>${errorMsg}</em>`, false);
|
||||
const errorMsg = data.detail || data.message || 'UdeCi no pudo procesar la respuesta en este momento.';
|
||||
appendMessage('assistant', `⚠️ ${errorMsg}`, [], false);
|
||||
}
|
||||
} catch (err) {
|
||||
appendMessage('assistant', `⚠️ <em>No se pudo comunicar con el servidor local de IA: ${err.message}</em>`, false);
|
||||
appendMessage('assistant', `⚠️ Error de comunicación: ${err.message}`, [], false);
|
||||
} finally {
|
||||
isProcessing = false;
|
||||
if (typing) typing.classList.add('d-none');
|
||||
if (sendBtn) sendBtn.disabled = false;
|
||||
textarea.focus();
|
||||
if (textarea) textarea.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function initChat() {
|
||||
const launcher = document.getElementById('aiChatLauncher');
|
||||
const panel = document.getElementById('aiChatPanel');
|
||||
const closeBtn = document.getElementById('aiChatCloseBtn');
|
||||
const clearBtn = document.getElementById('aiChatClearBtn');
|
||||
const textarea = document.getElementById('aiChatInput');
|
||||
const form = document.getElementById('aiChatForm');
|
||||
|
||||
if (!launcher || !panel) return;
|
||||
|
||||
const role = getUserRole();
|
||||
populateHeaderChips(role);
|
||||
|
||||
// Toggle panel
|
||||
launcher.addEventListener('click', () => {
|
||||
const isHidden = panel.classList.contains('d-none');
|
||||
if (isHidden) {
|
||||
panel.classList.remove('d-none');
|
||||
launcher.style.transform = 'scale(0.9)';
|
||||
setTimeout(() => {
|
||||
if (textarea) textarea.focus();
|
||||
}, 100);
|
||||
} else {
|
||||
panel.classList.add('d-none');
|
||||
launcher.style.transform = '';
|
||||
}
|
||||
});
|
||||
|
||||
if (closeBtn) {
|
||||
closeBtn.addEventListener('click', () => {
|
||||
panel.classList.add('d-none');
|
||||
launcher.style.transform = '';
|
||||
});
|
||||
}
|
||||
|
||||
// Reiniciar conversación
|
||||
if (clearBtn) {
|
||||
clearBtn.addEventListener('click', () => {
|
||||
sessionStorage.removeItem(STORAGE_KEY);
|
||||
const messagesContainer = document.getElementById('aiChatMessages');
|
||||
if (messagesContainer) messagesContainer.innerHTML = '';
|
||||
const initialOptions = (ROLE_CHIPS[role] || []).map(c => c.label);
|
||||
appendMessage('assistant', getWelcomeMessage(role), initialOptions, false);
|
||||
});
|
||||
}
|
||||
|
||||
// Cargar historial previo o mensaje de bienvenida
|
||||
const history = loadHistory();
|
||||
if (history.length > 0) {
|
||||
history.forEach(msg => appendMessage(msg.role, msg.content, msg.options || [], false));
|
||||
} else {
|
||||
const initialOptions = (ROLE_CHIPS[role] || []).map(c => c.label);
|
||||
appendMessage('assistant', getWelcomeMessage(role), initialOptions, false);
|
||||
}
|
||||
|
||||
// Atajo Enter para enviar
|
||||
if (textarea) {
|
||||
textarea.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
if (form) form.dispatchEvent(new Event('submit', { cancelable: true }));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.handleAiChatSubmit = function(e) {
|
||||
if (e) e.preventDefault();
|
||||
const textarea = document.getElementById('aiChatInput');
|
||||
if (!textarea) return;
|
||||
const text = textarea.value.trim();
|
||||
if (text) sendQuery(text);
|
||||
};
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
|
||||
+3
-3
@@ -86,9 +86,9 @@ const env = nunjucks.configure(path.join(__dirname, '../views'), {
|
||||
});
|
||||
|
||||
// Versiones institucionales del sistema
|
||||
const APP_VERSION = '3.8.24';
|
||||
const FRONTEND_VERSION = '3.8.24';
|
||||
const BACKEND_VERSION = '3.8.24';
|
||||
const APP_VERSION = '3.8.25';
|
||||
const FRONTEND_VERSION = '3.8.25';
|
||||
const BACKEND_VERSION = '3.8.25';
|
||||
|
||||
env.addGlobal('app_version', APP_VERSION);
|
||||
env.addGlobal('frontend_version', FRONTEND_VERSION);
|
||||
|
||||
@@ -1,57 +1,64 @@
|
||||
{% set current_role_name = (current_user.role if current_user and current_user.role else (user.role if user and user.role else 'alumno')) | lower %}
|
||||
<!-- ===================================================== -->
|
||||
<!-- WIDGET FLOTANTE: ASISTENTE IA Y CHATBOT CONTEXTUAL -->
|
||||
<!-- SDD-009: UniCABA Edu-Space AI Assistant (Llama.cpp) -->
|
||||
<!-- WIDGET FLOTANTE: UdeCi - TUTOR VIRTUAL UNICABA -->
|
||||
<!-- SDD-010: Arquitectura RAG y Asistencia Contextual -->
|
||||
<!-- ===================================================== -->
|
||||
|
||||
<div id="aiChatContainer" class="ai-chat-container" data-user-role="{{ current_role_name }}">
|
||||
<!-- Botón Lanzador Flotante -->
|
||||
<button id="aiChatLauncher" class="ai-chat-launcher btn shadow-lg" type="button" aria-label="Abrir Asistente IA" title="Asistente IA - Tutor Contextual UniCABA">
|
||||
<span class="ai-launcher-icon"><i class="bi bi-robot"></i></span>
|
||||
<button id="aiChatLauncher" class="ai-chat-launcher btn shadow-lg" type="button" aria-label="Abrir UdeCi" title="UdeCi - Tutor Virtual UniCABA">
|
||||
<span class="ai-launcher-icon"><i class="bi bi-chat-heart-fill"></i></span>
|
||||
<span class="ai-launcher-badge pulse-dot"></span>
|
||||
</button>
|
||||
|
||||
<!-- Panel de Conversación (Expandible) -->
|
||||
<!-- Panel de Conversación -->
|
||||
<div id="aiChatPanel" class="ai-chat-panel card shadow-lg border-0 d-none" role="dialog" aria-modal="true" aria-labelledby="aiChatTitle">
|
||||
<!-- Cabecera del Chat -->
|
||||
<!-- Cabecera Limpia e Institucional de UdeCi -->
|
||||
<div class="card-header ai-chat-header d-flex align-items-center justify-content-between p-3 border-bottom">
|
||||
<div class="d-flex align-items-center gap-2 overflow-hidden">
|
||||
<div class="ai-avatar-circle">
|
||||
<i class="bi bi-cpu-fill text-white"></i>
|
||||
<i class="bi bi-mortarboard-fill text-white"></i>
|
||||
</div>
|
||||
<div class="lh-sm text-truncate">
|
||||
<h6 class="mb-0 fw-bold text-truncate text-white" id="aiChatTitle">
|
||||
Tutor Edu-Space
|
||||
<span class="badge bg-success-subtle text-success-emphasis border border-success-subtle ms-1 font-monospace" style="font-size: 0.65rem;">Llama.cpp</span>
|
||||
</h6>
|
||||
<small class="text-white-50" style="font-size: 0.72rem;">
|
||||
<span class="status-indicator-dot me-1"></span>Qwen3 Coder 30B •
|
||||
<span class="text-uppercase fw-semibold text-warning-emphasis" id="aiRoleBadge">{{ current_role_name }}</span>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<h6 class="mb-0 fw-bold text-white" id="aiChatTitle">UdeCi</h6>
|
||||
<span class="badge bg-white text-primary fw-semibold rounded-pill px-2 py-0" style="font-size: 0.68rem;">Tutor Virtual</span>
|
||||
</div>
|
||||
<small class="text-white-50 d-flex align-items-center gap-1 mt-1" style="font-size: 0.73rem;">
|
||||
<span class="status-indicator-dot"></span>
|
||||
<span>UniCABA • En línea</span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-1">
|
||||
<button type="button" class="btn btn-sm btn-outline-light border-0 py-1 px-2" id="aiChatClearBtn" title="Limpiar conversación">
|
||||
<i class="bi bi-trash3"></i>
|
||||
<button type="button" class="btn btn-sm btn-outline-light border-0 py-1 px-2" id="aiChatClearBtn" title="Reiniciar chat">
|
||||
<i class="bi bi-arrow-clockwise"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-light border-0 py-1 px-2" id="aiChatCloseBtn" title="Minimizar chat">
|
||||
<i class="bi bi-x-lg"></i>
|
||||
<button type="button" class="btn btn-sm btn-outline-light border-0 py-1 px-2" id="aiChatCloseBtn" title="Minimizar">
|
||||
<i class="bi bi-dash-lg"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Cuerpo de Mensajes -->
|
||||
<div class="card-body ai-chat-messages p-3" id="aiChatMessages" tabindex="0">
|
||||
<!-- Mensaje de Bienvenida Inicial generado dinámicamente por JS según el rol -->
|
||||
<!-- Barra Superior de Accesos Rápidos (Sugerencias Iniciales) -->
|
||||
<div class="ai-quick-bar p-2 bg-body-tertiary border-bottom" id="aiQuickBar">
|
||||
<div class="d-flex align-items-center gap-1 overflow-auto py-1" id="aiQuickChipsHeader">
|
||||
<!-- Chips inyectados dinámicamente por JavaScript -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Indicador de Escritura -->
|
||||
<!-- Área de Mensajes -->
|
||||
<div class="card-body ai-chat-messages p-3" id="aiChatMessages" tabindex="0">
|
||||
<!-- Mensaje de bienvenida inicial y conversación -->
|
||||
</div>
|
||||
|
||||
<!-- Indicador de Respuesta en Progreso -->
|
||||
<div id="aiChatTyping" class="ai-typing-indicator px-3 py-1 d-none">
|
||||
<small class="text-muted d-flex align-items-center gap-2">
|
||||
<span class="typing-dot"></span>
|
||||
<span class="typing-dot"></span>
|
||||
<span class="typing-dot"></span>
|
||||
<span>El tutor está formulando la respuesta...</span>
|
||||
<span>UdeCi está respondiendo...</span>
|
||||
</small>
|
||||
</div>
|
||||
|
||||
@@ -60,23 +67,18 @@
|
||||
<form id="aiChatForm" class="d-flex align-items-center gap-2 m-0" onsubmit="handleAiChatSubmit(event)">
|
||||
<textarea id="aiChatInput" class="form-control form-control-sm ai-chat-textarea"
|
||||
rows="1"
|
||||
placeholder="Pregúntale al tutor sobre el sistema..."
|
||||
aria-label="Mensaje para el Asistente"></textarea>
|
||||
<button type="submit" class="btn btn-primary btn-sm rounded-circle ai-send-btn" id="aiChatSendBtn" title="Enviar mensaje">
|
||||
placeholder="Escribe tu consulta aquí..."
|
||||
aria-label="Mensaje para UdeCi"></textarea>
|
||||
<button type="submit" class="btn btn-primary btn-sm rounded-circle ai-send-btn" id="aiChatSendBtn" title="Enviar consulta">
|
||||
<i class="bi bi-send-fill"></i>
|
||||
</button>
|
||||
</form>
|
||||
<div class="text-center mt-1">
|
||||
<small class="text-muted font-monospace" style="font-size: 0.65rem;">
|
||||
Inferencia local segura UniCABA • Presiona Enter para enviar
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* Estilos del Contenedor Flotante */
|
||||
/* Contenedor Flotante */
|
||||
.ai-chat-container {
|
||||
position: fixed;
|
||||
bottom: 24px;
|
||||
@@ -87,38 +89,39 @@
|
||||
|
||||
/* Botón Lanzador */
|
||||
.ai-chat-launcher {
|
||||
width: 58px;
|
||||
height: 58px;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 50% !important;
|
||||
background: linear-gradient(135deg, #B43E8E 0%, #0d6efd 100%) !important;
|
||||
background: linear-gradient(135deg, #B43E8E 0%, #2563eb 100%) !important;
|
||||
color: #ffffff !important;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 2px solid rgba(255, 255, 255, 0.4) !important;
|
||||
border: 2px solid rgba(255, 255, 255, 0.45) !important;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 24px rgba(180, 62, 142, 0.35) !important;
|
||||
transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
|
||||
}
|
||||
.ai-chat-launcher:hover {
|
||||
transform: scale(1.08);
|
||||
box-shadow: 0 10px 25px rgba(180, 62, 142, 0.45) !important;
|
||||
box-shadow: 0 12px 30px rgba(180, 62, 142, 0.5) !important;
|
||||
}
|
||||
.ai-launcher-icon {
|
||||
font-size: 1.65rem;
|
||||
font-size: 1.55rem;
|
||||
line-height: 1;
|
||||
}
|
||||
.pulse-dot {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 4px;
|
||||
top: 3px;
|
||||
right: 3px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background-color: #22c55e;
|
||||
border-radius: 50%;
|
||||
border: 2px solid #ffffff;
|
||||
box-shadow: 0 0 8px #22c55e;
|
||||
animation: aiPulse 2s infinite;
|
||||
animation: aiPulse 2.2s infinite;
|
||||
}
|
||||
@keyframes aiPulse {
|
||||
0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
|
||||
@@ -126,33 +129,33 @@
|
||||
100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
|
||||
}
|
||||
|
||||
/* Panel de Chat */
|
||||
/* Panel de Conversación */
|
||||
.ai-chat-panel {
|
||||
width: 380px;
|
||||
max-width: calc(100vw - 32px);
|
||||
height: 540px;
|
||||
max-height: calc(100vh - 100px);
|
||||
border-radius: 16px !important;
|
||||
height: 520px;
|
||||
max-height: calc(100vh - 90px);
|
||||
border-radius: 18px !important;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
animation: aiSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
||||
animation: aiSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
||||
box-shadow: 0 20px 45px rgba(0, 0, 0, 0.28) !important;
|
||||
}
|
||||
@keyframes aiSlideUp {
|
||||
from { opacity: 0; transform: translateY(20px) scale(0.96); }
|
||||
from { opacity: 0; transform: translateY(16px) scale(0.97); }
|
||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
||||
}
|
||||
|
||||
/* Cabecera del Chat */
|
||||
/* Cabecera */
|
||||
.ai-chat-header {
|
||||
background: linear-gradient(135deg, #992875 0%, #0d6efd 100%) !important;
|
||||
background: linear-gradient(135deg, #B43E8E 0%, #1d4ed8 100%) !important;
|
||||
}
|
||||
.ai-avatar-circle {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.22);
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -166,22 +169,43 @@
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
/* Área de Mensajes */
|
||||
/* Barra de Chips Rápidos */
|
||||
.ai-quick-bar {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ai-quick-chip {
|
||||
font-size: 0.75rem;
|
||||
padding: 3px 10px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(180, 62, 142, 0.3);
|
||||
background-color: rgba(180, 62, 142, 0.08);
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
white-space: nowrap;
|
||||
user-select: none;
|
||||
}
|
||||
.ai-quick-chip:hover {
|
||||
background-color: #B43E8E;
|
||||
color: #ffffff;
|
||||
border-color: #B43E8E;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* Mensajes */
|
||||
.ai-chat-messages {
|
||||
flex: 1 1 auto;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
gap: 10px;
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
/* Burbujas de Mensaje */
|
||||
.ai-msg {
|
||||
max-width: 85%;
|
||||
padding: 10px 14px;
|
||||
max-width: 86%;
|
||||
padding: 9px 13px;
|
||||
border-radius: 14px;
|
||||
font-size: 0.88rem;
|
||||
font-size: 0.86rem;
|
||||
line-height: 1.45;
|
||||
word-break: break-word;
|
||||
}
|
||||
@@ -189,15 +213,15 @@
|
||||
align-self: flex-end;
|
||||
background-color: #0d6efd;
|
||||
color: #ffffff;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-right-radius: 3px;
|
||||
}
|
||||
.ai-msg-assistant {
|
||||
align-self: flex-start;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-left-radius: 3px;
|
||||
}
|
||||
[data-bs-theme="dark"] .ai-msg-assistant {
|
||||
background-color: #1e293b;
|
||||
color: #f1f5f9;
|
||||
color: #f8fafc;
|
||||
border: 1px solid #334155;
|
||||
}
|
||||
[data-bs-theme="light"] .ai-msg-assistant {
|
||||
@@ -206,14 +230,38 @@
|
||||
border: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.ai-msg code {
|
||||
font-size: 0.82rem;
|
||||
padding: 2px 5px;
|
||||
border-radius: 4px;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
/* Botones de sugerencias debajo de la respuesta */
|
||||
.ai-msg-options {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
[data-bs-theme="dark"] .ai-msg code {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
.ai-option-btn {
|
||||
font-size: 0.74rem;
|
||||
padding: 3px 9px;
|
||||
border-radius: 12px;
|
||||
background-color: rgba(13, 110, 253, 0.08);
|
||||
border: 1px solid rgba(13, 110, 253, 0.25);
|
||||
color: #0d6efd;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
[data-bs-theme="dark"] .ai-option-btn {
|
||||
background-color: rgba(56, 189, 248, 0.1);
|
||||
border-color: rgba(56, 189, 248, 0.3);
|
||||
color: #38bdf8;
|
||||
}
|
||||
.ai-option-btn:hover {
|
||||
background-color: #0d6efd;
|
||||
color: #ffffff;
|
||||
border-color: #0d6efd;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
[data-bs-theme="dark"] .ai-option-btn:hover {
|
||||
background-color: #38bdf8;
|
||||
color: #0f172a;
|
||||
border-color: #38bdf8;
|
||||
}
|
||||
|
||||
/* Indicador de Escritura */
|
||||
@@ -232,13 +280,13 @@
|
||||
40% { transform: scale(1.1); opacity: 1; }
|
||||
}
|
||||
|
||||
/* Formulario del Chat */
|
||||
/* Textarea y Botón */
|
||||
.ai-chat-textarea {
|
||||
resize: none;
|
||||
border-radius: 20px;
|
||||
padding-left: 14px;
|
||||
padding-right: 14px;
|
||||
max-height: 80px;
|
||||
border-radius: 18px;
|
||||
padding-left: 12px;
|
||||
padding-right: 12px;
|
||||
max-height: 75px;
|
||||
}
|
||||
.ai-send-btn {
|
||||
width: 36px;
|
||||
@@ -256,10 +304,10 @@
|
||||
}
|
||||
.ai-chat-panel {
|
||||
width: calc(100vw - 32px);
|
||||
height: calc(100vh - 120px);
|
||||
height: calc(100vh - 110px);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Script Lógico del Widget -->
|
||||
<!-- Script Lógico de UdeCi -->
|
||||
<script src="/js/ai-chat-widget.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user