|
6 | 6 | import * as dom from 'vs/base/browser/dom';
|
7 | 7 | import { status } from 'vs/base/browser/ui/aria/aria';
|
8 | 8 | import { ITreeContextMenuEvent, ITreeElement } from 'vs/base/browser/ui/tree/tree';
|
| 9 | +import { disposableTimeout } from 'vs/base/common/async'; |
9 | 10 | import { CancellationToken } from 'vs/base/common/cancellation';
|
10 | 11 | import { Emitter } from 'vs/base/common/event';
|
11 | 12 | import { Disposable, DisposableStore, IDisposable, combinedDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
@@ -526,22 +527,29 @@ export class ChatAccessibilityService extends Disposable implements IChatAccessi
|
526 | 527 | declare readonly _serviceBrand: undefined;
|
527 | 528 |
|
528 | 529 | private _responsePendingAudioCue: IDisposable | undefined;
|
| 530 | + private _hasReceivedRequest: boolean = false; |
529 | 531 |
|
530 | 532 | constructor(@IAudioCueService private readonly _audioCueService: IAudioCueService) {
|
531 | 533 | super();
|
532 | 534 | }
|
533 | 535 | acceptRequest(): void {
|
534 | 536 | 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)); |
536 | 542 | }
|
537 | 543 | acceptResponse(response?: IChatResponseViewModel): void {
|
| 544 | + this._hasReceivedRequest = true; |
538 | 545 | this._responsePendingAudioCue?.dispose();
|
539 | 546 | this._audioCueService.playRandomAudioCue(AudioCueGroupId.chatResponseReceived, true);
|
540 | 547 | if (!response) {
|
541 | 548 | return;
|
542 | 549 | }
|
543 | 550 | const errorDetails = response.errorDetails ? ` ${response.errorDetails.message}` : '';
|
544 | 551 | status(response.response.value + errorDetails);
|
| 552 | + this._hasReceivedRequest = false; |
545 | 553 | }
|
546 | 554 | }
|
547 | 555 |
|
0 commit comments