* Updates the OpenAI keys for the index. * @param keys Keys to use.
(keys: OpenAIKeys)
| 358 | * @param keys Keys to use. |
| 359 | */ |
| 360 | public async setKeys(keys: OpenAIKeys): Promise<void> { |
| 361 | if (!await this.isCreated()) { |
| 362 | throw new Error('Index has not been created yet. Please run `codepilot create` first.'); |
| 363 | } |
| 364 | |
| 365 | // Overwrite keys file |
| 366 | await fs.writeFile(path.join(this.folderPath, 'vectra.keys'), JSON.stringify(keys)); |
| 367 | this._keys = keys; |
| 368 | } |
| 369 | |
| 370 | /** |
| 371 | * Updates the code index configuration. |