feat(ai-chat): enable deep live context by user identity and role (v3.8.31)
This commit is contained in:
@@ -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()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user