Skip to content

Commit 258537d

Browse files
authored
voice - update keyword activation based on default agent presence (microsoft#210390)
* voice - only enable keyword activation when we have a chat agent * .
1 parent cdf55f8 commit 258537d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -847,8 +847,8 @@ registerThemingParticipant((theme, collector) => {
847847
`);
848848
});
849849

850-
function supportsKeywordActivation(configurationService: IConfigurationService, speechService: ISpeechService): boolean {
851-
if (!speechService.hasSpeechProvider) {
850+
function supportsKeywordActivation(configurationService: IConfigurationService, speechService: ISpeechService, chatAgentService: IChatAgentService): boolean {
851+
if (!speechService.hasSpeechProvider || !chatAgentService.getDefaultAgent(ChatAgentLocation.Panel)) {
852852
return false;
853853
}
854854

@@ -896,6 +896,8 @@ export class KeywordActivationContribution extends Disposable implements IWorkbe
896896
const onDidAddDefaultAgent = this._register(this.chatAgentService.onDidChangeAgents(() => {
897897
if (this.chatAgentService.getDefaultAgent(ChatAgentLocation.Panel)) {
898898
this.updateConfiguration();
899+
this.handleKeywordActivation();
900+
899901
onDidAddDefaultAgent.dispose();
900902
}
901903
}));
@@ -945,7 +947,7 @@ export class KeywordActivationContribution extends Disposable implements IWorkbe
945947

946948
private handleKeywordActivation(): void {
947949
const enabled =
948-
supportsKeywordActivation(this.configurationService, this.speechService) &&
950+
supportsKeywordActivation(this.configurationService, this.speechService, this.chatAgentService) &&
949951
!this.speechService.hasActiveSpeechToTextSession;
950952
if (
951953
(enabled && this.activeSession) ||
@@ -1031,6 +1033,7 @@ class KeywordActivationStatusEntry extends Disposable {
10311033
@IStatusbarService private readonly statusbarService: IStatusbarService,
10321034
@ICommandService private readonly commandService: ICommandService,
10331035
@IConfigurationService private readonly configurationService: IConfigurationService,
1036+
@IChatAgentService private readonly chatAgentService: IChatAgentService
10341037
) {
10351038
super();
10361039

@@ -1051,7 +1054,7 @@ class KeywordActivationStatusEntry extends Disposable {
10511054
}
10521055

10531056
private updateStatusEntry(): void {
1054-
const visible = supportsKeywordActivation(this.configurationService, this.speechService);
1057+
const visible = supportsKeywordActivation(this.configurationService, this.speechService, this.chatAgentService);
10551058
if (visible) {
10561059
if (!this.entry.value) {
10571060
this.createStatusEntry();

0 commit comments

Comments
 (0)