filecat 7.24.1 → 7.26.0
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/1448.1cfd6385d3c1f3e2701b.js +1 -0
- package/build/dist/1629.d967cef440ea02de3572.js +1 -0
- package/build/dist/2547.7cef6fbbd50f9cf353c2.js +1 -0
- package/build/dist/{2572.48803ebce6979dfb42d8.js → 2572.1aa7dbc89272a5aac4e9.js} +1 -1
- package/build/dist/3277.74d65f652a6c878e5459.js +1 -0
- package/build/dist/3355.91c4729dca10e0e0f50e.js +1 -0
- package/build/dist/3402.ab270a095e817a3341c4.js +1 -0
- package/build/dist/3753.f496e049cda74644a5e1.js +1 -0
- package/build/dist/3884.fdc1660692b436e3de29.js +1 -0
- package/build/dist/4598.380c006cc31e833f32d5.js +1 -0
- package/build/dist/47.663ae6aae79e51df2ee6.js +1 -0
- package/build/dist/6097.0a0fe33510ded61ac8e0.js +1 -0
- package/build/dist/7678.957bbb244031d8880bb1.js +1 -0
- package/build/dist/{8435.1f63fa3aa621962786b1.js → 8435.57ed600c50381d8601d8.js} +1 -1
- package/build/dist/9260.0478cac8cc727e4685a8.js +1 -0
- package/build/dist/9345.d04353131e6896dba23b.js +1 -0
- package/build/dist/9765.185439f34b34426d7e74.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.98fc7efaa6c2d9c8dc57.js +2 -0
- package/build/main.js +1 -1
- package/build/plugin/core.type.d.ts +33 -3
- package/package.json +2 -2
- package/build/dist/1448.3f0b38f99e8c1939d095.js +0 -1
- package/build/dist/159.997c74c507ded400c1b6.js +0 -1
- package/build/dist/2547.8be43571fd91ae6f383b.js +0 -1
- package/build/dist/2674.d9b1028be345304b48f4.js +0 -1
- package/build/dist/3355.83887ff6e00d984c879e.js +0 -1
- package/build/dist/3402.913056b796b3aa4dfd5f.js +0 -1
- package/build/dist/3884.7deab651e28ed4fe62c3.js +0 -1
- package/build/dist/4598.179b2ff1bb248b2742d1.js +0 -1
- package/build/dist/47.3278f9723fddd5acf5a7.js +0 -1
- package/build/dist/6097.26ddac3b40ecd7f51b86.js +0 -1
- package/build/dist/7678.6071adbabdb82553f9a4.js +0 -1
- package/build/dist/9260.92bf8b4c0fee842ac88a.js +0 -1
- package/build/dist/9765.7f276619cfb19731b85c.js +0 -1
- package/build/dist/9857.fb9f68e99b263b838288.js +0 -1
- package/build/dist/main.1590111d565f6ffdbf14.js +0 -2
- /package/build/dist/{main.1590111d565f6ffdbf14.js.LICENSE.txt → main.98fc7efaa6c2d9c8dc57.js.LICENSE.txt} +0 -0
|
@@ -53,23 +53,53 @@ export interface PluginContext {
|
|
|
53
53
|
params: {
|
|
54
54
|
[key: string]: any;
|
|
55
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* 控制 workflow 执行
|
|
58
|
+
* @param file_path - workflow 文件(.act)的绝对路径
|
|
59
|
+
* @param action - start 开始执行;stop 停止该文件正在运行的实例
|
|
60
|
+
* @param user_id - 执行身份的用户 id。不填则使用 root 用户
|
|
61
|
+
* @returns 成功返回 true,失败抛出异常(如文件不存在、无权限、已在运行)
|
|
62
|
+
*/
|
|
63
|
+
workflow_act: (file_path: string, action: 'start' | 'stop', user_id?: string) => Promise<boolean>;
|
|
56
64
|
}
|
|
57
65
|
/**
|
|
58
66
|
* 插件自定义路由定义
|
|
59
|
-
*
|
|
67
|
+
*
|
|
68
|
+
* 共支持三种类型(用 type 区分,不填默认 api):
|
|
69
|
+
* - api :自定义 API 路由,handler 直接处理请求(等价系统的「自定义 api 路由」)
|
|
70
|
+
* - resource :页面资源路由,把本地目录或 http 地址映射到一个 URL 前缀(等价「页面资源路由」)
|
|
71
|
+
*
|
|
72
|
+
* 匹配方式都是 router 前缀匹配(startsWith),同一前缀取最长匹配,因此
|
|
73
|
+
* /api/foo/bar 会优先命中 /api/foo 而不是 /api。
|
|
74
|
+
*
|
|
75
|
+
* workflow 触发不提供专用路由类型,插件在 api 路由的 handler 里自行调用
|
|
76
|
+
* context.workflow_act() 控制执行,这样触发条件、鉴权、返回值都由插件自己决定。
|
|
60
77
|
*/
|
|
78
|
+
export type PluginRouteType = 'api' | 'resource';
|
|
79
|
+
/** 插件自定义路由 定义 */
|
|
61
80
|
export interface PluginRoute {
|
|
62
|
-
/**
|
|
81
|
+
/** 路由类型,默认 'api' */
|
|
82
|
+
type?: PluginRouteType;
|
|
83
|
+
/** 路由前缀,任意路径都可以(不再限定 /api 开头),例如 /plugin/my-route */
|
|
63
84
|
router: string;
|
|
64
85
|
/** 是否需要鉴权,默认 true */
|
|
65
86
|
needAuth?: boolean;
|
|
66
87
|
/**
|
|
67
88
|
* 路由处理函数
|
|
89
|
+
* 仅 type === 'api' 时使用。
|
|
68
90
|
* @param req - Express Request 对象,插件自己读取 body、headers 等
|
|
69
91
|
* @param res - Express Response 对象,插件自己控制响应
|
|
70
92
|
* @returns 返回的内容会作为 HTTP 响应发送,返回 null/undefined 则不自动发送(由插件自己通过 res 发送)
|
|
71
93
|
*/
|
|
72
|
-
handler
|
|
94
|
+
handler?: (req: import('express').Request, res: import('express').Response) => Promise<string | object | null | undefined>;
|
|
95
|
+
/**
|
|
96
|
+
* 资源路径
|
|
97
|
+
* 仅 type === 'resource' 时使用。
|
|
98
|
+
* 填本地绝对路径(目录,访问时会拼接 router 之后的剩余路径)或 http(s) 地址(做反向代理)。
|
|
99
|
+
*/
|
|
100
|
+
location?: string;
|
|
101
|
+
/** 浏览器缓存时间(秒)。仅 type === 'resource' 且 location 为本地目录时生效 */
|
|
102
|
+
cache_length?: number;
|
|
73
103
|
}
|
|
74
104
|
/**
|
|
75
105
|
* 插件定义[cite: 4] 可以默认导出
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "filecat",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.26.0",
|
|
4
4
|
"description": "A self-hosted Web File browser and lightweight server management tool.",
|
|
5
5
|
"author": "xiaobaidadada",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@xiaobaidadada/node-tuntap2-wintun": "^3.0.2",
|
|
46
46
|
"@xiaobaidadada/ssh2-prebuilt": "^1.16.0",
|
|
47
47
|
"better-sqlite3": "^12.6.2",
|
|
48
|
-
"node-libsmb2": "1.
|
|
48
|
+
"node-libsmb2": "1.4.1",
|
|
49
49
|
"node-process-watcher": "^1.7.7"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1448],{83277(e,t,n){n.d(t,{$j:()=>a,CP:()=>l,Lv:()=>i,cL:()=>s});class i{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";yaml_env="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const n of t)if(n.value===e)return n.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const n of t)if(n.value===e)return!0;return!1}}const l="\n# 聊天循环最大次数\ntool_call_max: 500\n\n# 是否允许AI直接执行命令而不需要用户确认。\n# 默认为 false,需要用户手动确认;使用 workflow 时等价于 true。\nallow_exec_cmd_directly: false\n\n# 可选的大模型请求代理地址\n# proxy_url: http://127.0.0.1:7890\n\n# 可选的多个 url\n# options_agent_url_list:\n# - value: http://...\n# label: openai\n\n# 可选的多个 key\n# options_agent_key_list:\n# - value: sk-aaa\n# label: option1\n\n# 可选的多个 model\n# options_agent_model_list:\n# - value: gpt-5.5\n# label: gpt\n\n# 本地 prompt 文件列表,每次聊天时自动读取并加载\n# options_local_file_path_prompt_list:\n# - /prompt/a.txt\n\n# 开启切换模型,AI 可以根据 prompt 自己决定下一步调用哪个模型\n# open_pick_model: false\n\n# 历史消息裁剪相关\nmax_recent_messages: 12\ncompress_message_count: 16\nmax_tool_content_chars: 200\n\n# 是否在请求里带上 stream_options.include_usage,让接口返回 usage 数据\n# 开启后可拿到 cached_tokens / reasoning_tokens,token 统计更准确\n# 非 OpenAI 风格的接口传了可能报错,按服务商决定\n# usage_request_param: true\n\n# 是否关闭 token 数量统计(不再估算 token,usage_stats 不累加)\n# close_token_count: true\n\n# ===== 模型类型(request_type)=====\n# 默认 completions,可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n# request_type: completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,供 AI agent 动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n# tool_mode: false\n\n# ===== 图片理解(image_understanding)=====\n# 开启后注册 read_image 工具,工具读到的图片会以 image_url 多模态格式随消息发给模型。\nimage_understanding: true\n\n# ===== 命令环境变量(command_env)=====\n# AI 调用内置命令工具(exec_cmd / exec_cmd_background)执行命令时,\n# 这里配置的变量会覆盖到子进程的环境变量上。\n# command_env:\n# NODE_ENV: production\n# HTTP_PROXY: http://127.0.0.1:7890\n\n# 是否允许 AI 通过 set_command_env 工具修改上面的 command_env\ncommand_env_tool: false\n";const s=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function a(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}},11448(e,t,n){n.r(t),n.d(t,{PLATFORM_META:()=>g,RebotCard:()=>v,RebotCardContainer:()=>f,default:()=>y});var i=n(22022),l=n(96540),s=n(85997),a=n(4412),o=n(75725),r=n(61443),c=n(70447),d=n(14284),p=n(53459),_=n(62042),m=n(78247),h=n(23430),u=n(52671),x=(n(83277),n(92350)),j=n(74848);const g={qq:{key:"qq",label:"QQ 机器人",icon:"QQ",color:"#12B7F5",fields:[{key:"appId",label:"AppId",type:"text",placeholder:"请输入机器人 AppId",required:!0},{key:"clientSecret",label:"密钥",type:"password",placeholder:"请输入机器人密钥",required:!0}]},dingtalk:{key:"dingtalk",label:"钉钉机器人",icon:"钉钉",color:"#0089FF",fields:[{key:"appId",label:"ClientId (AppKey)",type:"text",placeholder:"请输入应用 ClientId",required:!0},{key:"clientSecret",label:"ClientSecret (AppSecret)",type:"password",placeholder:"请输入应用 ClientSecret",required:!0}]},wecom:{key:"wecom",label:"企业微信机器人",icon:"企业微信",color:"#07C160",fields:[{key:"appId",label:"botId",type:"text",placeholder:"请输入机器人 botId",required:!0},{key:"clientSecret",label:"Secret",type:"password",placeholder:"请输入机器人 Secret",required:!0}]},lark:{key:"lark",label:"飞书机器人",icon:"飞书",color:"#3370FF",fields:[{key:"appId",label:"App ID",type:"text",placeholder:"请输入应用 App ID",required:!0},{key:"clientSecret",label:"App Secret",type:"password",placeholder:"请输入应用 App Secret",required:!0}]}},b=Object.entries(g).map(([e,t])=>({value:e,title:t.label,color:t.color}));function f(e){const{t}=(0,i.Bd)(),[n,a]=(0,l.useState)(!1),[o,c]=(0,l.useState)(!1),d=(t,n)=>{const i=[...e.items];i[t]={...i[t],...n},e.setItems(i)},p=t=>{const n=[...e.items];n.splice(t,1),e.setItems(n)},_=t=>{e.setItems([...e.items,{...e.items[t],open:!1,name:(e.items[t].name||"")+" (副本)"}])};return(0,j.jsxs)(l.Fragment,{children:[(0,j.jsx)("div",{className:"airebot-setting__toolbar",children:!1!==e.have_auth_edit&&(0,j.jsxs)(j.Fragment,{children:[n?(0,j.jsxs)("div",{className:"airebot-setting__add-select",children:[(0,j.jsx)(r.l6,{options:b,defaultValue:"qq",onChange:t=>{return n=t,e.setItems([...e.items,{platform:n,name:"",open:!1,appId:"",clientSecret:"",note:""}]),void a(!1);var n},width:"180px"}),(0,j.jsx)(s.rA,{icon:"cancel",title:t("取消"),onClick:()=>a(!1)})]}):(0,j.jsx)(s.rA,{icon:"add",title:t("添加机器人"),onClick:()=>a(!0)}),(0,j.jsx)(s.rA,{icon:"save",title:t(o?"保存中...":"保存"),onClick:()=>{o||(async()=>{c(!0),await e.save(),c(!1)})()}})]})}),0===e.items.length?(0,j.jsxs)("div",{className:"airebot-setting__empty",children:[(0,j.jsx)("span",{className:"material-symbols-outlined airebot-setting__empty-icon",children:"smart_toy"}),(0,j.jsx)("p",{children:t("还没有配置任何机器人")}),(0,j.jsx)("p",{className:"airebot-setting__empty-hint",children:t("点击上方「添加机器人」按钮来开始配置")})]}):(0,j.jsx)("div",{className:"airebot-setting__grid",children:e.items.map((e,t)=>(0,j.jsx)(v,{item:e,index:t,onChange:d,onDelete:p,onCopy:_},t))})]})}const v=({item:e,index:t,onChange:n,onDelete:l,onCopy:a})=>{const{t:o}=(0,i.Bd)(),d=g[e.platform]??g.qq,p=e._status||"disconnected";e.open;return(0,j.jsx)(c.Zp,{self_title:(0,j.jsx)("div",{className:"airebot-setting__card-header",children:(0,j.jsx)("span",{className:"material-symbols-outlined airebot-setting__card-icon",style:{color:d.color},children:d.icon})}),rightTopCom:(0,j.jsxs)("div",{className:"airebot-setting__card-actions",children:[(0,j.jsx)(s.Ay,{checked:!!e.open,onChange:e=>n(t,{open:e})}),(0,j.jsx)(s.rA,{icon:"content_copy",title:o("复制"),onClick:()=>a(t)}),(0,j.jsx)(s.rA,{icon:"delete",title:o("删除"),onClick:()=>l(t)})]}),children:(0,j.jsxs)("div",{className:"airebot-setting__card-fields",children:[(0,j.jsxs)("div",{className:"airebot-setting__field",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("平台")}),(0,j.jsx)(r.l6,{options:b,value:e.platform,onChange:e=>n(t,{platform:e}),width:"100%"})]}),(0,j.jsxs)("div",{className:"airebot-setting__field",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("名称")}),(0,j.jsx)(r.Sm,{value:e.name||"",handleInputChange:e=>n(t,{name:e}),placeholder:o("给机器人起个名字")})]}),d.fields.map(i=>{const l=e[i.key]??"";return(0,j.jsxs)("div",{className:"airebot-setting__field",children:[(0,j.jsxs)("label",{className:"airebot-setting__field-label",children:[i.label,i.required&&(0,j.jsx)("span",{className:"airebot-setting__field-required",children:"*"})]}),(0,j.jsx)(r.Sm,{type:i.type,value:l,handleInputChange:e=>n(t,{[i.key]:e}),placeholder:i.placeholder})]},i.key)}),(0,j.jsxs)("div",{className:"airebot-setting__field ",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("模型编号")}),(0,j.jsx)(r.Sm,{value:e.model_index,handleInputChange:e=>n(t,{model_index:e}),placeholder:o("使用指定模型(可选)")})]}),(0,j.jsxs)("div",{className:"airebot-setting__field ",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("用户id")}),(0,j.jsx)(r.Sm,{value:e.user_id||"",handleInputChange:e=>n(t,{user_id:e}),placeholder:o("默认使用root账户(继承权限,可选)")})]}),(0,j.jsxs)("div",{className:"airebot-setting__field airebot-setting__field-full",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("备注")}),(0,j.jsx)(r.Sm,{value:e.note||"",handleInputChange:e=>n(t,{note:e}),placeholder:o("备注信息(可选)")})]})]})})};function y(){const{t:e}=(0,i.Bd)(),t=(0,u.Zp)(),{check_user_auth:n}=(0,m.MH)(),[r,c]=(0,l.useState)([]),g=(0,x.Q)(),b=async()=>{const e=await d.XO.get("ai_rebot_setting");e.code===p.m.Success&&c(e.data?.list??[])};(0,l.useEffect)(()=>{b()},[]);return(0,j.jsxs)("div",{className:"airebot-setting",children:[(0,j.jsx)(a.aZ,{position:"right",children:n(h.oV.ai_agent_setting)&&(0,j.jsx)(s.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>t(-1)})}),(0,j.jsx)(o.fI,{children:(0,j.jsxs)(o.VP,{widthPer:100,children:[(0,j.jsxs)("div",{className:"airebot-setting__page-title",children:[(0,j.jsx)("h2",{children:e("机器人配置")}),(0,j.jsx)(s.rA,{icon:"info",onClick:()=>{g("机器人配置")},title:"信息"})]}),(0,j.jsx)(f,{items:r,setItems:c,save:async()=>{const t={list:r.map((e,t)=>({...e,index:t}))};(await d.XO.post("ai_rebot_setting/save",t)).code===p.m.Success&&((0,_.SK)(e("保存成功")),await b())},have_auth_edit:n(h.oV.ai_agent_setting)})]})})]})}},92350(e,t,n){n.d(t,{Q:()=>p,o:()=>m});var i=n(34843),l=n(82893),s=n(74777),a=n(96540),o=n(22022),r=n(23430),c=n(14284),d=n(74848);function p(){const[e,t]=(0,i.fp)(l.AG.prompt_card),{t:n,i18n:a}=(0,o.Bd)();return e=>{let i;e===s.jk.ffmpeg?i=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===s.jk.smartmontools?i=(0,d.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?i=(0,d.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,d.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?i=(0,d.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?i=(0,d.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?i=(0,d.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?i=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,d.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?i=(0,d.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?i=(0,d.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?i=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,d.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,d.jsxs)("li",{children:[(0,d.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,d.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,d.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,d.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?i=(0,d.jsx)("div",{children:n("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(i=(0,d.jsxs)("div",{children:[(0,d.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,d.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,d.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,d.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,d.jsx)("div",{children:i})})}}let _=r.Ky;function m(){const[e,t]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{try{const e=await c.XO.get("themes");if(0===e.code){const n=e.data||[];_=[...r.Ky,...n],t(_)}else console.warn("获取主题列表失败,使用默认列表"),t(_)}catch(e){t(_)}})()},[]),e}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[159],{77481(e,t,s){s.d(t,{S:()=>o,X:()=>l});var n=s(96540),i=s(61443),a=s(74848);function l(e){const[t,s]=n.useState([]),l=(0,n.useRef)(-1),[o,r]=(0,n.useState)(-1),[d,c]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const u=()=>{l.current=-1,r(-1),c(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let l=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(l=`${t} (${n.label})`)}return(0,a.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,a.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:l}):t},s)})})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,a.jsx)("tr",{className:n?(o===s?"row-dragging":"")+(d===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(l.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||l.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",c(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=l.current,s=d;u(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:u,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,a.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function o(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))})}},20159(e,t,s){s.r(t),s.d(t,{default:()=>fe});var n=s(96540),i=s(75725),a=s(23430),l=s(70447),o=s(85997),r=s(61443),d=s(14284),c=s(53459),u=s(77481),h=s(22022),m=s(82893),p=s(40505),_=s(62042),x=s(21499),j=s(21469),v=s(64694),f=s(74848);function g(e){const{t}=(0,h.Bd)(),[s,a]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();a(t)}})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e.title}),e.info_click&&(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");a([t,...s])}}),(0,f.jsx)(o.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,f.jsx)(u.X,{headers:e.headers,rows:s.map((n,i)=>{const l=[];for(let t=0;t<e.headers.length;t++)l.push((0,f.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,a([...s])},no_border:!0}));return l.push((0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),a([...s])})(i)}),n[0]&&(0,f.jsx)(o.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,x.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,p.lW)(e),(0,_.SK)(e)}}),n[0]&&e.need_copy&&(0,f.jsx)(o.rA,{icon:"open_in_new",title:t("打开新页面"),onClick:()=>{const e=(0,x.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);window.open(e)}})]})),l}),width:"10rem",onRowDrag:(e,t)=>{a((0,v.TI)(s,e,t))}})})})}var w=s(34843),y=s(78247),b=s(24659);function C(){const{t:e}=(0,h.Bd)(),[t,s]=(0,w.fp)(m.AG.prompt_card),a=(0,b.K)(),g=[e("路由"),e("auth"),e("备注")],[C,S]=(0,w.fp)(m.AG.editorSetting),[k,A]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("api/customer_router");e.code===c.m.Success&&A(e.data)})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("api_rt")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{(()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})})()},title:"信息"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A([{note:"",needAuth:!1,router:""},...k])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("api/customer_router/save",k)).code===c.m.Success&&(0,_.SK)(e("保存成功"))}})]}),children:(0,f.jsx)(u.X,{headers:g,rows:k.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,A([...k])},no_border:!0}),(0,f.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,A([...k])},options:a,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,A([...k])},no_border:!0}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),A([...k])})(s)}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(async t=>{if(!t.router)return void(0,_.zN)(e("路由不能为空"));const s=await d.XO.get(`jscode/${encodeURIComponent(t.router)}`);S({model:"ace/mode/javascript",open:!0,fileName:t.router,save:async s=>{const n={context:s,router:t.router};(await d.XO.post("jscode/save",n)).code===c.m.Success&&(y.xK.set_value_temp(""),S({open:!1,model:"",fileName:"",save:null}),(0,_.SK)(e("成功")))}}),y.xK.set_value_temp(s.data)})(t)}),t.router&&(0,f.jsx)(o.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,p.lW)((0,x.bi)(window.location.origin+j.m.base_url,t.router)),(0,_.SK)(e("已复制"))}})]})];return n}),width:"10rem",onRowDrag:(e,t)=>{A((0,v.TI)(k,e,t))}})})})}var S=s(23496),k=s(4412);function A(){const{t:e}=(0,h.Bd)(),[t,s]=(0,w.fp)(m.AG.prompt_card),[a,l]=(0,w.fp)(m.AG.router_jump),o=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(k.aZ,{position:"right"}),(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{maxWidth:"50rem",children:[(0,f.jsx)(g,{title:e("页面资源路由"),headers:o,getItems:async()=>{const t=await d.XO.get(S.s.setting_customer_router);if(t.code===c.m.Success){if(a?.page_self_router_api_data){for(const s of t.data)s[1]===a?.page_self_router_api_data[1]&&(0,_.N9)(e("已经存在的页面资源路由配置目录设置"));const s={};Object.assign(s,a?.page_self_router_api_data),t.data=[s,...t.data],l({})}return t.data}return[]},save:async e=>{(await d.XO.post(S.s.setting_customer_router_save,e)).code===c.m.Success&&(0,_.SK)("success")},info_click:()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由,会自动识别地址,将页面转到对应结果。路径支持文件路径(如果是文件夹路径的最后最后一个名字将会成为资源实际地址,整个目录将会变成一个http目录),http地址。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})},need_copy:!0}),(0,f.jsx)(g,{title:e("wf_rt"),headers:r,getItems:async()=>{const e=await d.XO.get(S.s.setting_customer_workflow_router);return e.code===c.m.Success?e.data:[]},save:async t=>{(await d.XO.post(S.s.setting_customer_workflow_router_save,t)).code===c.m.Success&&(0,_.SK)(e("保存成功"))},info_click:()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由,文件路径是有效的workflow路径。token也可以是文件绝对路径,请求的时候请设置同样的authorization请求头字段。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})}})]}),(0,f.jsx)(i.VP,{maxWidth:"50rem",children:(0,f.jsx)(C,{})})]})]})}var I=s(74777),N=s(64484),V=s(18840),$=s(6960),B=s(7523);function X(){const{t:e}=(0,h.Bd)(),[,t]=(0,w.fp)(m.AG.prompt_card),[s,i]=(0,n.useState)(""),[a,p]=(0,n.useState)(5610),[x,j]=(0,n.useState)(5710);(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("sys_option/status");if(e.code===c.m.Success){const t=e.data?.sys_env;i((t?.browser_proxy_allow||[]).join("\n")),p(t?.browser_proxy_port_start||5610),j(t?.browser_proxy_port_end||5710)}})()},[]);return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("网页代理")}),(0,f.jsx)(o.rA,{icon:"info",title:e("信息"),onClick:()=>{t({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:(0,f.jsx)("div",{children:e("wbvpn_tip")})})})}})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{const t=s.split("\n").map(e=>e.trim()).filter(e=>!!e);(await d.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{browser_proxy_allow:t,browser_proxy_port_start:Number(a)||5610,browser_proxy_port_end:Number(x)||5710}})).code===c.m.Success&&(0,_.SK)(e("修改成功"))}}),children:[(0,f.jsx)("div",{children:e("wbvpn_allow")}),(0,f.jsx)(r.Z2,{style:{minHeight:"5rem",resize:"vertical"},placeholder:e("wbvpn_allow_ph"),value:s,onChange:e=>{i(e.target.value)}}),(0,f.jsx)("div",{children:e("wbvpn_port_range")}),(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(r.Sm,{placeholder:"5610",value:a,handleInputChange:e=>p(e)}),(0,f.jsx)("span",{style:{padding:"0 6px"},children:"-"}),(0,f.jsx)(r.Sm,{placeholder:"5710",value:x,handleInputChange:e=>j(e)})]})]})}function F(){const[e,t]=(0,n.useState)(""),[s,a]=(0,n.useState)(""),[p,x]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,b]=(0,n.useState)(!1),[C,A]=(0,n.useState)(""),[F,P]=(0,w.fp)(m.AG.prompt_card),[,K]=(0,w.fp)(m.AG.editorSetting),[z,O]=(0,n.useState)(I.aM.close),[T,E]=(0,n.useState)(!1),[M,q]=(0,n.useState)(I.Hb.independent),D=(0,N.T)(),[G,W]=(0,n.useState)(void 0),[H,R]=(0,n.useState)(""),{t:U,i18n:Z}=(0,h.Bd)(),J=[`- ${U("过期策略:默认表示使用系统内置的1小时过期时间;指定时间按填写的秒数过期;永不过期则token一直有效")}`,`- ${U("独立token:每次登录都签发新的token,同一账号可以在多个设备同时登录,互不影响")}`,`- ${U("复用token:该账号已有未过期的token时直接复用它,不会签发新的")}`,`- ${U("单会话:每次登录签发新的token,并让该账号此前的所有token立即失效")}`].join("\n"),[L,Q]=(0,w.fp)(m.AG.user_base_info),{check_user_auth:Y}=(0,y.MH)(),{initUserInfo:ee}=(0,n.useContext)(B.F),te=async()=>{const e=await d.XO.get("sys_option/status");if(e.code===c.m.Success){b(e.data.recycle_open),A(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),a(s?.logo||""),x(s?.show_login_user_info),v(s?.http_proxy||""),R(s?.control_env_str||V.CU)}const s=await d.XO.get("token");if(s.code===c.m.Success){const e=s.data;if(!e)return;e.length&&W(e.length),e.mode&&O(e.mode),void 0!==e.persist&&E(e.persist),void 0!==e.session_mode&&q(e.session_mode)}};(0,n.useEffect)(()=>{te()},[]);return(0,f.jsxs)("div",{children:[(0,f.jsx)(k.aZ,{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("span",{className:"credits",children:[U("系统运行于"),": ",(0,$.s)(L.runing_time_length)]}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:7.24.1",null!=L.latest_version&&"7.24.1"!==L.latest_version?` -> ${L.latest_version}`:""]})}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsx)("a",{href:U("官网地址"),target:"_blank",children:`filecat ${U("功能文档")}`})}),(0,f.jsxs)("span",{className:"credits",children:[U("安装方式")," :",L.process_env_run_env]})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:U("通用设置")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{P({open:!0,title:U("信息"),context_div:(0,f.jsx)("div",{children:(0,f.jsx)("div",{children:U("sys_env_setting_tip")})})})},title:U("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:U("确定修改"),clickFun:async()=>{(await d.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{web_site_title:e,show_login_user_info:p,http_proxy:j,logo:s}})).code===c.m.Success&&((0,_.SK)(U("修改成功")),ee())}}),rightTopCom:(0,f.jsx)(o.rA,{icon:"tune",title:U("环境控制"),onClick:()=>{y.xK.set_value_temp(H||V.CU),K({model:"ace/mode/yaml",open:!0,fileName:"",not_auto_save:!0,save:async e=>{const t=await d.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{control_env_str:e}});t.code===c.m.Success?(R(e),(0,_.SK)(U("修改成功")),te()):(0,_.zN)(`${t.message??U("保存失败")}`)}})}}),children:[U("网站标题"),(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),U("网站 Logo"),(0,f.jsx)(r.Sm,{placeholder:U("lclorur"),value:s,handleInputChange:e=>{a(e)}}),U("lgn_usr"),(0,f.jsx)("input",{type:"checkbox",checked:p,onChange:()=>{x(!p)}})]}),(0,f.jsx)(X,{})]}),(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:U("文件回收站")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{P({open:!0,title:U("信息"),context_div:(0,f.jsx)("div",{children:U("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:U("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:U("确定修改"),clickFun:async()=>{if(g&&!C)return void(0,_.zN)(U("目录不能为空"));(await d.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:C,open:g})).code===c.m.Success&&(0,_.SK)(U("修改成功"))}}),children:[(0,f.jsx)(r.Sm,{placeholder:U("目录"),value:C,handleInputChange:e=>{A(e)}}),(0,f.jsx)(r.l6,{value:g,onChange:e=>{b(e)},options:[{title:U("开启"),value:!0},{title:U("关闭"),value:!1}]})]}),(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:U("会话token设置")}),(0,f.jsx)(o.rA,{icon:"info",title:U("登录会话"),onClick:()=>D(J)})]}),rightBottomCom:(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(o.C3,{text:U("清空token"),clickFun:async()=>{(await d.XO.get("token/clear")).code===c.m.Success&&(0,_.SK)(U("清理完成,重新登录"))}}),(0,f.jsx)(o.C3,{text:U("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=z,e.persist=T,e.session_mode=M,I.aM.length!==e.mode||G||(0,_.zN)(U("秒数不能为空")),e.length=parseInt(G);(await d.XO.post("token/save",e)).code===c.m.Success&&(0,_.SK)(U("保存成功"))}})]}),children:[(0,f.jsxs)("div",{className:"form_group",children:[(0,f.jsx)("div",{className:"form_label",children:U("过期策略")}),(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(r.U6,{name:"token_time_mode",value:1,context:U("默认"),selected:z===I.aM.close,onchange:()=>{O(I.aM.close)}}),(0,f.jsx)(r.U6,{name:"token_time_mode",value:1,context:U("指定时间"),selected:z===I.aM.length,onchange:()=>{O(I.aM.length)}}),(0,f.jsx)(r.U6,{name:"token_time_mode",value:1,context:U("永不过期"),selected:z===I.aM.forver,onchange:()=>{O(I.aM.forver)}})]}),z===I.aM.length&&(0,f.jsx)(r.Sm,{placeholder:U("秒"),value:G,handleInputChange:e=>{W(e)}}),(0,f.jsx)(r.GL,{context:U("持久化"),selected:T,onchange:()=>E(!T)})]}),(0,f.jsxs)("div",{className:"form_group",children:[(0,f.jsx)("div",{className:"form_label",children:U("登录会话")}),(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(r.U6,{name:"token_session_mode",value:I.Hb.independent,context:U("独立token"),selected:M===I.Hb.independent,onchange:()=>q(I.Hb.independent)}),(0,f.jsx)(r.U6,{name:"token_session_mode",value:I.Hb.reuse,context:U("复用token"),selected:M===I.Hb.reuse,onchange:()=>q(I.Hb.reuse)}),(0,f.jsx)(r.U6,{name:"token_session_mode",value:I.Hb.single,context:U("单会话"),selected:M===I.Hb.single,onchange:()=>q(I.Hb.single)})]})]})]})]})]})})]})}var P=s(92350),K=s(69675),z=s(32361);const O=[{key:"second",min:0,max:59,label:"秒"},{key:"minute",min:0,max:59,label:"分"},{key:"hour",min:0,max:23,label:"时"},{key:"day",min:1,max:31,label:"日"},{key:"month",min:1,max:12,label:"月"},{key:"week",min:0,max:7,label:"星期"}];function T(e){switch(e.mode){case"step":return`*/${e.step??1}`;case"range":return`${e.from??0}-${e.to??0}`;case"list":return(e.values??[]).join(",");default:return"*"}}function E(e){return[T(e.second),T(e.minute),T(e.hour),T(e.day),T(e.month),T(e.week)].join(" ")}function M(e,t,s){const n=(e??"").trim();if(!n)return null;if("*"===n)return{mode:"every"};if(n.startsWith("*/")){const e=Number(n.slice(2));return!Number.isInteger(e)||e<=0?null:{mode:"step",step:e}}if(n.includes("-")&&!n.includes(",")){const[e,i]=n.split("-").map(Number);return Number.isInteger(e)&&Number.isInteger(i)?e<t||i>s||e>i?null:{mode:"range",from:e,to:i}:null}const i=n.split(","),a=[];for(const e of i){const n=Number(e.trim());if(!Number.isInteger(n)||n<t||n>s)return null;a.push(n)}return 0===a.length?null:{mode:"list",values:a}}function q(e){const t=(e??"").trim().split(/\s+/);if(6!==t.length)return null;const s={};for(let e=0;e<6;e++){const n=O[e],i=M(t[e],n.min,n.max);if(!i)return null;s[n.key]=i}return s}function D(e){return e<10?`0${e}`:`${e}`}function G(e,t,s){switch(e.mode){case"step":return`每 ${e.step} ${t}`;case"range":return`${e.from} 到 ${e.to} ${t}`;case"list":return`${(e.values??[]).slice().sort((e,t)=>e-t).join("、")} ${t}`;default:return null}}function W(e){const{second:t,minute:s,hour:n,day:i,month:a,week:l}=e,o=(e,t)=>"list"===e.mode&&1===(e.values??[]).length&&e.values[0]===t,r=[];if("list"===n.mode&&"list"===s.mode&&o(t,0)){const e=(n.values??[]).slice().sort((e,t)=>e-t),t=(s.values??[]).slice().sort((e,t)=>e-t);e.length===t.length&&e.length>1&&t.length>1?r.push(e.map((e,s)=>`${D(e)}:${D(t[s])}`).join("、")):1===e.length&&1===t.length?r.push(`${D(e[0])}:${D(t[0])}`):r.push(`${e.map(D).join("、")} 时 ${t.join("、")} 分`)}else if("list"===n.mode&&"step"===s.mode&&o(t,0))r.push(`${(n.values??[]).map(D).join("、")} 时内每 ${s.step} 分钟`);else if("every"===n.mode&&"list"===s.mode&&o(t,0))r.push(`每小时的 ${(s.values??[]).join("、")} 分`);else if("every"===n.mode&&"step"===s.mode&&o(t,0))r.push(`每 ${s.step} 分钟`);else if("every"===n.mode&&"every"===s.mode&&o(t,0))r.push("每分钟");else if("every"===n.mode&&"every"===s.mode&&"step"===t.mode)r.push(`每 ${t.step} 秒`);else if("every"===n.mode&&"every"===s.mode&&"every"===t.mode)r.push("每秒");else if("every"===n.mode&&"every"===s.mode&&"list"===t.mode)r.push(`每分钟的第 ${(t.values??[]).join("、")} 秒`);else{const e=[],i=G(n,"时"),a=G(s,"分"),l=o(t,0)?null:G(t,"秒");i&&e.push(i),a&&e.push(a),l&&e.push(l),e.length>0&&r.push(e.join(" "))}const d="list"===i.mode&&1===(i.values??[]).length?i.values[0]:null,c="list"===a.mode&&1===(a.values??[]).length?a.values[0]:null,u="list"===l.mode&&1===(l.values??[]).length?l.values[0]:null;let h="";if(null!==c&&null!==d)h=`每年 ${c} 月 ${d} 号`;else if(null!==c)h=`每年 ${c} 月`;else if(null!==d)h=`每月 ${d} 号`;else if(null!==u)h=`每${["周日","周一","周二","周三","周四","周五","周六","周日"][u]??`星期 ${u}`}`;else{const e=[];"every"!==a.mode&&e.push(G(a,"月")),"every"!==i.mode&&e.push(G(i,"号")),"every"!==l.mode&&e.push(`星期 ${G(l,"")}`),e.length&&(h=e.join(" "))}h||(h="每天");const m=r.join(",");return/^(每|每天)/.test(m)?`${m}${"每天"===h?"":","+h} 执行`:`${h} ${m} 执行`}const H=[{label:"任意 (*)",value:"every"},{label:"每隔 (*/n)",value:"step"},{label:"区间 (a-b)",value:"range"},{label:"指定 (a,b)",value:"list"}];function R(e,t,s=!1){const n=[];for(let i=e;i<=t;i++)n.push({label:s?String(i).padStart(2,"0"):String(i),value:i});return n}const U=({label:e,field:t,min:s,max:i,pad:a,week_label:l,onChange:o})=>{const d=(0,n.useMemo)(()=>R(s,i,a),[s,i,a]),c=(0,n.useMemo)(()=>{if(!l)return d;const e=["周日","周一","周二","周三","周四","周五","周六","周日"];return d.map(t=>({value:t.value,label:`${t.value} (${e[t.value]})`}))},[d,l]);return(0,f.jsxs)("div",{className:"cron-field",children:[(0,f.jsx)("span",{className:"cron-field__label",children:e}),(0,f.jsx)(r.l6,{value:t.mode,onChange:e=>{o("every"===e?{mode:"every"}:"step"===e?{mode:"step",step:t.step??1}:"range"===e?{mode:"range",from:t.from??s,to:t.to??i}:{mode:"list",values:t.values??[s]})},options:H,no_border:!0,width:"7.5rem"}),"step"===t.mode&&(0,f.jsxs)("div",{className:"cron-field__param",children:[(0,f.jsx)("span",{children:"每"}),(0,f.jsx)(r.l6,{value:t.step??1,onChange:e=>o({mode:"step",step:e}),options:R(1,i),no_border:!0,width:"4.5rem"}),(0,f.jsx)("span",{children:e})]}),"range"===t.mode&&(0,f.jsxs)("div",{className:"cron-field__param",children:[(0,f.jsx)(r.l6,{value:t.from??s,onChange:e=>o({mode:"range",from:e,to:t.to??i}),options:c,no_border:!0,width:"6.5rem"}),(0,f.jsx)("span",{children:"到"}),(0,f.jsx)(r.l6,{value:t.to??i,onChange:e=>o({mode:"range",from:t.from??s,to:e}),options:c,no_border:!0,width:"6.5rem"})]}),"list"===t.mode&&(0,f.jsxs)("div",{className:"cron-field__param cron-field__param--list",children:[(t.values??[]).map((e,s)=>(0,f.jsxs)("span",{className:"cron-tag",children:[(0,f.jsx)(r.l6,{value:e,onChange:e=>((e,s)=>{const n=[...t.values??[]];n[e]=s,o({mode:"list",values:n})})(s,e),options:c,no_border:!0,width:"6.5rem"}),(0,f.jsx)("i",{className:"material-icons cron-tag__del",onClick:()=>(e=>{const s=(t.values??[]).filter((t,s)=>s!==e);o(s.length?{mode:"list",values:s}:{mode:"every"})})(s),children:"close"})]},s)),(0,f.jsx)("i",{className:"material-icons cron-tag__add",onClick:()=>{const e=[...t.values??[]],n=new Set(e);let a=s;for(;n.has(a)&&a<i;)a++;o({mode:"list",values:[...e,a]})},children:"add"})]})]})};const Z=[{label:"每分钟",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},second:{mode:"list",values:[0]}})},{label:"每 5 分钟",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},minute:{mode:"step",step:5},second:{mode:"list",values:[0]}})},{label:"每小时",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每天 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每天 8 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[8]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每周一 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]},week:{mode:"list",values:[1]}})},{label:"每月 1 号 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]},day:{mode:"list",values:[1]}})}],J=({value:e,onChange:t,no_border:s})=>{const[i,a]=(0,n.useState)(!1),l=(0,n.useRef)(null),o=(0,n.useRef)(null),r=(0,n.useMemo)(()=>q(e??"")??{second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"}},[e]),d=!!e&&!q(e??""),c=(0,z.r)({active:i,trigger_ref:l,floating_ref:o,width:384,max_height:26});(0,K.$)(i,[l,o],()=>a(!1));const u=e=>{t(E(e))};return(0,f.jsxs)("div",{className:"cron-input "+(i?"cron-input--open":""),children:[(0,f.jsxs)("div",{ref:l,className:"cron-input__display "+(s?"cron-input__display--no-border":""),title:d?"表达式格式不正确":`${e||""} ${W(r)}`.trim(),onClick:()=>a(!i),children:[(0,f.jsx)("span",{className:"cron-input__expr "+(d?"cron-input__expr--invalid":""),children:e||"(未设置)"}),!s&&(0,f.jsx)("span",{className:"cron-input__desc",children:d?"表达式格式不正确":W(r)}),(0,f.jsx)("i",{className:"material-icons cron-input__arrow",children:"arrow_drop_down"})]}),i&&(0,f.jsxs)("div",{ref:o,className:"cron-editor",style:{left:c.left,top:c.top,...c.css_vars,visibility:c.ready?"visible":"hidden"},children:[(0,f.jsxs)("div",{className:"cron-editor__scroll",children:[(0,f.jsxs)("div",{className:"cron-editor__row",children:[(0,f.jsx)("span",{className:"cron-editor__title",children:"常用"}),(0,f.jsx)("div",{className:"cron-editor__presets",children:Z.map(e=>(0,f.jsx)("button",{className:"cron-preset",onClick:()=>u(e.make()),children:e.label},e.label))})]}),(0,f.jsx)("div",{className:"cron-editor__fields",children:O.map(e=>(0,f.jsx)(U,{label:e.label,field:r[e.key],min:e.min,max:e.max,pad:"day"!==e.key&&"month"!==e.key&&"week"!==e.key,week_label:"week"===e.key,onChange:t=>{return s=e.key,n=t,void u({...r,[s]:n});var s,n}},e.key))})]}),(0,f.jsxs)("div",{className:"cron-editor__footer",children:[(0,f.jsx)("span",{className:"cron-editor__preview",children:E(r)}),(0,f.jsx)("button",{className:"cron-editor__done",onClick:()=>a(!1),children:"完成"})]})]})]})};function L(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:a}=(0,n.useContext)(B.F),[p,x]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[C,S]=(0,w.fp)(m.AG.prompt_card),[,k]=(0,w.fp)(m.AG.editorSetting),[A,I]=(0,n.useState)([]),[N,V]=(0,n.useState)([]),[$,X]=(0,n.useState)([]),[F,K]=(0,n.useState)([]),[z,O]=(0,n.useState)(""),[T,E]=(0,n.useState)([]),M=(0,b.K)(),q=[e("软件"),e("是否安装"),e("路径")],D=[e("编号"),e("路径"),e("备注")],G=[e("编号"),e("路径"),e("是否开启"),e("备注")],W=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("cron表达式"),e("用户id"),e("备注")],H=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("big_res"),e("big_sz"),e("大文件并发数量"),e("big_ck"),e("备注")],R=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:U}=(0,y.MH)(),Z=async()=>{const e=await d.XO.get("env/path/get");e.code===c.m.Success&&X(e.data)},L=async()=>{const e=await d.XO.get("workflow_setting_get");e.code===c.m.Success&&K(e.data)};(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("outside/software/get");e.code===c.m.Success&&g(e.data);const t=await d.XO.get("pty_cmd");t.code===c.m.Success&&O(t.data),Z(),L();const s=await d.XO.get("protection_dir/sys");s.code===c.m.Success&&I(s.data??[]);const n=await d.XO.get("dir_upload_max_num");n.code===c.m.Success&&V(n.data??[]);const i=await d.XO.get("plugin/list");i.code===c.m.Success&&E(i.data??[])})()},[]);const Q=(0,P.Q)(),Y=async()=>{await d.XO.post("plugin/list/save",T)};return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("up_conc")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...N,{path:"",note:"",user_upload_num:2,sys_upload_num:6,ws_file_standard_size:52428800,ws_file_parallel_num:2,ws_file_block_mb_size:524288}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of N)if(e.open_ws_file){if("number"!=typeof e.ws_file_block_mb_size)return void(0,_.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,_.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,_.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,v.di)(N,e=>e.index??0);(await d.XO.post("dir_upload_max_num/save",N)).code===c.m.Success&&((0,_.SK)(e("保存成功")),a())}})]}),children:(0,f.jsx)(u.X,{headers:H,rows:N.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,placeholder:s,handleInputChange:e=>{t.index=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.user_upload_num,handleInputChange:e=>{t.user_upload_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.sys_upload_num,handleInputChange:e=>{t.sys_upload_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.l6,{value:!0===t.open_ws_file,onChange:e=>{t.open_ws_file=e,V([...N])},options:M,no_border:!0}),(0,f.jsx)(r.Sm,{value:"number"==typeof t.ws_file_standard_size?t.ws_file_standard_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_standard_size=1024*parseInt(e)*1024},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.ws_file_parallel_num,handleInputChange:e=>{t.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:"number"==typeof t.ws_file_block_mb_size?t.ws_file_block_mb_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_block_mb_size=1024*parseInt(e)*1024},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{N.splice(e,1),V([...N])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{V((0,v.TI)(N,e,t))}})})}),(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("Workflow Job")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{K([...F,{open:!1}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("workflow_setting_save",F)).code===c.m.Success&&((0,_.SK)("ok"),L())}})]}),children:(0,f.jsx)(u.X,{headers:W,rows:F.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.file_path,handleInputChange:e=>{t.file_path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,K([...F])},options:M,no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,K([...F])},options:M,no_border:!0}),(0,f.jsx)(J,{value:t.cron_str,onChange:e=>{t.cron_str=e,K([...F])},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.user_id,handleInputChange:e=>{t.user_id=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{F.splice(e,1),K([...F])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{K((0,v.TI)(F,e,t))}})})}),(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PATH")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await d.XO.get("env/process/view");t.code===c.m.Success?S({open:!0,title:e("进程环境变量"),context_div:(0,f.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:"60vh",overflow:"auto",margin:0,fontSize:"0.85rem",lineHeight:"1.5"},children:t.data})}):(0,_.zN)(e("获取失败"))}}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await d.XO.get("env/process/get");t.code===c.m.Success?(y.xK.set_value_temp(t.data??""),k({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{await d.XO.post("env/process/save",{text:e})}})):(0,_.zN)(e("获取失败"))}}),(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...$,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("env/path/save",{paths:$})).code===c.m.Success&&((0,_.SK)(e("保存成功")),Z(),s())}})]}),children:(0,f.jsx)(u.X,{headers:G,rows:$.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,X([...$])},options:M,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{$.splice(e,1),X([...$])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{X((0,v.TI)($,e,t))}})}),(0,f.jsx)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PTY CMD")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("pty")},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:e("更新"),clickFun:async()=>{(await d.XO.post("pty_cmd/save",{str:z})).code===c.m.Success&&((0,_.SK)(e("保存成功")),a())}}),children:(0,f.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:z,handleInputChange:e=>{O(e)}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("插件配置")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{E([...T,{name:"",path:"",note:"",open:!1}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:Y})]}),children:(0,f.jsx)(u.X,{headers:R,rows:T.map((t,s)=>{const n=[s,(0,f.jsx)(r.Sm,{value:t.name,handleInputChange:e=>{t.name=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,E([...T])},options:M,no_border:!0}),(0,f.jsx)(o.mu,{icon:"edit",value:t.params,save:async e=>{t.params=e,await Y()},title:""}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{T.splice(e,1),E([...T])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{E((0,v.TI)(T,e,t))}})})]})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("系统保护路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("protection_dir/sys/save",A)).code===c.m.Success&&((0,_.SK)(e("保存成功")),a())}})]}),children:(0,f.jsx)(u.X,{headers:D,rows:A.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),I([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{I((0,v.TI)(A,e,t))}})}),(0,f.jsx)(l.uF,{title:e("外部软件"),rightTopCom:(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("outside/software/save",j)).code===c.m.Success&&((0,_.SK)(e("保存成功")),s())}}),children:(0,f.jsx)(u.X,{headers:q,rows:j.map((t,s)=>[(0,f.jsx)("div",{children:t.id}),(0,f.jsx)(l.fq,{ok:t.installed}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("use_env")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function Q(e){const{t,i18n:s}=(0,h.Bd)(),[i,l]=(0,w.fp)(m.AG.user_base_info),o=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:a.oV.user_manage},{title:t("角色管理"),permission:a.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:a.oV.all_sys},{title:t("系统进程关闭"),permission:a.oV.sys_process_close},{title:t("dc_ctdl"),permission:a.oV.docker_container_update},{title:t("dc_idl"),permission:a.oV.docker_images_delete},{title:t("systemd管理"),permission:a.oV.systemd},{title:t("防火墙管理"),permission:a.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:a.oV.vir_net},{title:t("内网穿透"),permission:a.oV.tcp_proxy},{title:"ddns",permission:a.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:a.oV.ai_agent_setting},{title:t("ai_page"),permission:a.oV.ai_agent_page},{title:t("sw_mdl"),permission:a.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("log_del"),permission:a.oV.filecat_file_delete_cut_rename},{title:t("log_wr"),permission:a.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:a.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:a.oV.recycle_file_save},{title:t("文件分享"),permission:a.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:a.oV.sys_setting_page},{title:t("tk_time"),permission:a.oV.token_update},{title:t("修改密码"),permission:a.oV.update_password},{title:t("磁盘挂载"),permission:a.oV.sys_disk_mount},{title:t("通用设置"),permission:a.oV.sys_env_setting_key},{title:t("md_set"),permission:a.oV.md_editor_setting},{title:t("目录挂载"),permission:a.oV.file_mount},{title:t("文件服务"),permission:a.oV.file_server}]},{title:t("系统环境设置"),list:[{title:t("sys_env"),permission:a.oV.sys_env_page},{title:t("up_lim"),permission:a.oV.dir_upload_max_num},{title:t("path_md"),permission:a.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:a.oV.pty_cmd_update},{title:"workflow job",permission:a.oV.workflow_job},{title:t("path_up"),permission:a.oV.sys_protection_dir},{title:t("外部软件路径"),permission:a.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:a.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:a.oV.auth_router_page},{title:t("wf_api"),permission:a.oV.workflow_api},{title:t("自定义资源路由"),permission:a.oV.code_resource},{title:t("api_rt"),permission:a.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:a.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:a.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:a.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:a.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy},{title:t("http代理"),permission:a.oV.http_proxy},{title:t("pxy_off"),permission:a.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:a.oV.browser_proxy},{title:t("浏览器代理编辑"),permission:a.oV.browser_proxy_edit},{title:t("rdp代理"),permission:a.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("wf_run"),permission:a.oV.workflow_exe},{title:t("wf_user"),permission:a.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:a.oV.wol_proxy},{title:t("端口扫描"),permission:a.oV.port_scan},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy},{title:t("ssh_sv"),permission:a.oV.crypto_ssh_file},{title:t("cmd_rst"),permission:a.oV.shell_cmd_filecat_restart},{title:t("cmd_upg"),permission:a.oV.shell_cmd_filecat_upgrade},{title:t("cmd_dwn"),permission:a.oV.shell_cmd_filecat_kill_self},{title:t("cmd_ai"),permission:a.oV.ai_chat_cmd}]}];return(0,f.jsx)(n.Fragment,{children:o.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{children:t.title}),t.list.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.jsx)("input",{type:"checkbox",disabled:!t.noDisable&&e.is_disable(t.permission),checked:e.is_selected(t.permission,t.noDisable),onChange:()=>{e.select_auth(t.permission)}}),t.title]},s))]},s))})}const Y=new Map;function ee(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:p}=(0,n.useContext)(B.F),[j,g]=(0,w.fp)(m.AG.user_base_info),[y,b]=(0,n.useState)([]),[C,S]=(0,w.fp)(m.AG.prompt_card),[k,A]=(0,n.useState)(!1),[I,N]=(0,n.useState)(!1),[V,$]=(0,w.fp)(m.AG.confirm),[X,F]=(0,n.useState)(""),[K,z]=(0,n.useState)(""),[O,T]=(0,n.useState)(""),[E,M]=(0,n.useState)([]),[q,D]=(0,n.useState)([]),[G,W]=(0,n.useState)([]),[H,R]=(0,n.useState)(""),[U,Z]=(0,n.useState)(""),[J,L]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,ae]=(0,n.useState)(""),[le,oe]=(0,n.useState)(!1),[re,de]=(0,n.useState)(""),[ce,ue]=(0,n.useState)(""),[he,me]=(0,n.useState)({}),pe=(0,P.o)(),[_e,xe]=(0,n.useState)([]),[je,ve]=(0,n.useState)(void 0),fe=[e("用户id"),e("用户名"),e("目录范围"),e("备注")],ge=async()=>{const e=await d.wm.get("all_users");if(e.code===c.m.Success){const t=e.data??[];if(je){const e=[];for(const s of t)`${s.id}${s.username}${s.cwd}${s.note}`.includes(je)&&e.push(s);b(e)}else b(t)}const t=await d.wm.get("all_roles");if(t.code===c.m.Success){xe(t.data),Y.clear();for(const e of t.data)Y.set(e.role_id,e)}},we=e=>{F(e?.username??""),z(e?.password??""),T(e?.cwd??""),M(e?.access_dirs??[]),D(e?.not_access_dirs??[]),W(e?.only_read_dirs??[]),R(e?.access_cmd??""),Z(e?.not_access_cmd??""),L(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),ae(e?.note??""),oe(e?.is_root??!1),de(e?.id??""),e?.bind_role_id?ye(e.bind_role_id,e.auth_list??[]):(ue(""),me({}))};(0,n.useEffect)(()=>{ge()},[]);const ye=(e,t=[])=>{if(!e)return ue(""),void me({});const s=Y.get(e);if(s){if(s.cwd&&T(s.cwd),s.access_dirs&&s.access_dirs.length>0&&M(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&D(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&W(s.only_read_dirs),s.access_cmd&&R(s.access_cmd),s.not_access_cmd&&Z(s.not_access_cmd),s.language&&L(s.language),s.theme&&te(s.theme),s.auth_list&&s.auth_list.length>0){const e=new Set(s.auth_list);for(const s of t)e.add(s);ne(Array.from(e))}ue(e),me(s)}},be=()=>{if(!X)return void(0,_.zN)("username not empty");if((0,x.CB)(X))return void(0,_.zN)("username not empty char");if(!O)return void(0,_.zN)("cwd not empty");const e=new a.E0;return e.language=J,e.theme=ee,e.access_dirs=E,e.username=X,e.password=K,e.not_access_dirs=q,e.only_read_dirs=G,e.cwd=O,e.note=ie,e.access_cmd=H,e.not_access_cmd=U,e.auth_list=se,e.bind_role_id=ce,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("用户")})}),rightTopCom:(0,f.jsxs)("div",{className:"div-row",style:{gap:"0.5rem"},children:[(0,f.jsx)(r.Sm,{placeholder:e("过滤"),value:je,handleInputChange:e=>{ve(e)},handlerEnter:()=>{ge()}}),(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A(!0),N(!1),we(void 0)}})]}),children:(0,f.jsx)(u.X,{headers:fe,rows:y.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.id}),(0,f.jsx)(l.xP,{children:t.username}),(0,f.jsx)(l.xP,{children:t.cwd}),(0,f.jsx)(l.xP,{children:t.note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{A(!1),N(!0),we(e)})(t)}),!t.is_root&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{$({open:!0,title:e("确定删除吗"),handle:async()=>{const s=new a.E0;s.username=t,(await d.wm.post("delete_user",s)).code===c.m.Success&&((0,_.SK)(e("删除完成")),ge(),$({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(k||I)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(k?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{A(!1),N(!1),we(void 0)}}),k&&(0,f.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!K)return void(0,_.zN)("password not empty");if((0,x.CB)(K))return void(0,_.zN)("username not empty char");const t=be(),s=await d.wm.post("create_user",t);ge(),s.code===c.m.Success&&((0,_.SK)(e("创建完成")),ge(),A(!1),N(!1),we(void 0))}}),I&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t=be();if(!t)return;t.id=re;(await d.wm.post("save_user",t)).code===c.m.Success&&((0,_.SK)(e("保存完成")),ge())}})]}),children:[(0,f.jsx)("label",{children:e("用户名")}),(0,f.jsx)(r.Sm,{value:X,handleInputChange:e=>F(e)}),(0,f.jsx)("label",{children:e("密码")}),(0,f.jsx)(r.Sm,{type:"password",value:K,handleInputChange:e=>z(e)}),(0,f.jsxs)("label",{children:[!he?.access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{M([...E,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{disabled:""!==he.cwd&&void 0!==he.cwd,value:O,handleInputChange:e=>T(e)}),(E??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==he?.access_dirs?.length&&void 0!==he?.access_dirs?.length,value:t,handleInputChange:e=>{E[s]=e,M([...E])}})}),0===he?.access_dirs?.length||void 0===he?.access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{E.splice(s,1),M([...E])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!he?.not_access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{D([...q,""])},title:e("添加")}),e("禁止目录范围")]}),(q??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==he?.not_access_dirs?.length&&void 0!==he?.not_access_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,D([...q])}})}),0===he?.not_access_dirs?.length||void 0===he?.not_access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{q.splice(s,1),D([...q])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!he?.only_read_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{W([...G,""])},title:e("添加")}),e("只读目录范围")]}),(G??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==he?.only_read_dirs?.length&&void 0!==he?.only_read_dirs?.length,value:t,handleInputChange:e=>{G[s]=e,W([...G])}})}),0===he?.only_read_dirs?.length||void 0===he?.only_read_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{G.splice(s,1),W([...G])},title:e("删除")})]},s)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==he.access_cmd&&void 0!==he.access_cmd,value:H,placeholder:"use blank split",handleInputChange:e=>R(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==he.not_access_cmd&&void 0!==he.not_access_cmd,value:U,placeholder:"use blank split",handleInputChange:e=>Z(e)}),!le&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("label",{children:e("角色")}),(0,f.jsx)(r.l6,{value:ce,onChange:e=>{ye(e)},options:(()=>{const e=[];e.push({title:"NOT",value:""});for(let t of _e)e.push({title:t.role_name,value:t.role_id});return e})()})]}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{disabled:""!==he.language&&void 0!==he.language,value:J,onChange:e=>{L(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,f.jsx)("label",{children:e("主题")}),(0,f.jsx)(r.l6,{disabled:""!==he.theme&&void 0!==he.theme,value:ee,onChange:e=>{te(e)},options:pe}),(0,f.jsx)(Q,{is_disable:e=>{if(!0===le)return!0;if(ce){const t=Y.get(ce);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===le||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,v.I)(se,t=>t===e),ne([...se])):ne([...se,e]):ne([e])}}),(0,f.jsx)("label",{children:e("备注")}),(0,f.jsx)(r.Sm,{value:ie,handleInputChange:e=>ae(e)})]})})})]})}function te(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s}=(0,n.useContext)(B.F),[p,x]=(0,n.useState)([]),[j,g]=(0,w.fp)(m.AG.prompt_card),[y,b]=(0,n.useState)(!1),[C,S]=(0,n.useState)(!1),[k,A]=(0,w.fp)(m.AG.confirm),[I,N]=(0,n.useState)(""),[V,$]=(0,n.useState)(""),[X,F]=(0,n.useState)([]),[K,z]=(0,n.useState)([]),[O,T]=(0,n.useState)([]),[E,M]=(0,n.useState)(""),[q,D]=(0,n.useState)(""),[G,W]=(0,n.useState)(""),[H,R]=(0,n.useState)(""),[U,Z]=(0,n.useState)([]),[J,L]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,P.o)(),se=[e("角色id"),e("角色名"),e("备注")],ne=async()=>{const e=await d.wm.get("all_roles");e.code===c.m.Success&&x(e.data)},ie=e=>{N(e?.role_name??""),$(e?.cwd??""),F(e?.access_dirs??[]),z(e?.not_access_dirs??[]),T(e?.only_read_dirs??[]),M(e?.access_cmd??""),D(e?.not_access_cmd??""),W(e?.language??""),R(e?.theme??""),Z(e?.auth_list??[]),L(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const ae=()=>{if(!I)return void(0,_.zN)("role_name not empty");const e=new a.E0;return e.language=G,e.theme=H,e.access_dirs=X,e.role_name=I,e.not_access_dirs=K,e.only_read_dirs=O,e.cwd=V,e.access_cmd=E,e.not_access_cmd=q,e.auth_list=U,e.role_note=Y,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("角色")})}),rightTopCom:(0,f.jsx)("div",{children:(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{b(!0),S(!1),ie(void 0)}})}),children:(0,f.jsx)(u.X,{headers:se,rows:p.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.role_id}),(0,f.jsx)(l.xP,{children:t.role_name}),(0,f.jsx)(l.xP,{children:t.role_note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{b(!1),S(!0),ie(e)})(t)}),!t.is_root&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{A({open:!0,title:e("确定删除吗"),handle:async()=>{const s=new a.E0;s.role_id=t,(await d.wm.post("delete_role",s)).code===c.m.Success&&((0,_.SK)(e("删除完成")),ne(),A({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(y||C)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(y?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{b(!1),S(!1),ie(void 0)}}),y&&(0,f.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const t=ae();if(!t)return;const s=await d.wm.post("create_role",t);ne(),s.code===c.m.Success&&((0,_.SK)(e("创建完成")),ne(),b(!1),S(!1),ie(void 0))}}),C&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t=ae();if(!t)return;t.role_id=J;(await d.wm.post("save_role",t)).code===c.m.Success&&((0,_.SK)(e("保存完成")),ne())}})]}),children:[(0,f.jsx)("label",{children:e("角色名")}),(0,f.jsx)(r.Sm,{value:I,handleInputChange:e=>N(e)}),(0,f.jsx)("label",{children:e("角色备注")}),(0,f.jsx)(r.Sm,{value:Y,handleInputChange:e=>ee(e)}),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{F([...X,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{value:V,handleInputChange:e=>$(e)}),(X??[]).map((e,t)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{X[t]=e,F([...X])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{X.splice(t,1),F([...X])},title:"删除"})]},t)),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{z([...K,""])},title:"添加"}),e("禁止目录范围")]}),(K??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:t,handleInputChange:e=>{K[s]=e,z([...K])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{K.splice(s,1),z([...K])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{T([...O,""])},title:e("添加")}),e("只读目录范围")]}),(O??[]).map((e,t)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{O[t]=e,T([...O])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{O.splice(t,1),T([...O])},title:"删除"})]},t)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{value:E,placeholder:"use blank split",handleInputChange:e=>M(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{value:q,placeholder:"use blank split",handleInputChange:e=>D(e)}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{value:G,onChange:e=>{W(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"NOT",value:""},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,f.jsx)("label",{children:e("主题")}),(0,f.jsx)(r.l6,{value:H,onChange:e=>{R(e)},options:te}),(0,f.jsx)(Q,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==U?.find(t=>t===e),select_auth:e=>{U?(U.find(t=>t==e)?(0,v.I)(U,t=>t===e):U.push(e),Z([...U])):Z([e])}})]})})})]})}var se=s(93245);function ne(e){const{t}=(0,h.Bd)(),[s,i]=(0,n.useState)((e.children_list??[]).map(e=>({path:e.path,note:e.note}))),a=[t("编号"),t("目录"),t("备注")],d=()=>{i([...s,{path:"",note:""}])};(0,n.useEffect)(()=>{s?.length||d()});return(0,f.jsx)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:t("sub_dir")})}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:t("添加"),onClick:d}),(0,f.jsx)(o.rA,{icon:"save",title:t("保存"),onClick:()=>{e.on_confirm(s.filter(e=>e.path))}}),(0,f.jsx)(o.rA,{icon:"close",title:t("取消"),onClick:e.on_cancel})]}),children:(0,f.jsx)(u.X,{headers:a,rows:s.map((e,n)=>[(0,f.jsx)("span",{children:n}),(0,f.jsx)(r.Sm,{value:e.path,handleInputChange:t=>{e.path=t},no_border:!0}),(0,f.jsx)(r.Sm,{value:e.note,handleInputChange:t=>{e.note=t},no_border:!0}),(0,f.jsx)("div",{children:(0,f.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>{i(s.filter((e,t)=>t!==n))}})})]),width:"10rem"})})}function ie(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:p}=(0,n.useContext)(B.F),[x,j]=(0,n.useState)([]),[g,y]=(0,w.fp)(m.AG.prompt_card),[C,k]=(0,n.useState)([]),[A,N]=(0,n.useState)([]),[V,$]=(0,n.useState)([]),[X,F]=(0,w.fp)(m.AG.user_base_info),K=(0,b.K)(),z=(0,P.o)(),O=[e("编号"),e("路径"),e("是否默认"),e("备注"),e("sub_dir")],T=[e("编号"),e("路径"),e("备注")],E=[e("编号"),e("命令"),e("父编号"),e("备注")],M=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[q,D]=(0,n.useState)(""),[G,W]=(0,n.useState)(""),[H,R]=(0,n.useState)(""),[U,Z]=(0,n.useState)(!1),[J,L]=(0,n.useState)(""),[Q,Y]=(0,n.useState)(""),[ee,te]=(0,n.useState)(""),[ie,ae]=(0,n.useState)(!1),[le,oe]=(0,n.useState)(""),[re,de]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("filesSetting");e.code===c.m.Success&&(j(e.data.dirs),N(e.data.quick_cmd),$(e.data.file_quick_cmd));const t=await d.XO.get("protection_dir");t.code===c.m.Success&&k(t.data??[])})(),L(X?.user_data?.language),Y(X?.user_data?.theme),te(X?.user_data?.upload_file_ignore);const e=X?.user_data?.editor_auto_save;ae(!!e?.enable),oe(null!=e?.interval?String(e.interval):""),de(e?.editors??[])},[]);const ce=(0,P.Q)();return(0,f.jsx)(n.Fragment,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{title:e("修改密码"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{if(!q||!G)return void(0,_.zN)(e("账号密码不能为空"));if(G!==H)return void(0,_.zN)(e("两次密码不一样"));const t=new a.tl;t.username=q,t.password=G,t.confirm_password=H,t.user_id=X.user_data.id;(await d.wm.post("updatePassword",t)).code===c.m.Success&&(0,_.SK)(e("修改成功"))}}),children:[(0,f.jsx)(r.Sm,{placeholder:e("新账号"),value:q,handleInputChange:e=>{D(e)}}),(0,f.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{W(e)}}),(0,f.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{R(e)}})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{title:e("个性化设置"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{(await d.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:J,theme:Q,upload_file_ignore:ee}})).code===c.m.Success&&((0,_.SK)(e("修改成功")),s())}}),children:[e("语言"),(0,f.jsx)(r.l6,{value:J,onChange:e=>{L(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"},{title:"Deutsch",value:"de"},{title:"ドイツ語",value:"ja"},{title:"독일어",value:"ko"},{title:"Немецкий язык",value:"ru"},{title:"Allemand",value:"fr"},{title:"Alemán",value:"es"}]}),e("主题"),(0,f.jsx)(r.l6,{value:Q,onChange:e=>{Y(e)},options:z}),(0,f.jsx)(r.Sm,{value:ee,handleInputChange:e=>{te(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{title:e("编辑器自动保存"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{const t=parseInt(String(le),10);if(isNaN(t)||t<1)return void(0,_.zN)(e("请输入不小于 1 的整数(秒)"));(await d.wm.post(S.s.user_save_private_attr,{is_editor_auto_save:!0,editor_auto_save:{enable:ie,interval:t,editors:re}})).code===c.m.Success&&((0,_.SK)(e("修改成功")),s())}}),children:[(0,f.jsx)(r.BC,{label:e("开启"),children:(0,f.jsx)(r.l6,{value:ie,onChange:e=>{ae(e)},options:K,no_border:!0})}),(0,f.jsx)(r.BC,{label:e("自动保存间隔(秒)"),children:(0,f.jsx)(r.Sm,{type:"number",value:le,handleInputChange:e=>{oe(e)},placeholder:"30",no_border:!0})}),(0,f.jsx)("h3",{children:e("编辑器")}),se.d.map(t=>(0,f.jsxs)("div",{children:[(0,f.jsx)("input",{type:"checkbox",checked:re.includes(t.id),onChange:e=>{const s=e.target.checked;de(s?[...re,t.id]:re.filter(e=>e!==t.id))}}),e(t.label)]},t.id))]})})]}),(0,f.jsxs)(i.VP,{children:[(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件夹路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{ce("文件夹路径")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...x,{note:"",default:!1,path:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(let e=0;e<x.length;e++)x[e].index=e;(await d.XO.post("filesSetting/save",{dirs:x})).code===c.m.Success&&((0,_.SK)(e("保存成功")),p(),s())}})]}),children:(0,f.jsx)(u.X,{headers:O,rows:x.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:t.default,onChange:e=>{((e,t,s)=>{const n=[];for(let e=0;e<x.length;e++)x[e].default=e===s&&t,n.push(x[e]);j(n)})(0,e,s)},options:K,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)("span",{children:t.children?.length??0}),0!==s&&(0,f.jsx)(o.rA,{icon:"folder_open",title:e("sub_dir"),onClick:()=>(e=>{y({open:!0,main_context_div:(0,f.jsx)(ne,{children_list:e.children,on_cancel:()=>{y({open:!1})},on_confirm:t=>{e.children=t,j([...x]),y({open:!1})}})})})(t)})]}),(0,f.jsx)("div",{children:0!==s&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{x.splice(e,1),j([...x])})(s)})})];return n}),width:"10rem",onRowDrag:(e,t)=>{0!==e&&0!==t&&j((0,v.TI)(x,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("个人保护路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{ce("保护目录")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{k([...C,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("protection_dir/save",C)).code===c.m.Success&&((0,_.SK)(e("保存成功")),p())}})]}),children:(0,f.jsx)(u.X,{headers:T,rows:C.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),k([...C])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{k((0,v.TI)(C,e,t))}})})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("目录快捷命令")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{ce("目录快捷命令")},title:"info"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...A,{cmd:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("filesSetting/save",{quick_cmd:A})).code===c.m.Success&&((0,_.SK)(e("保存成功")),s())}})]}),children:(0,f.jsx)(u.X,{headers:E,rows:A.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,handleInputChange:e=>{t.index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.father_index,handleInputChange:e=>{t.father_index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),N([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{N((0,v.TI)(A,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件快捷命令")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{ce("文件快捷命令")},title:"info"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{$([...V,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("filesSetting/save",{file_quick_cmd:V})).code===c.m.Success&&((0,_.SK)(e("保存成功")),s())}})]}),children:(0,f.jsx)(u.X,{headers:M,rows:V.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.file_suffix,handleInputChange:e=>{t.file_suffix=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.params,handleInputChange:e=>{t.params=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),$([...V])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{$((0,v.TI)(V,e,t))}})})]})]})]})})}var ae=s(45907),le=s(17903);const oe=["password","private_key","secret_key"],re="webdav",de="@authorize",ce="@tcp_account",ue={smb:[{keys:["server","username","password"],on_next:"load_shares"},{keys:["share"]}],baidu:[{keys:["app_id","app_key","secret_key"],on_next:"save_app"},{keys:[de]}],tcp_proxy:[{keys:["client_num_id"],on_next:"save_app"},{keys:[ce]}]};function he(){const{t:e}=(0,h.Bd)(),t=(0,ae.y)(),[,s]=(0,w.fp)(m.AG.prompt_card),[i,a]=(0,n.useState)([]),[c,p]=(0,n.useState)([]),[x,j]=(0,n.useState)(!1),[v,g]=(0,n.useState)(""),[y,b]=(0,n.useState)(re),[C,S]=(0,n.useState)(""),[k,A]=(0,n.useState)({}),[I,N]=(0,n.useState)(1),[V,$]=(0,n.useState)([]),[B,X]=(0,n.useState)({}),[F,P]=(0,n.useState)("oob"),[K,z]=(0,n.useState)(""),[O,T]=(0,n.useState)(null),[E,M]=(0,n.useState)(!0),q=async()=>{try{const[e,t]=await Promise.all([d.I2.post("credential/list",{}),d.I2.post("credential/meta",{})]);a(Array.isArray(e?.data)?e.data:[]),p(Array.isArray(t?.data)?t.data:[])}catch(e){}};(0,n.useEffect)(()=>{q()},[]);const D=c.find(e=>e.type===y)?.fields??[],G=ue[y],W=G?.length??1,H=()=>{j(!1),g(""),b(re),S(""),A({}),N(1),$([]),z(""),M(!0)},R=async e=>{const t=Array.from(new Set(e.map(e=>e.options_source).filter(e=>Boolean(e)))),s={};for(const e of t){const t=await d.I2.post("credential/options",{source:e});s[e]=(t?.data??[]).map(e=>({label:e.label,value:e.value}))}X(s)},U=t=>{if(!C.trim())return e("请填写备注");for(const s of D){if(!1===t.includes(s.key))continue;const n=String(k[s.key]??"").trim()||v&&oe.includes(s.key);if(s.required&&!n)return e(s.label)}},Z=async()=>{try{const e=await d.I2.post("baidu/authorize_url",{id:v,mode:F});e?.data&&window.open(e.data,"_blank","noopener,noreferrer")}catch(e){}},J=async()=>{if(K.trim())try{const t=await d.I2.post("baidu/exchange",{id:v,code:K.trim(),mode:F});(0,_.SK)(`${e("授权成功")}:${t?.data?.baidu_name??""}`),z(""),await q()}catch(e){}else(0,_.zN)(e("请填写授权码"))},L=async()=>{if(O)if(O.account_name.trim())try{await d.I2.post("credential/account_save",{credential_id:v,account_id:O.id,note:O.note,account_name:O.account_name,password:O.password}),(0,_.SK)(e("已保存")),T(null),await q()}catch(e){}else(0,_.zN)(e("请填写对端账号"))},Q=G?.[I-1]?.keys??D.map(e=>e.key),Y=Q.includes(de),ee=Q.includes(ce),te=I===W,se=W>1;return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("凭证管理")}),(0,f.jsx)(o.rA,{icon:"info",title:e("信息"),onClick:()=>{s({open:!0,title:e("信息"),context_div:(0,f.jsxs)("div",{children:[(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:e("crd_tp")}),(0,f.jsx)("li",{children:e("pwdkept")}),(0,f.jsx)("li",{children:e("tstbfrs")})]}),(0,f.jsxs)("ul",{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"WebDAV"}),":",e("prtwbdv")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"SSH / SFTP"}),":",e("prtsftp")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"S3 兼容对象存储"}),":",e("prt_s3")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"SMB"}),":",e("prt_smb")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"百度网盘"}),":",e("prt_bd")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:e("内网穿透 FileCat")}),":",e("prt_tcp")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:e("本地目录")}),":",e("prt_local")]})]})]})})}})]}),rightBottomCom:(0,f.jsxs)("div",{children:[!x&&(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{H(),j(!0)}}),x&&(0,f.jsxs)(f.Fragment,{children:[se&&I>1&&(0,f.jsx)(o.rA,{icon:"arrow_back",title:e("上一步"),onClick:()=>N(I-1)}),se&&!te&&(0,f.jsx)(o.rA,{icon:"arrow_forward",title:e("下一步"),onClick:async()=>{const t=U(G?.[I-1]?.keys??[]);if(t)return void(0,_.zN)(`${e("请填写")}${t}`);const s=G?.[I-1]?.on_next;try{if("load_shares"===s&&!await(async()=>{const t=await d.I2.post("share/list",{driver:y,id:v||void 0,config:{server:k.server,username:k.username,password:k.password}}),s=t?.data??[];return s.length?($(s.map(e=>({label:e.name,value:e.name}))),!0):((0,_.zN)(e("没有找到共享")),!1)})())return;if("save_app"===s&&!await(async()=>{try{const e=await d.I2.post(v?"credential/update":"credential/add",{id:v||void 0,type:y,note:C,config:k,enabled:E});return!v&&e?.data?.id&&g(e.data.id),!0}catch(e){return!1}})())return;N(I+1)}catch(e){}}}),(!se||te)&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t=U(D.map(e=>e.key));if(t)(0,_.zN)(`${e("请填写")}${t}`);else try{await d.I2.post(v?"credential/update":"credential/add",{id:v||void 0,type:y,note:C,config:k,enabled:E}),(0,_.SK)(e("保存成功")),H(),await q()}catch(e){}}}),(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:H})]})]}),children:[x&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:e("备注"),value:C,handleInputChange:S}),(0,f.jsx)(r.l6,{value:y,options:c.map(e=>({title:e.name,value:e.type})),onChange:e=>{b(e),A({}),$([]),X({}),N(1),z("");const t=c.find(t=>t.type===e)?.fields??[];t.some(e=>e.options_source)&&R(t)}}),Y?(()=>{const s=i.find(e=>e.id===v)?.accounts??[];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("授权方式"),label_width:"6rem",children:(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(r.U6,{name:"baidu_auth_mode",value:"one_click",context:e("一键授权"),selected:"one_click"===F,onchange:()=>P("one_click")}),(0,f.jsx)(r.U6,{name:"baidu_auth_mode",value:"oob",context:e("outh_ob"),selected:"oob"===F,onchange:()=>P("oob")})]})}),"oob"===F&&(0,f.jsx)(r.BC,{label:e("授权码"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("粘贴授权码 code"),value:K,handleInputChange:z})}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(o.rA,{icon:"open_in_new",title:e("去授权"),onClick:Z}),"oob"===F&&(0,f.jsx)(o.rA,{icon:"check",title:e("完成授权"),onClick:J})]}),s.length>0&&(0,f.jsx)(u.X,{headers:[e("账号名"),e("百度账号"),e("授权状态"),e("使用"),e("授权时间"),e("操作")],rows:s.map(s=>[(0,f.jsx)(l.xP,{context:s.note||s.account_name||s.id}),(0,f.jsx)(l.xP,{context:s.account_name||s.id}),(0,f.jsx)(l.xP,{context:s.authorized?e("已授权"):e("未授权")}),(0,f.jsx)(l.xP,{context:!1===s.enabled?e("停用"):e("启用")}),(0,f.jsx)("p",{children:s.obtained_at?(0,le.eK)(s.obtained_at):"-"}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"network_check",title:e("授权检测"),onClick:()=>(async(t,s)=>{try{const n=await d.I2.post("baidu/verify",{id:t,account_id:s}),i=n?.data??{};i.valid?(0,_.SK)(e("账号可用")):(0,_.zN)(`${e("账号不可用")}:${i.error??""}`),await q()}catch(e){}})(v,s.id)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>((s,n)=>{t({title:e("确认删除"),sub_title:n.note||n.account_name||n.id,confirm_fun:async()=>{try{await d.I2.post("baidu/deauthorize",{id:s,account_id:n.id}),(0,_.SK)(e("已删除")),await q()}catch(e){}}})})(v,s)})]})])})]},de)})():ee?(()=>{const s=i.find(e=>e.id===v)?.accounts??[];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("div",{className:"div-row",children:(0,f.jsx)(r.BC,{label:e("备注"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("便于辨认的名字"),value:O?.note??"",handleInputChange:e=>T({...O??{note:"",account_name:"",password:""},note:e})})})}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(r.BC,{label:e("对端账号"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("对端 FileCat 登录名"),value:O?.account_name??"",handleInputChange:e=>T({...O??{note:"",account_name:"",password:""},account_name:e})})}),(0,f.jsx)(r.BC,{label:e("对端密码"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("留空表示不修改"),value:O?.password??"",handleInputChange:e=>T({...O??{note:"",account_name:"",password:""},password:e})})})]}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(o.rA,{icon:"save",title:e("保存账号"),onClick:L}),O&&(0,f.jsx)(o.rA,{icon:"close",title:e("取消"),onClick:()=>T(null)})]}),s.length>0&&(0,f.jsx)(u.X,{headers:[e("备注"),e("对端账号"),e("密码"),e("操作")],rows:s.map(s=>[(0,f.jsx)(l.xP,{context:s.note||s.account_name||s.id}),(0,f.jsx)(l.xP,{context:s.account_name||s.id}),(0,f.jsx)(l.xP,{context:s.has_password?e("已设置"):e("未设置")}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(o.rA,{icon:"network_check",title:e("验证登录"),onClick:()=>(async t=>{const s=O?.id===t.id;try{const n=await d.I2.post("credential/account_verify",{credential_id:v,account_id:t.id,account_name:s?O.account_name:t.account_name,password:s?O.password:void 0}),i=n?.data??{};i.ok?(0,_.SK)(e("账号可用")):(0,_.zN)(`${e("账号不可用")}:${i.error??""}`)}catch(e){}})(s)}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>T({id:s.id,note:s.note??"",account_name:s.account_name??"",password:""})}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(s=>{t({title:e("确认删除"),sub_title:s.note||s.account_name||s.id,confirm_fun:async()=>{try{await d.I2.post("credential/account_remove",{credential_id:v,account_id:s.id}),(0,_.SK)(e("已删除")),await q()}catch(e){}}})})(s)})]})])})]},ce)})():D.filter(e=>Q.includes(e.key)).map(t=>{if(t.options_source)return(0,f.jsx)(r.BC,{label:e(t.label),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:k[t.key]??"",options:B[t.options_source]??[],onChange:e=>A({...k,[t.key]:e})})},t.key);if("share"===t.key&&"smb"===y)return(0,f.jsx)(r.BC,{label:e(t.label),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:k[t.key]??"",options:V,onChange:e=>A({...k,[t.key]:e})})},t.key);const s="password"===t.type;return(0,f.jsx)(n.Fragment,{children:(0,f.jsx)(r.Sm,{type:s?"password":"text",placeholder:t.label,value:k[t.key]??"",handleInputChange:e=>A({...k,[t.key]:e})})},t.key)})]}),!x&&(0,f.jsx)(u.X,{headers:[e("备注"),e("类型"),e("操作")],rows:i.map(s=>{return[(0,f.jsx)(l.xP,{context:s.note}),(0,f.jsx)(l.xP,{context:(n=s.type,c.find(e=>e.type===n)?.name??n)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{j(!0),g(e.id),b(e.type),S(e.note??""),A({...e.config??{}}),z(""),M(!1!==e.enabled),N(ue[e.type]?.length??1),"smb"===e.type&&d.I2.post("share/list",{driver:"smb",id:e.id,config:e.config??{}}).then(e=>{$((e?.data??[]).map(e=>({label:e.name,value:e.name})))}).catch(()=>{});const t=c.find(t=>t.type===e.type)?.fields??[];t.some(e=>e.options_source)&&R(t).catch(()=>{})})(s)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{t({title:e("确认删除"),sub_title:s.note,confirm_fun:async()=>{try{await d.I2.post("credential/delete",{id:s.id}),(0,_.SK)(e("已删除")),await q()}catch(e){}}})})(s)})]})];var n})})]})}function me(){const{t:e}=(0,h.Bd)(),t=(0,ae.y)(),[s,i]=(0,n.useState)([]),[a,c]=(0,n.useState)([]),[m,p]=(0,n.useState)([]),[x,j]=(0,n.useState)(!1),[v,g]=(0,n.useState)(""),[w,y]=(0,n.useState)("webdav"),[b,C]=(0,n.useState)(""),[S,k]=(0,n.useState)(""),[A,I]=(0,n.useState)(""),[N,V]=(0,n.useState)(""),[$,B]=(0,n.useState)(""),[X,F]=(0,n.useState)(!1),P=async()=>{try{const[e,t,s]=await Promise.all([d.I2.post("list",{}),d.I2.post("credential/list",{}),d.I2.post("driver/list",{})]);i(Array.isArray(e?.data)?e.data:[]),c(Array.isArray(t?.data)?t.data:[]),p(Array.isArray(s?.data)?s.data:[])}catch(e){}};(0,n.useEffect)(()=>{P()},[]);const K=(0,le.p_)(S,a),z=K.length>0,O=()=>{j(!1),g(""),y("webdav"),C(""),k(""),I(""),V(""),B(""),F(!1)};return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("挂载列表")})}),rightBottomCom:(0,f.jsxs)("div",{children:[!x&&(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{O(),j(!0)}}),x&&(0,f.jsx)(o.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{if(S)try{const t=await d.I2.post("test",{id:v||void 0,driver:w,credential_id:S,account_id:A,root_dir:N}),s=t?.data;s?.ok?(0,_.SK)(`${e("连接成功")}(${s.count??0})`):(0,_.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}else(0,_.zN)(e("请选择凭据"))}}),x&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(S)if(!z||A)if(b.trim())try{await d.I2.post(v?"update":"add",{id:v||void 0,driver:w,mount_path:b,credential_id:S,account_id:z?A:void 0,root_dir:N,note:$,color:le.OT,readonly:!1,enabled:!0,forward_to_remote:X}),(0,_.SK)(e("保存成功")),O(),await P()}catch(e){}else(0,_.zN)(e("munt_rq"));else(0,_.zN)(e("请选择账号"));else(0,_.zN)(e("请选择凭据"))}}),x&&(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:O})]}),children:[x&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("挂载类型"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:w,options:m.map(e=>({title:e.name,value:e.type})),onChange:e=>{y(e),k(""),I("")}})}),(0,f.jsx)(r.BC,{label:e("凭据"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:S,options:(T=w,(0,le.XT)(T,a)),onChange:e=>{k(e),I("")}})}),z&&(0,f.jsx)(r.BC,{label:e("账号"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:A,options:K,onChange:I})}),(0,f.jsx)(r.BC,{label:e("本地目录"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:e("被挂载的本地绝对路径"),value:b,handleInputChange:C})}),(0,f.jsx)(r.BC,{label:e("strtdrt"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("远端目录"),value:N,handleInputChange:V})}),(0,f.jsx)(r.BC,{label:e("备注"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("列表显示的名称"),value:$,handleInputChange:B})}),"tcp_proxy"===w&&(0,f.jsx)(r.BC,{label:e("ftr2rmt"),label_width:"6rem",children:(0,f.jsx)(o.Ay,{checked:X,onChange:F,title:e("ftr2rmt_tip")})})]}),!x&&(0,f.jsx)(u.X,{headers:[e("备注"),e("挂载类型"),e("凭据"),e("账号"),e("操作")],rows:s.map(s=>{const n=a.find(e=>e.id===s.credential_id),i=(n?.accounts??[]).find(e=>e.id===s.account_id);return[(0,f.jsx)("p",{children:s.note}),(0,f.jsx)("p",{children:(l=s.driver,m.find(e=>e.type===l)?.name??l)}),(0,f.jsx)("p",{children:n?n.note:e("凭据已丢失")}),(0,f.jsx)("p",{children:s.account_id?i?i.note||i.account_name||i.nickname||i.id:e("账号已丢失"):"-"}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{j(!0),g(e.id),y(e.driver),C(e.mount_path??""),k(e.credential_id??""),I(e.account_id??""),V(e.root_dir??""),B(e.note??""),F(Boolean(e.forward_to_remote))})(s)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{t({title:e("确认删除"),sub_title:s.mount_path,confirm_fun:async()=>{try{await d.I2.post("delete",{id:s.id}),(0,_.SK)(e("已删除")),await P()}catch(e){}}})})(s)})]})];var l})})]});var T}function pe(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,y.MH)(),s=t(a.oV.file_mount),[r,c]=(0,w.fp)(m.AG.mount_enabled);(0,n.useEffect)(()=>{s&&(async()=>{try{const e=await d.I2.post("enabled/get",{});c(!0===e?.data)}catch(e){c(!1)}})()},[s]);return s?(0,f.jsxs)(n.Fragment,{children:[(0,f.jsxs)(k.aZ,{position:"right",children:[(0,f.jsx)("span",{className:"header-label",children:e("总开关")}),(0,f.jsx)(o.rA,{icon:!0===r?"cloud_done":"cloud_off",title:e(!0===r?"muntont":"muntoff"),selected:!0===r,onClick:async()=>{const t=!r;try{const s=await d.I2.post("enabled/set",{enabled:t}),n=!0===s?.data;c(n),(0,_.SK)(e(n?"挂载已启用":"挂载已停用"))}catch(e){}}})]}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(he,{})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(me,{})})]})})]}):(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{children:(0,f.jsx)(l.Zp,{self_title:(0,f.jsx)("h2",{children:e("网盘挂载")}),children:(0,f.jsx)("p",{children:e("nmuntpr")})})})})}const _e=[{value:"sftp",label:"SFTP"},{value:"webdav",label:"WebDAV"},{value:"smb",label:"SMB"}];function xe(){const{t:e}=(0,h.Bd)(),t=(0,ae.y)(),[s,a]=(0,n.useState)([]),[c,m]=(0,n.useState)("none"),[p,x]=(0,n.useState)(""),[j,v]=(0,n.useState)("sftp"),[g,w]=(0,n.useState)(""),[y,b]=(0,n.useState)(0),[C,S]=(0,n.useState)(""),[k,A]=(0,n.useState)(!1),[I,N]=(0,n.useState)(""),[V,$]=(0,n.useState)(""),[B,X]=(0,n.useState)(""),[F,P]=(0,n.useState)(""),[K,z]=(0,n.useState)(""),[O,T]=(0,n.useState)(""),E=async()=>{const e=await d.od.post("list",{});a(e?.data??[])};(0,n.useEffect)(()=>{E()},[]);const M=()=>{x(""),v("sftp"),w(""),b(0),S(""),A(!1),N(""),$(""),X(""),P(""),z(""),T("")},q=()=>{m("none"),M()};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("文件服务")})}),rightTopCom:(0,f.jsx)("div",{className:"div-row",children:(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{M(),b(2022),m("add")}})}),children:(0,f.jsx)(u.X,{headers:[e("状态"),e("备注"),e("协议"),e("端口"),e("fsvroot"),e("操作")],rows:s.map(s=>{return[(0,f.jsx)(o.Ay,{checked:s.running,title:e("启用"),onChange:t=>(async(t,s)=>{await d.od.post(s?"start":"stop",{id:t.id}),(0,_.SK)(e(s?"已启用":"已禁用")),await E()})(s,t)}),(0,f.jsx)(l.xP,{children:s.note||"-"}),(0,f.jsx)("p",{children:(n=s.type,_e.find(e=>e.value===n)?.label??n)}),(0,f.jsx)("p",{children:s.port}),(0,f.jsx)(l.xP,{children:s.root_path}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{M(),x(e.id),v(e.type),w(e.note),b(e.port),S(e.root_path),A(e.readonly),N(e.sftp_username??""),X(e.webdav_username??""),z(e.smb_share_name??""),T(e.smb_hostname??""),m("edit")})(s)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(s=>{t({title:e("确认删除"),confirm_fun:async()=>{await d.od.post("delete",{id:s.id}),(0,_.SK)(e("删除成功")),p===s.id&&q(),await E()}})})(s)})]})];var n})})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:"none"!==c&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("add"===c?"添加":"编辑")})}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:q}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t={type:j,note:g,port:Number(y),root_path:C,readonly:k,sftp_username:I,sftp_password:V,webdav_username:B,webdav_password:F,smb_share_name:K,smb_hostname:O};p?(t.id=p,await d.od.post("update",t)):await d.od.post("add",t),(0,_.SK)(e("保存成功")),q(),await E()}})]}),children:[(0,f.jsx)(r.BC,{label:e("协议"),label_width:"7rem",required:!0,children:(0,f.jsx)(r.l6,{value:j,options:_e,onChange:e=>v(e)})}),(0,f.jsx)(r.BC,{label:e("fsvroot"),label_width:"7rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:e("对外提供的本地绝对路径"),value:C,handleInputChange:S})}),(0,f.jsx)(r.BC,{label:e("端口"),label_width:"7rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:"1-65535",value:String(y||""),handleInputChange:e=>b(Number(e)||0)})}),(0,f.jsx)(r.BC,{label:e("备注"),label_width:"7rem",children:(0,f.jsx)(r.Sm,{placeholder:e("列表显示的名称"),value:g,handleInputChange:w})}),(0,f.jsx)(r.BC,{label:e("只读"),label_width:"7rem",children:(0,f.jsx)(o.Ay,{checked:k,onChange:A})}),"sftp"===j&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("用户名"),label_width:"7rem",required:!0,children:(0,f.jsx)(r.Sm,{value:I,handleInputChange:N})}),(0,f.jsx)(r.BC,{label:e("密码"),label_width:"7rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:p?e("留空不修改"):"",value:V,handleInputChange:$})})]}),"webdav"===j&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("用户名"),label_width:"7rem",required:!0,children:(0,f.jsx)(r.Sm,{value:B,handleInputChange:X})}),(0,f.jsx)(r.BC,{label:e("密码"),label_width:"7rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:p?e("留空不修改"):"",value:F,handleInputChange:P})})]}),"smb"===j&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("共享名"),label_width:"7rem",required:!0,children:(0,f.jsx)(r.Sm,{value:K,handleInputChange:z})}),(0,f.jsx)(r.BC,{label:e("主机名"),label_width:"7rem",children:(0,f.jsx)(r.Sm,{value:O,handleInputChange:T})})]})]})})})]})}function je(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,y.MH)();return t(a.oV.file_mount)?(0,f.jsx)(xe,{}):(0,f.jsx)(i.fI,{children:(0,f.jsx)(l.Zp,{self_title:(0,f.jsx)("h2",{children:e("文件服务")}),children:(0,f.jsx)("p",{children:e("没有权限")})})})}var ve=s(87361);function fe(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,y.MH)(),s=[{index:2,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,f.jsx)(ie,{})}];return t(a.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,f.jsx)(F,{})}),t(a.oV.sys_env_page)&&s.push({index:3,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,f.jsx)(L,{})}),t(a.oV.auth_router_page)&&s.push({index:4,name:e("自定义路由"),rto:"customer_router/",component:(0,f.jsx)(A,{})}),t(a.oV.file_mount)&&s.push({index:5,name:e("网盘挂载"),rto:"mount_setting/",component:(0,f.jsx)(pe,{})}),t(a.oV.file_server)&&s.push({index:6,name:e("文件服务"),rto:"file_server_setting/",component:(0,f.jsx)(je,{})}),t(a.oV.user_manage)&&s.push({index:7,name:e("用户管理"),rto:"user_manager/",component:(0,f.jsx)(ee,{})}),t(a.oV.role_manage)&&s.push({index:8,name:e("角色管理"),rto:"role_manager/",component:(0,f.jsx)(te,{})}),(0,f.jsx)(i.W1,{optionList:s,father_route:ve.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>u,o:()=>m});var n=s(34843),i=s(82893),a=s(74777),l=s(96540),o=s(22022),r=s(23430),d=s(14284),c=s(74848);function u(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:l}=(0,o.Bd)();return e=>{let n;e===a.jk.ffmpeg?n=(0,c.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===a.jk.smartmontools?n=(0,c.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?n=(0,c.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,c.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?n=(0,c.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?n=(0,c.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?n=(0,c.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?n=(0,c.jsx)("div",{children:(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,c.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?n=(0,c.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?n=(0,c.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?n=(0,c.jsx)("div",{children:(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,c.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,c.jsxs)("li",{children:[(0,c.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,c.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,c.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,c.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?n=(0,c.jsx)("div",{children:s("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(n=(0,c.jsxs)("div",{children:[(0,c.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,c.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,c.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,c.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,c.jsx)("div",{children:n})})}}let h=r.Ky;function m(){const[e,t]=(0,l.useState)([]);return(0,l.useEffect)(()=>{(async()=>{try{const e=await d.XO.get("themes");if(0===e.code){const s=e.data||[];h=[...r.Ky,...s],t(h)}else console.warn("获取主题列表失败,使用默认列表"),t(h)}catch(e){t(h)}})()},[]),e}},6960(e,t,s){s.d(t,{s:()=>l});var n=s(72635);const i=1440,a=525600;function l(e){e=e>1e12?e:1e3*e;const t=Date.now(),s=Math.abs(t-e)/6e4;return s<1?n.Ay.t("小于一分钟"):s<60?`${s.toFixed(0)} ${n.Ay.t("分钟前")}`:s<i?`${(s/60).toFixed(0)} ${n.Ay.t("小时前")}`:s<43200?`${(s/i).toFixed(0)} ${n.Ay.t("天前")}`:s<a?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/a).toFixed(0)} ${n.Ay.t("年前")}`}},93245(e,t,s){s.d(t,{a:()=>r,d:()=>o});var n=s(96540),i=s(34843),a=s(82893),l=s(23430);const o=[{id:l.nE.ace,label:"文本编辑器(ace)"},{id:l.nE.md,label:"md编辑器"},{id:l.nE.mind,label:"思维导图编辑器"},{id:l.nE.draw,label:"draw编辑器"},{id:l.nE.timeline,label:"时间线编辑器"},{id:l.nE.image,label:"图片编辑器"},{id:l.nE.excel,label:"excel编辑器"}];function r(e,t,s,l=!1){const[o]=(0,i.fp)(a.AG.user_base_info),r=o?.user_data?.editor_auto_save,d=(0,n.useRef)(r);d.current=r;const c=(0,n.useRef)(t);c.current=t;const u=(0,n.useRef)(s);u.current=s,(0,n.useEffect)(()=>{if(l)return;const t=d.current;if(!t?.enable||t.interval<=0||!t.editors?.includes(e))return;const s=setInterval(()=>{c.current()&&u.current(!0)},1e3*t.interval);return()=>clearInterval(s)},[r,e,l])}},24659(e,t,s){s.d(t,{K:()=>i});var n=s(22022);const i=()=>{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([[2547],{83277(e,t,n){n.d(t,{$j:()=>i,CP:()=>o,Lv:()=>s,cL:()=>a});class s{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";yaml_env="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const n of t)if(n.value===e)return n.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const n of t)if(n.value===e)return!0;return!1}}const o="\n# 聊天循环最大次数\ntool_call_max: 500\n\n# 是否允许AI直接执行命令而不需要用户确认。\n# 默认为 false,需要用户手动确认;使用 workflow 时等价于 true。\nallow_exec_cmd_directly: false\n\n# 可选的大模型请求代理地址\n# proxy_url: http://127.0.0.1:7890\n\n# 可选的多个 url\n# options_agent_url_list:\n# - value: http://...\n# label: openai\n\n# 可选的多个 key\n# options_agent_key_list:\n# - value: sk-aaa\n# label: option1\n\n# 可选的多个 model\n# options_agent_model_list:\n# - value: gpt-5.5\n# label: gpt\n\n# 本地 prompt 文件列表,每次聊天时自动读取并加载\n# options_local_file_path_prompt_list:\n# - /prompt/a.txt\n\n# 开启切换模型,AI 可以根据 prompt 自己决定下一步调用哪个模型\n# open_pick_model: false\n\n# 历史消息裁剪相关\nmax_recent_messages: 12\ncompress_message_count: 16\nmax_tool_content_chars: 200\n\n# 是否在请求里带上 stream_options.include_usage,让接口返回 usage 数据\n# 开启后可拿到 cached_tokens / reasoning_tokens,token 统计更准确\n# 非 OpenAI 风格的接口传了可能报错,按服务商决定\n# usage_request_param: true\n\n# 是否关闭 token 数量统计(不再估算 token,usage_stats 不累加)\n# close_token_count: true\n\n# ===== 模型类型(request_type)=====\n# 默认 completions,可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n# request_type: completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,供 AI agent 动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n# tool_mode: false\n\n# ===== 图片理解(image_understanding)=====\n# 开启后注册 read_image 工具,工具读到的图片会以 image_url 多模态格式随消息发给模型。\nimage_understanding: true\n\n# ===== 命令环境变量(command_env)=====\n# AI 调用内置命令工具(exec_cmd / exec_cmd_background)执行命令时,\n# 这里配置的变量会覆盖到子进程的环境变量上。\n# command_env:\n# NODE_ENV: production\n# HTTP_PROXY: http://127.0.0.1:7890\n\n# 是否允许 AI 通过 set_command_env 工具修改上面的 command_env\ncommand_env_tool: false\n";const a=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function i(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}},77481(e,t,n){n.d(t,{S:()=>r,X:()=>i});var s=n(96540),o=n(61443),a=n(74848);function i(e){const[t,n]=s.useState([]),i=(0,s.useRef)(-1),[r,l]=(0,s.useState)(-1),[c,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const m=()=>{i.current=-1,l(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,n)=>{const s=!!e.filter&&(e.filter.column??0)===n;let i=t;if(s){const n=e.filter,s=n.options.find(e=>e.value===n.value);null!=n.value&&s&&(i=`${t} (${s.label})`)}return(0,a.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,a.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):t},n)})})}),(0,a.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,a.jsx)("tr",{className:s?(r===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(i.current=n,l(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=i.current,n=c;m(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:m,children:t.map((n,s)=>{const o=s===t.length-1?"small":"";return(0,a.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}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))})}},52547(e,t,n){n.r(t),n.d(t,{default:()=>N});var s=n(22022),o=n(96540),a=n(85997),i=n(4412),r=n(34843),l=n(82893),c=n(75725),d=n(77481),m=n(61443),p=n(70447),_=n(64484),u=n(14284),h=n(53459),x=n(62042),g=n(7523),v=n(78247),j=n(23430),f=n(52671),y=n(14944),w=n(92275),b=n(88815),C=n(64694),k=n(45907),A=n(12721),S=n(24659),I=n(83277),K=n(74848);function N(){const{t:e}=(0,s.Bd)(),{initUserInfo:t}=(0,o.useContext)(g.F),n=[e("编号"),e("url"),e("是否开启"),e("key"),e("默认model"),e("更多属性"),e("备注")],N=[e("编号"),e("本地目录"),e("自动加载"),e("备注")],[O,P]=(0,o.useState)([]),[L,$]=(0,o.useState)({}),[M,X]=(0,o.useState)([]),[T,D]=(0,o.useState)([]),[R,q]=(0,o.useState)(null),F=(0,o.useRef)(),V=(0,o.useRef)(!1),Y=(0,o.useRef)(!1),[E,W]=(0,o.useState)([]),[H,J]=(0,o.useState)(!1),[B,G]=(0,o.useState)({}),[Z,U]=(0,r.fp)(l.AG.prompt_card),[z,Q]=(0,r.fp)(l.AG.user_base_info),[ee,te]=(0,o.useState)(!1),ne=T.filter(e=>"http"!==(e.transport??"stdio")),se=T.filter(e=>"http"===e.transport),oe=[e("编号"),e("名称"),e("是否开启"),e("状态"),"command","args","cwd",e("tools|env"),e("备注")],ae=[e("编号"),e("名称"),e("是否开启"),e("状态"),e("endpoint"),e("tools|headers"),e("备注")],ie=[e("编号"),e("提示词"),e("LLM编辑开关"),e("llm_pmt"),e("编辑规则"),e("备注")],[re,le]=(0,o.useState)([]),[ce,de]=(0,o.useState)(!1),me=(0,_.T)(),{check_user_auth:pe}=(0,v.MH)(),[_e,ue]=(0,r.fp)(l.AG.editorSetting),he=(0,f.Zp)(),xe=(0,k.y)(),ge=(0,S.K)(),ve=async()=>{const e=await u.jV.get("docs_on_get");e.code===h.m.Success&&te(e.data)};(0,o.useEffect)(()=>{(async()=>{const e=await u.XO.get("ai_agent_setting");e.code===h.m.Success&&P(e.data.models);const t=await u.XO.get("ai_agent_global_setting");t.code===h.m.Success&&$(t.data??{}),await y.ws.addMsg(w.HK.ai_load_info,e=>{q(e.context)});const n=await y.ws.sendData(w.HK.ai_load_info,{});n?.context&&q(n.context);const s=await u.XO.get("ai_docs_setting");s.code===h.m.Success&&(F.current=s.data.param,s.data.list?.length&&X(s.data.list));const o=await u.XO.get("ai_mcp_setting");o.code===h.m.Success&&D(o.data.list??[]),await ke(),ve();const a=await u.XO.get("ai_system_prompts");a.code===h.m.Success&&le(a.data??[]);const i=await u.XO.get("ai_long_term_memory_setting");i.code===h.m.Success&&de(i.data?.open??!1)})()},[]),(0,o.useEffect)(()=>{y.ws.addMsg(w.HK.mcp_status,e=>{const t=e.context??{},n={};for(const e of t.status??[])n[e.index]={state:e.state,error:e.error,tool_count:e.tool_count};G(n),t.done&&ke()})},[]);const je=(e="stdio")=>{const t="http"===e?{name:"",open:!1,note:"",transport:"http",endpoint:"",headers:"",stream:!1,timeout_ms:1e4}:{name:"",open:!1,command:"",args:"",cwd:"",env:"",note:"",transport:"stdio",timeout_ms:1e4};D([...T,t]),V.current=!0},fe=e=>{const t=T.indexOf(e);t<0||(T.splice(t,1),D([...T]),V.current=!0)},ye=e=>{D([...T,{...e,open:!1}]),V.current=!0},we=async t=>{for(let e=0;e<O.length;e++)O[e].index=e;(await u.XO.post("ai_agent_setting/save",{models:t??O})).code===h.m.Success&&(0,x.SK)(e("保存成功"))},be=async t=>{(await u.XO.post("ai_agent_global_setting/save",t??L)).code===h.m.Success&&(0,x.SK)(e("保存成功"))},Ce=async t=>{for(let e=0;e<T.length;e++)T[e].index=e;(await u.XO.post("ai_mcp_setting/save",{list:t??T})).code===h.m.Success&&((0,x.SK)(e("保存成功")),V.current=!1,y.ws.sendData(w.HK.mcp_reload,{}))},ke=async()=>{const e=await u.XO.get("ai_mcp_tools");return e.code===h.m.Success?(W(e.data??[]),e.data??[]):[]},Ae=async t=>{J(!0);try{const n=await u.XO.post("ai_mcp_tools/reload",{index:t});if(n.code===h.m.Success)return await ke(),(0,x.SK)(e("MCP工具加载成功")),n.data??null}finally{J(!1)}return null},Se=async(t,n,s,o)=>{const a=o??E.find(e=>e.index===n)??{index:n,key:`${n}`,name:t.name??"",note:t.note,transport:t.transport??"stdio",open:!!t.open,loaded:!1,tool_count:0,tools:[]},i=(a.tools??[]).map(t=>({id:t.runtime_name,title:t.tool_name,subtitle:t.description||e("无描述"),detail:t.display_name,meta:t.runtime_name}));U({open:!0,title:`${t.name||t.note||n} MCP工具`,context_div:(0,K.jsx)(A.O,{title:`${t.name||t.note||n} MCP工具`,subtitle:`${a.transport??"stdio"} | ${a.open?e("是"):e("否")} | ${a.loaded?"loaded":"idle"} | ${a.tool_count} tools`,pages:i,initialPageId:s,onRefresh:async()=>{const e=await Ae(n);e&&await Se(t,n,s,e)},renderPage:t=>{if(!t)return(0,K.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")});const n=a.tools?.find(e=>e.runtime_name===t.id);return n?(0,K.jsxs)("div",{className:"prompt-switch-page__detail",children:[(0,K.jsx)("div",{className:"prompt-switch-page__detail-title",children:n.display_name}),(0,K.jsx)("div",{className:"prompt-switch-page__detail-desc",children:n.description||e("无描述")}),(0,K.jsxs)("div",{className:"prompt-switch-page__detail-row",children:[(0,K.jsx)("strong",{children:"runtime:"})," ",n.runtime_name]}),(0,K.jsxs)("div",{children:[(0,K.jsx)("strong",{children:"schema:"}),(0,K.jsx)("pre",{className:"prompt-switch-page__schema",children:JSON.stringify(n.input_schema??{},null,2)})]})]}):(0,K.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")})}}),cancel:()=>U({open:!1})})},Ie=t=>{const n=B[t];let s=n?.state,o=n?.error,a=n?.tool_count;if(!s){const e=E.find(e=>e.index===t);s=e?.state,o=e?.error,a=e?.tool_count}switch(s){case"loading":return(0,K.jsx)(p.fq,{loading:!0,text:e("加载中")});case"success":return(0,K.jsx)(p.fq,{success:!0,text:`${a??0} ${e("个工具")}`});case"failed":return(0,K.jsx)("span",{title:o??e("加载失败"),children:(0,K.jsx)(p.fq,{success:!1,text:e("加载失败")})});default:return(0,K.jsx)(p.fq,{text:e("未加载")})}},Ke=async t=>{for(let e=0;e<O.length;e++)O[e].index=e;let n={list:M,docs_update_tag:Y.current};null!=t&&(n={param:t}),Y.current=!1;(await u.XO.post("ai_docs_setting_save",n)).code===h.m.Success&&(0,x.SK)(e("保存成功"))},Ne=async()=>{for(let e=0;e<re.length;e++)re[e].index=e;(await u.XO.post("ai_system_prompts/save",{list:re})).code===h.m.Success&&(0,x.SK)(e("保存成功"))};return(0,K.jsxs)("div",{children:[(0,K.jsx)(i.aZ,{position:"right",children:pe(j.oV.ai_agent_setting)&&(0,K.jsx)(a.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{he(-1)}})}),(0,K.jsx)(c.jW,{isFull:!0,more:!0,children:(0,K.jsx)(c.NN,{children:(0,K.jsxs)(c.xh,{children:[(0,K.jsx)(c.fI,{children:(0,K.jsx)(c.VP,{widthPer:100,maxWidth:"130rem",children:(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsx)("h2",{children:e("供应商设置")})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me('\n1. Only OpenAI-style AI APIs are supported. Fill in the FULL endpoint path (not just the domain), e.g. https://ark.cn-beijing.volces.com/api/v3/chat/completions\n2. The longer the conversation history, the more expensive the LLM token cost. Currently, there is no long-term memory simplification capability. You can set the system prompt to make the AI answer more concisely to save tokens\n3. When writing the model request parameter JSON, you can only write JSON in it, to configure the attributes supported by OpenAI-style AI, such as temperature, thinking (Doubao\'s deep thinking toggle), etc.\n4. You can enable "stream": true in the model request parameters to improve response speed.\n5. Deep thinking currently affects output speed. It is recommended to set { "thinking" : { "type":"disabled" } } to disable it (Doubao example).\n6. To use the AI feature to query server information, the AI needs to be able to know some commands. You need to first set command permissions for the user in user settings. It is recommended to set * to allow all commands, and then set the dangerous commands that are not allowed to be executed in the settings\n7. The model type and Become Tool are now both configured in "More Attributes → Extra Parameter Settings" using request_type / tool_mode (comments are already provided in the editor).\n8. After becoming a tool, the model will be loaded as a tool, enabling different models to serve as different roles; please do not set both it and "Enabled" to true at the same time.\n')},title:"信息"})]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"short_text",title:e("全局prompt"),onClick:()=>{ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{L.sys_prompt=e,$({...L}),v.xK.set_value_temp(""),await be({...L,sys_prompt:e})}}),v.xK.set_value_temp(L.sys_prompt??"")}}),(0,K.jsx)(a.rA,{icon:"edit_attributes",title:e("全局")+" "+e("model请求参数json编写"),onClick:()=>{ue({model:"ace/mode/json",open:!0,fileName:"",save:async e=>{L.json_params=e,$({...L}),v.xK.set_value_temp(""),await be({...L,json_params:e})},can_format:!0}),v.xK.set_value_temp(L.json_params??"")}}),(0,K.jsx)(a.rA,{icon:"settings",title:e("全局")+" "+e("额外参数设置"),onClick:()=>{ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{L.yaml_env=e,$({...L}),v.xK.set_value_temp(""),await be({...L,yaml_env:e})}}),v.xK.set_value_temp(L.yaml_env??"")}}),(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...O,{note:"",open:!1,path:"",yaml_env:I.CP,json_params:I.cL}])}}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{await we()}})]}),children:(0,K.jsx)(d.X,{headers:n,onRowDrag:(e,t)=>{P((0,C.TI)(O,e,t))},rows:O.map((t,n)=>{const s=[(0,K.jsx)("div",{children:n}),(0,K.jsx)(m.Sm,{value:I.Lv.get_label_by_v(t.url,t.show_options?.options_agent_url_list),options:t.show_options?.options_agent_url_list,handleInputChange:e=>{t.url=e},no_border:!0}),(0,K.jsx)(m.l6,{value:t.open,onChange:e=>{((e,t,n)=>{const s=[];for(let e=0;e<O.length;e++)O[e].open=e===n&&t,s.push(O[e]);P(s)})(0,e,n)},options:ge,no_border:!0}),(0,K.jsx)(m.Sm,{type:I.Lv.have_label_by_v(t.token,t.show_options?.options_agent_key_list)?null:"password",value:I.Lv.get_label_by_v(t.token,t.show_options?.options_agent_key_list),options:t.show_options?.options_agent_key_list,handleInputChange:e=>{t.token=e},no_border:!0}),(0,K.jsx)(m.Sm,{value:I.Lv.get_label_by_v(t.model,t.show_options?.options_agent_model_list),options:t.show_options?.options_agent_model_list,handleInputChange:e=>{t.model=e},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"short_text",title:"prompt",onClick:()=>{v.xK.set_value_temp(O[n].sys_prompt??""),ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{O[n].sys_prompt=e,P(O),v.xK.set_value_temp(""),we(O)}})}}),(0,K.jsx)(a.rA,{icon:"edit_attributes",title:"model请求参数json编写",onClick:()=>{v.xK.set_value_temp(O[n].json_params),ue({model:"ace/mode/json",open:!0,fileName:"",save:async e=>{O[n].json_params=e,P(O),v.xK.set_value_temp(""),we(O)},can_format:!0})}}),(0,K.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{v.xK.set_value_temp(O[n].yaml_env),ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{O[n].yaml_env=e,P(O),v.xK.set_value_temp(""),we(O)}})}})]}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),P([...O])})(n)}),(0,K.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>(e=>{P([...O,{...O[e],open:!1}])})(n)})]})];return s}),width:"10rem"})})})}),(0,K.jsx)(c.fI,{children:(0,K.jsx)(c.VP,{widthPer:70,maxWidth:"100rem",children:(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - stdio"]})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me("\n1. 这里配置的是 MCP Client 启动参数,当前实现的是 stdio 模式,也就是通过 command + args 启动本地 MCP Server\n2. 例如可以填 npx / uvx / python 等命令,再配合对应的 MCP server 包参数\n3. 保存后会自动重新加载 MCP 工具,agent 聊天时会把这些工具一起带给模型\n4. 建议把 cwd 配到具体项目目录,避免 server 在错误目录里运行\n")},title:"信息"})]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>je("stdio")}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ce()}})]}),children:(0,K.jsx)(d.X,{headers:oe,onRowDrag:(e,t)=>{D((0,C.TI)(T,T.indexOf(ne[e]),T.indexOf(ne[t]))),V.current=!0},rows:ne.map((t,n)=>{const s=T.indexOf(t);return[(0,K.jsx)("div",{children:n}),(0,K.jsx)(m.Sm,{value:t.name,handleInputChange:e=>{t.name=e,V.current=!0},no_border:!0}),(0,K.jsx)(m.l6,{value:t.open,onChange:e=>{t.open=e,D([...T]),V.current=!0},options:ge,no_border:!0}),Ie(T.indexOf(t)),(0,K.jsx)(m.Sm,{value:t.command,handleInputChange:e=>{t.command=e,V.current=!0},no_border:!0}),(0,K.jsx)(m.Sm,{value:t.args,handleInputChange:e=>{t.args=e,V.current=!0},no_border:!0}),(0,K.jsx)(m.Sm,{value:t.cwd,handleInputChange:e=>{t.cwd=e,V.current=!0},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{Se(t,s)}}),(0,K.jsx)(a.rA,{icon:"settings",title:"env",onClick:()=>{v.xK.set_value_temp(t.env??""),ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{t.env=e,D([...T]),v.xK.set_value_temp(""),V.current=!0,Ce()}})}})]}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e,V.current=!0},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>fe(t)}),(0,K.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>ye(t)})]})]}),width:"10rem"})})})}),(0,K.jsx)(c.fI,{children:(0,K.jsxs)(c.VP,{widthPer:70,maxWidth:"100rem",children:[(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - HTTP"]})," "]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>je("http")}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ce()}})]}),children:(0,K.jsx)(d.X,{headers:ae,onRowDrag:(e,t)=>{D((0,C.TI)(T,T.indexOf(se[e]),T.indexOf(se[t]))),V.current=!0},rows:se.map((t,n)=>{const s=T.indexOf(t);return[(0,K.jsx)("div",{children:n}),(0,K.jsx)(m.Sm,{value:t.name,handleInputChange:e=>{t.name=e,V.current=!0},no_border:!0}),(0,K.jsx)(m.l6,{value:t.open,onChange:e=>{t.open=e,D([...T]),V.current=!0},options:ge,no_border:!0}),Ie(T.indexOf(t)),(0,K.jsx)(m.Sm,{value:t.endpoint,handleInputChange:e=>{t.endpoint=e,V.current=!0},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{Se(t,s)}}),(0,K.jsx)(a.rA,{icon:"settings",title:"headers",onClick:()=>{v.xK.set_value_temp(t.headers??""),ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{t.headers=e,D([...T]),v.xK.set_value_temp(""),V.current=!0,Ce()}})}})]}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e,V.current=!0},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>fe(t)}),(0,K.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>ye(t)})]})]}),width:"10rem"})}),(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsx)("h2",{children:e("系统会话提示词")})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me('\n1. 系统会话提示词,在 AI 聊天页创建会话时可以选择,选中的提示词会自动填入聊天框作为第一条系统消息\n2. 适用于预先设定常用的会话场景模板,如"代码审查"、"翻译助手"、"运维诊断"等\n3. "LLM编辑开关":开启后,当用户选择了该系统提示词发起对话时,AI 将会获得一个"更新会话提示词"工具,允许 AI 在对话中对当前会话进行总结,并写入到本提示词的"LLM编辑提示词"字段(全局保存,供之后的新会话沿用),使 AI 能自我维护长期上下文。\n4. "LLM编辑提示词":可选。AI 编辑后写回的内容(可预填初始方向)。仅在"LLM编辑开关"开启时生效。\n5. "编辑规则":可选。给 LLM 的编辑要求,例如"总结时不要超过 300 token"、"用简洁的项目要点记录"等。仅在"LLM编辑开关"开启时生效。\n')},title:"信息"})]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{le([...re,{prompt:"",note:"",llm_prompt_enable:!1}])}}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ne()}})]}),children:(0,K.jsx)(d.X,{headers:ie,onRowDrag:(e,t)=>{le((0,C.TI)(re,e,t))},rows:re.map((t,n)=>{const s=[(0,K.jsx)("div",{children:n}),(0,K.jsx)("div",{children:(0,K.jsx)(a.rA,{icon:"short_text",title:e("提示词"),onClick:()=>{v.xK.set_value_temp(t.prompt??""),ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.prompt=e,le([...re]),v.xK.set_value_temp(""),Ne()}})}})}),(0,K.jsx)(a.Ay,{checked:!!t.llm_prompt_enable,onChange:e=>{t.llm_prompt_enable=e,le([...re])},title:e("LLM编辑开关")}),(0,K.jsx)("div",{children:(0,K.jsx)(a.rA,{icon:"edit_note",title:e("llm_pmt"),onClick:()=>{v.xK.set_value_temp(t.llm_prompt??""),ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt=e,le([...re]),v.xK.set_value_temp(""),Ne()}})}})}),(0,K.jsx)("div",{children:(0,K.jsx)(a.rA,{icon:"rule",title:e("编辑规则"),onClick:()=>{v.xK.set_value_temp(t.llm_prompt_tip??""),ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt_tip=e,le([...re]),v.xK.set_value_temp(""),Ne()}})}})}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,K.jsx)("div",{children:(0,K.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{re.splice(e,1),le([...re])})(n)})})];return s}),width:"10rem"})}),(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsx)("h2",{children:e("长期记忆")})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me(e("开启后跨会话保存记忆。四个固定文件:周/月/年/永久。每周结束自动压缩周→月,每月结束自动压缩月→年,每年结束自动压缩年→永久。编辑按钮可手动查看和修改。"))},title:"信息"})]}),rightTopCom:(0,K.jsx)("div",{children:(0,K.jsx)(a.Ay,{checked:ce,onChange:async t=>{de(t),await u.XO.post("ai_long_term_memory_setting/save",{open:t}),(0,x.SK)(e("长期记忆设置已保存"))},title:e("开关")})}),children:(0,K.jsx)("div",{style:{display:"flex",gap:"0.5rem",padding:"0.5rem 0",flexWrap:"wrap"},children:[{type:"week",label:e("周记忆"),tip:e("上限3000字")},{type:"month",label:e("月记忆"),tip:e("上限6000字")},{type:"year",label:e("年记忆"),tip:e("上限9000字")},{type:"forever",label:e("永久记忆"),tip:e("上限12000字")}].map(({type:t,label:n,tip:s})=>(0,K.jsx)(a.rA,{icon:"edit",title:`${e("编辑")} ${n} (${s})`,onClick:async()=>{const e=await u.XO.get(`ai_long_term_memory_bucket/${t}`),n=e.code===h.m.Success?e.data??"":"";v.xK.set_value_temp(n),ue({model:"ace/mode/text",open:!0,fileName:`long_term_memory_${t}.txt`,save:async e=>{await u.XO.post(`ai_long_term_memory_bucket/${t}/save`,{data:e}),v.xK.set_value_temp("")}})}},t))})})]})}),(0,K.jsxs)(c.fI,{children:[(0,K.jsx)(c.VP,{widthPer:50,maxWidth:"80rem",children:(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsx)("h2",{children:e("本地知识库")})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me("\n1. 本地知识库用于为AI增强理解能力,或者分析本地文件,原理读取本地的文件,对文件在内存中建立全文索引,为AI提供额外数据(需要有模型开启才能使用)\n2. 该功能只能用于小型知识库,作为本地小型或者公司内部资料使用还是没有问题的\n3. 每次保存都会重新加载知识库中的文件,不会全部重新加载,而是检测哪些文件有变更\n")},title:"信息"})]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.Ay,{checked:ee,onChange:async e=>{await u.jV.post("docs_on_set",{status:e}),ve(),t()},title:e("知识库开关")}),(0,K.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{v.xK.set_value_temp(F.current),ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{F.current=e,v.xK.set_value_temp(""),Ke(F.current)}})}}),(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...M,{note:"",auto_load:!1,dir:""}]),Y.current=!0}}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ke()}})]}),children:(0,K.jsx)(d.X,{headers:N,onRowDrag:(e,t)=>{X((0,C.TI)(M,e,t)),Y.current=!0},rows:M.map((t,n)=>{const s=[(0,K.jsx)("div",{children:n}),(0,K.jsx)(m.Sm,{value:t.dir,handleInputChange:e=>{t.dir=e,Y.current=!0},no_border:!0}),(0,K.jsx)(m.l6,{value:t.auto_load,onChange:e=>{t.auto_load=e,X([...M]),Y.current=!0},options:ge,no_border:!0}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"delete",title:e("删除记录"),onClick:()=>(e=>{M.splice(e,1),X([...M]),Y.current=!0})(n)}),(0,K.jsx)(a.rA,{icon:"restore",title:e("手动加载"),onClick:()=>{xe({sub_title:"手动加载",confirm_fun:()=>{u.jV.post("docs_load_file",{param_path:t.dir}),(0,x.SK)("ok")}})}}),(0,K.jsx)(a.rA,{icon:"delete_forever",title:e("从索引删除"),onClick:()=>{xe({sub_title:"从索引删除",confirm_fun:()=>{u.jV.post("docs_del",{param_path:t.dir}),(0,x.SK)("ok")}})}})]})];return s}),width:"10rem"})})}),R&&(0,K.jsx)(c.VP,{widthPer:50,maxWidth:"80rem",children:(0,K.jsxs)(p.Zp,{title:e("知识库加载信息"),children:[(0,K.jsx)(c.Yh,{left:e("最近一次加载")+","+e("加载进度"),right:R?.progress}),(0,K.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件数量")}`,right:R?.num}),(0,K.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件字符数量")}`,right:R?.char_num}),(0,K.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件大小")}`,right:(0,b.v7)(R?.size)}),(0,K.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总耗时")}`,right:(0,b.a3)(R?.consume_time_ms_len)}),(0,K.jsx)(c.Yh,{left:`${e("总文件数量")}`,right:R?.total_num})]})})]})]})})})]})}},24659(e,t,n){n.d(t,{K:()=>o});var s=n(22022);const o=()=>{const{t:e}=(0,s.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([[2674],{72458(e,t,n){function s(e,t){let n=function(e){let t="\\";for(const n of e)if("/"===n||"\\"===n){t=n;break}return t}(e);if("."===t)return e;if(".."===t){if(e.length>1){let t=e[e.length-1]===n?1:0;for(let s=e.length-1-t;s>=0;s--)if(e[s]===n)return e.substring(0,s+1)}return e}return e.endsWith(n)&&t.startsWith(n)?e.slice(0,-1)+t:e.endsWith(n)||t.startsWith(n)?e+t:e+n+t}n.d(t,{Jn:()=>s,Z1:()=>a});function a(e){if("string"!=typeof e||0===e.length)return!1;return/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e)}},92674(e,t,n){n.r(t),n.d(t,{default:()=>U});var s=n(96540),a=n(82893),i=n(34843),o=n(85997),l=n(57952),r=n(47022),c=n(34251),d=n(74848);function u(e){{const[t,n]=(0,s.useState)(()=>Boolean(e.expand_paths?.includes(e.pre_path))),[a,i]=(0,s.useState)([]),l=e=>{i(e)},p=async()=>{"folder"===e.type?(t||!e.click||a||await e.click(e,l,e.pre_path),n(!t)):e.click&&await e.click(e,l,e.pre_path)},h=async(t=!1)=>{"folder"!==e.type||t?e.fatherNowToggleExpansion&&e.fatherNowToggleExpansion():await e.click(e,l,e.pre_path)};return(0,s.useEffect)(()=>{i(e.children)},[e.children]),(0,s.useEffect)(()=>{t&&"folder"===e.type&&e.click&&e.click(e,l,e.pre_path)},[]),(0,d.jsxs)("div",{className:"studio-item",children:[(0,d.jsxs)("div",{onClick:p,onContextMenu:t=>{t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),e.handleContextMenu&&e.handleContextMenu(t,e.name,e.pre_path,e.type===r.Iw.folder,h)},className:"studio-item-title"+(e.active_path===e.pre_path?" studio-item-title--active":""),children:[(0,d.jsx)("i",{className:"material-icons studio-item-title-tag","data-icon":t?"arrow_drop_down":"arrow_right",children:"file"==e.type?"":t?"arrow_drop_down":"arrow_right"}),(0,d.jsx)("span",{className:"file-icons",children:(0,d.jsx)("span",{"data-type":(0,c.uL)(e.name),"data-dir":"folder"===e.type,"aria-label":e.name,children:(0,d.jsx)(o.In,{icon:"",aria_label:e.name})})}),(0,d.jsx)("span",{className:"studio-item-name",children:e.name})]}),t&&a&&(0,d.jsx)("div",{style:{marginLeft:20},children:a.map((t,n)=>(0,d.jsx)(s.Fragment,{children:(0,d.jsx)(u,{type:t.type,size:t.size,click:e.click,name:t.name,children:t.children,pre_path:`${e.pre_path}${t.name}${t.type===r.Iw.folder?"/":""}`,handleContextMenu:e.handleContextMenu,active_path:e.active_path,fatherNowToggleExpansion:h},n)},n))})]})}}n(61443);function p(e){return(0,d.jsx)("div",{children:e.list.map((t,n)=>(0,d.jsx)(u,{pre_path:`${e.pre_path}${t.name}${t.type===r.Iw.folder?"/":""}`,name:t.name,type:t.type,handleContextMenu:e.handleContextMenu,fatherNowToggleExpansion:e.fatherNowToggleExpansion,active_path:e.active_path,expand_paths:e.expand_paths,children:t.children,click:e.click,size:t.size},n))})}var h=n(14284),m=n(34289),f=n(53459),v=n(78247),_=n(62042),x=n(2543),y=n(78150),w=n(22022),g=n(88815),j=n(52671),k=n(23430),C=n(87361),S=n(99214),b=n(72458);const N=s.lazy(()=>Promise.all([n.e(122),n.e(4091)]).then(n.bind(n,84091))),$=s.lazy(()=>Promise.all([n.e(1384),n.e(1075),n.e(1142)]).then(n.bind(n,71142))),E=s.lazy(()=>n.e(4877).then(n.bind(n,64877))),A=s.lazy(()=>n.e(9857).then(n.bind(n,69857))),M=s.lazy(()=>Promise.all([n.e(3140),n.e(5744)]).then(n.bind(n,16575))),I=s.lazy(()=>Promise.all([n.e(8725),n.e(2728),n.e(2130),n.e(5602),n.e(8781),n.e(6404)]).then(n.bind(n,35304))),R=s.lazy(()=>Promise.resolve().then(n.bind(n,20892))),P=s.lazy(()=>Promise.all([n.e(1922),n.e(4935)]).then(n.bind(n,24935)));function z(e){return(0,c.uL)(e)===r.Iw.excel}function U(e){const[t,n]=(0,s.useState)([]),[u,U]=(0,s.useState)(""),[F,D]=(0,s.useState)(!1),[L,G]=(0,s.useState)({path:"",name:""}),[W,K]=(0,s.useState)(0),[T,B]=(0,s.useState)([]),[J,X]=(0,s.useState)(""),[Z,H]=(0,i.fp)(a.AG.confirm),[V,Y]=(0,s.useState)(!1),[q,O]=(0,i.fp)(a.AG.fileShellShow),[Q,ee]=(0,i.fp)(a.AG.file_shell_hidden),te=(0,S.Cf)(),ne=(0,s.useRef)(null),se=(0,s.useRef)(null),[ae,ie]=(0,s.useState)(!1),[oe,le]=(0,s.useState)(16),[re,ce]=(0,i.fp)(a.AG.showPrompt),{t:de}=(0,w.Bd)(),ue=(0,j.Zp)(),pe=(he=L.name,(0,c.uL)(he)===r.Iw.md);var he;const me=function(e){return(0,c.uL)(e)===r.Iw.excalidraw}(L.name),fe=function(e){return(0,c.uL)(e)===r.Iw.mind}(L.name),ve=function(e){return(0,c.uL)(e)===r.Iw.timeline}(L.name),_e=z(L.name),xe=(0,s.useRef)(null),ye=(0,s.useRef)(null),we=(0,s.useRef)(null),ge=(0,s.useRef)(null),je=(0,s.useRef)(null),ke=(0,s.useRef)(null),[Ce,Se]=(0,s.useState)([]),[be,Ne]=(0,s.useState)(-1),[$e,Ee]=(0,s.useState)("folder"),[Ae,Me]=(0,s.useState)(!0),[Ie,Re]=(0,s.useState)(!1),Pe=(0,S.oT)(),[ze]=(0,j.ok)(),Ue="1"===ze.get("chat_open"),[Fe,De]=(0,i.fp)(a.AG.studio_chat_width),Le=(0,s.useRef)(null),[Ge,We]=(0,s.useState)(!1),[Ke,Te]=(0,s.useState)(void 0),[Be,Je]=(0,i.fp)(a.AG.ai_chat_session_by_cwd),Xe=(0,j.zy)(),Ze=(()=>{const e=`${C.o.studio_page}/`,t=Xe.pathname.startsWith(e)?Xe.pathname.slice(e.length):"",n=(0,m.GG)("file",decodeURIComponent(t));return n.endsWith("/")?n:`${n}/`})(),{check_user_auth:He}=(0,v.MH)(),[Ve]=(0,i.fp)(a.AG.user_base_info),Ye=He(k.oV.ai_agent_page);(0,s.useEffect)(()=>{Ve?.user_data&&Ue&&!Ye&&Pe("chat_open",null)},[Ue,Ye,Ve]);const qe=(0,b.Jn)(k.nM.get_now_dir(Ve),Ze);(0,S.rJ)(qe);const Oe=async()=>{const e=Ze;U(e);const t=await h.$M.post("studio/get/item",{path:e});if(t.code===f.m.Success){const e=[],s=[];for(const n of t.data.list)"folder"===n.type?e.push(n):"file"===n.type&&s.push(n);n([...e,...s])}},Qe=(e,t)=>e===t||e.startsWith(t+"/");(0,s.useEffect)(()=>{Y(!1),G({path:"",name:""}),X(""),v.xK.set_value_temp(""),B([]),Oe()},[Xe]);const et=async(e,t)=>{if(v.xK.set_value_temp(""),!z(e)){const e=await h.$M.get(`${encodeURIComponent(t)}`);v.xK.set_value_temp(e.data)}G({path:t,name:e}),X(t),Ee("folder"),Re(!1)},tt=(e,t)=>{e.size>g.o5?H({open:!0,handle:()=>{et(e.name,t),H({open:!1,handle:null}),Y(!1)},title:"超过20MB了还要打开吗?"}):et(e.name,t)};function nt(){ye.current?.save()}const st=e=>{if(e.ctrlKey&&"s"===e.key){if(e.preventDefault(),pe||me||fe||ve||_e)return;V&&nt()}};(0,s.useEffect)(()=>(document.addEventListener("keydown",st),()=>{document.removeEventListener("keydown",st)}),[V,pe,me,fe,ve,_e]);const at=(0,s.useCallback)(x.throttle(e=>{const t=parseFloat(getComputedStyle(se.current).fontSize),n=window.innerWidth/t-4,s=e.clientX/t,a=2.25+ne.current.offsetWidth/t;s<=n&&s>=a&&le(parseFloat(s.toFixed(2)))},32),[]),it=()=>{ie(!1),se.current.removeEventListener("pointermove",at)},ot=(0,s.useCallback)(x.throttle(e=>{const t=Le.current;if(!t)return;const n=parseFloat(getComputedStyle(t).fontSize),s=t.parentElement.getBoundingClientRect().right-e.clientX,a=.7*t.parentElement.getBoundingClientRect().width,i=Math.min(Math.max(s,320),a);De(parseFloat((i/n).toFixed(2)))},32),[]),lt=()=>{We(!1),document.removeEventListener("pointermove",ot)},rt=[{r:de("创建文件"),v:"创建文件"},{r:de("创建目录"),v:"创建目录"},{r:de("重命名"),v:"重命名"},{r:de("删除"),v:"删除"}],ct=[{r:de("重命名"),v:"重命名"},{r:de("删除"),v:"删除"}],dt=(e,t,n,s,a)=>{e.preventDefault();const i=new c.ik;i.path=n,i.filename=t,i.x=e.clientX,i.y=e.clientY,i.items=s?rt:ct,a===Oe&&(i.items=i.items.slice(0,2)),i.type=s?r.Iw.studio_folder:r.Iw.studio_file;const o=e=>{a(e)};i.textClick=e=>{switch(e){case"创建文件":ce({show:!0,type:y.PromptEnum.FileNew,overlay:!0,data:{dir:n,call:o}});break;case"创建目录":ce({show:!0,type:y.PromptEnum.DirNew,overlay:!0,data:{dir:n,call:o}});break;case"删除":if(V&&(L.path===n||L.path.includes(n))){const e=()=>{o(s),Y(!1),G({}),v.xK.set_value_temp("")};ce({show:!0,type:y.PromptEnum.FilesDelete,overlay:!0,data:{path:n,call:e,filename:t}});break}ce({show:!0,type:y.PromptEnum.FilesDelete,overlay:!0,data:{path:n,filename:t,call:s?()=>{o(!0)}:o}});break;case"重命名":ce({show:!0,type:y.PromptEnum.FileRename,overlay:!0,data:{path:n,dir:(0,m.Yp)(n),call:(e,t)=>{((e,t)=>{if(J&&Qe(J,e)){const n=t+J.slice(e.length);X(n),G({path:n,name:(0,m.mH)(n)})}const n=(0,m.oW)(Ze);if(Qe(n,e)){const s=t+n.slice(e.length);return void ue(`${C.o.studio_page}/${encodeURIComponent(`/file/${s}`)}`,{replace:!0})}K(e=>e+1),Oe()})(e,t)},filename:t}})}},ce({show:!0,type:y.PromptEnum.FileMenu,overlay:!1,data:i})};const ut=pe&&"outline"===$e;return(0,d.jsxs)("div",{className:"studio studio--file",children:[(0,d.jsxs)(l.A,{ignore_tags:!0,left_children:[(0,d.jsx)(o.rA,{title:"取消",icon:"close",onClick:()=>{O({show:!1,path:""}),ee(void 0),ue(-1)}},1),(0,d.jsx)("div",{children:L.name},2)],children:[(0,d.jsx)("title",{children:L.name}),(0,d.jsx)(o.rA,{title:"侧边栏",icon:"list",onClick:()=>Me(e=>!e),selected:Ae}),pe&&[Ie?(0,d.jsx)(o.rA,{title:de("保存"),icon:"save",onClick:()=>xe.current?.save()},"save"):null,(0,d.jsx)(o.rA,{icon:"source"===xe.current?.mode()?"edit":"code",title:"source"===xe.current?.mode()?de("实时编辑模式"):de("源码模式"),onClick:()=>xe.current?.toggle_mode()},"mode"),(0,d.jsx)(o.rA,{title:de("导出PDF"),icon:"print",onClick:()=>xe.current?.export_pdf()},"pdf")],!pe&&(0,c.zr)(L.name)&&(0,d.jsx)(o.rA,{title:"格式化",icon:"data_object",onClick:function(){v.xK.get_editor()?.formatCode()}}),te.can_terminal&&(0,d.jsx)(o.rA,{icon:"terminal",title:"shell",onClick:function(){!0!==Q&&!1!==Q?q.show?O({show:!1,path:""}):(O({show:!0,path:Ze}),ee(!1)):ee(!Q)}}),He(k.oV.ai_agent_page)&&te.ai_chat_available&&(0,d.jsx)(o.rA,{title:de("AI 聊天"),icon:"smart_toy",selected:Ue,onClick:()=>Pe("chat_open",!Ue?"1":null)}),pe?Ie?(0,d.jsx)(o.rA,{title:de("保存"),icon:"save",onClick:()=>xe.current?.save()}):null:me?(0,d.jsx)(o.rA,{title:de("保存"),icon:"save",onClick:()=>we.current?.save()}):fe?(0,d.jsx)(o.rA,{title:de("保存"),icon:"save",onClick:()=>ge.current?.save()}):ve?(0,d.jsx)(o.rA,{title:de("保存"),icon:"save",onClick:()=>je.current?.save()}):_e?(0,d.jsx)(o.rA,{title:de("保存"),icon:"save",onClick:()=>ke.current?.save()}):V?(0,d.jsx)(o.rA,{title:"保存",icon:"save",onClick:nt}):null]}),(0,d.jsxs)("div",{className:"studio-body",ref:se,children:[(0,d.jsxs)("div",{className:"studio-nav",style:{display:Ae?void 0:"none",width:oe-1+"em"},onContextMenu:e=>{dt(e,L.name,Ze,!0,Oe)},children:[(0,d.jsx)("div",{className:"studio-nav-outline",style:{display:ut?void 0:"none"},children:(0,d.jsx)(E,{items:Ce,active_pos:be,on_click:e=>xe.current?.goto_heading(e)})}),(0,d.jsx)("div",{className:"studio-nav-folder",style:{display:ut?"none":void 0},children:(0,d.jsx)(s.Fragment,{children:(0,d.jsx)(p,{pre_path:u,list:t,click:async(e,t,n)=>{if("folder"===e.type){B(e=>e.includes(n)?e:[...e,n]);const e=await h.$M.post("studio/get/item",{path:`${n}`});if(e.code===f.m.Success){const n=[],s=[];for(const t of e.data.list)"folder"===t.type?n.push(t):"file"===t.type&&s.push(t);t([...n,...s])}}else{if(V)return void H({open:!0,handle:()=>{H({open:!1,handle:null}),Y(!1),tt(e,n)},title:"确定不保存就切换吗?"});tt(e,n)}},active_path:J,expand_paths:T,handleContextMenu:dt,fatherNowToggleExpansion:Oe})},W)}),pe&&(0,d.jsx)("div",{className:"studio-nav-switch",children:(0,d.jsx)(o.rA,{icon:ut?"folder":"list",title:de(ut?"文件目录":"大纲"),onClick:()=>Ee(ut?"folder":"outline")})})]}),Ae&&(0,d.jsx)("div",{className:"studio__divider",ref:ne,onPointerDown:()=>{ie(!0),se.current.addEventListener("pointermove",at)},onPointerUp:it}),ae&&(0,d.jsx)("div",{className:"shell__overlay",onPointerUp:it}),pe?(0,d.jsx)("div",{className:"studio-editor studio-editor--md",children:(0,d.jsx)(s.Suspense,{fallback:null,children:(0,d.jsx)($,{pane:{path:J,url:h.$M.getDownloadUrl(encodeURIComponent(J)),name:L.name,on_dirty:Re,on_outline:(e,t)=>{Se(e),Ne(t)},register:e=>{xe.current=e}}})})},J):me?(0,d.jsx)("div",{className:"studio-editor studio-editor--draw",children:(0,d.jsx)(s.Suspense,{fallback:null,children:(0,d.jsx)(M,{reset_key:J,url:h.$M.getDownloadUrl(encodeURIComponent(J)),save_path:J,on_dirty:Y,on_saved:()=>Y(!1),register:e=>{we.current=e}})})},J):fe?(0,d.jsx)("div",{className:"studio-editor studio-editor--mind",children:(0,d.jsx)(s.Suspense,{fallback:null,children:(0,d.jsx)(I,{reset_key:J,url:h.$M.getDownloadUrl(encodeURIComponent(J)),on_dirty:Y,on_saved:()=>Y(!1),register:e=>{ge.current=e},on_save:async e=>(await h.$M.post(`save/${encodeURIComponent(J)}`,{context:e})).code===f.m.Success})})},J):ve?(0,d.jsx)("div",{className:"studio-editor studio-editor--timeline",children:(0,d.jsx)(s.Suspense,{fallback:null,children:(0,d.jsx)(R,{reset_key:J,url:h.$M.getDownloadUrl(encodeURIComponent(J)),on_dirty:Y,register:e=>{je.current=e},on_save:async e=>(await h.$M.post(`save/${encodeURIComponent(J)}`,{context:e})).code===f.m.Success})})},J):_e?(0,d.jsx)("div",{className:"studio-editor studio-editor--excel",children:(0,d.jsx)(s.Suspense,{fallback:null,children:(0,d.jsx)(P,{url:h.$M.getDownloadUrl(encodeURIComponent(J)),save_path:J,on_dirty:Y,bind_save:e=>{ke.current={save:e}}})})},J):(0,d.jsx)("div",{className:"studio-editor",children:L.name&&(0,d.jsx)(s.Suspense,{fallback:null,children:(0,d.jsx)(N,{name:L.name,on_dirty:Y,register:e=>{ye.current=e},save:async e=>{const t={context:v.xK.get_editor_value()},n=await h.$M.post(`save/${encodeURIComponent(J)}`,t);return n.code===f.m.Success||e||(0,_.zN)(de("保存失败")),n.code===f.m.Success}})})},J),Ue&&(0,d.jsxs)(s.Fragment,{children:[(0,d.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Le,onPointerDown:e=>{e.preventDefault(),We(!0),document.addEventListener("pointermove",ot),document.addEventListener("pointerup",lt,{once:!0})}}),(0,d.jsx)("div",{className:"studio-chat-panel",style:{width:`${Fe}em`},children:(0,d.jsx)(s.Suspense,{fallback:null,children:(0,d.jsx)(A,{inline_header:!0,sync_url:!1,file_cwd_path:qe,session_id:Ke??(pt=qe,a.AG.get_ai_chat_session(Be,pt)),on_session_change:e=>{Te(e),((e,t)=>{Je({...Be,[e]:t})})(qe,e)}})})})]})]})]});var pt}}}]);
|