@@ -526,22 +526,31 @@ export class ChatAccessibilityService extends Disposable implements IChatAccessi
526
526
declare readonly _serviceBrand : undefined ;
527
527
528
528
private _responsePendingAudioCue : IDisposable | undefined ;
529
+ private _hasReceivedRequest : boolean = false ;
529
530
530
531
constructor ( @IAudioCueService private readonly _audioCueService : IAudioCueService ) {
531
532
super ( ) ;
532
533
}
533
- acceptRequest ( ) : void {
534
+ async acceptRequest ( ) : Promise < void > {
534
535
this . _audioCueService . playAudioCue ( AudioCue . chatRequestSent , true ) ;
535
- this . _responsePendingAudioCue = this . _audioCueService . playAudioCueLoop ( AudioCue . chatResponsePending , CHAT_RESPONSE_PENDING_AUDIO_CUE_LOOP_MS ) ;
536
+ // Only play the pending cue if the response is not accepted within the timeout
537
+ setTimeout ( ( ) => {
538
+ if ( ! this . _hasReceivedRequest ) {
539
+ this . _responsePendingAudioCue = this . _audioCueService . playAudioCueLoop ( AudioCue . chatResponsePending , CHAT_RESPONSE_PENDING_AUDIO_CUE_LOOP_MS ) ;
540
+ }
541
+ } , CHAT_RESPONSE_PENDING_AUDIO_CUE_LOOP_MS ) ;
536
542
}
537
543
acceptResponse ( response ?: IChatResponseViewModel ) : void {
544
+ this . _hasReceivedRequest = true ;
545
+ // The response pending cue has started looping, time to cancel it
538
546
this . _responsePendingAudioCue ?. dispose ( ) ;
539
547
this . _audioCueService . playRandomAudioCue ( AudioCueGroupId . chatResponseReceived , true ) ;
540
548
if ( ! response ) {
541
549
return ;
542
550
}
543
551
const errorDetails = response . errorDetails ? ` ${ response . errorDetails . message } ` : '' ;
544
552
status ( response . response . value + errorDetails ) ;
553
+ this . _hasReceivedRequest = false ;
545
554
}
546
555
}
547
556
0 commit comments