prepare the LLM first, then use it to get per-model autocompleteOptions
This commit is contained in:
parent
c2a616573e
commit
2af7850205
1 changed files with 11 additions and 6 deletions
|
|
@ -114,11 +114,12 @@ export class CompletionProvider {
|
|||
this.loggingService.markDisplayed(completionId, outcome);
|
||||
}
|
||||
|
||||
private async _getAutocompleteOptions() {
|
||||
private async _getAutocompleteOptions(llm: ILLM) {
|
||||
const { config } = await this.configHandler.loadConfig();
|
||||
const options = {
|
||||
...DEFAULT_AUTOCOMPLETE_OPTS,
|
||||
...config?.tabAutocompleteOptions,
|
||||
...llm.autocompleteOptions,
|
||||
};
|
||||
return options;
|
||||
}
|
||||
|
|
@ -136,15 +137,19 @@ export class CompletionProvider {
|
|||
token = controller.signal;
|
||||
}
|
||||
const startTime = Date.now();
|
||||
const options = await this._getAutocompleteOptions();
|
||||
|
||||
// Debounce
|
||||
if (await this.debouncer.delayAndShouldDebounce(options.debounceDelay)) {
|
||||
// NOTE: There shouldn't be too big of a performance penalty here.
|
||||
// If this ends up introducing too big of a bottleneck,
|
||||
// we should consider a more clever way of passing llm to _getAutocompleteOptions.
|
||||
const llm = await this._prepareLlm();
|
||||
if (!llm) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const llm = await this._prepareLlm();
|
||||
if (!llm) {
|
||||
const options = await this._getAutocompleteOptions(llm);
|
||||
|
||||
// Debounce
|
||||
if (await this.debouncer.delayAndShouldDebounce(options.debounceDelay)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue