mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +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
@@ -364,3 +364,34 @@ test('the chat gear is named for the settings it opens', async (t) => {
|
||||
'Settings',
|
||||
);
|
||||
});
|
||||
|
||||
test('a provider switch carries chat Settings or chat itself to the next mount', async (t) => {
|
||||
const mount = () => {
|
||||
const ui = createTestVoiceUi({ panel: true });
|
||||
const chat = bindChatControl({ ui, session: typedSession() });
|
||||
t.after(() => chat.destroy());
|
||||
return { ui, chat };
|
||||
};
|
||||
// Chat's Settings: the next mount shows Settings in chat's frame again.
|
||||
const before = mount();
|
||||
before.ui.emit('chat-button');
|
||||
before.ui.update('voicePanel', { hidden: false });
|
||||
before.ui.emit('settings-button');
|
||||
const settings = before.chat.presentation();
|
||||
assert.equal(settings.view, 'settings');
|
||||
const after = mount();
|
||||
after.chat.restorePresentation(settings);
|
||||
assert.equal(after.ui.state.voicePanel.context, 'chat');
|
||||
assert.equal(after.ui.state.chat.backVisible, true);
|
||||
assert.equal(after.ui.state.root.assistantMode, 'chat');
|
||||
// Open and minimized chat come back as they were, without taking focus.
|
||||
for (const view of ['open', 'minimized']) {
|
||||
const next = mount();
|
||||
next.chat.restorePresentation({ view });
|
||||
assert.equal(next.ui.state.chat.open, true);
|
||||
assert.equal(next.ui.state.chat.minimized, view === 'minimized');
|
||||
assert.equal(next.chat.presentation().view, view);
|
||||
}
|
||||
// Idle chat carries nothing.
|
||||
assert.equal(mount().chat.presentation(), null);
|
||||
});
|
||||
Reference in new issue
Block a user