@@ -302,10 +302,22 @@ export class TestController {
302
302
)
303
303
if ( session . stopIteration ) {
304
304
// Error from Science
305
- this . messenger . sendMessage ( data . error . uiMessage . replaceAll ( '```' , '' ) , data . tabID , 'answer' )
305
+ this . messenger . sendMessage (
306
+ data . error . uiMessage . replaceAll ( '```' , '' ) ,
307
+ data . tabID ,
308
+ 'answer' ,
309
+ 'testGenErrorMessage' ,
310
+ this . getFeedbackButtons ( )
311
+ )
306
312
} else {
307
313
isCancel
308
- ? this . messenger . sendMessage ( data . error . uiMessage , data . tabID , 'answer' )
314
+ ? this . messenger . sendMessage (
315
+ data . error . uiMessage ,
316
+ data . tabID ,
317
+ 'answer' ,
318
+ 'testGenErrorMessage' ,
319
+ this . getFeedbackButtons ( )
320
+ )
309
321
: this . sendErrorMessage ( data )
310
322
}
311
323
await this . sessionCleanUp ( )
@@ -325,7 +337,9 @@ export class TestController {
325
337
return this . messenger . sendMessage (
326
338
i18n ( 'AWS.amazonq.featureDev.error.monthlyLimitReached' ) ,
327
339
tabID ,
328
- 'answer'
340
+ 'answer' ,
341
+ 'testGenErrorMessage' ,
342
+ this . getFeedbackButtons ( )
329
343
)
330
344
}
331
345
if ( error . message . includes ( 'Too many requests' ) ) {
@@ -409,6 +423,21 @@ export class TestController {
409
423
}
410
424
}
411
425
426
+ private getFeedbackButtons ( ) : ChatItemButton [ ] {
427
+ const buttons : ChatItemButton [ ] = [ ]
428
+ if ( Auth . instance . isInternalAmazonUser ( ) ) {
429
+ buttons . push ( {
430
+ keepCardAfterClick : false ,
431
+ text : 'How can we make /test better?' ,
432
+ id : ButtonActions . PROVIDE_FEEDBACK ,
433
+ disabled : false , // allow button to be re-clicked
434
+ position : 'outside' ,
435
+ icon : 'comment' as MynahIcons ,
436
+ } )
437
+ }
438
+ return buttons
439
+ }
440
+
412
441
/**
413
442
* Start Test Generation and show the code results
414
443
*/
@@ -911,24 +940,12 @@ export class TestController {
911
940
912
941
// TODO: Check if there are more cases to endSession if yes create a enum or type for step
913
942
private async endSession ( data : any , step : FollowUpTypes ) {
914
- const buttons : ChatItemButton [ ] = [ ]
915
- if ( Auth . instance . isInternalAmazonUser ( ) ) {
916
- buttons . push ( {
917
- keepCardAfterClick : false ,
918
- text : 'How can we make /test better?' ,
919
- id : ButtonActions . PROVIDE_FEEDBACK ,
920
- disabled : false , // allow button to be re-clicked
921
- position : 'outside' ,
922
- icon : 'comment' as MynahIcons ,
923
- } )
924
- }
925
-
926
943
this . messenger . sendMessage (
927
944
'Unit test generation completed.' ,
928
945
data . tabID ,
929
946
'answer' ,
930
947
'testGenEndSessionMessage' ,
931
- buttons
948
+ this . getFeedbackButtons ( )
932
949
)
933
950
934
951
const session = this . sessionStorage . getSession ( )
0 commit comments