1
>
/*---------------------------------------------------------------------------------------------
chatSelectedModel.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
7
>
import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
8
>
import { ChatContextKeys } from './actions/chatContextKeys.js';
9
>
import { COPILOT_VENDOR_ID, ILanguageModelChatMetadata, ILanguageModelsService } from './languageModels.js';
10
>
11
>
/**
12
>
* Storage key prefix for persisted model selections.
13
>
* Full key format: `chat.currentLanguageModel.{location}[.{modelTarget}]`
14
>
*/
15
>
export const SELECTED_MODEL_STORAGE_KEY_PREFIX = 'chat.currentLanguageModel.';
16
>
17
>
export const SELECTED_MODEL_STORAGE_SCOPE = StorageScope.PROFILE;
18
>
export const SELECTED_MODEL_STORAGE_TARGET = StorageTarget.USER;
19
>
20
>
/**
21
>
* Builds the storage key used to persist the selected language model for a
22
>
* given chat location and optional model target.
23
>
*
24
>
* Shared by model-selection surfaces so they can read and write the explicit
25
>
* remembered preference without depending on widget internals.
26
>
*/
27
>
export function getSelectedModelStorageKey(location: string, modelTarget?: string): string {
28
if (modelTarget) {
29
return `${SELECTED_MODEL_STORAGE_KEY_PREFIX}${location}.${modelTarget}`;