Skip to content

Commit 34559a3

Browse files
authored
Fix stale models when using Bedrock (#10803)
Address #10763 If Bedrock is the only provider, there won't be any default models. This causes unexpected behaviour and falling back on the model cache would show unavailable models. ### Release Notes #### New Features - N/A #### Bug Fixes - Fix stale Assistant model listing when Bedrock is the only registered provider ### QA Notes Bedrock should be the only provider registered. I don't think Copilot has to be registered and unregistered first. Having Bedrock and only Bedrock is what causes a no default model situation, which causes no models to be shown or a stale model list.
1 parent b5b809e commit 34559a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

extensions/positron-assistant/src/models.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ export class OpenAILanguageModel extends AILanguageModel implements positron.ai.
846846
})
847847
);
848848

849-
return models;
849+
return markDefaultModel(models, this.provider, this._config.model);
850850
} catch (error) {
851851
log.warn(`[${this.providerName}] Failed to fetch models from API: ${error}`);
852852
return undefined;
@@ -1410,7 +1410,7 @@ export class AWSLanguageModel extends AILanguageModel implements positron.ai.Lan
14101410
})
14111411
);
14121412

1413-
return modelListing;
1413+
return markDefaultModel(modelListing, this.provider, this._config.model);
14141414
}
14151415

14161416
private async retrieveModelsFromApi(): Promise<vscode.LanguageModelChatInformation[] | undefined> {
@@ -1467,7 +1467,7 @@ export class AWSLanguageModel extends AILanguageModel implements positron.ai.Lan
14671467

14681468
log.debug(`[${this.providerName}] Available models after processing: ${models.map(m => m.name).join(', ')}`);
14691469

1470-
return models;
1470+
return markDefaultModel(models, this.provider, this._config.model);
14711471
} catch (error) {
14721472
log.warn(`[${this.providerName}] Failed to fetch models from Bedrock API: ${error}`);
14731473
this._lastError = error instanceof Error ? error : new Error(String(error));

0 commit comments

Comments
 (0)