Spaces:
Running
Running
File size: 92,460 Bytes
fb49c8e |
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){},144:function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var r,n,s=a(10),o=a(12),i=a(15),c=a(16),l=a(0),p=a.n(l),u=a(8),h=a(41),m=a(18),_=a(100),b=(r=Object(u.b)("store"),Object(h.f)(n=r(n=Object(u.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(m.g,null,p.a.createElement("div",{className:"flex flex-row justify-between"},p.a.createElement("div",{className:"left"},p.a.createElement(m.b,{large:"true",intent:_.a.PRIMARY,onClick:function(){return e.props.onSubmit()}},"\u63d0\u4ea4")),p.a.createElement("div",{className:"right"},this.props.cancel||p.a.createElement(m.b,{large:"true",onClick:function(){return e.props.history.goBack()},className:"right-20"},"\u53d6\u6d88")))))}}]),a}(l.Component))||n)||n)||n)},1462:function(e,t,a){"use strict";a.r(t);var r,n,s,o,i,c,l,p,u,h,m,_,b,f,d,v,y,g,k,j,O,x,w,E=a(0),N=a.n(E),S=a(38),C=a.n(S),q=(a(605),a(10)),A=a(12),z=a(15),I=a(16),T=a(29),P=a(41),W=a(8),M=Object(W.b)("store")(r=Object(W.c)(r=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){return Object(q.a)(this,a),t.apply(this,arguments)}return Object(A.a)(a,[{key:"render",value:function(){return N.a.createElement("div",{className:"title"},N.a.createElement("h1",null,"Hello\uff0c",this.props.store.appname))}}]),a}(E.Component))||r)||r,D=a(18),U=(n=Object(W.b)("store"),Object(P.f)(s=n(s=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){return Object(q.a)(this,a),t.apply(this,arguments)}return Object(A.a)(a,[{key:"render",value:function(){var e=this;return N.a.createElement("div",null,N.a.createElement("h1",null,N.a.createElement(M,null)),N.a.createElement("div",null,N.a.createElement(D.b,{onClick:function(){return e.props.store.appname+="\ud83c\udf88"}},"change")),N.a.createElement("div",null,N.a.createElement("span",{onClick:function(){return e.props.history.push("/login")}},"Login")))}}]),a}(E.Component))||s)||s),B=a(52),L=a(169),R=(o=Object(W.b)("store"),Object(P.f)(i=o(i=Object(W.c)(i=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){return Object(q.a)(this,a),t.apply(this,arguments)}return Object(A.a)(a,[{key:"render",value:function(){var e=N.a.createElement("div",{className:"p-32 "},"FrontPage");return N.a.createElement(B.a,{title:this.props.store.appname,main:e})}}]),a}(E.Component))||i)||i),a(3)),F=a.n(R),J=a(6),H=a(27),K=(c=Object(W.b)("store"),Object(P.f)(l=c(l=Object(W.c)(l=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){return Object(q.a)(this,a),t.apply(this,arguments)}return Object(A.a)(a,[{key:"componentDidMount",value:function(){var e=Object(J.a)(F.a.mark((function e(){var t,a,r,n;return F.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(H.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 N.a.createElement("div",{className:"flex flex-row pt-20 items-center justify-center"},N.a.createElement(D.n,null))}}]),a}(E.Component))||l)||l)||l),G=a(62),Y=a(57),V=a(219),$=(p=Object(W.b)("store"),Object(P.f)(u=p(u=Object(W.c)(u=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){var e;Object(q.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(A.a)(a,[{key:"go",value:function(){if(Object(H.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(Y.a)(t,["staticContext","onClick"]));return N.a.createElement(N.a.Fragment,null,N.a.createElement(D.b,Object.assign({onClick:function(){return e.go()}},a)),this.state.qrcode_url&&N.a.createElement(D.l,{isOpen:this.state.qrcode_url,onClose:function(){return e.setState({qrcode_url:!1})}},N.a.createElement("div",{className:"center-box bg-white p-10 rounded"},N.a.createElement(V.a,{value:this.state.qrcode_url}),N.a.createElement("div",{className:"mt-2"},"\u8bf7\u7528\u5fae\u4fe1\u626b\u7801\u652f\u4ed8"))))}}]),a}(E.Component))||u)||u)||u),X=(h=Object(W.b)("store"),Object(P.f)(m=h(m=Object(W.c)(m=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){var e;Object(q.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(A.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(H.b)("\u652f\u4ed8\u6570\u636e\u5904\u7406\u4e2d..."),e.props.history.push("/profile"))})),console.log("launch")}},{key:"recharge",value:function(){var e=Object(J.a)(F.a.mark((function e(){var t,a=this;return F.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(H.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=N.a.createElement("div",{className:"p-2 recharge-page"},N.a.createElement("div",{className:"price"},(this.props.store.recharge_input_coin/100).toFixed(2)),N.a.createElement(G.a,{field:"recharge_input_coin",type:"number",placeholder:"\u8bf7\u8f93\u5165\u8981\u8d2d\u4e70\u7684"+this.props.store.coin_name+"\u6570\u91cf"}),N.a.createElement($,{amount:this.props.store.recharge_input_coin,large:!0,onClick:function(){return e.recharge()}},"\u5145\u503c"));return N.a.createElement(B.a,{title:this.props.store.appname,main:t})}}]),a}(E.Component))||m)||m)||m),Z=(_=Object(W.b)("store"),Object(P.f)(b=_(b=Object(W.c)(b=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){return Object(q.a)(this,a),t.apply(this,arguments)}return Object(A.a)(a,[{key:"componentDidMount",value:function(){var e=Object(J.a)(F.a.mark((function e(){return F.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=N.a.createElement("div",{className:"flex flex-row pt-20 items-center justify-center"},N.a.createElement(D.n,null));return N.a.createElement(B.a,{title:this.props.store.appname,main:e})}}]),a}(E.Component))||b)||b)||b),Q=(f=Object(W.b)("store"),Object(P.f)(d=f(d=Object(W.c)(d=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){var e;Object(q.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(A.a)(a,[{key:"componentDidMount",value:function(){var e=Object(J.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.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=N.a.createElement("div",{className:"p-2 flex flex-col profile-page"},N.a.createElement("div",{className:"profile"},N.a.createElement("div",{className:"avatar"},N.a.createElement("img",{src:e.avatar_url,alt:""}),N.a.createElement("div",{className:"explain"},e.name))),N.a.createElement("div",{className:"detail"},N.a.createElement("div",{className:"row"},N.a.createElement("div",{className:"left"},"Level"),N.a.createElement("div",{className:"right"},e.level)),N.a.createElement("div",{className:"row"},N.a.createElement("div",{className:"left"},"Coin"),N.a.createElement("div",{className:"right"},e.coin))));return N.a.createElement(B.a,{title:this.props.store.appname,main:t})}}]),a}(E.Component))||d)||d)||d),ee=(v=Object(W.b)("store"),Object(P.f)(y=v(y=Object(W.c)(y=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){return Object(q.a)(this,a),t.apply(this,arguments)}return Object(A.a)(a,[{key:"componentDidMount",value:function(){document.querySelector("#wechat-login-btn").click()}},{key:"render",value:function(){var e=N.a.createElement("div",{className:"flex flex-row pt-12 items-center justify-center"},N.a.createElement(L.a,{large:!0}));return N.a.createElement(B.a,{title:this.props.store.appname,main:e})}}]),a}(E.Component))||y)||y)||y),te=(g=Object(W.b)("store"),Object(P.f)(k=g(k=Object(W.c)(k=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){return Object(q.a)(this,a),t.apply(this,arguments)}return Object(A.a)(a,[{key:"render",value:function(){var e=N.a.createElement("div",{className:"py-5 px-5 md:px-0 text-xl"},"\u767b\u5165\u6210\u529f\uff0c\u8bf7\u56de\u5230\u7535\u8111\u70b9\u51fb\u6309\u94ae\u7ee7\u7eed\u3002\u6216\u8005\u70b9\u51fb\u53f3\u4e0a\u89d2\u83dc\u5355\u8fdb\u884c\u64cd\u4f5c\u3002");return N.a.createElement(B.a,{title:this.props.store.appname,main:e})}}]),a}(E.Component))||k)||k)||k),ae=(j=Object(W.b)("store"),Object(P.f)(O=j(O=Object(W.c)(O=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){return Object(q.a)(this,a),t.apply(this,arguments)}return Object(A.a)(a,[{key:"componentDidMount",value:function(){var e=Object(J.a)(F.a.mark((function e(){var t,a,r,n;return F.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=N.a.createElement("div",{className:"py-5 px-5 md:px-0"},N.a.createElement("div",{className:"p-5 flex justify-center"},N.a.createElement(D.n,null)));return N.a.createElement(B.a,{title:this.props.store.appname,main:e})}}]),a}(E.Component))||O)||O)||O),re=a(304),ne=a(482),se=a(144),oe=(x=Object(W.b)("store"),Object(P.f)(w=x(w=Object(W.c)(w=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){return Object(q.a)(this,a),t.apply(this,arguments)}return Object(A.a)(a,[{key:"submit",value:function(){var e=Object(J.a)(F.a.mark((function e(){var t,a,r,n,s,o;return F.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.props.store._donate_keys.trim().split("\n"),a=[],Object(H.b)("\u6b63\u5728\u9a8c\u8bc1KEY\uff0c\u8bf7\u7a0d\u5019"),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(H.b)("\u6ca1\u6709\u662f\u6709\u6548\u7684KEY"),e.abrupt("return");case 27:Object(H.b)("".concat(a.length,"\u4e2aKEY\u901a\u8fc7\u6821\u9a8c\uff0c\u6b63\u5728\u63d0\u4ea4\u6570\u636e"));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=N.a.createElement("div",{className:"p-12"},N.a.createElement("div",{className:"text-center text-2xl"},"\u8d5e\u52a9OpenAI KEY"),N.a.createElement(G.a,{type:"textarea",fill:!0,label:"OpenAI KEY",field:"_donate_keys",placeholder:"\u4e00\u884c\u4e00\u4e2aKey\uff0c\u5f62\u5982 sk... "}),N.a.createElement(G.a,{label:"\u6587\u5b57\u5e7f\u544a\u6587\u6848",field:"_donate_title",placeholder:"30\u5b57\u7b26\u5185\uff0c\u4f1a\u4eba\u5de5\u5ba1\u6838\uff0c\u8fdd\u53cd\u5185\u5730\u6cd5\u5f8b\u6cd5\u89c4\u548c\u4e0d\u771f\u5b9e\u5185\u5bb9\u5c06\u4e0d\u4f1a\u901a\u8fc7"}),N.a.createElement(G.a,{label:"\u6587\u5b57\u5e7f\u544a\u94fe\u63a5",field:"_donate_link",placeholder:"https://... \u53ef\u586b\u5165\u4e2a\u4eba\u7f51\u7ad9\u3001\u7f51\u5e97\u3001\u535a\u5ba2\u4e4b\u7c7b"}),N.a.createElement(se.a,{label:"\u63d0\u4ea4",onSubmit:function(){return e.submit()}}),N.a.createElement("div",{className:"text-lg mt-8"},"\u6548\u679c\u9884\u89c8"),N.a.createElement("div",{className:"preview border rounded p-5 mt-5"},N.a.createElement("div",{className:"line-1"},"\u60a8\u4f7f\u7528\u7684 Key \u7531 ",N.a.createElement("span",{className:"text-blue-500"},this.props.store.user.name)," \u53cb\u60c5\u63d0\u4f9b"),N.a.createElement("div",{className:"line-2 mt-3 flex flex-row item-center"},N.a.createElement("span",{className:"text-white bg-gray-300 rounded px-1 mr-2"},"\u5e7f\u544a"),N.a.createElement("a",{href:this.props.store._donate_link||"https://stack.ftqq.com/subscribe",target:"_blank"},this.props.store._donate_title||"\u65b9\u7cd6\u8d85\u7ea7\u4f1a\u5458\xb7\u52a9\u529b\u4ece\u87ba\u4e1d\u9489\u5230\u4e00\u4eba\u4f01\u4e1a"))));return N.a.createElement(B.a,{title:this.props.store.appname,main:t})}}]),a}(E.Component))||w)||w)||w),ie=a(483),ce=function(e){Object(z.a)(a,e);var t=Object(I.a)(a);function a(){return Object(q.a)(this,a),t.apply(this,arguments)}return Object(A.a)(a,[{key:"render",value:function(){return N.a.createElement(T.a,null,N.a.createElement(P.c,null,N.a.createElement(P.a,{path:"/donate",component:oe}),N.a.createElement(P.a,{path:"/chat",component:re.a}),N.a.createElement(P.a,{path:"/login/auto/:token",component:ae}),N.a.createElement(P.a,{path:"/after/login",component:te}),N.a.createElement(P.a,{path:"/profile",component:Q}),N.a.createElement(P.a,{path:"/recharge",component:X}),N.a.createElement(P.a,{path:"/logout",component:Z}),N.a.createElement(P.a,{path:"/logback",component:K}),N.a.createElement(P.a,{path:"/login",component:ee}),N.a.createElement(P.a,{path:"/index",component:U}),N.a.createElement(P.a,{path:"/share/:info",component:ie.a}),N.a.createElement(P.a,{path:"/",component:re.a})))}}]),a}(E.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 le=a(232);console.log("Welcome to ".concat(le.a.appname)),console.log=function(){},C.a.render(N.a.createElement(W.a,{store:le.a},N.a.createElement(ce,null)),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()}))},169:function(e,t,a){"use strict";a.d(t,"a",(function(){return j}));var r,n,s=a(57),o=a(3),i=a.n(o),c=a(6),l=a(10),p=a(12),u=a(15),h=a(16),m=a(0),_=a.n(m),b=a(8),f=a(41),d=a(18),v=a(27),y=a(219),g=a(468),k=a.n(g),j=(r=Object(b.b)("store"),Object(f.f)(n=r(n=Object(b.c)(n=function(e){Object(u.a)(a,e);var t=Object(h.a)(a);function a(){var e;Object(l.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=k()({length:32}),e.next=3,this.props.store.get_wechat_login_url();case 3:(t=e.sent)&&t.url&&(Object(v.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(v.b)("\u8bf7\u626b\u7801\u540e\u518d\u70b9\u51fb\u6b64\u6309\u94ae"):a&&a.user&&(this.props.store.set_user(a.user),this.setState({qrcode_url:!1}),Object(v.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 _.a.createElement(_.a.Fragment,null,_.a.createElement(d.b,Object.assign({id:"wechat-login-btn",text:"\u5fae\u4fe1\u767b\u5165",onClick:function(){return e.go()}},a)),this.state.qrcode_url&&_.a.createElement(d.l,{isOpen:this.state.qrcode_url,canOutsideClickClose:!1,onClose:function(){return e.setState({qrcode_url:!1})}},_.a.createElement("div",{className:"center-box bg-white p-10 rounded"},_.a.createElement(y.a,{value:this.state.qrcode_url}),_.a.createElement("div",{className:"mt-2"},_.a.createElement(d.b,{large:!0,onClick:function(){return e.check()}},"\u5fae\u4fe1\u626b\u7801\u540e\u70b9\u6b64\u7ee7\u7eed")))))}}]),a}(m.Component))||n)||n)||n)},177:function(e,t,a){"use strict";a.d(t,"a",(function(){return _}));var r,n,s=a(10),o=a(12),i=a(15),c=a(16),l=a(0),p=a.n(l),u=a(8),h=a(41),m=a(18),_=(r=Object(u.b)("store"),Object(h.f)(n=r(n=Object(u.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(m.d,{key:a+t++,checked:"yes"==this.props.store[r],label:this.props.label,onChange:function(t){return e.change(t)},inline:!0}))}}]),a}(l.Component))||n)||n)||n)},219:function(e,t,a){"use strict";a.d(t,"a",(function(){return _}));var r,n=a(14),s=a(10),o=a(12),i=a(15),c=a(16),l=a(0),p=a.n(l),u=a(41),h=a(467),m=a.n(h),_=Object(u.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(m.a,Object(n.a)({size:200,value:this.state.value,includeMargin:!0,id:"theqr__inbox"},"includeMargin",!0)))}}]),a}(l.Component))||r},232:function(e,t,a){"use strict";var r,n,s,o,i,c,l,p,u,h,m,_,b,f,d,v,y,g,k,j,O,x,w,E,N,S,C,q,A,z,I,T,P,W,M,D,U,B,L=a(3),R=a.n(L),F=a(6),J=a(33),H=a(10),K=a(12),G=a(30),Y=(a(634),a(11)),V=a(27),$=a(234),X=a.n($),Z=function(){function e(t){Object(H.a)(this,e),this.store=t}return Object(K.a)(e,[{key:"get",value:function(){var e=Object(F.a)(R.a.mark((function e(t){var a,r,n=arguments;return R.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(F.a)(R.a.mark((function e(t){return R.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=this,e.next=3,X.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(F.a)(R.a.mark((function e(t){var a,r,n,s,o=arguments;return R.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(F.a)(R.a.mark((function e(t){var a,r,n,s,o=arguments;return R.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,X.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(F.a)(R.a.mark((function e(t){var a,r,n,s,o=arguments;return R.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,X.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(F.a)(R.a.mark((function e(t){var a=arguments;return R.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(V.b)("\u8bf7\u767b\u5165\u540e\u7ee7\u7eed"),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}(),Q=(r=function(){function e(){Object(H.a)(this,e),Object(J.a)(this,"appname",n,this),Object(J.a)(this,"apibase",s,this),Object(J.a)(this,"local_apibase",o,this),Object(J.a)(this,"session",i,this),Object(J.a)(this,"token",c,this),Object(J.a)(this,"user",l,this),Object(J.a)(this,"api_endpoints",p,this),this.version="3.0.1",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"],Object(J.a)(this,"menu",u,this),Object(J.a)(this,"coin_name",h,this),Object(J.a)(this,"recharge_input_coin",m,this),Object(J.a)(this,"_donate_keys",_,this),Object(J.a)(this,"_donate_title",b,this),Object(J.a)(this,"_donate_link",f,this),Object(J.a)(this,"_chat_model",d,this),Object(J.a)(this,"_chat_saved_list",v,this),Object(J.a)(this,"_preset_saved_list",y,this),Object(J.a)(this,"_chat_key",g,this),Object(J.a)(this,"_chat_api_url",k,this),Object(J.a)(this,"_chat_avatar_url",j,this),Object(J.a)(this,"_chat_bg_url",O,this),Object(J.a)(this,"_chat_max_tokens",x,this),Object(J.a)(this,"_chat_temperature",w,this),Object(J.a)(this,"_chat_timeout",E,this),Object(J.a)(this,"_chat_system_prompt",N,this),Object(J.a)(this,"_chat_user_prompt",S,this),Object(J.a)(this,"_chat_char_opacity",C,this),Object(J.a)(this,"_chat_history_count",q,this),Object(J.a)(this,"_chat_last",A,this),Object(J.a)(this,"_chat_auto_save",z,this),Object(J.a)(this,"_chat_summarize_content",I,this),Object(J.a)(this,"_chat_auto_audio",T,this),Object(J.a)(this,"_chat_pin_window",P,this),Object(J.a)(this,"_preset_system_prompt",W,this),Object(J.a)(this,"_preset_user_prompt",M,this),Object(J.a)(this,"_preset_prompt_title",D,this),Object(J.a)(this,"_preset_prompt_id",U,this),Object(J.a)(this,"_chat_moderation_on",B,this),this._chat_stream=!0,this.api=new Z(this),this.load_vars(),this.load_api_endpoints()}return Object(K.a)(e,[{key:"load_api_endpoints",value:function(){var e=Object(F.a)(R.a.mark((function e(){var t,a;return R.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch("https://domain.api2d.org/");case 2:return t=e.sent,e.next=5,t.json();case 5:(a=e.sent)&&a.length>0&&(this.api_endpoints=a);case 7:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"load_default",value:function(){var e=Object(F.a)(R.a.mark((function e(){var t,a;return R.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(F.a)(R.a.mark((function e(){var t=this;return R.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(F.a)(R.a.mark((function e(){var t,a,r,n=arguments;return R.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(F.a)(R.a.mark((function e(t){var a,r,n=arguments;return R.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(F.a)(R.a.mark((function e(t){var a;return R.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(F.a)(R.a.mark((function e(){var t,a,r,n=arguments;return R.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(F.a)(R.a.mark((function e(){var t;return R.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(G.a)(r.prototype,"appname",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"BioinfoArk"}}),s=Object(G.a)(r.prototype,"apibase",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"https://openapi.ftqq.com/"}}),o=Object(G.a)(r.prototype,"local_apibase",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),i=Object(G.a)(r.prototype,"session",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),c=Object(G.a)(r.prototype,"token",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),l=Object(G.a)(r.prototype,"user",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),p=Object(G.a)(r.prototype,"api_endpoints",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),u=Object(G.a)(r.prototype,"menu",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[{id:8001,text:"\u9996\u9875",link:"/home",member_only:!1}]}}),Object(G.a)(r.prototype,"logout",[Y.f],Object.getOwnPropertyDescriptor(r.prototype,"logout"),r.prototype),Object(G.a)(r.prototype,"set_user",[Y.f],Object.getOwnPropertyDescriptor(r.prototype,"set_user"),r.prototype),h=Object(G.a)(r.prototype,"coin_name",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"\u91d1\u5e01"}}),m=Object(G.a)(r.prototype,"recharge_input_coin",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),_=Object(G.a)(r.prototype,"_donate_keys",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),b=Object(G.a)(r.prototype,"_donate_title",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),f=Object(G.a)(r.prototype,"_donate_link",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),d=Object(G.a)(r.prototype,"_chat_model",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"gpt-3.5-turbo"}}),v=Object(G.a)(r.prototype,"_chat_saved_list",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),y=Object(G.a)(r.prototype,"_preset_saved_list",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),g=Object(G.a)(r.prototype,"_chat_key",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),k=Object(G.a)(r.prototype,"_chat_api_url",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"https://openai.api2d.net"}}),j=Object(G.a)(r.prototype,"_chat_avatar_url",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),O=Object(G.a)(r.prototype,"_chat_bg_url",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),x=Object(G.a)(r.prototype,"_chat_max_tokens",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1e3}}),w=Object(G.a)(r.prototype,"_chat_temperature",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.1}}),E=Object(G.a)(r.prototype,"_chat_timeout",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 60}}),N=Object(G.a)(r.prototype,"_chat_system_prompt",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),S=Object(G.a)(r.prototype,"_chat_user_prompt",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),C=Object(G.a)(r.prototype,"_chat_char_opacity",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 80}}),q=Object(G.a)(r.prototype,"_chat_history_count",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 6}}),A=Object(G.a)(r.prototype,"_chat_last",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),z=Object(G.a)(r.prototype,"_chat_auto_save",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"yes"}}),I=Object(G.a)(r.prototype,"_chat_summarize_content",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"yes"}}),T=Object(G.a)(r.prototype,"_chat_auto_audio",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"no"}}),P=Object(G.a)(r.prototype,"_chat_pin_window",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"no"}}),W=Object(G.a)(r.prototype,"_preset_system_prompt",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),M=Object(G.a)(r.prototype,"_preset_user_prompt",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),D=Object(G.a)(r.prototype,"_preset_prompt_title",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),U=Object(G.a)(r.prototype,"_preset_prompt_id",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),B=Object(G.a)(r.prototype,"_chat_moderation_on",[Y.m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),r);t.a=new Q},27:function(e,t,a){"use strict";a(232);var r=a(18),n=a(53),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}))},304:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return I}));var r,n,s=a(14),o=a(3),i=a.n(o),c=a(6),l=a(10),p=a(12),u=a(15),h=a(16),m=a(0),_=a.n(m),b=a(8),f=a(41),d=a(52),v=a(18),y=a(27),g=(a(1143),a(488)),k=a(471),j=a(62),O=a(144),x=a(305),w=a(480),E=a(177),N=a(221),S=a(481),C=a.n(S),q=a(235),A=a(485),z=a(224),I=(r=Object(b.b)("store"),Object(f.f)(n=r(n=Object(b.c)(n=function(t){Object(u.a)(n,t);var r=Object(h.a)(n);function n(){var e;Object(l.a)(this,n);for(var t=arguments.length,a=new Array(t),s=0;s<t;s++)a[s]=arguments[s];return(e=r.call.apply(r,[this].concat(a))).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},e.handleFile=function(t){var a=t.target.files[0];if("application/json"===a.type){var r=new FileReader;r.onload=function(t){var a=JSON.parse(t.target.result);if(a&&a.chat_list){for(var r=e.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])}e.props.store._chat_saved_list=r.concat(s),e.props.store.save_vars("_chat_saved_list")}if(a&&a.preset_list){for(var l=e.props.store._preset_saved_list,p=a.preset_list,u=[],h=0;h<p.length;h++){for(var m=!1,_=0;_<l.length;_++)if(l[_].id==p[h].id){m=!0;break}m||u.push(p[h])}e.props.store._preset_saved_list=l.concat(u),e.props.store.save_vars("_preset_saved_list")}},r.readAsText(a)}else alert("Please select a JSON file")},e}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\u8f7d\u5165\u9519\u8bef",e.t0),Object(y.b)("wasm\u8f7d\u5165\u5931\u8d25\uff0c\u8fdb\u5165\u517c\u5bb9\u6a21\u5f0f\uff0c\u5982\u9047400\u9519\u8bef\uff0c\u8bf7\u6e05\u7406\u5bf9\u8bdd\u8bb0\u5f55");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(y.b)("\u8bf7\u8f93\u5165\u6b63\u786e\u7684OpenAPI/API2D Key"),e.abrupt("return",!1);case 3:this.props.store.save_vars(),this.api2d_instance=null,Object(y.b)("\u4fdd\u5b58\u6210\u529f");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(y.b)("\u5bf9\u8bdd\u5df2\u6e05\u9664\uff0c\u53ef\u70b9\u6062\u590d\u6309\u94ae\u64a4\u9500");case 9: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,e.next=4,r.completion({messages:[{role:"system",content:"\u4f60\u662f\u4e00\u4e2a\u7ecf\u9a8c\u4e30\u5bcc\u7684\u8bb0\u5f55\u5458\uff0c\u64c5\u957f\u4ece\u5bf9\u8bdd\u4e2d\u63d0\u53d6\u5173\u952e\u4fe1\u606f\uff0c\u5e76\u4e3a\u5bf9\u8bdd\u547d\u540d\u3002"},{role:"user",content:"\u8bf7\u4e3a\u4ee5\u4e0b\u5bf9\u8bdd\u547d\u540d\uff0c\u4f18\u5148\u4f7f\u7528\u4e2d\u6587\uff0c\u76f4\u63a5\u8fd4\u56de\u540d\u79f0\uff0c\u957f\u5ea6\u5c3d\u91cf\u572830\u4e2a\u5b57\u4ee5\u5185\u3002\u5bf9\u8bdd\u5185\u5bb9\uff1a"+a}],temperature:0,max_tokens:50,model:"gpt-3.5-turbo",stream:!1});case 4: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=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.log(e.t0);case 12:case"end":return e.stop()}}),e,this,[[1,9]])})));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(),this.check_bottom_effect(),"yes"==this.props.store._chat_summarize_content&&this.rename_conversation(a,r.substring(0,800));case 11: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 g.a(this.props.store._chat_key)),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,l,p,u,h,m,_,b,f,d,v,g,k=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"),l={role:c,content:t[o].text},n.push(l);case 24:o++,e.next=16;break;case 27:return console.log("history",JSON.stringify(n)),e.prev=28,h=this.getApiInstance(),e.next=32,h.completion({messages:n,temperature:null!==(p=parseFloat(this.props.store._chat_temperature))&&void 0!==p?p:0,max_tokens:null!==(u=parseInt(this.props.store._chat_max_tokens))&&void 0!==u?u:1e3,model:this.props.store._chat_model||"gpt-3.5-turbo",stream: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),k.setState({typing:e}),document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight},onEnd:function(e){k.setState({typing:""}),document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight}});case 32:m=e.sent,console.log("ret",m),m&&(this.setState({list:this.state.list.concat({text:this.props.store._chat_stream?m.trim():null===(_=m.choices[0])||void 0===_||null===(b=_.message)||void 0===b?void 0:b.content.trim(),role:"robot"}),text:"",loading:!1}),this.props.store._chat_last=this.state.list,this.props.store.save_vars("_chat_last")),e.next=58;break;case 37:e.prev=37,e.t0=e.catch(28),d=e.t0.message,v=null===(f=d.match(/\[(\d+)\]/))||void 0===f?void 0:f[1],g="\u5bc6\u94a5",e.t1=v,e.next="400"===e.t1?45:"401"===e.t1?46:"402"===e.t1?48:"403"===e.t1?50:"408"===e.t1?52:"429"===e.t1?54:56;break;case 45:d="\u8bf7\u6c42\u53c2\u6570\u9519\u8bef\uff0c\u5386\u53f2\u8bb0\u5f55\u53ef\u80fd\u8fc7\u957f\uff0c\u8bf7\u6e05\u7406\u540e\u518d\u8bd5";case 46:return d="".concat(g,"\u9519\u8bef\u6216\u8005\u8d26\u6237\u72b6\u6001\u9519\u8bef\uff0c\u8bf7\u68c0\u67e5\uff1a").concat(g,"\u662f\u5426\u6b63\u786e\u3001").concat(g,"\u662f\u5426\u88ab\u7981\u7528"),e.abrupt("break",56);case 48:return d="\u8d26\u6237\u70b9\u6570\u4e0d\u8db3\uff0c\u8bf7\u5145\u503c\u3002BioinfoArk\u6309\u8bbe\u7f6e\u4e2d\u7684 Max token \u8fdb\u884c\u9884\u6263\uff0c\u56e0\u6b64\u5e76\u4e0d\u662f\u70b9\u6570\u5927\u4e8e\u96f6\u5c31\u53ef\u4ee5\u4f7f\u7528\u54e6~",e.abrupt("break",56);case 50:return d="\u8bf7\u6c42\u7684\u6a21\u578b\u6216\u8005\u8def\u5f84\u4e0d\u53ef\u7528\u6216\u672a\u5f00\u653e\uff0c\u8bf7\u68c0\u67e5\uff1a\u6a21\u578b\u662f\u5426\u5b58\u5728\u3001\u6a21\u578b\u662f\u5426\u88ab\u7981\u7528",e.abrupt("break",56);case 52:return d="\u8bf7\u6c42\u8d85\u65f6\uff0c\u53ef\u8c03\u6574\u5ba2\u6237\u7aef\u8bbe\u7f6e\uff1b\u670d\u52a1\u5668\u7aef\u6700\u957f\u54cd\u5e94\u65f6\u95f4\u4e3a180\u79d2",e.abrupt("break",56);case 54:return d="\u8bf7\u6c42\u8fc7\u4e8e\u9891\u7e41\uff0c\u6216\u8005\u670d\u52a1\u5668\u8fde\u63a5\u8fc7\u591a\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5",e.abrupt("break",56);case 56:Object(y.b)("\u9519\u8bef\uff1a"+d),this.setState({loading:!1,typing:""});case 58:this.refresh_point();case 59: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,l,p,u,h,m,_,b,f,d,v,g,k,j,O,x,w,E,N,S,C,q,A=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(y.b)("\u8bf7\u5148\u70b9\u51fb\u53f3\u4e0a\u89d2\u6309\u94ae\u8bbe\u7f6e".concat("\u5bc6\u94a5","\u4ee5\u540e\u518d\u4f7f\u7528")),e.abrupt("return",!1);case 3:0,a="CK208".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(y.b)("\u60a8\u7684Key\u4e0d\u80fd\u5728\u6b64\u4f7f\u7528\uff0c\u8bf7\u54a8\u8be2Key\u7684\u4f9b\u5e94\u5546"),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:"\u6b63\u5728\u601d\u8003\u4e2d...",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),l=c<0?s.slice(c):[],console.log("old",l),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}),u=0;u<l.length;u++)"me"==l[u].role?p.push({role:"user",content:l[u].text}):p.push({role:"assistant",content:l[u].text});if(0!=p.length){e.next=40;break}return Object(y.b)("\u8bb0\u5f55\u4e3a\u7a7a"),e.abrupt("return",!1);case 40:if(!this.tiktoken){e.next=85;break}if(!(h=this.tiktoken.encoding_for_model)||"object"!==typeof WebAssembly||"function"!==typeof WebAssembly.instantiate){e.next=84;break}console.log("encoding_for_model & wasm enabled"),m=this.props.store._chat_model,e.t0=m,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 m="gpt-3.5-turbo",e.abrupt("break",52);case 50:return m="gpt-4",e.abrupt("break",52);case 52:_=h(m),b=p,f=0;case 55:if(!(f<b.length)){e.next=63;break}if(!(!b[f]||"object"!==typeof b[f]||!b[f].content||b[f].content.length<1||!b[f].role||b[f].role.length<1)){e.next=59;break}return Object(y.b)("\u8bb0\u5f55\u683c\u5f0f\u9519\u8bef"),e.abrupt("return",!1);case 59:case 60:f++,e.next=55;break;case 63:d=b.map((function(e){return"<|im_start|>".concat(e.role," \n").concat(e.content,"<|im_end|>\n")})).join("")+"<|im_start|>assistant \n",console.log("wrapped",d),d=d.replaceAll("<|im_start|>"," , ").replaceAll("<|im_end|>"," , ").trim(),v=_.encode(d).length,console.log("message_tokens",v),g=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 g=4096,e.abrupt("break",78);case 74:return g=8192,e.abrupt("break",78);case 76:return g=16384,e.abrupt("break",78);case 78:if(!(v+parseInt(this.props.store._chat_max_tokens)>=g)){e.next=82;break}return Object(y.b)("\u8f93\u5165\u5185\u5bb9\u8fc7\u957f\uff0c\u8bf7\u6e05\u7406\u5bf9\u8bdd\u5386\u53f2\u6216\u8005\u51cf\u5c11\u6700\u5927token"),this.setState({loading:!1,typing:""}),e.abrupt("return",!1);case 82:e.next=85;break;case 84:console.log("load encoding fail");case 85:return e.prev=85,O="",e.next=89,o.completion({messages:p,temperature:null!==(k=parseFloat(this.props.store._chat_temperature))&&void 0!==k?k:0,max_tokens:null!==(j=parseInt(this.props.store._chat_max_tokens))&&void 0!==j?j:1e3,model:this.props.store._chat_model||"gpt-3.5-turbo",stream: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(e.length<1)return!1;if(t&&(O+=t,"\u3002"===t||"\uff01"===t||"\uff1f"===t)){var a=O;O="","yes"==A.props.store._chat_auto_audio&&a.length>1&&A.audio(a)}A.setState({typing:e}),document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight},onEnd:function(e){A.setState({typing:""}),document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight,"yes"==A.props.store._chat_auto_audio&&O.length>1&&A.audio(O)}});case 89:(x=e.sent)&&(this.setState({list:this.state.list.concat({text:this.props.store._chat_stream?x.trim():null===(w=x.choices[0])||void 0===w||null===(E=w.message)||void 0===E?void 0:E.content.trim(),role:"robot"}),text:"",loading:!1}),this.props.store._chat_last=this.state.list,this.props.store.save_vars("_chat_last")),e.next=114;break;case 93:e.prev=93,e.t2=e.catch(85),S=e.t2.message,C=null===(N=S.match(/\[(\d+)\]/))||void 0===N?void 0:N[1],q="\u5bc6\u94a5",e.t3=C,e.next="400"===e.t3?101:"401"===e.t3?102:"402"===e.t3?104:"403"===e.t3?106:"408"===e.t3?108:"429"===e.t3?110:112;break;case 101:S="\u8bf7\u6c42\u53c2\u6570\u9519\u8bef\uff0c\u5386\u53f2\u8bb0\u5f55\u53ef\u80fd\u8fc7\u957f\uff0c\u8bf7\u6e05\u7406\u540e\u518d\u8bd5";case 102:return S="".concat(q,"\u9519\u8bef\u6216\u8005\u8d26\u6237\u72b6\u6001\u9519\u8bef\uff0c\u8bf7\u68c0\u67e5\uff1a").concat(q,"\u662f\u5426\u6b63\u786e\u3001").concat(q,"\u662f\u5426\u88ab\u7981\u7528"),e.abrupt("break",112);case 104:return S="\u8d26\u6237\u70b9\u6570\u4e0d\u8db3\uff0c\u8bf7\u5145\u503c\u3002BioinfoArk\u6309\u8bbe\u7f6e\u4e2d\u7684 Max token \u8fdb\u884c\u9884\u6263\uff0c\u56e0\u6b64\u5e76\u4e0d\u662f\u70b9\u6570\u5927\u4e8e\u96f6\u5c31\u53ef\u4ee5\u4f7f\u7528\u54e6~",e.abrupt("break",112);case 106:return S="\u8bf7\u6c42\u7684\u6a21\u578b\u6216\u8005\u8def\u5f84\u4e0d\u53ef\u7528\u6216\u672a\u5f00\u653e\uff0c\u8bf7\u68c0\u67e5\uff1a\u6a21\u578b\u662f\u5426\u5b58\u5728\u3001\u6a21\u578b\u662f\u5426\u88ab\u7981\u7528",e.abrupt("break",112);case 108:return S="\u8bf7\u6c42\u8d85\u65f6\uff0c\u53ef\u8c03\u6574\u5ba2\u6237\u7aef\u8bbe\u7f6e\uff1b\u670d\u52a1\u5668\u7aef\u6700\u957f\u54cd\u5e94\u65f6\u95f4\u4e3a180\u79d2",e.abrupt("break",112);case 110:return S="\u8bf7\u6c42\u8fc7\u4e8e\u9891\u7e41\uff0c\u6216\u8005\u670d\u52a1\u5668\u8fde\u63a5\u8fc7\u591a\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5",e.abrupt("break",112);case 112:Object(y.b)("\u9519\u8bef\uff1a"+S),this.setState({loading:!1,typing:""});case 114:document.querySelector(".input-box").focus(),document.querySelector(".chat-list").scrollTop=document.querySelector(".chat-list").scrollHeight,window.setTimeout((function(){A.refresh_point()}),1e3),e.next=124;break;case 119:e.prev=119,e.t4=e.catch(26),console.log("error",e.t4),Object(y.b)("\u53d1\u9001\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5".concat("\u5bc6\u94a5","\u548cAPI\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u6216\u91cd\u8bd5\u3002")+JSON.stringify(e.t4)),this.setState({loading:!1});case 124:case"end":return e.stop()}}),e,this,[[26,119],[85,93]])})));return function(t){return e.apply(this,arguments)}}()},{key:"warning",value:function(e){"gpt-4"==e&&Object(y.b)("4\u6a21\u578b\u4ef7\u683c\u662f3.5\u768415~30\u500d\uff0c\u4e14\u8fd4\u56de\u8f83\u6162\u5bb9\u6613\u8d85\u65f6\uff0c\u8bf7\u8c28\u614e\u4f7f\u7528\u3002"),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(q.saveAs)(a,"".concat("BioinfoArk",".\u5bf9\u8bdd\u8bb0\u5f55.json"))):(r=JSON.stringify({preset_list:this.props.store._preset_saved_list}),n=new Blob([r],{type:"application/json"}),Object(q.saveAs)(n,"".concat("BioinfoArk",".\u5e38\u7528\u63d0\u793a\u8bcd.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("\u6709\u6eda\u52a8\u6761"),document.querySelector(".bottom-effect").style.display="block",document.querySelector(".bottom-effect").style.bottom="0"):(document.querySelector(".bottom-effect").style.display="none",console.log("\u6ca1\u6709\u6eda\u52a8\u6761"))}},{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(y.b)("\u5df2\u8f7d\u5165\u5386\u53f2\u4f1a\u8bdd\u8bb0\u5f55\uff0c\u53ef\u70b9\u51fb\u5bf9\u8bdd\u6700\u4e0a\u65b9\u7684\u64a4\u9500\u6309\u94ae\u6062\u590d\u539f\u6709\u5bf9\u8bdd");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(y.b)("\u83b7\u53d6\u70b9\u6570\u5931\u8d25\uff1a"+a.message),a.total_available&&(r=(r=a.total_available*(parseFloat("1")||1)).toFixed(parseInt("0")||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(y.b)("\u83b7\u53d6\u70b9\u6570\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u8bf7\u6c42\u5730\u5740\u548cKey\uff1a"+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(y.b)("\u68c0\u6d4b\u5230\u60a8\u4f7f\u7528\u7684\u662fForward Key\uff0c\u5df2\u81ea\u52a8\u5207\u6362API\u5730\u5740")),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(y.b)("\u5f53\u524d\u6a21\u578b\u6700\u5927tokens\u4e3a"+t+"\uff0c\u60a8\u8bbe\u7f6e\u7684max tokens\u592a\u5927\uff0c\u65e0\u6cd5\u6b63\u5e38\u804a\u5929\uff0c\u8bf7\u91cd\u65b0\u8bbe\u7f6e"),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;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.innerHTML=document.querySelector(".chat-list").innerHTML,e.next=3,C()(document.querySelector("#snap_tmp"),{scale:2});case 3:a=e.sent,n.setState({snap:!1}),r=Date.now(),Object(q.saveAs)(a.toDataURL(),"".concat(n.props.store.appname||"Chat\u9171","-")+r+".png"),document.querySelector("#snap_tmp").remove();case 8: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(y.b)("\u6807\u9898\u4e0d\u80fd\u4e3a\u7a7a"),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(y.b)("\u63d0\u793a\u8bcd\u4e0d\u80fd\u90fd\u4e3a\u7a7a"),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}));this.setState({text:this.state.text+t.user}),document.querySelector(".input-box").focus()}},{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(y.b)("\u53ea\u6709API2D\u7684Key\u53ef\u652f\u6301\u8bed\u97f3"),e.abrupt("return",!1);case 3:return e.t0=String,e.next=6,Object(A.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=_.a.createElement("div",{className:"right-box"},_.a.createElement("div",{className:"row flex md:flex-row flex-col"},_.a.createElement("div",{className:"left flex-1"}),_.a.createElement("div",{className:"right"},_.a.createElement(v.e,{vertical:window.innerWidth<600},window.innerWidth>=600&&window.electronAPI&&(null===(t=window.electronAPI)||void 0===t?void 0:t.pinWindow)&&_.a.createElement(v.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(y.b)("\u5df2\u5c06\u7a97\u53e3\u7f6e\u4e8e\u6700\u4e0a\u65b9")},large:!0}),this.props.store._chat_key&&this.props.store._chat_key.startsWith("fk")&&_.a.createElement(v.h,{className:"md:w-40 w-full",large:!0,rightElement:_.a.createElement(v.b,{icon:"refresh",minimal:!0,onClick:function(){return o.refresh_point()},large:!0}),value:this.state.point+"P",title:"\u4f59\u989d",readOnly:!0}),_.a.createElement(v.b,{icon:"key",onClick:function(){return o.setState({settings_open:!0})},large:!0},"\u70b9\u6b64\u8f93\u5165\u5bc6\u94a5"),window.innerWidth>=600&&null))),_.a.createElement("div",{className:"chat-list"},this.state.show_undo?_.a.createElement("div",{className:"text-center gray-btn gray-text"},_.a.createElement(v.c,null,_.a.createElement(v.b,{icon:"undo",minimal:!0,onClick:function(){return o.undo_conversation()}},"\u64a4\u9500"))):null,this.state.list&&this.state.list.map((function(e,t){var a,r;return _.a.createElement("div",{className:"chat-item ".concat(e.role),key:t},_.a.createElement("div",{className:"chat-text content"},_.a.createElement(x.a,{markdown:null===(a=e.text)||void 0===a?void 0:a.trim()}),_.a.createElement("div",{className:"flex flex-row float-icons"},_.a.createElement("span",{className:"remove"},_.a.createElement(v.b,{icon:"trash",small:!0,minimal:!0,title:"\u5220\u9664",onClick:function(){return o.remove_chat_line(t)}})),_.a.createElement("span",{className:"copy"},_.a.createElement(N.CopyToClipboard,{text:null===(r=e.text)||void 0===r?void 0:r.trim(),onCopy:function(){return Object(y.b)("Markdown\u5df2\u590d\u5236\u5230\u526a\u8d34\u677f")}},_.a.createElement(v.b,{icon:"duplicate",small:!0,minimal:!0,title:"\u590d\u5236markdown"}))),_.a.createElement("span",{className:"audio"},_.a.createElement(v.b,{icon:"volume-up",onClick:function(){return o.audio(e.text)},small:!0,minimal:!0,title:"\u8bed\u97f3"})))))})),this.state.typing&&_.a.createElement("div",{className:"chat-item robot"},_.a.createElement("div",{className:"chat-text content"},_.a.createElement(v.n,{size:12,className:"mr-2"}),_.a.createElement(x.a,{markdown:null===(a=this.state.typing)||void 0===a?void 0:a.trim()}),_.a.createElement(v.b,{icon:"cross",minimal:!0,onClick:function(){return o.abort()}}))),this.state.list&&this.state.list.length>0&&_.a.createElement("div",{className:"text-center gray-btn xs-btn gray-text"},this.state.snap?_.a.createElement("div",{className:"text-center mt-2"},_.a.createElement("span",{className:"text-gray-400 p-2 px-3 "},"- By ".concat("BioinfoArk").concat(" \xb7 http://www.bioinfoark.com/"," -"))):_.a.createElement(v.c,null,_.a.createElement(v.b,{icon:"refresh",small:!0,minimal:!0,onClick:function(){return o.regen_conversation()}},"\u91cd\u65b0\u751f\u6210"),_.a.createElement(v.b,{icon:"eraser",small:!0,minimal:!0,onClick:function(){return o.clean_conversation(!1)}},"\u6e05\u7a7a\u8bb0\u5f55"),_.a.createElement(v.b,{icon:"download",small:!0,minimal:!0,onClick:function(){return o.export_conversation()}},"\u5bfc\u51fa\u622a\u56fe")))),_.a.createElement("div",{className:"chat-box"},_.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())}},_.a.createElement(v.q,{growVertically:!0,large:!0,rows:4,disabled:this.state.loading,placeholder:"\u8f93\u5165\u4f60\u7684\u95ee\u9898",autoFocus:!0,className:"input-box",onChange:function(e){return o.onChange(e,"text")},value:this.state.text}),_.a.createElement("div",{className:"flex md:flex-row md:justify-between flex-col items-center mb-2"},_.a.createElement("div",{className:"left flex flex-row items-center"},_.a.createElement(k.a,{onUpdate:function(e){return o.warning(e)},className:"mt-2 mb-2 md:mb-0 md:block hidden",field:"_chat_model",options:[{label:"GPT3.5",value:"gpt-3.5-turbo"},{label:"GPT3.5-16K",value:"gpt-3.5-turbo-16k"},{label:"GPT4",value:"gpt-4"}]}),_.a.createElement("div",{className:"mt-2 md:hidden block mr-1"},_.a.createElement(v.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")),_.a.createElement(v.c,{className:"mt-2 md:mt-0"},_.a.createElement(v.b,{large:!0,className:"md:mt-2 md:ml-1",icon:this.state.loading?_.a.createElement(v.n,{size:12}):"send-message",type:"submit",disabled:this.state.loading},this.state.loading?"\u8bf7\u7a0d\u5019":"\u53d1\u9001(cmd/ctrl+enter)"),_.a.createElement(v.b,{large:!0,className:"md:mt-2 ",icon:"clean",onClick:function(){return o.clean_conversation()}},"\u65b0\u5bf9\u8bdd"))),_.a.createElement("div",{className:"right hidden md:block flex flex-row items-center justify-center"},"yes"!=this.props.store._chat_auto_save?_.a.createElement(v.b,{large:!0,className:"mt-2 ml-2",icon:"floppy-disk",onClick:function(){return o.save_conversation()}},"\u4fdd\u5b58\u5bf9\u8bdd"):_.a.createElement(E.a,{onUpdate:function(){return o.props.store.save_vars()},field:"_chat_auto_save",label:"\u81ea\u52a8\u4fdd\u5b58\u4f1a\u8bdd",className:"no-margin",options:[{label:"\u662f",value:"yes"},{label:"\u5426",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:"\u8bf7\u9009\u62e9",value:""});var c=_.a.createElement("div",{className:"prompt-tab"},_.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 _.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)}},_.a.createElement("div",{className:"left flex flex-row items-center"},e.title.substring(0,30)),_.a.createElement("div",{className:"right action-icon ml-2 gray-btn"},_.a.createElement(v.b,{small:!0,minimal:!0,icon:"edit",title:"\u7f16\u8f91",onClick:function(t){o.edit_prompt(e.id),t.preventDefault(),t.stopPropagation()}}),_.a.createElement(v.b,{small:!0,minimal:!0,icon:"cross",title:"\u5220\u9664",onClick:function(t){o.remove_prompt(e.id),t.preventDefault(),t.stopPropagation()}})))}))),_.a.createElement("div",{className:"bottom-effect"}))),l=_.a.createElement("div",{className:"history-tab"},_.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 _.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"},_.a.createElement("div",{className:"left flex flex-row items-center"},e.name.substring(0,30)),_.a.createElement("div",{className:"right action-icon ml-2 gray-btn"},_.a.createElement(v.b,{small:!0,minimal:!0,icon:"history",title:"\u8f7d\u5165",onClick:function(){return o.load_list(JSON.stringify(e.list))}}),_.a.createElement(v.b,{small:!0,minimal:!0,icon:"cross",title:"\u5220\u9664",onClick:function(){return o.remove_list(e.id)}})))}))),_.a.createElement("div",{className:"bottom-effect"}))),p=_.a.createElement("div",{className:"left-box flex-1"},_.a.createElement("div",null,_.a.createElement("div",{className:"text-lg mb-2 text-gray-300 mt-6 mr-2 flex flex-row w-48"},_.a.createElement(v.p,{id:"left-tab",onChange:function(e){o.setState({tab_selected:e})},selectedTabId:this.state.tab_selected,className:"w-full"},_.a.createElement(v.o,{id:"prompt",title:"\u63d0\u793a\u8bcd",panel:c}),_.a.createElement(v.o,{id:"history",title:"\u5bf9\u8bdd\u8bb0\u5f55",panel:l}),_.a.createElement(v.p.Expander,null),_.a.createElement(v.c,null,"prompt"==this.state.tab_selected&&_.a.createElement(v.b,{onClick:function(){return o.prompt_add()},icon:"plus",className:"gray-btn",minimal:!0,title:"\u6dfb\u52a0\u9884\u7f6e\u63d0\u793a\u8bcd"}),_.a.createElement(v.b,{onClick:function(){return o.fileInput.click()},icon:"circle-arrow-up",className:"gray-btn",minimal:!0,title:"\u5bfc\u5165"}),_.a.createElement("input",{type:"file",accept:".json",ref:function(e){o.fileInput=e},style:{display:"none"},onChange:this.handleFile}),_.a.createElement(v.b,{icon:"circle-arrow-down",className:"gray-btn",minimal:!0,onClick:function(){return o.export(o.state.tab_selected)},title:"\u5bfc\u51fa"}))))),_.a.createElement("div",{className:null!==(s="char-box opacity-"+this.props.store._chat_char_opacity)&&void 0!==s?s:80},_.a.createElement("img",{src:this.props.store._chat_avatar_url||"http://mymdimg.oss-cn-hangzhou.aliyuncs.com/bioinfoark.jpeg",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(z.a)("width: 160px;")}),_.a.createElement(w.a,{className:"slider",field:"_chat_char_opacity",min:10,stepSize:10,labelStepSize:10,onUpdate:function(){return o.props.store.save_vars()}}))),u=(window.origin,encodeURIComponent(e.from(JSON.stringify({_chat_key:this.props.store._chat_key,_chat_api_url:this.props.store._chat_api_url})).toString("base64")),_.a.createElement(v.a,{large:!0,icon:"key",href:"http://www.bioinfoark.com".replaceAll("{{key}}",encodeURIComponent(e.from(this.props.store._chat_key).toString("base64"))),target:"_blank"},"\u70b9\u6b64\u83b7\u5f97key")),h="c.level06.com"==window.location.hostname||"dd.ftqq.com"==window.location.hostname?_.a.createElement(v.a,{large:!0,icon:"cog",className:"ml-2",href:"https://a.ftqq.com/2023/04/24/chatyou-custom-platform",target:"_blank"},"\u5b9a\u5236Chat\u9171"):null,m=_.a.createElement("div",{className:"flex flex-row chat-page"},p,i,_.a.createElement(v.f,{isOpen:this.state.settings_open,title:"\u8bbe\u7f6e",icon:"info-sign",onClose:function(){return o.setState({settings_open:!1})}},_.a.createElement("div",{className:"p-5 mt-2"},_.a.createElement(_.a.Fragment,null,_.a.createElement(j.a,{field:"_chat_key",label:"\u5bc6\u94a5",placeholder:"\u8bf7\u8f93\u5165fk\u5f00\u5934\u7684\u90a3\u4e32\u957f\u957f\u7684\u5bc6\u94a5\u54e6~"})),null,_.a.createElement("div",{className:"flex flex-row mb-5 items-center"},_.a.createElement(v.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})}},"\u9ad8\u7ea7\u8bbe\u7f6e"),null,h),this.state.show_extend_settings?_.a.createElement(_.a.Fragment,null,_.a.createElement("div",{className:"flex flex-row"},_.a.createElement(j.a,{field:"_chat_max_tokens",label:"Max Tokens",placeholder:"\u6700\u5927 token \u6570\u91cf\uff0c\u4e00\u822c\u804a\u59291000\u5373\u53ef\uff0c3.5\u6700\u5927\u4e3a4000,4\u4e3a8000\uff0c\u5426\u5219\u5bb9\u6613\u51fa\u9519",className:"mr-2 flex-1"}),_.a.createElement(j.a,{field:"_chat_temperature",label:"\u53d1\u6563\u5ea6",placeholder:"Temperature\uff0c\u53d1\u6563\u7a0b\u5ea6\uff0c0~2\u4e4b\u95f4\uff0c\u8d8a\u5927\u8d8a\u53d1\u6563",className:"flex-1 mr-2"}),_.a.createElement(j.a,{field:"_chat_timeout",label:"\u8d85\u65f6\u65f6\u95f4\xb7\u79d2",placeholder:"\u8d85\u65f6\u4f1a\u81ea\u52a8\u7ec8\u6b62\u8bf7\u6c42",className:"mr-2 flex-1"}),_.a.createElement(j.a,{field:"_chat_history_count",label:"\u5386\u53f2\u4e0a\u4e0b\u6587\u6570\u91cf",placeholder:"\u6bcf\u6b21\u9644\u5e26\u7684\u4e0a\u4e0b\u6587\u6761\u6570\uff0c\u4f1a\u53d7 Max tokens\u9650\u5236",className:"flex-1"})),_.a.createElement("div",{className:"flex flex-row"},_.a.createElement(E.a,{field:"_chat_auto_save",label:"\u81ea\u52a8\u4fdd\u5b58\u4f1a\u8bdd",className:"mr-2",options:[{label:"\u662f",value:"yes"},{label:"\u5426",value:"no"}]}),_.a.createElement(E.a,{field:"_chat_summarize_content",label:"\u4f7f\u7528GPT\u751f\u6210\u4f1a\u8bdd\u6807\u9898"}),this.props.store._chat_key.startsWith("fk")?_.a.createElement(E.a,{field:"_chat_auto_audio",label:"\u81ea\u52a8\u6717\u8bfb\u56de\u7b54"}):null),_.a.createElement(j.a,{field:"_chat_system_prompt",label:"\u7cfb\u7edf\u63d0\u793a\u8bcd",placeholder:"system prompt"}),_.a.createElement(j.a,{field:"_chat_user_prompt",label:"\u7528\u6237\u63d0\u793a\u8bcd",placeholder:"user prompt"})):null,_.a.createElement(O.a,{onSubmit:function(){return o.save()},cancel:_.a.createElement("div",{className:"flex flex-row"},u)}),_.a.createElement("div",{className:"text-center box-footer text-gray-400"},"- ","BioinfoArk "+"".concat(this.props.store.version)," -"))),_.a.createElement(v.f,{isOpen:this.state.avatar_open,title:"\u8bbe\u7f6e\u804a\u5929\u52a9\u7406\u548c\u80cc\u666f",icon:"info-sign",onClose:function(){return o.setState({avatar_open:!1})}},_.a.createElement("div",{className:"p-5 mt-2"},_.a.createElement(j.a,{field:"_chat_avatar_url",placeholder:"\u8bf7\u7c98\u8d34\u4e00\u4e2a\u53ef\u4ee5\u8bbf\u95ee\u7684\u56fe\u7247URL\uff0c\u6700\u597d\u80cc\u666f\u900f\u660e\uff0c\u5982https://..."}),_.a.createElement(j.a,{field:"_chat_bg_url",placeholder:"\u80cc\u666f\u56fe\u7247URL\uff0c\u5982https://..."}),_.a.createElement(O.a,{onSubmit:function(){return o.avatar_save()},cancel:_.a.createElement(v.b,{onClick:function(){return o.setState({avatar_open:!1})},large:!0},"\u5173\u95ed")}))),_.a.createElement(v.f,{isOpen:this.state.prompt_box,title:"\u5e38\u7528\u63d0\u793a\u8bcd",icon:"info-sign",onClose:function(){return o.prompt_box_clean(!0)}},_.a.createElement("div",{className:"p-5 mt-2"},_.a.createElement(j.a,{field:"_preset_prompt_title",placeholder:"\u63d0\u793a\u8bcd\u6807\u9898"}),_.a.createElement(j.a,{type:"textarea",field:"_preset_user_prompt",placeholder:"user prompt",fill:!0}),_.a.createElement(O.a,{onSubmit:function(){return o.prompt_save()},cancel:_.a.createElement(v.b,{onClick:function(){return o.prompt_box_clean(!0)},large:!0},"\u5173\u95ed")}))));return _.a.createElement(d.a,{title:this.props.store.appname,main:m})}}]),n}(m.Component))||n)||n)||n)}).call(this,a(56).Buffer)},305:function(e,t,a){"use strict";a.d(t,"a",(function(){return j}));var r,n,s=a(57),o=a(10),i=a(12),c=a(15),l=a(16),p=a(0),u=a.n(p),h=a(8),m=a(41),_=a(1464),b=a(487),f=a(1465),d=a(1463),v=a(486),y=a(221),g=a(18),k=a(27),j=(r=Object(h.b)("store"),Object(m.f)(n=r(n=Object(h.c)(n=function(e){Object(c.a)(a,e);var t=Object(l.a)(a);function a(){return Object(o.a)(this,a),t.apply(this,arguments)}return Object(i.a)(a,[{key:"render",value:function(){return u.a.createElement(_.a,{remarkPlugins:[v.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 u.a.createElement("code",Object.assign({},n,{className:a}),r);var o=/language-(\w+)/.exec(a||"");return t?u.a.createElement("code",Object.assign({className:a},n),r):u.a.createElement("div",{className:"code-box my-2"},u.a.createElement(f.a,Object.assign({children:String(r).replace(/\n$/,""),style:d.a,language:o&&o[1]?o[1]:"bash",PreTag:"div"},n)),u.a.createElement(y.CopyToClipboard,{className:"code-copy",text:String(r),onCopy:function(){return Object(k.b)("\u4ee3\u7801\u5df2\u590d\u5236")}},u.a.createElement(g.b,{icon:"code"},"\u590d\u5236\u4ee3\u7801")))},img:function(e){var t=e.src,a=e.alt;return u.a.createElement(b.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 _}));var r,n,s=a(10),o=a(12),i=a(15),c=a(16),l=a(0),p=a.n(l),u=a(8),h=a(41),m=a(484),_=(r=Object(u.b)("store"),Object(h.f)(n=r(n=Object(u.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(m.a,{menuPlacement:this.props.menuPosition||"auto",placeholder:this.props.placeholder||"\u8bf7\u9009\u62e9",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}(l.Component))||n)||n)||n)},480:function(e,t,a){"use strict";a.d(t,"a",(function(){return _}));var r,n,s=a(10),o=a(12),i=a(15),c=a(16),l=a(0),p=a.n(l),u=a(8),h=a(41),m=a(18),_=(r=Object(u.b)("store"),Object(h.f)(n=r(n=Object(u.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(m.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}(l.Component))||n)||n)||n)},483:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return b}));var r,n,s=a(10),o=a(12),i=a(15),c=a(16),l=a(0),p=a.n(l),u=a(8),h=a(41),m=a(52),_=a(18),b=(r=Object(u.b)("store"),Object(h.f)(n=r(n=Object(u.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(_.n,null)));return p.a.createElement(m.a,{title:this.props.store.appname,main:e})}}]),r}(l.Component))||n)||n)||n)}).call(this,a(56).Buffer)},52:function(e,t,a){"use strict";var r,n,s,o,i,c,l,p,u,h,m,_,b=a(10),f=a(12),d=a(15),v=a(16),y=a(0),g=a.n(y),k=a(8),j=a(41),O=a(466),x=a.n(O),w=a(29),E=(r=Object(k.b)("store"),Object(j.f)(n=r(n=Object(k.c)(n=function(e){Object(d.a)(a,e);var t=Object(v.a)(a);function a(){return Object(b.a)(this,a),t.apply(this,arguments)}return Object(f.a)(a,[{key:"render",value:function(){var e=this.props.data;return e?g.a.createElement("div",{className:"user-span"},g.a.createElement("img",{src:e.avatar_url,className:"avatar"}),e.name,e.coin>=0&&g.a.createElement("span",{className:"coin bg-blue-500 text-white font-mono text-xs"},e.coin)):null}}]),a}(y.Component))||n)||n),a(57)),N=a(18),S=a(53),C=a(1504),q=a(169),A=(s=Object(k.b)("store"),Object(j.f)(o=s(o=Object(k.c)(o=function(e){Object(d.a)(a,e);var t=Object(v.a)(a);function a(){return Object(b.a)(this,a),t.apply(this,arguments)}return Object(f.a)(a,[{key:"render",value:function(){var e=this,t=g.a.createElement(N.i,{className:"border"},g.a.createElement(N.k,{icon:"person",text:"\u6211\u7684",onClick:function(){return e.props.history.push("/profile")}}),g.a.createElement(N.k,{icon:"dollar",text:"\u5145\u503c",onClick:function(){return e.props.history.push("/recharge")}}),g.a.createElement(N.j,null),g.a.createElement(N.k,{icon:"log-out",text:"\u9000\u51fa",onClick:function(){return e.props.history.push("/logout")}})),a=this.props,r=(a.staticContext,Object(E.a)(a,["staticContext"]));return g.a.createElement("div",r,this.props.store.user?g.a.createElement(C.a,{autoFocus:!1,content:t,position:S.a.BOTTOM_RIGHT},g.a.createElement(N.b,{rightIcon:"caret-down",minimal:!0})):g.a.createElement(q.a,{minimal:!0}))}}]),a}(y.Component))||o)||o),i=Object(k.b)("store"),Object(j.f)(c=i(c=Object(k.c)(c=function(e){Object(d.a)(a,e);var t=Object(v.a)(a);function a(){return Object(b.a)(this,a),t.apply(this,arguments)}return Object(f.a)(a,[{key:"render",value:function(){var e=this,t=this.props,a=(t.staticContext,Object(E.a)(t,["staticContext"]));return g.a.createElement("div",a,g.a.createElement("div",{className:"flex flex-row items-center"},this.props.store.menu&&g.a.createElement(g.a.Fragment,null," ",g.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"},g.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?g.a.createElement(w.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}(y.Component))||c)||c)||c);l=Object(k.b)("store"),Object(j.f)(p=l(p=Object(k.c)(p=function(e){Object(d.a)(a,e);var t=Object(v.a)(a);function a(){return Object(b.a)(this,a),t.apply(this,arguments)}return Object(f.a)(a,[{key:"render",value:function(){this.props.store.user;return g.a.createElement("div",{className:(this.props.className||"")+" header"},g.a.createElement("div",{className:"container mx-auto"},g.a.createElement("div",{className:"left flex flex-row items-center"},g.a.createElement(w.b,{to:"/"},this.props.store.appname),g.a.createElement(A,{className:"ml-5 hidden md:block"})),g.a.createElement("div",{className:"right"})))}}]),a}(y.Component))||p)||p),u=Object(k.b)("store"),Object(j.f)(h=u(h=Object(k.c)(h=function(e){Object(d.a)(a,e);var t=Object(v.a)(a);function a(){return Object(b.a)(this,a),t.apply(this,arguments)}return Object(f.a)(a,[{key:"render",value:function(){return g.a.createElement("div",{className:(this.props.className||"")+" footer"},"\u65b9\u7cd6\u6c14\u7403 \ud83c\udf88 ftqq.com")}}]),a}(y.Component))||h)||h);a.d(t,"a",(function(){return z}));var z=(m=Object(k.b)("store"),Object(j.f)(_=m(_=Object(k.c)(_=function(e){Object(d.a)(a,e);var t=Object(v.a)(a);function a(){return Object(b.a)(this,a),t.apply(this,arguments)}return Object(f.a)(a,[{key:"render",value:function(){return g.a.createElement(x.a,{title:this.props.title||this.props.store.appname},g.a.createElement(g.a.Fragment,null,this.props.store._chat_bg_url?g.a.createElement("div",{className:"chat-bg"}," ",g.a.createElement("img",{src:this.props.store._chat_bg_url,onError:function(e){return e.target.style.display="none"},referrerPolicy:"no-referrer"})):null,g.a.createElement("div",{className:""},g.a.createElement("div",{className:"body container mx-auto"},this.props.main)),g.a.createElement("div",{className:"drag-handle w-full h-5 fixed top-0 "})))}}]),a}(y.Component))||_)||_)||_)},600:function(e,t,a){e.exports=a(1462)},605:function(e,t,a){},62:function(e,t,a){"use strict";a.d(t,"a",(function(){return _}));var r,n,s=a(10),o=a(12),i=a(15),c=a(16),l=a(0),p=a.n(l),u=a(8),h=a(41),m=a(18),_=(r=Object(u.b)("store"),Object(h.f)(n=r(n=Object(u.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(m.g,{label:this.props.label,className:this.props.lineClass||""},"textarea"==this.props.type?p.a.createElement(m.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(m.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}(l.Component))||n)||n)||n)}},[[600,1,2]]]); |