MCPcopy Create free account
hub / github.com/Stevenic/codepilot / load

Method load

src/CodeIndex.ts:233–254  ·  view source on GitHub ↗

* Loads the current code index.

()

Source from the content-addressed store, hash-verified

231 * Loads the current code index.
232 */
233 public async load(): Promise<LocalDocumentIndex> {
234 if (!this._config) {
235 const configPath = path.join(this.folderPath, 'config.json');
236 this._config = JSON.parse(await fs.readFile(configPath, 'utf-8'));
237 }
238
239 if (!this._keys) {
240 const keysPath = path.join(this.folderPath, 'vectra.keys');
241 this._keys = JSON.parse(await fs.readFile(keysPath, 'utf-8'));
242 }
243
244 if (!this._index) {
245 const folderPath = path.join(this.folderPath, 'index');
246 const embeddings = new OpenAIEmbeddings(Object.assign({ model: 'text-embedding-ada-002' }, this._keys));
247 this._index = new LocalDocumentIndex({
248 folderPath,
249 embeddings,
250 });
251 }
252
253 return this._index;
254 }
255
256 // LLM-REGION
257

Callers 5

runFunction · 0.95
createMethod · 0.95
queryMethod · 0.95
rebuildMethod · 0.95
upsertDocumentMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected