| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- var clientChatHtml = ''
- var serviceChatHtml = ''
- var objVoice ={
- agent_id:'8000',
- timestamp:new Date().getTime(),
- data:''
- }
- //VoiceCommAPI.setConfigureServer("http://配置服务器 URL");
- //var agent = VoiceCommAPI.createAgentControl();
- //agent.login(objVoice);
- //agent.setDetectSpeechEventListener(objVoice,function(data){})
- //agent.on('setDetectSpeechEventListener',function(data){})
- setTimeout(function(){
-
- for(var i = 0; i < voiceToTextContextAway.length; i++) {
- if (voiceToTextContextAway[i].type=="clientChat") {
- $('<div class="clientChat"><img src="img/youkeTx.png"><div class="clientChatText">'+
- voiceToTextContextAway[i].clientChat+'</div></div>').appendTo($(".voiceToTextContext"));
- } else if(voiceToTextContextAway[i].type=="serviceChat"){
- $('<div class="serviceChat"><img src="img/kefuTx.png"><div class="serviceChatText">'+
- voiceToTextContextAway[i].serviceChat+'</div></div>').appendTo($(".voiceToTextContext"));
- }
- }
-
- scrollTopFn("scrollVoice")
- },2000)
- $("#clickElementVoice").click(function(){
- var elThis = $(this)
- voiceTextToggle(elThis,1000)
- $(".voiceToText").toggle(1000)
- })
- function voiceTextToggle(elThis,timeToggle){
- if (elThis.text() === '隐藏') {
- elThis.text( '展开')
- elThis.css({
- "right":"0px",
- "top":"70%"
- })
- }else if(elThis.text() === '展开'){
- elThis.text( '隐藏')
- elThis.css({
- "right":"348px",
- "top":"50%"
- })
-
- }
- showFn(elThis,timeToggle)
- }
- function scrollTopFn(el){
- scrollVoice = document.getElementById(el)
- scrollVoice.scrollTop = scrollVoice.scrollHeight
- }
- function showFn(el,timeToggle){
- var timeoutShow= null
- el.hide()
- clearTimeout(timeoutShow)
- timeoutShow = setTimeout(function(){
- el.show()
- scrollTopFn("scrollVoice")
- timeoutShow= null
- },timeToggle)
- }
- var voiceToTextContextAway = [
- {
- type:"clientChat",
- clientChat:'你知道2020年我最宝贵的是什么吗'
- },
- {
- type:"serviceChat",
- serviceChat:'什么哟'
- },
- {
- type:"clientChat",
- clientChat:'我刚说的那句话的第一个字'
- },
- {
- type:"clientChat",
- clientChat:'啊 我的心好痛'
- },
- {
- type:"serviceChat",
- serviceChat:'怎么了'
- },
- {
- type:"clientChat",
- clientChat:'你卡在我心上了'
- },
- {
- type:"clientChat",
- clientChat:'我第一次见到你我就发烧了'
- },
- {
- type:"serviceChat",
- serviceChat:'为什么'
- },
- {
- type:"clientChat",
- clientChat:'因为一见钟情的体温是38°6啊'
- },
- {
- type:"clientChat",
- clientChat:'你知道我现在最想喝什么吗?'
- },
- {
- type:"serviceChat",
- serviceChat:'喝什么?'
- },
- {
- type:"clientChat",
- clientChat:'呵护你。'
- },
- {
- type:"clientChat",
- clientChat:'我觉得我好像见过你'
- },
- {
- type:"serviceChat",
- serviceChat:'在哪?'
- },
- {
- type:"clientChat",
- clientChat:'在我的结婚证上'
- },
- {
- type:"clientChat",
- clientChat:'你喜欢吃糖吗'
- },
- {
- type:"serviceChat",
- serviceChat:'不喜欢'
- },
- {
- type:"clientChat",
- clientChat:'那为什么你还这么甜'
- },
- {
- type:"clientChat",
- clientChat:'你跑的快吗?'
- },
- {
- type:"serviceChat",
- serviceChat:'不太快。'
- },
- {
- type:"clientChat",
- clientChat:'那太好了,我一定能追到你。'
- },
- {
- type:"clientChat",
- clientChat:'有一个很美的故事'
- },
- {
- type:"serviceChat",
- serviceChat:'什么故事'
- },
- {
- type:"clientChat",
- clientChat:'就是你遇见我的事'
- },
- ]
|