Skip to content

Commit 06a7481

Browse files
authored
Add mode to userActions (#102)
1 parent b39d6fa commit 06a7481

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

src/extension/conversation/vscode-node/userActions.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ import { Intent } from '../../common/constants';
1919
import { IConversationStore } from '../../conversationStore/node/conversationStore';
2020
import { findDiagnosticsTelemetry } from '../../inlineChat/node/diagnosticsTelemetry';
2121
import { CopilotInteractiveEditorResponse, InteractionOutcome } from '../../inlineChat/node/promptCraftingTypes';
22-
import { AgentParticipantId } from '../../intents/node/agentIntent';
2322
import { EditCodeStepTurnMetaData } from '../../intents/node/editCodeStep';
2423
import { Conversation, ICopilotChatResultIn } from '../../prompt/common/conversation';
2524
import { IntentInvocationMetadata } from '../../prompt/node/conversation';
2625
import { IFeedbackReporter } from '../../prompt/node/feedbackReporter';
2726
import { sendUserActionTelemetry } from '../../prompt/node/telemetry';
27+
import { ParticipantIds, participantIdToName } from '../../intents/common/intents';
2828

2929
export const IUserFeedbackService = createServiceIdentifier<IUserFeedbackService>('IUserFeedbackService');
3030
export interface IUserFeedbackService {
@@ -222,7 +222,7 @@ export class UserFeedbackService implements IUserFeedbackService {
222222
measurements = {
223223
totalCharacters: e.action.totalCharacters,
224224
totalLines: e.action.totalLines,
225-
isAgent: agentId === AgentParticipantId ? 1 : 0,
225+
isAgent: agentId === ParticipantIds.Agent ? 1 : 0,
226226
};
227227

228228
// Copy actions have a copiedCharacters/Lines property since this includes manual copying which can be partial
@@ -255,7 +255,8 @@ export class UserFeedbackService implements IUserFeedbackService {
255255
participant: agentId,
256256
languageId: e.action.languageId ?? '',
257257
modelId: e.action.modelId ?? '',
258-
comp_type: compType
258+
comp_type: compType,
259+
mode: participantIdToName(agentId),
259260
},
260261
measurements,
261262
e.action.kind === 'copy' ? 'conversation.acceptedCopy' : 'conversation.acceptedInsert'
@@ -277,10 +278,11 @@ export class UserFeedbackService implements IUserFeedbackService {
277278
headerRequestId: result.metadata?.responseId ?? '',
278279
participant: agentId,
279280
languageId: e.languageId ?? '',
280-
modelId: e.modelId
281+
modelId: e.modelId,
282+
mode: participantIdToName(agentId),
281283
},
282284
{
283-
isAgent: agentId === AgentParticipantId ? 1 : 0,
285+
isAgent: agentId === ParticipantIds.Agent ? 1 : 0,
284286
totalLines: e.totalLines,
285287
},
286288
'conversation.appliedCodeblock'
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*---------------------------------------------------------------------------------------------
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+
export enum ParticipantIds {
7+
Ask = 'github.copilot.default',
8+
Agent = 'github.copilot.editsAgent',
9+
Edit = 'github.copilot.editingSession',
10+
Edit2 = 'github.copilot.editingSession2',
11+
}
12+
13+
export function participantIdToName(participantId: string): string {
14+
switch (participantId) {
15+
case ParticipantIds.Ask:
16+
return 'ask';
17+
case ParticipantIds.Agent:
18+
return 'agent';
19+
case ParticipantIds.Edit:
20+
case ParticipantIds.Edit2:
21+
return 'edit';
22+
default:
23+
return participantId;
24+
}
25+
}

src/extension/intents/node/agentIntent.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,5 +376,3 @@ function countCacheBreakpoints(messages: Raw.ChatMessage[]) {
376376
}
377377
return count;
378378
}
379-
380-
export const AgentParticipantId = 'github.copilot.editsAgent';

0 commit comments

Comments
 (0)