Skip to content

Commit f54cd0a

Browse files
committed
Route omni voice mode to omni input
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: be6b07e4-795c-42ba-88ef-329916399579
1 parent e4e6837 commit f54cd0a

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/vs/workbench/contrib/chat/browser/voiceInputMode/voiceInputModeActionViewItem.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ export interface IVoiceInputModePillOptions {
309309
readonly isActive?: IObservable<boolean>;
310310
/** Whether the shared Voice Mode transport belongs to this input. */
311311
readonly isVoiceActive?: IObservable<boolean>;
312+
/** Claim Voice Mode for this host instead of targeting the last focused chat session. */
313+
readonly activateVoiceMode?: () => void | Promise<void>;
312314
}
313315

314316
/**
@@ -768,12 +770,20 @@ export class VoiceInputModeActionViewItem extends BaseActionViewItem {
768770
const controller = this.voiceSessionController;
769771
if (controller.isConnected.get() || controller.isConnecting.get()) {
770772
if (this._options?.isVoiceActive?.get() === false) {
771-
await retargetVoiceToCurrentSession(this.commandService, controller);
773+
if (this._options.activateVoiceMode) {
774+
await this._options.activateVoiceMode();
775+
} else {
776+
await retargetVoiceToCurrentSession(this.commandService, controller);
777+
}
772778
return;
773779
}
774780
controller.disconnect();
775781
} else {
776-
await retargetVoiceToCurrentSession(this.commandService, controller);
782+
if (this._options?.activateVoiceMode) {
783+
await this._options.activateVoiceMode();
784+
} else {
785+
await retargetVoiceToCurrentSession(this.commandService, controller);
786+
}
777787
const targetWindow = getWindow(this._voiceCell);
778788
controller.connect(targetWindow).catch(() => { /* connect failures are surfaced/logged by the controller */ });
779789
}

src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3348,6 +3348,10 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
33483348
return this.instantiationService.createInstance(VoiceInputModeActionViewItem, action, {
33493349
isActive: isVoiceInputActive,
33503350
isVoiceActive: isVoiceSessionActive,
3351+
activateVoiceMode: isOmniInput ? () => {
3352+
this.voiceSessionController.setOmniInputActive(true);
3353+
this.voiceSessionController.setDraftTarget();
3354+
} : undefined,
33513355
});
33523356
}
33533357
if ((action.id === ChatSubmitAction.ID || action.id === ChatEditingSessionSubmitAction.ID) && action instanceof MenuItemAction) {

0 commit comments

Comments
 (0)