fix(core): resolve TypeScript compilation errors and test failures
- Add missing 'level' property to HNSWNoun objects in storage adapters - Fix HNSWVerb type compatibility in CacheManager imports - Clear statistics cache when clearing storage to prevent stale data - Update test expectations to match actual HNSW index behavior (includes both nouns and verbs) - Add StatisticsCollector utility for enhanced metrics tracking - Improve statistics comparison in tests to handle volatile fields
This commit is contained in:
parent
649e452ff9
commit
cfaf2f8b83
12 changed files with 668 additions and 112 deletions
|
|
@ -193,7 +193,8 @@ export class FileSystemStorage extends BaseStorage {
|
|||
return {
|
||||
id: parsedNode.id,
|
||||
vector: parsedNode.vector,
|
||||
connections
|
||||
connections,
|
||||
level: parsedNode.level || 0
|
||||
}
|
||||
} catch (error: any) {
|
||||
if (error.code !== 'ENOENT') {
|
||||
|
|
@ -229,7 +230,8 @@ export class FileSystemStorage extends BaseStorage {
|
|||
allNodes.push({
|
||||
id: parsedNode.id,
|
||||
vector: parsedNode.vector,
|
||||
connections
|
||||
connections,
|
||||
level: parsedNode.level || 0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -273,7 +275,8 @@ export class FileSystemStorage extends BaseStorage {
|
|||
nouns.push({
|
||||
id: parsedNode.id,
|
||||
vector: parsedNode.vector,
|
||||
connections
|
||||
connections,
|
||||
level: parsedNode.level || 0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -575,6 +578,10 @@ export class FileSystemStorage extends BaseStorage {
|
|||
|
||||
// Remove all files in the index directory
|
||||
await removeDirectoryContents(this.indexDir)
|
||||
|
||||
// Clear the statistics cache
|
||||
this.statisticsCache = null
|
||||
this.statisticsModified = false
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue