Allow vscode.LanguageModelChatInformation#isDefault to be per chat location (#287527)

We have `isDefault` which allows a model to indicate that it is the best/most-recommended model. This PR extends this concept to define default by location, e.g for inline chat a different default model might apply than for panel chat or terminal chat
This commit is contained in:
Johannes Rieken
2026-01-13 16:45:38 +01:00
committed by GitHub
parent 8855b3724c
commit 23f6c25c9b
12 changed files with 95 additions and 32 deletions

View File

@@ -205,7 +205,7 @@ export class InlineChatController implements IEditorContribution {
this._store.add(result);
this._store.add(result.widget.chatWidget.input.onDidChangeCurrentLanguageModel(newModel => {
InlineChatController._selectVendorDefaultLanguageModel = Boolean(newModel.metadata.isDefault);
InlineChatController._selectVendorDefaultLanguageModel = Boolean(newModel.metadata.isDefaultForLocation[location.location]);
}));
result.domNode.classList.add('inline-chat-2');
@@ -440,11 +440,11 @@ export class InlineChatController implements IEditorContribution {
// or unless the user has chosen to persist their model choice
const persistModelChoice = this._configurationService.getValue<boolean>(InlineChatConfigKeys.PersistModelChoice);
const model = this._zone.value.widget.chatWidget.input.selectedLanguageModel;
if (!persistModelChoice && InlineChatController._selectVendorDefaultLanguageModel && model && !model.metadata.isDefault) {
if (!persistModelChoice && InlineChatController._selectVendorDefaultLanguageModel && model && !model.metadata.isDefaultForLocation[session.chatModel.initialLocation]) {
const ids = await this._languageModelService.selectLanguageModels({ vendor: model.metadata.vendor }, false);
for (const identifier of ids) {
const candidate = this._languageModelService.lookupLanguageModel(identifier);
if (candidate?.isDefault) {
if (candidate?.isDefaultForLocation[session.chatModel.initialLocation]) {
this._zone.value.widget.chatWidget.input.setCurrentLanguageModel({ metadata: candidate, identifier });
break;
}