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
@@ -94,7 +94,10 @@ export function bindChatControl({ ui, session, onOpen, dataManager }) {
|
||||
: '';
|
||||
function open({ focus = true } = {}) {
|
||||
leaveChatSettings();
|
||||
if (!isTyped() && session.isActive()) session.stop();
|
||||
// Chat replaces voice, a stale voice error included, so the dock stops
|
||||
// showing it.
|
||||
if (!isTyped() && (session.isActive() || session.state === 'error'))
|
||||
session.stop();
|
||||
onOpen?.();
|
||||
ui.update('chat', { open: true, minimized: false, rows: 2, authNote });
|
||||
sync();
|
||||
@@ -413,10 +416,39 @@ export function bindChatControl({ ui, session, onOpen, dataManager }) {
|
||||
}),
|
||||
];
|
||||
sync();
|
||||
// What a provider switch carries to the next mount: chat's Settings or
|
||||
// chat itself, never the conversation.
|
||||
function presentation() {
|
||||
if (inChatSettings()) {
|
||||
const { frameWidth, frameHeight } = ui.state.voicePanel;
|
||||
return { view: 'settings', frameWidth, frameHeight };
|
||||
}
|
||||
if (chat().open) return { view: chat().minimized ? 'minimized' : 'open' };
|
||||
return null;
|
||||
}
|
||||
// Restored without moving focus: the switch keeps it on the provider choice.
|
||||
function restorePresentation(state) {
|
||||
if (disposed || !state) return;
|
||||
if (state.view === 'settings') {
|
||||
ui.update('voicePanel', {
|
||||
context: 'chat',
|
||||
...(state.frameWidth && {
|
||||
frameWidth: state.frameWidth,
|
||||
frameHeight: state.frameHeight,
|
||||
}),
|
||||
});
|
||||
ui.update('chat', { backVisible: true });
|
||||
return sync();
|
||||
}
|
||||
open({ focus: false });
|
||||
if (state.view === 'minimized') minimize({ focus: false });
|
||||
}
|
||||
return {
|
||||
close,
|
||||
minimize,
|
||||
restore: open,
|
||||
presentation,
|
||||
restorePresentation,
|
||||
get minimized() {
|
||||
return chat().open && chat().minimized;
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user