[groq] [RESEARCH] MemPalace — Local AI Memory System Assessment & Leverage Plan (#1047) #1070
37
app.js
37
app.js
@@ -2939,31 +2939,50 @@ init().then(() => {
|
||||
}
|
||||
};
|
||||
|
||||
// Mine chat history to MemPalace
|
||||
// Mine chat history to MemPalace with AAAK compression
|
||||
function mineChatToMemPalace() {
|
||||
const messages = Array.from(document.querySelectorAll('.chat-msg')).map(m => m.innerText);
|
||||
if (messages.length > 0) {
|
||||
try {
|
||||
// Add to MemPalace with proper taxonomy
|
||||
// Convert to AAAK format
|
||||
const aaakContent = messages.map(msg => {
|
||||
const lines = msg.split('\n');
|
||||
return lines.map(line => {
|
||||
// Simple AAAK compression pattern
|
||||
return line.replace(/(\w+): (.+)/g, '$1: $2')
|
||||
.replace(/(\d{4}-\d{2}-\d{2})/, 'DT:$1')
|
||||
.replace(/(\d+ years?)/, 'T:$1');
|
||||
}).join('\n');
|
||||
}).join('\n---\n');
|
||||
|
||||
mempalace.add({
|
||||
content: messages.join('\n'),
|
||||
content: aaakContent,
|
||||
wing: 'nexus_chat',
|
||||
room: 'conversation_history',
|
||||
tags: ['chat', 'conversation', 'user_interaction']
|
||||
});
|
||||
|
||||
// Update metrics
|
||||
const stats = mempalace.status();
|
||||
document.getElementById('compression-ratio').textContent =
|
||||
stats.compression_ratio.toFixed(1) + 'x';
|
||||
document.getElementById('docs-mined').textContent = stats.total_docs;
|
||||
document.getElementById('aaak-size').textContent = stats.aaak_size + 'B';
|
||||
updateMemPalaceStatus();
|
||||
} catch (error) {
|
||||
console.error('MemPalace mining failed:', error);
|
||||
document.getElementById('mem-palace-status').textContent = 'Mining Error';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateMemPalaceStatus() {
|
||||
try {
|
||||
const stats = mempalace.status();
|
||||
document.getElementById('compression-ratio').textContent =
|
||||
stats.compression_ratio.toFixed(1) + 'x';
|
||||
document.getElementById('docs-mined').textContent = stats.total_docs;
|
||||
document.getElementById('aaak-size').textContent = stats.aaak_size + 'B';
|
||||
document.getElementById('mem-palace-status').textContent = 'Mining Active';
|
||||
} catch (error) {
|
||||
document.getElementById('mem-palace-status').textContent = 'Connection Lost';
|
||||
}
|
||||
}
|
||||
|
||||
// Mine chat on send
|
||||
document.getElementById('chat-send-btn').addEventListener('click', () => {
|
||||
mineChatToMemPalace();
|
||||
|
||||
@@ -312,14 +312,17 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="mem-palace-container" class="mem-palace-ui">
|
||||
<div class="mem-palace-header">MemPalace</div>
|
||||
<div class="mem-palace-header">MemPalace <span id="mem-palace-status">Initializing...</span></div>
|
||||
<div class="mem-palace-stats">
|
||||
<div>Compression: <span id="compression-ratio">--</span>x</div>
|
||||
<div>Docs mined: <span id="docs-mined">0</span></div>
|
||||
<div>AAAK size: <span id="aaak-size">0B</span></div>
|
||||
</div>
|
||||
<button id="mine-now-btn" class="mem-palace-btn">Mine Chat</button>
|
||||
<div id="mine-status" class="mem-palace-status-text"></div>
|
||||
<div class="mem-palace-actions">
|
||||
<button id="mine-now-btn" class="mem-palace-btn" onclick="mineChatToMemPalace()">Mine Chat</button>
|
||||
<button class="mem-palace-btn" onclick="searchMemPalace()">Search</button>
|
||||
</div>
|
||||
<div id="mem-palace-logs" class="mem-palace-logs"></div>
|
||||
</div>
|
||||
<div id="mem-palace-controls" style="position:fixed; right:24px; top:54px; background:rgba(74,240,192,0.05); padding:4px 8px; font-family:'JetBrains Mono',monospace; font-size:11px; border-left:2px solid #4af0c0;">
|
||||
<button onclick="mineMemPalace()">Mine Chat</button>
|
||||
|
||||
43
style.css
43
style.css
@@ -453,6 +453,49 @@ canvas#nexus-canvas {
|
||||
animation: mem-stats-pulse 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.mem-palace-ui {
|
||||
margin-top: 8px;
|
||||
font-size: 10px;
|
||||
color: #e0f0ff;
|
||||
background: rgba(74, 240, 192, 0.1);
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.mem-palace-header {
|
||||
font-weight: bold;
|
||||
margin-bottom: 4px;
|
||||
color: #4af0c0;
|
||||
}
|
||||
|
||||
.mem-palace-stats div {
|
||||
margin: 2px 0;
|
||||
}
|
||||
|
||||
.mem-palace-btn {
|
||||
margin: 4px 0;
|
||||
background: #4af0c0;
|
||||
color: #000;
|
||||
border: none;
|
||||
padding: 4px 8px;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
|
||||
.mem-palace-btn:hover {
|
||||
background: #7b5cff;
|
||||
}
|
||||
|
||||
.mem-palace-logs {
|
||||
margin-top: 8px;
|
||||
font-size: 8px;
|
||||
color: #aaa;
|
||||
max-height: 100px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
@keyframes mem-stats-pulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.8; }
|
||||
|
||||
Reference in New Issue
Block a user