| | |
| | | |
| | | const speakContent = (content: string) => { |
| | | // 打断之前的已收到xxx |
| | | duix.break(); |
| | | duix?.break(); |
| | | isWaitingSpeak = false; |
| | | duix.speak({ |
| | | duix?.speak({ |
| | | content, |
| | | }); |
| | | }; |
| | | const closeOtherDigitalHuman = async () => { |
| | | const response = await fetch(`https://duix.guiji.ai/duix-openapi-v2/v1/distroyCallSessionsByAppId?appId=${duixConfig.appId}`, { |
| | | method: 'GET', |
| | | headers: { |
| | | priority: 'u=1, i', |
| | | sig: duixConfig.sign, |
| | | }, |
| | | }); |
| | | |
| | | const data = await response.json(); |
| | | // const total = data.data.totalConcurrentNumber; |
| | | // const user = data.data.userConcurrentNumber; |
| | | |
| | | // if (total === null || total === 0) { |
| | | // return false; |
| | | // } |
| | | // if (total !== null && total === user) { |
| | | // return false; |
| | | // } |
| | | |
| | | // return true; |
| | | }; |
| | | const startDuix = () => { |
| | | const conversationId = duixConfig.conversationId; // duix平台会话id |
| | | |
| | |
| | | duixConfig.sign = await createSig(duixConfig.appId, duixConfig.appKey, 60 * 60 * duixConfig.expired); |
| | | const isUsable = await checkIsUseable(); |
| | | if (!isUsable) { |
| | | ElMessage.warning('"资源占用中,请检查后再试~"'); |
| | | return; |
| | | await closeOtherDigitalHuman(); |
| | | // ElMessage.warning('"资源占用中,请检查后再试~"'); |
| | | } |
| | | digitalHumanIsShow.value = true; |
| | | |