voice
This commit is contained in:
		@@ -1,5 +1,4 @@
 | 
			
		||||
"use client";
 | 
			
		||||
import dynamic from "next/dynamic";
 | 
			
		||||
import { useEffect, useRef, useState } from "react";
 | 
			
		||||
import "@/deps/live2d.min.js";
 | 
			
		||||
import useVoice2Txt from "@/hooks/useVoice2txt";
 | 
			
		||||
@@ -7,6 +6,7 @@ import useTxt2Voice from "@/hooks/useTxt2Voice";
 | 
			
		||||
import axios from "axios";
 | 
			
		||||
import * as PIXI from "pixi.js";
 | 
			
		||||
import { Live2DModel } from "pixi-live2d-display/cubism2";
 | 
			
		||||
import { useSearchParams } from "next/navigation";
 | 
			
		||||
 | 
			
		||||
// fake list
 | 
			
		||||
const opList = [
 | 
			
		||||
@@ -35,7 +35,21 @@ const opList = [
 | 
			
		||||
//import "@/deps/live2dcubismcore.min.js"
 | 
			
		||||
export default function Home() {
 | 
			
		||||
    const [useVoice, setUseVoice] = useState(false);
 | 
			
		||||
 | 
			
		||||
    const query = useSearchParams();
 | 
			
		||||
    const characterId = query.get("id");
 | 
			
		||||
    const token = query.get("token");
 | 
			
		||||
    const voice2txt = (txt: string) => {
 | 
			
		||||
        fetch("xxxx/voice/txt2voice", {
 | 
			
		||||
            method: "POST",
 | 
			
		||||
            headers: {
 | 
			
		||||
                "Content-Type": "application/json",
 | 
			
		||||
                "Authorization": `${token}`,
 | 
			
		||||
            },
 | 
			
		||||
            body: JSON.stringify({
 | 
			
		||||
                txt: txt,
 | 
			
		||||
            }),
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
    function draggable(model: any) {
 | 
			
		||||
        model.buttonMode = true;
 | 
			
		||||
        model.on("pointerdown", (e: any) => {
 | 
			
		||||
@@ -60,8 +74,6 @@ export default function Home() {
 | 
			
		||||
        foreground.alpha = 0.2;
 | 
			
		||||
 | 
			
		||||
        model.addChild(foreground);
 | 
			
		||||
        // 这里先叉了
 | 
			
		||||
        // checkbox("Model Frames", (checked: any) => (foreground.visible = checked));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function addHitAreaFrames(model: any) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user