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

Method setConfig

lib/CodeIndex.js:313–342  ·  view source on GitHub ↗

* Updates the code index configuration. * @param config Settings to update.

(config)

Source from the content-addressed store, hash-verified

311 * @param config Settings to update.
312 */
313 setConfig(config) {
314 return __awaiter(this, void 0, void 0, function* () {
315 if (!(yield this.isCreated())) {
316 throw new Error('Index has not been created yet. Please run `codepilot create` first.');
317 }
318 // Ensure config loaded
319 const configPath = path.join(this.folderPath, 'config.json');
320 if (!this._config) {
321 this._config = JSON.parse(yield fs.readFile(configPath, 'utf-8'));
322 }
323 // Clone config
324 const newConfig = Object.assign({}, this._config);
325 // Apply changes
326 if (config.model !== undefined) {
327 newConfig.model = config.model;
328 }
329 if (config.max_input_tokens !== undefined) {
330 newConfig.max_input_tokens = config.max_input_tokens;
331 }
332 if (config.max_tokens !== undefined) {
333 newConfig.max_tokens = config.max_tokens;
334 }
335 if (config.temperature !== undefined) {
336 newConfig.temperature = config.temperature;
337 }
338 // Write config
339 yield fs.writeFile(configPath, JSON.stringify(newConfig));
340 this._config = newConfig;
341 });
342 }
343 // LLM-REGION
344 /**
345 * Adds a document to the index.

Callers 1

runFunction · 0.95

Calls 1

isCreatedMethod · 0.95

Tested by

no test coverage detected