feat: anti-prompt injection, live context db entities and udeci ux/ui refinement v3.8.28
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "3.8.27",
|
||||
"version": "3.8.28",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -149,23 +149,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function populateHeaderChips(role) {
|
||||
const headerChips = document.getElementById('aiQuickChipsHeader');
|
||||
if (!headerChips) return;
|
||||
headerChips.innerHTML = '';
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
async function sendQuery(queryText) {
|
||||
if (!queryText || isProcessing) return;
|
||||
|
||||
@@ -239,7 +222,6 @@
|
||||
if (!launcher || !panel) return;
|
||||
|
||||
const role = getUserRole();
|
||||
populateHeaderChips(role);
|
||||
|
||||
// Toggle panel
|
||||
launcher.addEventListener('click', () => {
|
||||
@@ -269,8 +251,7 @@
|
||||
sessionStorage.removeItem(getStorageKey());
|
||||
const messagesContainer = document.getElementById('aiChatMessages');
|
||||
if (messagesContainer) messagesContainer.innerHTML = '';
|
||||
const initialOptions = (ROLE_CHIPS[role] || []).map(c => c.label);
|
||||
appendMessage('assistant', getWelcomeMessage(role), initialOptions, false);
|
||||
appendMessage('assistant', getWelcomeMessage(role), [], false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -279,8 +260,7 @@
|
||||
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);
|
||||
appendMessage('assistant', getWelcomeMessage(role), [], false);
|
||||
}
|
||||
|
||||
// Atajo Enter para enviar
|
||||
|
||||
@@ -46,13 +46,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<!-- Área de Mensajes -->
|
||||
<div class="card-body ai-chat-messages p-3" id="aiChatMessages" tabindex="0">
|
||||
<!-- Mensaje de bienvenida inicial y conversación -->
|
||||
@@ -69,7 +62,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Área de Entrada / Envío -->
|
||||
<div class="card-footer ai-chat-footer p-2 bg-body-tertiary border-top">
|
||||
<div class="card-footer ai-chat-footer p-2 border-top">
|
||||
<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"
|
||||
@@ -146,17 +139,75 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
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;
|
||||
box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45) !important;
|
||||
backdrop-filter: none !important;
|
||||
-webkit-backdrop-filter: none !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
@keyframes aiSlideUp {
|
||||
from { opacity: 0; transform: translateY(16px) scale(0.97); }
|
||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
||||
}
|
||||
|
||||
/* Cabecera */
|
||||
.ai-chat-header {
|
||||
background: linear-gradient(135deg, #B43E8E 0%, #1d4ed8 100%) !important;
|
||||
/* Modo Oscuro 100% Sólido y Opaco (Cero Transparencia) */
|
||||
[data-bs-theme="dark"] .ai-chat-panel,
|
||||
[data-bs-theme="dark"] #aiChatPanel {
|
||||
background-color: #0f172a !important;
|
||||
background: #0f172a !important;
|
||||
border: 1px solid #334155 !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
[data-bs-theme="dark"] .ai-chat-header {
|
||||
background-color: #1e293b !important;
|
||||
background: #1e293b !important;
|
||||
border-bottom: 1px solid #334155 !important;
|
||||
}
|
||||
[data-bs-theme="dark"] .ai-chat-messages,
|
||||
[data-bs-theme="dark"] #aiChatMessages {
|
||||
background-color: #0f172a !important;
|
||||
background: #0f172a !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
[data-bs-theme="dark"] .ai-chat-footer {
|
||||
background-color: #1e293b !important;
|
||||
background: #1e293b !important;
|
||||
border-top: 1px solid #334155 !important;
|
||||
}
|
||||
[data-bs-theme="dark"] .ai-chat-textarea {
|
||||
background-color: #0f172a !important;
|
||||
color: #f8fafc !important;
|
||||
border: 1px solid #475569 !important;
|
||||
}
|
||||
|
||||
/* Modo Claro 100% Sólido y Opaco */
|
||||
[data-bs-theme="light"] .ai-chat-panel,
|
||||
[data-bs-theme="light"] #aiChatPanel {
|
||||
background-color: #ffffff !important;
|
||||
background: #ffffff !important;
|
||||
border: 1px solid rgba(180, 62, 142, 0.25) !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
[data-bs-theme="light"] .ai-chat-header {
|
||||
background: linear-gradient(135deg, #B43E8E 0%, #8A256B 100%) !important;
|
||||
border-bottom: 1px solid rgba(180, 62, 142, 0.2) !important;
|
||||
}
|
||||
[data-bs-theme="light"] .ai-chat-messages,
|
||||
[data-bs-theme="light"] #aiChatMessages {
|
||||
background-color: #FAF5F8 !important;
|
||||
background: #FAF5F8 !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
[data-bs-theme="light"] .ai-chat-footer {
|
||||
background-color: #ffffff !important;
|
||||
background: #ffffff !important;
|
||||
border-top: 1px solid rgba(180, 62, 142, 0.2) !important;
|
||||
}
|
||||
[data-bs-theme="light"] .ai-chat-textarea {
|
||||
background-color: #ffffff !important;
|
||||
color: #1e293b !important;
|
||||
border: 1px solid #cbd5e1 !important;
|
||||
}
|
||||
|
||||
.ai-avatar-circle {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
@@ -175,29 +226,6 @@
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
Reference in New Issue
Block a user