This commit is contained in:
zjt 2024-06-24 19:31:28 +08:00
parent 66e5b4c9f2
commit 7b01a4a0a7

View File

@ -114,7 +114,7 @@ export default function Home() {
.then((response) => {
console.log(`response`, response);
console.log(response.data);
typeof speak !== 'undefined' && speak(response.data.choices[0].message.content);
typeof speak !== 'undefined' && speak(response.data.choices[0].message.content) || model!.motion('tap_body');;
setResponse(response.data.choices[0].message.content);
})
.catch((error) => {
@ -169,6 +169,7 @@ export default function Home() {
(async function () {
const app = new PIXI.Application({
view: document.getElementById('canvas') as HTMLCanvasElement,
backgroundAlpha: 1
});
const model = await Live2DModel.from('https://cdn.jsdelivr.net/gh/guansss/pixi-live2d-display/test/assets/shizuku/shizuku.model.json');
@ -201,7 +202,7 @@ export default function Home() {
typeof window !== 'undefined'
&& typeof window.Live2D !== 'undefined'
&& (<div className='flex w-full flex-col h-full items-center justify-center relative'>
<canvas className='w-full h-[40%]' id="canvas"></canvas>
<canvas className='w-full h-full' id="canvas"></canvas>
<div className='absolute right-[20vw] top-4 bg-white rounded w-[20vw] h-auto text-sm text-black'>{response ? response : "请输入文字和我聊天吧"}</div>
<div id="control"></div>
<button onClick={start}></button>