Нет описания

voiceToText.js 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. $("#clickElementVoice").click(function(){
  2. var elThis = $(this)
  3. voiceTextToggle(elThis,1000)
  4. $(".voiceToText").toggle(1000)
  5. })
  6. function voiceTextToggle(elThis,timeToggle){
  7. if (elThis.text() === '隐藏') {
  8. elThis.text( '展开')
  9. elThis.css({
  10. "right":"0px",
  11. "top":"70%"
  12. })
  13. }else if(elThis.text() === '展开'){
  14. elThis.text( '隐藏')
  15. elThis.css({
  16. "right":"348px",
  17. "top":"50%"
  18. })
  19. }
  20. showFn(elThis,timeToggle)
  21. }
  22. function scrollTopFn(el){
  23. scrollVoice = document.getElementById(el)
  24. scrollVoice.scrollTop = scrollVoice.scrollHeight
  25. }
  26. function showFn(el,timeToggle){
  27. var timeoutShow= null
  28. el.hide()
  29. clearTimeout(timeoutShow)
  30. timeoutShow = setTimeout(function(){
  31. el.show()
  32. scrollTopFn("scrollVoice")
  33. timeoutShow= null
  34. },timeToggle)
  35. }
  36. //var clientChatHtml = ''
  37. //var serviceChatHtml = ''
  38. //var objVoice ={
  39. // agent_id:'8000',
  40. // timestamp:new Date().getTime(),
  41. // data:''
  42. //}
  43. //VoiceCommAPI.setConfigureServer("ws://222.143.106.46:12233");
  44. //var agent = VoiceCommAPI.createAgentControl();
  45. //agent.login(objVoice);
  46. //agent.setDetectSpeechEventListener(objVoice,function(data){})
  47. //agent.on('setDetectSpeechEventListener',function(data){})
  48. //setTimeout(function(){
  49. //
  50. // for(var i = 0; i < voiceToTextContextAway.length; i++) {
  51. // if (voiceToTextContextAway[i].type=="clientChat") {
  52. // $('<div class="clientChat"><img src="img/youkeTx.png"><div class="clientChatText">'+
  53. // voiceToTextContextAway[i].clientChat+'</div></div>').appendTo($(".voiceToTextContext"));
  54. // } else if(voiceToTextContextAway[i].type=="serviceChat"){
  55. // $('<div class="serviceChat"><img src="img/kefuTx.png"><div class="serviceChatText">'+
  56. // voiceToTextContextAway[i].serviceChat+'</div></div>').appendTo($(".voiceToTextContext"));
  57. // }
  58. // }
  59. //
  60. //
  61. //},2000)
  62. //var voiceToTextContextAway = [
  63. // {
  64. // type:"clientChat",
  65. // clientChat:'你知道2020年我最宝贵的是什么吗'
  66. // },
  67. // {
  68. // type:"serviceChat",
  69. // serviceChat:'什么哟'
  70. // },
  71. // {
  72. // type:"clientChat",
  73. // clientChat:'我刚说的那句话的第一个字'
  74. // },
  75. // {
  76. // type:"clientChat",
  77. // clientChat:'啊 我的心好痛'
  78. // },
  79. // {
  80. // type:"serviceChat",
  81. // serviceChat:'怎么了'
  82. // },
  83. // {
  84. // type:"clientChat",
  85. // clientChat:'你卡在我心上了'
  86. // },
  87. // {
  88. // type:"clientChat",
  89. // clientChat:'我第一次见到你我就发烧了'
  90. // },
  91. // {
  92. // type:"serviceChat",
  93. // serviceChat:'为什么'
  94. // },
  95. // {
  96. // type:"clientChat",
  97. // clientChat:'因为一见钟情的体温是38°6啊'
  98. // },
  99. // {
  100. // type:"clientChat",
  101. // clientChat:'你知道我现在最想喝什么吗?'
  102. // },
  103. // {
  104. // type:"serviceChat",
  105. // serviceChat:'喝什么?'
  106. // },
  107. // {
  108. // type:"clientChat",
  109. // clientChat:'呵护你。'
  110. // },
  111. // {
  112. // type:"clientChat",
  113. // clientChat:'我觉得我好像见过你'
  114. // },
  115. // {
  116. // type:"serviceChat",
  117. // serviceChat:'在哪?'
  118. // },
  119. // {
  120. // type:"clientChat",
  121. // clientChat:'在我的结婚证上'
  122. // },
  123. // {
  124. // type:"clientChat",
  125. // clientChat:'你喜欢吃糖吗'
  126. // },
  127. // {
  128. // type:"serviceChat",
  129. // serviceChat:'不喜欢'
  130. // },
  131. // {
  132. // type:"clientChat",
  133. // clientChat:'那为什么你还这么甜'
  134. // },
  135. // {
  136. // type:"clientChat",
  137. // clientChat:'你跑的快吗?'
  138. // },
  139. // {
  140. // type:"serviceChat",
  141. // serviceChat:'不太快。'
  142. // },
  143. // {
  144. // type:"clientChat",
  145. // clientChat:'那太好了,我一定能追到你。'
  146. // },
  147. // {
  148. // type:"clientChat",
  149. // clientChat:'有一个很美的故事'
  150. // },
  151. // {
  152. // type:"serviceChat",
  153. // serviceChat:'什么故事'
  154. // },
  155. // {
  156. // type:"clientChat",
  157. // clientChat:'就是你遇见我的事'
  158. // },
  159. //]