Spaces:
Running
Running
File size: 118,969 Bytes
bda1417 |
1 |
(this.webpackJsonpchatchan=this.webpackJsonpchatchan||[]).push([[0],{1051:function(e,t){},1053:function(e,t){},1063:function(e,t){},1065:function(e,t){},1092:function(e,t){},1093:function(e,t){},1098:function(e,t){},1100:function(e,t){},1107:function(e,t){},1126:function(e,t){},124:function(e,t,a){"use strict";a.d(t,"a",(function(){return T}));var r,n,s=a(11),o=a(12),i=a(15),c=a(16),_=a(0),p=a.n(_),l=a(8),u=a(41),A=a(17),T=(r=Object(l.b)("store"),Object(u.f)(n=r(n=Object(l.c)(n=function(e){Object(i.a)(a,e);var t=Object(c.a)(a);function a(){return Object(s.a)(this,a),t.apply(this,arguments)}return Object(o.a)(a,[{key:"change",value:function(e){this.props.store[this.props.field]=e.target.checked?"yes":"no",this.props.onUpdate&&this.props.onUpdate(this.props.store[this.props.field])}},{key:"render",value:function(){var e=this,t=1,a=Date.now(),r=this.props.field;return p.a.createElement("div",{className:"my-2 "+this.props.className||!1},p.a.createElement(A.d,{key:a+t++,checked:"yes"==this.props.store[r],label:this.props.label,onChange:function(t){return e.change(t)},inline:!0}))}}]),a}(_.Component))||n)||n)||n)},145:function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var r,n,s=a(11),o=a(12),i=a(15),c=a(16),_=a(0),p=a.n(_),l=a(8),u=a(41),A=a(17),T=a(100),h=(r=Object(l.b)("store"),Object(u.f)(n=r(n=Object(l.c)(n=function(e){Object(i.a)(a,e);var t=Object(c.a)(a);function a(){return Object(s.a)(this,a),t.apply(this,arguments)}return Object(o.a)(a,[{key:"render",value:function(){var e=this;return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{className:"std-hr form-div"}),p.a.createElement(A.g,null,p.a.createElement("div",{className:"flex flex-row justify-between"},p.a.createElement("div",{className:"left"},p.a.createElement(A.b,{large:"true",intent:T.a.PRIMARY,onClick:function(){return e.props.onSubmit()}},"提交")),p.a.createElement("div",{className:"right"},this.props.cancel||p.a.createElement(A.b,{large:"true",onClick:function(){return e.props.history.goBack()},className:"right-20"},"取消")))))}}]),a}(_.Component))||n)||n)||n)},1462:function(e,t,a){"use strict";a.r(t);var r,n,s,o,i,c,_,p,l,u,A,T,h,E,P,m,O,d,b,f,C,y,N,v=a(0),I=a.n(v),S=a(38),R=a.n(S),k=(a(605),a(11)),g=a(12),j=a(15),B=a(16),x=a(29),w=a(41),U=a(8),L=Object(U.b)("store")(r=Object(U.c)(r=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){return Object(k.a)(this,a),t.apply(this,arguments)}return Object(g.a)(a,[{key:"render",value:function(){return I.a.createElement("div",{className:"title"},I.a.createElement("h1",null,"Hello,",this.props.store.appname))}}]),a}(v.Component))||r)||r,D=a(17),G=(n=Object(U.b)("store"),Object(w.f)(s=n(s=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){return Object(k.a)(this,a),t.apply(this,arguments)}return Object(g.a)(a,[{key:"render",value:function(){var e=this;return I.a.createElement("div",null,I.a.createElement("h1",null,I.a.createElement(L,null)),I.a.createElement("div",null,I.a.createElement(D.b,{onClick:function(){return e.props.store.appname+="🎈"}},"change")),I.a.createElement("div",null,I.a.createElement("span",{onClick:function(){return e.props.history.push("/login")}},"Login")))}}]),a}(v.Component))||s)||s),q=a(52),K=a(170),W=(o=Object(U.b)("store"),Object(w.f)(i=o(i=Object(U.c)(i=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){return Object(k.a)(this,a),t.apply(this,arguments)}return Object(g.a)(a,[{key:"render",value:function(){var e=I.a.createElement("div",{className:"p-32 "},"FrontPage");return I.a.createElement(q.a,{title:this.props.store.appname,main:e})}}]),a}(v.Component))||i)||i),a(3)),H=a.n(W),F=a(6),V=a(23),X=(c=Object(U.b)("store"),Object(w.f)(_=c(_=Object(U.c)(_=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){return Object(k.a)(this,a),t.apply(this,arguments)}return Object(g.a)(a,[{key:"componentDidMount",value:function(){var e=Object(F.a)(H.a.mark((function e(){var t,a,r,n;return H.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new URLSearchParams(this.props.location.search),a=t.get("code"),r=t.get("session"),e.next=5,this.props.store.get_token_by_code(a,r);case 5:(null===(n=e.sent)||void 0===n?void 0:n.token)&&this.props.store.set_user(n.user),Object(V.a)()?this.props.history.push("/after/login"):this.props.history.push("/home");case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){return I.a.createElement("div",{className:"flex flex-row pt-20 items-center justify-center"},I.a.createElement(D.n,null))}}]),a}(v.Component))||_)||_)||_),z=a(60),M=a(53),Y=a(220),J=(p=Object(U.b)("store"),Object(w.f)(l=p(l=Object(U.c)(l=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){var e;Object(k.a)(this,a);for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return(e=t.call.apply(t,[this].concat(n))).state={qrcode_url:!1},e}return Object(g.a)(a,[{key:"go",value:function(){if(Object(V.a)())this.props.onClick&&this.props.onClick();else{var e=window.location.origin+"/login/auto/"+this.props.store.token+"?redirect="+encodeURIComponent(window.location.pathname+"?amount="+this.props.amount||100);this.setState({qrcode_url:e})}}},{key:"render",value:function(){var e=this,t=this.props,a=(t.staticContext,t.onClick,Object(M.a)(t,["staticContext","onClick"]));return I.a.createElement(I.a.Fragment,null,I.a.createElement(D.b,Object.assign({onClick:function(){return e.go()}},a)),this.state.qrcode_url&&I.a.createElement(D.l,{isOpen:this.state.qrcode_url,onClose:function(){return e.setState({qrcode_url:!1})}},I.a.createElement("div",{className:"center-box bg-white p-10 rounded"},I.a.createElement(Y.a,{value:this.state.qrcode_url}),I.a.createElement("div",{className:"mt-2"},"请用微信扫码支付"))))}}]),a}(v.Component))||l)||l)||l),$=(u=Object(U.b)("store"),Object(w.f)(A=u(A=Object(U.c)(A=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){var e;Object(k.a)(this,a);for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return(e=t.call.apply(t,[this].concat(n))).state={jsinfo:!1},e}return Object(g.a)(a,[{key:"componentDidMount",value:function(){var e=parseInt(new URLSearchParams(this.props.location.search).get("amount"));function t(){}this.props.store.recharge_input_coin||(this.props.store.recharge_input_coin=e),"undefined"==typeof WeixinJSBridge&&(document.addEventListener?document.addEventListener("WeixinJSBridgeReady",t,!1):document.attachEvent&&(document.attachEvent("WeixinJSBridgeReady",t),document.attachEvent("onWeixinJSBridgeReady",t)))}},{key:"launch",value:function(){var e=this;WeixinJSBridge.invoke("getBrandWCPayRequest",{appId:this.state.jsinfo.appId,timeStamp:this.state.jsinfo.timestamp,nonceStr:this.state.jsinfo.nonceStr,package:this.state.jsinfo.package,signType:this.state.jsinfo.signType,paySign:this.state.jsinfo.paySign},(function(t){"get_brand_wcpay_request:ok"==t.err_msg&&(Object(V.b)("支付数据处理中..."),e.props.history.push("/profile"))})),console.log("launch")}},{key:"recharge",value:function(){var e=Object(F.a)(H.a.mark((function e(){var t,a=this;return H.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.props.store.preorder(this.props.store.recharge_input_coin);case 2:(t=e.sent)&&(t.result&&(this.setState({jsinfo:t.result}),window.setTimeout((function(){return a.launch()}),600)),t.error&&Object(V.b)(t.error.err_code_des));case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this,t=I.a.createElement("div",{className:"p-2 recharge-page"},I.a.createElement("div",{className:"price"},(this.props.store.recharge_input_coin/100).toFixed(2)),I.a.createElement(z.a,{field:"recharge_input_coin",type:"number",placeholder:"请输入要购买的"+this.props.store.coin_name+"数量"}),I.a.createElement(J,{amount:this.props.store.recharge_input_coin,large:!0,onClick:function(){return e.recharge()}},"充值"));return I.a.createElement(q.a,{title:this.props.store.appname,main:t})}}]),a}(v.Component))||A)||A)||A),Z=(T=Object(U.b)("store"),Object(w.f)(h=T(h=Object(U.c)(h=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){return Object(k.a)(this,a),t.apply(this,arguments)}return Object(g.a)(a,[{key:"componentDidMount",value:function(){var e=Object(F.a)(H.a.mark((function e(){return H.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.props.store.logout();case 2:this.props.history.replace("/");case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=I.a.createElement("div",{className:"flex flex-row pt-20 items-center justify-center"},I.a.createElement(D.n,null));return I.a.createElement(q.a,{title:this.props.store.appname,main:e})}}]),a}(v.Component))||h)||h)||h),Q=(E=Object(U.b)("store"),Object(w.f)(P=E(P=Object(U.c)(P=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){var e;Object(k.a)(this,a);for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return(e=t.call.apply(t,[this].concat(n))).state={user:!1},e}return Object(g.a)(a,[{key:"componentDidMount",value:function(){var e=Object(F.a)(H.a.mark((function e(){var t;return H.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.props.store.get_user_profile();case 2:(t=e.sent)&&t.user&&(this.setState({user:t.user}),this.props.store.set_user(t.user));case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this.state.user;if(!e)return null;var t=I.a.createElement("div",{className:"p-2 flex flex-col profile-page"},I.a.createElement("div",{className:"profile"},I.a.createElement("div",{className:"avatar"},I.a.createElement("img",{src:e.avatar_url,alt:""}),I.a.createElement("div",{className:"explain"},e.name))),I.a.createElement("div",{className:"detail"},I.a.createElement("div",{className:"row"},I.a.createElement("div",{className:"left"},"Level"),I.a.createElement("div",{className:"right"},e.level)),I.a.createElement("div",{className:"row"},I.a.createElement("div",{className:"left"},"Coin"),I.a.createElement("div",{className:"right"},e.coin))));return I.a.createElement(q.a,{title:this.props.store.appname,main:t})}}]),a}(v.Component))||P)||P)||P),ee=(m=Object(U.b)("store"),Object(w.f)(O=m(O=Object(U.c)(O=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){return Object(k.a)(this,a),t.apply(this,arguments)}return Object(g.a)(a,[{key:"componentDidMount",value:function(){document.querySelector("#wechat-login-btn").click()}},{key:"render",value:function(){var e=I.a.createElement("div",{className:"flex flex-row pt-12 items-center justify-center"},I.a.createElement(K.a,{large:!0}));return I.a.createElement(q.a,{title:this.props.store.appname,main:e})}}]),a}(v.Component))||O)||O)||O),te=(d=Object(U.b)("store"),Object(w.f)(b=d(b=Object(U.c)(b=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){return Object(k.a)(this,a),t.apply(this,arguments)}return Object(g.a)(a,[{key:"render",value:function(){var e=I.a.createElement("div",{className:"py-5 px-5 md:px-0 text-xl"},"登入成功,请回到电脑点击按钮继续。或者点击右上角菜单进行操作。");return I.a.createElement(q.a,{title:this.props.store.appname,main:e})}}]),a}(v.Component))||b)||b)||b),ae=(f=Object(U.b)("store"),Object(w.f)(C=f(C=Object(U.c)(C=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){return Object(k.a)(this,a),t.apply(this,arguments)}return Object(g.a)(a,[{key:"componentDidMount",value:function(){var e=Object(F.a)(H.a.mark((function e(){var t,a,r,n;return H.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.props.match.params.token,e.next=3,this.props.store.check_user_info(t);case 3:a=e.sent,console.log(a),a&&a.user&&(this.props.store.set_user(a.user),r=new URLSearchParams(this.props.location.search),(n=r.get("redirect"))||(n="/recharge"),this.props.history.push(n));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=I.a.createElement("div",{className:"py-5 px-5 md:px-0"},I.a.createElement("div",{className:"p-5 flex justify-center"},I.a.createElement(D.n,null)));return I.a.createElement(q.a,{title:this.props.store.appname,main:e})}}]),a}(v.Component))||C)||C)||C),re=a(304),ne=a(482),se=a(145),oe=(y=Object(U.b)("store"),Object(w.f)(N=y(N=Object(U.c)(N=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){return Object(k.a)(this,a),t.apply(this,arguments)}return Object(g.a)(a,[{key:"submit",value:function(){var e=Object(F.a)(H.a.mark((function e(){var t,a,r,n,s,o;return H.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.props.store._donate_keys.trim().split("\n"),a=[],Object(V.b)("正在验证KEY,请稍候"),r=Object(ne.a)(t),e.prev=4,r.s();case 6:if((n=r.n()).done){e.next=14;break}return s=n.value,e.next=10,this.props.store.api.rawPost("".concat(this.props.store.local_apibase,"/chat/verify"),{key:s});case 10:(o=e.sent)&&"done"==o.message&&a.push(s);case 12:e.next=6;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(4),r.e(e.t0);case 19:return e.prev=19,r.f(),e.finish(19);case 22:if(!(a.length<1)){e.next=27;break}return Object(V.b)("没有是有效的KEY"),e.abrupt("return");case 27:Object(V.b)("".concat(a.length,"个KEY通过校验,正在提交数据"));case 28:case"end":return e.stop()}}),e,this,[[4,16,19,22]])})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this,t=I.a.createElement("div",{className:"p-12"},I.a.createElement("div",{className:"text-center text-2xl"},"赞助OpenAI KEY"),I.a.createElement(z.a,{type:"textarea",fill:!0,label:"OpenAI KEY",field:"_donate_keys",placeholder:"一行一个Key,形如 sk... "}),I.a.createElement(z.a,{label:"文字广告文案",field:"_donate_title",placeholder:"30字符内,会人工审核,违反内地法律法规和不真实内容将不会通过"}),I.a.createElement(z.a,{label:"文字广告链接",field:"_donate_link",placeholder:"https://... 可填入个人网站、网店、博客之类"}),I.a.createElement(se.a,{label:"提交",onSubmit:function(){return e.submit()}}),I.a.createElement("div",{className:"text-lg mt-8"},"效果预览"),I.a.createElement("div",{className:"preview border rounded p-5 mt-5"},I.a.createElement("div",{className:"line-1"},"您使用的 Key 由 ",I.a.createElement("span",{className:"text-blue-500"},this.props.store.user.name)," 友情提供"),I.a.createElement("div",{className:"line-2 mt-3 flex flex-row item-center"},I.a.createElement("span",{className:"text-white bg-gray-300 rounded px-1 mr-2"},"广告"),I.a.createElement("a",{href:this.props.store._donate_link||"https://stack.ftqq.com/subscribe",target:"_blank"},this.props.store._donate_title||"方糖超级会员\xb7助力从螺丝钉到一人企业"))));return I.a.createElement(q.a,{title:this.props.store.appname,main:t})}}]),a}(v.Component))||N)||N)||N),ie=a(483),ce=function(e){Object(j.a)(a,e);var t=Object(B.a)(a);function a(){return Object(k.a)(this,a),t.apply(this,arguments)}return Object(g.a)(a,[{key:"render",value:function(){return I.a.createElement(x.a,null,I.a.createElement(w.c,null,I.a.createElement(w.a,{path:"/donate",component:oe}),I.a.createElement(w.a,{path:"/chat",component:re.a}),I.a.createElement(w.a,{path:"/login/auto/:token",component:ae}),I.a.createElement(w.a,{path:"/after/login",component:te}),I.a.createElement(w.a,{path:"/profile",component:Q}),I.a.createElement(w.a,{path:"/recharge",component:$}),I.a.createElement(w.a,{path:"/logout",component:Z}),I.a.createElement(w.a,{path:"/logback",component:X}),I.a.createElement(w.a,{path:"/login",component:ee}),I.a.createElement(w.a,{path:"/index",component:G}),I.a.createElement(w.a,{path:"/share/:info",component:ie.a}),I.a.createElement(w.a,{path:"/",component:re.a})))}}]),a}(v.Component);Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));var _e=a(232);console.log("Welcome to ".concat(_e.a.appname)),console.log=function(){},R.a.render(I.a.createElement(U.a,{store:_e.a},I.a.createElement(ce,null)),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()}))},170:function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var r,n,s=a(53),o=a(3),i=a.n(o),c=a(6),_=a(11),p=a(12),l=a(15),u=a(16),A=a(0),T=a.n(A),h=a(8),E=a(41),P=a(17),m=a(23),O=a(220),d=a(468),b=a.n(d),f=(r=Object(h.b)("store"),Object(E.f)(n=r(n=Object(h.c)(n=function(e){Object(l.a)(a,e);var t=Object(u.a)(a);function a(){var e;Object(_.a)(this,a);for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return(e=t.call.apply(t,[this].concat(n))).state={qrcode_url:!1},e}return Object(p.a)(a,[{key:"go",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.props.store.session=b()({length:32}),e.next=3,this.props.store.get_wechat_login_url();case 3:(t=e.sent)&&t.url&&(Object(m.a)()?window.location=t.url:(this.setState({qrcode_url:t.url}),console.log(t.url)));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"check",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t,a;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.props.store.session,e.next=3,this.props.store.check_user_info(t);case 3:(a=e.sent)&&a.code>0?Object(m.b)("请扫码后再点击此按钮"):a&&a.user&&(this.props.store.set_user(a.user),this.setState({qrcode_url:!1}),Object(m.a)()?this.props.history.push("/after/login"):this.props.history.push("/home"));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this,t=this.props,a=(t.staticContext,t.onClick,Object(s.a)(t,["staticContext","onClick"]));return T.a.createElement(T.a.Fragment,null,T.a.createElement(P.b,Object.assign({id:"wechat-login-btn",text:"微信登入",onClick:function(){return e.go()}},a)),this.state.qrcode_url&&T.a.createElement(P.l,{isOpen:this.state.qrcode_url,canOutsideClickClose:!1,onClose:function(){return e.setState({qrcode_url:!1})}},T.a.createElement("div",{className:"center-box bg-white p-10 rounded"},T.a.createElement(O.a,{value:this.state.qrcode_url}),T.a.createElement("div",{className:"mt-2"},T.a.createElement(P.b,{large:!0,onClick:function(){return e.check()}},"微信扫码后点此继续")))))}}]),a}(A.Component))||n)||n)||n)},220:function(e,t,a){"use strict";a.d(t,"a",(function(){return T}));var r,n=a(14),s=a(11),o=a(12),i=a(15),c=a(16),_=a(0),p=a.n(_),l=a(41),u=a(467),A=a.n(u),T=Object(l.f)(r=function(e){Object(i.a)(a,e);var t=Object(c.a)(a);function a(){var e;Object(s.a)(this,a);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(e=t.call.apply(t,[this].concat(n))).state={value:e.props.value,img_url:""},e}return Object(o.a)(a,[{key:"componentDidMount",value:function(){var e=this;this.ck=setInterval((function(){return e.check()}),500)}},{key:"componentWillUnmount",value:function(){this.ck&&clearInterval(this.ck)}},{key:"check",value:function(){var e=document.getElementById("theqr__inbox");e&&(this.setState({img_url:e.toDataURL("image/png")}),clearInterval(this.ck))}},{key:"render",value:function(){return p.a.createElement("div",{className:this.props.className},this.state.img_url.length>0?p.a.createElement("img",{style:{maxWidth:200},src:this.state.img_url}):p.a.createElement(A.a,Object(n.a)({size:200,value:this.state.value,includeMargin:!0,id:"theqr__inbox"},"includeMargin",!0)))}}]),a}(_.Component))||r},23:function(e,t,a){"use strict";a(232);var r=a(17),n=a(54),s=r.r.create({className:"lm-toaster",position:n.a.TOP});a(652),a(653);function o(){return"micromessenger"==navigator.userAgent.toLowerCase().match(/MicroMessenger/i)}function i(e){s.show({message:e})}a.d(t,"a",(function(){return o})),a.d(t,"b",(function(){return i}))},232:function(e,t,a){"use strict";var r,n,s,o,i,c,_,p,l,u,A,T,h,E,P,m,O,d,b,f,C,y,N,v,I,S,R,k,g,j,B,x,w,U,L,D,G,q,K,W,H=a(3),F=a.n(H),V=a(6),X=a(31),z=a(11),M=a(12),Y=a(30),J=(a(634),a(10)),$=a(23),Z=a(234),Q=a.n(Z),ee=function(){function e(t){Object(z.a)(this,e),this.store=t}return Object(M.a)(e,[{key:"get",value:function(){var e=Object(V.a)(F.a.mark((function e(t){var a,r,n=arguments;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=n.length>1&&void 0!==n[1]?n[1]:null,r=null==a?this.store.apibase+t:this.store.apibase+t+ds+new URLSearchParams(a).toString(),e.abrupt("return",this.rawGet(r));case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"rawGet",value:function(){var e=Object(V.a)(F.a.mark((function e(t){return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=this,e.next=3,Q.a.get(t);case 3:return e.t1=e.sent,e.abrupt("return",e.t0.return_data.call(e.t0,e.t1));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"post",value:function(){var e=Object(V.a)(F.a.mark((function e(t){var a,r,n,s,o=arguments;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.length>1&&void 0!==o[1]?o[1]:null,r=!(o.length>2&&void 0!==o[2])||o[2],n=!(o.length>3&&void 0!==o[3])||o[3],s=this.store.apibase+t,e.abrupt("return",this.rawPost(s,a,r,n));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"rawPost",value:function(){var e=Object(V.a)(F.a.mark((function e(t){var a,r,n,s,o=arguments;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.length>1&&void 0!==o[1]?o[1]:null,r=!(o.length>2&&void 0!==o[2])||o[2],n=!(o.length>3&&void 0!==o[3])||o[3],e.prev=3,s=new URLSearchParams,a&&Object.keys(a).forEach((function(e){return s.append(e,a[e])})),r&&this.store.token&&s.append("token",this.store.token),e.t0=this,e.next=10,Q.a.post(t,s);case 10:return e.t1=e.sent,e.t2=n,e.abrupt("return",e.t0.return_data.call(e.t0,e.t1,e.t2));case 15:return e.prev=15,e.t3=e.catch(3),console.log(e.t3),e.abrupt("return",!1);case 19:case"end":return e.stop()}}),e,this,[[3,15]])})));return function(t){return e.apply(this,arguments)}}()},{key:"upload",value:function(){var e=Object(V.a)(F.a.mark((function e(t){var a,r,n,s,o=arguments;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.length>1&&void 0!==o[1]?o[1]:null,r=!(o.length>2&&void 0!==o[2])||o[2],n=!(o.length>3&&void 0!==o[3])||o[3],s=new FormData,a&&Object.keys(a).forEach((function(e){return s.append(e,a[e])})),r&&this.store.token&&s.append("token",this.store.token),e.t0=this,e.next=9,Q.a.post(this.store.apibase+t,s);case 9:return e.t1=e.sent,e.t2=n,e.next=13,e.t0.return_data.call(e.t0,e.t1,e.t2);case 13:return e.abrupt("return",e.sent);case 14:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"return_data",value:function(){var e=Object(V.a)(F.a.mark((function e(t){var a=arguments;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a.length>1&&void 0!==a[1])||a[1],200!=parseInt(t.status)){e.next=8;break}if(!t.data){e.next=5;break}return 80403==t.data.code&&(Object($.b)("请登入后继续"),window.location="/login"),e.abrupt("return",t.data);case 5:return e.abrupt("return",!1);case 8:console.log(t);case 9:return e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}]),e}(),te=(r=function(){function e(){Object(z.a)(this,e),Object(X.a)(this,"appname",n,this),Object(X.a)(this,"apibase",s,this),Object(X.a)(this,"local_apibase",o,this),Object(X.a)(this,"session",i,this),Object(X.a)(this,"token",c,this),Object(X.a)(this,"user",_,this),Object(X.a)(this,"api_endpoints",p,this),this.version=Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_VERSION||"1.0.21",this.endpoint_count=0,this.ftopenapp_id="26",this.to_save_vars=["user","token","_chat_saved_list","_chat_model","_chat_key","_chat_api_url","_chat_avatar_url","_chat_max_tokens","_chat_temperature","_chat_timeout","_chat_char_opacity","_chat_system_prompt","_chat_user_prompt","_chat_last","_chat_history_count","_chat_auto_save","_chat_summarize_content","_chat_auto_audio","_chat_bg_url","_chat_pin_window","_preset_saved_list","_chat_stream","_chat_change_model"],Object(X.a)(this,"menu",l,this),Object(X.a)(this,"coin_name",u,this),Object(X.a)(this,"recharge_input_coin",A,this),Object(X.a)(this,"_donate_keys",T,this),Object(X.a)(this,"_donate_title",h,this),Object(X.a)(this,"_donate_link",E,this),Object(X.a)(this,"_chat_model",P,this),Object(X.a)(this,"_chat_saved_list",m,this),Object(X.a)(this,"_preset_saved_list",O,this),Object(X.a)(this,"_chat_key",d,this),Object(X.a)(this,"_chat_api_url",b,this),Object(X.a)(this,"_chat_avatar_url",f,this),Object(X.a)(this,"_chat_bg_url",C,this),Object(X.a)(this,"_chat_max_tokens",y,this),Object(X.a)(this,"_chat_temperature",N,this),Object(X.a)(this,"_chat_timeout",v,this),Object(X.a)(this,"_chat_system_prompt",I,this),Object(X.a)(this,"_chat_user_prompt",S,this),Object(X.a)(this,"_chat_char_opacity",R,this),Object(X.a)(this,"_chat_history_count",k,this),Object(X.a)(this,"_chat_last",g,this),Object(X.a)(this,"_chat_auto_save",j,this),Object(X.a)(this,"_chat_summarize_content",B,this),Object(X.a)(this,"_chat_auto_audio",x,this),Object(X.a)(this,"_chat_pin_window",w,this),Object(X.a)(this,"_preset_system_prompt",U,this),Object(X.a)(this,"_preset_user_prompt",L,this),Object(X.a)(this,"_preset_prompt_title",D,this),Object(X.a)(this,"_preset_prompt_id",G,this),Object(X.a)(this,"_chat_moderation_on",q,this),Object(X.a)(this,"_chat_stream",K,this),Object(X.a)(this,"_chat_change_model",W,this),this.api=new ee(this),this.load_vars(),this.load_api_endpoints()}return Object(M.a)(e,[{key:"load_api_endpoints",value:function(){var e=Object(V.a)(F.a.mark((function e(){var t,a;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch("https://domain.api2d.org/");case 3:return t=e.sent,e.next=6,t.json();case 6:(a=e.sent)&&a.length>0&&(this.api_endpoints=a),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),console.log(e.t0);case 13:case"end":return e.stop()}}),e,this,[[0,10]])})));return function(){return e.apply(this,arguments)}}()},{key:"load_default",value:function(){var e=Object(V.a)(F.a.mark((function e(){var t,a;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch("default.json");case 3:return t=e.sent,e.next=6,t.json();case 6:(a=e.sent).app_name&&(this.appname=a.app_name),a.api_key&&(this._chat_key=a.api_key),a.api_url&&(this._chat_api_url=a.api_url),a.chat_model&&(this._chat_model=a.chat_model),a.chat_max_tokens&&(this._chat_max_tokens=a.chat_max_tokens),a.chat_temperature&&(this._chat_temperature=a.chat_temperature),a.chat_timeout&&(this._chat_timeout=a.chat_timeout),a.chat_system_prompt&&(this._chat_system_prompt=a.chat_system_prompt),a.chat_user_prompt&&(this._chat_user_prompt=a.chat_user_prompt),a.chat_character_url&&(this._chat_avatar_url=a.chat_character_url),a.chat_character_opacity&&(this._chat_opacity=a.chat_character_opacity),a.chat_moderation&&(this._chat_moderation_on="on"==a.chat_moderation),e.next=23;break;case 21:e.prev=21,e.t0=e.catch(0);case 23:case"end":return e.stop()}}),e,this,[[0,21]])})));return function(){return e.apply(this,arguments)}}()},{key:"load_vars",value:function(){var e=Object(V.a)(F.a.mark((function e(){var t=this;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.load_default();case 2:this.to_save_vars.forEach((function(e){var a=window.localStorage.getItem("FT_CHATCHAN_VAR_"+e);a&&(t[e]=JSON.parse(a))}));case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"save_vars",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,a=null===t?this.to_save_vars:[t];a.forEach((function(t){window.localStorage.setItem("FT_CHATCHAN_VAR_"+t,JSON.stringify(e[t]))}))}},{key:"get_wechat_login_url",value:function(){var e=Object(V.a)(F.a.mark((function e(){var t,a,r,n=arguments;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:this.ftopenapp_id,a=n.length>1&&void 0!==n[1]?n[1]:this.session,e.next=4,this.api.get("global/user/get_wx_sns_login_url?id="+t+"&session="+a);case 4:return r=e.sent,e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"get_token_by_code",value:function(){var e=Object(V.a)(F.a.mark((function e(t){var a,r,n=arguments;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=n.length>1&&void 0!==n[1]?n[1]:"",e.next=3,this.api.post("global/user/get_token_by_wx_code",{code:t,session:a});case 3:return r=e.sent,e.abrupt("return",r);case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"preorder",value:function(){var e=Object(V.a)(F.a.mark((function e(t){var a;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.api.post("global/pay/order",{amount_cent:t});case 2:return a=e.sent,e.abrupt("return",a);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"logout",value:function(){this.user=null,this.token=null,window.localStorage.clear()}},{key:"set_user",value:function(e){this.user=e,this.token=e.session_id,this.save_vars()}},{key:"check_user_info",value:function(){var e=Object(V.a)(F.a.mark((function e(){var t,a,r,n=arguments;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t=n.length>0&&void 0!==n[0]?n[0]:null)){e.next=8;break}return e.next=4,this.api.post("global/user/get_user_session",{token:t},!1);case 4:return a=e.sent,e.abrupt("return",a);case 8:return e.next=10,this.api.post("global/user/get_user_session");case 10:return r=e.sent,e.abrupt("return",r);case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"get_user_profile",value:function(){var e=Object(V.a)(F.a.mark((function e(){var t;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.api.post("global/user/profile");case 2:return t=e.sent,e.abrupt("return",t);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()}]),e}(),n=Object(Y.a)(r.prototype,"appname",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_NAME||"BioinfoArk纯净版"}}),s=Object(Y.a)(r.prototype,"apibase",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"https://oa.ai01.org/"}}),o=Object(Y.a)(r.prototype,"local_apibase",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),i=Object(Y.a)(r.prototype,"session",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),c=Object(Y.a)(r.prototype,"token",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),_=Object(Y.a)(r.prototype,"user",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),p=Object(Y.a)(r.prototype,"api_endpoints",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),l=Object(Y.a)(r.prototype,"menu",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[{id:8001,text:"首页",link:"/home",member_only:!1}]}}),Object(Y.a)(r.prototype,"logout",[J.f],Object.getOwnPropertyDescriptor(r.prototype,"logout"),r.prototype),Object(Y.a)(r.prototype,"set_user",[J.f],Object.getOwnPropertyDescriptor(r.prototype,"set_user"),r.prototype),u=Object(Y.a)(r.prototype,"coin_name",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"金币"}}),A=Object(Y.a)(r.prototype,"recharge_input_coin",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),T=Object(Y.a)(r.prototype,"_donate_keys",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),h=Object(Y.a)(r.prototype,"_donate_title",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),E=Object(Y.a)(r.prototype,"_donate_link",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),P=Object(Y.a)(r.prototype,"_chat_model",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"gpt-3.5-turbo"}}),m=Object(Y.a)(r.prototype,"_chat_saved_list",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),O=Object(Y.a)(r.prototype,"_preset_saved_list",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),d=Object(Y.a)(r.prototype,"_chat_key",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_KEY_DEFAULT_VALUE||""}}),b=Object(Y.a)(r.prototype,"_chat_api_url",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_API_URL||"https://api.openai.com"}}),f=Object(Y.a)(r.prototype,"_chat_avatar_url",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),C=Object(Y.a)(r.prototype,"_chat_bg_url",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),y=Object(Y.a)(r.prototype,"_chat_max_tokens",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1e3}}),N=Object(Y.a)(r.prototype,"_chat_temperature",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.1}}),v=Object(Y.a)(r.prototype,"_chat_timeout",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 60}}),I=Object(Y.a)(r.prototype,"_chat_system_prompt",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),S=Object(Y.a)(r.prototype,"_chat_user_prompt",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),R=Object(Y.a)(r.prototype,"_chat_char_opacity",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 80}}),k=Object(Y.a)(r.prototype,"_chat_history_count",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 6}}),g=Object(Y.a)(r.prototype,"_chat_last",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),j=Object(Y.a)(r.prototype,"_chat_auto_save",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"yes"}}),B=Object(Y.a)(r.prototype,"_chat_summarize_content",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"yes"}}),x=Object(Y.a)(r.prototype,"_chat_auto_audio",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"no"}}),w=Object(Y.a)(r.prototype,"_chat_pin_window",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"no"}}),U=Object(Y.a)(r.prototype,"_preset_system_prompt",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),L=Object(Y.a)(r.prototype,"_preset_user_prompt",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),D=Object(Y.a)(r.prototype,"_preset_prompt_title",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),G=Object(Y.a)(r.prototype,"_preset_prompt_id",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),q=Object(Y.a)(r.prototype,"_chat_moderation_on",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),K=Object(Y.a)(r.prototype,"_chat_stream",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"yes"}}),W=Object(Y.a)(r.prototype,"_chat_change_model",[J.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"yes"}}),r);t.a=new te},304:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return B}));var r,n,s=a(14),o=a(3),i=a.n(o),c=a(6),_=a(11),p=a(12),l=a(15),u=a(16),A=a(0),T=a.n(A),h=a(8),E=a(41),P=a(52),m=a(17),O=a(23),d=(a(1143),a(488)),b=a(471),f=a(60),C=a(145),y=a(305),N=a(480),v=a(124),I=a(174),S=a(481),R=a.n(S),k=a(235),g=a(485),j=a(224),B=(r=Object(h.b)("store"),Object(E.f)(n=r(n=Object(h.c)(n=function(t){Object(l.a)(n,t);var r=Object(u.a)(n);function n(e){var t;return Object(_.a)(this,n),(t=r.call(this,e)).handleFile=function(e){var a=e.target.files[0];if("application/json"===a.type){var r=new FileReader;r.onload=function(e){var a=JSON.parse(e.target.result);if(a&&a.chat_list){for(var r=t.props.store._chat_saved_list,n=a.chat_list,s=[],o=0;o<n.length;o++){for(var i=!1,c=0;c<r.length;c++)if(r[c].id==n[o].id){i=!0;break}i||s.push(n[o])}t.props.store._chat_saved_list=r.concat(s),t.props.store.save_vars("_chat_saved_list")}if(a&&a.preset_list){for(var _=t.props.store._preset_saved_list,p=a.preset_list,l=[],u=0;u<p.length;u++){for(var A=!1,T=0;T<_.length;T++)if(_[T].id==p[u].id){A=!0;break}A||l.push(p[u])}t.props.store._preset_saved_list=_.concat(l),t.props.store.save_vars("_preset_saved_list")}},r.readAsText(a)}else alert("Please select a JSON file")},t.inputRef=T.a.createRef(),t.state={actions:{},list:[],text:"",last:!1,loading:!1,typing:"",force_cn:!1,connect:!1,show_tips:!1,in:!1,saved_list:{},settings_open:!1,avatar_open:!1,show_undo:!1,point:"-",show_extend_settings:!1,snap:!1,tab_selected:"history",prompt_box:!1},t}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this;this.init(),this.audio_to_play=[],window.location.hostname.match(/ftqq.com$/)&&this.setState({in:!0}),document.addEventListener("keydown",(function(t){var a;13===t.keyCode&&(t.metaKey||t.ctrlKey)&&e.send(null===(a=e.state.text)||void 0===a?void 0:a.trim())})),document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight,window.setTimeout((function(){var t;(e.props.store._chat_key&&e.props.store._chat_key.length>10&&e.refresh_point(),e.state.list.length<1&&e.props.store._chat_last&&e.props.store._chat_last.length>0&&e.setState({list:e.props.store._chat_last}),"yes"==e.props.store._chat_pin_window)&&(window&&window.electronAPI&&(null===(t=window.electronAPI)||void 0===t?void 0:t.pinWindow)&&(window.electronAPI.pinWindow(!0),console.log("set window float")));e.check_bottom_effect()}),1e3),document.addEventListener("visibilitychange",(function(e){e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault()}))}},{key:"init",value:function(){var e=Object(c.a)(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,a.e(3).then(a.bind(null,1466));case 3:this.tiktoken=e.sent,e.next=10;break;case 6:e.prev=6,e.t0=e.catch(0),console.log("wasm载入错误",e.t0),Object(O.b)("wasm载入失败,进入兼容模式,如遇400错误,请清理对话记录");case 10:case"end":return e.stop()}}),e,this,[[0,6]])})));return function(){return e.apply(this,arguments)}}()},{key:"onChange",value:function(e,t){this.setState(Object(s.a)({},t,e.target.value))}},{key:"save_key",value:function(){var e=Object(c.a)(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.props.store._chat_key.length<10)){e.next=3;break}return Object(O.b)("请输入正确的BioinfoArk Key"),e.abrupt("return",!1);case 3:this.props.store.save_vars(),this.api2d_instance=null,Object(O.b)("保存成功");case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"clean_conversation",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t,a=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!(a.length>0&&void 0!==a[0])||a[0],"yes"!=this.props.store._chat_auto_save||!t){e.next=4;break}return e.next=4,this.save_conversation();case 4:this.old_list=this.state.list.slice(),this.setState({last:!1,list:[],loading:!1,show_undo:!0}),this.props.store._chat_last=[],this.props.store.save_vars("_chat_last"),Object(O.b)("对话已清除,可点恢复按钮撤销"),console.log("this.props.store._chat_change_model",this.props.store._chat_change_model,"this.props.store._chat_model",this.props.store._chat_model),"gpt-3.5-turbo-16k"===this.props.store._chat_model&&"yes"===this.props.store._chat_change_model&&(this.props.store._chat_model="gpt-3.5-turbo");case 11:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"undo_conversation",value:function(){var e=Object(c.a)(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.old_list&&(this.setState({last:!1,list:this.old_list,loading:!1,show_undo:!1}),window.setTimeout((function(){document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight}),300));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"remove_list",value:function(){var e=Object(c.a)(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.props.store._chat_saved_list=this.props.store._chat_saved_list.filter((function(e){return e.id!=t})),this.props.store.save_vars(),this.check_bottom_effect();case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"rename_conversation",value:function(){var e=Object(c.a)(i.a.mark((function e(t,a){var r,n,s,o;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.getApiInstance(),e.prev=1,a=a.replace(/@[\s\S]*?\s/g,"").replace(/#[\s\S]*?\s/g,"").substring(0,800),e.next=5,r.completion({messages:[{role:"system",content:"你是一个经验丰富的记录员,擅长从对话中提取关键信息,并为对话命名。"},{role:"user",content:"请为以下对话命名,优先使用中文,直接返回名称,长度尽量在30个字以内。对话内容:"+a+"\n对话命名:"}],temperature:0,max_tokens:50,model:"gpt-3.5-turbo",stream:!1});case 5:n=e.sent,console.log(n),n&&n.choices&&n.choices.length>0&&((o=null===(s=n.choices[0].message)||void 0===s?void 0:s.content).length>30&&(o=o.substring(0,30)),this.props.store._chat_saved_list=this.props.store._chat_saved_list.map((function(e){return e.id==t&&(e.name=o),e})),this.props.store.save_vars("_chat_saved_list")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(1),console.log(e.t0);case 13:case"end":return e.stop()}}),e,this,[[1,10]])})));return function(t,a){return e.apply(this,arguments)}}()},{key:"save_conversation",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t,a,r;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.state.list.length<1)){e.next=2;break}return e.abrupt("return",!1);case 2:t=this.state.list[0].text.substring(0,10)+"-"+(new Date).getTime(),a=(new Date).getTime(),console.log("conversation_id",a),r=this.state.list.map((function(e){return e.text})).join("\n"),this.props.store._chat_saved_list.length>100&&this.props.store._chat_saved_list.shift(),this.props.store._chat_saved_list.push({name:t,list:this.state.list,id:a}),this.props.store.save_vars(),Object(O.b)("对话已保存,可在「对话记录」中查看"),this.check_bottom_effect(),"yes"==this.props.store._chat_summarize_content&&this.rename_conversation(a,r.substring(0,800));case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getApiInstance",value:function(){return this.api2d_instance||(this.api2d_instance=new d.a(this.props.store._chat_key,this.props.store._chat_api_url)),this.api2d_instance}},{key:"regen_conversation",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t,a,r,n,s,o,c,_,p,l,u,A,T,h,E,P,m,d,b=this;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.setState({list:this.state.list.slice(0,-1)}),t=[],a=0,r=this.state.list.length-2;case 4:if(!(r>=0)){e.next=12;break}if(t.unshift(this.state.list[r]),!(++a>=this.props.store._chat_history_count)){e.next=9;break}return e.abrupt("break",12);case 9:r--,e.next=4;break;case 12:console.log("new_list",JSON.stringify(t)),n=[],s=0,o=0;case 16:if(!(o<t.length)){e.next=27;break}if(!(s+t[o].text.length>this.props.store._chat_max_tokens)){e.next=19;break}return e.abrupt("break",27);case 19:"me"==(c=t[o].role)&&(c="user"),"robot"==c&&(c="assistant"),_={role:c,content:t[o].text},n.push(_);case 24:o++,e.next=16;break;case 27:return console.log("history",JSON.stringify(n)),e.prev=28,u=this.getApiInstance(),e.next=32,u.completion({messages:n,temperature:null!==(p=parseFloat(this.props.store._chat_temperature))&&void 0!==p?p:0,max_tokens:null!==(l=parseInt(this.props.store._chat_max_tokens))&&void 0!==l?l:1e3,model:this.props.store._chat_model||"gpt-3.5-turbo",stream:"yes"==this.props.store._chat_stream,moderation:this.props.store._chat_key.startsWith("fk")&&this.props.store._chat_moderation,moderation_stop:!0,noCache:this.props.store._chat_key.startsWith("fk"),onMessage:function(e){console.log("onMessage",e),b.setState({typing:e}),document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight},onEnd:function(e){b.setState({typing:""}),document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight}});case 32:A=e.sent,console.log("ret",A),A&&(this.setState({list:this.state.list.concat({text:"yes"==this.props.store._chat_stream?A.trim():null===(T=A.choices[0])||void 0===T||null===(h=T.message)||void 0===h?void 0:h.content.trim(),role:"robot"}),text:"",loading:!1}),this.props.store._chat_last=this.state.list,this.props.store.save_vars("_chat_last")),e.next=59;break;case 37:e.prev=37,e.t0=e.catch(28),P=e.t0.message,m=null===(E=P.match(/\[(\d+)\]/))||void 0===E?void 0:E[1],d=Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_KEY_NAME||"KEY",e.t1=m,e.next="400"===e.t1?45:"401"===e.t1?47:"402"===e.t1?49:"403"===e.t1?51:"408"===e.t1?53:"429"===e.t1?55:57;break;case 45:return P="请求参数错误,历史记录可能过长,请清理后再试",e.abrupt("break",57);case 47:return P="".concat(d,"错误或者账户状态错误,请检查:").concat(d,"是否正确、").concat(d,"是否被禁用"),e.abrupt("break",57);case 49:return P=Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_NO_MORE_POINT_TEXT||"账户点数不足,请充值。Bioinfoark 按设置中的 Max token 进行预扣,因此并不是点数大于零就可以使用。",e.abrupt("break",57);case 51:return P="请求的模型或者路径不可用或未开放,请检查:模型是否存在、模型是否被禁用",e.abrupt("break",57);case 53:return P="请求超时,可调整客户端设置;服务器端最长响应时间为180秒",e.abrupt("break",57);case 55:return P="请求过于频繁,或者服务器连接过多,请稍后再试",e.abrupt("break",57);case 57:Object(O.b)("错误:"+P),this.setState({loading:!1,typing:""});case 59:this.refresh_point();case 60:case"end":return e.stop()}}),e,this,[[28,37]])})));return function(){return e.apply(this,arguments)}}()},{key:"send",value:function(){var e=Object(c.a)(i.a.mark((function e(t){var a,r,n,s,o,c,_,p,l,u,A,T,h,E,P,m,d,b,f,C,y,N,v,I,S,R,k,g=this;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.props.store._chat_key.length<10)){e.next=3;break}return Object(O.b)("请先点击右上角按钮设置".concat(Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_KEY_NAME||"KEY","以后再使用")),e.abrupt("return",!1);case 3:if(!Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_KEY_CK_ID){e.next=17;break}a=Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_KEY_CK_ID.split("|"),r=!1,n=0;case 7:if(!(n<a.length)){e.next=14;break}if(!(this.props.store._chat_key.indexOf("|".concat(a[n].toLowerCase()))>0)){e.next=11;break}return r=!0,e.abrupt("break",14);case 11:n++,e.next=7;break;case 14:if(r){e.next=17;break}return Object(O.b)("您的Key不能在此使用,请咨询Key的供应商"),e.abrupt("return",!1);case 17:if(console.log("on send"),!(t.length<1)){e.next=20;break}return e.abrupt("return",!1);case 20:if(!this.state.loading){e.next=22;break}return e.abrupt("return",!1);case 22:for(document.querySelector(".input-box").style.height="100px",s=this.state.list.concat({text:t,role:"me"}),this.setState({loading:!0,typing:"正在思考中...",list:s,show_undo:!1}),document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight,e.prev=26,(o=this.getApiInstance()).setApiBaseUrl(this.props.store._chat_api_url),parseInt(this.props.store._chat_timeout)>0&&(o.timeout=1e3*parseInt(this.props.store._chat_timeout)),c=-2-parseInt(this.props.store._chat_history_count||6),_=c<0?s.slice(c):[],console.log("old",_),p=[],this.props.store._chat_system_prompt&&p.push({role:"system",content:this.props.store._chat_system_prompt}),this.props.store._chat_user_prompt&&p.push({role:"user",content:this.props.store._chat_user_prompt}),l=0;l<_.length;l++)"me"==_[l].role?p.push({role:"user",content:_[l].text}):p.push({role:"assistant",content:_[l].text});if(0!=p.length){e.next=40;break}return Object(O.b)("记录为空"),e.abrupt("return",!1);case 40:if(!this.tiktoken){e.next=89;break}if(!(u=this.tiktoken.encoding_for_model)||"object"!==typeof WebAssembly||"function"!==typeof WebAssembly.instantiate){e.next=88;break}console.log("encoding_for_model & wasm enabled"),A=this.props.store._chat_model,e.t0=A,e.next="gpt-3.5-turbo-16k"===e.t0||"gtp-3.5-turbo-0613"===e.t0?48:"gpt-4-0613"===e.t0?50:52;break;case 48:return A="gpt-3.5-turbo",e.abrupt("break",52);case 50:return A="gpt-4",e.abrupt("break",52);case 52:T=u(A),h=p,E=0;case 55:if(!(E<h.length)){e.next=63;break}if(!(!h[E]||"object"!==typeof h[E]||!h[E].content||h[E].content.length<1||!h[E].role||h[E].role.length<1)){e.next=59;break}return Object(O.b)("记录格式错误"),e.abrupt("return",!1);case 59:case 60:E++,e.next=55;break;case 63:P=h.map((function(e){return"<|im_start|>".concat(e.role," \n").concat(e.content,"<|im_end|>\n")})).join("")+"<|im_start|>assistant \n",console.log("wrapped",P),P=P.replaceAll("<|im_start|>"," , ").replaceAll("<|im_end|>"," , ").trim(),m=T.encode(P).length,console.log("message_tokens",m),d=4096,e.t1=this.props.store._chat_model,e.next="gpt-3.5-turbo"===e.t1?72:"gpt-4"===e.t1?74:"gpt-3.5-turbo-16k"===e.t1?76:78;break;case 72:return d=4096,e.abrupt("break",78);case 74:return d=8192,e.abrupt("break",78);case 76:return d=16384,e.abrupt("break",78);case 78:if(!(m+parseInt(this.props.store._chat_max_tokens)>=d)){e.next=86;break}if("yes"!=this.props.store._chat_change_model){e.next=83;break}"gpt-3.5-turbo"==this.props.store._chat_model&&(this.props.store._chat_model="gpt-3.5-turbo-16k",d=16384,Object(O.b)("内容过长,自动调整为 gpt-3.5-16k 模型")),e.next=86;break;case 83:return Object(O.b)("输入内容过长,请清理对话历史或者减少最大token"),this.setState({loading:!1,typing:""}),e.abrupt("return",!1);case 86:e.next=89;break;case 88:console.log("load encoding fail");case 89:return e.prev=89,C="",e.next=93,o.completion({messages:p,temperature:null!==(b=parseFloat(this.props.store._chat_temperature))&&void 0!==b?b:0,max_tokens:null!==(f=parseInt(this.props.store._chat_max_tokens))&&void 0!==f?f:1e3,model:this.props.store._chat_model||"gpt-3.5-turbo",stream:"yes"==this.props.store._chat_stream,moderation:this.props.store._chat_key.startsWith("fk")&&this.props.store._chat_moderation_on,moderation_stop:!0,onMessage:function(e,t){if(console.log("text",e,"last",t),e.length<1)return!1;if(t&&(C+=t,"。"===t||"!"===t||"?"===t)){var a=C;C="","yes"==g.props.store._chat_auto_audio&&a.length>1&&g.audio(a)}g.setState({typing:e}),document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight},onEnd:function(e){g.setState({typing:""}),document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight,"yes"==g.props.store._chat_auto_audio&&C.length>1&&g.audio(C)}});case 93:(y=e.sent)&&(console.log("send ret",y),this.setState({list:this.state.list.concat({text:"yes"==this.props.store._chat_stream?y.trim():null===(N=y.choices[0])||void 0===N||null===(v=N.message)||void 0===v?void 0:v.content.trim(),role:"robot"}),text:"",typing:"",loading:!1}),this.props.store._chat_last=this.state.list,this.props.store.save_vars("_chat_last")),e.next=119;break;case 97:e.prev=97,e.t2=e.catch(89),S=e.t2.message,R=null===(I=S.match(/\[(\d+)\]/))||void 0===I?void 0:I[1],k=Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_KEY_NAME||"KEY",e.t3=R,e.next="400"===e.t3?105:"401"===e.t3?107:"402"===e.t3?109:"403"===e.t3?111:"408"===e.t3?113:"429"===e.t3?115:117;break;case 105:return S="请求参数错误,历史记录可能过长,请清理后再试",e.abrupt("break",117);case 107:return S="".concat(k,"错误或者账户状态错误,请检查:").concat(k,"是否正确、").concat(k,"是否被禁用"),e.abrupt("break",117);case 109:return S=Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_NO_MORE_POINT_TEXT||"账户点数不足,请充值。BioinfoArk 按设置中的 Max token 进行预扣,因此并不是点数大于零就可以使用。",e.abrupt("break",117);case 111:return S="请求的模型或者路径不可用或未开放,请检查:模型是否存在、模型是否被禁用",e.abrupt("break",117);case 113:return S="请求超时,可调整客户端设置;服务器端最长响应时间为180秒",e.abrupt("break",117);case 115:return S="请求过于频繁,或者服务器连接过多,请稍后再试",e.abrupt("break",117);case 117:Object(O.b)("错误:"+S),this.setState({loading:!1,typing:""});case 119:document.querySelector(".input-box").focus(),document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight,window.setTimeout((function(){g.refresh_point()}),1e3),e.next=129;break;case 124:e.prev=124,e.t4=e.catch(26),console.log("error",e.t4),Object(O.b)("发送请求失败,请检查".concat(Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_KEY_NAME||"KEY","和API请求地址是否正确或重试。")+JSON.stringify(e.t4)),this.setState({loading:!1});case 129:case"end":return e.stop()}}),e,this,[[26,124],[89,97]])})));return function(t){return e.apply(this,arguments)}}()},{key:"warning",value:function(e){"gpt-4"==e&&Object(O.b)("4模型价格是3.5的15~30倍,且返回较慢容易超时,请谨慎使用。"),this.props.store.save_vars("_chat_model")}},{key:"select_action",value:function(){var e=Object(c.a)(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.state.actions[t.target.value]&&this.send(this.state.actions[t.target.value]);case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"export",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t,a,r,n,s=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"history"==(s.length>0&&void 0!==s[0]?s[0]:"history")?(t=JSON.stringify({chat_list:this.props.store._chat_saved_list}),a=new Blob([t],{type:"application/json"}),Object(k.saveAs)(a,"".concat(Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_NAME||"BioinfoArk纯净版",".对话记录.json"))):(r=JSON.stringify({preset_list:this.props.store._preset_saved_list}),n=new Blob([r],{type:"application/json"}),Object(k.saveAs)(n,"".concat(Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_NAME||"BioinfoArk纯净版",".常用提示词.json")));case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"check_bottom_effect",value:function(){if(!document.querySelector(".history-list"))return!1;console.log("check_bottom_effect"),document.querySelector(".history-list").scrollHeight>document.querySelector(".history-list").clientHeight?(console.log("有滚动条"),document.querySelector(".bottom-effect").style.display="block",document.querySelector(".bottom-effect").style.bottom="0"):(document.querySelector(".bottom-effect").style.display="none",console.log("没有滚动条"))}},{key:"set_text",value:function(){var e=Object(c.a)(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.setState({text:this.state.text+" "+t});case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"donate",value:function(){var e=Object(c.a)(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.props.history.push("/donate");case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"load_list",value:function(){var e=Object(c.a)(i.a.mark((function e(t){var a;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.old_list=this.state.list,a=JSON.parse(t),this.setState({list:a,show_undo:!0}),this.props.store.save_vars("_chat_last"),Object(O.b)("已载入历史会话记录,可点击对话最上方的撤销按钮恢复原有对话");case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"refresh_point",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t,a,r;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.props.store._chat_api_url&&this.props.store._chat_key&&this.props.store._chat_key.startsWith("fk")){e.next=2;break}return e.abrupt("return",!1);case 2:return e.prev=2,(t=this.getApiInstance()).setApiBaseUrl(this.props.store._chat_api_url),e.next=7,t.billing();case 7:(a=e.sent)&&(a.object&&"error"==a.object&&Object(O.b)("获取点数失败:"+a.message),a.total_available&&(r=a.total_available*(parseFloat(Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_POINT_SCALE)||1),Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_POINT_DECIMAL&&(r=r.toFixed(parseInt(Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_POINT_DECIMAL)||0)),this.setState({point:r}))),e.next=16;break;case 11:e.prev=11,e.t0=e.catch(2),console.log("error",e.t0),this.api2d_instance=null,Object(O.b)("获取点数失败,请检查请求地址和Key:"+e.t0.message);case 16:case"end":return e.stop()}}),e,this,[[2,11]])})));return function(){return e.apply(this,arguments)}}()},{key:"save",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.props.store._chat_key=this.props.store._chat_key.trim(),this.props.store._chat_api_url=this.props.store._chat_api_url.trim(),(!this.props.store._chat_api_url||this.props.store._chat_key.startsWith("fk")&&this.props.store._chat_api_url.startsWith("https://api.openai.com"))&&(this.props.store._chat_api_url="https://oa.api2d.net",Object(O.b)("检测到您使用的是bioinfoark key,已自动切换API地址")),t=4096,e.t0=this.props.store._chat_model,e.next="gpt-3.5-turbo"===e.t0?7:"gpt-4"===e.t0?9:"gpt-3.5-turbo-16k"===e.t0?11:13;break;case 7:return t=4096,e.abrupt("break",13);case 9:return t=8192,e.abrupt("break",13);case 11:return t=16384,e.abrupt("break",13);case 13:if(!(this.props.store._chat_max_tokens>t-10)){e.next=16;break}return Object(O.b)("当前模型最大tokens为"+t+",您设置的max tokens太大,无法正常聊天,请重新设置"),e.abrupt("return",!1);case 16:return this.props.store.save_vars(),this.api2d_instance=null,e.next=20,this.refresh_point();case 20:this.setState({settings_open:!1});case 21:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"avatar_save",value:function(){var e=Object(c.a)(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.props.store.save_vars(),this.setState({avatar_open:!1});case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"abort",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.getApiInstance().abort(),this.api2d_instance=null,t=this.state.typing,this.setState({loading:!1,typing:"",list:this.state.list.concat({text:t+"...",role:"robot"})});case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"export_conversation",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t,a,r,n=this;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.setState({snap:!0}),(t=document.querySelector("#snap_tmp"))||(t=document.createElement("div"),a=document.querySelector(".chat-list"),r=a.offsetWidth||720,t.style.width="".concat(r,"px"),t.style.padding="20px",t.setAttribute("id","snap_tmp"),t.classList.add("snap-chat-list"),document.body.appendChild(t)),window.setTimeout(Object(c.a)(i.a.mark((function e(){var a,r,s,o;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t.innerHTML=document.querySelector(".chat-list").innerHTML,a=t.querySelectorAll(".bp3-button.code-copy"),r=0;r<a.length;r++)a[r].style.display="none";return e.next=5,R()(document.querySelector("#snap_tmp"),{scale:2});case 5:s=e.sent,n.setState({snap:!1}),o=Date.now(),Object(k.saveAs)(s.toDataURL(),"".concat(n.props.store.appname||"BioinfoArk纯净版","-")+o+".png"),document.querySelector("#snap_tmp").remove();case 10:case"end":return e.stop()}}),e)}))),500);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"prompt_add",value:function(){var e=Object(c.a)(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.setState({prompt_box:!0});case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"prompt_save",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t,a,r=this;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.props.store._preset_prompt_title){e.next=3;break}return Object(O.b)("标题不能为空"),e.abrupt("return",!1);case 3:if(this.props.store._preset_system_prompt||this.props.store._preset_user_prompt){e.next=6;break}return Object(O.b)("提示词不能都为空"),e.abrupt("return",!1);case 6:this.props.store._preset_prompt_id?((a=this.props.store._preset_saved_list.find((function(e){return e.id==r.props.store._preset_prompt_id}))).title=this.props.store._preset_prompt_title,a.system=this.props.store._preset_system_prompt,a.user=this.props.store._preset_user_prompt,this.props.store.save_vars("_preset_saved_list"),this.prompt_box_clean(!0)):(t={id:Date.now(),title:this.props.store._preset_prompt_title,system:this.props.store._preset_system_prompt,user:this.props.store._preset_user_prompt},this.props.store._preset_saved_list.push(t),this.props.store.save_vars("_preset_saved_list"),this.prompt_box_clean(!0));case 7:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"prompt_box_clean",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.props.store._preset_prompt_title="",this.props.store._preset_system_prompt="",this.props.store._preset_user_prompt="",this.props.store._preset_prompt_id="",e&&this.setState({prompt_box:!1})}},{key:"load_prompt",value:function(e){var t=this.props.store._preset_saved_list.find((function(t){return t.id==e})),a=this.inputRef.current,r=a.selectionStart,n=a.selectionEnd,s=this.state.text.substring(0,r)+t.user+this.state.text.substring(n);this.setState({text:s}),setTimeout((function(){a.selectionStart=r+t.user.length,a.selectionEnd=r+t.user.length,a.focus()}),0)}},{key:"edit_prompt",value:function(e){var t=this.props.store._preset_saved_list.find((function(t){return t.id==e}));this.props.store._preset_prompt_id=e,this.props.store._preset_prompt_title=t.title,this.props.store._preset_system_prompt=t.system,this.props.store._preset_user_prompt=t.user,this.setState({prompt_box:!0})}},{key:"remove_prompt",value:function(e){var t=this.props.store._preset_saved_list.findIndex((function(t){return t.id==e}));this.props.store._preset_saved_list.splice(t,1),this.props.store.save_vars("_preset_saved_list")}},{key:"remove_chat_line",value:function(e){var t=this;this.old_list=this.state.list;var a=this.state.list.filter((function(t,a){return a!=e}));this.setState({list:a,show_undo:!0}),window.setTimeout((function(){t.props.store._chat_last=t.state.list,t.props.store.save_vars("_chat_last")}),1e3)}},{key:"audio_play",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t,a,r,n,s,o=this;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.playing){e.next=2;break}return e.abrupt("return",!1);case 2:if(this.audio_to_play.length){e.next=4;break}return e.abrupt("return",!1);case 4:return this.playing=!0,t=this.audio_to_play.shift(),a=t.text,r=this.getApiInstance(),e.next=9,r.textToSpeech({text:a,voiceName:"zh-CN-XiaoxiaoNeural",responseType:"blob-url",speed:1.2});case 9:n=e.sent,s=n,console.log("shift",s,a),this.audio_dom||(this.audio_dom=new Audio),this.audio_dom.src=s,this.audio_dom.play(),this.audio_dom.addEventListener("ended",(function(){URL.revokeObjectURL(s),o.playing=!1,o.audio_play()}),{once:!0});case 16:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"audio",value:function(){var e=Object(c.a)(i.a.mark((function e(t){var a,r,n;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0==this.props.store._chat_key.indexOf("fk")){e.next=3;break}return Object(O.b)("bioinfoark的Key可支持语音"),e.abrupt("return",!1);case 3:return e.t0=String,e.next=6,Object(g.a)().process(t);case 6:e.t1=e.sent,a=(0,e.t0)(e.t1),(r=document.createElement("div")).innerHTML=a,n=r.innerText,r.remove(),console.log("markdown to text",t,n),n.length>1&&(this.audio_to_play.push({text:n}),this.audio_play());case 14:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"toggle_version",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t="gpt-3.5-turbo","gpt-3.5-turbo"==this.props.store._chat_model&&(t="gpt-3.5-turbo-16k"),"gpt-3.5-turbo-16k"==this.props.store._chat_model&&(t="gpt-4"),"gpt-4"==this.props.store._chat_model&&(t="gpt-3.5-turbo"),this.props.store._chat_model=t,this.props.store.save_vars("_chat_model");case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"changeApiEndpoint",value:function(){var e=Object(c.a)(i.a.mark((function e(){var t,a;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.props.store.api_endpoints&&this.props.store.api_endpoints.length>0&&(this.props.store.endpoint_count++,t=this.props.store.endpoint_count%this.props.store.api_endpoints.length,a="https://"+(a=this.props.store.api_endpoints[t]),console.log("next_endpoint",a),this.props.store._chat_api_url=a);case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var t,a,r,n,s,o=this,i=T.a.createElement("div",{className:"right-box"},T.a.createElement("div",{className:"row flex md:flex-row flex-col"},T.a.createElement("div",{className:"left flex-1"}),T.a.createElement("div",{className:"right"},T.a.createElement(m.e,{vertical:window.innerWidth<600},window.innerWidth>=600&&window.electronAPI&&(null===(t=window.electronAPI)||void 0===t?void 0:t.pinWindow)&&T.a.createElement(m.b,{active:"yes"==this.props.store._chat_pin_window,icon:"pin",onClick:function(){var e;o.props.store._chat_pin_window="yes"==o.props.store._chat_pin_window?"no":"yes";var t="yes"==o.props.store._chat_pin_window;null===(e=window.electronAPI)||void 0===e||e.pinWindow(t),o.props.store.save_vars("_chat_pin_window"),t&&Object(O.b)("已将窗口置于最上方")},large:!0}),this.props.store._chat_key&&this.props.store._chat_key.startsWith("fk")&&T.a.createElement(m.h,{className:"md:w-40 w-full",large:!0,rightElement:T.a.createElement(m.b,{icon:"refresh",minimal:!0,onClick:function(){return o.refresh_point()},large:!0}),value:this.state.point+(Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_POINT_NAME||"P"),title:"余额",readOnly:!0}),T.a.createElement(m.b,{icon:"key",onClick:function(){return o.setState({settings_open:!0})},large:!0},"Key和其他设置"),window.innerWidth>=600&&(Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_DATA_BUTTON&&"no"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_DATA_BUTTON?null:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用".startsWith("http")?T.a.createElement(m.a,{href:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用".replaceAll("{{key}}",encodeURIComponent(e.from(this.props.store._chat_key).toString("base64"))),icon:Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_DATA_BTN_ICON||"info-sign",target:"_blank"},Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://www.bioinfoark.com/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_DATA_BTN_TEXT||"数据安全"):T.a.createElement(m.b,{className:"hidden",icon:Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_DATA_BTN_ICON||"info-sign",onClick:function(){return Object(O.b)("您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用")},large:!0},Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_DATA_BTN_TEXT||"数据安全"))))),T.a.createElement("div",{className:"chat-list"},this.state.show_undo?T.a.createElement("div",{className:"text-center gray-btn gray-text"},T.a.createElement(m.c,null,T.a.createElement(m.b,{icon:"undo",minimal:!0,onClick:function(){return o.undo_conversation()}},"撤销"))):null,this.state.list&&this.state.list.map((function(e,t){var a,r;return T.a.createElement("div",{className:"chat-item ".concat(e.role),key:t},T.a.createElement("div",{className:"chat-text content"},T.a.createElement(y.a,{markdown:null===(a=e.text)||void 0===a?void 0:a.trim()}),T.a.createElement("div",{className:"flex flex-row float-icons"},T.a.createElement("span",{className:"remove"},T.a.createElement(m.b,{icon:"trash",small:!0,minimal:!0,title:"删除",onClick:function(){return o.remove_chat_line(t)}})),T.a.createElement("span",{className:"copy"},T.a.createElement(I.CopyToClipboard,{text:null===(r=e.text)||void 0===r?void 0:r.trim(),onCopy:function(){return Object(O.b)("Markdown已复制到剪贴板")}},T.a.createElement(m.b,{icon:"duplicate",small:!0,minimal:!0,title:"复制markdown"}))),Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_TTS&&"no"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_TTS?null:T.a.createElement("span",{className:"audio"},T.a.createElement(m.b,{icon:"volume-up",onClick:function(){return o.audio(e.text)},small:!0,minimal:!0,title:"语音"})))))})),this.state.typing&&T.a.createElement("div",{className:"chat-item robot"},T.a.createElement("div",{className:"chat-text content"},T.a.createElement(m.n,{size:12,className:"mr-2"}),T.a.createElement(y.a,{markdown:null===(a=this.state.typing)||void 0===a?void 0:a.trim()}),T.a.createElement(m.b,{icon:"cross",minimal:!0,onClick:function(){return o.abort()}}))),this.state.list&&this.state.list.length>0&&T.a.createElement("div",{className:"text-center gray-btn xs-btn gray-text"},!this.state.snap||Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_SNAP_WATERMARK&&"no"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_SNAP_WATERMARK?T.a.createElement(m.c,null,T.a.createElement(m.b,{icon:"refresh",small:!0,minimal:!0,onClick:function(){return o.regen_conversation()}},"重新生成"),T.a.createElement(m.b,{icon:"eraser",small:!0,minimal:!0,onClick:function(){return o.clean_conversation(!1)}},"清空记录"),T.a.createElement(m.b,{icon:"download",small:!0,minimal:!0,onClick:function(){return o.export_conversation()}},"导出截图")):T.a.createElement("div",{className:"text-center mt-2"},T.a.createElement("span",{className:"text-gray-400 p-2 px-3 "},Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_NAME?"- By ".concat(Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_NAME).concat(Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_WEBSITE?" \xb7 "+Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_WEBSITE:""," -"):"- By BioinfoArk纯净版 c3.level06.com -")))),T.a.createElement("div",{className:"chat-box"},T.a.createElement("form",{action:"post",id:"chat-form",className:"flex flex-col",onSubmit:function(e){var t;e.preventDefault(),o.send(null===(t=o.state.text)||void 0===t?void 0:t.trim())}},T.a.createElement(m.q,{growVertically:!0,large:!0,rows:4,inputRef:this.inputRef,disabled:this.state.loading,placeholder:"输入你的问题",autoFocus:!0,className:"input-box",onChange:function(e){return o.onChange(e,"text")},value:this.state.text}),T.a.createElement("div",{className:"flex md:flex-row md:justify-between flex-col items-center mb-2"},T.a.createElement("div",{className:"left flex flex-row items-center"},T.a.createElement(b.a,{onUpdate:function(e){return o.warning(e)},className:"mt-2 mb-2 md:mb-0 md:block hidden",field:"_chat_model",options:Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_GPT_NAME&&"no"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_GPT_NAME?[{label:"3.5",value:"gpt-3.5-turbo"},{label:"3.5-16K",value:"gpt-3.5-turbo-16k"},{label:"4",value:"gpt-4"}]:[{label:"GPT3.5",value:"gpt-3.5-turbo"},{label:"GPT3.5-16K",value:"gpt-3.5-turbo-16k"},{label:"GPT4",value:"gpt-4"}]}),T.a.createElement("div",{className:"mt-2 md:hidden block mr-1"},T.a.createElement(m.b,{onClick:function(){return o.toggle_version()},large:!0},"gpt-4"==this.props.store._chat_model?"4":"gpt-3.5-turbo-16k"==this.props.store._chat_model?"3.5+":"3.5")),T.a.createElement(m.c,{className:"mt-2 md:mt-0"},T.a.createElement(m.b,{large:!0,className:"md:mt-2 md:ml-1",icon:this.state.loading?T.a.createElement(m.n,{size:12}):"send-message",type:"submit",disabled:this.state.loading},this.state.loading?"请稍候":"发送(cmd/ctrl+enter)"),T.a.createElement(m.b,{large:!0,className:"md:mt-2 ",icon:"clean",onClick:function(){return o.clean_conversation()}},"新对话"))),T.a.createElement("div",{className:"right hidden md:block flex flex-row items-center justify-center"},"yes"!=this.props.store._chat_auto_save?T.a.createElement(m.b,{large:!0,className:"mt-2 ml-2",icon:"floppy-disk",onClick:function(){return o.save_conversation()}},"保存对话"):T.a.createElement(v.a,{onUpdate:function(){return o.props.store.save_vars()},field:"_chat_auto_save",label:"自动保存会话",className:"no-margin",options:[{label:"是",value:"yes"},{label:"否",value:"no"}]}))))));(this.state.actions?Object.keys(this.state.actions).map((function(e){if(e.trim().length>0)return{label:e,value:e}})):[]).unshift({label:"请选择",value:""});var c=T.a.createElement("div",{className:"prompt-tab"},T.a.createElement("div",{className:"prompt-list"},this.props.store._preset_saved_list&&(null===(r=this.props.store._preset_saved_list)||void 0===r?void 0:r.slice().reverse().map((function(e,t){return T.a.createElement("div",{key:t,className:"prompt-item mb-2 border rounded mb-2 p-2 text-sm text-gray-400 hover:text-blue-400 flex flex-row justify-between cursor-pointer",onClick:function(){return o.load_prompt(e.id)}},T.a.createElement("div",{className:"left flex flex-row items-center"},e.title.substring(0,30)),T.a.createElement("div",{className:"right action-icon ml-2 gray-btn"},T.a.createElement(m.b,{small:!0,minimal:!0,icon:"edit",title:"编辑",onClick:function(t){o.edit_prompt(e.id),t.preventDefault(),t.stopPropagation()}}),T.a.createElement(m.b,{small:!0,minimal:!0,icon:"cross",title:"删除",onClick:function(t){o.remove_prompt(e.id),t.preventDefault(),t.stopPropagation()}})))}))),T.a.createElement("div",{className:"bottom-effect"}))),_=T.a.createElement("div",{className:"history-tab"},T.a.createElement("div",{className:"history-list"},this.props.store._chat_saved_list&&(null===(n=this.props.store._chat_saved_list)||void 0===n?void 0:n.slice().reverse().map((function(e,t){return T.a.createElement("div",{key:t,className:"history-item mb-2 border rounded mb-2 p-2 text-sm text-gray-400 hover:text-blue-400 flex flex-row justify-between"},T.a.createElement("div",{className:"left flex flex-row items-center"},e.name.substring(0,30)),T.a.createElement("div",{className:"right action-icon ml-2 gray-btn"},T.a.createElement(m.b,{small:!0,minimal:!0,icon:"history",title:"载入",onClick:function(){return o.load_list(JSON.stringify(e.list))}}),T.a.createElement(m.b,{small:!0,minimal:!0,icon:"cross",title:"删除",onClick:function(){return o.remove_list(e.id)}})))}))),T.a.createElement("div",{className:"bottom-effect"}))),p=T.a.createElement("div",{className:"left-box flex-1"},T.a.createElement("div",null,T.a.createElement("div",{className:"text-lg mb-2 text-gray-300 mt-6 mr-2 flex flex-row w-48"},T.a.createElement(m.p,{id:"left-tab",onChange:function(e){o.setState({tab_selected:e})},selectedTabId:this.state.tab_selected,className:"w-full"},T.a.createElement(m.o,{id:"prompt",title:"提示词",panel:c}),T.a.createElement(m.o,{id:"history",title:"对话记录",panel:_}),T.a.createElement(m.p.Expander,null),T.a.createElement(m.c,null,"prompt"==this.state.tab_selected&&T.a.createElement(m.b,{onClick:function(){return o.prompt_add()},icon:"plus",className:"gray-btn",minimal:!0,title:"添加预置提示词"}),T.a.createElement(m.b,{onClick:function(){return o.fileInput.click()},icon:"circle-arrow-up",className:"gray-btn",minimal:!0,title:"导入"}),T.a.createElement("input",{type:"file",accept:".json",ref:function(e){o.fileInput=e},style:{display:"none"},onChange:this.handleFile}),T.a.createElement(m.b,{icon:"circle-arrow-down",className:"gray-btn",minimal:!0,onClick:function(){return o.export(o.state.tab_selected)},title:"导出"}))))),Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_LOGO&&"no"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_LOGO?null:T.a.createElement("div",{className:null!==(s="char-box opacity-"+this.props.store._chat_char_opacity)&&void 0!==s?s:80},T.a.createElement("img",{src:this.props.store._chat_avatar_url||Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_LOGO||"char.png",onError:function(){o.props.store._chat_avatar_url&&(o.props.store._chat_avatar_url=null)},className:"char",onClick:function(){return o.setState({avatar_open:!0})},style:Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_LOGO_STYLE?Object(j.a)(Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_LOGO_STYLE):null}),T.a.createElement(N.a,{className:"slider",field:"_chat_char_opacity",min:10,stepSize:10,labelStepSize:10,onUpdate:function(){return o.props.store.save_vars()}}))),l=window.origin+"/#share/"+encodeURIComponent(e.from(JSON.stringify({_chat_key:this.props.store._chat_key,_chat_api_url:this.props.store._chat_api_url})).toString("base64")),u=Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_KEY_BUTTON&&"no"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_KEY_BUTTON?null:Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_KEY_LINK?T.a.createElement(m.a,{large:!0,icon:"key",href:Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_KEY_LINK.replaceAll("{{key}}",encodeURIComponent(e.from(this.props.store._chat_key).toString("base64"))),target:"_blank"},Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_KEY_TEXT||"点此申请Key"):T.a.createElement(m.a,{large:!0,icon:"key",href:"https://www.bioinfoark.com/?page_id=902",target:"_blank"},"申请BioinfoArk Key"),A="c.level06.com"==window.location.hostname||"dd.ftqq.com"==window.location.hostname?T.a.createElement(m.a,{large:!0,icon:"cog",className:"ml-2",href:"https://a.ftqq.com/2023/04/24/chatyou-custom-platform",target:"_blank"},""):null,h=T.a.createElement("div",{className:"flex flex-row chat-page"},p,i,T.a.createElement(m.f,{isOpen:this.state.settings_open,title:"设置",icon:"info-sign",onClose:function(){return o.setState({settings_open:!1})}},T.a.createElement("div",{className:"p-5 mt-2"},(!Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_KEY||"yes"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_KEY)&&T.a.createElement(T.a.Fragment,null,T.a.createElement(f.a,{field:"_chat_key",label:Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_KEY_NAME||"KEY",placeholder:Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_KEY_PLACEHOLDER||"请输入BioinfoArk KEY: fkxxx"})),Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_API_URL&&"no"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_API_URL?null:T.a.createElement(f.a,{field:"_chat_api_url",label:"API地址",placeholder:"请输入API地址,留空访问OpenAI官方",disabled:Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_MODIFY_API_URL&&"no"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_MODIFY_API_URL,rightElement:Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_API2D_ENDPOINT_BTN&&"no"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_API2D_ENDPOINT_BTN?null:T.a.createElement(m.b,{icon:"random",onClick:function(){return o.changeApiEndpoint()}},"切换bioinfoark地址")}),T.a.createElement("div",{className:"flex flex-row mb-5 items-center"},Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_ADVANCED_SETTINGS_BUTTON&&"no"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_ADVANCED_SETTINGS_BUTTON?null:T.a.createElement(m.b,{icon:this.state.show_extend_settings?"chevron-up":"chevron-down",className:"mr-2",large:!0,onClick:function(){return o.setState({show_extend_settings:!o.state.show_extend_settings})}},"高级设置"),Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_SHARE_BUTTON&&"no"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_SHARE_BUTTON?null:T.a.createElement(T.a.Fragment,null,!window.electronAPI&&T.a.createElement(I.CopyToClipboard,{text:l,onCopy:function(){return Object(O.b)("分享链接已经复制到剪贴板,请注意保密,知道此链接的人会消耗你的余额")}},T.a.createElement(m.b,{icon:"share",large:!0},"分享带账号链接"))),A),this.state.show_extend_settings?T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"flex flex-row"},T.a.createElement(f.a,{field:"_chat_max_tokens",label:"Max Tokens",placeholder:"最大 token 数量,一般聊天1000即可,3.5最大为4000,4为8000,否则容易出错",className:"mr-2 flex-1"}),T.a.createElement(f.a,{field:"_chat_temperature",label:"发散度",placeholder:"Temperature,发散程度,0~2之间,越大越发散",className:"flex-1 mr-2"}),T.a.createElement(f.a,{field:"_chat_timeout",label:"超时时间\xb7秒",placeholder:"超时会自动终止请求",className:"mr-2 flex-1"}),T.a.createElement(f.a,{field:"_chat_history_count",label:"历史上下文数量",placeholder:"每次附带的上下文条数,会受 Max tokens限制",className:"flex-1"})),T.a.createElement("div",{className:"flex flex-row"},T.a.createElement(v.a,{field:"_chat_auto_save",label:"自动保存会话",className:"mr-2",options:[{label:"是",value:"yes"},{label:"否",value:"no"}]}),T.a.createElement(v.a,{field:"_chat_summarize_content",label:"使用GPT生成会话标题"}),this.props.store._chat_key.startsWith("fk")?Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_TTS&&"no"==Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_SHOW_TTS?null:T.a.createElement(v.a,{field:"_chat_auto_audio",label:"自动朗读回答"}):null),T.a.createElement(f.a,{field:"_chat_system_prompt",label:"系统提示词",placeholder:"system prompt"}),T.a.createElement(f.a,{field:"_chat_user_prompt",label:"用户提示词",placeholder:"user prompt"}),T.a.createElement("div",{className:"flex flex-row"},T.a.createElement(v.a,{field:"_chat_stream",label:"流式传输",className:"mr-2",options:[{label:"是",value:"yes"},{label:"否",value:"no"}]}),T.a.createElement(v.a,{field:"_chat_change_model",label:"根据长度自动切换3.5-16K",className:"mr-2",options:[{label:"是",value:"yes"},{label:"否",value:"no"}]}))):null,T.a.createElement(C.a,{onSubmit:function(){return o.save()},cancel:T.a.createElement("div",{className:"flex flex-row"},u)}),T.a.createElement("div",{className:"text-center box-footer text-gray-400"},"- ",(Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_NAME?Object({NODE_ENV:"production",PUBLIC_URL:".",REACT_APP_API_BASE:"https://oa.ai01.org/",REACT_APP_LOCAL_API_BASE:"",REACT_APP_FT_APPID:"26",REACT_APP_DATA_NOTICE:"您的key保存在客户端中,直接和OpenAI交互,Key和数据均不通过我们的服务器,请放心使用",REACT_APP_SHOW_SETTINGS_BUTTON:"yes",REACT_APP_SETTINGS_BUTTON_TEXT:"Key和其他设置",REACT_APP_SETTINGS_BUTTON_ICON:"key"}).REACT_APP_NAME+" ":"BioinfoArk 荣誉出品 \xb7 v")+"".concat(this.props.store.version)," -"))),T.a.createElement(m.f,{isOpen:this.state.avatar_open,title:"设置聊天助理和背景",icon:"info-sign",onClose:function(){return o.setState({avatar_open:!1})}},T.a.createElement("div",{className:"p-5 mt-2"},T.a.createElement(f.a,{field:"_chat_avatar_url",placeholder:"请粘贴一个可以访问的图片URL,最好背景透明,如https://..."}),T.a.createElement(f.a,{field:"_chat_bg_url",placeholder:"背景图片URL,如https://..."}),T.a.createElement(C.a,{onSubmit:function(){return o.avatar_save()},cancel:T.a.createElement(m.b,{onClick:function(){return o.setState({avatar_open:!1})},large:!0},"关闭")}))),T.a.createElement(m.f,{isOpen:this.state.prompt_box,title:"常用提示词",icon:"info-sign",onClose:function(){return o.prompt_box_clean(!0)}},T.a.createElement("div",{className:"p-5 mt-2"},T.a.createElement(f.a,{field:"_preset_prompt_title",placeholder:"提示词标题"}),T.a.createElement(f.a,{type:"textarea",field:"_preset_user_prompt",placeholder:"user prompt",fill:!0}),T.a.createElement(C.a,{onSubmit:function(){return o.prompt_save()},cancel:T.a.createElement(m.b,{onClick:function(){return o.prompt_box_clean(!0)},large:!0},"关闭")}))));return T.a.createElement(P.a,{title:this.props.store.appname,main:h})}}]),n}(A.Component))||n)||n)||n)}).call(this,a(57).Buffer)},305:function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var r,n,s=a(53),o=a(11),i=a(12),c=a(15),_=a(16),p=a(0),l=a.n(p),u=a(8),A=a(41),T=a(1464),h=a(487),E=a(1465),P=a(1463),m=a(486),O=a(174),d=a(17),b=a(23),f=(r=Object(u.b)("store"),Object(A.f)(n=r(n=Object(u.c)(n=function(e){Object(c.a)(a,e);var t=Object(_.a)(a);function a(){return Object(o.a)(this,a),t.apply(this,arguments)}return Object(i.a)(a,[{key:"render",value:function(){return l.a.createElement(T.a,{remarkPlugins:[m.a],className:"markdown-text toastui-editor-contents",children:this.props.markdown,linkTarget:"_blank",components:{code:function(e){e.node;var t=e.inline,a=e.className,r=e.children,n=Object(s.a)(e,["node","inline","className","children"]);if(a&&a.indexOf("hljs")>-1)return l.a.createElement("code",Object.assign({},n,{className:a}),r);var o=/language-(\w+)/.exec(a||"");return t?l.a.createElement("code",Object.assign({className:a},n),r):l.a.createElement("div",{className:"code-box my-2"},l.a.createElement(E.a,Object.assign({children:String(r).replace(/\n$/,""),style:P.a,language:o&&o[1]?o[1]:"bash",PreTag:"div"},n)),l.a.createElement(O.CopyToClipboard,{className:"code-copy",text:String(r),onCopy:function(){return Object(b.b)("代码已复制")}},l.a.createElement(d.b,{icon:"code"},"复制代码")))},img:function(e){var t=e.src,a=e.alt;return l.a.createElement(h.a,{showDownload:!0,showRotation:!0,showZoom:!0,small:t,large:t,alt:a})}}})}}]),a}(p.Component))||n)||n)||n)},471:function(e,t,a){"use strict";a.d(t,"a",(function(){return T}));var r,n,s=a(11),o=a(12),i=a(15),c=a(16),_=a(0),p=a.n(_),l=a(8),u=a(41),A=a(484),T=(r=Object(l.b)("store"),Object(u.f)(n=r(n=Object(l.c)(n=function(e){Object(i.a)(a,e);var t=Object(c.a)(a);function a(){return Object(s.a)(this,a),t.apply(this,arguments)}return Object(o.a)(a,[{key:"render",value:function(){var e=this,t=this.props.store[this.props.field]||"",a=this.props.options.filter((function(e){return t==e.value}));Date.now();return p.a.createElement("div",{className:"lossline "+this.props.className||!1},p.a.createElement("div",{className:"lossline"},this.props.label),p.a.createElement(A.a,{menuPlacement:this.props.menuPosition||"auto",placeholder:this.props.placeholder||"请选择",value:a,isMulti:!1,onChange:function(t){e.props.store[e.props.field]=t?t.value:"",e.props.onUpdate&&e.props.onUpdate(t.value)},options:this.props.options||[]}))}}]),a}(_.Component))||n)||n)||n)},480:function(e,t,a){"use strict";a.d(t,"a",(function(){return T}));var r,n,s=a(11),o=a(12),i=a(15),c=a(16),_=a(0),p=a.n(_),l=a(8),u=a(41),A=a(17),T=(r=Object(l.b)("store"),Object(u.f)(n=r(n=Object(l.c)(n=function(e){Object(i.a)(a,e);var t=Object(c.a)(a);function a(){return Object(s.a)(this,a),t.apply(this,arguments)}return Object(o.a)(a,[{key:"render",value:function(){var e,t,a,r,n,s=this,o=null!==(e=this.props.store[this.props.field])&&void 0!==e?e:0;return p.a.createElement(A.m,{className:this.props.className||"",stepSize:null!==(t=this.props.stepSize)&&void 0!==t?t:10,labelStepSize:null!==(a=this.props.labelStepSize)&&void 0!==a?a:10,min:null!==(r=this.props.min)&&void 0!==r?r:0,max:null!==(n=this.props.max)&&void 0!==n?n:100,value:o,onChange:function(e){s.props.store[s.props.field]=e,s.props.onUpdate&&s.props.onUpdate(e)}})}}]),a}(_.Component))||n)||n)||n)},483:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return h}));var r,n,s=a(11),o=a(12),i=a(15),c=a(16),_=a(0),p=a.n(_),l=a(8),u=a(41),A=a(52),T=a(17),h=(r=Object(l.b)("store"),Object(u.f)(n=r(n=Object(l.c)(n=function(t){Object(i.a)(r,t);var a=Object(c.a)(r);function r(){return Object(s.a)(this,r),a.apply(this,arguments)}return Object(o.a)(r,[{key:"componentDidMount",value:function(){var t=decodeURIComponent(this.props.match.params.info),a=e.from(t,"base64").toString();this.props.store.share_info=a;var r=JSON.parse(a);for(var n in r)this.props.store.hasOwnProperty(n)&&(this.props.store[n]=r[n]);this.props.store.save_vars(),this.props.history.push("/")}},{key:"render",value:function(){var e=p.a.createElement("div",{className:"flex justify-center items-center h-screen"},p.a.createElement("div",{className:"text-center"},p.a.createElement(T.n,null)));return p.a.createElement(A.a,{title:this.props.store.appname,main:e})}}]),r}(_.Component))||n)||n)||n)}).call(this,a(57).Buffer)},52:function(e,t,a){"use strict";var r,n,s,o,i,c,_,p,l,u,A,T,h=a(11),E=a(12),P=a(15),m=a(16),O=a(0),d=a.n(O),b=a(8),f=a(41),C=a(466),y=a.n(C),N=a(29),v=(r=Object(b.b)("store"),Object(f.f)(n=r(n=Object(b.c)(n=function(e){Object(P.a)(a,e);var t=Object(m.a)(a);function a(){return Object(h.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"render",value:function(){var e=this.props.data;return e?d.a.createElement("div",{className:"user-span"},d.a.createElement("img",{src:e.avatar_url,className:"avatar"}),e.name,e.coin>=0&&d.a.createElement("span",{className:"coin bg-blue-500 text-white font-mono text-xs"},e.coin)):null}}]),a}(O.Component))||n)||n),a(53)),I=a(17),S=a(54),R=a(1504),k=a(170),g=(s=Object(b.b)("store"),Object(f.f)(o=s(o=Object(b.c)(o=function(e){Object(P.a)(a,e);var t=Object(m.a)(a);function a(){return Object(h.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"render",value:function(){var e=this,t=d.a.createElement(I.i,{className:"border"},d.a.createElement(I.k,{icon:"person",text:"我的",onClick:function(){return e.props.history.push("/profile")}}),d.a.createElement(I.k,{icon:"dollar",text:"充值",onClick:function(){return e.props.history.push("/recharge")}}),d.a.createElement(I.j,null),d.a.createElement(I.k,{icon:"log-out",text:"退出",onClick:function(){return e.props.history.push("/logout")}})),a=this.props,r=(a.staticContext,Object(v.a)(a,["staticContext"]));return d.a.createElement("div",r,this.props.store.user?d.a.createElement(R.a,{autoFocus:!1,content:t,position:S.a.BOTTOM_RIGHT},d.a.createElement(I.b,{rightIcon:"caret-down",minimal:!0})):d.a.createElement(k.a,{minimal:!0}))}}]),a}(O.Component))||o)||o),i=Object(b.b)("store"),Object(f.f)(c=i(c=Object(b.c)(c=function(e){Object(P.a)(a,e);var t=Object(m.a)(a);function a(){return Object(h.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"render",value:function(){var e=this,t=this.props,a=(t.staticContext,Object(v.a)(t,["staticContext"]));return d.a.createElement("div",a,d.a.createElement("div",{className:"flex flex-row items-center"},this.props.store.menu&&d.a.createElement(d.a.Fragment,null," ",d.a.createElement("svg",{className:"w-3 h-3 mr-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},d.a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M9 5l7 7-7 7"}))," "),this.props.store.menu&&this.props.store.menu.map((function(t){var a,r=!0;(t.member_only&&(e.props.store.token||(r=!1)),t.admin_only)&&((null===(a=e.props.store.user)||void 0===a?void 0:a.level)<9&&(r=!1));return r?d.a.createElement(N.c,{className:"nav-menu text-black text-lg hover:text-gray-500 hover:no-underline ",key:t.id,to:t.link},t.text):null}))))}}]),a}(O.Component))||c)||c)||c);_=Object(b.b)("store"),Object(f.f)(p=_(p=Object(b.c)(p=function(e){Object(P.a)(a,e);var t=Object(m.a)(a);function a(){return Object(h.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"render",value:function(){this.props.store.user;return d.a.createElement("div",{className:(this.props.className||"")+" header"},d.a.createElement("div",{className:"container mx-auto"},d.a.createElement("div",{className:"left flex flex-row items-center"},d.a.createElement(N.b,{to:"/"},this.props.store.appname),d.a.createElement(g,{className:"ml-5 hidden md:block"})),d.a.createElement("div",{className:"right"})))}}]),a}(O.Component))||p)||p),l=Object(b.b)("store"),Object(f.f)(u=l(u=Object(b.c)(u=function(e){Object(P.a)(a,e);var t=Object(m.a)(a);function a(){return Object(h.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"render",value:function(){return d.a.createElement("div",{className:(this.props.className||"")+" footer"},"BioinfoArk")}}]),a}(O.Component))||u)||u);a.d(t,"a",(function(){return j}));var j=(A=Object(b.b)("store"),Object(f.f)(T=A(T=Object(b.c)(T=function(e){Object(P.a)(a,e);var t=Object(m.a)(a);function a(){return Object(h.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"render",value:function(){return d.a.createElement(y.a,{title:this.props.title||this.props.store.appname},d.a.createElement(d.a.Fragment,null,this.props.store._chat_bg_url?d.a.createElement("div",{className:"chat-bg"}," ",d.a.createElement("img",{src:this.props.store._chat_bg_url,onError:function(e){return e.target.style.display="none"},referrerPolicy:"no-referrer"})):null,d.a.createElement("div",{className:""},d.a.createElement("div",{className:"body container mx-auto"},this.props.main)),d.a.createElement("div",{className:"drag-handle w-full h-5 fixed top-0 "})))}}]),a}(O.Component))||T)||T)||T)},60:function(e,t,a){"use strict";a.d(t,"a",(function(){return T}));var r,n,s=a(11),o=a(12),i=a(15),c=a(16),_=a(0),p=a.n(_),l=a(8),u=a(41),A=a(17),T=(r=Object(l.b)("store"),Object(u.f)(n=r(n=Object(l.c)(n=function(e){Object(i.a)(a,e);var t=Object(c.a)(a);function a(){return Object(s.a)(this,a),t.apply(this,arguments)}return Object(o.a)(a,[{key:"render",value:function(){var e=this,t=this.props.store[this.props.field]||"";return p.a.createElement(A.g,{label:this.props.label,className:this.props.lineClass||""},"textarea"==this.props.type?p.a.createElement(A.q,{fill:this.props.fill||!1,growVertically:!0,large:!0,placeholder:this.props.placeholder,onChange:function(t){return e.props.store[e.props.field]=t.target.value},value:t,className:this.props.className||""}):p.a.createElement(A.h,{type:this.props.type,large:"true",placeholder:this.props.placeholder,onChange:function(t){return e.props.store[e.props.field]=t.target.value},rightElement:this.props.rightElement||null,value:t,className:this.props.className||"",disabled:this.props.disabled||null}),parseInt(this.props.max_count)>0&&p.a.createElement("div",{className:"text-count"},t.length,"/",this.props.max_count))}}]),a}(_.Component))||n)||n)||n)},600:function(e,t,a){e.exports=a(1462)},605:function(e,t,a){}},[[600,1,2]]]); |