fix(stage-tamagotchi): prompt onboarding for stage window only

This commit is contained in:
Neko Ayaka
2026-03-10 19:31:32 +08:00
parent f42c56e769
commit 9c88f83e2b
2 changed files with 12 additions and 17 deletions
+1 -16
View File
@@ -12,13 +12,12 @@ import { clearMcpToolBridge, setMcpToolBridge } from '@proj-airi/stage-ui/stores
import { useModsServerChannelStore } from '@proj-airi/stage-ui/stores/mods/api/channel-server'
import { useContextBridgeStore } from '@proj-airi/stage-ui/stores/mods/api/context-bridge'
import { useAiriCardStore } from '@proj-airi/stage-ui/stores/modules/airi-card'
import { useOnboardingStore } from '@proj-airi/stage-ui/stores/onboarding'
import { usePerfTracerBridgeStore } from '@proj-airi/stage-ui/stores/perf-tracer-bridge'
import { listProvidersForPluginHost, shouldPublishPluginHostCapabilities } from '@proj-airi/stage-ui/stores/plugin-host-capabilities'
import { useSettings } from '@proj-airi/stage-ui/stores/settings'
import { useTheme } from '@proj-airi/ui'
import { storeToRefs } from 'pinia'
import { computed, onMounted, onUnmounted, watch } from 'vue'
import { onMounted, onUnmounted, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { RouterView, useRoute, useRouter } from 'vue-router'
import { toast, Toaster } from 'vue-sonner'
@@ -29,7 +28,6 @@ import {
electronGetServerChannelConfig,
electronMcpCallTool,
electronMcpListTools,
electronOpenOnboarding,
electronOpenSettings,
electronPluginInspect,
electronPluginList,
@@ -52,7 +50,6 @@ const displayModelsStore = useDisplayModelsStore()
const settingsStore = useSettings()
const { language, themeColorsHue, themeColorsHueDynamic } = storeToRefs(settingsStore)
const serverChannelSettingsStore = useServerChannelSettingsStore()
const onboardingStore = useOnboardingStore()
const router = useRouter()
const route = useRoute()
const cardStore = useAiriCardStore()
@@ -76,8 +73,6 @@ const reportPluginCapability = useElectronEventaInvoke(electronPluginUpdateCapab
const listMcpTools = useElectronEventaInvoke(electronMcpListTools)
const callMcpTool = useElectronEventaInvoke(electronMcpCallTool)
const setLocale = useElectronEventaInvoke(i18nSetLocale)
const openOnboarding = useElectronEventaInvoke(electronOpenOnboarding)
const shouldHandleOnboardingInCurrentWindow = computed(() => route.path === '/')
// NOTICE: register plugin host bridge during setup to avoid race with pages using it in immediate watchers.
pluginHostInspectorStore.setBridge({
@@ -114,10 +109,6 @@ onMounted(async () => {
await displayModelsStore.loadDisplayModelsFromIndexedDB()
await settingsStore.initializeStageModel()
if (shouldHandleOnboardingInCurrentWindow.value) {
await onboardingStore.initializeSetupCheck()
}
const serverChannelConfig = await getServerChannelConfig()
serverChannelSettingsStore.websocketTlsConfig = serverChannelConfig.websocketTlsConfig
@@ -151,12 +142,6 @@ watch(themeColorsHueDynamic, () => {
document.documentElement.classList.toggle('dynamic-hue', themeColorsHueDynamic.value)
}, { immediate: true })
watch([() => onboardingStore.shouldShowSetup, shouldHandleOnboardingInCurrentWindow], ([shouldShowSetup, shouldHandleOnboarding]) => {
if (shouldHandleOnboarding && shouldShowSetup) {
openOnboarding()
}
}, { immediate: true })
onUnmounted(() => {
contextBridgeStore.dispose()
clearMcpToolBridge()
@@ -22,6 +22,7 @@ import { useChatOrchestratorStore } from '@proj-airi/stage-ui/stores/chat'
import { useLive2d } from '@proj-airi/stage-ui/stores/live2d'
import { useConsciousnessStore } from '@proj-airi/stage-ui/stores/modules/consciousness'
import { useHearingSpeechInputPipeline } from '@proj-airi/stage-ui/stores/modules/hearing'
import { useOnboardingStore } from '@proj-airi/stage-ui/stores/onboarding'
import { useProvidersStore } from '@proj-airi/stage-ui/stores/providers'
import { useSettings, useSettingsAudioDevice } from '@proj-airi/stage-ui/stores/settings'
import { refDebounced, useBroadcastChannel } from '@vueuse/core'
@@ -32,7 +33,7 @@ import { computed, onUnmounted, ref, toRef, watch } from 'vue'
import ControlsIsland from '../components/stage-islands/controls-island/index.vue'
import ResourceStatusIsland from '../components/stage-islands/resource-status-island/index.vue'
import { electronStartDraggingWindow } from '../../shared/eventa'
import { electronOpenOnboarding, electronStartDraggingWindow } from '../../shared/eventa'
import { useControlsIslandStore } from '../stores/controls-island'
import { useWindowStore } from '../stores/window'
@@ -46,6 +47,9 @@ const isLoading = ref(true)
const isIgnoringMouseEvents = ref(false)
const shouldFadeOnCursorWithin = ref(false)
const onboardingStore = useOnboardingStore()
const openOnboarding = useElectronEventaInvoke(electronOpenOnboarding)
const { isOutside: isOutsideWindow } = useElectronMouseInWindow()
const { isOutside } = useElectronMouseInElement(controlsIslandRef)
const isOutsideFor250Ms = refDebounced(isOutside, 250)
@@ -307,6 +311,12 @@ watch(enabled, async (val) => {
}
}, { immediate: true })
watch([() => onboardingStore.shouldShowSetup], ([shouldShowSetup]) => {
if (shouldShowSetup) {
openOnboarding()
}
}, { immediate: true })
onUnmounted(() => {
stopAudioInteraction()
})