Add comprehensive tests for vector/semantic search functionality

- Implement full coverage tests for Embedder model loading and embedding generation
- Add CRUD operations and caching tests for VectorStore
- Include cosine similarity computation tests
- Validate semantic search accuracy and relevance through various queries
- Establish performance benchmarks for embedding and search operations
- Ensure edge cases and error handling are covered
- Test thread safety and concurrent access scenarios
- Verify availability of semantic search dependencies
This commit is contained in:
catlog22
2025-12-14 17:17:09 +08:00
parent 8d542b8e45
commit 79a2953862
47 changed files with 11208 additions and 4336 deletions

View File

@@ -194,6 +194,50 @@ function handleNotification(data) {
}
break;
// CLI Review Events
case 'CLI_REVIEW_UPDATED':
if (typeof handleCliReviewUpdated === 'function') {
handleCliReviewUpdated(payload);
}
// Also refresh CLI history to show review status
if (typeof refreshCliHistory === 'function') {
refreshCliHistory();
}
break;
// System Notify Events (from CLI commands)
case 'REFRESH_REQUIRED':
handleRefreshRequired(payload);
break;
case 'MEMORY_UPDATED':
if (typeof handleMemoryUpdated === 'function') {
handleMemoryUpdated(payload);
}
// Force refresh of memory view if active
if (getCurrentView && getCurrentView() === 'memory') {
if (typeof loadMemoryStats === 'function') {
loadMemoryStats().then(function() {
if (typeof renderHotspotsColumn === 'function') renderHotspotsColumn();
});
}
}
break;
case 'HISTORY_UPDATED':
// Refresh CLI history when updated externally
if (typeof refreshCliHistory === 'function') {
refreshCliHistory();
}
break;
case 'INSIGHT_GENERATED':
// Refresh insights when new insight is generated
if (typeof loadInsightsHistory === 'function') {
loadInsightsHistory();
}
break;
default:
console.log('[WS] Unknown notification type:', type);
}
@@ -427,6 +471,60 @@ async function refreshWorkspaceData(newData) {
lastDataHash = calculateDataHash();
}
/**
* Handle REFRESH_REQUIRED events from CLI commands
* @param {Object} payload - Contains scope (memory|history|insights|all)
*/
function handleRefreshRequired(payload) {
const scope = payload?.scope || 'all';
console.log('[WS] Refresh required for scope:', scope);
switch (scope) {
case 'memory':
// Refresh memory stats and graph
if (typeof loadMemoryStats === 'function') {
loadMemoryStats().then(function() {
if (typeof renderHotspotsColumn === 'function') renderHotspotsColumn();
});
}
if (typeof loadMemoryGraph === 'function') {
loadMemoryGraph();
}
break;
case 'history':
// Refresh CLI history
if (typeof refreshCliHistory === 'function') {
refreshCliHistory();
}
break;
case 'insights':
// Refresh insights history
if (typeof loadInsightsHistory === 'function') {
loadInsightsHistory();
}
break;
case 'all':
default:
// Refresh everything
refreshIfNeeded();
if (typeof loadMemoryStats === 'function') {
loadMemoryStats().then(function() {
if (typeof renderHotspotsColumn === 'function') renderHotspotsColumn();
});
}
if (typeof refreshCliHistory === 'function') {
refreshCliHistory();
}
if (typeof loadInsightsHistory === 'function') {
loadInsightsHistory();
}
break;
}
}
// ========== Cleanup ==========
function stopAutoRefresh() {
if (autoRefreshInterval) {