feat: enhance local knowledge retrieval

This commit is contained in:
lofyer
2026-08-12 21:45:47 +08:00
parent e0e5a8c1b3
commit 111f487e20
65 changed files with 13517 additions and 1155 deletions
+19
View File
@@ -3,6 +3,7 @@ import {
embeddingDiagnosticResultSchema,
embeddingIndexJobSchema,
embeddingIndexStatusSchema,
knowledgeEmbeddingIndexSnapshotSchema,
embeddingSafeErrorSchema,
isEmbeddingIndexJobActive
} from './embedding-contracts'
@@ -130,4 +131,22 @@ describe('embedding contracts', () => {
}).success
).toBe(false)
})
it('validates library-scoped embedding coverage totals', () => {
const base = {
knowledgeBaseId: '11111111-1111-4111-8111-111111111111',
enabled: true,
coverage: { total: 4, indexed: 2, missing: 1, error: 1 },
indexStatus: { job: null }
}
expect(
knowledgeEmbeddingIndexSnapshotSchema.safeParse(base).success
).toBe(true)
expect(
knowledgeEmbeddingIndexSnapshotSchema.safeParse({
...base,
coverage: { total: 4, indexed: 2, missing: 2, error: 1 }
}).success
).toBe(false)
})
})