Skip to content

Commit cebcc6f

Browse files
authored
Backport restoring selected model with old API (microsoft#257086)
* Backport restoring selected model with old API * Spelling is hard
1 parent 145d5f4 commit cebcc6f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/vs/workbench/contrib/chat/browser/chatInputPart.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,13 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
473473
}
474474

475475
private initSelectedModel() {
476-
const persistedSelection = this.storageService.get(this.getSelectedModelStorageKey(), StorageScope.APPLICATION);
477-
const persistedAsDefault = this.storageService.getBoolean(this.getSelectedModelIsDefaultStorageKey(), StorageScope.APPLICATION, persistedSelection === 'github.copilot-chat/gpt-4o');
476+
let persistedSelection = this.storageService.get(this.getSelectedModelStorageKey(), StorageScope.APPLICATION);
477+
if (persistedSelection && persistedSelection.startsWith('github.copilot-chat/')) {
478+
// Convert the persisted selection to make it backwards comptabile with the old LM API. TODO @lramos15 - Remove this after a bit
479+
persistedSelection = persistedSelection.replace('github.copilot-chat/', 'copilot/');
480+
this.storageService.store(this.getSelectedModelStorageKey(), persistedSelection, StorageScope.APPLICATION, StorageTarget.USER);
481+
}
482+
const persistedAsDefault = this.storageService.getBoolean(this.getSelectedModelIsDefaultStorageKey(), StorageScope.APPLICATION, persistedSelection === 'copilot/gpt-4.1');
478483

479484
if (persistedSelection) {
480485
const model = this.languageModelsService.lookupLanguageModel(persistedSelection);

0 commit comments

Comments
 (0)