mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
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:
1 parent
4859ba4c94
commit
53ea76251f
7 files changed
+120
-6
No files matched your search
@@ -40,6 +40,8 @@ export function createVoiceCommands({
|
||||
createReticle = createDefaultReticle,
|
||||
panelHost = null,
|
||||
nativePanelProvider = null,
|
||||
// Chat's Settings or chat itself, carried across a provider switch.
|
||||
presentation = null,
|
||||
}) {
|
||||
if (resetExisting) window.__gevVoiceCommands?.stop?.({ removeUi: true });
|
||||
const ui = createControl(panelHost ? { panel: true } : {});
|
||||
@@ -225,6 +227,8 @@ export function createVoiceCommands({
|
||||
onOpen: () => panelMount?.panel.close(),
|
||||
})
|
||||
: null;
|
||||
chat?.restorePresentation(presentation);
|
||||
controls.chatPresentation = () => chat?.presentation() ?? null;
|
||||
function minimizeVoicePanel() {
|
||||
const panel = ui.element('voicePanel');
|
||||
const holdsFocus = panel?.contains?.(globalThis.document?.activeElement);
|
||||
@@ -284,7 +288,12 @@ export function createVoiceCommands({
|
||||
// The panel's close turns voice off, as chat's close ends the chat. A typed
|
||||
// session belongs to chat, which handles its own close.
|
||||
const offClose = ui.on('settings-close', () => {
|
||||
if (!session.isActive() || adapter.getStartOptions?.().textOnly) return;
|
||||
// A voice error the user closes is over too; stopping returns to idle.
|
||||
if (
|
||||
(!session.isActive() && session.state !== 'error') ||
|
||||
adapter.getStartOptions?.().textOnly
|
||||
)
|
||||
return;
|
||||
const ticket = panelMount?.stopTicket();
|
||||
session.stop();
|
||||
panelMount?.closeAfterStop(ticket);
|
||||
|
||||
Reference in new issue
Block a user