@@ -262,7 +262,7 @@ class VoiceChatSessions {
262262 @IConfigurationService private readonly configurationService : IConfigurationService
263263 ) { }
264264
265- async start ( controller : IVoiceChatSessionController ) : Promise < void > {
265+ async start ( controller : IVoiceChatSessionController , context ?: IChatExecuteActionContext ) : Promise < void > {
266266 this . stop ( ) ;
267267
268268 const sessionId = ++ this . voiceChatSessionIds ;
@@ -304,7 +304,7 @@ class VoiceChatSessions {
304304 case SpeechToTextStatus . Recognizing :
305305 if ( text ) {
306306 session . controller . updateInput ( [ inputValue , text ] . join ( ' ' ) ) ;
307- if ( voiceChatTimeout > 0 ) {
307+ if ( voiceChatTimeout > 0 && context ?. voice ?. disableTimeout !== true ) {
308308 acceptTranscriptionScheduler . cancel ( ) ;
309309 }
310310 }
@@ -313,7 +313,7 @@ class VoiceChatSessions {
313313 if ( text ) {
314314 inputValue = [ inputValue , text ] . join ( ' ' ) ;
315315 session . controller . updateInput ( inputValue ) ;
316- if ( voiceChatTimeout > 0 ) {
316+ if ( voiceChatTimeout > 0 && context ?. voice ?. disableTimeout !== true ) {
317317 acceptTranscriptionScheduler . schedule ( ) ;
318318 }
319319 }
@@ -408,12 +408,12 @@ export class VoiceChatInChatViewAction extends Action2 {
408408 } ) ;
409409 }
410410
411- async run ( accessor : ServicesAccessor ) : Promise < void > {
411+ async run ( accessor : ServicesAccessor , context ?: IChatExecuteActionContext ) : Promise < void > {
412412 const instantiationService = accessor . get ( IInstantiationService ) ;
413413
414414 const controller = await VoiceChatSessionControllerFactory . create ( accessor , 'view' ) ;
415415 if ( controller ) {
416- VoiceChatSessions . getInstance ( instantiationService ) . start ( controller ) ;
416+ VoiceChatSessions . getInstance ( instantiationService ) . start ( controller , context ) ;
417417 }
418418 }
419419}
@@ -435,12 +435,12 @@ export class InlineVoiceChatAction extends Action2 {
435435 } ) ;
436436 }
437437
438- async run ( accessor : ServicesAccessor ) : Promise < void > {
438+ async run ( accessor : ServicesAccessor , context ?: IChatExecuteActionContext ) : Promise < void > {
439439 const instantiationService = accessor . get ( IInstantiationService ) ;
440440
441441 const controller = await VoiceChatSessionControllerFactory . create ( accessor , 'inline' ) ;
442442 if ( controller ) {
443- VoiceChatSessions . getInstance ( instantiationService ) . start ( controller ) ;
443+ VoiceChatSessions . getInstance ( instantiationService ) . start ( controller , context ) ;
444444 }
445445 }
446446}
@@ -462,12 +462,12 @@ export class QuickVoiceChatAction extends Action2 {
462462 } ) ;
463463 }
464464
465- async run ( accessor : ServicesAccessor ) : Promise < void > {
465+ async run ( accessor : ServicesAccessor , context ?: IChatExecuteActionContext ) : Promise < void > {
466466 const instantiationService = accessor . get ( IInstantiationService ) ;
467467
468468 const controller = await VoiceChatSessionControllerFactory . create ( accessor , 'quick' ) ;
469469 if ( controller ) {
470- VoiceChatSessions . getInstance ( instantiationService ) . start ( controller ) ;
470+ VoiceChatSessions . getInstance ( instantiationService ) . start ( controller , context ) ;
471471 }
472472 }
473473}
@@ -500,11 +500,11 @@ export class StartVoiceChatAction extends Action2 {
500500 } ) ;
501501 }
502502
503- async run ( accessor : ServicesAccessor , context : unknown ) : Promise < void > {
503+ async run ( accessor : ServicesAccessor , context ?: IChatExecuteActionContext ) : Promise < void > {
504504 const instantiationService = accessor . get ( IInstantiationService ) ;
505505 const commandService = accessor . get ( ICommandService ) ;
506506
507- const widget = ( context as IChatExecuteActionContext ) ?. widget ;
507+ const widget = context ?. widget ;
508508 if ( widget ) {
509509 // if we already get a context when the action is executed
510510 // from a toolbar within the chat widget, then make sure
@@ -518,10 +518,10 @@ export class StartVoiceChatAction extends Action2 {
518518
519519 const controller = await VoiceChatSessionControllerFactory . create ( accessor , 'focused' ) ;
520520 if ( controller ) {
521- VoiceChatSessions . getInstance ( instantiationService ) . start ( controller ) ;
521+ VoiceChatSessions . getInstance ( instantiationService ) . start ( controller , context ) ;
522522 } else {
523523 // fallback to Quick Voice Chat command
524- commandService . executeCommand ( QuickVoiceChatAction . ID ) ;
524+ commandService . executeCommand ( QuickVoiceChatAction . ID , context ) ;
525525 }
526526 }
527527}
0 commit comments