MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / setup

Function setup

packages/node-runtime/src/semantic-index/warmup/runner.test.ts:78–91  ·  view source on GitHub ↗
(messages: ChunkMessageInput[])

Source from the content-addressed store, hash-verified

76}
77
78function setup(messages: ChunkMessageInput[]) {
79 const dir = makeTempDir()
80 const dbPath = path.join(dir, 'embedding_index.db')
81 const store = new EmbeddingIndexStore(dbPath)
82 const stateStore = new SemanticIndexStateStore(dbPath)
83 stateStore.enable({
84 dbPathHash: DB_HASH,
85 dbPath: '/chat/a.db',
86 modelId: MODEL,
87 chunkerVersion: 'v1.1',
88 chunkerConfigHash: 'cfg',
89 })
90 return { store, stateStore, source: makeSource(messages) }
91}
92
93function countStored(store: EmbeddingIndexStore): number {
94 return store.queryDense({ dbPathHash: DB_HASH, modelId: MODEL, dim: 4, embedding: [1, 0, 0, 0], k: 1000 }).length

Callers 1

runner.test.tsFile · 0.70

Calls 3

enableMethod · 0.95
makeSourceFunction · 0.85
makeTempDirFunction · 0.70

Tested by

no test coverage detected