Skip to content

Commit 7351ea6

Browse files
committed
Adding Q chat metrics
1 parent b6beb28 commit 7351ea6

File tree

9 files changed

+9
-95
lines changed

9 files changed

+9
-95
lines changed

.changes/next-release/Feature-66094f43-8633-459a-b81a-714ef9b2b5fe.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/core/src/amazonq/webview/ui/apps/cwChatConnector.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,7 @@ export class Connector {
9292
messageId: string,
9393
code?: string,
9494
type?: 'selection' | 'block',
95-
codeReference?: CodeReference[],
96-
eventId?: string,
97-
codeBlockIndex?: number,
98-
totalCodeBlocks?: number
95+
codeReference?: CodeReference[]
9996
): void => {
10097
this.sendMessageToExtension({
10198
tabID: tabID,
@@ -105,9 +102,6 @@ export class Connector {
105102
tabType: 'cwc',
106103
insertionTargetType: type,
107104
codeReference,
108-
eventId,
109-
codeBlockIndex,
110-
totalCodeBlocks,
111105
})
112106
}
113107

@@ -116,10 +110,7 @@ export class Connector {
116110
messageId: string,
117111
code?: string,
118112
type?: 'selection' | 'block',
119-
codeReference?: CodeReference[],
120-
eventId?: string,
121-
codeBlockIndex?: number,
122-
totalCodeBlocks?: number
113+
codeReference?: CodeReference[]
123114
): void => {
124115
this.sendMessageToExtension({
125116
tabID: tabID,
@@ -129,9 +120,6 @@ export class Connector {
129120
tabType: 'cwc',
130121
insertionTargetType: type,
131122
codeReference,
132-
eventId,
133-
codeBlockIndex,
134-
totalCodeBlocks,
135123
})
136124
}
137125

packages/core/src/amazonq/webview/ui/connector.ts

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -214,23 +214,11 @@ export class Connector {
214214
messageId: string,
215215
code?: string,
216216
type?: 'selection' | 'block',
217-
codeReference?: CodeReference[],
218-
eventId?: string,
219-
codeBlockIndex?: number,
220-
totalCodeBlocks?: number
217+
codeReference?: CodeReference[]
221218
): void => {
222219
switch (this.tabsStorage.getTab(tabID)?.type) {
223220
case 'cwc':
224-
this.cwChatConnector.onCodeInsertToCursorPosition(
225-
tabID,
226-
messageId,
227-
code,
228-
type,
229-
codeReference,
230-
eventId,
231-
codeBlockIndex,
232-
totalCodeBlocks
233-
)
221+
this.cwChatConnector.onCodeInsertToCursorPosition(tabID, messageId, code, type, codeReference)
234222
break
235223
case 'featuredev':
236224
this.featureDevChatConnector.onCodeInsertToCursorPosition(tabID, code, type, codeReference)
@@ -243,23 +231,11 @@ export class Connector {
243231
messageId: string,
244232
code?: string,
245233
type?: 'selection' | 'block',
246-
codeReference?: CodeReference[],
247-
eventId?: string,
248-
codeBlockIndex?: number,
249-
totalCodeBlocks?: number
234+
codeReference?: CodeReference[]
250235
): void => {
251236
switch (this.tabsStorage.getTab(tabID)?.type) {
252237
case 'cwc':
253-
this.cwChatConnector.onCopyCodeToClipboard(
254-
tabID,
255-
messageId,
256-
code,
257-
type,
258-
codeReference,
259-
eventId,
260-
codeBlockIndex,
261-
totalCodeBlocks
262-
)
238+
this.cwChatConnector.onCopyCodeToClipboard(tabID, messageId, code, type, codeReference)
263239
break
264240
case 'featuredev':
265241
this.featureDevChatConnector.onCopyCodeToClipboard(tabID, code, type, codeReference)

packages/core/src/amazonq/webview/ui/main.ts

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ export const createMynahUI = (ideApi: any, amazonQEnabled: boolean) => {
207207
},
208208
onChatAnswerReceived: (tabID: string, item: ChatItem) => {
209209
if (item.type === ChatItemType.ANSWER_PART || item.type === ChatItemType.CODE_RESULT) {
210-
// Enters after gen started 1st chunk with messageId
211210
if (item.body !== undefined && item.messageId !== undefined) {
212211
const totalCodeBlocks = countNumberOfCodeBlocks(item.body)
213212
connector.handleMessageofStreamedData(tabID, totalCodeBlocks, item.messageId)
@@ -240,7 +239,6 @@ export const createMynahUI = (ideApi: any, amazonQEnabled: boolean) => {
240239
item.type === ChatItemType.SYSTEM_PROMPT ||
241240
item.type === ChatItemType.AI_PROMPT
242241
) {
243-
//Does not enter this
244242
mynahUI.updateStore(tabID, {
245243
loadingChat: true,
246244
promptInputDisabledState: true,
@@ -251,7 +249,6 @@ export const createMynahUI = (ideApi: any, amazonQEnabled: boolean) => {
251249
}
252250

253251
if (item.type === ChatItemType.ANSWER) {
254-
//Enters only once before gen the code block but with messageID
255252
mynahUI.updateStore(tabID, {
256253
loadingChat: false,
257254
promptInputDisabledState: tabsStorage.isTabDead(tabID),
@@ -397,26 +394,8 @@ export const createMynahUI = (ideApi: any, amazonQEnabled: boolean) => {
397394
})
398395
},
399396
onCodeInsertToCursorPosition: connector.onCodeInsertToCursorPosition,
400-
onCopyCodeToClipboard: (
401-
tabId,
402-
messageId,
403-
code,
404-
type,
405-
referenceTrackerInfo,
406-
eventId,
407-
codeBlockIndex,
408-
totalCodeBlocks
409-
) => {
410-
connector.onCopyCodeToClipboard(
411-
tabId,
412-
messageId,
413-
code,
414-
type,
415-
referenceTrackerInfo,
416-
eventId,
417-
codeBlockIndex,
418-
totalCodeBlocks
419-
)
397+
onCopyCodeToClipboard: (tabId, messageId, code, type, referenceTrackerInfo) => {
398+
connector.onCopyCodeToClipboard(tabId, messageId, code, type, referenceTrackerInfo)
420399
mynahUI.notify({
421400
type: NotificationType.SUCCESS,
422401
content: 'Selected code is copied to clipboard',

packages/core/src/codewhispererChat/controllers/chat/controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ export class ChatController {
319319

320320
private async processMessageofStreamedData(message: MessageofStreamedData) {
321321
// Check the telemtry and trigger from here
322-
//this.telemetryHelper.recordInteractWithMessage(message)
322+
this.telemetryHelper.recordInteractWithMessage(message)
323323
}
324324

325325
private async processTabCreateMessage(message: TabCreatedMessage) {

packages/core/src/codewhispererChat/controllers/chat/model.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ export interface InsertCodeAtCursorPosition {
4141
code: string
4242
insertionTargetType: string | undefined
4343
codeReference: CodeReference[] | undefined
44-
eventId: string
45-
codeBlockIndex: number
46-
totalCodeBlocks: number
4744
}
4845

4946
export interface CopyCodeToClipboard {
@@ -53,9 +50,6 @@ export interface CopyCodeToClipboard {
5350
code: string
5451
insertionTargetType: string | undefined
5552
codeReference: CodeReference[] | undefined
56-
eventId: string
57-
codeBlockIndex: number
58-
totalCodeBlocks: number
5953
}
6054

6155
export interface MessageofStreamedData {

packages/core/src/codewhispererChat/controllers/chat/telemetryHelper.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ export class CWCTelemetryHelper {
162162
cwsprChatAcceptedCharactersLength: message.code.length,
163163
cwsprChatInteractionTarget: message.insertionTargetType,
164164
cwsprChatHasReference: message.codeReference && message.codeReference.length > 0,
165-
cwsprChatCodeBlockIndex: message.codeBlockIndex,
166-
cwsprChatTotalCodeBlocks: message.totalCodeBlocks,
167165
}
168166
break
169167
case 'code_was_copied_to_clipboard':
@@ -177,8 +175,6 @@ export class CWCTelemetryHelper {
177175
cwsprChatAcceptedCharactersLength: message.code.length,
178176
cwsprChatInteractionTarget: message.insertionTargetType,
179177
cwsprChatHasReference: message.codeReference && message.codeReference.length > 0,
180-
cwsprChatCodeBlockIndex: message.codeBlockIndex,
181-
cwsprChatTotalCodeBlocks: message.totalCodeBlocks,
182178
}
183179
break
184180
case 'follow-up-was-clicked':

packages/core/src/codewhispererChat/view/messages/messageListener.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ export class UIMessageListener {
159159
code: msg.code,
160160
insertionTargetType: msg.insertionTargetType,
161161
codeReference: msg.codeReference,
162-
eventId: msg.eventId,
163-
codeBlockIndex: msg.codeBlockIndex,
164-
totalCodeBlocks: msg.totalCodeBlocks,
165162
})
166163
}
167164

@@ -173,9 +170,6 @@ export class UIMessageListener {
173170
code: msg.code,
174171
insertionTargetType: msg.insertionTargetType,
175172
codeReference: msg.codeReference,
176-
eventId: msg.eventId,
177-
codeBlockIndex: msg.codeBlockIndex,
178-
totalCodeBlocks: msg.totalCodeBlocks,
179173
})
180174
}
181175

packages/core/src/shared/telemetry/vscodeTelemetry.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,6 @@
256256
"type": "string",
257257
"description": "Identifies the entity within the message that user interacts with."
258258
},
259-
{
260-
"name": "cwsprChatCodeBlockIndex",
261-
"type": "int",
262-
"description": "Index of the code block inside a message in the conversation."
263-
},
264259
{
265260
"name": "cwsprChatTotalCodeBlocks",
266261
"type": "int",
@@ -834,10 +829,6 @@
834829
"type": "cwsprChatHasReference",
835830
"required": false
836831
},
837-
{
838-
"type": "cwsprChatCodeBlockIndex",
839-
"required": false
840-
},
841832
{
842833
"type": "cwsprChatTotalCodeBlocks",
843834
"required": false

0 commit comments

Comments
 (0)