Files
weiyu/deploy/server/admin/6902.5208da91.async.js
jack ning 4445905084 update
2025-11-22 13:39:00 +08:00

1 line
34 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use strict";(self.webpackChunkadmin=self.webpackChunkadmin||[]).push([[6902],{2890:function(e,t,n){n.d(t,{IH:function(){return g},RB:function(){return w},SJ:function(){return m},Xy:function(){return k},iO:function(){return x},u9:function(){return c},wU:function(){return v}});var r=n(90819),i=n.n(r),a=n(73193),s=n.n(a),o=n(89933),u=n.n(o),l=n(39497),d=n(14906);function c(e){return f.apply(this,arguments)}function f(){return(f=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/query/org",{method:"GET",params:s()(s()({},t),{},{channel:l.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(e){return p.apply(this,arguments)}function p(){return(p=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/create",{method:"POST",data:s()(s()({},t),{},{channel:l.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(e){return h.apply(this,arguments)}function h(){return(h=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/update",{method:"POST",data:s()(s()({},t),{},{channel:l.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function m(e){return b.apply(this,arguments)}function b(){return(b=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/delete",{method:"POST",data:s()(s()({},t),{},{channel:l.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(e){return y.apply(this,arguments)}function y(){return(y=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/enable",{method:"POST",data:s()(s()({},t),{},{channel:l.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function x(e){return S.apply(this,arguments)}function S(){return(S=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/disable",{method:"POST",data:s()(s()({},t),{},{channel:l.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(e){return C.apply(this,arguments)}function C(){return(C=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/publish",{method:"POST",data:s()(s()({},t),{},{channel:l.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},43167:function(e,t,n){n.d(t,{Dm:function(){return w},Y2:function(){return v},jT:function(){return g},zN:function(){return m},zc:function(){return c}});var r=n(90819),i=n.n(r),a=n(73193),s=n.n(a),o=n(89933),u=n.n(o),l=n(39497),d=n(14906);function c(e){return f.apply(this,arguments)}function f(){return(f=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/workgroup/settings/query/org",{method:"GET",params:s()(s()({},t),{},{channel:l.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(e){return p.apply(this,arguments)}function p(){return(p=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/workgroup/settings/create",{method:"POST",data:s()(s()({},t),{},{channel:l.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(e){return h.apply(this,arguments)}function h(){return(h=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/workgroup/settings/update",{method:"POST",data:s()(s()({},t),{},{channel:l.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function m(e){return b.apply(this,arguments)}function b(){return(b=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/workgroup/settings/delete",{method:"POST",data:s()(s()({},t),{},{channel:l.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(e){return y.apply(this,arguments)}function y(){return(y=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/workgroup/settings/publish",{method:"POST",data:s()(s()({},t),{},{channel:l.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},84262:function(e,t,n){n(90819),n(89933),n(73193),n(45332),n(10404),n(8938),n(24388),n(39497),n(14906),n(44194),n(28427),n(73614),n(31549)},27153:function(e,t,n){var r=n(90819),i=n.n(r),a=n(89933),s=n.n(a),o=n(45332),u=n.n(o),l=(n(71256),n(25784)),d=n(42491),c=n(14906),f=n(44194),g=(n(11329),n(91361)),p=n(31549);t.Z=function(e){e.variant;var t=e.serviceSettings,n=e.onServiceSettingsChange,r=(0,c.useIntl)(),a=l.A.useForm(),o=u()(a,1)[0],v=(0,g.Z)().translateString,h=(0,f.useState)(!1),m=u()(h,2),b=(m[0],m[1]),w=(0,f.useState)(""),y=u()(w,2),x=(y[0],y[1]),S=(0,f.useMemo)((function(){var e,n;return null!==(e=null!==(n=null==t?void 0:t.draft)&&void 0!==n?n:null==t?void 0:t.live)&&void 0!==e?e:void 0}),[null==t?void 0:t.draft,null==t?void 0:t.live]);(0,f.useEffect)((function(){var e=!(null==S||!S.showRateBtn),t=v(null==S?void 0:S.inviteRateTip)||"";o.setFieldsValue({showRateBtn:null==S?void 0:S.showRateBtn,autoInviteRate:null==S?void 0:S.autoInviteRate}),b(e),x(t)}),[S,o,v]);var k=function(){var e=s()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("onFinish:",t);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),C=function(){var e=s()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("TabRating handleChange autoInviteRate",t),o.setFieldValue("autoInviteRate",t),null==n||n({autoInviteRate:t});case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return(0,p.jsx)(p.Fragment,{children:(0,p.jsxs)(l.A,{form:o,onFinish:k,submitter:!1,style:{marginLeft:"20px"},children:[(0,p.jsx)(d.Z,{width:"md",name:"autoInviteRate",label:r.formatMessage({id:"rate.auto.invite.rate"}),tooltip:r.formatMessage({id:"rate.auto.invite.rate.tooltip"}),fieldProps:{onChange:C}}),!1]})})}},66547:function(e,t,n){var r=n(73193),i=n.n(r),a=n(90819),s=n.n(a),o=n(89933),u=n.n(o),l=n(45332),d=n.n(l),c=n(19433),f=n(2890),g=n(88894),p=n(43167),v=n(12864),h=n(7704),m=n(10404),b=n(8938),w=n(24388),y=n(99665),x=n(98830),S=n(91361),k=n(39497),C=n(25784),q=n(42491),j=n(89965),T=n(2250),R=n(14906),M=n(44194),U=n(77033),F=n(67738),Z=n(13847),A=n(41466),I=n(44929),P=n(40795),K=n(5932),O=n(73614),E=n(33019),X=n(75580),W=n(2077),V=n(31549);t.Z=function(e){var t,n,r,a,o,l,L,J,N=e.variant,D=e.serviceSettings,z=e.onServiceSettingsChange,_=e.settingsUid,B=e.isActive,Q=void 0===B||B,$=(0,R.useIntl)(),H=C.A.useForm(),Y=d()(H,1)[0],G=(0,x.u)((function(e){return e.currentOrg})),ee=(0,S.Z)().translateString,te=null==D?void 0:D.live,ne=null==D?void 0:D.draft,re=(0,M.useMemo)((function(){var e;return null!==(e=null!=ne?ne:te)&&void 0!==e?e:{}}),[ne,te]),ie="robot"===N,ae="agent"===N?k.Njn:ie?k._X4:k.aZD,se=(0,M.useState)(),oe=d()(se,2),ue=oe[0],le=oe[1],de=(0,M.useState)(),ce=d()(de,2),fe=ce[0],ge=ce[1],pe=(0,M.useState)(),ve=d()(pe,2),he=ve[0],me=ve[1],be=(0,M.useState)("iframe"),we=d()(be,2),ye=we[0],xe=we[1],Se=(0,M.useState)(0),ke=d()(Se,2),Ce=ke[0],qe=ke[1],je=(0,M.useState)(!1),Te=d()(je,2),Re=Te[0],Me=Te[1],Ue=(0,M.useRef)(Promise.resolve()),Fe=(0,M.useState)("desktop"),Ze=d()(Fe,2),Ae=Ze[0],Ie=Ze[1],Pe=(0,M.useState)(),Ke=d()(Pe,2),Oe=Ke[0],Ee=Ke[1],Xe=(0,M.useState)(),We=d()(Xe,2),Ve=We[0],Le=We[1],Je=(0,M.useState)(),Ne=d()(Je,2),De=Ne[0],ze=Ne[1],_e=(0,M.useCallback)((function(){var e=(null==G?void 0:G.uid)||"unknown";return"admin.preview.selected.".concat(N,".").concat(e)}),[null==G?void 0:G.uid,N]),Be=(0,M.useCallback)((function(){try{return localStorage.getItem(_e())||void 0}catch(e){return}}),[_e]),Qe=(0,M.useCallback)((function(e){try{var t=_e();e?localStorage.setItem(t,e):localStorage.removeItem(t)}catch(e){}}),[_e]),$e=(0,b.V)((function(e){return{robotResult:e.robotResult,setRobotResult:e.setRobotResult}})),He=$e.robotResult,Ye=$e.setRobotResult,Ge=(0,m.E)((function(e){return{agentResult:e.agentResult,setAgentResult:e.setAgentResult}})),et=Ge.agentResult,tt=Ge.setAgentResult,nt=(0,w.$)((function(e){return{workgroupResult:e.workgroupResult,setWorkgroupResult:e.setWorkgroupResult}})),rt=nt.workgroupResult,it=nt.setWorkgroupResult,at=(0,y.z)((function(e){return{currentRobotSettings:e.currentRobotSettings,currentAgentSettings:e.currentAgentSettings,currentWorkgroupSettings:e.currentWorkgroupSettings}})),st=at.currentRobotSettings,ot=at.currentAgentSettings,ut=at.currentWorkgroupSettings,lt=(0,M.useMemo)((function(){if(ae===k._X4){var e,t=Oe||(null==He||null===(e=He.data)||void 0===e||null===(e=e.content)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.uid)||"";return{chatType:k.ACv,chatSid:t}}if(ae===k.Njn){var n,r=Ve||(null==et||null===(n=et.data)||void 0===n||null===(n=n.content)||void 0===n||null===(n=n[0])||void 0===n?void 0:n.uid)||"";return{chatType:k._0X,chatSid:r}}if(ae===k.aZD){var i,a=De||(null==rt||null===(i=rt.data)||void 0===i||null===(i=i.content)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.uid)||"";return{chatType:k.I$6,chatSid:a}}return{chatType:k.ACv,chatSid:""}}),[ae,Oe,null==He||null===(t=He.data)||void 0===t?void 0:t.content,Ve,null==et||null===(n=et.data)||void 0===n?void 0:n.content,De,null==rt||null===(r=rt.data)||void 0===r?void 0:r.content]),dt=lt.chatType,ct=lt.chatSid,ft=(0,M.useCallback)(function(){var e=u()(s()().mark((function e(t){var n,r,i,a,o,u,l,d;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t||he){e.next=4;break}return console.log("TabRight: 没有选择知识库无法获取FAQ"),le(void 0),e.abrupt("return");case 4:return c.yw.loading($.formatMessage({id:"loading",defaultMessage:"Loading"})),n={pageNumber:0,pageSize:100,orgUid:null==G?void 0:G.uid,kbUid:t||he},e.prev=6,e.next=9,(0,v.pf)(n);case 9:r=e.sent,console.log("TabRight.getFaqs response:",n,r),c.yw.destroy(),200===r.code?(i={code:r.code,message:r.message,data:{content:r.data.content.map((function(e){return{uid:e.uid,question:e.question,answer:e.answer,kbUid:e.kbUid,orgUid:e.orgUid}})),totalElements:r.data.totalElements,totalPages:r.data.totalPages,number:r.data.number}},le(i),a=t||he,o=Y.getFieldValue("faqUids")||[],a&&o.length>0&&(l=(null===(u=i.data.content)||void 0===u?void 0:u.map((function(e){return e.uid})))||[],(d=o.filter((function(e){return l.includes(e)}))).length!==o.length&&Y.setFieldValue("faqUids",d))):c.yw.error(r.message),e.next=20;break;case 15:e.prev=15,e.t0=e.catch(6),c.yw.destroy(),console.error("TabRight 获取FAQ失败:",e.t0),c.yw.error("获取FAQ失败");case 20:case"end":return e.stop()}}),e,null,[[6,15]])})));return function(t){return e.apply(this,arguments)}}(),[null==G?void 0:G.uid,Y,$,he]),gt=(0,M.useCallback)(u()(s()().mark((function e(){var t,n,r,i,a;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c.yw.loading($.formatMessage({id:"loading",defaultMessage:"Loading"})),t={pageNumber:0,pageSize:50,type:k.QPQ,orgUid:null==G?void 0:G.uid},e.prev=2,e.next=5,(0,h.AP)(t);case 5:n=e.sent,console.log("TabRight.getKbases response:",t,n),c.yw.destroy(),200===n.code?(i={code:n.code,message:n.message,data:{content:n.data.content.map((function(e){return{uid:e.uid,name:e.name,type:e.type,orgUid:e.orgUid}})),totalElements:n.data.totalElements,totalPages:n.data.totalPages,number:n.data.number}},ge(i),null!=ne&&ne.faqKbUid?a=ne.faqKbUid:null!=te&&te.faqKbUid?a=te.faqKbUid:(null===(r=i.data)||void 0===r||null===(r=r.content)||void 0===r?void 0:r.length)>0&&(a=i.data.content[0].uid),a&&(me(a),Y.setFieldValue("faqKbUid",a),ft(a))):c.yw.error(n.message),e.next=16;break;case 11:e.prev=11,e.t0=e.catch(2),c.yw.destroy(),console.error("TabRight 获取知识库失败:",e.t0),c.yw.error("获取知识库失败");case 16:case"end":return e.stop()}}),e,null,[[2,11]])}))),[null==G?void 0:G.uid,Y,ft,$,null==ne?void 0:ne.faqKbUid,null==te?void 0:te.faqKbUid]);(0,M.useEffect)((function(){var e=Array.isArray(null==re?void 0:re.faqs)?(null==re?void 0:re.faqs).map((function(e){return null==e?void 0:e.uid})).filter(Boolean):[];Y.setFieldsValue({showRightIframe:null==re?void 0:re.showRightIframe,rightIframeUrl:null==re?void 0:re.rightIframeUrl,showFaqs:null==re?void 0:re.showFaqs,faqKbUid:null==re?void 0:re.faqKbUid,faqUids:Array.isArray(null==re?void 0:re.faqUids)?null==re?void 0:re.faqUids:e}),null!=re&&re.faqKbUid&&re.faqKbUid!==he&&(me(re.faqKbUid),ft(re.faqKbUid))}),[Y,ft,re,he]),(0,M.useEffect)((function(){null!=G&&G.uid&&gt()}),[null==G?void 0:G.uid,gt]),(0,M.useEffect)((function(){var e=function(){var e=u()(s()().mark((function e(){var t,n,r,i,a,o,u,l,d,c,f,g,p,v,h,m,b,w,y,x,S;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=G&&G.uid){e.next=2;break}return e.abrupt("return");case 2:if(e.prev=2,ae!==k.Njn){e.next=11;break}return t={pageNumber:0,pageSize:100,orgUid:G.uid},e.next=7,(0,E._t)(t);case 7:200===(n=e.sent).code&&(tt(n),i=(null===(r=n.data)||void 0===r?void 0:r.content)||[],a=Be(),(o=a?i.find((function(e){return(null==e?void 0:e.uid)===a})):void 0)?Le(o.uid):!Ve&&i.length&&(u=i[0],Le(null==u?void 0:u.uid),Qe(null==u?void 0:u.uid))),e.next=25;break;case 11:if(ae!==k._X4){e.next=19;break}return l={pageNumber:0,pageSize:100,level:k.whQ,type:k.f4h,orgUid:G.uid},e.next=15,(0,X.p0)(l);case 15:200===(d=e.sent).code&&(Ye(d),f=(null===(c=d.data)||void 0===c?void 0:c.content)||[],g=Be(),(p=g?f.find((function(e){return(null==e?void 0:e.uid)===g})):void 0)?Ee(p.uid):!Oe&&f.length&&(v=f[0],Ee(null==v?void 0:v.uid),Qe(null==v?void 0:v.uid))),e.next=25;break;case 19:if(ae!==k.aZD){e.next=25;break}return h={pageNumber:0,pageSize:100,orgUid:G.uid},e.next=23,(0,W.LE)(h);case 23:200===(m=e.sent).code&&(it(m),w=(null===(b=m.data)||void 0===b?void 0:b.content)||[],y=Be(),(x=y?w.find((function(e){return(null==e?void 0:e.uid)===y})):void 0)?ze(x.uid):!De&&w.length&&(S=w[0],ze(null==S?void 0:S.uid),Qe(null==S?void 0:S.uid)));case 25:e.next=30;break;case 27:e.prev=27,e.t0=e.catch(2),console.warn("加载预览实体失败(忽略):",e.t0);case 30:case"end":return e.stop()}}),e,null,[[2,27]])})));return function(){return e.apply(this,arguments)}}();e()}),[null==G?void 0:G.uid,ae,tt,Ye,it,Ve,Oe,De,Be,Qe]),(0,M.useEffect)((function(){void 0!==_&&vt("switch-settings")}),[_]);var pt=function(){var e=u()(s()().mark((function e(){var t,n,r,a,o,u;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ae===k.Njn?null==ot?void 0:ot.uid:ae===k._X4?null==st?void 0:st.uid:null==ut?void 0:ut.uid){e.next=3;break}return e.abrupt("return",!0);case 3:return e.prev=3,e.next=6,Y.validateFields();case 6:e.next=12;break;case 8:return e.prev=8,e.t0=e.catch(3),c.yw.warning($.formatMessage({id:"form.validate.failed",defaultMessage:"请先修正表单校验错误"})),e.abrupt("return",!1);case 12:if(t=Y.getFieldsValue(),n={showRightIframe:t.showRightIframe,rightIframeUrl:t.rightIframeUrl,showFaqs:t.showFaqs,faqKbUid:t.faqKbUid,faqUids:Array.isArray(t.faqUids)?t.faqUids:void 0},e.prev=14,Me(!0),r=function(e,t,n){return i()(i()(i()({},e||{}),t||{}),n||{})},ae!==k.Njn||!ot){e.next=23;break}return a=r(ot.serviceSettings,ot.draftServiceSettings,n),e.next=21,(0,f.wU)({uid:ot.uid,serviceSettings:a});case 21:case 27:e.next=33;break;case 23:if(ae!==k._X4||!st){e.next=29;break}return o=r(st.serviceSettings,st.draftServiceSettings,n),e.next=27,(0,g.sK)({uid:st.uid,serviceSettings:o});case 29:if(ae!==k.aZD||!ut){e.next=33;break}return u=r(ut.serviceSettings,ut.draftServiceSettings,n),e.next=33,(0,p.Y2)({uid:ut.uid,serviceSettings:u});case 33:return e.abrupt("return",!0);case 36:return e.prev=36,e.t1=e.catch(14),console.warn("保存右侧配置失败(忽略刷新):",e.t1),c.yw.error($.formatMessage({id:"save.failed",defaultMessage:"保存失败"})),e.abrupt("return",!1);case 41:return e.prev=41,Me(!1),e.finish(41);case 44:case"end":return e.stop()}}),e,null,[[3,8],[14,36,41,44]])})));return function(){return e.apply(this,arguments)}}(),vt=function(){var e=u()(s()().mark((function e(t){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ue.current;case 2:if(!Re){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,pt();case 6:e.sent&&Q&&qe((function(e){return e+1}));case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ht=function(){var e=u()(s()().mark((function e(t){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("onFinish:",t);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),mt=function(){var e=u()(s()().mark((function e(t){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("TabRight handleChange showRightIframe",t),Y.setFieldValue("showRightIframe",t),null==z||z({showRightIframe:t});case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),bt=function(){var e=u()(s()().mark((function e(t){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("TabRight handleChange showFaqs",t),Y.setFieldValue("showFaqs",t),null==z||z({showFaqs:t});case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),wt=(0,M.useMemo)((function(){return _||(ae===k.Njn?null==ot?void 0:ot.uid:ae===k._X4?null==st?void 0:st.uid:ae===k.aZD?null==ut?void 0:ut.uid:void 0)}),[_,ae,null==ot?void 0:ot.uid,null==st?void 0:st.uid,null==ut?void 0:ut.uid]);(0,M.useEffect)((function(){Q&&vt("tab-activated")}),[Q]);var yt=(0,M.useMemo)((function(){if(!Q)return"";var e=(0,K.Cn)(),t=new URLSearchParams({org:(null==G?void 0:G.uid)||"",t:dt,sid:ct,debug:"1",k:String(Ce)});wt&&t.set("settingsUid",wt);var n="".concat(e,"?").concat(t.toString());return console.log("Chat Preview URL Right:",n),n}),[null==G?void 0:G.uid,dt,ct,Ce,wt,Q]),xt=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(q.Z,{width:"md",name:"showRightIframe",label:(0,V.jsxs)("span",{children:[$.formatMessage({id:"showRightIframe"}),(0,V.jsx)(O.Z,{type:"service",keys:["showRightIframe"],live:te,draft:ne})]}),fieldProps:{onChange:mt,disabled:Re}}),(0,V.jsx)(j.Z,{width:"md",name:"rightIframeUrl",label:(0,V.jsxs)("span",{children:[$.formatMessage({id:"rightIframeUrl"}),(0,V.jsx)(O.Z,{type:"service",keys:["rightIframeUrl"],live:te,draft:ne})]}),placeholder:$.formatMessage({id:"rightIframeUrl.placeholder",defaultMessage:"请输入以 http:// 或 https:// 开头的URL"}),rules:[{type:"url",message:$.formatMessage({id:"rightIframeUrl.invalid",defaultMessage:"请输入有效的URL地址"})},{pattern:/^https?:\/\/[^\s]+$/i,message:$.formatMessage({id:"rightIframeUrl.scheme.required",defaultMessage:"必须以 http:// 或 https:// 开头"})}],fieldProps:{type:"url",inputMode:"url",allowClear:!0,disabled:Re}})]}),St=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(q.Z,{width:"md",name:"showFaqs",label:(0,V.jsxs)("span",{children:[$.formatMessage({id:"faq.show.faqs"}),(0,V.jsx)(O.Z,{type:"service",keys:["showFaqs"],live:te,draft:ne})]}),fieldProps:{onChange:bt,disabled:Re}}),(0,V.jsx)(T.Z,{name:"faqKbUid",width:"md",label:(0,V.jsxs)("span",{children:[$.formatMessage({id:"faq.kbase.select",defaultMessage:"选择侧边栏常见问题知识库"}),(0,V.jsx)(O.Z,{type:"service",keys:["faqKbUid"],live:te,draft:ne})]}),options:null==fe||null===(a=fe.data)||void 0===a||null===(a=a.content)||void 0===a?void 0:a.map((function(e){return{label:ee(e.name),value:e.uid}})),fieldProps:{onChange:function(e){console.log("TabRight selected kbase:",e),me(e),Y.setFieldValue("faqUids",[]),ft(e),null==z||z({faqKbUid:e,faqUids:[]})},allowClear:!0,placeholder:$.formatMessage({id:"choose",defaultMessage:"Choose"}),disabled:Re}}),(0,V.jsx)(T.Z,{name:"faqUids",width:"md",label:(0,V.jsxs)("span",{children:[$.formatMessage({id:"menu.kbase.faq"}),(0,V.jsx)(O.Z,{type:"service",keys:["faqUids"],live:te,draft:ne})]}),options:null==ue||null===(o=ue.data)||void 0===o||null===(o=o.content)||void 0===o?void 0:o.map((function(e){return{label:ee(e.question),value:e.uid}})),fieldProps:{mode:"multiple",allowClear:!0,placeholder:$.formatMessage({id:"choose",defaultMessage:"Choose"}),disabled:Re}})]});return(0,V.jsxs)(U.Z,{children:[(0,V.jsx)(U.Z.Panel,{defaultSize:"30%",min:"20%",max:"50%",children:(0,V.jsx)("div",{style:{padding:"0 16px",height:"100%",overflowY:"auto"},children:(0,V.jsx)(C.A,{form:Y,onFinish:ht,onValuesChange:function(e,t){var n={};Object.prototype.hasOwnProperty.call(e,"rightIframeUrl")&&(n.rightIframeUrl=t.rightIframeUrl),Object.prototype.hasOwnProperty.call(e,"faqUids")&&(n.faqUids=t.faqUids),Object.prototype.hasOwnProperty.call(e,"faqKbUid")&&(n.faqKbUid=t.faqKbUid),Object.keys(n).length>0&&(null==z||z(n))},submitter:!1,children:(0,V.jsx)(F.Z,{activeKey:ye,onChange:xe,items:[{key:"iframe",label:$.formatMessage({id:"showRightIframe",defaultMessage:"右侧iframe"}),children:xt},{key:"faq",label:$.formatMessage({id:"faq.show.faqs",defaultMessage:"常见问题"}),children:St}]})})})}),(0,V.jsx)(U.Z.Panel,{children:(0,V.jsxs)("div",{style:{height:"100%",padding:"16px",background:"#f0f2f5",display:"flex",flexDirection:"column"},children:[(0,V.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8,gap:12},children:[ae===k.Njn&&(0,V.jsx)(Z.Z,{style:{minWidth:220},value:Ve,placeholder:$.formatMessage({id:"preview.select.agent",defaultMessage:"选择预览客服"}),options:((null==et||null===(l=et.data)||void 0===l?void 0:l.content)||[]).map((function(e){return{value:e.uid,label:ee(e.nickname)}})),onChange:function(e){Le(e),Qe(e),vt("switch-agent")},allowClear:!0,disabled:Re}),ae===k._X4&&(0,V.jsx)(Z.Z,{style:{minWidth:220},value:Oe,placeholder:$.formatMessage({id:"preview.select.robot",defaultMessage:"选择预览机器人"}),options:((null==He||null===(L=He.data)||void 0===L?void 0:L.content)||[]).map((function(e){return{value:e.uid,label:ee(e.nickname)}})),onChange:function(e){Ee(e),Qe(e),vt("switch-robot")},allowClear:!0,disabled:Re}),ae===k.aZD&&(0,V.jsx)(Z.Z,{style:{minWidth:220},value:De,placeholder:$.formatMessage({id:"preview.select.workgroup",defaultMessage:"选择预览工作组"}),options:((null==rt||null===(J=rt.data)||void 0===J?void 0:J.content)||[]).map((function(e){return{value:e.uid,label:ee(e.nickname)}})),onChange:function(e){ze(e),Qe(e),vt("switch-workgroup")},allowClear:!0,disabled:Re}),(0,V.jsx)(A.Z,{value:Ae,onChange:function(e){return Ie(e)},options:[{value:"desktop",icon:(0,V.jsx)(I.Z,{})},{value:"mobile",icon:(0,V.jsx)(P.Z,{})}],disabled:Re})]}),(0,V.jsx)("div",{style:{flex:1,minHeight:720,display:"flex",justifyContent:"center"},children:(0,V.jsx)("div",{style:{width:"mobile"===Ae?390:"100%",height:"100%",border:"1px solid #d9d9d9",borderRadius:4,overflow:"hidden",background:"#fff"},children:(0,V.jsx)("iframe",{src:yt,style:{width:"100%",height:"100%",border:"none"},title:"Chat Preview"},Ce)})})]})})]})}},90631:function(e,t,n){var r=n(73193),i=n.n(r),a=n(45332),s=n.n(a),o=n(73614),u=n(99665),l=n(39497),d=n(25784),c=n(60796),f=n(14906),g=n(39487),p=n(32525),v=n(44194),h=n(31549);t.Z=function(e){var t,n=d.A.useForm(),r=s()(n,1)[0],a=(0,f.useIntl)(),m={width:320},b=(0,u.z)((function(e){return{currentRobotSettings:e.currentRobotSettings,currentAgentSettings:e.currentAgentSettings,currentWorkgroupSettings:e.currentWorkgroupSettings,setCurrentRobotSettings:e.setCurrentRobotSettings,setCurrentAgentSettings:e.setCurrentAgentSettings,setCurrentWorkgroupSettings:e.setCurrentWorkgroupSettings}})),w=b.currentRobotSettings,y=b.currentAgentSettings,x=b.currentWorkgroupSettings,S=b.setCurrentRobotSettings,k=b.setCurrentAgentSettings,C=b.setCurrentWorkgroupSettings,q=void 0!==e.variant,j=q?e:null,T=q?j.variant:(t=e.type)===l.Njn?"agent":t===l._X4?"robot":"workgroup",R=(0,v.useMemo)((function(){var e;return q?null!==(e=null==j?void 0:j.serviceSettings)&&void 0!==e?e:{}:"agent"===T?{live:null==y?void 0:y.serviceSettings,draft:null==y?void 0:y.draftServiceSettings}:"robot"===T?{live:null==w?void 0:w.serviceSettings,draft:null==w?void 0:w.draftServiceSettings}:{live:null==x?void 0:x.serviceSettings,draft:null==x?void 0:x.draftServiceSettings}}),[q,j,T,y,w,x]),M=(0,v.useMemo)((function(){return"agent"!==T?null:q?null!==(e=null==j?void 0:j.agentMeta)&&void 0!==e?e:null:{maxThreadCount:null==y?void 0:y.maxThreadCount,timeoutRemindTime:null==y?void 0:y.timeoutRemindTime};var e}),[T,q,j,y]),U=(0,v.useCallback)((function(e){"agent"===T&&y?k(i()(i()({},y),{},{serviceSettings:i()(i()({},y.serviceSettings),e),draftServiceSettings:i()(i()({},y.draftServiceSettings||{}),e)})):"robot"===T&&w?S(i()(i()({},w),{},{serviceSettings:i()(i()({},w.serviceSettings),e),draftServiceSettings:i()(i()({},w.draftServiceSettings||{}),e)})):"workgroup"===T&&x&&C(i()(i()({},x),{},{serviceSettings:i()(i()({},x.serviceSettings),e),draftServiceSettings:i()(i()({},x.draftServiceSettings||{}),e)}))}),[T,y,w,x,k,S,C]),F=(0,v.useCallback)((function(e){"agent"===T&&y&&k(i()(i()({},y),e))}),[T,y,k]),Z=(0,v.useCallback)((function(e){var t;q?null==j||null===(t=j.onServiceSettingsChange)||void 0===t||t.call(j,e):U(e)}),[q,j,U]),A=(0,v.useCallback)((function(e){var t;"agent"===T&&(q?null==j||null===(t=j.onAgentMetaChange)||void 0===t||t.call(j,e):F(e))}),[T,q,j,F]),I=(0,v.useMemo)((function(){var e,t;return null!==(e=null!==(t=null==R?void 0:R.draft)&&void 0!==t?t:null==R?void 0:R.live)&&void 0!==e?e:void 0}),[R]);return(0,v.useEffect)((function(){r.setFieldsValue({autoCloseMin:null==I?void 0:I.autoCloseMin,showLogo:null==I?void 0:I.showLogo})}),[r,I]),(0,v.useEffect)((function(){"agent"===T&&r.setFieldsValue({maxThreadCount:null==M?void 0:M.maxThreadCount,timeoutRemindTime:null==M?void 0:M.timeoutRemindTime})}),[r,T,null==M?void 0:M.maxThreadCount,null==M?void 0:M.timeoutRemindTime]),(0,h.jsxs)(d.A,{form:r,submitter:!1,style:{marginLeft:"20px"},children:["agent"===T&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c.Z,{width:"md",name:"maxThreadCount",label:a.formatMessage({id:"agent.settings.max.thread"}),tooltip:a.formatMessage({id:"agent.settings.max.thread.tooltip",defaultMessage:"超出此设置数量会自动进入排队队列,需要手动接入"}),min:0,formItemProps:{style:m},fieldProps:{style:{width:"100%"},onChange:function(e){"number"==typeof e&&A({maxThreadCount:e})}}}),(0,h.jsx)(d.A.Item,{label:a.formatMessage({id:"agent.settings.timeout.remind",defaultMessage:"超时提醒时间"}),tooltip:a.formatMessage({id:"agent.settings.timeout.remind.tooltip",defaultMessage:"超过设定时间未回复客户将收到提醒"}),style:m,children:(0,h.jsxs)(g.Z.Compact,{block:!0,children:[(0,h.jsx)(c.Z,{formItemProps:{noStyle:!0},width:"md",name:"timeoutRemindTime",min:1,fieldProps:{style:{width:"100%"},onChange:function(e){"number"==typeof e&&A({timeoutRemindTime:e})}}}),(0,h.jsx)(p.Z,{disabled:!0,value:a.formatMessage({id:"time.minute",defaultMessage:"分钟"}),style:{width:72,textAlign:"center"},readOnly:!0,tabIndex:-1})]})})]}),(0,h.jsx)(c.Z,{width:"md",name:"autoCloseMin",label:(0,h.jsxs)("span",{children:[a.formatMessage({id:"agent.settings.auto.close.time"}),(0,h.jsx)(o.Z,{type:"service",keys:["autoCloseMin"],live:null==R?void 0:R.live,draft:null==R?void 0:R.draft})]}),tooltip:a.formatMessage({id:"agent.settings.auto.close.time.tooltip"}),min:1,formItemProps:{style:m},fieldProps:{style:{width:"100%"},onChange:function(e){"number"==typeof e&&Z({autoCloseMin:e})}}})]})}},1460:function(e,t,n){var r=n(45332),i=n.n(r),a=n(73614),s=n(91361),o=n(71256),u=n(25784),l=n(10434),d=n(14906),c=n(44194),f=n(11329),g=n(31549);t.Z=function(e){var t=u.A.useForm(),n=i()(t,1)[0],r=(0,d.useIntl)(),p=(0,s.Z)().translateString,v=e.variant,h=e.serviceSettings,m=e.onServiceSettingsChange,b=(0,c.useState)(!1),w=i()(b,2),y=w[0],x=w[1],S=(0,c.useState)(""),k=i()(S,2),C=k[0],q=k[1],j=(0,c.useState)(""),T=i()(j,2),R=T[0],M=T[1],U=(0,c.useState)(""),F=i()(U,2),Z=F[0],A=F[1],I=(0,c.useRef)({topTip:"",agentCloseTip:"",autoCloseTip:""}),P=(0,c.useMemo)((function(){return null!=h?h:{}}),[h]),K=(0,c.useCallback)((function(e){null==m||m(e)}),[m]),O=(0,c.useMemo)((function(){var e,t;return null!==(e=null!==(t=null==P?void 0:P.draft)&&void 0!==t?t:null==P?void 0:P.live)&&void 0!==e?e:void 0}),[P]);(0,c.useEffect)((function(){var e=!(null==O||!O.showTopTip);y!==e&&(x(e),n.setFieldValue("showTopTip",e));var t=function(e,t){var r=p(t)||"";I.current[e]!==r&&(I.current[e]=r,"topTip"===e?q(r):"agentCloseTip"===e?M(r):"autoCloseTip"===e&&A(r),n.setFieldValue(e,r))};O?(t("topTip",O.topTip),t("agentCloseTip",O.agentCloseTip),t("autoCloseTip",O.autoCloseTip)):(t("topTip",""),t("agentCloseTip",""),t("autoCloseTip",""))}),[O,n,y,p,v]);var E=(0,c.useCallback)((function(e){I.current.topTip=e,q(e),n.setFieldValue("topTip",e),K({topTip:e})}),[n,K]),X=(0,c.useCallback)((function(e){I.current.agentCloseTip=e,M(e),n.setFieldValue("agentCloseTip",e),K({agentCloseTip:e})}),[n,K]),W=(0,c.useCallback)((function(e){I.current.autoCloseTip=e,A(e),n.setFieldValue("autoCloseTip",e),K({autoCloseTip:e})}),[n,K]);return(0,g.jsxs)(u.A,{form:n,submitter:!1,style:{marginLeft:"20px"},children:[(0,g.jsx)(l.Z,{name:"showTopTip",width:"md",label:(0,g.jsxs)("span",{children:[r.formatMessage({id:"agent.settings.show.top.tip"}),(0,g.jsx)(a.Z,{type:"service",keys:["showTopTip"],live:null==P?void 0:P.live,draft:null==P?void 0:P.draft})]}),fieldProps:{onChange:function(e){x(e.target.checked),e.target.checked&&q(p(null==O?void 0:O.topTip)),K({showTopTip:e.target.checked})}}}),y&&(0,g.jsx)(u.A.Item,{name:"topTip",label:(0,g.jsxs)("span",{children:[r.formatMessage({id:"agent.settings.top.tip"}),(0,g.jsx)(a.Z,{type:"service",keys:["topTip"],live:null==P?void 0:P.live,draft:null==P?void 0:P.draft})]}),rules:[{required:!0,message:r.formatMessage({id:"agent.settings.top.tip.required"})}],children:(0,g.jsx)(f.Z,{placeholder:r.formatMessage({id:"agent.settings.top.tip.placeholder"}),value:C,toolbarKeys:(0,o.eD)(),style:{height:"150px",width:"600px"},maxLength:200,onChange:function(e){return E(e)}},"topTipEditor")}),"agent"===v&&(0,g.jsx)(u.A.Item,{name:"agentCloseTip",label:(0,g.jsxs)("span",{children:[r.formatMessage({id:"agent.settings.agent.close.tip"}),(0,g.jsx)(a.Z,{type:"service",keys:["agentCloseTip"],live:null==P?void 0:P.live,draft:null==P?void 0:P.draft})]}),tooltip:r.formatMessage({id:"agent.settings.agent.close.tip.tooltip"}),rules:[{required:!0,message:r.formatMessage({id:"agent.settings.agent.close.tip.required"})}],children:(0,g.jsx)(f.Z,{placeholder:r.formatMessage({id:"agent.settings.agent.close.tip.placeholder"}),value:R,toolbarKeys:(0,o.eD)(),style:{height:"150px",width:"600px"},maxLength:200,onChange:function(e){return X(e)}},"agentCloseTipEditor")}),(0,g.jsx)(u.A.Item,{name:"autoCloseTip",label:(0,g.jsxs)("span",{children:[r.formatMessage({id:"agent.settings.auto.close.tip"}),(0,g.jsx)(a.Z,{type:"service",keys:["autoCloseTip"],live:null==P?void 0:P.live,draft:null==P?void 0:P.draft})]}),tooltip:r.formatMessage({id:"agent.settings.auto.close.tip.tooltip"}),rules:[{required:!0,message:r.formatMessage({id:"agent.settings.auto.close.tip.required"})}],children:(0,g.jsx)(f.Z,{placeholder:r.formatMessage({id:"agent.settings.auto.close.tip.placeholder"}),value:Z,toolbarKeys:(0,o.eD)(),style:{height:"150px",width:"600px"},maxLength:200,onChange:function(e){return W(e)}},"autoCloseTipEditor")})]})}},24479:function(e,t,n){n(76711),n(90819),n(89933),n(73193),n(45332),n(10404),n(8938),n(24388),n(99665),n(98830),n(39497),n(14906),n(44194),n(12864),n(7704),n(91361),n(5932),n(2890),n(88894),n(43167),n(73614),n(33019),n(75580),n(2077),n(31549)},94212:function(e,t,n){n(73193),n(45332),n(89957),n(73614),n(14906),n(44194),n(31549)},73614:function(e,t,n){n.d(t,{Z:function(){return x}});var r=n(73193),i=n.n(r),a=n(44194),s=n(78578),o=n(81739),u=n(86222),l=n.n(u),d=n(89957),c=n.n(d),f=["welcomeFaqUids","faqUids","quickFaqUids","guessFaqUids","hotFaqUids","shortcutFaqUids","proactiveFaqUids"],g=["welcomeFaqs","faqs","quickFaqs","guessFaqs","hotFaqs","shortcutFaqs","proactiveFaqs"];function p(e){return"[object Object]"===Object.prototype.toString.call(e)}function v(e,t){if(!e)return e;if(!t||0===t.length)return e;var n={};return t.forEach((function(t){Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])})),n}function h(e){var t=e&&p(e)?i()({},e):{};return g.forEach((function(e){t[e]&&(t[e.replace(/s$/,"Uids")]=function(e){if(Array.isArray(e))return e.map((function(e){return null==e?void 0:e.uid})).filter(Boolean).map(String)}(t[e]),delete t[e])})),f.forEach((function(e){t[e]&&(t[e]=function(e){if(!Array.isArray(e))return e;var t=e.slice();return t.every((function(e){return["string","number","boolean"].includes(c()(e))}))?t.map((function(e){return"string"==typeof e?e:String(e)})).sort():t}(t[e]))})),t}function m(e){return e&&p(e)?i()({},e):{}}function b(e){var t=new WeakSet;return JSON.stringify(function e(n){if(null===n||"object"!==c()(n))return n;if(!t.has(n)){if(t.add(n),Array.isArray(n))return n.map((function(t){return e(t)}));var r,i=Object.keys(n).sort(),a={},s=l()(i);try{for(s.s();!(r=s.n()).done;){var o=r.value;a[o]=e(n[o])}}catch(e){s.e(e)}finally{s.f()}return a}}(e))}function w(e,t){return b(e)===b(t)}var y=n(31549),x=function(e){var t=e.hasDiff,n=e.type,r=void 0===n?"service":n,u=e.live,l=e.draft,d=e.keys,c=e.text,f=void 0===c?"草稿未发布":c,g=e.style;return(0,a.useMemo)((function(){if("boolean"==typeof t)return t;if(!u&&!l)return!1;switch(r){case"service":return function(e,t,n){return!w(v(h(e),n),v(h(t),n))}(u,l,d);case"messageLeave":return function(e,t,n){return!w(v(m(e),n),v(m(t),n))}(u,l,d);default:return function(e,t,n){return!w(v(e||{},n),v(t||{},n))}(u,l,d)}}),[t,r,u,l,d])?(0,y.jsx)(s.Z,{title:"string"==typeof f?f:"草稿与线上不一致",children:(0,y.jsx)(o.Z,{color:"orange",style:i()({marginLeft:8,height:20,lineHeight:"18px"},g),children:"Draft"})}):null}},99665:function(e,t,n){n.d(t,{z:function(){return o}});var r=n(39497),i=n(58063),a=n(66266),s=n(31403),o=(0,i.Ue)()((0,a.mW)((0,a.tJ)((0,s.n)((function(e){return{currentAgentSettings:null,currentRobotSettings:null,currentWorkgroupSettings:null,setCurrentAgentSettings:function(t){return e({currentAgentSettings:t})},setCurrentRobotSettings:function(t){return e({currentRobotSettings:t})},setCurrentWorkgroupSettings:function(t){return e({currentWorkgroupSettings:t})},clear:function(){return e({currentAgentSettings:null,currentRobotSettings:null,currentWorkgroupSettings:null})}}})),{name:r.rpR})))}}]);