Keep an active voice session through engine switches

The page creates the voice once; each engine attachment only gives it that scene's action runner, pointer canvas and annotation events. Calls made during a switch wait for the incoming engine and are refused with ENGINE_SWITCHING when none attaches in time; results name the engine that answered, and the session hears engine-changed after a switch. The analyst's follow-up memory and layer enable times outlive one engine's runner. scripts/qa-voice-engine-switch.mjs drives a fake microphone and Realtime transport through the switches.
This commit is contained in:
German Khokhlov committed 2026-11-03 17:20:40 +04:00
1 parent 35ed499ae4
commit 05578c61b9
13 files changed
+998 -139

No files matched your search

+18 -21
View File
@@ -6,7 +6,7 @@ import { useDisplayStore } from '../ui/stores/display.js';
import { applicationPinia } from '../ui/vueRuntime.js';
import { initImageryBoxTool } from '../ui/imageryBoxTool.js';
import { createRecentImageryPanel } from '../ui/recentImagery.js';
import { initGevVoiceCommands } from '../voice/gevRealtime.js';
import { attachSessionVoice } from './sessionVoice.js';
import { installViews, isEmbeddedInline } from './embed.js';
import { installScopeMask, destroyScopeMask } from '../scopeMask.js';
import { installLayerReleaseTrim } from '../sceneCommandRelease.js';
@@ -42,10 +42,15 @@ export function createApplicationTools({
const { viewer, engine, tileset, mapStackController, operations } = scene;
const { styleManager, weatherEffects, cockpitCloudEffects } = controls;
const { dataManager } = data;
const isMapStackAvailable = id => mapStackController?.isStackAvailable(id) === true;
const sceneDirector = layerSession?.director ?? new SceneDirector(viewer, styleManager, dataManager, {
engine, dataPacks: {...sceneDataPacks,native:scene.packRenderer}, isMapStackAvailable,
});
const isMapStackAvailable = (id) =>
mapStackController?.isStackAvailable(id) === true;
const sceneDirector =
layerSession?.director ??
new SceneDirector(viewer, styleManager, dataManager, {
engine,
dataPacks: { ...sceneDataPacks, native: scene.packRenderer },
isMapStackAvailable,
});
if (layerSession?.director)
sceneDirector.attachScene(
viewer,
@@ -79,6 +84,7 @@ export function createApplicationTools({
voice,
sceneDirector,
startChrome,
layerSession,
signal,
defer,
}),
@@ -239,24 +245,15 @@ export function createApplicationTools({
defer(() => {
if (window.__godsEyeView === debug) delete window.__godsEyeView;
});
const voiceCommands = initGevVoiceCommands({
...voice,
floorServices: operations.surface.groundFloor,
annotationResolver: operations.annotationResolver,
searchNavigation: operations.searchAndFlyTo,
signal,
const voiceCommands = attachSessionVoice({
layerSession,
voice,
operations,
placeSearch,
viewer,
engine,
styleManager,
dataManager,
sceneDirector,
annotations,
});
defer(() => {
voiceCommands.stop({ removeUi: true });
if (window.__gevVoiceCommands === voiceCommands)
delete window.__gevVoiceCommands;
scene: { viewer, engine, styleManager, sceneDirector, annotations },
signal,
defer,
});
debug.voiceCommands = voiceCommands;
defer(