Skip to content

Commit fdf41f3

Browse files
committed
fix(stage-tamagotchi): cannot load static assets due to file not able to be accessed with in Electron
1 parent 1c26d8d commit fdf41f3

File tree

6 files changed

+9
-15
lines changed

6 files changed

+9
-15
lines changed

packages/stage-ui-three/src/components/ThreeScene.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { DirectionalLight, SphericalHarmonics3, Texture, WebGLRenderTarget
1212
1313
import type { Vec3 } from '../stores/model-store'
1414
15+
import { withBase } from '@proj-airi/stage-shared'
1516
import { EffectComposerPmndrs, HueSaturationPmndrs } from '@proj-airi/tresjs/post-processing'
1617
import { TresCanvas } from '@tresjs/core'
1718
import { useElementBounding } from '@vueuse/core'
@@ -43,7 +44,7 @@ const props = withDefaults(defineProps<{
4344
paused?: boolean
4445
}>(), {
4546
showAxes: false,
46-
idleAnimation: '/assets/vrm/animations/idle_loop.vrma',
47+
idleAnimation: withBase('/assets/vrm/animations/idle_loop.vrma'),
4748
paused: false,
4849
})
4950

packages/stage-ui/src/components/scenarios/dialogs/model-selector/model-selector.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import type { DisplayModel } from '../../../../stores/display-models'
33
4+
import { withBase } from '@proj-airi/stage-shared'
45
import { useFileDialog } from '@vueuse/core'
56
import { storeToRefs } from 'pinia'
67
import { DropdownMenuContent, DropdownMenuItem, DropdownMenuPortal, DropdownMenuRoot, DropdownMenuTrigger, EditableArea, EditableEditTrigger, EditableInput, EditablePreview, EditableRoot, EditableSubmitTrigger } from 'reka-ui'
@@ -162,7 +163,7 @@ vrmDialog.onChange(handleAddVRMModel)
162163
aspect="12/16"
163164
px-1 py-2
164165
>
165-
<img v-if="model.previewImage" :src="model.previewImage" h-full w-full rounded-lg object-cover :class="[highlightDisplayModelCard && highlightDisplayModelCard === model.id ? 'ring-3 ring-primary-400' : 'ring-0 ring-transparent']" transition="all duration-200 ease-in-out">
166+
<img v-if="model.previewImage" :src="withBase(model.previewImage)" h-full w-full rounded-lg object-cover :class="[highlightDisplayModelCard && highlightDisplayModelCard === model.id ? 'ring-3 ring-primary-400' : 'ring-0 ring-transparent']" transition="all duration-200 ease-in-out">
166167
<div v-else bg="neutral-100 dark:neutral-900" relative h-full w-full flex flex-col items-center justify-center gap-2 overflow-hidden rounded-lg :class="[highlightDisplayModelCard && highlightDisplayModelCard === model.id ? 'ring-3 ring-primary-400' : 'ring-0 ring-transparent']" transition="all duration-200 ease-in-out">
167168
<div i-solar:question-square-bold-duotone text-4xl opacity-75 />
168169
<div translate-y="100%" absolute top-0 flex flex-col translate-x--7 rotate-45 scale-250 gap-0 opacity-5>

packages/stage-ui/src/components/scenes/Stage.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type { Emotion } from '../../constants/emotions'
77
88
import { drizzle } from '@proj-airi/drizzle-duckdb-wasm'
99
import { getImportUrlBundles } from '@proj-airi/drizzle-duckdb-wasm/bundles/import-url-browser'
10+
import { withBase } from '@proj-airi/stage-shared'
1011
import { ThreeScene, useModelStore } from '@proj-airi/stage-ui-three'
1112
// import { createTransformers } from '@xsai-transformers/embed'
1213
// import embedWorkerURL from '@xsai-transformers/embed/worker?worker&url'
@@ -286,7 +287,7 @@ defineExpose({
286287
v-if="stageModelRenderer === 'vrm' && showStage"
287288
ref="vrmViewerRef"
288289
:model-src="stageModelSelectedUrl"
289-
idle-animation="/assets/vrm/animations/idle_loop.vrma"
290+
:idle-animation="withBase('/assets/vrm/animations/idle_loop.vrma')"
290291
min-w="50% <lg:full" min-h="100 sm:100" h-full w-full flex-1
291292
:paused="paused"
292293
:show-axes="stageViewControlsEnabled"

packages/stage-ui/src/stores/providers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import type {
1717
VoiceProviderWithExtraOptions,
1818
} from 'unspeech'
1919

20+
import { isUrl } from '@proj-airi/stage-shared'
2021
import { computedAsync, useLocalStorage } from '@vueuse/core'
2122
import {
2223
createAzure,
@@ -56,7 +57,6 @@ import {
5657
import { computed, ref, watch } from 'vue'
5758
import { useI18n } from 'vue-i18n'
5859

59-
import { isUrl } from '../utils/url'
6060
import { models as elevenLabsModels } from './providers/elevenlabs/list-models'
6161
import { buildOpenAICompatibleProvider } from './providers/openai-compatible-builder'
6262

packages/stage-ui/src/stores/settings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { DisplayModel } from './display-models'
22

33
import messages from '@proj-airi/i18n/locales'
44

5+
import { withBase } from '@proj-airi/stage-shared'
56
import { useEventListener, useLocalStorage } from '@vueuse/core'
67
import { converter } from 'culori'
78
import { defineStore } from 'pinia'
@@ -80,7 +81,7 @@ export const useSettings = defineStore('settings', () => {
8081
stageModelSelectedUrl.value = URL.createObjectURL(model.file)
8182
}
8283
else {
83-
stageModelSelectedUrl.value = model.url
84+
stageModelSelectedUrl.value = withBase(model.url)
8485
}
8586

8687
stageModelSelectedDisplayModel.value = model

packages/stage-ui/src/utils/url.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)