@@ -262,7 +262,7 @@ class VoiceChatSessions {
262
262
@IConfigurationService private readonly configurationService : IConfigurationService
263
263
) { }
264
264
265
- async start ( controller : IVoiceChatSessionController ) : Promise < void > {
265
+ async start ( controller : IVoiceChatSessionController , context ?: IChatExecuteActionContext ) : Promise < void > {
266
266
this . stop ( ) ;
267
267
268
268
const sessionId = ++ this . voiceChatSessionIds ;
@@ -304,7 +304,7 @@ class VoiceChatSessions {
304
304
case SpeechToTextStatus . Recognizing :
305
305
if ( text ) {
306
306
session . controller . updateInput ( [ inputValue , text ] . join ( ' ' ) ) ;
307
- if ( voiceChatTimeout > 0 ) {
307
+ if ( voiceChatTimeout > 0 && context ?. voice ?. disableTimeout !== true ) {
308
308
acceptTranscriptionScheduler . cancel ( ) ;
309
309
}
310
310
}
@@ -313,7 +313,7 @@ class VoiceChatSessions {
313
313
if ( text ) {
314
314
inputValue = [ inputValue , text ] . join ( ' ' ) ;
315
315
session . controller . updateInput ( inputValue ) ;
316
- if ( voiceChatTimeout > 0 ) {
316
+ if ( voiceChatTimeout > 0 && context ?. voice ?. disableTimeout !== true ) {
317
317
acceptTranscriptionScheduler . schedule ( ) ;
318
318
}
319
319
}
@@ -408,12 +408,12 @@ export class VoiceChatInChatViewAction extends Action2 {
408
408
} ) ;
409
409
}
410
410
411
- async run ( accessor : ServicesAccessor ) : Promise < void > {
411
+ async run ( accessor : ServicesAccessor , context ?: IChatExecuteActionContext ) : Promise < void > {
412
412
const instantiationService = accessor . get ( IInstantiationService ) ;
413
413
414
414
const controller = await VoiceChatSessionControllerFactory . create ( accessor , 'view' ) ;
415
415
if ( controller ) {
416
- VoiceChatSessions . getInstance ( instantiationService ) . start ( controller ) ;
416
+ VoiceChatSessions . getInstance ( instantiationService ) . start ( controller , context ) ;
417
417
}
418
418
}
419
419
}
@@ -435,12 +435,12 @@ export class InlineVoiceChatAction extends Action2 {
435
435
} ) ;
436
436
}
437
437
438
- async run ( accessor : ServicesAccessor ) : Promise < void > {
438
+ async run ( accessor : ServicesAccessor , context ?: IChatExecuteActionContext ) : Promise < void > {
439
439
const instantiationService = accessor . get ( IInstantiationService ) ;
440
440
441
441
const controller = await VoiceChatSessionControllerFactory . create ( accessor , 'inline' ) ;
442
442
if ( controller ) {
443
- VoiceChatSessions . getInstance ( instantiationService ) . start ( controller ) ;
443
+ VoiceChatSessions . getInstance ( instantiationService ) . start ( controller , context ) ;
444
444
}
445
445
}
446
446
}
@@ -462,12 +462,12 @@ export class QuickVoiceChatAction extends Action2 {
462
462
} ) ;
463
463
}
464
464
465
- async run ( accessor : ServicesAccessor ) : Promise < void > {
465
+ async run ( accessor : ServicesAccessor , context ?: IChatExecuteActionContext ) : Promise < void > {
466
466
const instantiationService = accessor . get ( IInstantiationService ) ;
467
467
468
468
const controller = await VoiceChatSessionControllerFactory . create ( accessor , 'quick' ) ;
469
469
if ( controller ) {
470
- VoiceChatSessions . getInstance ( instantiationService ) . start ( controller ) ;
470
+ VoiceChatSessions . getInstance ( instantiationService ) . start ( controller , context ) ;
471
471
}
472
472
}
473
473
}
@@ -500,11 +500,11 @@ export class StartVoiceChatAction extends Action2 {
500
500
} ) ;
501
501
}
502
502
503
- async run ( accessor : ServicesAccessor , context : unknown ) : Promise < void > {
503
+ async run ( accessor : ServicesAccessor , context ?: IChatExecuteActionContext ) : Promise < void > {
504
504
const instantiationService = accessor . get ( IInstantiationService ) ;
505
505
const commandService = accessor . get ( ICommandService ) ;
506
506
507
- const widget = ( context as IChatExecuteActionContext ) ?. widget ;
507
+ const widget = context ?. widget ;
508
508
if ( widget ) {
509
509
// if we already get a context when the action is executed
510
510
// from a toolbar within the chat widget, then make sure
@@ -518,10 +518,10 @@ export class StartVoiceChatAction extends Action2 {
518
518
519
519
const controller = await VoiceChatSessionControllerFactory . create ( accessor , 'focused' ) ;
520
520
if ( controller ) {
521
- VoiceChatSessions . getInstance ( instantiationService ) . start ( controller ) ;
521
+ VoiceChatSessions . getInstance ( instantiationService ) . start ( controller , context ) ;
522
522
} else {
523
523
// fallback to Quick Voice Chat command
524
- commandService . executeCommand ( QuickVoiceChatAction . ID ) ;
524
+ commandService . executeCommand ( QuickVoiceChatAction . ID , context ) ;
525
525
}
526
526
}
527
527
}
0 commit comments