Skip to content

Commit 87ee421

Browse files
authored
Merge pull request microsoft#185792 from microsoft/merogge/pending-cue
wait 5 seconds before initiating pending cue
2 parents f72ec2a + 36fc6be commit 87ee421

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import * as dom from 'vs/base/browser/dom';
77
import { status } from 'vs/base/browser/ui/aria/aria';
88
import { ITreeContextMenuEvent, ITreeElement } from 'vs/base/browser/ui/tree/tree';
9+
import { disposableTimeout } from 'vs/base/common/async';
910
import { CancellationToken } from 'vs/base/common/cancellation';
1011
import { Emitter } from 'vs/base/common/event';
1112
import { Disposable, DisposableStore, IDisposable, combinedDisposable, toDisposable } from 'vs/base/common/lifecycle';
@@ -526,22 +527,29 @@ export class ChatAccessibilityService extends Disposable implements IChatAccessi
526527
declare readonly _serviceBrand: undefined;
527528

528529
private _responsePendingAudioCue: IDisposable | undefined;
530+
private _hasReceivedRequest: boolean = false;
529531

530532
constructor(@IAudioCueService private readonly _audioCueService: IAudioCueService) {
531533
super();
532534
}
533535
acceptRequest(): void {
534536
this._audioCueService.playAudioCue(AudioCue.chatRequestSent, true);
535-
this._responsePendingAudioCue = this._audioCueService.playAudioCueLoop(AudioCue.chatResponsePending, CHAT_RESPONSE_PENDING_AUDIO_CUE_LOOP_MS);
537+
this._register(disposableTimeout(() => {
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;
538545
this._responsePendingAudioCue?.dispose();
539546
this._audioCueService.playRandomAudioCue(AudioCueGroupId.chatResponseReceived, true);
540547
if (!response) {
541548
return;
542549
}
543550
const errorDetails = response.errorDetails ? ` ${response.errorDetails.message}` : '';
544551
status(response.response.value + errorDetails);
552+
this._hasReceivedRequest = false;
545553
}
546554
}
547555

0 commit comments

Comments
 (0)