commit
42e883a752
66
simple.html
66
simple.html
@ -8,7 +8,8 @@
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
<meta http-equiv="expires" content="0" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximu-scale=1.0,user-scalable=no" />
|
||||
<title>Duix Sdk Simple Example</title>
|
||||
<title>Yantu Digital human</title>
|
||||
<link rel="icon" type="image/png" sizes="48x48" href="./yantu/favicon.png" />
|
||||
<style>
|
||||
:root {
|
||||
--primary-100: #FF7F50;
|
||||
@ -141,15 +142,61 @@
|
||||
.btn:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.statement {
|
||||
position: absolute;
|
||||
bottom: 160px;
|
||||
left: 80%;
|
||||
transform: translate(-50%);
|
||||
color: #fff;
|
||||
padding: 12px;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
background-color: rgba(27, 160, 53, 0.5);
|
||||
border-radius: 12px;
|
||||
visibility: hidden;
|
||||
z-index: 100000;
|
||||
}
|
||||
|
||||
.statement:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
position: absolute;
|
||||
bottom: 40%;
|
||||
left: 50%;
|
||||
transform: translate(-50%);
|
||||
color: #000;
|
||||
padding: 12px;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
border-radius: 12px;
|
||||
visibility: hidden;
|
||||
z-index: 100000;
|
||||
}
|
||||
|
||||
.subtitle:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<script src="https://cdn.bootcss.com/eruda/1.3.2/eruda.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/js-base64@3.7.2/base64.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/crypto-js@4.1.1/crypto-js.min.js"></script>
|
||||
<script>eruda.init()</script>
|
||||
<script src="./duix/duix.js"></script>
|
||||
<!-- <script src="./yantu/yantoo-ava.js"></script> -->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- 数字人容器 -->
|
||||
<div class="container"></div>
|
||||
<div class="statement"></div>
|
||||
<div class="subtitle"></div>
|
||||
<!-- <input class="input" style="display: block;border-color: #8f1e00;z-index: 999;" id="duihua" placeholder="输入对话" value=""> -->
|
||||
|
||||
<div id="modal" class="modal">
|
||||
<div class="modal-content" style="text-align: center; padding: 20px; position: relative;">
|
||||
@ -167,8 +214,8 @@
|
||||
<option value="jiguang" selected>极光</option>
|
||||
<option value="gongzheng">公证</option>
|
||||
</select>
|
||||
<div style="margin-bottom: 8px; width: 100%; text-align: left; color: var(--text-200);">会话ID</div>
|
||||
<input class="input" id="conversationId" placeholder="请输入会话ID" value="1920410565458886658" title="请输入会话ID" />
|
||||
<div style="display: none;margin-bottom: 8px; width: 100%; text-align: left; color: var(--text-200);">会话ID</div>
|
||||
<input class="input" id="conversationId" style="display: none;" placeholder="请输入会话ID" value="1920410565458886658" title="请输入会话ID" />
|
||||
</div>
|
||||
<button id="start" onclick="init()" class="btn" style="width: 200px; margin: 20px auto 0;">
|
||||
<span>开始智能会话</span>
|
||||
@ -210,7 +257,7 @@
|
||||
|
||||
async function getToken() {
|
||||
try {
|
||||
const response = await fetch('http://14.103.170.252:6211/token', {
|
||||
const response = await fetch('https://srtc.yantootech.com/token', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@ -272,6 +319,8 @@
|
||||
console.info('show')
|
||||
// 此时可确认视频已
|
||||
document.querySelector('#modal').style.display = "none"
|
||||
document.querySelector('.statement').style.visibility = "visible"
|
||||
document.querySelector('.subtitle').style.visibility = "visible"
|
||||
})
|
||||
duix.on('openAsrSuccess', () => {
|
||||
console.info('openAsrSuccess')
|
||||
@ -287,11 +336,18 @@
|
||||
// })
|
||||
duix.on('speakSection', (data) => {
|
||||
console.info('speakSection', data)
|
||||
document.querySelector('.subtitle').innerText = data.content
|
||||
})
|
||||
duix.on('asrStop', (data) => {
|
||||
console.info('asrStop', data)
|
||||
document.querySelector('.statement').innerText = data.content;
|
||||
});
|
||||
duix.on('speakError', (data) => {
|
||||
console.info('speakError', data)
|
||||
})
|
||||
duix.on('asrResult', async (data) => {
|
||||
document.querySelector('.statement').innerText = ''
|
||||
document.querySelector('.subtitle').innerText = ''
|
||||
|
||||
console.info('asrResult', data, trigger_status);
|
||||
if (data == "小公" || data == "小共" || data == "小工"){
|
||||
@ -338,7 +394,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
const response = await fetch('http://14.103.170.252:6211/chat', {
|
||||
const response = await fetch('https://srtc.yantootech.com/chat', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
BIN
yantu/favicon.png
Normal file
BIN
yantu/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
1
yantu/vite.svg
Normal file
1
yantu/vite.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
20261
yantu/yantoo-ava.js
Normal file
20261
yantu/yantoo-ava.js
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user