From 678b137a19c2d096c82bef87962dd7df77f2855b Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期三, 09 四月 2025 16:23:25 +0800 Subject: [PATCH] asr open close --- src/components/chat/components/playBar/hook/useDigitalHuman.ts | 22 ++++++++++++++++------ 1 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/components/chat/components/playBar/hook/useDigitalHuman.ts b/src/components/chat/components/playBar/hook/useDigitalHuman.ts index 918c9af..7f0b096 100644 --- a/src/components/chat/components/playBar/hook/useDigitalHuman.ts +++ b/src/components/chat/components/playBar/hook/useDigitalHuman.ts @@ -69,6 +69,16 @@ }); }; + const startDuix = () =>{ + const conversationId = duixConfig.conversationId; // duix骞冲彴浼氳瘽id + + duix.start({ conversationId, openAsr: true,wipeGreen:true }).then((res) => { + console.info('start', res); + }).catch((err)=>{ + console.error('start error', err); + }); + } + const initDuix = () => { const sign = duixConfig.sign; // sign鐢辨湇鍔$鐢熸垚 const conversationId = duixConfig.conversationId; // duix骞冲彴浼氳瘽id @@ -81,9 +91,7 @@ duix.on('intialSucccess', () => { console.info('intialSucccess'); // 姝ゆ椂鍒濆鍖栨垚鍔燂紝鍙皟鐢╯tart - duix.start({ conversationId, openAsr: true,wipeGreen:true }).then((res) => { - console.info('start', res); - }); + startDuix(); }); duix.on('bye', (data) => { console.info('bye', data); @@ -110,6 +118,8 @@ duix.on('speakEnd', (data) => { if (!isWaitingSpeak) { isReceiveRes.value = false; + duix.openAsr().then((...a) => { + }); } }); duix.on('speakSection', (data) => { @@ -123,6 +133,8 @@ if (isReceiveRes.value) { return; } + duix.closeAsr().then((...a) => { + }); let hasResult = false; isReceiveRes.value = true; @@ -191,9 +203,7 @@ duix = new DUIX(); initDuix(); } else { - duix.start({ conversationId: duixConfig.conversationId, openAsr: true }).then((res) => { - console.info('start', res); - }); + startDuix(); } }); }; -- Gitblit v1.9.3