Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import { ILanguageModelChatMetadata, ILanguageModelChatMetadataAndIdentifier, IL
import { ChatModelConfigurationStore } from './chatModelConfigurationStore.js';
import { IChatModelInputState, IChatRequestModeInfo, IInputModel, logChangesToStateModel } from '../../../common/model/chatModel.js';
import { filterModelsForSession, findBestMatchingModel, findDefaultModel, hasModelsTargetingSession, isModelValidForSession, mergeModelsWithCache, resolveModelFromSyncState, shouldResetModelToDefault, shouldResetOnModelListChange, shouldRestoreLateArrivingModel, shouldRestorePersistedModel } from './chatModelSelectionLogic.js';
import { getChatSessionType, LocalChatSessionUri } from '../../../common/model/chatUri.js';
import { chatSessionResourceToId, getChatSessionType, LocalChatSessionUri } from '../../../common/model/chatUri.js';
import { IChatResponseViewModel, isResponseVM } from '../../../common/model/chatViewModel.js';
import { IChatAgentService } from '../../../common/participants/chatAgents.js';
import { ILanguageModelToolsService } from '../../../common/tools/languageModelToolsService.js';
Expand Down Expand Up @@ -1044,6 +1044,10 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
return !sessionType || sessionType === localChatSessionType || isAgentHostTarget(sessionType);
},
showAutoModel: () => this._showAutoModel(),
getChatSessionId: () => {
const sessionResource = this._widget?.viewModel?.model.sessionResource;
return sessionResource ? chatSessionResourceToId(sessionResource) : undefined;
},
modelConfiguration: this._modelConfigStore,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,13 @@ type ChatModelChangeClassification = {
comment: 'Reporting when the model picker is switched';
fromModel?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The previous chat model' };
toModel: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The new chat model' };
chatSessionId?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The id of the current chat session, used to correlate the model switch with the session.' };
};

type ChatModelChangeEvent = {
fromModel: string | TelemetryTrustedValue<string> | undefined;
toModel: string | TelemetryTrustedValue<string>;
chatSessionId?: string;
};

type ChatModelPickerInteraction = 'disabledModelContactAdminClicked' | 'premiumModelUpgradePlanClicked' | 'otherModelsExpanded' | 'otherModelsCollapsed';
Expand Down Expand Up @@ -1104,7 +1106,8 @@ export class ModelPickerWidget extends Disposable {
const onSelect = (model: ILanguageModelChatMetadataAndIdentifier) => {
this._telemetryService.publicLog2<ChatModelChangeEvent, ChatModelChangeClassification>('chat.modelChange', {
fromModel: previousModel?.metadata.vendor === 'copilot' ? new TelemetryTrustedValue(previousModel.identifier) : 'unknown',
toModel: model.metadata.vendor === 'copilot' ? new TelemetryTrustedValue(model.identifier) : 'unknown'
toModel: model.metadata.vendor === 'copilot' ? new TelemetryTrustedValue(model.identifier) : 'unknown',
chatSessionId: this._delegate.getChatSessionId?.()
});
this._selectedModel = model;
this._renderLabel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ export interface IModelPickerDelegate {
* Student users) instead of an Auto entry.
*/
showAutoModel?(): boolean;
/**
* The id of the current chat session, used to correlate model-picker
* changes with the session in telemetry. Matches the `chatSessionId`
* reported by other chat telemetry events (e.g. the chat request event).
* Returns `undefined` when no session is active.
*/
getChatSessionId?(): string | undefined;
/**
* Per-editor model configuration access. When omitted, the picker reads and
* writes configuration through the global {@link ILanguageModelsService}.
Expand Down
Loading