MCPcopy Index your code
hub / github.com/Stevenic/codepilot / load

Method load

lib/CodeIndex.js:184–204  ·  view source on GitHub ↗

* Loads the current code index.

()

Source from the content-addressed store, hash-verified

182 * Loads the current code index.
183 */
184 load() {
185 return __awaiter(this, void 0, void 0, function* () {
186 if (!this._config) {
187 const configPath = path.join(this.folderPath, 'config.json');
188 this._config = JSON.parse(yield fs.readFile(configPath, 'utf-8'));
189 }
190 if (!this._keys) {
191 const keysPath = path.join(this.folderPath, 'vectra.keys');
192 this._keys = JSON.parse(yield fs.readFile(keysPath, 'utf-8'));
193 }
194 if (!this._index) {
195 const folderPath = path.join(this.folderPath, 'index');
196 const embeddings = new vectra_1.OpenAIEmbeddings(Object.assign({ model: 'text-embedding-ada-002' }, this._keys));
197 this._index = new vectra_1.LocalDocumentIndex({
198 folderPath,
199 embeddings,
200 });
201 }
202 return this._index;
203 });
204 }
205 // LLM-REGION
206 /**
207 * Queries the code index.

Callers 5

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

Calls

no outgoing calls

Tested by

no test coverage detected