Skip to content

Commit e5af90b

Browse files
committed
Ux changes in feedback mechanism V2 version
1 parent b45a626 commit e5af90b

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export class Connector extends BaseConnector {
8686

8787
onCustomFormAction(
8888
tabId: string,
89+
messageId: string,
8990
action: {
9091
id: string
9192
text?: string | undefined
@@ -105,6 +106,34 @@ export class Connector extends BaseConnector {
105106
tabID: tabId,
106107
description: action.description,
107108
})
109+
110+
if (this.onChatAnswerUpdated === undefined) {
111+
return
112+
}
113+
const answer: ChatItem = {
114+
type: ChatItemType.ANSWER,
115+
messageId: messageId,
116+
buttons: [],
117+
}
118+
119+
switch (action.id) {
120+
case 'Provide-Feedback':
121+
answer.buttons = [
122+
{
123+
keepCardAfterClick: true,
124+
text: 'Thanks for providing feedback.',
125+
id: 'utg_provided_feedback',
126+
status: 'success',
127+
position: 'outside',
128+
disabled: true,
129+
},
130+
]
131+
break
132+
default:
133+
console.warn(`Unhandled action ID: ${action.id}`)
134+
break
135+
}
136+
this.onChatAnswerUpdated(tabId, answer)
108137
}
109138

110139
onFileDiff = (tabID: string, filePath: string, deleted: boolean, messageId?: string): void => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ export class Connector {
681681
this.gumbyChatConnector.onCustomFormAction(tabId, action)
682682
break
683683
case 'testgen':
684-
this.testChatConnector.onCustomFormAction(tabId, action)
684+
this.testChatConnector.onCustomFormAction(tabId, messageId ?? '', action)
685685
break
686686
case 'review':
687687
this.scanChatConnector.onCustomFormAction(tabId, action)

packages/core/src/amazonqTest/chat/controller/controller.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,6 @@ export class TestController {
388388
getFeedbackCommentData = `Q Test Generation: RequestId: ${this.sessionStorage.getSession().startTestGenerationRequestId}, TestGenerationJobId: ${this.sessionStorage.getSession().testGenerationJob?.testGenerationJobId}`
389389
void submitFeedback(placeholder, 'Amazon Q', getFeedbackCommentData)
390390
telemetry.ui_click.emit({ elementId: 'unitTestGeneration_provideFeedback' })
391-
this.messenger.sendMessage(
392-
'Unit test generation completed. Thanks for providing feedback.',
393-
data.tabID,
394-
'answer'
395-
)
396391
break
397392
}
398393
}
@@ -427,7 +422,7 @@ export class TestController {
427422
const buttons: ChatItemButton[] = []
428423
if (Auth.instance.isInternalAmazonUser()) {
429424
buttons.push({
430-
keepCardAfterClick: false,
425+
keepCardAfterClick: true,
431426
text: 'How can we make /test better?',
432427
id: ButtonActions.PROVIDE_FEEDBACK,
433428
disabled: false, // allow button to be re-clicked

0 commit comments

Comments
 (0)