error
This commit is contained in:
parent
dc2ddc3fa4
commit
4e0e4d9d80
@ -121,7 +121,7 @@ export default function Home() {
|
||||
});
|
||||
}
|
||||
|
||||
const { start, end, text, isListening } = useVoice2Txt({
|
||||
const { start, end, text, isListening, error } = useVoice2Txt({
|
||||
lang: 'cmn-Hans-CN',
|
||||
continuous: false
|
||||
});
|
||||
@ -135,10 +135,14 @@ export default function Home() {
|
||||
const isMouthOpen = useRef(false);
|
||||
const [response, setResponse] = useState("");
|
||||
useEffect(() => {
|
||||
console.log(text)
|
||||
console.log(text, error)
|
||||
if (!text) return;
|
||||
send(text);
|
||||
}, [text]);
|
||||
if (error) {
|
||||
setResponse(error);
|
||||
return;
|
||||
}
|
||||
}, [text, error]);
|
||||
const [model, setModel] = useState<Live2DModel>();
|
||||
useEffect(() => {
|
||||
if (!isSpeaking) {
|
||||
@ -190,7 +194,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-[40%] h-[40%]' id="canvas"></canvas>
|
||||
<canvas className='w-full h-[40%]' 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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user