@@ -24,7 +24,7 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
2424import { WorkbenchObjectTree } from 'vs/platform/list/browser/listService' ;
2525import { IViewsService } from 'vs/workbench/common/views' ;
2626import { clearChatSession } from 'vs/workbench/contrib/chat/browser/actions/chatClear' ;
27- import { ChatTreeItem , IChatCodeBlockInfo , IChatWidget , IChatWidgetService , IChatWidgetViewContext } from 'vs/workbench/contrib/chat/browser/chat' ;
27+ import { ChatTreeItem , IChatAccessibilityService , IChatCodeBlockInfo , IChatWidget , IChatWidgetService , IChatWidgetViewContext } from 'vs/workbench/contrib/chat/browser/chat' ;
2828import { ChatInputPart } from 'vs/workbench/contrib/chat/browser/chatInputPart' ;
2929import { ChatAccessibilityProvider , ChatListDelegate , ChatListItemRenderer , IChatRendererDelegate } from 'vs/workbench/contrib/chat/browser/chatListRenderer' ;
3030import { ChatEditorOptions } from 'vs/workbench/contrib/chat/browser/chatOptions' ;
@@ -108,8 +108,6 @@ export class ChatWidget extends Disposable implements IChatWidget {
108108 private lastSlashCommands : ISlashCommand [ ] | undefined ;
109109 private slashCommandsPromise : Promise < ISlashCommand [ ] | undefined > | undefined ;
110110
111- private _chatAccessibilityService : ChatAccessibilityService ;
112-
113111 constructor (
114112 readonly viewContext : IChatWidgetViewContext ,
115113 private readonly styles : IChatWidgetStyles ,
@@ -118,15 +116,13 @@ export class ChatWidget extends Disposable implements IChatWidget {
118116 @IChatService private readonly chatService : IChatService ,
119117 @IChatWidgetService chatWidgetService : IChatWidgetService ,
120118 @IContextMenuService private readonly contextMenuService : IContextMenuService ,
121- @IAudioCueService audioCueService : IAudioCueService
119+ @IChatAccessibilityService private readonly _chatAccessibilityService : IChatAccessibilityService
122120 ) {
123121 super ( ) ;
124122 CONTEXT_IN_CHAT_SESSION . bindTo ( contextKeyService ) . set ( true ) ;
125123 this . requestInProgress = CONTEXT_CHAT_REQUEST_IN_PROGRESS . bindTo ( contextKeyService ) ;
126124
127125 this . _register ( ( chatWidgetService as ChatWidgetService ) . register ( this ) ) ;
128- this . _chatAccessibilityService = new ChatAccessibilityService ( audioCueService ) ;
129- this . _register ( this . _chatAccessibilityService ) ;
130126 }
131127
132128 get providerId ( ) : string {
@@ -511,9 +507,14 @@ export class ChatWidgetService implements IChatWidgetService {
511507 }
512508}
513509
510+
514511const CHAT_RESPONSE_PENDING_AUDIO_CUE_LOOP_MS = 7000 ;
515- class ChatAccessibilityService extends Disposable {
512+ export class ChatAccessibilityService extends Disposable implements IChatAccessibilityService {
513+
514+ declare readonly _serviceBrand : undefined ;
515+
516516 private _responsePendingAudioCue : IDisposable | undefined ;
517+
517518 constructor ( @IAudioCueService private readonly _audioCueService : IAudioCueService ) {
518519 super ( ) ;
519520 }
@@ -523,10 +524,10 @@ class ChatAccessibilityService extends Disposable {
523524 }
524525 acceptResponse ( response ?: IChatResponseViewModel ) : void {
525526 this . _responsePendingAudioCue ?. dispose ( ) ;
527+ this . _audioCueService . playRandomAudioCue ( AudioCueGroupId . chatResponseReceived , true ) ;
526528 if ( ! response ) {
527529 return ;
528530 }
529- this . _audioCueService . playRandomAudioCue ( AudioCueGroupId . chatResponseReceived , true ) ;
530531 const errorDetails = response . errorDetails ? ` ${ response . errorDetails . message } ` : '' ;
531532 alert ( response . response . value + errorDetails ) ;
532533 }
0 commit comments