This commit is contained in:
Neko Ayaka
2024-12-02 00:31:40 +08:00
parent 1822784e99
commit 369010297a
2 changed files with 19 additions and 19 deletions
+5 -5
View File
@@ -39,7 +39,7 @@ async function initLive2DPixiStage(parent: HTMLDivElement) {
pixiApp.value = new Application({
width: containerElementBounding.width.value,
height: Math.max(800, containerParentElementBounding.height.value),
height: Math.max(600, containerParentElementBounding.height.value),
backgroundAlpha: 0,
})
@@ -50,10 +50,10 @@ async function initLive2DPixiStage(parent: HTMLDivElement) {
pixiApp.value.stage.addChild(model.value as any)
model.value.x = containerElementBounding.width.value / 2
model.value.y = Math.max(1000, containerParentElementBounding.height.value)
model.value.y = Math.max(600, containerParentElementBounding.height.value)
model.value.rotation = Math.PI
model.value.skew.x = Math.PI
model.value.scale.set(0.5, 0.5)
model.value.scale.set(0.3, 0.3)
model.value.anchor.set(0.5, 0.5)
model.value.on('hit', (hitAreas) => {
@@ -75,12 +75,12 @@ watch([width, height], () => {
if (pixiAppCanvas.value) {
pixiAppCanvas.value.width = (width.value - 16) / 2
pixiAppCanvas.value.height = Math.max(800, containerParentElementBounding.height.value)
pixiAppCanvas.value.height = Math.max(600, containerParentElementBounding.height.value)
}
if (model.value) {
model.value.x = (width.value - 16) / 4
model.value.y = Math.max(1000, containerParentElementBounding.height.value)
model.value.y = Math.max(600, containerParentElementBounding.height.value)
}
})
+14 -14
View File
@@ -188,28 +188,28 @@ async function onSendMessage(sendingMessage: string) {
for await (const textPart of res.textStream) {
for (const textSingleChar of textPart) {
let newState: States = state
let newState: States = state
if (textSingleChar === '<')
newState = States.Special
newState = States.Special
else if (textSingleChar === '>')
newState = States.Literal
newState = States.Literal
if (state === States.Literal && newState === States.Special) {
streamingMessage.value.content += buffer
buffer = ''
}
if (state === States.Literal && newState === States.Special) {
streamingMessage.value.content += buffer
buffer = ''
}
if (state === States.Special && newState === States.Literal)
buffer = '' // Clear buffer when exiting Special state
if (state === States.Special && newState === States.Literal)
buffer = '' // Clear buffer when exiting Special state
if (state === States.Literal && newState === States.Literal) {
if (state === States.Literal && newState === States.Literal) {
streamingMessage.value.content += textSingleChar
buffer = ''
}
buffer = ''
}
await delaysQueue.add(textSingleChar)
state = newState
state = newState
buffer += textSingleChar
}
}
@@ -269,7 +269,7 @@ onUnmounted(() => {
</div>
</div>
<div flex="~ row 1" w-full items-end space-x-2>
<div w-full min-h="100 sm:200">
<div w-full min-h="100 sm:100">
<Live2DViewer ref="live2DViewerRef" :mouth-open-size="mouthOpenSize" model="assets/live2d/models/hiyori_pro_zh/hiyori_pro_t11.model3.json" />
<!-- <div>
<input v-model.number="mouthOpenSize" type="range" max="1" min="0" step="0.01">