Skip to content

Commit ab43727

Browse files
committed
wait 5 seconds before initiating pending cue
1 parent 8af267c commit ab43727

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/vs/workbench/contrib/chat/browser/chatWidget.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,22 +526,31 @@ export class ChatAccessibilityService extends Disposable implements IChatAccessi
526526
declare readonly _serviceBrand: undefined;
527527

528528
private _responsePendingAudioCue: IDisposable | undefined;
529+
private _hasReceivedRequest: boolean = false;
529530

530531
constructor(@IAudioCueService private readonly _audioCueService: IAudioCueService) {
531532
super();
532533
}
533-
acceptRequest(): void {
534+
async acceptRequest(): Promise<void> {
534535
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);
536542
}
537543
acceptResponse(response?: IChatResponseViewModel): void {
544+
this._hasReceivedRequest = true;
545+
// The response pending cue has started looping, time to cancel it
538546
this._responsePendingAudioCue?.dispose();
539547
this._audioCueService.playRandomAudioCue(AudioCueGroupId.chatResponseReceived, true);
540548
if (!response) {
541549
return;
542550
}
543551
const errorDetails = response.errorDetails ? ` ${response.errorDetails.message}` : '';
544552
status(response.response.value + errorDetails);
553+
this._hasReceivedRequest = false;
545554
}
546555
}
547556

0 commit comments

Comments
 (0)