(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{436:function(t,e,n){"use strict";var o=n(8),r=n(45),c=n(46),l=n(258),d=n(108),m=n(16),f=n(82).f,v=n(83).f,h=n(22).f,_=n(438).trim,y="Number",w=o.Number,C=w,k=w.prototype,S=c(n(168)(k))==y,x="trim"in String.prototype,$=function(t){var e=d(t,!1);if("string"==typeof e&&e.length>2){var n,o,r,c=(e=x?e.trim():_(e,3)).charCodeAt(0);if(43===c||45===c){if(88===(n=e.charCodeAt(2))||120===n)return NaN}else if(48===c){switch(e.charCodeAt(1)){case 66:case 98:o=2,r=49;break;case 79:case 111:o=8,r=55;break;default:return+e}for(var code,l=e.slice(2),i=0,m=l.length;ir)return NaN;return parseInt(l,o)}}return+e};if(!w(" 0o1")||!w("0b1")||w("+0x1")){w=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof w&&(S?m((function(){k.valueOf.call(n)})):c(n)!=y)?l(new C($(e)),n,w):$(e)};for(var E,O=n(15)?f(C):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),T=0;O.length>T;T++)r(C,E=O[T])&&!r(w,E)&&h(w,E,v(C,E));w.prototype=k,k.constructor=w,n(26)(o,y,w)}},438:function(t,e,n){var o=n(6),r=n(61),c=n(16),l=n(439),d="["+l+"]",m=RegExp("^"+d+d+"*"),f=RegExp(d+d+"*$"),v=function(t,e,n){var r={},d=c((function(){return!!l[t]()||"​…"!="​…"[t]()})),m=r[t]=d?e(h):l[t];n&&(r[n]=m),o(o.P+o.F*d,"String",r)},h=v.trim=function(t,e){return t=String(r(t)),1&e&&(t=t.replace(m,"")),2&e&&(t=t.replace(f,"")),t};t.exports=v},439:function(t,e){t.exports="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff"},641:function(t,e,n){"use strict";var o=n(3),r=(n(24),n(436),n(12),n(931)),c=n(9),l=n.n(c),d={props:{message:Object}},m=(n(796),n(2)),f=Object(m.a)(d,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"customer-wrapper"},[n("div",{staticClass:"body"},[n("div",{staticClass:"content"},[t._v(t._s(t.message.content))])])])}),[],!1,null,"23edc402",null).exports,v={props:{message:Object,index:Number},computed:{config:function(){return this.$store.state.botConfig}},methods:{handleClickRealte:function(t){this.$bus.$emit("send-question",{type:"customer",content:t})},like:function(t){var e=JSON.parse(JSON.stringify(this.message));e.likeState=t,e.index=this.index,this.$store.commit("UPDATE_BOT_MESSAGES",e),"like"===t?this.$store.commit("PUSH_BOT_MESSAGES",{type:"yibot",content:"谢谢鼓励,我会继续努力",answerType:"feedback"}):this.$store.commit("PUSH_BOT_MESSAGES",{type:"yibot",content:"谢谢反馈,我会持续学习进步",answerType:"feedback"}),this.$bus.$emit("bot-scroll-to-bottom")}}},h=(n(797),Object(m.a)(v,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticStyle:{"margin-bottom":"24px"}},[n("div",{staticClass:"message-yibot-wrapper"},[n("img",{staticClass:"logo",attrs:{src:t.config.robot_avatar}}),t._v(" "),n("div",{staticClass:"body"},[n("div",{staticClass:"content",domProps:{innerHTML:t._s(t.message.content)}})])]),t._v(" "),-1!==["faq","chat"].indexOf(t.message.answerType)?n("div",{staticClass:"like-wrapper"},["unclick"===t.message.likeState?n("div",{staticClass:"icon-wrapper"},[n("div",{staticClass:"svg-icon can-hover",on:{click:function(e){return t.like("like")}}},[n("svg",{staticClass:"icon",staticStyle:{"margin-top":"2px"},attrs:{"aria-hidden":"true"}},[n("use",{attrs:{"xlink:href":"#icondianzan-weidian"}})])]),t._v(" "),n("div",{staticClass:"svg-icon can-hover",on:{click:function(e){return t.like("dislike")}}},[n("svg",{staticClass:"icon",staticStyle:{"margin-bottom":"2px"},attrs:{"aria-hidden":"true"}},[n("use",{attrs:{"xlink:href":"#icondiancai-weidian"}})])])]):t._e(),t._v(" "),"like"===t.message.likeState?n("div",{staticClass:"icon-wrapper"},[n("div",{staticClass:"svg-icon like-active"},[n("svg",{staticClass:"icon",staticStyle:{"margin-top":"2px"},attrs:{"aria-hidden":"true"}},[n("use",{attrs:{"xlink:href":"#icondianzan-weidian"}})])])]):t._e(),t._v(" "),"dislike"===t.message.likeState?n("div",{staticClass:"icon-wrapper"},[n("div",{staticClass:"svg-icon dislike-active"},[n("svg",{staticClass:"icon",staticStyle:{"margin-bottom":"2px"},attrs:{"aria-hidden":"true"}},[n("use",{attrs:{"xlink:href":"#icondiancai-weidian"}})])])]):t._e()]):t._e(),t._v(" "),t.message.relate&&t.message.relate.length>0?n("div",{staticClass:"relate"},[n("div",{staticClass:"title"},[t._v(t._s(t.message.title))]),t._v(" "),n("div",{staticClass:"recommend"},t._l(t.message.relate,(function(e,o){return n("div",{key:o,staticClass:"item",on:{click:function(n){return t.handleClickRealte(e.qt)}}},[t._v("\n "+t._s(e.qt)+"\n ")])})),0)]):t._e()])}),[],!1,null,null,null).exports),_={props:{message:Object},computed:{config:function(){return this.$store.state.botConfig}},methods:{handleClickRecommend:function(t,e){this.$bus.$emit("send-question",{type:"customer",content:t})}}},y=(n(798),Object(m.a)(_,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"wrapper"},[n("img",{directives:[{name:"show",rawName:"v-show",value:t.message.showLogo,expression:"message.showLogo"}],staticClass:"logo",attrs:{src:t.config.robot_avatar}}),t._v(" "),n("div",{staticClass:"body"},[n("div",{staticClass:"title"},[t._v("您可能想问")]),t._v(" "),t.message.list&&t.message.list.length>0?n("div",{staticClass:"recommend"},t._l(t.message.list,(function(e,o){return n("div",{key:o,staticClass:"item",on:{click:function(n){return t.handleClickRecommend(e.question,o)}}},[t._v("\n "+t._s(e.question)+"\n ")])})),0):t._e()])])}),[],!1,null,"c9681b70",null).exports),w={computed:{config:function(){return this.$store.state.botConfig}}},C=(n(799),Object(m.a)(w,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"wrapper"},[n("img",{staticClass:"logo",attrs:{src:t.config.robot_avatar}}),t._v(" "),t._m(0)])}),[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"body"},[n("span",{staticClass:"dot dot-one"}),t._v(" "),n("span",{staticClass:"dot dot-two"}),t._v(" "),n("span",{staticClass:"dot dot-three"})])}],!1,null,"4a333825",null).exports),k={data:function(){return{start:0,end:4,page:1}},computed:{totalPage:function(){return Math.ceil(this.config.recom_question.length/4)},config:function(){return this.$store.state.botConfig}},methods:{sendQuestion:function(t){this.$bus.$emit("send-question",{type:"customer",content:t})},handleRefresh:function(){this.page===this.totalPage?this.page=1:this.page+=1,this.start=4*(this.page-1),this.end=this.start+4}}},S=(n(800),Object(m.a)(k,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticStyle:{"margin-bottom":"24px"}},[n("div",{staticClass:"welcome-wrapper"},[n("img",{staticClass:"logo",attrs:{src:t.config.robot_avatar}}),t._v(" "),n("div",{staticClass:"body"},[n("div",{staticClass:"content"},[t._v(t._s(t.config.welcome))])])]),t._v(" "),t.config.recom_question.length>0?n("div",{staticClass:"hot-question-wrapper"},[n("div",{staticClass:"body"},[n("div",{staticClass:"title"},[n("span",[t._v(t._s(t.$t("digitalWorkshop.hotQuestion")))]),t._v(" "),this.config.recom_question.length>4?n("svg",{staticClass:"icon refresh",attrs:{"aria-hidden":"true"},on:{click:function(e){return t.handleRefresh()}}},[n("use",{attrs:{"xlink:href":"#iconshuaxin"}})]):t._e()]),t._v(" "),n("div",{staticClass:"recommend"},t._l(t.config.recom_question.slice(t.start,t.end),(function(e,o){return n("div",{key:o,staticClass:"item",on:{click:function(n){t.sendQuestion(e.question,o+4*(t.page-1))}}},[t._v("\n "+t._s(e.question)+"\n ")])})),0)])]):t._e()])}),[],!1,null,"50217550",null).exports),x={props:{config:Object},components:{Customer:f,Yibot:h,Recommend:y,Loading:C,Welcome:S},computed:{messages:function(){return this.$store.state.botMessages},messageLoading:function(){return this.$store.state.botMessageLoading}}},$=(n(801),Object(m.a)(x,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"message-wrapper"},[n("div",{attrs:{id:"message"}},[t._l(t.messages,(function(e,o){return n("div",{key:o},["customer"===e.type?n("customer",{attrs:{message:e,index:o}}):t._e(),t._v(" "),"yibot"===e.type?n("yibot",{attrs:{message:e,index:o}}):t._e(),t._v(" "),"recommend"===e.type?n("recommend",{attrs:{message:e}}):t._e(),t._v(" "),"welcome"===e.type?n("welcome",{attrs:{message:e,index:o}}):t._e()],1)})),t._v(" "),t.messageLoading?n("loading",{attrs:{config:t.config}}):t._e()],2)])}),[],!1,null,"28c4b774",null).exports),E={computed:{config:function(){return this.$store.state.botConfig}},methods:{handleClick:function(t,e){var n=this;return Object(o.a)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"text"===t.type?n.$bus.$emit("send-question",{type:"customer",content:t.text}):"link"===t.type&&(window.location.href=t.url);case 1:case"end":return e.stop()}}),e)})))()}}},O=(n(802),{components:{Message:$,Shortcut:Object(m.a)(E,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.config.quick_menu.length>0?n("div",{staticClass:"shortcuts"},t._l(t.config.quick_menu,(function(e,o){return n("div",{key:o,staticClass:"item",on:{click:function(n){return t.handleClick(e,o)}}},[t._v("\n "+t._s(e.text)+"\n ")])})),0):t._e()}),[],!1,null,"594e3e72",null).exports},props:{visible:Boolean,botId:Number,botName:String},computed:{config:function(){return this.$store.state.botConfig},messageLoading:function(){return this.$store.state.botMessageLoading}},data:function(){return{userId:"",session_id:"",question:""}},watch:{visible:function(t){!0===t?(this.session_id=Object(r.a)(),this.$store.commit("FLUSH_BOT_MESSAGES"),this.getBotConfig(),document.querySelector("body").style.overflow="hidden"):document.querySelector("body").style.overflow="auto"}},mounted:function(){var t=this;window.localStorage.getItem("aiforce_uuid")?this.userId=window.localStorage.getItem("aiforce_uuid"):(this.userId=Object(r.a)(),window.localStorage.setItem("aiforce_uuid",this.userId)),this.$bus.$on("send-question",(function(e){t.receiveUserQuestion(e)})),this.$bus.$on("bot-scroll-to-bottom",(function(e){t.pageScrollToBottom()}))},methods:{sleep:function(t){return new Promise((function(e){return setTimeout(e,t)}))},handleSend:function(){""!==this.question&&(this.$bus.$emit("send-question",{type:"customer",content:this.question}),this.question="")},getBotConfig:function(){var t=this;return Object(o.a)(regeneratorRuntime.mark((function e(){var n,data;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.$store.commit("FLUSH_BOT_CONFIG"),e.next=3,l.a.get("/public_api/bot/settings?id=".concat(t.botId)).catch((function(t){return console.log(t)}));case 3:n=e.sent,0===(data=n.data).code&&(t.$store.commit("SET_BOT_CONFIG",data.data),t.$store.commit("PUSH_BOT_MESSAGES",{type:"welcome"}));case 6:case"end":return e.stop()}}),e)})))()},receiveUserQuestion:function(t){this.messageLoading||(this.pushMessage(t),this.sendQuestionToYibot(t.content))},sendQuestionToYibot:function(t){var e=this;return Object(o.a)(regeneratorRuntime.mark((function n(){var o,data,r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,l.a.get("/public_api/bot/query?question=".concat(t,"&id=").concat(e.botId,"&userId=").concat(e.userId,"&session_id=").concat(e.session_id)).catch((function(t){return console.log(t)}));case 3:if(o=n.sent,data=o.data,0!==(r=data.data).status){n.next=13;break}if(1!==r.reject_recog){n.next=10;break}return e.pushMessage({type:"yibot",content:e.config.robotUnknown,answerType:r.answer_type}),n.abrupt("return");case 10:"task"===r.answer_type?e.analyzeTaskAnswer(r):"task_faq"===r.answer_type?e.analyzeTaskFaqAnswer(r):e.analyzeFaqAnswer(r),n.next=14;break;case 13:e.pushMessage({type:"yibot",content:e.config.robotUnknown});case 14:n.next=20;break;case 16:n.prev=16,n.t0=n.catch(0),e.$store.commit("SET_BOT_MESSAGE_LOADING",!1),e.pushMessage({type:"tip",content:"当前网络不可用,请稍后再试"});case 20:case"end":return n.stop()}}),n,null,[[0,16]])})))()},pushMessage:function(t){var e=this;return Object(o.a)(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if("yibot"!==t.type&&"recommend"!==t.type){n.next=4;break}return n.next=3,e.sleep(500);case 3:e.$store.commit("SET_BOT_MESSAGE_LOADING",!1);case 4:"customer"===t.type&&e.$store.commit("SET_BOT_MESSAGE_LOADING",!0),e.$store.commit("PUSH_BOT_MESSAGES",t),"welcome"!==t.type&&e.pageScrollToBottom();case 7:case"end":return n.stop()}}),n)})))()},analyzeFaqAnswer:function(data){var t=this;return Object(o.a)(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:200===data.type&&(n=data.info[0],t.pushMessage({type:"yibot",title:"你可能还关心这些问题",content:n.answer,relate:n.relate,answerType:"faq",id:n.id,likeState:"unclick"})),300===data.type&&t.pushMessage({type:"recommend",title:t.config.recommend,question:data.raw_query,list:data.info,showLogo:!0});case 2:case"end":return e.stop()}}),e)})))()},analyzeTaskAnswer:function(data){var t=this;return Object(o.a)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.pushMessage({type:"yibot",content:data.clarify.answer,relate:data.clarify.relate_info,title:"请选择"});case 2:case"end":return e.stop()}}),e)})))()},analyzeTaskFaqAnswer:function(data){var t=this;return Object(o.a)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.analyzeFaqAnswer(data),t.analyzeTaskAnswer(data);case 2:case"end":return e.stop()}}),e)})))()},pageScrollToBottom:function(){var t=this;return Object(o.a)(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.sleep(200);case 2:n=document.getElementById("message").clientHeight,"function"==typeof document.body.scrollTo?document.querySelector(".dialog-body").scrollTo({top:n,behavior:"smooth"}):document.querySelector(".dialog-body").scrollTop=n;case 4:case"end":return e.stop()}}),e)})))()}}}),T=(n(803),Object(m.a)(O,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.visible?n("div",{staticClass:"dialog-wrapper",on:{click:function(e){return e.target!==e.currentTarget?null:t.$emit("update:visible",!1)}}},[n("div",{ref:"dialog",staticClass:"dialog"},[n("div",{staticClass:"dialog-header"},[n("span",{staticClass:"dialog-header__title"},[t._v(t._s(t.botName))]),t._v(" "),n("svg",{staticClass:"icon dialog-header__close",attrs:{"aria-hidden":"true"},on:{click:function(e){return t.$emit("update:visible",!1)}}},[n("use",{attrs:{"xlink:href":"#iconguanbi"}})])]),t._v(" "),n("div",{staticClass:"dialog-body"},[n("message")],1),t._v(" "),n("div",{staticClass:"dialog-footer"},[n("shortcut"),t._v(" "),n("textarea",{directives:[{name:"model",rawName:"v-model.trim",value:t.question,expression:"question",modifiers:{trim:!0}}],staticClass:"dialog-footer__textarea",attrs:{placeholder:t.config.prompt},domProps:{value:t.question},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:(e.preventDefault(),t.handleSend.apply(null,arguments))},input:function(e){e.target.composing||(t.question=e.target.value.trim())},blur:function(e){return t.$forceUpdate()}}}),t._v(" "),n("div",{staticClass:"dialog-footer__send",attrs:{disabled:!t.question},on:{click:t.handleSend}},[t._v("发送")])],1)])]):t._e()}),[],!1,null,"3d42af9d",null));e.a=T.exports},652:function(t,e,n){},653:function(t,e,n){},654:function(t,e,n){},655:function(t,e,n){},656:function(t,e,n){},657:function(t,e,n){},658:function(t,e,n){},659:function(t,e,n){},796:function(t,e,n){"use strict";n(652)},797:function(t,e,n){"use strict";n(653)},798:function(t,e,n){"use strict";n(654)},799:function(t,e,n){"use strict";n(655)},800:function(t,e,n){"use strict";n(656)},801:function(t,e,n){"use strict";n(657)},802:function(t,e,n){"use strict";n(658)},803:function(t,e,n){"use strict";n(659)},931:function(t,e,n){"use strict";var o="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),r=new Uint8Array(16);function c(){if(!o)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return o(r)}for(var l=[],d=0;d<256;++d)l[d]=(d+256).toString(16).substr(1);var m=function(t,e){var i=e||0,n=l;return[n[t[i++]],n[t[i++]],n[t[i++]],n[t[i++]],"-",n[t[i++]],n[t[i++]],"-",n[t[i++]],n[t[i++]],"-",n[t[i++]],n[t[i++]],"-",n[t[i++]],n[t[i++]],n[t[i++]],n[t[i++]],n[t[i++]],n[t[i++]]].join("")};e.a=function(t,e,n){var i=e&&n||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||c)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var r=0;r<16;++r)e[i+r]=o[r];return e||m(o)}}}]);