Implement database migration framework and performance optimizations

- Added active memory configuration for manual interval and Gemini tool.
- Created file modification rules for handling edits and writes.
- Implemented migration manager for managing database schema migrations.
- Added migration 001 to normalize keywords into separate tables.
- Developed tests for validating performance optimizations including keyword normalization, path lookup, and symbol search.
- Created validation script to manually verify optimization implementations.
This commit is contained in:
catlog22
2025-12-14 18:08:32 +08:00
parent 79a2953862
commit 0529b57694
18 changed files with 2085 additions and 545 deletions

View File

@@ -3757,3 +3757,205 @@
.btn-ghost.text-destructive:hover {
background: hsl(var(--destructive) / 0.1);
}
/* ========================================
* Semantic Metadata Viewer Styles
* ======================================== */
.semantic-viewer-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.75rem 1rem;
background: hsl(var(--muted) / 0.3);
border-bottom: 1px solid hsl(var(--border));
}
.semantic-table-container {
max-height: 400px;
overflow-y: auto;
}
.semantic-table {
width: 100%;
border-collapse: collapse;
font-size: 0.8125rem;
}
.semantic-table th {
position: sticky;
top: 0;
background: hsl(var(--card));
padding: 0.625rem 0.75rem;
text-align: left;
font-weight: 600;
font-size: 0.75rem;
color: hsl(var(--muted-foreground));
border-bottom: 1px solid hsl(var(--border));
white-space: nowrap;
}
.semantic-table td {
padding: 0.625rem 0.75rem;
border-bottom: 1px solid hsl(var(--border) / 0.5);
vertical-align: top;
}
.semantic-row {
cursor: pointer;
transition: background 0.15s ease;
}
.semantic-row:hover {
background: hsl(var(--hover));
}
.semantic-cell-file {
max-width: 200px;
}
.semantic-cell-lang {
width: 80px;
color: hsl(var(--muted-foreground));
}
.semantic-cell-purpose {
max-width: 180px;
color: hsl(var(--foreground) / 0.8);
}
.semantic-cell-keywords {
max-width: 160px;
}
.semantic-cell-tool {
width: 70px;
}
.semantic-cell-date {
width: 80px;
color: hsl(var(--muted-foreground));
font-size: 0.75rem;
}
.semantic-keyword {
display: inline-block;
padding: 0.125rem 0.375rem;
margin: 0.125rem;
background: hsl(var(--primary) / 0.1);
color: hsl(var(--primary));
border-radius: 0.25rem;
font-size: 0.6875rem;
}
.semantic-keyword-more {
display: inline-block;
padding: 0.125rem 0.375rem;
margin: 0.125rem;
background: hsl(var(--muted));
color: hsl(var(--muted-foreground));
border-radius: 0.25rem;
font-size: 0.6875rem;
}
.tool-badge {
display: inline-block;
padding: 0.125rem 0.5rem;
border-radius: 0.25rem;
font-size: 0.6875rem;
font-weight: 500;
text-transform: capitalize;
}
.tool-badge.tool-gemini {
background: hsl(210 80% 55% / 0.15);
color: hsl(210 80% 45%);
}
.tool-badge.tool-qwen {
background: hsl(142 76% 36% / 0.15);
color: hsl(142 76% 36%);
}
.tool-badge.tool-unknown {
background: hsl(var(--muted));
color: hsl(var(--muted-foreground));
}
.semantic-detail-row {
background: hsl(var(--muted) / 0.2);
}
.semantic-detail-row.hidden {
display: none;
}
.semantic-detail-content {
padding: 1rem;
}
.semantic-detail-section {
margin-bottom: 1rem;
}
.semantic-detail-section h4 {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.75rem;
font-weight: 600;
color: hsl(var(--muted-foreground));
margin-bottom: 0.5rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.semantic-detail-section p {
font-size: 0.8125rem;
line-height: 1.5;
color: hsl(var(--foreground));
}
.semantic-keywords-full {
display: flex;
flex-wrap: wrap;
gap: 0.25rem;
}
.semantic-detail-meta {
display: flex;
gap: 1rem;
padding-top: 0.75rem;
border-top: 1px solid hsl(var(--border) / 0.5);
font-size: 0.75rem;
color: hsl(var(--muted-foreground));
}
.semantic-detail-meta span {
display: flex;
align-items: center;
gap: 0.375rem;
}
.semantic-viewer-footer {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.75rem 1rem;
background: hsl(var(--muted) / 0.3);
border-top: 1px solid hsl(var(--border));
}
.semantic-loading,
.semantic-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 3rem;
text-align: center;
color: hsl(var(--muted-foreground));
}
.semantic-loading {
gap: 1rem;
}

View File

@@ -2097,7 +2097,7 @@
position: fixed;
top: 0;
right: 0;
width: 480px;
width: 50vw;
max-width: 100vw;
height: 100vh;
background: hsl(var(--card));
@@ -2132,7 +2132,6 @@
justify-content: space-between;
padding: 1rem 1.25rem;
border-bottom: 1px solid hsl(var(--border));
background: hsl(var(--muted) / 0.3);
}
.insight-detail-header h3 {

View File

@@ -238,6 +238,31 @@ function handleNotification(data) {
}
break;
case 'ACTIVE_MEMORY_SYNCED':
// Handle Active Memory sync completion
if (typeof addGlobalNotification === 'function') {
const { filesAnalyzed, tool, usedCli } = payload;
const method = usedCli ? `CLI (${tool})` : 'Basic';
addGlobalNotification(
'success',
'Active Memory synced',
{
'Files Analyzed': filesAnalyzed,
'Method': method,
'Timestamp': new Date(payload.timestamp).toLocaleTimeString()
},
'Memory'
);
}
// Refresh Active Memory status if on memory view
if (getCurrentView && getCurrentView() === 'memory') {
if (typeof loadActiveMemoryStatus === 'function') {
loadActiveMemoryStatus();
}
}
console.log('[Active Memory] Sync completed:', payload);
break;
default:
console.log('[WS] Unknown notification type:', type);
}