Skip to content

Commit 37b4721

Browse files
committed
fix(stage-tamagotchi,stage-ui): withBase incorrectly used causes model url issues
Close #773
1 parent e7588cb commit 37b4721

File tree

8 files changed

+131
-26
lines changed

8 files changed

+131
-26
lines changed

packages/stage-ui-three/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"directory": "packages/stage-ui-three"
1616
},
1717
"exports": {
18+
"./assets/vrm": "./src/assets/vrm/index.ts",
1819
".": "./src/index.ts"
1920
},
2021
"scripts": {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const animations = {
2+
idleLoop: new URL('./idle_loop.vrma', import.meta.url),
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './animations'

packages/stage-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"@proj-airi/font-xiaolai": "workspace:^",
7575
"@proj-airi/i18n": "workspace:^",
7676
"@proj-airi/server-sdk": "workspace:^",
77-
"@proj-airi/stage-shared": "workspace:*",
77+
"@proj-airi/stage-shared": "workspace:^",
7878
"@proj-airi/stage-ui-three": "workspace:^",
7979
"@proj-airi/tauri-plugin-mcp": "workspace:^",
8080
"@proj-airi/ui": "workspace:^",

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script setup lang="ts">
22
import type { DisplayModel } from '../../../../stores/display-models'
33
4-
import { withBase } from '@proj-airi/stage-shared'
54
import { useFileDialog } from '@vueuse/core'
65
import { storeToRefs } from 'pinia'
76
import { DropdownMenuContent, DropdownMenuItem, DropdownMenuPortal, DropdownMenuRoot, DropdownMenuTrigger, EditableArea, EditableEditTrigger, EditableInput, EditablePreview, EditableRoot, EditableSubmitTrigger } from 'reka-ui'
@@ -163,7 +162,7 @@ vrmDialog.onChange(handleAddVRMModel)
163162
aspect="12/16"
164163
px-1 py-2
165164
>
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">
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">
167166
<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">
168167
<div i-solar:question-square-bold-duotone text-4xl opacity-75 />
169168
<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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import type { TTSChunkItem } from '../../utils/tts'
99
1010
import { drizzle } from '@proj-airi/drizzle-duckdb-wasm'
1111
import { getImportUrlBundles } from '@proj-airi/drizzle-duckdb-wasm/bundles/import-url-browser'
12-
import { withBase } from '@proj-airi/stage-shared'
1312
import { ThreeScene, useModelStore } from '@proj-airi/stage-ui-three'
13+
import { animations } from '@proj-airi/stage-ui-three/assets/vrm'
1414
import { useBroadcastChannel } from '@vueuse/core'
1515
// import { createTransformers } from '@xsai-transformers/embed'
1616
// import embedWorkerURL from '@xsai-transformers/embed/worker?worker&url'
@@ -336,7 +336,7 @@ onPlaybackStarted(({ text }) => {
336336
v-if="stageModelRenderer === 'vrm' && showStage"
337337
ref="vrmViewerRef"
338338
:model-src="stageModelSelectedUrl"
339-
:idle-animation="withBase('/assets/vrm/animations/idle_loop.vrma')"
339+
:idle-animation="animations.idleLoop.toString()"
340340
min-w="50% <lg:full" min-h="100 sm:100" h-full w-full flex-1
341341
:paused="paused"
342342
:show-axes="stageViewControlsEnabled"

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

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

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

5-
import { withBase } from '@proj-airi/stage-shared'
65
import { useEventListener, useLocalStorage } from '@vueuse/core'
76
import { converter } from 'culori'
87
import { defineStore } from 'pinia'
@@ -81,7 +80,7 @@ export const useSettings = defineStore('settings', () => {
8180
stageModelSelectedUrl.value = URL.createObjectURL(model.file)
8281
}
8382
else {
84-
stageModelSelectedUrl.value = withBase(model.url)
83+
stageModelSelectedUrl.value = model.url
8584
}
8685

8786
stageModelSelectedDisplayModel.value = model

pnpm-lock.yaml

Lines changed: 121 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)