filecat 6.40.1 → 6.41.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/{1472.105ab1842cd67fc0bd6d.js → 1472.d58726aaf7d732bdffdf.js} +1 -1
- package/build/dist/2562.956ee307dc4032dee7a8.js +1 -0
- package/build/dist/2851.b4b84820b81113718235.js +1 -0
- package/build/dist/dark.css +47 -1
- package/build/dist/google-dark.css +47 -1
- package/build/dist/index.html +1 -1
- package/build/dist/main.d4d0e1488172d9946488.js +2 -0
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/2851.9932d366079562f5ee01.js +0 -1
- package/build/dist/9258.21069de8306973ad782d.js +0 -1
- package/build/dist/main.ae355e9056e258ac5497.js +0 -2
- /package/build/dist/{main.ae355e9056e258ac5497.js.LICENSE.txt → main.d4d0e1488172d9946488.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2851],{75897(e,t,s){s.d(t,{L:()=>a});let n=function(e){return e.username="username",e.password="password",e.password_hash="password_hash",e.navindex_remote_ssh_key="navindex_remote_ssh_key",e.user_id_name_mapping="user_id_name_mapping",e.user_id_info_data_mapping="user_id_info_data_mapping",e.user_unique_id_num="user_unique_id_num",e.role_unique_id_num="role_unique_id_num",e.sys_all_roles="sys_all_roles",e.ddns_http_url_key="ddns_http_url_key",e.ddns_tx_key="tengxun_ddns_key",e.ddns_dnspod_key="ddns_dnspod",e.ddns_ali_key="ali_ddns_key",e.navindex_net_key_list="navindex_net_key_list",e.navindex_wol_key="navindex_wol_key",e.customer_router_key="customer_router_key",e.customer_workflow_router_key="customer_workflow_router_key",e.customer_api_router_key="customer_api_router_key",e.token_setting="token_setting",e.sys_software="sys_software",e.protection_directory="sys_protection_directory",e.dir_upload_max_num="dir_upload_max_num",e.self_auth_jscode="self_auth_jscode",e.navindex_video_key="navindex_video_tag_key",e.systemd_key="systemd_key",e.vir_server_data_key="vir_server_net_data_key",e.vir_client_data_key="vir_client_net_data_key",e.vir_data_client_hash_key="vir_data_client_hash_key",e.vir_data_server_hash_key="vir_data_server_hash_key",e.language="user_language",e.navindex_rdp_key="navindex_rdp_tag_key",e.navindex_key="navindex_key_list",e.http_tag_key="http_tag_key",e.self_shell_cmd_check_open_status="self_shell_cmd_check_open_status",e.self_shell_cmd_jscode="self_shell_cmd_jscode",e.extra_env_path_list_key="extra_env_path_list_key",e.cmd_use_pty_key="cmd_use_pty_key",e.recycle_bin_key="recycle_bin_key",e.recycle_bin_status="recycle_bin_status",e.guid_key="guid_key",e.tcp_proxy_key="tcp_proxy_key",e.sys_env_key="sys_env_key",e.http_server_key="http_server_key",e.proxy_server_code_prefix="proxy_server_code_prefix",e.ai_agent_model_setting="ai_agent_model_setting",e.ai_agent_mcp_setting="ai_agent_mcp_setting",e.ai_agent_docs_setting="ai_agent_docs_setting",e.ai_agent_chat_session_store="ai_agent_chat_session_store",e.share_file_list_key="share_file_list_key",e.share_file_list_key_download_statics="share_file_list_key_download_statics",e.tcp_proxy_server_base="tcp_proxy_server_base",e.tcp_proxy_server_client_list="tcp_proxy_server_client_list",e.tcp_proxy_client_fig="tcp_proxy_client_fig",e.tcp_proxy_client_all_fig="tcp_proxy_client_all_fig",e.tcp_proxy_sync_task_list="tcp_proxy_sync_task_list",e.workflow_setting_item_list="workflow_setting_item_list",e.server_bridge_config_list="server_bridge_config_list",e.ai_agent_status="ai_agent_status",e.ai_system_prompts="ai_system_prompts",e.filecat_plugin_list="filecat_plugin_list",e.https_setting="https_setting",e.ai_rebot_setting="ai_rebot_setting",e.token_cache="token_cache",e.auto_upgrade_setting="auto_upgrade_setting",e.ai_long_term_memory_setting="ai_long_term_memory_setting",e}({});const a=n.self_auth_jscode},8694(e,t,s){s.d(t,{$K:()=>o,RB:()=>i,l5:()=>l,qB:()=>n,vo:()=>r,vr:()=>c});class n{targetProxyUrl;proxyPort;sysProxyPort}let a=function(e){return e[e.tcp=0]="tcp",e[e.udp=1]="udp",e}({});class o{open=!1;port;key="";async_ips=[]}class r{client_num_id;client_name;open=!1;ip;mask;serverIp;serverPort;key="";model=a.udp}let i=function(e){return e[e.row=1]="row",e[e.json=2]="json",e[e.form=3]="form",e}({});class c{body_type;header_type;url;method;headers;data;form_data_list;local_download_path}class l{enabled;ip;port;bypass;useForLocal;type}},77481(e,t,s){s.d(t,{S:()=>r,X:()=>o});var n=s(96540),a=s(74848);function o(e){const[t,s]=n.useState([]);return(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]),(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((e,t)=>(0,a.jsx)("th",{children:e},t))})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>(0,a.jsx)("tr",{onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},children:t.map((s,n)=>(0,a.jsx)("td",{style:{width:e.width??"auto"},className:n===t.length-1?"small":"",children:s},n))},s))})]})}function r(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},42851(e,t,s){s.r(t),s.d(t,{default:()=>F});var n=s(96540),a=s(75725),o=s(14284),r=s(62042),i=s(53459),c=s(70447),l=s(61443),d=s(85997),_=s(77481),p=s(8694),h=s(14944),u=s(92275),x=s(22022),m=s(57952),y=s(74848);function v(e){const{t}=(0,x.Bd)(),[s,v]=(0,n.useState)(void 0),[j,g]=(0,n.useState)(!1),[k,f]=(0,n.useState)(""),[S,w]=(0,n.useState)([t(`${t("名称")}`),t(`${t("虚拟")}ip`),`${t("物理")}信息`,t("在线状态"),t("选择")]),[C,b]=(0,n.useState)([]),[I,A]=(0,n.useState)({}),[U,P]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{const e=new u.hf(u.HK.vir_net_serverIno_get);h.ws.addMsg(u.HK.vir_net_serverIno_get,e=>{(e=>{for(const s of e){const e=s[s.length-1];s[s.length-1]=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.fq,{ok:e}),t(e?"在线":"离线")]}),s[0]=(0,y.jsx)(c.xP,{context:s[0],tip_context:s[0]}),s[2]=(0,y.jsx)(c.xP,{context:s[2],tip_context:s[2]})}})(e.context),b(e.context)}),await h.ws.send(e)})();return(async()=>{const e=await o._U.get("vir/server/get");if(e.code!==i.m.Success)return;const t=e.data;v(t.port),f(t.key),g(t.open)})(),()=>{}},[]);return(0,y.jsxs)("div",{children:[(0,y.jsxs)(m.A,{children:[!!Object.keys(I).length&&I[0],!!Object.keys(I).length&&(0,y.jsx)(d.rA,{icon:"delete",title:"删除",onClick:async()=>{await o._U.post("vir/server/delete/client",{ips:Object.keys(I)}),A({})}})]}),(0,y.jsx)(a.fI,{children:(0,y.jsxs)(a.VP,{children:[(0,y.jsxs)(c.Zp,{title:"",rightBottomCom:(0,y.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new p.$K;e.open=j,e.key=k,U&&(e.async_ips=Object.keys(I)),s&&(e.port=parseInt(s));(await o._U.post("vir/server/save",e)).code===i.m.Success?((0,r.SK)("保存成功"),P(!1)):(0,r.zN)("网络错误")}}),children:[(0,y.jsx)(l.Sm,{placeholder:"port",value:s,handleInputChange:e=>{v(e)}}),(0,y.jsx)(l.Sm,{type:"password",placeholder:"key ",value:k,handleInputChange:e=>{f(e)}}),(0,y.jsxs)("form",{children:[t("状态"),":",(0,y.jsx)(_.S,{isFlex:!0,columns:[(0,y.jsx)(l.U6,{value:1,context:t("开启"),selected:j,onchange:()=>{g(!j)}}),(0,y.jsx)(l.U6,{value:1,context:t("关闭"),selected:!j,onchange:()=>{g(!j)}})]})]}),!!Object.keys(I).length&&(0,y.jsx)(l.GL,{context:t("同步信息给选中服务器"),selected:U,onchange:()=>{P(!U)}})]}),(0,y.jsx)(c.Zp,{title:"",children:(0,y.jsx)(_.X,{headers:S,rows:C.map(e=>[...e,(0,y.jsx)(l.GL,{context:t(""),selected:I[e[1]],onchange:()=>{const t={...I};t[e[1]]?delete t[e[1]]:t[e[1]]=e,A(t)}})]),width:"10rem"})})]})})]})}function j(e){const{t}=(0,x.Bd)(),[s,m]=(0,n.useState)(""),[v,j]=(0,n.useState)(void 0),[g,k]=(0,n.useState)(""),[f,S]=(0,n.useState)(""),[w,C]=(0,n.useState)(void 0),[b,I]=(0,n.useState)(!1),[A,U]=(0,n.useState)(""),[P,K]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{const e=await o._U.get("vir/client/get");if(e.code!==i.m.Success)return;const t=e.data;if(C(t.serverPort),k(t.serverIp),m(t.ip),j(t.mask),U(t.key),I(t.open),S(t.client_name),t.open){const e=new u.hf(u.HK.vir_net_client_get),t=(await h.ws.send(e)).context.state;K(t),h.ws.addMsg(u.HK.vir_net_client_get,e=>{K(e.context.state)})}})()},[]);return(0,y.jsx)("div",{children:(0,y.jsx)(a.fI,{children:(0,y.jsxs)(a.VP,{children:[(0,y.jsxs)(c.Zp,{title:"",rightBottomCom:(0,y.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new p.vo;e.ip=s,e.mask=parseInt(v),e.key=A,e.serverIp=g,e.serverPort=parseInt(w),e.open=b,e.client_name=f;(await o._U.post("vir/client/save",e)).code===i.m.Success?(0,r.SK)("保存成功"):(0,r.zN)("网络错误")}}),titleCom:(0,y.jsxs)("div",{children:[t("连接状态"),(0,y.jsx)(c.fq,{ok:P})]}),children:[(0,y.jsx)(l.Sm,{placeholder:"ip ",value:s,handleInputChange:e=>{m(e)}}),(0,y.jsx)(l.Sm,{placeholder:"mask",value:v,handleInputChange:e=>{j(e)}}),(0,y.jsx)(l.Sm,{placeholder:`${t("服务器")} ip`,value:g,handleInputChange:e=>{k(e)}}),(0,y.jsx)(l.Sm,{placeholder:`${t("服务器")} part`,value:w,handleInputChange:e=>{C(e)}}),(0,y.jsx)(l.Sm,{placeholder:"名称 ",value:f,handleInputChange:e=>{S(e)}}),(0,y.jsx)(l.Sm,{type:"password",placeholder:"key ",value:A,handleInputChange:e=>{U(e)}}),(0,y.jsxs)("form",{children:[t("状态"),(0,y.jsx)(_.S,{isFlex:!0,columns:[(0,y.jsx)(l.U6,{value:1,context:t("开启"),selected:b,onchange:()=>{I(!b)}}),(0,y.jsx)(l.U6,{value:1,context:t("关闭"),selected:!b,onchange:()=>{I(!b)}})]})]})]}),(0,y.jsxs)(c.Zp,{title:"",children:[(0,y.jsx)("div",{children:"ip: 虚拟ip, “10.0.0.0 - 10.255.255.255”和“172.16.0.0 - 172.31.255.255”和“192.168.0.0 - 192.168.255.255”这三个网段属于内网ip"}),(0,y.jsx)("div",{children:"mask: 一些常见的子网掩码网段/8:255.0.0.0;/16:255.255.0.0 ;/24:255.255.255.0"}),(0,y.jsx)("div",{children:"key:用于验证身份信息并加密的和服务器设置的一样"})]})]})})})}var g=s(34843),k=s(82893),f=s(23430),S=(s(75897),s(78247)),w=s(21499),C=s(24659);function b(e){const{t}=(0,x.Bd)(),[s,h]=(0,n.useState)(""),[u,m]=(0,n.useState)(""),[v,j]=(0,n.useState)(""),[b,I]=(0,n.useState)(!1),[A,U]=(0,n.useState)(!1),[P,K]=(0,n.useState)({list:[]}),[F,H]=(0,g.fp)(k.AG.editorSetting),[$,N]=(0,g.fp)(k.AG.user_base_info),B=[t("端口"),t("目标地址"),t("目标端口"),t("开启"),t("备注"),t("删除")],[O,Z]=(0,n.useState)([]),z=[t("port"),t("ip"),t("type"),t("开启")],[E,V]=(0,n.useState)([]),M=[t("编辑"),t("开启"),t("备注"),t("删除")],L=(0,C.K)(),X=async()=>{const e=[o._U.post("vir/client/tcp_proxy/get"),o._U.post("http/proxy/server/get")];let t;$.sys===f.XM.mac?t=(async()=>{const e=await o._U.post("http/proxy/get/mac");if(e.code!==i.m.Success)return;const t=[],s=[];for(const n of e.data)"Wi-Fi"===n.name?t.push(n):s.push(n);V([...t,...s])})():$.sys===f.XM.win&&(t=(async()=>{const e=await o._U.post("http/proxy/get/win");if(e.code===i.m.Success){const t=e.data;h(t.ip),m(t.port),I(t.enabled),j(t.bypass),U(t.useForLocal)}})()),t&&e.push(t);const[s,n]=await Promise.all(e);s.code===i.m.Success&&Z(s.data),n.code===i.m.Success&&K(n.data)};(0,n.useEffect)(()=>{X()},[]);const G=async()=>{(await o._U.post("http/proxy/server/save",P)).code===i.m.Success&&(X(),(0,r.SK)("保存成功"))};return(0,y.jsx)("div",{children:(0,y.jsxs)(a.fI,{children:[$.sys===f.XM.win&&(0,y.jsx)(a.VP,{children:(0,y.jsxs)(c.Zp,{title:"Http Proxy",rightBottomCom:(0,y.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new p.l5;e.port=parseInt(u),e.enabled=b,e.useForLocal=A,e.ip=s,e.bypass=v;(await o._U.post("http/proxy/set/win",e)).code===i.m.Success&&(X(),(0,r.SK)("保存成功"))}}),children:[(0,y.jsx)(l.Sm,{placeholder:"ip (default localhost) ",value:s,handleInputChange:e=>{h(e)}}),(0,y.jsx)(l.Sm,{placeholder:"port ",value:u,handleInputChange:e=>{m(e)}}),(0,y.jsx)(l.Sm,{placeholder:t("忽略ip"),value:v,handleInputChange:e=>{j(e)}}),(0,y.jsxs)("form",{children:[t("请勿将代理服务器用于本地(Intranet)地址"),(0,y.jsx)(_.S,{isFlex:!0,columns:[(0,y.jsx)(l.U6,{value:1,context:t("开启"),selected:A,onchange:()=>{U(!A)}}),(0,y.jsx)(l.U6,{value:1,context:t("关闭"),selected:!A,onchange:()=>{U(!A)}})]})]}),(0,y.jsxs)("form",{children:[t("状态"),(0,y.jsx)(_.S,{isFlex:!0,columns:[(0,y.jsx)(l.U6,{value:1,context:t("开启"),selected:b,onchange:()=>{I(!b)}}),(0,y.jsx)(l.U6,{value:1,context:t("关闭"),selected:!b,onchange:()=>{I(!b)}})]})]})]})}),$.sys===f.XM.mac&&(0,y.jsx)(a.VP,{children:E.map((e,s)=>(0,y.jsxs)(c.uF,{self_title:(0,y.jsxs)("span",{className:" div-row ",children:[(0,y.jsx)("h2",{children:e.name})," "]}),titleCom:(0,y.jsx)("div",{children:(0,y.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:()=>{(async e=>{const t=E[e];(await o._U.post("http/proxy/set/mac",[t])).code===i.m.Success&&(X(),(0,r.SK)("保存成功"))})(s)}})}),children:[(0,y.jsx)(_.X,{headers:z,rows:e.proxies.map((e,t)=>{const n=[(0,y.jsx)(l.Sm,{value:e.port,handleInputChange:t=>{e.port=parseInt(t)},no_border:!0}),(0,y.jsx)(l.Sm,{value:e.ip,handleInputChange:t=>{e.ip=t},no_border:!0}),(0,y.jsx)("div",{children:1===e.type?"http":"https"}),(0,y.jsx)(l.l6,{value:e.enabled,onChange:e=>{((e,t,s)=>{const n=[...E];n[e].proxies[t].enabled=s,V(n)})(s,t,e)},options:L,no_border:!0})];return n}),width:"10rem"}),"ignore ips",(0,y.jsx)(l.Sm,{value:e.bypass,handleInputChange:e=>{E[s].bypass=e},no_border:!0})]},s))}),(0,y.jsxs)(a.VP,{children:[(0,y.jsx)(c.uF,{self_title:(0,y.jsxs)("span",{className:" div-row ",children:[(0,y.jsx)("h2",{children:t("Tcp Proxy")})," "]}),titleCom:(0,y.jsxs)("div",{children:[(0,y.jsx)(d.rA,{icon:"add",title:t("添加"),onClick:()=>{Z([...O,{note:"",open:!1,port:0,target_port:0,target_ip:""}])}}),(0,y.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:async()=>{const e=[];for(let t=0;t<O.length;t++)O[t].index=t,e.push(O[t]);(await o._U.post("vir/client/tcp_proxy/save",e)).code===i.m.Success&&((0,r.SK)("保存成功"),X())}})]}),children:(0,y.jsx)(_.X,{headers:B,rows:O.map((e,s)=>{const n=[(0,y.jsx)(l.Sm,{value:e.port,handleInputChange:t=>{e.port=parseInt(t)},no_border:!0}),(0,y.jsx)(l.Sm,{value:e.target_ip,handleInputChange:t=>{e.target_ip=t},no_border:!0}),(0,y.jsx)(l.Sm,{value:e.target_port,handleInputChange:t=>{e.target_port=parseInt(t)},no_border:!0}),(0,y.jsx)(l.l6,{value:e.open,onChange:e=>{O[s].open=e,Z([...O])},options:L,no_border:!0}),(0,y.jsx)(l.Sm,{value:e.note,handleInputChange:t=>{e.note=t},no_border:!0}),(0,y.jsx)("div",{children:(0,y.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{O.splice(e,1),Z([...O])})(s)})})];return n}),width:"10rem"})}),(0,y.jsx)(c.uF,{self_title:(0,y.jsxs)("span",{className:" div-row ",children:[(0,y.jsx)("h2",{children:t("Http Proxy Server")})," "]}),titleCom:(0,y.jsxs)("div",{children:[(0,y.jsx)(d.rA,{icon:"add",title:t("添加端口实例"),onClick:()=>{P.list.push({open:!1,port:0,note:"",list:[]}),K({...P})}}),(0,y.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:G})]}),children:P.list.map((e,s)=>(0,y.jsxs)("div",{className:"net-proxy-instance",children:[(0,y.jsxs)("div",{className:"net-proxy-instance__toolbar",children:[(0,y.jsxs)("span",{className:"net-proxy-instance__label",children:[t("端口实例")," #",s+1]}),(0,y.jsx)("span",{children:t("状态")}),(0,y.jsx)(l.l6,{value:e.open,width:"15%",onChange:t=>{e.open=t,K({...P})},options:L,no_border:!0}),(0,y.jsx)("span",{children:t("端口")}),(0,y.jsx)(l.Sm,{value:e.port||"",handleInputChange:t=>{e.port=t?parseInt(t):0,K({...P})},no_border:!0,width:"80px"}),(0,y.jsx)(d.rA,{icon:"add",title:t("添加规则"),onClick:()=>{e.list.push({note:"",open:!1}),K({...P})}}),(0,y.jsx)(d.rA,{icon:"delete",title:t("删除端口实例"),onClick:()=>{P.list.splice(s,1),K({...P})}}),(0,y.jsx)(l.Sm,{placeholder:t("备注"),width:"100%",value:e.note,handleInputChange:t=>{e.note=t,K({...P})},no_border:!0})]}),(0,y.jsx)(_.X,{headers:M,rows:e.list.map((n,a)=>{const r=[(0,y.jsx)("div",{children:(0,y.jsx)(d.rA,{icon:"edit",title:t("编辑"),onClick:()=>{(async(e,t)=>{const s=P.list[e];if(!s)return;const n=s.list[t];if(!n)return;n.random_key||(n.random_key=(0,w.hU)(),K({...P}),await G());const a=await o._U.post("http/proxy/server/code/get",{key:n.random_key,name:n.random_key});H({model:"ace/mode/javascript",open:!0,fileName:"",can_format:!0,save:async e=>{0===(await o._U.post("http/proxy/server/code/save",{context:e,key:n.random_key})).code&&(S.xK.set_value_temp(""),H({open:!1,model:"",fileName:"",save:null}))}}),S.xK.set_value_temp(a.data)})(s,a)}})}),(0,y.jsx)(l.l6,{value:n.open,onChange:t=>{e.list[a].open=t,K({...P})},options:L,no_border:!0}),(0,y.jsx)(l.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,y.jsx)("div",{children:(0,y.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{e.list.splice(a,1),K({...P})}})})];return r}),width:"10rem"})]},s))})]})]})})}var I=s(87361),A=s(82726),U=s(27690);function P(e){const{t}=(0,x.Bd)(),[s,p]=(0,n.useState)([]),[h,u]=(0,n.useState)([]),[v,j]=(0,n.useState)(""),[f,S]=(0,n.useState)(""),[w,C]=(0,n.useState)(!1),[b,I]=(0,g.fp)(k.AG.showPrompt),[P,K]=(0,g.fp)(k.AG.confirm);(0,n.useEffect)(()=>{(async()=>{const e=await o.ez.get("ips/dnspod");if(e.code!==i.m.Success)return;const t=e.data,s=[],n=[];for(const e of t.ips)e.isIPv4?s.push(e):n.push(e);p(s),u(n),t.account&&(j(t.account.id),S(t.account.token)),C(t.isOpen)})()},[]);const F=async e=>{K({open:!0,handle:async()=>{0===(await o.ez.post("http/del",e)).code&&(0,r.SK)("删除成功,稍后请刷新"),K({open:!1,handle:null})},title:t("确定删除吗")})};return(0,y.jsxs)("div",{children:[(0,y.jsx)(m.A,{children:(0,y.jsx)(d.rA,{icon:"add",title:t("添加http获取ip"),onClick:()=>{I({show:!0,type:U.PromptEnum.DdnsAddHttp,overlay:!0,data:{}})}})}),(0,y.jsxs)(a.fI,{children:[(0,y.jsxs)(a.VP,{children:[(0,y.jsx)(c.Zp,{title:"ipv4",children:s.length>0&&s.map((e,s)=>(0,y.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,y.jsx)(l.Sm,{right_placeholder:(0,y.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,y.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))}),(0,y.jsx)(c.Zp,{title:"ipv6",children:h.length>0&&h.map((e,s)=>(0,y.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,y.jsx)(l.Sm,{right_placeholder:(0,y.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,y.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))})]}),(0,y.jsxs)(a.VP,{children:[(0,y.jsxs)(c.Zp,{title:t("账号设置"),rightBottomCom:(0,y.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{if(w&&(!v||!f))return void(0,r.zN)("id和token都不能为空");const e=new A.yL,t=[];for(const e of[...s,...h])e.ddnsHost&&t.push(e);e.ips=t,e.account={id:v,token:f},e.isOpen=w,e.ddnsType=A.E2.dnspod;(await o.ez.post("save",e)).code===i.m.DdnsAuthFail?(0,r.zN)("鉴权失败"):(0,r.SK)("success")}}),children:[(0,y.jsx)(l.Sm,{placeholder:"ID",value:v,handleInputChange:e=>{j(e)}}),(0,y.jsx)(l.cA,{placeholder:"TOKEN",value:f,handleInputChange:e=>{S(e)}}),(0,y.jsx)(_.S,{isFlex:!0,columns:[(0,y.jsx)(l.U6,{value:1,context:t("开启"),selected:w,onchange:()=>{C(!w)}}),(0,y.jsx)(l.U6,{value:1,context:t("关闭"),selected:!w,onchange:()=>{C(!w)}})]})]}),(0,y.jsx)(c.Zp,{title:t("说明"),children:"域名如果不存在会自动创建,空子域名是@,ip6和ipv4可以互相切换。"})]})]})]})}function K(e){const{t}=(0,x.Bd)(),[s,p]=(0,n.useState)([]),[h,u]=(0,n.useState)([]),[v,j]=(0,n.useState)(""),[f,S]=(0,n.useState)(""),[w,C]=(0,n.useState)(!1),[b,I]=(0,g.fp)(k.AG.showPrompt),[P,K]=(0,g.fp)(k.AG.confirm);(0,n.useEffect)(()=>{(async()=>{const e=await o.ez.get("ips/tx");if(e.code!==i.m.Success)return;const t=e.data,s=[],n=[];for(const e of t.ips)e.isIPv4?s.push(e):n.push(e);p(s),u(n),t.account&&(j(t.account.secretid),S(t.account.secretkey)),C(t.isOpen)})()},[]);const F=async e=>{K({open:!0,handle:async()=>{0===(await o.ez.post("http/del",e)).code&&(0,r.SK)("删除成功,稍后请刷新"),K({open:!1,handle:null})},title:t("确定删除吗")})};return(0,y.jsxs)("div",{children:[(0,y.jsx)(m.A,{children:(0,y.jsx)(d.rA,{icon:"add",title:t("添加http获取ip"),onClick:()=>{I({show:!0,type:U.PromptEnum.DdnsAddHttp,overlay:!0,data:{}})}})}),(0,y.jsxs)(a.fI,{children:[(0,y.jsxs)(a.VP,{children:[(0,y.jsx)(c.Zp,{title:"ipv4",children:s.length>0&&s.map((e,s)=>(0,y.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,y.jsx)(l.Sm,{right_placeholder:(0,y.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,y.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))}),(0,y.jsx)(c.Zp,{title:"ipv6",children:h.length>0&&h.map((e,s)=>(0,y.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,y.jsx)(l.Sm,{right_placeholder:(0,y.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,y.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))})]}),(0,y.jsxs)(a.VP,{children:[(0,y.jsxs)(c.Zp,{title:t("账号设置"),rightBottomCom:(0,y.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{if(w&&(!v||!f))return void(0,r.zN)("SecretId和SecretKey都不能为空");const e=new A.yL,t=[];for(const e of[...s,...h])e.ddnsHost&&t.push(e);e.ips=t,e.account={secretid:v,secretkey:f},e.isOpen=w,e.ddnsType=A.E2.tengxun;(await o.ez.post("save",e)).code===i.m.DdnsAuthFail?(0,r.zN)("鉴权失败"):(0,r.SK)("成功")}}),children:[(0,y.jsx)(l.Sm,{placeholder:"SecretId",value:v,handleInputChange:e=>{j(e)}}),(0,y.jsx)(l.cA,{placeholder:"SecretKey",value:f,handleInputChange:e=>{S(e)}}),(0,y.jsx)(_.S,{isFlex:!0,columns:[(0,y.jsx)(l.U6,{value:1,context:t("开启"),selected:w,onchange:()=>{C(!w)}}),(0,y.jsx)(l.U6,{value:1,context:t("关闭"),selected:!w,onchange:()=>{C(!w)}})]})]}),(0,y.jsx)(c.Zp,{title:t("说明"),children:"域名如果不存在会自动创建,空子域名是@,ip6和ipv4可以互相切换。"})]})]})]})}function F(){const{t:e}=(0,x.Bd)(),{check_user_auth:t}=(0,S.MH)(),s=[];return t(f.oV.vir_net)&&s.push({index:1,name:e("系统")+e("代理"),rto:"proxy_sys/",component:(0,y.jsx)(b,{})},{index:2,name:"Tun proxy "+e("客户端"),rto:"client/",component:(0,y.jsx)(j,{})},{index:3,name:"Tun proxy "+e("服务端"),rto:"server/",component:(0,y.jsx)(v,{})}),t(f.oV.ddns)&&s.push({index:4,name:`ddns-dnspod(${e("腾讯")})`,rto:"dnspod/",component:(0,y.jsx)(P,{})},{index:5,name:`ddns-${e("腾讯")}${e("云")}`,rto:"tengxun/",component:(0,y.jsx)(K,{})}),(0,y.jsx)(a.W1,{optionList:s,father_route:I.o.net})}},24659(e,t,s){var n=s(22022);s.d(t,["K",0,()=>{const{t:e}=(0,n.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6010,9258],{83277(e,t,s){s.d(t,{$j:()=>l,Lv:()=>a,qq:()=>i});class n{options_agent_url_list;options_agent_key_list;options_agent_model_list;options_local_file_path_prompt_list}class a{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const s of t)if(s.value===e)return s.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const s of t)if(s.value===e)return!0;return!1}}class i extends n{tool_error_max=50;tool_call_max=300;allow_exec_cmd_directly=!1;proxy_url}const o=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function l(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}s.d(t,["CP",0,'\n\n# 工具报错最大尝试次数\ntool_error_max=50\n# 聊天循环最大次数\ntool_call_max=300\n# 是否允许AI直接执行命令而不需要用户确认,默认为false,需要用户手动确认,如果使用 workflow 这里等价于为 true\nallow_exec_cmd_directly=false\n\n# 可选的代理 url,如果指定了所有访问大模型的请求将会走代理\n#proxy_url=\n\n# 可选的多个url 以数组分割\n# options_agent_url_list=[{"value":"http://..","label":"openai"}]\n\n# 可选的多个 key\n# options_agent_key_list=[{"value":"sh-aaa","label":"option1"}]\n\n# 可选的多个 model\n# options_agent_model_list=[{"value":"gpt-5.5","label":"gpt"}]\n\n# 存放本地的 prompt 文件 用于每次聊天的时候自动读取并加载\n# options_local_file_path_prompt_list=["/prompt/a.txt"]\n',"cL",0,o])},26363(e,t,s){s.r(t),s.d(t,{default:()=>U});var n=s(96540),a=s(34843),i=s(22022),o=s(61973),l=s(14284),c=s(7463),r=s(78247),d=s(40505),u=s(62042),m=s(45907),h=s(53459),g=s(72693),p=s(82893),x=s(61443),_=s(83277);function f(e){const t=(0,_.$j)(e.content);if(t)return t;const s=e.content_list??[];return s.length?s.map(e=>(0,_.$j)(e.content)).filter(Boolean).join("\n\n"):""}const j=/\.(md|txt|json|js|jsx|ts|tsx|css|html?|xml|ya?ml|py|java|go|rs|c|cpp|h|hpp|sh|bat|cmd|ini|toml|csv|log|sql|env|gitignore|dockerfile)$/i;function v(e){return e.type?.startsWith("image/")?"image":e.type?.startsWith("text/")||j.test(e.name)?"text":"binary"}function y(e){return e.text()}function b(e){return new Promise((t,s)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=s,n.readAsDataURL(e)})}async function w(e){const t=[];for(const s of e){const e=v(s);let n="";if("text"===e)try{const e=await y(s),t=12e4;n=e.length>t?`${e.slice(0,t)}\n\n[内容已截断,原始长度 ${e.length} 字符]`:e}catch{n="[文本读取失败]"}else if("image"===e)try{n=await b(s)}catch{n=`[图片文件: ${s.name}]`}else n=`[二进制文件: ${s.name}]`;t.push({name:s.name,mime_type:s.type,size:s.size,kind:e,content:n})}return t}var S=s(14944),N=s(92275);var k=s(52035),C=s(85997),A=s(34299),$=s(74848);function I(e){const t=e.attachments&&e.attachments.length>0?(0,$.jsx)("div",{className:"chat-message-attachments",children:e.attachments.map((e,t)=>(0,$.jsxs)("div",{className:"chat-message-attachment",children:[(0,$.jsx)(C.In,{icon:"attach_file"}),(0,$.jsx)("span",{children:e.name}),(0,$.jsxs)("small",{children:[e.size," B"]})]},`${e.name}_${t}`))}):null,s=[];e.images&&"bot"===e.sender&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(D,{images:e.images,text:e.text})},"images")),e.audio&&"bot"===e.sender&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(O,{audio:e.audio,text:e.text})},"audio")),e.embeddings&&"bot"===e.sender&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(R,{embeddings:e.embeddings,text:e.text})},"embeddings"));const a=function(e){if("bot"!==e.sender||!e.content_list?.length)return e.text?(0,$.jsx)(A.default,{context:e.text}):null;return(0,$.jsxs)($.Fragment,{children:[e.content_list.map((e,t)=>{const s=[],a=(0,_.$j)(e.content);return a&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(A.default,{context:a})},`content-${t}`)),e.tool_call_ends?.length&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(M,{callList:e.tool_call_ends})},`tool-${t}`)),(0,$.jsx)(n.Fragment,{children:s},`part-${t}`)}),!e.content_list.some(e=>e.content)&&e.text?(0,$.jsx)(A.default,{context:e.text}):null]})}(e);return 0===s.length?(0,$.jsxs)($.Fragment,{children:[t,a]}):(0,$.jsxs)($.Fragment,{children:[s,t,a]})}function M({callList:e}){const[t,s]=n.useState(!1);if(!e?.length)return null;e.filter(e=>e.success).length;const a=e.filter(e=>!e.success).length;return(0,$.jsxs)("div",{className:"chat-message-call-list",children:[(0,$.jsxs)("div",{className:"call-list-header",onClick:()=>s(!t),children:[(0,$.jsx)(C.In,{icon:t?"expand_less":"expand_more"}),(0,$.jsxs)("span",{className:"call-list-summary",children:["工具调用 (",e.length,")",a>0&&(0,$.jsx)("span",{className:"call-list-fail",children:" 失败 "})]})]}),t&&(0,$.jsx)("div",{className:"call-list-body",children:e.map((e,t)=>(0,$.jsxs)("div",{className:"call-list-item "+(e.success?"call-success":"call-fail"),children:[(0,$.jsxs)("div",{className:"call-list-item-header",children:[(0,$.jsx)(C.In,{icon:e.success?"check_circle":"error"}),(0,$.jsx)("span",{className:"call-list-tool-name",children:e.tool_display_name||e.tool_name}),(0,$.jsxs)("span",{className:"call-list-duration",children:[e.duration_ms,"ms"]})]}),e.tool_args&&(0,$.jsxs)("details",{className:"call-list-details",children:[(0,$.jsx)("summary",{children:"参数"}),(0,$.jsx)("pre",{className:"call-list-pre",children:JSON.stringify(e.tool_args,null,2)})]}),!e.success&&e.error&&(0,$.jsxs)("details",{className:"call-list-details",children:[(0,$.jsx)("summary",{children:"错误"}),(0,$.jsx)("pre",{className:"call-list-pre call-list-error-text",children:e.error})]}),e.success&&e.tool_result&&(0,$.jsxs)("details",{className:"call-list-details",children:[(0,$.jsx)("summary",{children:"结果"}),(0,$.jsx)("pre",{className:"call-list-pre",children:e.tool_result.length>500?e.tool_result.slice(0,500)+"...":e.tool_result})]})]},t))})]})}function D({images:e,text:t}){let s=e||[];if(!s.length&&t)try{s=JSON.parse(t).data||[]}catch{}return s.length?(0,$.jsxs)("div",{className:"image-generation-result",children:[s.map((e,t)=>(0,$.jsxs)("div",{className:"image-generation-item",children:[e.url&&(0,$.jsx)("div",{className:"image-generation-image-wrapper",children:(0,$.jsx)("img",{src:e.url,alt:e.revised_prompt||`生成的图片 ${t+1}`,loading:"lazy"})}),e.b64_json&&(0,$.jsx)("div",{className:"image-generation-image-wrapper",children:(0,$.jsx)("img",{src:`data:image/png;base64,${e.b64_json}`,alt:`生成的图片 ${t+1}`})}),e.revised_prompt&&(0,$.jsx)("p",{className:"image-generation-prompt",children:(0,$.jsx)("small",{children:e.revised_prompt})})]},t)),t&&!e&&(0,$.jsx)(A.default,{context:t})]}):(0,$.jsx)(A.default,{context:t||""})}function O({audio:e,text:t}){if(e){if(e.url)return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:e.url,children:"您的浏览器不支持音频播放"})});if(e.data){const t=e.mime_type||"audio/mpeg";return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:`data:${t};base64,${e.data}`,children:"您的浏览器不支持音频播放"})})}}const s=t||"";if(s.startsWith("http://")||s.startsWith("https://"))return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:s,children:"您的浏览器不支持音频播放"})});try{const e=JSON.parse(s);if(e?.data||e?.audio_data){const t=e.data||e.audio_data;return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:`data:audio/mpeg;base64,${t}`,children:"您的浏览器不支持音频播放"})})}}catch{}return(0,$.jsx)(A.default,{context:s})}function F({content:e,label:t}){const[s,a]=n.useState(!1);return(0,$.jsxs)("button",{className:"embeddings-copy-btn",onClick:()=>{(0,d.lW)(e),a(!0),setTimeout(()=>a(!1),1500)},children:[(0,$.jsx)(C.In,{icon:s?"check":"content_copy"}),s?"已复制":t||"复制"]})}function R({embeddings:e,text:t}){let s=e||null;if(!s&&t)try{s=JSON.parse(t)}catch{return(0,$.jsx)(A.default,{context:t})}if(!s)return(0,$.jsx)(A.default,{context:t||""});const n=s?.data||[],a=s?.usage,i=JSON.stringify(s,null,2);return(0,$.jsxs)("div",{className:"embeddings-result",children:[(0,$.jsxs)("div",{className:"embeddings-summary",children:[(0,$.jsx)("strong",{children:"向量嵌入结果"}),(0,$.jsxs)("span",{children:["维度: ",n[0]?.embedding?.length??"N/A"]}),(0,$.jsxs)("span",{children:["数量: ",n.length]}),a&&(0,$.jsxs)("span",{children:["使用 tokens: ",a.total_tokens??"N/A"]})]}),(0,$.jsxs)("div",{className:"embeddings-toolbar",children:[(0,$.jsx)(F,{content:i,label:"复制全部结果"}),n.length>0&&n[0]?.embedding&&(0,$.jsx)(F,{content:JSON.stringify(n[0].embedding,null,2),label:"复制第一条向量"}),n.length>0&&(0,$.jsx)(F,{content:JSON.stringify(n.map(e=>e.embedding),null,2),label:"复制所有向量数据"})]}),n.length>0&&n[0]?.embedding&&(0,$.jsx)("div",{className:"embeddings-preview",children:(0,$.jsxs)("span",{children:["向量预览: [",n[0].embedding.slice(0,5).join(", "),n[0].embedding.length>5?", ...":"","]"]})}),n.length>0&&(0,$.jsxs)("details",{children:[(0,$.jsx)("summary",{children:"查看详细数据"}),(0,$.jsx)("pre",{className:"embeddings-raw",children:i})]})]})}async function T(e,t){const s=function(){try{return(0,k.zp)().get(p.AG.ai_images_extra_params)||{}}catch{return{}}}(),n={prompt:e,n:s.n??1,size:s.size??"1024x1024",session_id:t};if(s.quality&&(n.quality=s.quality),s.style&&(n.style=s.style),s.extra_json)try{const e=JSON.parse(s.extra_json);Object.assign(n,e)}catch(e){console.warn("图片额外参数 JSON 解析失败:",e)}const a=await l.jV.post("images/generations",n);if(0!==a.code)throw new Error(a.message||"图片生成失败");const i=a.data||{},o=(i.data||[]).map(e=>({url:e.url,b64_json:e.b64_json,revised_prompt:e.revised_prompt})),c=o.map((e,t)=>`${e.revised_prompt?`\n> ${e.revised_prompt}`:""}`).join("\n\n");return{session_id:i.session_id||t,images:o,text:c||`生成了 ${o.length} 张图片`}}async function H(e,t,s,n){try{switch(e){case"images":{const e=await T(t,s);return e&&n(e.text,{images:e.images}),!0}case"audio_speech":{const e=await async function(e,t){const s={input:e,session_id:t};try{const e=localStorage.getItem("ai_audio_extra_params");if(e){const t=JSON.parse(e);t.voice&&(s.voice=t.voice),t.speed&&(s.speed=parseFloat(t.speed))}}catch{}const n=localStorage.getItem("token")||"",a=await fetch("/api/ai_agent/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:n},body:JSON.stringify(s)});if(!a.ok)throw new Error(`语音合成失败: ${a.statusText}`);const i=a.headers.get("X-Session-Id")||t,o=await a.arrayBuffer();return{session_id:i,audio:{data:btoa(String.fromCharCode(...Array.from(new Uint8Array(o)))),mime_type:a.headers.get("content-type")||"audio/mpeg"},text:`[音频文件: ${e.slice(0,50)}...]`}}(t,s);return e&&n(e.text,{audio:e.audio}),!0}case"embeddings":{const e=await async function(e,t){const s=await l.jV.post("embeddings",{input:e,session_id:t});if(0!==s.code)throw new Error(s.message||"Embeddings 请求失败");const n=s.data||{},a=n?.data??[],i=`向量维度: ${a[0]?.embedding?.length??0}, 数量: ${a.length}`;return{session_id:n.session_id||t,embeddings:n,text:`✅ Embeddings 结果 - ${i}\n\`\`\`json\n${JSON.stringify(n,null,2).slice(0,2e3)}\n\`\`\``}}(t,s);return e&&n(e.text,{embeddings:e.embeddings}),!0}default:return!1}}catch(e){return n(`请求失败: ${e?.message||JSON.stringify(e)}`),!0}}var q=s(57952),B=s(23430),V=s(87361),L=s(27690);const K=({currentModelName:e,setCurrentModelName:t,envConfigRef:s,sysPromptList:n,batchMode:c,selectedMsgCount:d,onToggleSessionPanel:m,onCreateSession:g,onToggleBatchMode:_,onBatchDeleteMessages:f})=>{const{t:j}=(0,i.Bd)(),v=(0,o.Zp)(),{check_user_auth:y}=(0,r.MH)(),[,b]=(0,a.fp)(p.AG.ai_session_collapsed);return(0,$.jsxs)(q.A,{children:[(0,$.jsx)(C.rA,{icon:"menu",title:j("会话"),onClick:m}),(0,$.jsx)(C.rA,{icon:"add",title:j("新会话"),onClick:()=>g()}),n.length>0&&(0,$.jsx)(L.MenuSelect,{list:n.map((e,t)=>({name:e.note||`${j("提示词")} ${t+1}`,click:()=>{e.prompt&&g(e.prompt)}})),children:(0,$.jsx)(C.rA,{icon:"add_comment",title:j("提示词模板创建会话")})}),(s.current?.ai_config_env?.options_agent_model_list?.length??0)>0&&(0,$.jsx)(x.l6,{value:e,options:s.current.ai_config_env.options_agent_model_list?.map(e=>({title:e.label,value:e.value}))??[],onChange:e=>{t(e),l.jV.post("set_active_model",{model_name:e}).then(()=>{(0,u.SK)("success"),l.XO.get("ai_agent_setting/env").then(e=>{e.code===h.m.Success&&(s.current=e.data)})}).catch(console.error)},no_border:!0,width:"auto"}),c&&d>0&&(0,$.jsx)(C.rA,{icon:"delete",title:j("删除选中消息"),onClick:f}),y(B.oV.ai_agent_setting)&&(0,$.jsx)(C.rA,{icon:"smart_toy",title:"机器人配置",onClick:()=>{v(`/${V.o.ai_rebot_setting_page}`)}}),y(B.oV.ai_agent_setting)&&(0,$.jsx)(C.rA,{icon:"settings",title:"ai setting",onClick:()=>{v(`/${V.o.ai_agent_setting_page}`)}})]})};function z({sessions:e,activeSessionId:t,onSelectSession:s,onRenameSession:o,onDeleteSession:l,onShowUsageStats:c,batchMode:r,selectedSessionIds:d,onToggleSessionSelect:u,onToggleBatchMode:m,onBatchDeleteSessions:h,onClearAllSessions:g}){const{t:x}=(0,i.Bd)(),[_,f]=(0,a.fp)(p.AG.ai_session_collapsed),[j,v]=(0,n.useState)(""),y=j.trim()?e.filter(e=>(e.title||"").toLowerCase().includes(j.toLowerCase())||(e.summary||"").toLowerCase().includes(j.toLowerCase())||(e.long_term_memory||"").toLowerCase().includes(j.toLowerCase())):e;return(0,$.jsxs)("aside",{className:`chat-session-list ${_?"active":""} ${_?"collapsed":""}`,children:[(0,$.jsx)("div",{className:"chat-session-search",children:(0,$.jsx)("input",{type:"text",className:"chat-session-search-input",placeholder:x("搜索会话"),value:j,onChange:e=>v(e.target.value)})}),(0,$.jsx)("div",{className:"chat-session-items-wrap",children:y.map(e=>{return(0,$.jsx)("div",{children:(0,$.jsxs)("button",{className:`chat-session-item ${t===e.id?"active":""} ${r?"batch-mode":""}`,onClick:()=>{r&&u?u(e.id):s(e.id)},title:e.summary||e.long_term_memory||e.title,children:[r&&(0,$.jsx)("input",{type:"checkbox",className:"chat-session-checkbox",checked:d?.has(e.id)??!1,onChange:()=>u?.(e.id),onClick:e=>e.stopPropagation()}),(0,$.jsx)("span",{children:(n=e.title,n||"新会话")}),(0,$.jsx)("small",{children:e.message_count}),"web"!==e.source&&(0,$.jsx)("em",{className:"chat-session-source",children:e.source}),!r&&(0,$.jsx)(L.MenuSelect,{list:[{name:x("重命名"),click:()=>o(e.id,e.title)},{name:x("字符消耗统计"),click:()=>c(e.id)},{name:x("删除"),click:()=>l(e.id)}],children:(0,$.jsx)(C.In,{icon:"more_horiz"})})]})},e.id);var n})}),(0,$.jsxs)("div",{className:"chat-session-actions",children:[(0,$.jsx)(C.rA,{icon:r?"check_circle":"checklist",title:x(r?"取消批量选择":"批量选择"),onClick:m}),r&&(d?.size??0)>0&&(0,$.jsx)(C.rA,{icon:"delete",title:x("删除选中会话"),onClick:h}),!r&&(0,$.jsx)(C.rA,{icon:"delete_sweep",title:x("删除全部会话"),onClick:g})]})]})}const E=({messages:e,batchMode:t,selectedMsgIds:s,sending:n,chatContainerRef:a,messagesEndRef:i,onToggleMsgSelect:o,onDelete:l,onCopy:c,onToggleBatchMode:r,t:d})=>(0,$.jsxs)("div",{className:"chat-messages",ref:a,"data-sending":n?"true":"false",children:[e.map(e=>(0,$.jsxs)("div",{className:`chat-message ${e.sender} ${t?"batch-mode":""} ${e.is_loading?"is-loading":""}`,children:[t&&(0,$.jsx)("input",{type:"checkbox",className:"chat-message-checkbox",checked:s.has(e.id),onChange:()=>o(e.id)}),e.is_loading?(0,$.jsxs)("div",{className:"ai-loading-bubble",children:[(0,$.jsxs)("div",{className:"ai-loading-dots",children:[(0,$.jsx)("span",{className:"ai-loading-dot"}),(0,$.jsx)("span",{className:"ai-loading-dot"}),(0,$.jsx)("span",{className:"ai-loading-dot"})]}),(0,$.jsx)("span",{className:"ai-loading-text",children:e.text})]}):(0,$.jsxs)($.Fragment,{children:[I(e),(0,$.jsx)("div",{className:"message-actions",children:t?(0,$.jsx)("button",{onClick:()=>o(e.id),children:s.has(e.id)?d("取消选择"):d("选择")}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("button",{onClick:()=>l(e.id),children:d("删除")}),(0,$.jsx)("button",{onClick:()=>c(e.text),children:d("复制")}),(0,$.jsx)("button",{onClick:r,children:d("多选")})]})})]})]},e.id)),(0,$.jsx)("div",{ref:i})]});function P({onClose:e}){const{t}=(0,i.Bd)(),[s,o]=(0,a.fp)(p.AG.ai_images_extra_params),[l,c]=(0,n.useState)(s.size||"1024x1024"),[r,d]=(0,n.useState)(String(s.n??1)),[u,m]=(0,n.useState)(s.quality||""),[h,g]=(0,n.useState)(s.style||""),[_,f]=(0,n.useState)(s.extra_json||"");return(0,$.jsxs)("div",{className:"card floating",children:[(0,$.jsx)("div",{className:"card-title",children:(0,$.jsx)("h2",{children:t("图片生成参数设置")})}),(0,$.jsxs)("div",{className:"card-content",children:[(0,$.jsx)(x.Sm,{placeholderOut:t("图片尺寸 (size)"),value:l,handleInputChange:c,placeholder:"1024x1024"}),(0,$.jsx)(x.Sm,{placeholderOut:t("生成数量 (n)"),value:r,handleInputChange:d,type:"number"}),(0,$.jsx)(x.Sm,{placeholderOut:t("画质 (quality)"),value:u,handleInputChange:m,placeholder:"standard / hd"}),(0,$.jsx)(x.Sm,{placeholderOut:t("风格 (style)"),value:h,handleInputChange:g,placeholder:"vivid / natural"}),(0,$.jsx)(x.Sm,{placeholderOut:t("额外参数 JSON"),value:_,handleInputChange:f,placeholder:'{"key":"value"}'})]}),(0,$.jsxs)("div",{className:"card-action",children:[(0,$.jsx)("button",{className:"button button--flat button--grey",onClick:e,children:t("取消")}),(0,$.jsx)("button",{className:"button button--flat",onClick:()=>{const t={size:l,n:parseInt(r)||1};u&&(t.quality=u),h&&(t.style=h),_&&(t.extra_json=_),o(t),e()},children:t("确定")})]})]})}function J({requestType:e}){const{t}=(0,i.Bd)(),[s,a]=(0,n.useState)(!1);return"completions"===e?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(C.rA,{icon:"tune",title:t("模型参数设置"),onClick:()=>a(!0)}),s&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("div",{className:"overlay",onClick:()=>a(!1)}),"images"===e&&(0,$.jsx)(P,{onClose:()=>a(!1)})]})]})}function G({pendingAttachments:e,onRemove:t}){return 0===e.length?null:(0,$.jsx)("div",{className:"chat-attachment-strip",children:e.map((e,s)=>(0,$.jsxs)("div",{className:"chat-attachment-chip",children:[(0,$.jsx)(C.In,{icon:"attach_file"}),(0,$.jsx)("span",{title:e.name,children:e.name}),(0,$.jsx)("button",{type:"button",onClick:()=>t(s),children:(0,$.jsx)(C.In,{icon:"close"})})]},`${e.name}_${s}`))})}function Q({inputValue:e,onInputChange:t,onKeyDown:s,onPaste:n,onSend:a,sending:o,onAbort:l,pendingAttachments:c,onRemoveAttachment:r,onOpenFilePicker:d,onAddFiles:u,onDrop:m,onDragOver:h,fileInputRef:g,requestType:p}){const{t:x}=(0,i.Bd)();return(0,$.jsxs)("div",{className:"chat-input-area",onDrop:m,onDragOver:h,children:[(0,$.jsx)("input",{ref:g,type:"file",multiple:!0,style:{display:"none"},onChange:e=>{e.target.files?.length&&(u(e.target.files),e.currentTarget.value="")}}),(0,$.jsxs)("div",{className:"chat-input-shell",children:[(0,$.jsx)(G,{pendingAttachments:c,onRemove:r}),(0,$.jsx)("textarea",{value:e,onChange:t,onPaste:n,onKeyDown:s,placeholder:x("输入消息"),className:"chat-input"})]}),(0,$.jsx)(C.rA,{title:x("添加文件"),icon:"attach_file",onClick:d}),(0,$.jsx)(J,{requestType:p}),o?(0,$.jsx)(C.Vi,{color:"var( --icon-red)",text:x("暂停"),clickFun:l}):(0,$.jsx)(C.Vi,{text:x("发送"),clickFun:a})]})}const W=e=>null==e||e<0?"0":e.toLocaleString();function U(){const{t:e}=(0,i.Bd)(),t=((0,o.Zp)(),(0,m.y)()),{check_user_auth:s}=(0,r.MH)();(0,g.w)();const[j,v]=(0,n.useState)([]),[y,b]=(0,n.useState)([]),[k,C]=(0,n.useState)(""),[A,I]=(0,n.useState)(!1),[M,D]=(0,n.useState)(""),[O,F]=(0,n.useState)([]),[R,T]=(0,a.fp)(p.AG.ai_session_collapsed),[q,B]=(0,a.fp)(p.AG.prompt_card),[V,L]=(0,n.useState)(!1),[P,J]=(0,n.useState)(new Set),[G,U]=(0,n.useState)(new Set),X=(0,n.useRef)(null),Z=(0,n.useRef)(null),Y=(0,n.useRef)(null),ee=(0,n.useRef)(!0),te=(0,n.useRef)(new _.qq),[se,ne]=(0,n.useState)([]),[ae,ie]=(0,n.useState)(""),oe=()=>te?.current?.ai_config?.request_type||"completions",le=(0,n.useRef)((0,c.sg)(e=>{v(e),ee.current&&ce(!1)},50)).current,ce=(e=!1)=>{const t=Y.current;t&&t.scrollTo({top:t.scrollHeight,behavior:e?"smooth":"auto"})},re=async()=>{const e=await l.jV.get("sessions");e.code===h.m.Success&&b(e.data??[])},de=function(e){const{getMessages:t,setMessages:s,setMessagesDebounced:a,setSending:i,getActiveSessionId:o,setActiveSessionId:l,refreshSessions:c,scrollToBottom:r,buildRequestMessages:d}=e,u=(0,n.useRef)([]),m=(0,n.useRef)(null),h=(e,n,o)=>{const l=[...t(),n];s(l),i(!0),m.current={abort:()=>{}};const u={id:n.id+1,sender:"bot",text:"AI思考中...",is_loading:!0};l.push(u),s([...l]);const h=new Map;let g=!0,p=u;const x=e=>{const t=e.context||{},s=t.text||"",n=t.tool_call_ends,i=t.chunk_index??0;if("[DONE]"!==s)if(g)g=!1,p.text=s,n&&(p.content_list=[{tool_call_ends:n,content:p.text,role:"assistant"}]),p.is_loading=!1,p.chunk_index=i,h.set(i,p),a([...l]);else{const e=h.get(i);if(e)e.text+=s,n&&(e.content_list=[{tool_call_ends:n,content:e.text,role:"assistant"}]),a([...l]);else{const e={id:Date.now()+Math.random(),sender:"bot",text:s,chunk_index:i};n&&(e.content_list=[{tool_call_ends:n,content:e.text,role:"assistant"}]),l.push(e),h.set(i,e),a([...l])}}},_=e=>{j(),m.current=null,i(!1),p.is_loading=!1,c(),r(!0),o()},f=e=>{j(),m.current=null,i(!1);const t=e.context||{};p.text="AI请求出错: "+(t.message||"未知错误"),p.is_loading=!1,s([...l]),o()},j=()=>{S.ws.off_message(`message_${N.HK.ai_chat_msg}`,x),S.ws.off_message(`message_${N.HK.ai_chat_end}`,_),S.ws.off_message(`message_${N.HK.ai_chat_error}`,f)};S.ws.addMsg(N.HK.ai_chat_msg,x),S.ws.addMsg(N.HK.ai_chat_end,_),S.ws.addMsg(N.HK.ai_chat_error,f),S.ws.sendData(N.HK.ai_chat_req,{messages:d(n),session_id:e})},g=()=>{const e=u.current;if(0===e.length)return;const t=e.shift();if(!t)return;s(e=>e.map(e=>"user"===e.sender&&e.text.includes("⏳(排队中...)")?{...e,text:e.text.replace(" ⏳(排队中...)","")}:e));const n={id:Date.now(),sender:"user",text:t.text,attachments:t.attachments};h(o(),n,g)};return{startChatStream:h,processPendingQueue:g,enqueueMessage:(e,t)=>{u.current.push({text:e,attachments:t})},getQueueLength:()=>u.current.length,abort:()=>{m.current&&(S.ws.sendData(N.HK.ai_chat_abort,{session_id:o()}),m.current=null,i(!1))}}}({getMessages:()=>j,setMessages:v,setMessagesDebounced:le,setSending:I,getActiveSessionId:()=>k,setActiveSessionId:C,refreshSessions:re,scrollToBottom:ce,buildRequestMessages:e=>{const t=(e.attachments??[]).filter(e=>"image"===e.kind);if(t.length>0){const s=[];e.text&&s.push({type:"text",text:e.text});for(const e of t)s.push({type:"image_url",image_url:{url:e.content}});return[{content:s,role:"user",attachments:e.attachments??[]}]}return[{content:e.text,role:"bot"===e.sender?"assistant":"user",attachments:e.attachments??[]}]}}),ue=async e=>{const t=await l.jV.get("sessions");if(t.code!==h.m.Success)return;const s=t.data??[];b(s);const n=null===e?s[0]?.id??"":e||k||s[0]?.id||"";n?await me(n):(v([]),C(""))},me=async(e,t=!1)=>{const s=await l.jV.post("session/get",{session_id:e});if(s.code!==h.m.Success||!s.data)return;const n=s.data;C(n.id),v(function(e=[]){return e.filter(e=>"user"===e.role||"assistant"===e.role).map((e,t)=>({id:Date.now()+t,sender:"assistant"===e.role?"bot":"user",text:f(e),attachments:e.attachments??[],content_list:e.content_list,images:e.images,audio:e.audio,embeddings:e.embeddings}))}(n.messages)),t&&T(!1),requestAnimationFrame(()=>ce(!1))},he=async()=>{const e=M.trim();if(!e&&0===O.length)return;if(A){const t=await w(O);de.enqueueMessage(e,t),D(""),F([]);const s={id:Date.now(),sender:"user",text:e+(de.getQueueLength()>1?" ⏳(排队中...)":""),attachments:t};return void v(e=>[...e,s])}let t=k;if(!t){const s=await l.jV.post("session",{title:(e||O[0]?.name||"新会话").slice(0,28)});if(s.code!==h.m.Success)return;t=s.data.id,C(t),await ue(t)}const s=await w(O),n={id:Date.now(),sender:"user",text:e,attachments:s};D(""),F([]);const a=oe();if("completions"!==a){const s={id:n.id+1,sender:"bot",text:"处理中...",is_loading:!0},i=[...j,n,s];v(i),I(!0);return void(await H(a,e,t,async(e,t)=>{s.text=e,s.is_loading=!1,t?.images&&(s.images=t.images),t?.audio&&(s.audio=t.audio),t?.embeddings&&(s.embeddings=t.embeddings),v([...i]),I(!1),re(),ce(!0),de.processPendingQueue()})||(s.text=`请求类型 "${a}" 的专用处理器尚未实现,请使用 completions 类型。`,s.is_loading=!1,v([...i]),I(!1),de.processPendingQueue()))}de.startChatStream(t,n,()=>de.processPendingQueue())},ge=e=>{const t=Array.from(e??[]).filter(Boolean);t.length&&F(e=>[...e,...t])},pe=()=>{V&&(J(new Set),U(new Set)),L(e=>!e)};(0,n.useEffect)(()=>{(async()=>{const e=await l.XO.get("ai_agent_setting/env");if(e.code===h.m.Success){te.current=e.data;const t=e.data.ai_config?.model||"",s=(e.data.ai_config_env?.options_agent_model_list??[]).find(e=>e.label===t);ie(s?s.value:t)}await ue();const t=await l.jV.get("system_prompts");t.code===h.m.Success&&ne(t.data??[])})(),requestAnimationFrame(()=>ce(!1))},[]),(0,n.useEffect)(()=>{const e=Y.current;if(!e)return;const t=()=>{ee.current=((e,t=120)=>{const{scrollTop:s,scrollHeight:n,clientHeight:a}=e;return n-(s+a)<t})(e)};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)},[]),(0,n.useLayoutEffect)(()=>{ee.current&&ce(!1)},[j]);return(0,$.jsxs)(n.Fragment,{children:[(0,$.jsx)(K,{currentModelName:ae,setCurrentModelName:ie,envConfigRef:te,sysPromptList:se,batchMode:V,selectedMsgCount:P.size,onToggleSessionPanel:()=>{T(e=>!e)},onCreateSession:async e=>{const t=await l.jV.post("session",{title:"新会话"});if(t.code!==h.m.Success)return;const s=t.data;C(s.id),e?(D(e),v([])):v([]),T(!1),await ue(s.id),requestAnimationFrame(()=>{const e=document.querySelector(".chat-input");e&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,200)+"px")})},onBatchDeleteMessages:()=>{0!==P.size&&t({sub_title:e("确认删除选中的聊天消息吗?"),confirm_fun:async()=>{const e=[];j.forEach((t,s)=>{P.has(t.id)&&e.push(s)}),v(j.filter(e=>!P.has(e.id))),J(new Set),L(!1),k&&e.length>0&&l.jV.post("session/message/delete",{session_id:k,indices:e}).catch(console.error)}})}}),(0,$.jsxs)("div",{className:"chat-page chat-page-with-sessions",children:[R&&(0,$.jsx)("div",{className:"chat-session-overlay",onClick:()=>T(!1)}),(0,$.jsx)(z,{sessions:y,activeSessionId:k,onSelectSession:e=>me(e,!1),onRenameSession:(e,s)=>{let n=s;t({confirm_fun:async()=>{await l.jV.post("sessions/update/meta",{id:e,title:n}),await ue(k)},context_div:(0,$.jsx)("div",{className:"card-content",children:(0,$.jsx)(x.Sm,{value:n,handleInputChange:e=>{n=e}})})})},onDeleteSession:e=>{t({sub_title:"确认删除这个会话吗?",confirm_fun:async()=>{await l.jV.post("session/delete",{session_id:e}),k===e?(C(""),await ue(null)):await ue(k)}})},onShowUsageStats:async t=>{B({open:!0,title:e("字符消耗统计"),context_div:(0,$.jsx)("div",{className:"usage-stats-loading",children:e("加载中...")}),cancel:()=>B({open:!1})});try{const s=await l.jV.post("session/usage_stats",{session_id:t});if(s.code===h.m.Success&&s.data){const t=s.data;B({open:!0,title:e("字符消耗统计"),context_div:(0,$.jsxs)("div",{className:"usage-stats-panel",children:[[{l:e("对话轮次"),v:(t.turns??0).toString()},{l:e("AI输入字符"),v:W(t.input_chars)},{l:e("AI输出字符"),v:W(t.output_chars)},{l:e("AI输入字符(最近一轮)"),v:W(t.recent_input_chars)},{l:e("AI输出字符(最近一轮)"),v:W(t.recent_output_chars)}].map((e,t)=>(0,$.jsxs)("div",{className:"usage-stats-row",children:[(0,$.jsx)("span",{className:"usage-stats-label",children:e.l}),(0,$.jsx)("span",{className:"usage-stats-value",children:e.v})]},t)),(0,$.jsxs)("div",{className:"usage-stats-row usage-stats-total",children:[(0,$.jsx)("span",{className:"usage-stats-label",children:e("AI字符总计消耗")}),(0,$.jsx)("span",{className:"usage-stats-value",children:W((t.input_chars||0)+(t.output_chars||0))})]})]}),cancel:()=>B({open:!1})})}else B({open:!0,title:e("字符消耗统计"),context_div:(0,$.jsx)("div",{className:"usage-stats-empty",children:e("暂无统计数据")}),cancel:()=>B({open:!1})})}catch{B({open:!0,title:e("字符消耗统计"),context_div:(0,$.jsx)("div",{className:"usage-stats-empty",children:e("暂无统计数据")}),cancel:()=>B({open:!1})})}},batchMode:V,selectedSessionIds:G,onToggleSessionSelect:e=>{U(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},onToggleBatchMode:pe,onBatchDeleteSessions:()=>{0!==G.size&&t({sub_title:e("确认删除选中的会话吗?"),confirm_fun:async()=>{for(const e of G)await l.jV.post("session/delete",{session_id:e});U(new Set),L(!1),G.has(k)?(C(""),await ue(null)):await ue(k)}})},onClearAllSessions:()=>{t({sub_title:e("确认删除全部聊天会话吗?"),confirm_fun:async()=>{await l.jV.post("sessions/clear",{}),C(""),v([]),await ue(null)}})}}),(0,$.jsxs)("section",{className:"chat-main",children:[0===j?.length&&(0,$.jsx)("div",{className:"chat-header",children:(0,$.jsx)("div",{children:e("询问服务器的一切")})}),(0,$.jsx)(E,{messages:j,batchMode:V,selectedMsgIds:P,sending:A,chatContainerRef:Y,messagesEndRef:Z,onToggleMsgSelect:e=>{J(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},onDelete:s=>{t({sub_title:e("确认删除这条消息吗?"),confirm_fun:async()=>{const e=j.findIndex(e=>e.id===s);if(e<0)return;const t=j.filter(e=>e.id!==s);v(t),k&&l.jV.post("session/message/delete",{session_id:k,indices:[e]}).catch(console.error)}})},onCopy:async e=>{(0,d.lW)(e),(0,u.SK)("复制成功")},onToggleBatchMode:pe,t:e}),(0,$.jsx)(Q,{inputValue:M,onInputChange:e=>{const t=e.target;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,200)+"px",D(t.value)},onKeyDown:e=>{"Process"===e.key||e.nativeEvent.isComposing||e.shiftKey||e.ctrlKey||"Enter"===e.key&&(e.preventDefault(),he())},onPaste:e=>{const t=e.clipboardData?.files;t&&t.length>0&&(e.preventDefault(),ge(t))},onSend:he,sending:A,onAbort:de.abort,pendingAttachments:O,onRemoveAttachment:e=>{F(t=>t.filter((t,s)=>s!==e))},onOpenFilePicker:()=>{X.current?.click()},onAddFiles:ge,onDrop:e=>{const t=e.dataTransfer?.files;t&&t.length>0&&(e.preventDefault(),ge(t))},onDragOver:e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},fileInputRef:X,requestType:oe()})]})]})]})}},72693(e,t,s){s.d(t,{w:()=>u});var n=s(96540),a=s(22022),i=s(14944),o=s(92275),l=s(34843),c=s(82893),r=s(85997),d=s(74848);function u(){const[e,t]=(0,l.fp)(c.AG.prompt_card),{t:s}=(0,a.Bd)(),u=(0,n.useRef)([]),m=(0,n.useRef)(!1),h=(0,n.useCallback)(()=>{if(m.current)return;if(0===u.current.length)return m.current=!1,void t({open:!1});m.current=!0;const e=u.current.shift();e?t({open:!0,title:s("命令确认"),cancel:()=>{i.ws.sendData(o.HK.ai_confirm_cmd,{askId:e.askId,approved:!1}),t({open:!1}),m.current=!1,h()},context_div:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{style:{maxHeight:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"var(--surfaceSecondary)",padding:"0.75em",borderRadius:"0.5em",marginBottom:"0.75em",fontFamily:"monospace",fontSize:"0.9em",lineHeight:"1.5"},children:e.cmd}),(0,d.jsxs)("div",{style:{display:"flex",gap:"0.5em",justifyContent:"flex-end"},children:[(0,d.jsx)(r.$n,{text:s("拒绝"),color:"var(--red)",clickFun:()=>{i.ws.sendData(o.HK.ai_confirm_cmd,{askId:e.askId,approved:!1}),t({open:!1}),m.current=!1,h()}}),(0,d.jsx)(r.$n,{text:s("允许"),clickFun:()=>{i.ws.sendData(o.HK.ai_confirm_cmd,{askId:e.askId,approved:!0}),t({open:!1}),m.current=!1,h()}})]})]})}):m.current=!1},[s]),g=(0,n.useCallback)(e=>{u.current.push(e),h()},[h]);(0,n.useEffect)(()=>(i.ws.addMsg(o.HK.ai_confirm_cmd,e=>{const s=e.context||{};if(s.dismiss&&s.askId)return u.current=u.current.filter(e=>e.askId!==s.askId),void(m.current&&(m.current=!1,t({open:!1}),h()));s.askId&&s.cmd&&g({askId:s.askId,cmd:s.cmd})}),()=>{i.ws.removeMsg(o.HK.ai_confirm_cmd)}),[g]),(0,n.useEffect)(()=>()=>{u.current=[],m.current=!1},[])}},34299(e,t,s){s.r(t),s.d(t,{default:()=>p});s(96540);var n=s(73557),a=s(53995),i=s(18569),o=s(77979),l=s(8263),c=s(69428),r=s.n(c),d=(s(3775),s(21499)),u=s(99214),m=s(19878),h=(s(72411),s(74848));const g=new n.A({html:!0,highlight:function(e,t){if(t&&m.A.getLanguage(t))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${t}">${m.A.highlight(e,{language:t}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${m.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${g.utils.escapeHtml(e)}</code></pre>`}});function p(e){return(0,u.VD)(),(0,h.jsx)("div",{dangerouslySetInnerHTML:{__html:g.render(e.context)}})}g.use(a.A).use(i.A).use(o.A).use(l.A).use(r()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(t,s,n,a,i)=>{const o=t[s],l=o.content.trim(),c=o.info.trim();let r="";if(c&&m.A.getLanguage(c))try{r=m.A.highlight(l,{language:c}).value}catch(t){r=e.utils.escapeHtml(l)}else try{r=m.A.highlightAuto(l).value}catch(t){r=e.utils.escapeHtml(l)}return`\n <div class="code-block-with-copy">\n <div class="code-header">\n <span class="code-language">${c||"code"}</span>\n <button class="copy-btn" data-code="${e.utils.escapeHtml(l)}">复制</button>\n </div>\n <pre><code class="hljs ${c?`language-${c}`:""}">${r}</code></pre>\n </div>`}}).use(e=>{const t=e.renderer.rules.link_open||function(e,t,s,n,a){return a.renderToken(e,t,s)};e.renderer.rules.link_open=(e,s,n,a,i)=>{const o=e[s],l=o.attrIndex("href");if(l>=0){const e=o.attrs[l][1];o.attrs[l][1]=(0,d.bi)(window.location.href,e)}return t(e,s,n,a,i)}})},45907(e,t,s){s.d(t,{y:()=>i});var n=s(34843),a=s(82893);function i(){const[e,t]=(0,n.fp)(a.AG.confirm);return({sub_title:e,confirm_fun:s,title:n,context_div:a})=>{t({open:!0,sub_title:e,handle:()=>{s(),t({open:!1,handle:null})},title:n,context_div:a})}}},60840(e){e.exports="data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 version=%271.1%27 aria-hidden=%27true%27><path fill-rule=%27evenodd%27 d=%27M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z%27></path></svg>"}}]);
|