feat(ai-chat): enable deep live context by user identity and role (v3.8.31)

This commit is contained in:
2026-10-27 14:59:50 -03:00
parent da7c96d083
commit 32fdd7dbfe
12 changed files with 514 additions and 49 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "3.8.30",
"version": "3.8.31",
"description": "",
"main": "index.js",
"scripts": {
+14
View File
@@ -71,6 +71,16 @@
return (container ? container.getAttribute('data-user-name') : '') || '';
}
function getRawUserId() {
const container = getContainer();
return (container ? container.getAttribute('data-user-id') : '') || '';
}
function getUserEmail() {
const container = getContainer();
return (container ? container.getAttribute('data-user-email') : '') || '';
}
function getWelcomeMessage(role, name) {
const greeting = name ? `¡Hola, **${name}**! 👋` : '¡Hola! 👋';
if (role === 'admin') {
@@ -174,6 +184,8 @@
const userRole = getUserRole();
const userName = getUserName();
const rawUserId = getRawUserId();
const userEmail = getUserEmail();
const rawHistory = loadHistory();
const payloadMessages = rawHistory.map(m => ({
role: m.role,
@@ -188,6 +200,8 @@
messages: payloadMessages,
user_role: userRole,
user_name: userName,
user_id: rawUserId || null,
user_email: userEmail || null,
current_path: window.location.pathname,
conversation_id: getUserId()
})
+3 -3
View File
@@ -86,9 +86,9 @@ const env = nunjucks.configure(path.join(__dirname, '../views'), {
});
// Versiones institucionales del sistema
const APP_VERSION = '3.8.30';
const FRONTEND_VERSION = '3.8.30';
const BACKEND_VERSION = '3.8.30';
const APP_VERSION = '3.8.31';
const FRONTEND_VERSION = '3.8.31';
const BACKEND_VERSION = '3.8.31';
env.addGlobal('app_version', APP_VERSION);
env.addGlobal('frontend_version', FRONTEND_VERSION);