mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 08:08:39 +01:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user