filecat 6.66.0 → 6.67.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/1458.4b7f874b4895f047f85d.js +1 -0
- package/build/dist/{1472.a30bcdd8bd2cbfc4b5c2.js → 1472.26eae5dfbe640bd95007.js} +1 -1
- package/build/dist/6247.b49e239cf64a04aa3d19.js +1 -0
- package/build/dist/8302.e0f4d085e33b3b95b7a3.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/{main.b35123cf5b85762e093f.js → main.0e7ed35ca4d77c86e560.js} +2 -2
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/1458.53238483707d85f74175.js +0 -1
- package/build/dist/6247.a51d063e4fea2aad451c.js +0 -1
- package/build/dist/8302.947f0a82bfdf22ae5ff1.js +0 -1
- /package/build/dist/{main.b35123cf5b85762e093f.js.LICENSE.txt → main.0e7ed35ca4d77c86e560.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1458],{91458(e,t,r){r.r(t),r.d(t,{default:()=>De});var n=r(96540),s=r(34843),o=r(82893),a=r(85997),c=r(57952),l=r(62042),i=r(53459),u=r(14284),d=r(57889),h=r(86149),m=r(42845),p=r(1575),f=r(89781),g=r(61396),v=r(46762),b=r(73337),_=r(89552),k=r(86059),w=r(58903);const x=(0,k.of)({tableGroup:"block",cellContent:"block+",cellAttributes:{}}),y={align:{default:null}},M={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:y,parseDOM:[{tag:"p"}],toDOM:e=>["p",e.attrs.align?{style:`text-align:${e.attrs.align}`}:{},0]},heading:{content:"inline*",group:"block",attrs:{level:{default:1},...y},defining:!0,parseDOM:[1,2,3,4,5,6].map(e=>({tag:`h${e}`,attrs:{level:e}})),toDOM(e){const t=e.attrs.align?{style:`text-align:${e.attrs.align}`}:{};return[`h${e.attrs.level}`,t,0]}},bullet_list:{group:"block",content:"list_item+",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},ordered_list:{group:"block",content:"list_item+",attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:e=>({order:Number(e.getAttribute("start")??1)})}],toDOM:e=>1===e.attrs.order?["ol",0]:["ol",{start:e.attrs.order},0]},list_item:{content:"paragraph block*",defining:!0,attrs:{checked:{default:null}},parseDOM:[{tag:"li",getAttrs:e=>{const t=e,r=t.querySelector("input[type=checkbox]");if(r)return{checked:r.checked};const n=t.getAttribute("data-checked");return{checked:null===n?null:"true"===n}}}],toDOM:e=>null!==e.attrs.checked?["li",{"data-checked":String(e.attrs.checked)},0]:["li",0]},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},code_block:{content:"text*",group:"block",marks:"",defining:!0,attrs:{language:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{const t=e.querySelector("code"),r=/language-([\w-]+)/.exec(t?.className??"");return{language:r?r[1]:""}}}],toDOM:e=>["pre",{"data-language":e.attrs.language},["code",0]]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},image:{inline:!0,group:"inline",draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:e=>{const t=e;return{src:t.getAttribute("src"),alt:t.getAttribute("alt"),title:t.getAttribute("title")}}}],toDOM(e){const{src:t,alt:r,title:n}=e.attrs,s={src:t};return r&&(s.alt=r),n&&(s.title=n),["img",s]}},text:{group:"inline"},...x},$={strong:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight=bold"}],toDOM:()=>["strong",0]},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"}],toDOM:()=>["s",0]},code:{parseDOM:[{tag:"code",getAttrs:e=>"PRE"!==e.parentElement?.tagName&&null}],toDOM:()=>["code",0]},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:e=>{const t=e;return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(e){const{href:t,title:r}=e.attrs;return["a",{href:t,title:r,rel:"noopener noreferrer",target:"_blank"},0]}}},j=new w.Sj({nodes:M,marks:$});const S=new(r(22091).A)({html:!0,linkify:!0,breaks:!1,typographer:!1});function E(e){const t=S.render(e??""),r=document.createElement("div");return r.innerHTML=t,w.S4.fromSchema(j).parse(r)}function D(e){let t="";return e.forEach(e=>{if(e.isText){let r=e.marks.some(e=>"code"===e.type.name)?e.text??"":function(e){return e.replace(/([\\`*_[\]<>])/g,"\\$1")}(e.text??"");for(const t of e.marks)switch(t.type.name){case"code":r=`\`${e.text??""}\``;break;case"strong":r=`**${r}**`;break;case"em":r=`*${r}*`;break;case"strike":r=`~~${r}~~`;break;case"link":r=`[${r}](${t.attrs.href}${t.attrs.title?` "${t.attrs.title}"`:""})`}t+=r}else if("image"===e.type.name){const{src:r,alt:n,title:s}=e.attrs;t+=``}else"hard_break"===e.type.name&&(t+=" \n")}),t}function A(e){const t=[];if(e.forEach(e=>{const r=[],n=[];e.forEach(e=>{var t;r.push((t=e.textContent,t.replace(/\|/g,"\\|").replace(/\n/g," ")).trim()),n.push("table_header"===e.type.name)}),t.push({cells:r,header_flags:n})}),0===t.length)return"";const r=Math.max(...t.map(e=>e.cells.length)),n=t[0].header_flags.some(e=>e),s=Array.from({length:r},(e,r)=>Math.max(3,...t.map(e=>O(e.cells[r]??"")))),o=e=>`| ${Array.from({length:r},(t,r)=>{return n=e[r]??"",o=s[r],n+" ".repeat(Math.max(0,o-O(n)));var n,o}).join(" | ")} |`,a=[];if(n){a.push(o(t[0].cells)),a.push(`| ${s.map(e=>"-".repeat(e)).join(" | ")} |`);for(let e=1;e<t.length;e++)a.push(o(t[e].cells))}else{a.push(o(new Array(r).fill(""))),a.push(`| ${s.map(e=>"-".repeat(e)).join(" | ")} |`);for(const e of t)a.push(o(e.cells))}return a.join("\n")}function O(e){let t=0;for(const r of e){const e=r.codePointAt(0)??0;t+=e>=4352&&e<=4447||e>=11904&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510?2:1}return t}function C(e,t=""){switch(e.type.name){case"paragraph":default:return t+D(e);case"heading":return`${t}${"#".repeat(e.attrs.level)} ${D(e)}`;case"blockquote":return L(e,"").split("\n").map(e=>`${t}> ${e}`).join("\n");case"code_block":{const r=e.attrs.language??"";return`${t}\`\`\`${r}\n${e.textContent}\n${t}\`\`\``}case"horizontal_rule":return`${t}---`;case"bullet_list":{const r=[];return e.forEach((e,n,s)=>{r.push(N(e,t,`${t}- `,`${t} `,s))}),r.join("\n")}case"ordered_list":{const r=[],n=e.attrs.order??1;return e.forEach((e,s,o)=>{r.push(N(e,t,`${t}${n+o}. `,`${t} `,o))}),r.join("\n")}case"table":return A(e).split("\n").map(e=>t+e).join("\n")}}function N(e,t,r,n,s){const o=e.attrs.checked,a=null===o?"":o?"[x] ":"[ ] ",c=[];e.forEach((e,t,r)=>{c.push(C(e,0===r?"":n))});const l=c.join("\n").split("\n");return r+a+l[0]+(l.length>1?"\n"+l.slice(1).join("\n"):"")}function L(e,t=""){const r=[];return e.forEach(e=>{r.push(C(e,t))}),r.join("\n\n")}function R(e){return L(e).trim()+"\n"}var z=r(74848);function q(e){const{t}=(0,h.B)(),[r,s]=(0,n.useState)(new Set),o=(0,n.useMemo)(()=>function(e){const t=[],r=[];for(const n of e){const e={...n,children:[]};for(;r.length>0&&r[r.length-1].level>=e.level;)r.pop();0===r.length?t.push(e):r[r.length-1].children.push(e),r.push(e)}return t}(e.items),[e.items]),a=(n,o)=>n.map(n=>{const c=n.children.length>0,l=r.has(n.pos),i=n.pos===e.active_pos;return(0,z.jsxs)("div",{children:[(0,z.jsxs)("div",{className:`md-outline-item md-outline-item--h${n.level}${i?" md-outline-item--active":""}`,style:{paddingLeft:.4+.75*o+"em"},title:n.text,onClick:()=>e.on_click(n),children:[(0,z.jsx)("i",{className:"material-icons md-outline-arrow"+(c?"":" md-outline-arrow--empty"),onClick:c?e=>{return t=n.pos,e.stopPropagation(),void s(e=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r});var t}:void 0,children:c?l?"arrow_right":"arrow_drop_down":""}),(0,z.jsx)("span",{className:"md-outline-text",children:n.text||t("未命名标题")})]}),c&&!l&&a(n.children,o+1)]},n.pos)});return 0===e.items.length?(0,z.jsxs)("div",{className:"md-outline md-outline--empty",children:[(0,z.jsx)("div",{className:"md-outline-header",children:t("大纲")}),(0,z.jsx)("div",{className:"md-outline-tip",children:t("正文里还没有标题")})]}):(0,z.jsxs)("div",{className:"md-outline",children:[(0,z.jsx)("div",{className:"md-outline-header",children:t("大纲")}),(0,z.jsx)("div",{className:"md-outline-list",children:a(o,0)})]})}var T=r(38341),B=r(3772);function I(){const e=j;return(0,T.sM)({rules:[(0,T.JJ)(/^(#{1,6})\s$/,e.nodes.heading,e=>({level:e[1].length})),(0,T.JJ)(/^```([\w-]*)\s$/,e.nodes.code_block,e=>({language:e[1]??""})),(0,T.tG)(/^\s*>\s$/,e.nodes.blockquote),(0,T.tG)(/^\s*([-+*])\s$/,e.nodes.bullet_list),(0,T.tG)(/^(\d+)\.\s$/,e.nodes.ordered_list,e=>({order:Number(e[1])})),...T.Fr,T.gO]})}function P(e){return(t,r)=>{const n=t.schema.marks[e];return!!n&&(0,v.wh)(n)(t,r)}}function W(e,t={}){return(r,n)=>{const s=r.schema.nodes[e];if(!s)return!1;const{$from:o,$to:a}=r.selection,c=o.blockRange(a);if(!c)return!1;const l=o.parent,i=l.type===s&&Object.entries(t).every(([e,t])=>l.attrs[e]===t),u=i?r.schema.nodes.paragraph:s,d=i?{}:t;return n&&n(r.tr.setBlockType(c.start,c.end,u,d)),!0}}const F=(e,t)=>(0,B.Sd)(e.schema.nodes.bullet_list)(e,t),G=(e,t)=>(0,B.Sd)(e.schema.nodes.ordered_list)(e,t),H=(e,t)=>{const{blockquote:r}=e.schema.nodes,{$from:n,$to:s}=e.selection,o=n.blockRange(s);if(!o)return!1;if(o.parent.type===r&&o.depth>0){const r=n.before(o.depth),s=e.tr.doc.nodeAt(r);if(s&&1===s.childCount)return t&&t(e.tr.replaceWith(r,r+s.nodeSize,s.child(0)).scrollIntoView()),!0;if(t){const r=e.tr,s=n.parent,a=n.after(o.depth);r.delete(o.start,o.end),r.insert(a,s),t(r.scrollIntoView())}return!0}return t&&t(e.tr.wrap(o,[{type:r}]).scrollIntoView()),!0},U={sink:(0,B.$B)(j.nodes.list_item),lift:(0,B.T2)(j.nodes.list_item),split:(0,B.wn)(j.nodes.list_item),wrap_bullet:F,wrap_ordered:G};r(41631),r(50576),r(70432);function V(e){return 0===e?W("paragraph"):W("heading",{level:e})}function J(e,t){return(0,k.D8)(1)(e,t)}const X=n.forwardRef(function(e,t){const r=(0,n.useRef)(null),s=(0,n.useRef)(null),o=(0,n.useRef)(e.on_change),a=(0,n.useRef)(e.on_save),c=(0,n.useRef)(e.on_selection_change);return(0,n.useEffect)(()=>{o.current=e.on_change,a.current=e.on_save,c.current=e.on_selection_change}),(0,n.useEffect)(()=>{if(!r.current)return;const n=m.$t.create({doc:E(e.value??""),plugins:[I(),(0,g.w)({"Mod-b":P("strong"),"Mod-i":P("em"),"Mod-Shift-x":P("strike"),"Mod-`":P("code"),"Mod-1":(e,t)=>V(1)(e,t),"Mod-2":(e,t)=>V(2)(e,t),"Mod-3":(e,t)=>V(3)(e,t),"Mod-0":(e,t)=>V(0)(e,t),"Mod-Shift-8":F,"Mod-Shift-9":G,"Mod-Shift-.":H,Tab:U.sink,"Shift-Tab":U.lift,"Mod-Enter":J,"Mod-s":()=>(a.current?.(),!0)}),(0,k.LF)({allowTableNodeSelection:!0}),(0,k.AL)(),(0,b.A)({color:"var(--primary, #1a73e8)",width:2}),(0,_.z)(),(0,f.b6)(),(0,g.w)({Enter:(0,v.st)(v.pC,U.split,v.Z1,v.iz,v.aw),"Shift-Enter":(e,t)=>{const{hard_break:r}=e.schema.nodes;return t&&t(e.tr.replaceSelectionWith(r.create()).scrollIntoView()),!0},"Mod-Enter":v.I$}),(0,g.w)(v.RV)]}),l=new p.Lz(r.current,{state:n,editable:()=>!1!==e.editable,dispatchTransaction(e){const t=l.state.apply(e);l.updateState(t),e.docChanged&&o.current?.(R(t.doc)),(e.selectionSet||e.docChanged)&&c.current?.()},attributes:{class:"md-wysiwyg-content",spellcheck:"false"}});s.current=l;const i={get_markdown:()=>R(l.state.doc),set_markdown:e=>{const t=E(e);l.dispatch(l.state.tr.replaceWith(0,l.state.doc.content.size,t.content))},focus:()=>l.focus(),get_view:()=>s.current,in_table:()=>function(e){const{$from:t}=e.selection;for(let e=t.depth;e>0;e--){if("table"===t.node(e).type.name)return!0}return!1}(l.state),active_marks:()=>(l.state.storedMarks??l.state.selection.$from.marks()).map(e=>e.type.name),active_block:()=>{const{$from:e}=l.state.selection;for(let t=e.depth;t>0;t--){const r=e.node(t);if("heading"===r.type.name)return{name:"heading",level:r.attrs.level};if("paragraph"===r.type.name)return{name:"paragraph"}}return{name:"paragraph"}},insert_table:(e=3,t=3)=>{const r=function(e,t,r){const n=(0,k.e)(e),s=n.table,o=n.row,a=n.cell,c=n.header_cell??n.cell;if(!s||!o||!a)return null;const l=e=>o.create(null,Array.from({length:t},()=>e.createAndFill())),i=l(c),u=Array.from({length:r},()=>l(a));return s.create(null,[i,...u])}(l.state.schema,e,t);if(!r)return;const{from:n}=l.state.selection,s=l.state.doc.resolve(n);let o=n;for(let e=s.depth;e>0;e--)if("table"===s.node(e).type.name){o=s.after(e);break}const a=l.state.tr;o===n?a.replaceSelectionWith(r):a.insert(o,r),l.dispatch(a.scrollIntoView());const c=l.state.doc.resolve(Math.min(o+3,l.state.doc.content.size));try{l.dispatch(l.state.tr.setSelection(l.state.selection.constructor.near(c)))}catch{}},get_headings:()=>function(e){const t=[];return e.doc.descendants((e,r)=>("heading"!==e.type.name||t.push({level:e.attrs.level,text:e.textContent,pos:r}),!0)),t}(l.state),scroll_to_pos:e=>{const t=l.state.doc.content.size,r=Math.max(0,Math.min(e,t)),n=l.state.doc.nodeAt(r);let s;try{s=n?m.U3.near(l.state.doc.resolve(r+1),1):m.U3.near(l.state.doc.resolve(r),1)}catch{s=m.U3.near(l.state.doc.resolve(0),1)}l.dispatch(l.state.tr.setSelection(s).scrollIntoView()),l.focus()}};return"function"==typeof t?t(i):t&&(t.current=i),e.on_ready?.(i),()=>{l.destroy(),s.current=null}},[]),(0,z.jsx)("div",{className:"md-wysiwyg",ref:r})});function Y(e){const{t}=(0,h.B)(),r=(0,n.useRef)(null),[s,o]=(0,n.useState)({marks:[],block:{name:"paragraph"}}),[a,c]=(0,n.useState)(null),l=(0,n.useCallback)(()=>{const t=e.get_view();if(!t)return;const r=t.state.selection,n=t.state.storedMarks??r.$from.marks();if(o({marks:n.map(e=>e.type.name),block:K(r.$from)}),r.empty)return void c(null);const s=t.coordsAtPos(r.from),a=t.coordsAtPos(r.to),l=(Math.min(s.left,a.left)+Math.max(s.right,a.right))/2,i=Math.min(s.top,a.top),u=Math.max(s.bottom,a.bottom);c({top:i,bottom:u,left:l})},[e.get_view]);(0,n.useEffect)(()=>{l();const t=e.get_view();if(!t)return;const r=()=>l();t.dom.addEventListener("keyup",r),t.dom.addEventListener("mouseup",r),document.addEventListener("selectionchange",r);const n=t.dom.closest(".md-editor-context");return n?.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),()=>{t.dom.removeEventListener("keyup",r),t.dom.removeEventListener("mouseup",r),document.removeEventListener("selectionchange",r),n?.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[l,e.get_view,e.refresh_key]);const i=t=>{const r=e.get_view();r&&(t(r.state,r.dispatch),r.focus(),l())},u=e=>s.marks.includes(e),d=e=>"heading"===s.block.name&&s.block.level===e,[m,p]=(0,n.useState)({w:0,h:36});if((0,n.useLayoutEffect)(()=>{if(!a||!r.current)return;const e=r.current.offsetWidth,t=r.current.offsetHeight;p(r=>r.w===e&&r.h===t?r:{w:e,h:t})},[a,e.refresh_key]),!a)return null;const f=(e,r,n,s,o=!1)=>(0,z.jsx)("button",{className:"mdtb__btn"+(o?" mdtb__btn--on":""),title:t(n),onMouseDown:e=>e.preventDefault(),onClick:s,children:r},e),g=m.w/2,v=g+4,b=Math.max(v,window.innerWidth-g-4),_=document.querySelector(".header")?.getBoundingClientRect().bottom??0,k=a.top-m.h-8,w=k<_+4,x={top:w?Math.min(a.bottom+8,window.innerHeight-m.h-4):k,left:Math.min(b,Math.max(v,a.left))};return(0,z.jsxs)("div",{className:"mdtb mdtb--floating"+(w?" mdtb--below":""),ref:r,style:x,children:[f("h1","H1","一级标题",()=>i(W("heading",{level:1})),d(1)),f("h2","H2","二级标题",()=>i(W("heading",{level:2})),d(2)),f("h3","H3","三级标题",()=>i(W("heading",{level:3})),d(3)),(0,z.jsx)("span",{className:"mdtb__sep"}),f("b","B","加粗",()=>i(P("strong")),u("strong")),f("i","I","斜体",()=>i(P("em")),u("em")),f("s","S","删除线",()=>i(P("strike")),u("strike")),f("code","</>","行内代码",()=>i(P("code")),u("code")),(0,z.jsx)("span",{className:"mdtb__sep"}),f("ul","≔","无序列表",()=>i(F)),f("ol","1.","有序列表",()=>i(G)),f("quote","❝","引用",()=>i(H))]})}function K(e){for(let t=e.depth;t>0;t--){const r=e.node(t).type.name;if("heading"===r)return{name:"heading",level:e.node(t).attrs.level};if("paragraph"===r)return{name:"paragraph"}}return{name:"paragraph"}}var Z=r(75725);const Q="cut",ee="copy",te="paste",re="strong",ne="em",se="strike",oe="code",ae="h1",ce="h2",le="h3",ie="paragraph",ue="bullet",de="ordered",he="quote",me="code_block",pe="clean",fe="row_before",ge="row_after",ve="row_delete",be="col_before",_e="col_after",ke="col_delete",we="header_toggle",xe="cell_merge",ye="cell_split",Me="table_delete",$e="table_insert",je="select_all";function Se(e){const{t}=(0,h.B)(),[r,s]=(0,n.useState)(null),o=(0,n.useRef)(e.get_view);o.current=e.get_view,(0,n.useEffect)(()=>{const e=e=>{const t=o.current();if(!t)return;const r=e.target;if(!r||!r.closest(".md-wysiwyg-content"))return;e.preventDefault();const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(n){const e=t.state.selection;if(n.pos<e.from||n.pos>e.to){const{TextSelection:e}=t.state.selection.constructor;try{t.dispatch(t.state.tr.setSelection(e.near(t.state.doc.resolve(n.pos))))}catch{}}}const a=!!r.closest("td, th");s({x:e.clientX,y:e.clientY,in_table:a||(0,k.aH)(t.state)})};return document.addEventListener("contextmenu",e,!0),()=>document.removeEventListener("contextmenu",e,!0)},[]);const a=()=>s(null),c=(0,n.useCallback)(e=>{const t=o.current();t&&(e(t.state,t.dispatch),t.focus(),a())},[]),l=e=>{const t=o.current();t?.focus(),document.execCommand(e),a()};if(!r)return null;const i=r.in_table?[{r:t("上方插入行"),v:fe},{r:t("下方插入行"),v:ge},{r:t("左侧插入列"),v:be},{r:t("右侧插入列"),v:_e},{r:t("删除行"),v:ve},{r:t("删除列"),v:ke},{r:t("切换表头行"),v:we},{r:t("合并单元格"),v:xe},{r:t("拆分单元格"),v:ye},{r:t("删除表格"),v:Me}]:[],u=[{r:t("剪切"),v:Q},{r:t("复制"),v:ee},{r:t("粘贴"),v:te},{r:t("格式"),v:"format",items:[{r:t("加粗"),v:re},{r:t("斜体"),v:ne},{r:t("删除线"),v:se},{r:t("行内代码"),v:oe}]},{r:t("段落"),v:"block",items:[{r:t("一级标题"),v:ae},{r:t("二级标题"),v:ce},{r:t("三级标题"),v:le},{r:t("正文"),v:ie}]},{r:t("插入"),v:"insert",items:[{r:t("无序列表"),v:ue},{r:t("有序列表"),v:de},{r:t("引用"),v:he},{r:t("代码块"),v:me},{r:t("插入表格"),v:$e}]},...i.length?[{r:t("表格"),v:"table",items:i}]:[],{r:t("清除格式"),v:pe},{r:t("全选"),v:je}];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Z.rY,{click:a}),(0,z.jsx)(Z.Pu,{x:r.x,y:r.y,items:u,click:t=>{switch(t){case Q:return l("cut");case ee:return l("copy");case te:return l("paste");case re:return c(P("strong"));case ne:return c(P("em"));case se:return c(P("strike"));case oe:return c(P("code"));case ae:return c(W("heading",{level:1}));case ce:return c(W("heading",{level:2}));case le:return c(W("heading",{level:3}));case ie:return c(W("paragraph"));case ue:return c(F);case de:return c(G);case he:return c(H);case me:return c(W("code_block"));case $e:return a(),void e.on_insert_table?.();case fe:return c(k.JD);case ge:return c(k.gC);case be:return c(k.RC);case _e:return c(k.GU);case ve:return c(k.aR);case ke:return c(k.gR);case we:return c(k.uC);case xe:return c(k.w7);case ye:return c(k.L0);case Me:return c(k.kG);case pe:return c((e,t)=>{const{from:r,to:n}=e.selection;let s=e.tr;return e.doc.nodesBetween(r,n,(e,t)=>{if(e.isText)for(const r of e.marks)s=s.removeMark(t,t+e.nodeSize,r.type)}),t?.(s),!0});case je:return c((e,t)=>{const{TextSelection:r}=e.selection.constructor;return t?.(e.tr.setSelection(r.create(e.doc,0,e.doc.content.size))),!0})}}})]})}var Ee=r(2543);function De(){const{t:e}=(0,h.B)(),[t,r]=(0,s.fp)(o.AG.md_editor),[m,p]=(0,n.useState)(null),[f,g]=(0,n.useState)(!1),[v,b]=(0,n.useState)(!1),[_,k]=(0,n.useState)(0),w=(0,n.useRef)(null),[x,y]=(0,n.useState)([]),[M,$]=(0,n.useState)(-1),[j,S]=(0,n.useState)(15),[E,D]=(0,n.useState)(!1),A=(0,n.useRef)(null),O=(0,n.useRef)(null),C=(0,n.useRef)([]),N=(0,n.useCallback)(()=>{const e=w.current;if(!e)return;const t=e.get_headings();C.current=t,y(t)},[]),L=(0,n.useCallback)(()=>{const e=w.current?.get_view();if(!e)return;const t=e.state.selection.from;let r=-1;for(const e of C.current){if(!(e.pos<=t))break;r=e.pos}$(r)},[]);(0,n.useEffect)(()=>{let r=!1;if(t?.url)return g(!0),d.l.get(t.url).then(e=>{r||p(e??"")}).catch(()=>{r||((0,l.zN)(e("打开失败")),p(""))}).finally(()=>{r||g(!1)}),()=>{r=!0};p(null)},[t?.url]),(0,n.useEffect)(()=>{const e=()=>k(e=>e+1);return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[]),(0,n.useEffect)(()=>{N(),L()},[_,N,L]);const R=(0,n.useCallback)(Ee.throttle(e=>{if(!A.current||!O.current)return;const t=parseFloat(getComputedStyle(A.current).fontSize),r=e.clientX/t,n=window.innerWidth/t-4,s=2.25+O.current.offsetWidth/t;r<=n&&r>=s&&S(parseFloat(r.toFixed(2)))},32),[]),T=()=>{D(!1),A.current?.removeEventListener("pointermove",R)},B=async()=>{if(!t?.name||!t?.path||!w.current)return;const r=w.current.get_markdown(),n=t.path.slice(0,t.path.length-t.name.length),s=`${encodeURIComponent(n)}${t.name}`;(await u.$M.post(`save/${s}`,{context:r})).code===i.m.Success?(b(!1),(0,l.SK)(e("保存成功"))):(0,l.zN)(e("保存失败"))},I=(0,n.useRef)(B);I.current=B;const P=(0,n.useMemo)(()=>t?.url??"md_editor",[t?.url]);return t?.name?(0,z.jsxs)("div",{id:"md-editor-container",children:[(0,z.jsx)(c.A,{ignore_tags:!0,left_children:[(0,z.jsx)(a.rA,{title:e("关闭"),icon:"close",onClick:()=>{r({}),b(!1),p(null),w.current=null,t?.close?.()}},1),(0,z.jsx)(a.rA,{title:e("保存"),icon:"save",onClick:B,selected:v},2),(0,z.jsx)("title",{children:t.name},3)]}),(0,z.jsxs)("div",{className:"md-editor-context",ref:A,children:[f&&(0,z.jsxs)("div",{className:"common-box common-box-center",children:[e("加载中"),"..."]}),!f&&null!==m&&(0,z.jsxs)(n.Fragment,{children:[(0,z.jsx)("div",{className:"md-outline-panel",style:{width:`${j}em`},children:(0,z.jsx)(q,{items:x,active_pos:M,on_click:e=>{w.current?.scroll_to_pos(e.pos),$(e.pos)}})}),(0,z.jsx)("div",{className:"md-editor-divider",ref:O,onPointerDown:()=>{D(!0),A.current?.addEventListener("pointermove",R)},onPointerUp:T}),E&&(0,z.jsx)("div",{className:"md-editor-drag-overlay",onPointerUp:T}),(0,z.jsx)("div",{className:"md-editor-scroll",children:(0,z.jsxs)("div",{className:"md-editor-sheet",children:[(0,z.jsx)(Y,{get_view:()=>w.current?.get_view()??null,refresh_key:_}),(0,z.jsx)(X,{value:m,ref:w,on_ready:e=>{const t=e.get_headings();C.current=t,y(t),$(-1)},on_change:()=>{v||b(!0)},on_save:()=>I.current(),on_selection_change:()=>k(e=>e+1)},P),(0,z.jsx)(Se,{get_view:()=>w.current?.get_view()??null,on_insert_table:()=>{w.current?.insert_table(3,3),b(!0)}})]})})]})]})]}):null}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6247],{77481(e,t,n){n.d(t,{S:()=>i,X:()=>s});var r=n(96540),o=n(61443),l=n(74848);function s(e){const[t,n]=r.useState([]),s=(0,r.useRef)(-1),[i,a]=(0,r.useState)(-1),[c,d]=(0,r.useState)(-1);(0,r.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const h=()=>{s.current=-1,a(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((t,n)=>{const r=!!e.filter&&(e.filter.column??0)===n;let s=t;if(r){const n=e.filter,r=n.options.find(e=>e.value===n.value);null!=n.value&&r&&(s=`${t} (${r.label})`)}return(0,l.jsx)("th",{className:r?"table-filter-col":"",children:r?(0,l.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:s}):t},n)})})}),(0,l.jsx)("tbody",{children:t.map((t,n)=>{const r=!!e.onRowDrag;return(0,l.jsx)("tr",{className:r?(i===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:r,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{r&&(s.current=n,a(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!r||s.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{r&&(t.preventDefault(),(()=>{const t=s.current,n=c;h(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:h,children:t.map((n,r)=>{const o=r===t.length-1?"small":"";return(0,l.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},r)})},n)})})]})}function i(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,l.jsx)("div",{children:e},t))})}},66247(e,t,n){n.r(t),n.d(t,{default:()=>b});var r=n(96540),o=n(75725),l=n(70447),s=n(85997),i=n(77481),a=n(61443),c=n(86149),d=n(14284),h=n(53459),u=n(62042),f=n(87361),x=n(40505),p=n(4412),j=n(86090),_=n(34843),m=n(82893),w=n(21469),v=n(21499),g=n(74848);function b(){const{t:e,i18n:t}=(0,c.B)(),n=(0,j.Zp)(),b=[e("编号"),e("路径"),e("过期小时"),e("token"),e("备注"),e("剩余时间(h)"),e("下载次数")],[C,k]=(0,r.useState)([]),[S,y]=(0,_.fp)(m.AG.prompt_card),A=async()=>{const e=await d.XO.get("get_share_file_list");if(e.code===h.m.Success){const t=e.data??[],n=Date.now();for(const e of t)try{if(null!=e.left_hour&&e.left_hour>0){const t=n-e.time_stamp,r=36e5*e.left_hour-t;e.show_left_hour=parseFloat((r/36e5).toFixed(2))}else e.show_left_hour=e.left_hour}catch(e){}k(t)}};(0,r.useEffect)(()=>{A()},[]);return(0,g.jsxs)("div",{className:"common-box ",style:{overflowY:"auto"},children:[(0,g.jsx)(p.aZ,{position:"right",children:(0,g.jsx)(s.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{n(-1)}})}),(0,g.jsx)(o.J,{widthPer:100,children:(0,g.jsx)(l.uF,{self_title:(0,g.jsxs)("span",{className:" div-row ",children:[(0,g.jsx)("h2",{children:e("文件分享列表")}),(0,g.jsx)(s.rA,{icon:"info",title:e("提示"),onClick:()=>{let e=(0,g.jsx)("div",{children:"小时设置为-1或者不设置就没有过期时间"});y({open:!0,title:"信息",context_div:(0,g.jsx)("div",{children:e})})}})]}),titleCom:(0,g.jsxs)("div",{children:[(0,g.jsx)(s.rA,{icon:"add",title:e("添加"),onClick:()=>{k([...C,{note:"",path:""}])}}),(0,g.jsx)(s.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("set_share_file_list",C)).code===h.m.Success&&((0,u.SK)("保存成功"),A())}})]}),children:(0,g.jsx)(i.X,{headers:b,rows:C.map((t,n)=>{const r=[(0,g.jsx)("div",{children:n}),(0,g.jsx)(a.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,g.jsx)(a.Sm,{value:t.left_hour,handleInputChange:e=>{t.left_hour=parseFloat(e),t.time_stamp=Date.now()},no_border:!0}),(0,g.jsx)(a.Sm,{value:t.token,handleInputChange:e=>{t.token=e},no_border:!0}),(0,g.jsx)(a.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,g.jsx)("p",{children:t.show_left_hour}),(0,g.jsx)("p",{children:t.download_num}),(0,g.jsxs)("div",{children:[(0,g.jsx)(s.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),k([...C])})(n)}),t.id&&(0,g.jsx)(s.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{const e=(0,v.bi)(`${window.location.origin}${w.m.base_url}`,`${f.o.share}/${t.id}`);(0,x.lW)(e),(0,u.SK)(e)}}),t.id&&(0,g.jsx)(s.rA,{icon:"open_in_new",title:e("打开新页面"),onClick:()=>{const e=(0,v.bi)(`${window.location.origin}${w.m.base_url}`,`${f.o.share}/${t.id}`);window.open(e)}})]})];return r}),width:"10rem"})})})]})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6010,8302],{83277(e,t,n){n.d(t,{$j:()=>i,Lv:()=>s});class s{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const 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=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"):""}n.d(t,["CP",0,'\n\n\n\n# 聊天循环最大次数\ntool_call_max=500\n# 是否允许AI直接执行命令而不需要用户确认,默认为false,需要用户手动确认,如果使用 workflow 这里等价于为 true\nallow_exec_cmd_directly=false\n\n# 可选的代理 url,如果指定了所有访问大模型的请求将会走代理\n#proxy_url=\n\n# 可选的多个url 以数组分割\n# options_agent_url_list=[{"value":"http://..","label":"openai"}]\n\n# 可选的多个 key\n# options_agent_key_list=[{"value":"sh-aaa","label":"option1"}]\n\n# 可选的多个 model\n# options_agent_model_list=[{"value":"gpt-5.5","label":"gpt"}]\n\n# 存放本地的 prompt 文件 用于每次聊天的时候自动读取并加载\n# options_local_file_path_prompt_list=["/prompt/a.txt"]\n\n# 开启切换模型 ,开启以后,你可以自己写 prompt 提供多个模型让 ai 自己根据每次聊天切换下一步调用其他模型的次数\n# open_pick_model=false\n\n# 压缩后仍然完整保留的最近消息数\nmax_recent_messages=12\n# 当单个会话累计消息条数超过该值时,触发历史消息裁剪\ncompress_message_count=16\n# 历史消息中 tool 输出的最大字符数,只保留调用形式让 AI 知道调用了就行\nmax_tool_content_chars=200\n\n# ===== 模型类型(request_type)=====\n# 必填项,不同类型的 model 接口格式不同,默认 completions。\n# 可选值:\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',"cL",0,o])},77481(e,t,n){n.d(t,{S:()=>l,X:()=>a});var s=n(96540),o=n(61443),i=n(74848);function a(e){const[t,n]=s.useState([]),a=(0,s.useRef)(-1),[l,r]=(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 p=()=>{a.current=-1,r(-1),d(-1)};return(0,i.jsxs)("table",{children:[(0,i.jsx)("thead",{children:(0,i.jsx)("tr",{children:e.headers?.map((t,n)=>{const s=!!e.filter&&(e.filter.column??0)===n;let a=t;if(s){const n=e.filter,s=n.options.find(e=>e.value===n.value);null!=n.value&&s&&(a=`${t} (${s.label})`)}return(0,i.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,i.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:a}):t},n)})})}),(0,i.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,i.jsx)("tr",{className:s?(l===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(a.current=n,r(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=a.current,n=c;p(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:p,children:t.map((n,s)=>{const o=s===t.length-1?"small":"";return(0,i.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function l(e){return(0,i.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,i.jsx)("div",{children:e},t))})}},29591(e,t,n){n.r(t),n.d(t,{default:()=>$});var s=n(86149),o=n(96540),i=n(85997),a=n(4412),l=n(34843),r=n(82893),c=n(75725),d=n(77481),p=n(61443),m=n(70447),u=n(34299),h=n(74848);var _=n(14284),x=n(53459),g=n(62042),v=n(7523),j=n(78247),f=n(23430),y=n(86090),w=n(14944),b=n(92275),C=n(88815),k=n(45907),A=n(12721),S=n(24659),I=n(83277);function $(){const{t:e}=(0,s.B)(),{initUserInfo:t}=(0,o.useContext)(v.F),n=[e("编号"),e("url"),e("是否开启"),e("key"),"model",e("更多属性"),e("备注")],$=[e("编号"),e("本地目录"),e("自动加载"),e("备注")],[L,K]=(0,o.useState)([]),[N,M]=(0,o.useState)([]),[O,P]=(0,o.useState)([]),[X,D]=(0,o.useState)(null),F=(0,o.useRef)(),V=(0,o.useRef)(!1),T=(0,o.useRef)(!1),[H,Y]=(0,o.useState)([]),[q,R]=(0,o.useState)(!1),[E,G]=(0,l.fp)(r.AG.prompt_card),[B,J]=(0,l.fp)(r.AG.user_base_info),[z,W]=(0,o.useState)(!1),Z=O.filter(e=>"http"!==(e.transport??"stdio")),U=O.filter(e=>"http"===e.transport),Q=[e("编号"),e("名称"),e("是否开启"),"command","args","cwd",e("tools|env"),e("备注")],ee=[e("编号"),e("名称"),e("是否开启"),e("endpoint"),e("tools|headers"),e("备注")],te=[e("编号"),e("提示词"),e("LLM编辑开关"),e("LLM编辑提示词"),e("编辑规则"),e("备注")],[ne,se]=(0,o.useState)([]),[oe,ie]=(0,o.useState)(!1),ae=function(){const[e,t]=(0,l.fp)(r.AG.prompt_card);return e=>{t({open:!0,title:"信息",context_div:(0,h.jsx)("div",{children:(0,h.jsx)(u.default,{context:e})})})}}(),{check_user_auth:le}=(0,j.MH)(),[re,ce]=(0,l.fp)(r.AG.editorSetting),de=(0,y.Zp)(),pe=(0,k.y)(),me=(0,S.K)(),ue=async()=>{const e=await _.jV.get("docs_on_get");e.code===x.m.Success&&W(e.data)};(0,o.useEffect)(()=>{(async()=>{const e=await _.XO.get("ai_agent_setting");e.code===x.m.Success&&K(e.data.models),await w.ws.addMsg(b.HK.ai_load_info,e=>{D(e.context)});const t=await w.ws.sendData(b.HK.ai_load_info,{});t?.context&&D(t.context);const n=await _.XO.get("ai_docs_setting");n.code===x.m.Success&&(F.current=n.data.param,n.data.list?.length&&M(n.data.list));const s=await _.XO.get("ai_mcp_setting");s.code===x.m.Success&&P(s.data.list??[]),await je(),ue();const o=await _.XO.get("ai_system_prompts");o.code===x.m.Success&&se(o.data??[]);const i=await _.XO.get("ai_long_term_memory_setting");i.code===x.m.Success&&ie(i.data?.open??!1)})()},[]);const he=(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};P([...O,t]),V.current=!0},_e=e=>{const t=O.indexOf(e);t<0||(O.splice(t,1),P([...O]),V.current=!0)},xe=e=>{P([...O,{...e,open:!1}]),V.current=!0},ge=async e=>{for(let e=0;e<L.length;e++)L[e].index=e;(await _.XO.post("ai_agent_setting/save",{models:e??L})).code===x.m.Success&&(0,g.SK)("保存成功")},ve=async e=>{for(let e=0;e<O.length;e++)O[e].index=e;(await _.XO.post("ai_mcp_setting/save",{list:e??O})).code===x.m.Success&&((0,g.SK)("保存成功"),V.current=!1,await je())},je=async()=>{const e=await _.XO.get("ai_mcp_tools");return e.code===x.m.Success?(Y(e.data??[]),e.data??[]):[]},fe=async e=>{R(!0);try{const t=await _.XO.post("ai_mcp_tools/reload",{index:e});if(t.code===x.m.Success)return await je(),(0,g.SK)("MCP工具加载成功"),t.data??null}finally{R(!1)}return null},ye=async(t,n,s,o)=>{const i=o??H.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:[]},a=(i.tools??[]).map(t=>({id:t.runtime_name,title:t.tool_name,subtitle:t.description||e("无描述"),detail:t.display_name,meta:t.runtime_name}));G({open:!0,title:`${t.name||t.note||n} MCP工具`,context_div:(0,h.jsx)(A.O,{title:`${t.name||t.note||n} MCP工具`,subtitle:`${i.transport??"stdio"} | ${i.open?e("是"):e("否")} | ${i.loaded?"loaded":"idle"} | ${i.tool_count} tools`,pages:a,initialPageId:s,onRefresh:async()=>{const e=await fe(n);e&&await ye(t,n,s,e)},renderPage:t=>{if(!t)return(0,h.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")});const n=i.tools?.find(e=>e.runtime_name===t.id);return n?(0,h.jsxs)("div",{className:"prompt-switch-page__detail",children:[(0,h.jsx)("div",{className:"prompt-switch-page__detail-title",children:n.display_name}),(0,h.jsx)("div",{className:"prompt-switch-page__detail-desc",children:n.description||e("无描述")}),(0,h.jsxs)("div",{className:"prompt-switch-page__detail-row",children:[(0,h.jsx)("strong",{children:"runtime:"})," ",n.runtime_name]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("strong",{children:"schema:"}),(0,h.jsx)("pre",{className:"prompt-switch-page__schema",children:JSON.stringify(n.input_schema??{},null,2)})]})]}):(0,h.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")})}}),cancel:()=>G({open:!1})})},we=async e=>{for(let e=0;e<L.length;e++)L[e].index=e;let t={list:N,docs_update_tag:T.current};null!=e&&(t={param:e}),T.current=!1;(await _.XO.post("ai_docs_setting_save",t)).code===x.m.Success&&(0,g.SK)("保存成功")},be=async()=>{for(let e=0;e<ne.length;e++)ne[e].index=e;(await _.XO.post("ai_system_prompts/save",{list:ne})).code===x.m.Success&&(0,g.SK)("保存成功")};return(0,h.jsxs)("div",{children:[(0,h.jsx)(a.aZ,{position:"right",children:le(f.oV.ai_agent_setting)&&(0,h.jsx)(i.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{de(-1)}})}),(0,h.jsx)(c.jW,{isFull:!0,more:!0,children:(0,h.jsx)(c.NN,{children:(0,h.jsxs)(c.xh,{children:[(0,h.jsx)(c.fI,{children:(0,h.jsx)(c.VP,{widthPer:100,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("Model")+" "+e("设置")})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae('\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:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>{K([...L,{note:"",open:!1,path:"",dotenv:I.CP,json_params:I.cL}])}}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:async()=>{await ge()}})]}),children:(0,h.jsx)(d.X,{headers:n,rows:L.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.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,h.jsx)(p.l6,{value:t.open,onChange:e=>{((e,t,n)=>{const s=[];for(let e=0;e<L.length;e++)L[e].open=e===n&&t,s.push(L[e]);K(s)})(0,e,n)},options:me,no_border:!0}),(0,h.jsx)(p.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,h.jsx)(p.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,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"short_text",title:"prompt",onClick:()=>{j.xK.set_value_temp(L[n].sys_prompt??""),ce({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{L[n].sys_prompt=e,K(L),j.xK.set_value_temp(""),ge(L)}})}}),(0,h.jsx)(i.rA,{icon:"edit_attributes",title:"model请求参数json编写",onClick:()=>{j.xK.set_value_temp(L[n].json_params),ce({model:"ace/mode/json",open:!0,fileName:"",save:async e=>{L[n].json_params=e,K(L),j.xK.set_value_temp(""),ge(L)},can_format:!0})}}),(0,h.jsx)(i.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{j.xK.set_value_temp(L[n].dotenv),ce({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{L[n].dotenv=e,K(L),j.xK.set_value_temp(""),ge(L)}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{L.splice(e,1),K([...L])})(n)}),(0,h.jsx)(i.rA,{icon:"copy_all",title:e("复制"),onClick:()=>(e=>{K([...L,{...L[e],open:!1}])})(n)})]})];return s}),width:"10rem"})})})}),(0,h.jsx)(c.fI,{children:(0,h.jsx)(c.VP,{widthPer:70,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - stdio"]})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae("\n1. 这里配置的是 MCP Client 启动参数,当前实现的是 stdio 模式,也就是通过 command + args 启动本地 MCP Server\n2. 例如可以填 npx / uvx / python 等命令,再配合对应的 MCP server 包参数\n3. 保存后会自动重新加载 MCP 工具,agent 聊天时会把这些工具一起带给模型\n4. 建议把 cwd 配到具体项目目录,避免 server 在错误目录里运行\n")},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>he("stdio")}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>{ve()}})]}),children:(0,h.jsx)(d.X,{headers:Q,rows:Z.map((t,n)=>{const s=O.indexOf(t);return[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.name,handleInputChange:e=>{t.name=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{t.open=e,P([...O]),V.current=!0},options:me,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.command,handleInputChange:e=>{t.command=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.Sm,{value:t.args,handleInputChange:e=>{t.args=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.Sm,{value:t.cwd,handleInputChange:e=>{t.cwd=e,V.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"visibility",title:"查看工具",onClick:()=>{ye(t,s)}}),(0,h.jsx)(i.rA,{icon:"settings",title:"env",onClick:()=>{j.xK.set_value_temp(t.env??""),ce({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{t.env=e,P([...O]),j.xK.set_value_temp(""),V.current=!0,ve()}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e,V.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>_e(t)}),(0,h.jsx)(i.rA,{icon:"copy_all",title:e("复制"),onClick:()=>xe(t)})]})]}),width:"10rem"})})})}),(0,h.jsx)(c.fI,{children:(0,h.jsxs)(c.VP,{widthPer:70,children:[(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - HTTP"]})," "]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>he("http")}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>{ve()}})]}),children:(0,h.jsx)(d.X,{headers:ee,rows:U.map((t,n)=>{const s=O.indexOf(t);return[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.name,handleInputChange:e=>{t.name=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{t.open=e,P([...O]),V.current=!0},options:me,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.endpoint,handleInputChange:e=>{t.endpoint=e,V.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"visibility",title:"查看工具",onClick:()=>{ye(t,s)}}),(0,h.jsx)(i.rA,{icon:"settings",title:"headers",onClick:()=>{j.xK.set_value_temp(t.headers??""),ce({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{t.headers=e,P([...O]),j.xK.set_value_temp(""),V.current=!0,ve()}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e,V.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>_e(t)}),(0,h.jsx)(i.rA,{icon:"copy_all",title:e("复制"),onClick:()=>xe(t)})]})]}),width:"10rem"})}),(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("系统会话提示词")})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae('\n1. 系统会话提示词,在 AI 聊天页创建会话时可以选择,选中的提示词会自动填入聊天框作为第一条系统消息\n2. 适用于预先设定常用的会话场景模板,如"代码审查"、"翻译助手"、"运维诊断"等\n3. "LLM编辑开关":开启后,当用户选择了该系统提示词发起对话时,AI 将会获得一个"更新会话提示词"工具,允许 AI 在对话中对当前会话进行总结,并写入到本提示词的"LLM编辑提示词"字段(全局保存,供之后的新会话沿用),使 AI 能自我维护长期上下文。\n4. "LLM编辑提示词":可选。AI 编辑后写回的内容(可预填初始方向)。仅在"LLM编辑开关"开启时生效。\n5. "编辑规则":可选。给 LLM 的编辑要求,例如"总结时不要超过 300 token"、"用简洁的项目要点记录"等。仅在"LLM编辑开关"开启时生效。\n')},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>{se([...ne,{prompt:"",note:"",llm_prompt_enable:!1}])}}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>{be()}})]}),children:(0,h.jsx)(d.X,{headers:te,rows:ne.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)("div",{children:(0,h.jsx)(i.rA,{icon:"short_text",title:e("提示词"),onClick:()=>{j.xK.set_value_temp(t.prompt??""),ce({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.prompt=e,se([...ne]),j.xK.set_value_temp(""),be()}})}})}),(0,h.jsx)(i.Ay,{checked:!!t.llm_prompt_enable,onChange:e=>{t.llm_prompt_enable=e,se([...ne])},title:e("LLM编辑开关")}),(0,h.jsx)("div",{children:(0,h.jsx)(i.rA,{icon:"edit_note",title:e("LLM编辑提示词"),onClick:()=>{j.xK.set_value_temp(t.llm_prompt??""),ce({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt=e,se([...ne]),j.xK.set_value_temp(""),be()}})}})}),(0,h.jsx)("div",{children:(0,h.jsx)(i.rA,{icon:"rule",title:e("编辑规则"),onClick:()=>{j.xK.set_value_temp(t.llm_prompt_tip??""),ce({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt_tip=e,se([...ne]),j.xK.set_value_temp(""),be()}})}})}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsx)("div",{children:(0,h.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{ne.splice(e,1),se([...ne])})(n)})})];return s}),width:"10rem"})}),(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("长期记忆")})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae(e("开启后跨会话保存记忆。四个固定文件:周/月/年/永久。每周结束自动压缩周→月,每月结束自动压缩月→年,每年结束自动压缩年→永久。编辑按钮可手动查看和修改。"))},title:"信息"})]}),titleCom:(0,h.jsx)("div",{children:(0,h.jsx)(i.Ay,{checked:oe,onChange:async t=>{ie(t),await _.XO.post("ai_long_term_memory_setting/save",{open:t}),(0,g.SK)(e("长期记忆设置已保存"))},title:e("开关")})}),children:(0,h.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,h.jsx)(i.rA,{icon:"edit",title:`${e("编辑")} ${n} (${s})`,onClick:async()=>{const s=await _.XO.get(`ai_long_term_memory_bucket/${t}`),o=s.code===x.m.Success?s.data??"":"";j.xK.set_value_temp(o),ce({model:"ace/mode/text",open:!0,fileName:`long_term_memory_${t}.txt`,save:async s=>{await _.XO.post(`ai_long_term_memory_bucket/${t}/save`,{data:s}),j.xK.set_value_temp(""),(0,g.SK)(`${n} ${e("已保存")}`)}})}},t))})})]})}),(0,h.jsxs)(c.fI,{children:[(0,h.jsx)(c.VP,{widthPer:50,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("本地知识库")})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae("\n1. 本地知识库用于为AI增强理解能力,或者分析本地文件,原理读取本地的文件,对文件在内存中建立全文索引,为AI提供额外数据(需要有模型开启才能使用)\n2. 该功能只能用于小型知识库,作为本地小型或者公司内部资料使用还是没有问题的\n3. 每次保存都会重新加载知识库中的文件,不会全部重新加载,而是检测哪些文件有变更\n")},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.Ay,{checked:z,onChange:async e=>{await _.jV.post("docs_on_set",{status:e}),ue(),t()},title:e("知识库开关")}),(0,h.jsx)(i.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{j.xK.set_value_temp(F.current),ce({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{F.current=e,j.xK.set_value_temp(""),we(F.current)}})}}),(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>{M([...N,{note:"",auto_load:!1,dir:""}]),T.current=!0}}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>{we()}})]}),children:(0,h.jsx)(d.X,{headers:$,rows:N.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.dir,handleInputChange:e=>{t.dir=e,T.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.auto_load,onChange:e=>{t.auto_load=e,M([...N]),T.current=!0},options:me,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"delete",title:e("删除记录"),onClick:()=>(e=>{N.splice(e,1),M([...N]),T.current=!0})(n)}),(0,h.jsx)(i.rA,{icon:"restore",title:e("手动加载"),onClick:()=>{pe({sub_title:"手动加载",confirm_fun:()=>{_.jV.post("ai_load_one_file",{param_path:t.dir}),(0,g.SK)("ok")}})}}),(0,h.jsx)(i.rA,{icon:"delete_forever",title:e("从索引删除"),onClick:()=>{pe({sub_title:"从索引删除",confirm_fun:()=>{_.jV.post("ai_del",{param_path:t.dir}),(0,g.SK)("ok")}})}})]})];return s}),width:"10rem"})})}),X&&(0,h.jsx)(c.VP,{widthPer:50,children:(0,h.jsxs)(m.Zp,{title:e("知识库加载信息"),children:[(0,h.jsx)(c.Yh,{left:e("最近一次加载")+","+e("加载进度"),right:X?.progress}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件数量")}`,right:X?.num}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件字符数量")}`,right:X?.char_num}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件大小")}`,right:(0,C.v7)(X?.size)}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总耗时")}`,right:(0,C.a3)(X?.consume_time_ms_len)}),(0,h.jsx)(c.Yh,{left:`${e("总文件数量")}`,right:X?.total_num})]})})]})]})})})]})}},34299(e,t,n){n.r(t),n.d(t,{default:()=>_});n(96540);var s=n(22091),o=n(53995),i=n(18569),a=n(77979),l=n(8263),r=n(69428),c=n.n(r),d=(n(3775),n(21499)),p=n(99214),m=n(19878),u=(n(72411),n(74848));const h=new s.A({html:!0,highlight:function(e,t){if(t&&m.A.getLanguage(t))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${t}">${m.A.highlight(e,{language:t}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${m.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${h.utils.escapeHtml(e)}</code></pre>`}});function _(e){return(0,p.VD)(),(0,u.jsx)("div",{dangerouslySetInnerHTML:{__html:h.render(e.context)}})}h.use(o.A).use(i.A).use(a.A).use(l.A).use(c()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(t,n,s,o,i)=>{const a=t[n],l=a.content.trim(),r=a.info.trim();let c="";if(r&&m.A.getLanguage(r))try{c=m.A.highlight(l,{language:r}).value}catch(t){c=e.utils.escapeHtml(l)}else try{c=m.A.highlightAuto(l).value}catch(t){c=e.utils.escapeHtml(l)}return`\n <div class="code-block-with-copy">\n <div class="code-header">\n <span class="code-language">${r||"code"}</span>\n <button class="copy-btn" data-code="${e.utils.escapeHtml(l)}">复制</button>\n </div>\n <pre><code class="hljs ${r?`language-${r}`:""}">${c}</code></pre>\n </div>`}}).use(e=>{const t=e.renderer.rules.link_open||function(e,t,n,s,o){return o.renderToken(e,t,n)};e.renderer.rules.link_open=(e,n,s,o,i)=>{const a=e[n],l=a.attrIndex("href");if(l>=0){const e=a.attrs[l][1];a.attrs[l][1]=(0,d.bi)(window.location.href,e)}return t(e,n,s,o,i)}})},45907(e,t,n){n.d(t,{y:()=>i});var s=n(34843),o=n(82893);function i(){const[e,t]=(0,s.fp)(o.AG.confirm);return({sub_title:e,confirm_fun:n,title:s,context_div:o})=>{t({open:!0,sub_title:e,handle:()=>{n(),t({open:!1,handle:null})},title:s,context_div:o})}}},24659(e,t,n){var s=n(86149);n.d(t,["K",0,()=>{const{t:e}=(0,s.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])},60840(e){e.exports="data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 version=%271.1%27 aria-hidden=%27true%27><path fill-rule=%27evenodd%27 d=%27M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z%27></path></svg>"}}]);
|
|
File without changes
|