fix(voice): keep chat's view across a provider switch and clear stale errors

Switching AI Provider in Settings opened from chat rebuilt the voice
control, so Settings fell back to voice and the dock went idle, widening
the wings. The switch now carries chat's Settings, or chat itself, to the
new provider as it already carries the input mode; the conversation still
starts fresh and focus stays on the provider choice.

After a voice error, opening chat or closing the voice panel left the dock
red on ERROR, because both stopped only an active session. They now also
end a session left in error, which returns the dock to idle.
This commit is contained in:
manjunath22466 committed 2026-11-04 19:34:30 +05:30
1 parent 4859ba4c94
commit 53ea76251f
7 files changed
+120 -6

No files matched your search

+5 -2
View File
@@ -64,6 +64,8 @@ export function createProviderCommands(options, { bind, factories, storage }) {
const textOnly = Boolean(
current.session.adapter.getStartOptions?.().textOnly,
);
// The panel stays where the user is: chat's Settings or chat itself.
const presentation = current.chatPresentation?.() ?? null;
const generation = ++mountGeneration;
voiceEnabled = false;
current.session.destroy();
@@ -80,7 +82,7 @@ export function createProviderCommands(options, { bind, factories, storage }) {
} catch {
/* Storage is optional. */
}
mount();
mount(presentation);
if (resume && !disposed && provider === next)
void current.session.start({
pushToTalk,
@@ -142,7 +144,7 @@ export function createProviderCommands(options, { bind, factories, storage }) {
return typeof value === 'function' ? value.bind(current) : value;
},
});
function mount() {
function mount(presentation = null) {
voiceEnabled = false;
const generation = ++mountGeneration;
current = bind({
@@ -158,6 +160,7 @@ export function createProviderCommands(options, { bind, factories, storage }) {
handleSessionEvent(event);
},
createSession: factories[provider],
presentation,
});
window.__gevVoiceCommands = facade;
}