AI数字人2160大机器透明背景
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

584 lines
24 KiB

3 months ago
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
  8. <meta http-equiv="Pragma" content="no-cache" />
  9. <meta http-equiv="Expires" content="0" />
  10. <link rel="stylesheet" type="text/css" href="css/libs/reset.css" />
  11. <link rel="stylesheet" type="text/css" href="css/libs/animate.min.css" />
  12. <link rel="stylesheet" type="text/css" href="css/plugins/swiper-bundle.min.css" />
  13. <link rel="stylesheet" type="text/css" href="css/index.css" />
  14. <!--[if lt IE 9]>
  15. <script src="js/html5shiv.js"></script>
  16. <script src="js/respond.min.js"></script>
  17. <![endif]-->
  18. <title>AI数字人</title>
  19. </head>
  20. <body>
  21. <div class="ai-wrapper">
  22. <!-- <iframe style="position: absolute; top: 0; left: 0; border: none; z-index: 9;" width="100%" height="100%" src="https://f.3dman.cn/art/9fM6sgHv/avatars/GPBrJQBD/index.html"></iframe> -->
  23. <!-- <iframe style="position: absolute; top: 0; left: 0; border: none; z-index: 9;" width="100%" height="100%" src="https://f.3dman.cn/art/sDpbYwwJ/fbx/CdYqVH95/index.html"></iframe> -->
  24. <div class="page-content">
  25. <!-- 菜单 -->
  26. <ul class="ai-nav">
  27. <li class="nav-home"><p><span>主页</span></p></li>
  28. <!-- nav-talk -->
  29. <!-- talk-ing -->
  30. <!-- talk-end -->
  31. <li class="nav-talk"><p><span>提问</span></p></li>
  32. <li class="nav-help"><p><span>帮助</span></p></li>
  33. </ul>
  34. <!-- animate__swing / animate__tada / animate__wobble-->
  35. <!-- animate__rollIn / animate__bounceInDown -->
  36. <!-- animate__animated animate__tada -->
  37. <div class="ai-tip">喊一声“晓菲晓菲”,可以跟我对话</div>
  38. <div class="chat-container">
  39. <!-- <div class="chat-message user-message animate__animated animate__fadeInUp">
  40. <div class="message-content">
  41. <img src="images/1080_4.png" alt="" class="message-avatar" />
  42. <span class="message-text">你好!</span>
  43. </div>
  44. </div>
  45. <div class="chat-message ai-message animate__animated animate__flipInY">
  46. <div class="message-content">
  47. <img src="images/1080_5.png" alt="" class="message-avatar" />
  48. <span class="message-text" id="botReplyText">你好!请问有需要帮助的吗?</span>
  49. </div>
  50. </div> -->
  51. </div>
  52. <div class="other-content">
  53. <!-- animate__backInDown / animate__backInUp / animate__bounceIn / animate__bounceInDown /animate__bounceInUp -->
  54. <!-- 图书列表 -->
  55. <div class="book-box">
  56. <div class="layer-content layer-book-box animate__animated animate__bounceInUp">
  57. <div class="layer-header">
  58. <h3>图书列表</h3>
  59. <div class="layer-closed layer-index-closed"></div>
  60. </div>
  61. <div class="swiper mySwiper">
  62. <div class="swiper-wrapper">
  63. </div>
  64. <div class="book-last">
  65. <div class="book-result"></div>
  66. <div class="swiper-button-prev"></div>
  67. <div class="swiper-pagination"></div>
  68. <div class="swiper-button-next"></div>
  69. </div>
  70. </div>
  71. </div>
  72. <!-- 导航地址页 -->
  73. <div class="layer-content layer-place-box animate__animated animate__bounceInUp">
  74. <div class="layer-header">
  75. <h3>导航</h3>
  76. <div class="layer-closed layer-place-closed"></div>
  77. </div>
  78. <div class="map-content">
  79. </div>
  80. </div>
  81. </div>
  82. <!-- 导航地址页 -->
  83. <div class="layer-content layer-place2-box animate__animated animate__bounceInUp">
  84. <div class="layer-header">
  85. <h3>导航</h3>
  86. <div class="layer-closed layer-place-closed"></div>
  87. </div>
  88. <div class="map-content2">
  89. </div>
  90. </div>
  91. <!-- 3D内容页 -->
  92. <div class="layer-content layer-img3-box animate__animated animate__bounceInUp">
  93. <div class="layer-closed layer-place-closed"></div>
  94. <div class="threeImg-content">
  95. </div>
  96. <div class="threeImg-info">
  97. </div>
  98. </div>
  99. <div class="test" style="position: fixed; right: 0; top: 0;"></div>
  100. <!-- 视频播放 -->
  101. <div class="layer-content layer-video-box animate__animated animate__bounceInUp">
  102. <div class="layer-header">
  103. <h3>视频标题</h3>
  104. <div class="layer-closed layer-index-closed"></div>
  105. </div>
  106. <div class="video-box">
  107. <!-- <video width="100%" height="100%" controls autoplay muted>
  108. <source src="video/入门级开源机械臂ultraArm套装.mp4" type="video/mp4">
  109. </video> -->
  110. </div>
  111. </div>
  112. </div>
  113. <!-- 帮助 -->
  114. <div class="layer-help-box animate__animated animate__fadeInLeft">
  115. <div class="layer-closed layer-help-closed"></div>
  116. <h4>HI,您好!<br/>
  117. 我是您的AI助手晓菲!</h4>
  118. <p class="help-top-text">我可以为您提供图书查询、导航定位、参考咨询、智能推荐等服务。让我们一起在知识的海洋中航行,发现新大陆!有什么问题想要探讨吗?</p>
  119. <ul class="help-tip">
  120. <li class="animate__animated animate__bounceInUp">
  121. <span>图书查询</span>
  122. <p>"请帮我查一下《斗罗大陆》这本书"</p>
  123. </li>
  124. <li class="animate__animated animate__bounceInUp">
  125. <span>图书推荐</span>
  126. <p>"帮我推荐一下近期热门书籍"</p>
  127. </li>
  128. <li class="animate__animated animate__bounceInUp">
  129. <span>知识百科</span>
  130. <p>"请问《红楼梦》里王熙凤和贾宝玉是什么关系?"</p>
  131. </li>
  132. <li class="animate__animated animate__bounceInUp">
  133. <span>大模型</span>
  134. <p>"请帮我写一篇关于“日落”的300字文章"</p>
  135. </li>
  136. <li class="animate__animated animate__bounceInUp">
  137. <span>导航定位</span>
  138. <p>"请问少儿借阅室怎么走"</p>
  139. </li>
  140. </ul>
  141. </div>
  142. </div>
  143. </div>
  144. </body>
  145. <script type="text/javascript" src="js/libs/jquery-3.7.1.min.js"></script>
  146. <script type="text/javascript" src="js/libs/flexible.js"></script>
  147. <!-- 弹出框 -->
  148. <script type="text/javascript" src="js/plugins/swiper-bundle.min.js"></script>
  149. <script type="text/javascript" src="config.js"></script>
  150. <script type="text/javascript" src="data.js"></script>
  151. <script>
  152. var dataJson = data
  153. var shouldStopTyping = false; // 停止打字标识
  154. var helpTimer; // 帮助的自动消失定时器
  155. var intervalText; // 打字定时器
  156. var swiper;
  157. function helpShowHide() {
  158. clearTimeout(helpTimer);
  159. $('.chat-message').remove();
  160. $('.layer-content').hide();
  161. if ($('.layer-help-box').is(':visible')) {
  162. // 如果帮助框是可见的,则隐藏它
  163. $('.layer-help-box').hide();
  164. } else {
  165. // 如果帮助框是隐藏的,则显示它,并设置定时器
  166. $('.layer-help-box').show();
  167. helpTimer = setTimeout(() => {
  168. $('.layer-help-box').hide();
  169. }, 7000); // 7秒后隐藏帮助框
  170. }
  171. }
  172. // animate__swing / animate__tada / animate__wobble
  173. // animate__rollIn / animate__bounceInDown
  174. $(function(){
  175. // 顶部提示语动画
  176. setInterval(function() {
  177. $('.ai-tip').css('animation-duration', '1s').addClass('animate__animated animate__tada');
  178. setTimeout(function() {
  179. $('.ai-tip').removeClass('animate__animated animate__tada');
  180. }, 1000);
  181. }, 5000);
  182. // 禁用右键菜单
  183. document.addEventListener('contextmenu', function(event) {
  184. event.preventDefault();
  185. });
  186. // 帮助按钮点击事件
  187. $('.nav-help').on('click', function() {
  188. helpShowHide();
  189. });
  190. // 帮助的关闭按钮click
  191. $(".layer-help-closed").on("click",function(){
  192. clearTimeout(helpTimer); // 清除之前的定时器
  193. $('.layer-help-box').hide()
  194. })
  195. // 图书列表 / 视频弹框的关闭按钮
  196. $(".layer-index-closed").on("click",function(){
  197. // 销毁 Swiper 实例
  198. if (swiper) {
  199. swiper.destroy();
  200. }
  201. $('.layer-content').hide()
  202. $('.swiper-wrapper').html('')
  203. })
  204. // 新地址弹框
  205. $('.layer-place2-box .layer-place-closed').on("click",function(){
  206. $('.map-content2').html('');
  207. $('.layer-place2-box').hide();
  208. })
  209. // 3D图片弹框
  210. $('.layer-img3-box .layer-place-closed').on("click",function(){
  211. $('.threeImg-content').html('');
  212. $('.layer-img3-box').hide();
  213. })
  214. })
  215. // 图书列表
  216. // getBookList(dataJson)
  217. // getBookList([{"BookName":"陈氏太极拳图说:简体版","Author":"陈鑫","Isbn":"7537727279","Publish":null,"Sortmark":"G852.111.9-64/1","BookCover":"aba3eec6723f4cef8d2ae0661946862e","SrcUrl":"http://static1.showapi.com/app2/isbn/unk/8587da2ac70e4a41a4ce3a30cd5c1035.jpg","Books":[{"Barcode":"4201120100108481","PlaceName":null}]},{"BookName":"孟子译注:简体字本","Author":"杨伯峻译注","Isbn":"9787101063585","Publish":null,"Sortmark":"B222.52/1","BookCover":"85ebce648e24408db5095528e6534356","SrcUrl":"http://static1.showapi.com/app2/isbn/101/b16902a8ad4646ed8296f51a6c2c3483.jpg","Books":[{"Barcode":"4201120100237455","PlaceName":"三楼图书借阅区001排A面06架05层"}]},{"BookName":"章太炎家书:手稿与简体字对照版","Author":"章太炎等","Isbn":"9787512673069","Publish":null,"Sortmark":"B259.25/6","BookCover":"dd5948c5f9454e959b25220b86d57c7c","SrcUrl":"https://book-resource.dataesb.com/cover/p/20210730/eae5b39e98f14d388c8e18e5276b9451.jpeg","Books":[{"Barcode":"4201120100417226","PlaceName":"三楼图书借阅区001排A面07架04层"},{"Barcode":"4201120100417225","PlaceName":null}]},{"BookName":"论语译注:简体字本","Author":"杨伯峻译注","Isbn":"7101054196","Publish":null,"Sortmark":"B222.22/5","BookCover":"732e35c6e0914443b6c375456eb1e3b5","SrcUrl":"https://book-resource.dataesb.com/cover/p/20200516/775ed0e2d7a14163bbf872dd47f4d31b.jpeg","Books":[{"Barcode":"4201120100237456","PlaceName":"三楼图书借阅区001排A面05架07层"}]}])
  218. function handleImageError(imgElement) {
  219. imgElement.src = 'images/dxh/default-img.png';
  220. if (!imgElement.classList.contains('dxh-class')) {
  221. imgElement.classList.add('dxh-class');
  222. }
  223. imgElement.onerror = null;
  224. }
  225. function getBookList(dataBook){
  226. var swiperHtml = '';
  227. var processedBooks = 0;
  228. var promises = [];
  229. for (let i = 0; i < dataBook.length; i++) {
  230. let book = dataBook[i];
  231. let places = book.books || book.Books || [];
  232. let placesHtml = places.map(function(place) {
  233. let noDataClass = ( place.placeName === null || place.PlaceName === null) ? 'no-data' : '';
  234. return '<a class="' + noDataClass + '" href="javascript:;" data-id="'+ (place.barcode || place.Barcode) +'">' + ( ( place.placeName || place.PlaceName ) || '暂无架位信息') + '</a>';
  235. }).join('');
  236. (function(book) {
  237. promises.push($.ajax({
  238. url: config.apiUrl+'/dxhtsg/getCoverByISBN',
  239. type: 'GET',
  240. data: {
  241. 'isbn': book.isbn || book.Isbn
  242. },
  243. success: function(res) {
  244. console.log('res',res)
  245. if (res) {
  246. book.cover = res;
  247. }
  248. swiperHtml += createBookHtml(book, placesHtml);
  249. processedBooks++;
  250. },
  251. error: function(err) {
  252. console.error(err);
  253. }
  254. }));
  255. })(book);
  256. }
  257. Promise.all(promises).then(function() {
  258. $('.book-result').html('共有 ' + dataBook.length + ' 册图书符合您的检索结果');
  259. $('.swiper-wrapper').html(swiperHtml);
  260. $('.layer-book-box').show();
  261. // list轮播切换
  262. swiper = new Swiper(".mySwiper", {
  263. spaceBetween: 30,
  264. centeredSlides: true,
  265. autoHeight: true,
  266. autoplay: {
  267. delay: 6000,
  268. disableOnInteraction: false,
  269. },
  270. pagination: {
  271. el: ".swiper-pagination",
  272. type: "fraction",
  273. },
  274. navigation: {
  275. nextEl: ".swiper-button-next",
  276. prevEl: ".swiper-button-prev",
  277. },
  278. on: {
  279. init: function () {
  280. // 轮播初始化后立即请求第一个图书的gist
  281. requestBookGist(this.slides[0].dataset.isbn);
  282. },
  283. touchStart: function(swiper,event){
  284. swiper.autoplay.stop();
  285. },
  286. touchEnd: function(swiper,event){
  287. swiper.autoplay.start();
  288. },
  289. slideChangeTransitionStart: function () {
  290. let currentBook = this.slides[this.activeIndex].dataset.isbn
  291. requestBookGist(currentBook);
  292. }
  293. }
  294. });
  295. // 图书导航列表点击
  296. // http://58.49.77.70:8443/anchoring/goNavigation.do?libcode=1201&barcode=4201120100440912
  297. $('.place-book a').on("click",function(){
  298. var _thisBarcode = $(this).attr('data-id');
  299. var _thisNoData = $(this).hasClass('no-data')
  300. if(!_thisNoData){
  301. // 点击时停止轮播
  302. swiper.autoplay.stop();
  303. $('.map-content').html('<iframe style="border: none;" width="100%" height="100%" src="'+config.apiUrl+'/anchoring/goNavigation.do?libcode='+config.libcode+'&barcode='+_thisBarcode+'"></iframe>');
  304. $('.layer-place-box').show();
  305. }
  306. })
  307. // 图书导航关闭按钮
  308. $('.layer-place-closed').on("click",function(){
  309. $('.map-content').html('');
  310. $('.layer-place-box').hide();
  311. // 弹框关闭后恢复轮播
  312. swiper.autoplay.start();
  313. })
  314. }).catch(function(error) {
  315. console.error(error);
  316. });
  317. function createBookHtml(book, placesHtml) {
  318. var imgClass = book.cover.includes('dxh') ? 'dxh-class' : '';
  319. return '<div class="swiper-slide" data-isbn='+ (book.isbn || book.Isbn) +'>' +
  320. '<div class="book-wrapper">' +
  321. '<div class="book-info">' +
  322. '<div class="info-img">' +
  323. '<img src="' + book.cover + '" alt="" class="' + imgClass + '" onerror="handleImageError(this);" />' +
  324. '</div>' +
  325. '<div class="info-text">' +
  326. '<p>' + ( book.bookName || book.BookName ) + '</p>' +
  327. '<p><i>著者:</i><span>' + (book.author || book.Author || '-') + '</span></p>' +
  328. '<p><i>出版社:</i><span>' + (book.publish || book.Publish || '-') + '</span></p>' +
  329. '<p><i>ISBN:</i><span>' + (book.isbn || book.Isbn || '-') + '</span></p>' +
  330. '<p class="gist-content"><span>' + (book.gist || book.Gist || '-') + '</span></p>' +
  331. '</div>' +
  332. '</div>' +
  333. '<div class="place-book">' + placesHtml + '</div>' +
  334. '</div>' +
  335. '</div>';
  336. }
  337. // http://58.49.77.70:8443/dxhtsg/LibraryBookByBarcode 通过barcode获取一本图书 {"barcode":"4201000201648913"}
  338. // http://58.49.77.70:8443/dxhtsg/LibraryBookByISBN 通过isbn获取第一本有简介的图书 {"isbn":"4201000201648913"}
  339. // http://58.49.77.70:8443/dxhtsg/LibraryBookByISBNTop1 通过isbn获取图书集合 {"isbn":"4201000201648913"}
  340. // http://58.49.77.70:19000/LibraryBookByBarcode
  341. function requestBookGist(isbn) {
  342. if (isbn) {
  343. $.ajax({
  344. url: config.apiUrl + '/dxhtsg/LibraryBookByISBN ',
  345. type: 'POST',
  346. contentType:'application/json',
  347. dataType: "json",
  348. data: JSON.stringify({
  349. 'isbn': isbn
  350. }),
  351. success: function(res) {
  352. console.log(res)
  353. if(res.length !== 0){
  354. updateGist(res[0].gist);
  355. }else{
  356. updateGist('');
  357. }
  358. },
  359. error: function(err) {
  360. console.error(err);
  361. }
  362. });
  363. }
  364. }
  365. function updateGist(gist) {
  366. $('.gist-content span').text('')
  367. $('.gist-content span').text(gist);
  368. }
  369. }
  370. // newPlace('http://58.49.77.70:8443/anchoring/goNavigation.do?libcode=1201&barcode=4201120100331343')
  371. function newPlace(url){
  372. $('.map-content2').html('<iframe style="border: none;" width="100%" height="100%" src="'+url+'"></iframe>');
  373. $('.layer-place2-box').show();
  374. }
  375. // 3D图片弹框
  376. const json = {
  377. 'url': 'https://f.3dman.cn/art/9fM6sgHv/fbx/YwU35Vn8/index.html',
  378. 'name': '景泰蓝珐琅景泰蓝珐琅景泰蓝珐琅景泰',
  379. 'date': '清乾隆清乾隆清乾隆清乾隆22222',
  380. 'size': '6.8*9.8*25.8cm',
  381. }
  382. // threeDieImg(json)
  383. function threeDieImg(json){
  384. $('.threeImg-content').html('<iframe id="myIframe" style="border: none;" width="100%" height="100%" src="'+json.url+'"></iframe>');
  385. // 首先展示name
  386. // $('.threeImg-info').html(json.name).addClass('animate__animated animate__fadeIn');
  387. const sizeParts = json.size.split('*').map((size, index) => {
  388. const dimension = size.replace('cm', '').trim();
  389. const prefixes = ['长', '宽', '高'];
  390. return `<span class="three-dimension">${prefixes[index]}:${dimension}</span>`;
  391. }).join(' ');
  392. const sizeWithUnit = `${sizeParts} <span class="three-unit">单位:cm</span>`;
  393. $('.threeImg-info').html(`
  394. <p class="three-name">${json.name}</p>
  395. <p class="three-size">${sizeWithUnit}</p>
  396. <p class="three-date">${json.date}</p>
  397. `).addClass('animate__animated animate__fadeIn');
  398. // // 等待一段时间后隐藏name,展示date
  399. // setTimeout(function() {
  400. // $('.threeImg-info').hide().removeClass('animate__animated animate__fadeIn');
  401. // $('.threeImg-info').html(json.date);
  402. // $('.threeImg-info').show().addClass('animate__animated animate__fadeIn');
  403. // }, 4000); // 延迟4秒,可以根据需要调整时间
  404. // // 再等待一段时间后隐藏date,展示size
  405. // setTimeout(function() {
  406. // $('.threeImg-info').hide().removeClass('animate__animated animate__fadeIn');
  407. // $('.threeImg-info').html(json.size);
  408. // $('.threeImg-info').show().addClass('animate__animated animate__fadeIn');
  409. // }, 8000); // 延迟8秒,即在展示date后2秒展示size
  410. // // 全部展示完之后
  411. // setTimeout(function() {
  412. // $('.threeImg-info').html('');
  413. // $('.threeImg-info').hide();
  414. // }, 12000);
  415. $('.layer-img3-box').show();
  416. }
  417. function handleThreeImg(value1, value2, value3) {
  418. document.getElementById('myIframe').contentWindow.postMessage({ action: 'setModelRotation', data: [value1, value2, value3] }, '*');
  419. }
  420. // 获取视频播放
  421. function getVideo(title,videoSrc){
  422. $('.layer-video-box').show();
  423. $('.layer-video-box').find('h3').html(title);
  424. var html = '<video width="100%" height="100%" controls autoplay muted>'+
  425. '<source src="'+videoSrc+'" type="video/mp4">'+
  426. '</video>';
  427. $('.video-box').html(html);
  428. }
  429. // $(document).on('click', '.nav-talk', function() {
  430. // talkDefalutToIng()
  431. // setTimeout(()=>{
  432. // // 检测发送用户提问内容
  433. // userQuestion(1,'测试一下')
  434. // // 模拟机器人的回答
  435. // setTimeout(function() {
  436. // talkIngToEnd()
  437. // var message = "所替代,万物复苏,生命在这个季节里得到了更新。在田野上,农民们忙碌地耕种,希望在秋天收获满满的果实。而在城市中,人们带着期待和希望迎接新的一年。孩子们在公园里欢笑玩耍,他们的笑声如同春天的风,温暖而清新。河边的柳树开始发芽,嫩绿的叶子在阳光下闪闪发光。花朵在春风的吹拂下慢慢绽放,她们像是一群群舞者,在舞台上展示着各自的美丽。春天是一首优美的诗,是一幅生动的画。它带给我们的不仅仅是美景,更是对生活的热爱和对未来的期待。让我们珍惜这个美丽的季节,感受大自然的魅力,享受生活的美好。"
  438. // digiPeopleReply(message)
  439. // getBookList(dataJson)
  440. // }, 4000);
  441. // $('.layer-help-box').hide();
  442. // $('.layer-content').hide()
  443. // },4000)
  444. // })
  445. // $(document).on('click', '.talk-end', function() {
  446. // talkEndToDefalut()
  447. // })
  448. // $(document).on('click', '.nav-home', function() {
  449. // setTimeout(()=>{
  450. // // 检测发送用户提问内容
  451. // userQuestion(2,'文物介绍')
  452. // $('.layer-help-box').hide();
  453. // $('.layer-content').hide()
  454. // },4000)
  455. // })
  456. // 提问 - 录音
  457. function talkDefalutToIng(){
  458. $('.nav-talk').html('<p><span>录音</span></p>').removeClass().addClass('talk-ing');
  459. $('.layer-help-box').hide();
  460. }
  461. // 录音 - 打断
  462. function talkIngToEnd(){
  463. $('.talk-ing').html('<p><span>打断</span></p>').removeClass().addClass('talk-end');
  464. }
  465. // 打断 - 提问
  466. function talkEndToDefalut(){
  467. $('.talk-end').html('<p><span>提问</span></p>').removeClass().addClass('nav-talk');
  468. shouldStopTyping = true; // 设置变量,指示应该停止打字
  469. clearInterval(intervalText); // 清除定时器
  470. }
  471. // 用户提问
  472. function userQuestion(chatType, message){
  473. if (swiper) {
  474. swiper.destroy();
  475. }
  476. $('.layer-help-box').hide();
  477. $('.layer-content').hide();
  478. $('.swiper-wrapper').html('')
  479. var $userMessageBox = $('<div class="chat-message user-message animate__animated animate__fadeInUp"></div>');
  480. $userMessageBox.html(
  481. '<div class="message-content">' +
  482. '<img src="images/1080_4.png" alt="" class="message-avatar" />' +
  483. '<span class="message-text">' + message + '</span>' +
  484. '</div>'
  485. );
  486. // 将用户的消息添加到聊天容器的最顶部
  487. $('.chat-container').prepend($userMessageBox);
  488. // 清空旧的消息,只保留最新的一条问答
  489. $('.chat-container').children('.chat-message').slice(1).remove();
  490. if(chatType===1){
  491. // 常规提问 居中
  492. $('.chat-container').removeClass('three-chat-container')
  493. }else{
  494. // 非常规提问 顶部
  495. $('.chat-container').addClass('three-chat-container')
  496. }
  497. setTimeout(()=>{
  498. var $userMessageBox = $('.chat-container').children('.chat-message.user-message').last();
  499. var $botMessageBox = $('<div class="chat-message ai-message animate__animated animate__fadeInUp"></div>');
  500. $botMessageBox.html(
  501. '<div class="message-content">' +
  502. '<img src="images/1080_5.png" alt="" class="message-avatar" />' +
  503. '<span class="message-text" id="botReplyText"><img class="loading" src="images/loading.webp" alt="" /></span>' +
  504. '</div>'
  505. );
  506. $userMessageBox.after($botMessageBox);
  507. },1000)
  508. }
  509. // 数字人回答
  510. function digiPeopleReply(message) {
  511. shouldStopTyping = false;
  512. setTimeout(function() {
  513. // 隐藏loading
  514. $('.ai-message').find('.loading').hide();
  515. // 数字人回复逐字敲打出来
  516. var index = 0;
  517. intervalText = setInterval(function() {
  518. if (!shouldStopTyping && index < message.length) {
  519. $('#botReplyText').text(message.substring(0, index + 1));
  520. index++;
  521. $('#botReplyText').scrollTop($('#botReplyText')[0].scrollHeight);
  522. } else if (shouldStopTyping) {
  523. clearInterval(intervalText); // 停止打字动画
  524. }
  525. }, 100); // 100 打字速度,越小越快
  526. }, 1000);
  527. }
  528. </script>
  529. </html>