@customize-agent/server 4.0.17 → 4.0.19

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.
Files changed (58) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +98 -98
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/required-server-files.json +2 -2
  5. package/.next/server/chunks/1936.js +1 -1
  6. package/.next/server/middleware-build-manifest.js +1 -1
  7. package/.next/server/pages/404.html +1 -1
  8. package/.next/server/pages/500.html +1 -1
  9. package/.next/server/pages/api/prompt/chat.js +6 -3
  10. package/.next/server/pages/asset-library.html +1 -1
  11. package/.next/server/pages/context/long-term.html +1 -1
  12. package/.next/server/pages/context/short-term.html +1 -1
  13. package/.next/server/pages/document-roles.html +1 -1
  14. package/.next/server/pages/document-specs.html +1 -1
  15. package/.next/server/pages/documents.html +1 -1
  16. package/.next/server/pages/guide.html +1 -1
  17. package/.next/server/pages/index.html +1 -1
  18. package/.next/server/pages/knowledge/file-detail.html +1 -1
  19. package/.next/server/pages/knowledge/files.html +1 -1
  20. package/.next/server/pages/knowledge/manage.html +1 -1
  21. package/.next/server/pages/knowledge/search.html +1 -1
  22. package/.next/server/pages/knowledge.html +1 -1
  23. package/.next/server/pages/models.html +1 -1
  24. package/.next/server/pages/overview.html +1 -1
  25. package/.next/server/pages/prompt.html +1 -1
  26. package/.next/server/pages/settings.html +1 -1
  27. package/.next/server/pages/system/logs.html +1 -1
  28. package/.next/server/pages-manifest.json +29 -29
  29. package/.next/static/L8VozJMjOhfyjhAlVliVF/_buildManifest.js +1 -0
  30. package/.next/static/chunks/{131-96749f5b6e1460d1.js → 131-e2f0164f12b82496.js} +1 -1
  31. package/.next/static/chunks/{150-a7b953a600cbd7e0.js → 150-134099bf526e9292.js} +2 -2
  32. package/.next/static/chunks/{195-9f2e4c67a9deff05.js → 195-2c0168eacab722d2.js} +1 -1
  33. package/.next/static/chunks/{20-23d24b40b69faf0f.js → 20-00147a779147a5a4.js} +1 -1
  34. package/.next/static/chunks/{265-c3a46cef96364aac.js → 265-32ec272a49cfacef.js} +1 -1
  35. package/.next/static/chunks/{289-36c210992d5009d5.js → 289-6bf8af72114aefd5.js} +2 -2
  36. package/.next/static/chunks/{433-ef3d7675b81826a9.js → 433-233659be69169c19.js} +1 -1
  37. package/.next/static/chunks/{447-772df02993a8609b.js → 447-fa0c71b418e19135.js} +1 -1
  38. package/.next/static/chunks/{455-9e1e1c7e96845347.js → 455-e04e99d9e242de44.js} +2 -2
  39. package/.next/static/chunks/{506-b97aadd3e451b379.js → 506-93f730bc149d0dce.js} +1 -1
  40. package/.next/static/chunks/{512-e2813c7e9454d53c.js → 512-12bd409cebeca05b.js} +1 -1
  41. package/.next/static/chunks/525-5d947137d894f5fe.js +1 -0
  42. package/.next/static/chunks/{576-679ab6348b33b960.js → 576-6699fed6c88502fe.js} +1 -1
  43. package/.next/static/chunks/{698-625f34d5d0052e87.js → 698-5f16390243596219.js} +1 -1
  44. package/.next/static/chunks/{749-dcb0cd85d1455f34.js → 749-83476f9bcd014a5a.js} +1 -1
  45. package/.next/static/chunks/{787-196a2bed7b11745a.js → 787-c18af810af3433f6.js} +2 -2
  46. package/.next/static/chunks/{788-f74cda5d27cf4390.js → 788-7f7359a830e3f4fd.js} +1 -1
  47. package/.next/static/chunks/{932-823e1ae10dd43b8b.js → 932-2f195f4200ce9378.js} +1 -1
  48. package/.next/static/chunks/{938-0063785681203bb5.js → 938-45efd516bb130bd5.js} +1 -1
  49. package/.next/static/chunks/{985-da0b1f68e59d1e76.js → 985-4b4a3ed36ada16eb.js} +1 -1
  50. package/.next/static/chunks/pages/{_app-c3312d1cfa7c8b29.js → _app-8872f79a787469b6.js} +19 -19
  51. package/.next/static/chunks/pages/knowledge/{files-a1727a21113f99cd.js → files-bc2ad2b01cb1f568.js} +1 -1
  52. package/.next/static/chunks/pages/prompt-3be228b7b80373ca.js +1 -0
  53. package/{next.config.js → next.config.ts} +4 -3
  54. package/package.json +4 -4
  55. package/.next/static/chunks/36-205281971ae6919f.js +0 -1
  56. package/.next/static/chunks/pages/prompt-31107707a8e8d33c.js +0 -1
  57. package/.next/static/lsztDhTkEy3WwGjvuXb2a/_buildManifest.js +0 -1
  58. /package/.next/static/{lsztDhTkEy3WwGjvuXb2a → L8VozJMjOhfyjhAlVliVF}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28],{1611:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"database",theme:"outlined"}},10218:(e,t,l)=>{"use strict";l.d(t,{A:()=>g,H:()=>m});var r=l(97109),n=l(4932),a=l(82813);let i=e=>"object"==typeof e&&null!=e&&1===e.nodeType,s=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,o=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let l=getComputedStyle(e,null);return s(l.overflowY,t)||s(l.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},c=(e,t,l,r,n,a,i,s)=>a<e&&i>t||a>e&&i<t?0:a<=e&&s<=l||i>=t&&s>=l?a-e-r:i>t&&s<l||a<e&&s>l?i-t+n:0,u=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},d=(e,t)=>{var l,r,n,a;if("undefined"==typeof document)return[];let{scrollMode:s,block:d,inline:h,boundary:f,skipOverflowHiddenElements:m}=t,p="function"==typeof f?f:e=>e!==f;if(!i(e))throw TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,v=[],y=e;for(;i(y)&&p(y);){if((y=u(y))===g){v.push(y);break}null!=y&&y===document.body&&o(y)&&!o(document.documentElement)||null!=y&&o(y,m)&&v.push(y)}let x=null!=(r=null==(l=window.visualViewport)?void 0:l.width)?r:innerWidth,w=null!=(a=null==(n=window.visualViewport)?void 0:n.height)?a:innerHeight,{scrollX:j,scrollY:b}=window,{height:_,width:A,top:C,right:z,bottom:k,left:P}=e.getBoundingClientRect(),{top:S,right:M,bottom:N,left:I}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),H="start"===d||"nearest"===d?C-S:"end"===d?k+N:C+_/2-S+N,E="center"===h?P+A/2-I+M:"end"===h?z+M:P-I,F=[];for(let e=0;e<v.length;e++){let t=v[e],{height:l,width:r,top:n,right:a,bottom:i,left:u}=t.getBoundingClientRect();if("if-needed"===s&&C>=0&&P>=0&&k<=w&&z<=x&&(t===g&&!o(t)||C>=n&&k<=i&&P>=u&&z<=a))break;let f=getComputedStyle(t),m=parseInt(f.borderLeftWidth,10),p=parseInt(f.borderTopWidth,10),y=parseInt(f.borderRightWidth,10),S=parseInt(f.borderBottomWidth,10),M=0,N=0,I="offsetWidth"in t?t.offsetWidth-t.clientWidth-m-y:0,O="offsetHeight"in t?t.offsetHeight-t.clientHeight-p-S:0,V="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,T="offsetHeight"in t?0===t.offsetHeight?0:l/t.offsetHeight:0;if(g===t)M="start"===d?H:"end"===d?H-w:"nearest"===d?c(b,b+w,w,p,S,b+H,b+H+_,_):H-w/2,N="start"===h?E:"center"===h?E-x/2:"end"===h?E-x:c(j,j+x,x,m,y,j+E,j+E+A,A),M=Math.max(0,M+b),N=Math.max(0,N+j);else{M="start"===d?H-n-p:"end"===d?H-i+S+O:"nearest"===d?c(n,i,l,p,S+O,H,H+_,_):H-(n+l/2)+O/2,N="start"===h?E-u-m:"center"===h?E-(u+r/2)+I/2:"end"===h?E-a+y+I:c(u,a,r,m,y+I,E,E+A,A);let{scrollLeft:e,scrollTop:s}=t;M=0===T?0:Math.max(0,Math.min(s+M/T,t.scrollHeight-l/T+O)),N=0===V?0:Math.max(0,Math.min(e+N/V,t.scrollWidth-r/V+I)),H+=s-M,E+=e-N}F.push({el:t,top:M,left:N})}return F};var h=l(26047),f=l(44624);function m(e){return(0,f.$r)(e).join("_")}function p(e,t){let l=t.getFieldInstance(e),r=(0,a.rb)(l);if(r)return r;let n=(0,f.kV)((0,f.$r)(e),t.__INTERNAL__.name);if(n)return document.getElementById(n)}function g(e){let[t]=(0,n.mN)(),l=r.useRef({}),a=r.useMemo(()=>e??{...t,__INTERNAL__:{itemRef:e=>t=>{let r=m(e);t?l.current[r]=t:delete l.current[r]}},scrollToField:(e,t={})=>{let{focus:l,...r}=t,n=p(e,a);n&&(!function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let l=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(d(e,t));let r="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:n,top:a,left:i}of d(e,!1===t?{block:"end",inline:"nearest"}:t===Object(t)&&0!==Object.keys(t).length?t:{block:"start",inline:"nearest"})){let e=a-l.top+l.bottom,t=i-l.left+l.right;n.scroll({top:e,left:t,behavior:r})}}(n,{scrollMode:"if-needed",block:"nearest",...r}),l&&a.focusField(e))},focusField:e=>{let t=a.getFieldInstance(e);(0,h.Tn)(t?.focus)?t.focus():p(e,a)?.focus?.()},getFieldInstance:e=>{let t=m(e);return l.current[t]}},[e,t]);return[a]}},12887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},13067:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0010.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 00-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"}}]},name:"file-excel",theme:"outlined"}},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},23793:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"}},25258:(e,t,l)=>{"use strict";l.d(t,{A:()=>w});var r=l(51541),n=l(61848),a=l(5669),i=l(97109),s=l(72658),o=l(3638),c=l(92162),u=l(82725),d=l(74567),h=l(632),f=l(49517),m=l(79412),p=l(19527);let g=(0,u.U)(e=>{let{prefixCls:t,className:l,closeIcon:r,closable:n,type:a,title:u,children:g,footer:v,classNames:y,styles:x,...w}=e,{getPrefixCls:j}=i.useContext(d.QO),{className:b,style:_,classNames:A,styles:C}=(0,d.TP)("modal"),z=j(),k=t||j("modal"),P=(0,h.A)(z),[S,M]=(0,p.Ay)(k,P),[N,I]=(0,c.AV)([A,y],[C,x],{props:e}),H=`${k}-confirm`,E={};return E=a?{closable:n??!1,title:"",footer:"",children:i.createElement(f.k,{...e,prefixCls:k,confirmPrefixCls:H,rootPrefixCls:z,content:g})}:{closable:n??!0,title:u,footer:null!==v&&i.createElement(m.w,{...e}),children:g},i.createElement(s.Z,{prefixCls:k,className:(0,o.$)(S,`${k}-pure-panel`,a&&H,a&&`${H}-${a}`,l,b,M,P,N.root),style:{..._,...I.root},...w,closeIcon:(0,m.O)(k,r),closable:n,classNames:N,styles:I,...E})});var v=l(99739);function y(e){return(0,r.Ay)((0,r.fp)(e))}let x=a.A;x.useModal=v.A,x.info=function(e){return(0,r.Ay)((0,r.$D)(e))},x.success=function(e){return(0,r.Ay)((0,r.Ej)(e))},x.error=function(e){return(0,r.Ay)((0,r.jT)(e))},x.warning=y,x.warn=y,x.confirm=function(e){return(0,r.Ay)((0,r.lr)(e))},x.destroyAll=function(){for(;n.A.length;){let e=n.A.pop();e&&e()}},x.config=r.FB,x._InternalPanelDoNotUseOrYouWillBeFired=g;let w=x},26619:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var r=l(97109),n=l(1611),a=l(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let s=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:n.A})))},26631:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var r=l(97109),n=l(12887),a=l(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let s=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:n.A})))},30289:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"}},44624:(e,t,l)=>{"use strict";l.d(t,{$r:()=>n,BS:()=>i,kV:()=>a});let r=["parentNode"];function n(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function a(e,t){if(!e.length)return;let l=e.join("_");return t?`${t}_${l}`:r.includes(l)?`form_item_${l}`:l}function i(e,t,l,r,n,a){let i=r;return void 0!==a?i=a:l.validating?i="validating":e.length?i="error":t.length?i="warning":(l.touched||n&&l.validated)&&(i="success"),i}},45551:(e,t,l)=>{"use strict";function r(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),l=e/Math.pow(1024,t);return"".concat(l.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let l=Math.floor(Math.floor((Date.now()-e)/1e3)/60),r=Math.floor(l/60),n=Math.floor(r/24);return n>30?new Date(e).toLocaleDateString(t):"en-US"===t?n>0?"".concat(n,"d ago"):r>0?"".concat(r,"h ago"):l>0?"".concat(l,"m ago"):"Just now":n>0?"".concat(n," 天前"):r>0?"".concat(r," 小时前"):l>0?"".concat(l," 分钟前"):"刚刚"}l.d(t,{Jm:()=>s,fw:()=>n,z3:()=>r});let a={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},i={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===l?i:a)[e])?t:e}},48893:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M553.1 509.1l-77.8 99.2-41.1-52.4a8 8 0 00-12.6 0l-99.8 127.2a7.98 7.98 0 006.3 12.9H696c6.7 0 10.4-7.7 6.3-12.9l-136.5-174a8.1 8.1 0 00-12.7 0zM360 442a40 40 0 1080 0 40 40 0 10-80 0zm494.6-153.4L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file-image",theme:"outlined"}},53234:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM496 208H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 544h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm328 244a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"hdd",theme:"outlined"}},58209:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var r=l(97109),n=l(23793),a=l(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let s=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:n.A})))},58520:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 00-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 00-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z"}}]},name:"file-word",theme:"outlined"}},61825:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var r=l(97109),n=l(30289),a=l(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let s=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:n.A})))},82738:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>ee});var r=l(65321),n=l(97109),a=l(79059),i=l(43220),s=l.n(i),o=l(86109),c=l(17807),u=l(25258),d=l(11702),h=l(33442),f=l(14932),m=l(85114),p=l(7576),g=l(57271),v=l(68787),y=l(99605),x=l(21289),w=l(56768),j=l(48893),b=l(88483);function _(){return(_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let A=n.forwardRef((e,t)=>n.createElement(b.A,_({},e,{ref:t,icon:j.A})));var C=l(13067);function z(){return(z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let k=n.forwardRef((e,t)=>n.createElement(b.A,z({},e,{ref:t,icon:C.A})));var P=l(58520);function S(){return(S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let M=n.forwardRef((e,t)=>n.createElement(b.A,S({},e,{ref:t,icon:P.A})));var N=l(90939);function I(){return(I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let H=n.forwardRef((e,t)=>n.createElement(b.A,I({},e,{ref:t,icon:N.A})));var E=l(93314),F=l(61825),O=l(26619),V=l(29606),T=l(26631),B=l(64254),L=l(64629),R=l(58209),D=l(30486),W=l(92803);function $(){return($=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let U=n.forwardRef((e,t)=>n.createElement(b.A,$({},e,{ref:t,icon:W.A})));var J=l(84742),Q=l(38762),X=l(6578),q=l(45551),G=l(14569),K=l.n(G);let Y=["document","spreadsheet","image","cad","code","data","web","diagram","other"],Z=/\.(zip|jar|war|apk|tar|gz|tgz|bz2|rar|7z)$/iu;function ee(){let e=(0,a.Vr)("knowledge"),{locale:t}=(0,a.x_)(),{message:l}=c.A.useApp(),i=(0,o.useRouter)(),j="string"==typeof i.query.category?i.query.category:"",[b,_]=(0,n.useState)([]),[C,z]=(0,n.useState)(!1),[P,S]=(0,n.useState)(""),[N,I]=(0,n.useState)(""),[W,$]=(0,n.useState)(j),[G,ee]=(0,n.useState)(!1),[et,el]=(0,n.useState)(!1),[er,en]=(0,n.useState)([]),[ea,ei]=(0,n.useState)([]),[es,eo]=(0,n.useState)(new Set),[ec,eu]=(0,n.useState)("all"),[ed,eh]=(0,n.useState)("user"),[ef,em]=(0,n.useState)(!0),[ep,eg]=(0,n.useState)([]),[ev,ey]=(0,n.useState)(new Set),ex=(0,n.useRef)(W);(0,n.useEffect)(()=>{ex.current=W},[W]),(0,n.useEffect)(()=>{$("string"==typeof i.query.category?i.query.category:"")},[i.query.category]);let ew=(0,n.useCallback)(async(e,t)=>{let l=null!=e?e:ex.current;(null==t?void 0:t.silent)||(z(!0),S(""));try{let e=await (0,X.HT)({category:l||void 0,limit:200});_(e.files||[]),e.initializing&&window.setTimeout(()=>{ew(l,{silent:!0})},3e3)}catch(e){(null==t?void 0:t.silent)||(_([]),S(e instanceof Error?e.message:"文件列表加载失败"))}finally{(null==t?void 0:t.silent)||z(!1)}},[]);(0,n.useEffect)(()=>{ew(W)},[W,ew]);let ej=e=>({id:e.id,type:e.type,title:e.title,description:e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,textLength:e.textLength,extractionMode:e.extractionMode,error:e.error,createdAt:e.createdAt}),eb=(0,n.useCallback)(async()=>{try{let e=(await (0,X.Qx)()).operations.map(ej);en(t=>{let l=new Set(e.map(e=>e.id).filter(Boolean)),r=e.map(e=>{var l;let r=t.find(t=>t.id===e.id);return r?{...r,...e,createdAt:null!=(l=r.createdAt)?l:e.createdAt}:e}),n=t.filter(e=>e.id&&!l.has(e.id)&&"processing"===e.status);return[...r,...n].slice(0,50)})}catch(e){}},[]),e_=(0,n.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];en(l=>{let r=l.findIndex(l=>e.id&&l.id===e.id||t.includes(l.title));if(r>=0){var n;let t=[...l];return t[r]={...l[r],...e,createdAt:null!=(n=l[r].createdAt)?n:e.createdAt},t}return[e,...l].slice(0,50)})},[]);(0,n.useEffect)(()=>{eb()},[eb]);let eA=async()=>{try{await (0,X.H7)(),en([]),l.success("任务状态已清空")}catch(e){l.error("清空任务状态失败")}},eC=async(e,t)=>{if(t.stopPropagation(),e.id)try{await (0,X.CU)(e.id)}catch(e){}en(t=>t.filter(t=>t!==e))},ez=(0,n.useMemo)(()=>{let e=0,t=0,l=0;for(let r of er)"processing"===r.status?e++:"success"===r.status?t++:("error"===r.status||"warning"===r.status)&&l++;return{processing:e,success:t,error:l}},[er]);(0,n.useEffect)(()=>{ez.processing>0&&em(!1)},[ez.processing]),(0,n.useEffect)(()=>{if(0===ez.processing)return;let e=window.setInterval(()=>{eb()},2e3),t=window.setInterval(()=>{ew(void 0,{silent:!0})},8e3);return()=>{window.clearInterval(e),window.clearInterval(t)}},[ew,eb,ez.processing]);let ek="all"===ec?er:er.filter(e=>"processing"===ec?"processing"===e.status:"success"===ec?"success"===e.status:"error"!==ec||"error"===e.status||"warning"===e.status),eP=async e=>{let t=e.filter(e=>!Z.test(e.name)),r=e.length-t.length;if(r>0&&l.warning("已跳过 ".concat(r," 个压缩包,请解压后上传内部文件")),0===t.length)return;let n=1===t.length?t[0].name:"".concat(t.length," 个文件");ee(!0);let a="".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2));e_({id:a,type:"upload",title:"上传 ".concat(n),description:"等待上传、解析、切片和入库",status:"processing",percent:5});try{await (0,X.c1)(t,void 0,a,e=>{e_({id:a,type:"upload",title:"上传 ".concat(n),description:"正在上传文件:".concat(e.uploadedFiles,"/").concat(e.totalFiles,",批次 ").concat(e.batchIndex+1,"/").concat(e.totalBatches),status:"processing",percent:Math.min(5,Math.max(1,Math.round(e.uploadedFiles/Math.max(1,e.totalFiles)*5)))})}),l.info("文件已上传,正在后台解析、切片和入库,可在顶部“后台任务”查看进度"),I(""),$(""),ei([]),ex.current="",await eb(),window.setTimeout(()=>{ew(void 0,{silent:!0})},2e3)}catch(t){let e=t instanceof Error?t.message:"请重试或检查文件格式";l.error(e||"上传失败"),e_({id:a,type:"error",title:"上传失败 ".concat(n),description:e,status:"error",percent:100})}finally{ee(!1)}},eS=async()=>{el(!0);let e="reindex-ui-".concat(Date.now());e_({id:e,type:"reindex",title:"重新解析入库",description:"正在提交后台任务",status:"processing",percent:5});try{var t;let r=await (0,X.H1)(),n=r.operationId||e,a=r.job;l.info(r.alreadyRunning?"已有重新解析任务正在后台执行":"已提交重新解析入库任务,可在顶部“后台任务”查看进度"),e_({id:n,type:"reindex",title:(null==a?void 0:a.title)||"重新解析入库",description:(null==a?void 0:a.message)||"后台将重新扫描文件、解析、切片并重建索引",status:(null==a?void 0:a.status)||"processing",percent:null!=(t=null==a?void 0:a.percent)?t:10,error:null==a?void 0:a.error},["重新解析入库"]);for(let e=0;e<360;e++){let e=await (0,X.ax)(n).then(e=>e.job).catch(async()=>(await (0,X.Qx)()).operations.find(e=>e.id===n));if(e){let t="success"===e.status||"error"===e.status;if(e_({id:n,type:"error"===e.status?"error":"reindex",title:"success"===e.status?"重新解析入库完成":"error"===e.status?"重新解析入库失败":e.title,description:e.error||e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,error:e.error}),t){"success"===e.status?l.success(e.message||"重新解析入库完成"):l.error(e.error||e.message||"重新解析入库失败");break}}await new Promise(e=>setTimeout(e,1e3))}await ew(),await eb()}catch(r){let t=r instanceof Error?r.message:"重新解析入库失败";l.error(t),e_({id:e,type:"error",title:"重新解析入库失败",description:t,status:"error",percent:100},["重新解析入库","重新解析入库完成","重新解析入库失败"])}finally{el(!1)}},eM=async e=>{if(e.builtIn)return void l.info("内置示例资料不可重新解析");let t="file-reindex-ui-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2));ey(t=>new Set(t).add(e.relativePath)),e_({id:t,type:"reindex",title:"重新解析 ".concat(e.relativePath),description:"正在提交单文件后台任务",status:"processing",percent:5,filePath:e.relativePath});try{var r;let n=await (0,X.HC)(e.relativePath),a=n.operationId||t,i=n.job;l.info(n.alreadyRunning?"已有知识库任务正在后台执行":"已提交单文件重新解析任务"),e_({id:a,type:"reindex",title:(null==i?void 0:i.title)||"重新解析 ".concat(e.relativePath),description:(null==i?void 0:i.message)||"后台将重新解析、分块并入库该文件",status:(null==i?void 0:i.status)||"processing",percent:null!=(r=null==i?void 0:i.percent)?r:10,filePath:(null==i?void 0:i.filePath)||e.relativePath,chunkCount:null==i?void 0:i.chunkCount,error:null==i?void 0:i.error},["重新解析 ".concat(e.relativePath)]);for(let t=0;t<240;t++){let t=await (0,X.ax)(a).then(e=>e.job).catch(async()=>(await (0,X.Qx)()).operations.find(e=>e.id===a));if(t){let r="success"===t.status||"error"===t.status;if(e_({id:a,type:"error"===t.status?"error":"reindex",title:"success"===t.status?"重新解析完成 ".concat(e.relativePath):"error"===t.status?"重新解析失败 ".concat(e.relativePath):t.title,description:t.error||t.message,status:t.status,percent:t.percent,filePath:t.filePath||e.relativePath,chunkCount:t.chunkCount,error:t.error}),await ew(),r){"success"===t.status?l.success(t.message||"单文件重新解析完成"):l.error(t.error||t.message||"单文件重新解析失败");break}}await new Promise(e=>setTimeout(e,1e3))}await ew(),await eb()}catch(n){let r=n instanceof Error?n.message:"单文件重新解析失败";l.error(r),e_({id:t,type:"error",title:"重新解析失败 ".concat(e.relativePath),description:r,status:"error",percent:100,filePath:e.relativePath},["重新解析 ".concat(e.relativePath)])}finally{ey(t=>{let l=new Set(t);return l.delete(e.relativePath),l})}},eN=t=>{let r="selected"===t?e$:"filtered"===t?eH.filter(e=>!e.builtIn).map(e=>e.relativePath):[],n=b.filter(e=>!e.builtIn).length;if("all"!==t&&0===r.length||"all"===t&&0===n)return void l.info("没有可删除的用户文件");let a="all"===t?"删除全部用户文件 ".concat(n," 个?"):"filtered"===t?"删除当前筛选结果中的用户文件 ".concat(r.length," 个?"):"删除已选用户文件 ".concat(r.length," 个?");u.A.confirm({title:a,content:"将同时删除文件、切片、索引和向量记录。此操作不可撤销。",okText:e("common.delete"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{en(e=>[{type:"delete",title:a,description:"正在批量删除文件和索引",status:"processing",percent:10},...e].slice(0,50));try{var e;let a=null!=(e=("all"===t?await (0,X.X8)():"selected"===t?await (0,X.tZ)(eW,eD):await (0,X.SJ)(r)).deleted)?e:"all"===t?n:r.length;l.success("已删除 ".concat(a," 个文件")),ei([]),en(e=>[{type:"delete",title:"批量删除完成",description:"已删除 ".concat(a," 个文件、切片和索引"),status:"success"},...e].slice(0,50)),await ew(),await eb()}catch(e){l.error("批量删除失败"),en(e=>[{type:"error",title:"批量删除失败",description:"请重试",status:"error"},...e].slice(0,50))}}})},eI=(0,n.useMemo)(()=>"all"===ed?b:b.filter(e=>"builtIn"===ed?e.builtIn:!e.builtIn),[b,ed]),eH=(0,n.useMemo)(()=>N?eI.filter(e=>e.relativePath.toLowerCase().includes(N.toLowerCase())):eI,[N,eI]),eE=(0,n.useMemo)(()=>b.filter(e=>!e.builtIn),[b]),eF=(0,n.useMemo)(()=>b.filter(e=>e.builtIn),[b]),eO=(0,n.useMemo)(()=>eH.filter(e=>!e.builtIn),[eH]),eV=(0,n.useMemo)(()=>eH.filter(e=>e.builtIn),[eH]),eT=(0,n.useMemo)(()=>new Set(eH.map(e=>e.relativePath)),[eH]),eB=(0,n.useMemo)(()=>{let e={};for(let l of[...eH].sort((e,t)=>e.relativePath.localeCompare(t.relativePath))){let r=l.relativePath.split("/"),n="";for(let a=0;a<r.length;a++){let i=r[a],s=n;n=n?"".concat(n,"/").concat(i):i;let o=a===r.length-1;if(e[n])o||e[n].isFolder?o&&(e[n].isFolder=!1,e[n].file=l,e[n].fileCount=1,e[n].userFileCount=+!l.builtIn,e[n].totalSize=l.fileSize,e[n].totalChunks=l.chunkCount):(e[n].isFolder=!0,e[n].children=[],e[n].fileCount=0,e[n].userFileCount=0,e[n].totalSize=0,e[n].totalChunks=0);else{var t;e[n]={key:n,name:i,isFolder:!o,...o?{file:l,fileCount:1,userFileCount:+!l.builtIn,totalSize:l.fileSize,totalChunks:l.chunkCount}:{children:[],fileCount:0,userFileCount:0,totalSize:0,totalChunks:0}},s&&(null==(t=e[s])?void 0:t.children)&&e[s].children.push(e[n])}}}let l=e=>{for(let i of e)if(i.children){l(i.children);let e=0,s=0,o=0,c=0;for(let l of i.children){var t,r,n,a;e+=null!=(t=l.fileCount)?t:0,s+=null!=(r=l.userFileCount)?r:0,o+=null!=(n=l.totalSize)?n:0,c+=null!=(a=l.totalChunks)?a:0}i.fileCount=e,i.userFileCount=s,i.totalSize=o,i.totalChunks=c}},r=e=>e.map(e=>e.children?{...e,children:r(e.children)}:e).filter(e=>{var t,l,r;return!e.isFolder||(null!=(l=e.fileCount)?l:0)>0&&(null!=(r=null==(t=e.children)?void 0:t.length)?r:0)>0}),n=Object.values(e).filter(e=>!e.key.includes("/"));return l(n),r(n)},[eH]),eL=(0,n.useMemo)(()=>{let e=[],t=l=>{for(let r of l)e.push(r.key),r.children&&t(r.children)};return t(eB),e},[eB]),eR=(0,n.useMemo)(()=>new Set([...eT,...eL]),[eL,eT]),eD=(0,n.useMemo)(()=>ea.map(String).filter(e=>!eT.has(e)&&eL.includes(e)),[eL,ea,eT]),eW=(0,n.useMemo)(()=>ea.map(String).filter(e=>eT.has(e)),[ea,eT]),e$=(0,n.useMemo)(()=>{let e=new Set;for(let t of eW){let l=b.find(e=>e.relativePath===t);l&&!l.builtIn&&e.add(l.relativePath)}for(let t of eD){let l="".concat(t,"/");for(let t of b)!t.builtIn&&t.relativePath.startsWith(l)&&e.add(t.relativePath)}return Array.from(e)},[b,eW,eD]),eU=e$.length;(0,n.useEffect)(()=>{ei(e=>e.filter(e=>eR.has(String(e))))},[eR]);let eJ=(0,n.useMemo)(()=>N?eL:eB.map(e=>e.key),[N,eL,eB]);(0,n.useEffect)(()=>{eg(eJ)},[eJ]);let eQ=(e,t)=>{eg(l=>e?[...l,t.key]:l.filter(e=>e!==t.key))},eX=[{title:e("fileName"),dataIndex:"name",key:"name",render:(e,t)=>{var l;return(0,r.jsxs)("span",{className:K().fileNameCell,children:[t.isFolder?(0,r.jsx)("span",{style:{cursor:"pointer"},onClick:e=>{e.stopPropagation(),eQ(!ep.includes(t.key),t)},children:(e=>{let t=e.children;return t&&0!==t.length?(0,r.jsx)(B.A,{style:{color:"#fa8c16",fontSize:15}}):(0,r.jsx)(V.A,{style:{color:"#fa8c16",fontSize:15}})})(t)}):(e=>{if(!e)return(0,r.jsx)(w.A,{style:{fontSize:15}});let t=e.category;return"image"===t?(0,r.jsx)(A,{style:{color:"#eb2f96",fontSize:15}}):"spreadsheet"===t?(0,r.jsx)(k,{style:{color:"#52c41a",fontSize:15}}):"document"===t?(0,r.jsx)(M,{style:{color:"#1677ff",fontSize:15}}):"code"===t?(0,r.jsx)(H,{style:{color:"#fa8c16",fontSize:15}}):"archive"===t?(0,r.jsx)(E.A,{style:{color:"#8c8c8c",fontSize:15}}):"web"===t?(0,r.jsx)(F.A,{style:{color:"#13c2c2",fontSize:15}}):"data"===t?(0,r.jsx)(O.A,{style:{color:"#722ed1",fontSize:15}}):"cad"===t?(0,r.jsx)(V.A,{style:{color:"#fa541c",fontSize:15}}):"diagram"===t?(0,r.jsx)(A,{style:{color:"#a0d911",fontSize:15}}):(0,r.jsx)(T.A,{style:{fontSize:15}})})(t.file),t.isFolder?(0,r.jsx)("span",{className:K().folderName,onClick:e=>{e.stopPropagation(),eQ(!ep.includes(t.key),t)},children:t.name}):(0,r.jsxs)(r.Fragment,{children:[(null==(l=t.file)?void 0:l.builtIn)&&(0,r.jsx)(d.A,{color:"gold",style:{fontSize:11,lineHeight:"18px"},children:"内置"}),(0,r.jsx)(s(),{className:"truncate max-w-[380px] inline-block",href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(t.key)),children:t.name})]})]})}},{title:e("fileCategory"),dataIndex:"category",key:"cat",width:110,render:(e,l)=>{var n,a;return l.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,r.jsx)(d.A,{children:(0,q.Jm)(null!=(a=null==(n=l.file)?void 0:n.category)?a:"",t)})}},{title:e("fileSize"),dataIndex:"fileSize",key:"size",width:90,render:(e,t)=>{var l,r,n;return(0,q.z3)(t.isFolder?null!=(r=t.totalSize)?r:0:null!=(n=null==(l=t.file)?void 0:l.fileSize)?n:0)}},{title:"切片",dataIndex:"chunkCount",key:"chunks",width:80,render:(e,t)=>{var l,n,a;let i=t.isFolder?null!=(n=t.totalChunks)?n:0:null!=(a=null==(l=t.file)?void 0:l.chunkCount)?a:0;return(0,r.jsx)(d.A,{color:i>1?"green":"orange",children:i})}},{title:"解析状态",dataIndex:"status",key:"status",width:100,render:(e,t)=>{var l,n,a,i;return t.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,r.jsx)(d.A,{color:"active"===(i=null==(l=t.file)?void 0:l.status)?"green":"processing"===i||"indexing"===i?"blue":"error"===i?"red":"orange",children:(null==(n=t.file)?void 0:n.errorMessage)||(null==(a=t.file)?void 0:a.status)||"—"})}},{title:e("fileDate"),dataIndex:"mtime",key:"date",width:130,render:(e,l)=>{var n;return l.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(null==(n=l.file)?void 0:n.mtime)?new Date(l.file.mtime).toLocaleDateString(t):"—"}},{title:"来源",key:"source",width:100,render:(e,t)=>{var l;return t.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(null==(l=t.file)?void 0:l.builtIn)?(0,r.jsx)(d.A,{color:"gold",children:"内置示例"}):(0,r.jsx)(d.A,{color:"cyan",children:"我的文件"})}},{title:"",key:"act",width:100,render:(t,n)=>{var a,i;return n.isFolder?null:(0,r.jsxs)(h.A,{size:4,children:[(0,r.jsx)(f.A,{title:"重新解析、分块并入库",children:(0,r.jsx)(m.Ay,{type:"text",size:"small",disabled:null==(a=n.file)?void 0:a.builtIn,loading:!!(n.file&&ev.has(n.file.relativePath)),icon:(0,r.jsx)(L.A,{}),onClick:()=>{eM(n.file)}})}),(0,r.jsx)(m.Ay,{type:"text",danger:!0,size:"small",disabled:null==(i=n.file)?void 0:i.builtIn,icon:(0,r.jsx)(R.A,{}),onClick:()=>(t=>{if(t.builtIn)return void l.info("内置示例资料不可删除");u.A.confirm({title:e("delete"),content:e("deleteConfirm"),okText:e("common.confirm"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{en(e=>[{type:"delete",title:"删除 ".concat(t.relativePath),description:"正在删除文件记录",status:"processing"},...e].slice(0,50));try{await (0,X.xq)(t.relativePath),l.success("已删除"),en(e=>[{type:"delete",title:"删除完成 ".concat(t.relativePath),description:"文件和索引记录已移除",status:"success"},...e].slice(0,50)),ei(e=>e.filter(e=>e!==t.relativePath)),await ew(),await eb()}catch(e){l.error("删除失败"),en(e=>[{type:"error",title:"删除失败 ".concat(t.relativePath),description:"请重试",status:"error"},...e].slice(0,50))}}})})(n.file)})]})}}];return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsx)("h2",{className:"pageTitle",children:e("files")}),(0,r.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,r.jsx)(p.A,{placeholder:e("searchPlaceholder"),prefix:(0,r.jsx)(D.A,{}),value:N,onChange:e=>{I(e.target.value)},allowClear:!0,className:K().filterInput}),(0,r.jsx)(g.A,{value:W||void 0,onChange:e=>{$(e||"")},placeholder:e("filterCategory"),allowClear:!0,className:K().filterSelect,options:[{label:e("allCategories"),value:""},...Y.map(e=>({label:(0,q.Jm)(e,t),value:e}))]}),(0,r.jsx)(g.A,{value:ed,onChange:eh,className:K().filterSelect,options:[{label:"全部来源 (".concat(b.length,")"),value:"all"},{label:"我的文件 (".concat(eE.length,")"),value:"user"},{label:"内置示例 (".concat(eF.length,")"),value:"builtIn"}]}),(0,r.jsx)(m.Ay,{type:"primary",icon:(0,r.jsx)(U,{}),loading:G,onClick:()=>{var e;return null==(e=document.getElementById("kb-file-upload-input"))?void 0:e.click()},children:G?e("uploading"):e("upload")}),(0,r.jsx)(m.Ay,{icon:(0,r.jsx)(U,{}),loading:G,onClick:()=>{var e;return null==(e=document.getElementById("kb-folder-upload-input"))?void 0:e.click()},children:"上传文件夹"}),(0,r.jsx)(m.Ay,{icon:(0,r.jsx)(L.A,{}),loading:et,onClick:()=>{eS()},children:"重新解析入库"}),(0,r.jsx)("input",{id:"kb-file-upload-input",type:"file",multiple:!0,hidden:!0,accept:".pdf,.doc,.docx,.txt,.md,.csv,.tsv,.xls,.xlsx,.png,.jpg,.jpeg,.webp,.svg,.dwg,.dxf,.step,.stp,.iges,.igs,.js,.ts,.tsx,.jsx,.py,.go,.java,.cs,.cpp,.c,.h,.json,.jsonl,.yaml,.yml,.xml,.html,.htm,.drawio,.dio,.vsdx,.vdx,.puml,.plantuml,.mmd,.mermaid,.excalidraw",onChange:e=>{var t;let l=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",eP(l)}}),(0,r.jsx)("input",{id:"kb-folder-upload-input",type:"file",multiple:!0,hidden:!0,webkitdirectory:"",onChange:e=>{var t;let l=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",eP(l)}})]}),(0,r.jsxs)(v.A,{size:"small",className:K().statusCard,styles:{body:{padding:0}},children:[(0,r.jsxs)("div",{className:K().statusSummary,onClick:()=>em(!ef),children:[(0,r.jsx)("span",{className:K().statusSummaryText,children:0===er.length?"暂无文件任务":(0,r.jsxs)(h.A,{size:6,children:[ez.processing>0&&(0,r.jsxs)(d.A,{color:"processing",style:{margin:0},icon:(0,r.jsx)(L.A,{spin:!0}),children:["处理中 ",ez.processing]}),(0,r.jsxs)(d.A,{color:"success",style:{margin:0},icon:(0,r.jsx)(J.A,{}),children:["已完成 ",ez.success]}),(0,r.jsxs)(d.A,{color:"error",style:{margin:0},icon:(0,r.jsx)(Q.A,{}),children:["失败 ",ez.error]})]})}),er.length>0&&(0,r.jsxs)(h.A,{size:6,children:[(0,r.jsx)(m.Ay,{size:"small",className:K().statusClearBtn,onClick:e=>{e.stopPropagation(),eA()},children:"清空"}),(0,r.jsx)(m.Ay,{size:"small",className:K().statusExpandBtn,onClick:e=>{e.stopPropagation(),em(!ef)},children:ef?"展开":"收起"})]})]}),!ef&&er.length>0&&(0,r.jsxs)("div",{className:K().statusPanel,children:[(0,r.jsxs)("div",{className:K().statusFilters,children:[(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("all"===ec?K().filterPillActive:""),style:"all"===ec?{color:"#1677ff"}:void 0,onClick:()=>eu("all"),children:["全部 ",(0,r.jsx)("b",{children:er.length})]}),(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("processing"===ec?K().filterPillActive:""),style:"processing"===ec?{color:"#1677ff"}:void 0,onClick:()=>eu("processing"),children:[(0,r.jsx)(L.A,{spin:ez.processing>0})," 处理中 ",(0,r.jsx)("b",{children:ez.processing})]}),(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("success"===ec?K().filterPillActive:""),style:"success"===ec?{color:"#52c41a"}:void 0,onClick:()=>eu("success"),children:[(0,r.jsx)(J.A,{})," 已完成 ",(0,r.jsx)("b",{children:ez.success})]}),(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("error"===ec?K().filterPillActive:""),style:"error"===ec?{color:"#ff4d4f"}:void 0,onClick:()=>eu("error"),children:[(0,r.jsx)(Q.A,{})," 失败 ",(0,r.jsx)("b",{children:ez.error})]})]}),(0,r.jsx)("div",{className:K().timelineList,children:0===ek.length?(0,r.jsx)("div",{className:K().statusEmpty,children:"没有匹配的任务"}):ek.map((e,l)=>{var n;let a=e.id||"".concat(e.type,"-").concat(null!=(n=e.createdAt)?n:e.title,"-").concat(l),i=es.has(a);return(0,r.jsxs)("div",{className:K().timelineItem,children:[(0,r.jsxs)("div",{className:K().timelineRow,onClick:()=>{eo(e=>{let t=new Set(e);return t.has(a)?t.delete(a):t.add(a),t})},children:[(0,r.jsx)("span",{className:K().timelineStatusIcon,children:"success"===e.status?(0,r.jsx)(J.A,{style:{color:"#52c41a"}}):"processing"===e.status?(0,r.jsx)(L.A,{spin:!0,style:{color:"#1677ff"}}):"error"===e.status?(0,r.jsx)(Q.A,{style:{color:"#ff4d4f"}}):(0,r.jsx)("span",{style:{color:"#fa8c16",fontWeight:700},children:"!"})}),(0,r.jsx)("span",{className:K().timelineTitle,children:e.title}),"number"==typeof e.percent&&"processing"===e.status&&(0,r.jsxs)("span",{className:K().timelinePercent,children:[e.percent,"%"]}),(0,r.jsx)(m.Ay,{type:"text",size:"small",danger:!0,icon:(0,r.jsx)(R.A,{}),style:{width:22,height:22,padding:0,fontSize:12},onClick:t=>{eC(e,t)}})]}),i&&(0,r.jsxs)("div",{className:K().timelineDetail,children:["number"==typeof e.percent&&"processing"===e.status&&(0,r.jsx)(y.A,{percent:e.percent,size:"small",strokeColor:"#1677ff"}),e.description&&(0,r.jsx)("div",{className:K().timelineDesc,children:e.description}),e.error&&(0,r.jsx)("div",{style:{color:"var(--colorError)",fontSize:12,wordBreak:"break-word"},children:e.error}),e.filePath&&(0,r.jsx)(f.A,{title:e.filePath,children:(0,r.jsx)("div",{className:K().timelinePath,children:e.filePath})}),(0,r.jsxs)("div",{className:K().timelineMeta,children:["number"==typeof e.chunkCount&&(0,r.jsxs)("span",{className:K().timelineMetaTag,children:["切片 ",(0,r.jsx)("b",{children:e.chunkCount})]}),"number"==typeof e.textLength&&(0,r.jsxs)("span",{className:K().timelineMetaTag,children:["正文 ",(0,r.jsx)("b",{children:e.textLength.toLocaleString(t)})," 字符"]}),e.extractionMode&&(0,r.jsxs)("span",{className:K().timelineMetaTag,children:["解析 ",(0,r.jsx)("b",{children:e.extractionMode})]})]}),"error"===e.status&&(0,r.jsx)("div",{style:{color:"var(--colorError)",fontSize:12},children:"此任务失败,请重新上传文件或重试操作"})]})]},a)})})]})]}),(0,r.jsxs)(v.A,{title:"文件列表",extra:(0,r.jsxs)(h.A,{size:8,children:[(0,r.jsxs)(m.Ay,{danger:!0,size:"small",disabled:0===eU,icon:(0,r.jsx)(R.A,{}),onClick:()=>eN("selected"),children:["删除已选 ",eU||""]}),(0,r.jsx)(m.Ay,{danger:!0,size:"small",disabled:0===eE.length,onClick:()=>eN("all"),children:"删除全部用户文件"})]}),children:[P&&(0,r.jsxs)("div",{className:K().statusEmpty,children:["文件列表加载失败:",P]}),(0,r.jsx)(x.A,{rowKey:"key",columns:eX,dataSource:eB,loading:C,size:"middle",expandable:{expandedRowKeys:ep,onExpand:eQ,childrenColumnName:"children"},locale:{emptyText:C?"正在加载文件列表...":N?e("emptySearch"):e("noFiles")},pagination:!1,rowClassName:e=>e.isFolder?K().folderRow:"",rowSelection:{selectedRowKeys:ea,onChange:ei,checkStrictly:!1,getCheckboxProps:e=>{var t,l;return{disabled:e.isFolder?(null!=(l=e.userFileCount)?l:0)===0:!!(null==(t=e.file)?void 0:t.builtIn)}}},footer:()=>(0,r.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["当前展示 ",eH.length," 个文件,其中我的文件 ",eO.length," 个、内置示例 ",eV.length," 个;全部我的文件 ",eE.length," 个、内置示例 ",eF.length," 个;",eB.length," 个顶层目录"]})})]})]})}},90426:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/files",function(){return l(82738)}])},90939:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"}},92803:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"}},93314:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var r=l(97109),n=l(53234),a=l(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let s=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:n.A})))}},e=>{e.O(0,[433,787,576,985,150,289,636,593,792],()=>e(e.s=90426)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28],{1611:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"database",theme:"outlined"}},10218:(e,t,l)=>{"use strict";l.d(t,{A:()=>g,H:()=>m});var r=l(97109),n=l(4932),a=l(42644);let i=e=>"object"==typeof e&&null!=e&&1===e.nodeType,s=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,o=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let l=getComputedStyle(e,null);return s(l.overflowY,t)||s(l.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},c=(e,t,l,r,n,a,i,s)=>a<e&&i>t||a>e&&i<t?0:a<=e&&s<=l||i>=t&&s>=l?a-e-r:i>t&&s<l||a<e&&s>l?i-t+n:0,u=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},d=(e,t)=>{var l,r,n,a;if("undefined"==typeof document)return[];let{scrollMode:s,block:d,inline:h,boundary:f,skipOverflowHiddenElements:m}=t,p="function"==typeof f?f:e=>e!==f;if(!i(e))throw TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,v=[],y=e;for(;i(y)&&p(y);){if((y=u(y))===g){v.push(y);break}null!=y&&y===document.body&&o(y)&&!o(document.documentElement)||null!=y&&o(y,m)&&v.push(y)}let x=null!=(r=null==(l=window.visualViewport)?void 0:l.width)?r:innerWidth,w=null!=(a=null==(n=window.visualViewport)?void 0:n.height)?a:innerHeight,{scrollX:j,scrollY:b}=window,{height:_,width:A,top:C,right:z,bottom:k,left:P}=e.getBoundingClientRect(),{top:S,right:M,bottom:N,left:I}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),H="start"===d||"nearest"===d?C-S:"end"===d?k+N:C+_/2-S+N,E="center"===h?P+A/2-I+M:"end"===h?z+M:P-I,F=[];for(let e=0;e<v.length;e++){let t=v[e],{height:l,width:r,top:n,right:a,bottom:i,left:u}=t.getBoundingClientRect();if("if-needed"===s&&C>=0&&P>=0&&k<=w&&z<=x&&(t===g&&!o(t)||C>=n&&k<=i&&P>=u&&z<=a))break;let f=getComputedStyle(t),m=parseInt(f.borderLeftWidth,10),p=parseInt(f.borderTopWidth,10),y=parseInt(f.borderRightWidth,10),S=parseInt(f.borderBottomWidth,10),M=0,N=0,I="offsetWidth"in t?t.offsetWidth-t.clientWidth-m-y:0,O="offsetHeight"in t?t.offsetHeight-t.clientHeight-p-S:0,V="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,T="offsetHeight"in t?0===t.offsetHeight?0:l/t.offsetHeight:0;if(g===t)M="start"===d?H:"end"===d?H-w:"nearest"===d?c(b,b+w,w,p,S,b+H,b+H+_,_):H-w/2,N="start"===h?E:"center"===h?E-x/2:"end"===h?E-x:c(j,j+x,x,m,y,j+E,j+E+A,A),M=Math.max(0,M+b),N=Math.max(0,N+j);else{M="start"===d?H-n-p:"end"===d?H-i+S+O:"nearest"===d?c(n,i,l,p,S+O,H,H+_,_):H-(n+l/2)+O/2,N="start"===h?E-u-m:"center"===h?E-(u+r/2)+I/2:"end"===h?E-a+y+I:c(u,a,r,m,y+I,E,E+A,A);let{scrollLeft:e,scrollTop:s}=t;M=0===T?0:Math.max(0,Math.min(s+M/T,t.scrollHeight-l/T+O)),N=0===V?0:Math.max(0,Math.min(e+N/V,t.scrollWidth-r/V+I)),H+=s-M,E+=e-N}F.push({el:t,top:M,left:N})}return F};var h=l(26047),f=l(44624);function m(e){return(0,f.$r)(e).join("_")}function p(e,t){let l=t.getFieldInstance(e),r=(0,a.rb)(l);if(r)return r;let n=(0,f.kV)((0,f.$r)(e),t.__INTERNAL__.name);if(n)return document.getElementById(n)}function g(e){let[t]=(0,n.mN)(),l=r.useRef({}),a=r.useMemo(()=>e??{...t,__INTERNAL__:{itemRef:e=>t=>{let r=m(e);t?l.current[r]=t:delete l.current[r]}},scrollToField:(e,t={})=>{let{focus:l,...r}=t,n=p(e,a);n&&(!function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let l=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(d(e,t));let r="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:n,top:a,left:i}of d(e,!1===t?{block:"end",inline:"nearest"}:t===Object(t)&&0!==Object.keys(t).length?t:{block:"start",inline:"nearest"})){let e=a-l.top+l.bottom,t=i-l.left+l.right;n.scroll({top:e,left:t,behavior:r})}}(n,{scrollMode:"if-needed",block:"nearest",...r}),l&&a.focusField(e))},focusField:e=>{let t=a.getFieldInstance(e);(0,h.Tn)(t?.focus)?t.focus():p(e,a)?.focus?.()},getFieldInstance:e=>{let t=m(e);return l.current[t]}},[e,t]);return[a]}},12887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},13067:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0010.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 00-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"}}]},name:"file-excel",theme:"outlined"}},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},23793:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"}},25258:(e,t,l)=>{"use strict";l.d(t,{A:()=>w});var r=l(51541),n=l(61848),a=l(5669),i=l(97109),s=l(72658),o=l(3638),c=l(92162),u=l(82725),d=l(74567),h=l(632),f=l(49517),m=l(79412),p=l(19527);let g=(0,u.U)(e=>{let{prefixCls:t,className:l,closeIcon:r,closable:n,type:a,title:u,children:g,footer:v,classNames:y,styles:x,...w}=e,{getPrefixCls:j}=i.useContext(d.QO),{className:b,style:_,classNames:A,styles:C}=(0,d.TP)("modal"),z=j(),k=t||j("modal"),P=(0,h.A)(z),[S,M]=(0,p.Ay)(k,P),[N,I]=(0,c.AV)([A,y],[C,x],{props:e}),H=`${k}-confirm`,E={};return E=a?{closable:n??!1,title:"",footer:"",children:i.createElement(f.k,{...e,prefixCls:k,confirmPrefixCls:H,rootPrefixCls:z,content:g})}:{closable:n??!0,title:u,footer:null!==v&&i.createElement(m.w,{...e}),children:g},i.createElement(s.Z,{prefixCls:k,className:(0,o.$)(S,`${k}-pure-panel`,a&&H,a&&`${H}-${a}`,l,b,M,P,N.root),style:{..._,...I.root},...w,closeIcon:(0,m.O)(k,r),closable:n,classNames:N,styles:I,...E})});var v=l(99739);function y(e){return(0,r.Ay)((0,r.fp)(e))}let x=a.A;x.useModal=v.A,x.info=function(e){return(0,r.Ay)((0,r.$D)(e))},x.success=function(e){return(0,r.Ay)((0,r.Ej)(e))},x.error=function(e){return(0,r.Ay)((0,r.jT)(e))},x.warning=y,x.warn=y,x.confirm=function(e){return(0,r.Ay)((0,r.lr)(e))},x.destroyAll=function(){for(;n.A.length;){let e=n.A.pop();e&&e()}},x.config=r.FB,x._InternalPanelDoNotUseOrYouWillBeFired=g;let w=x},26619:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var r=l(97109),n=l(1611),a=l(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let s=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:n.A})))},26631:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var r=l(97109),n=l(12887),a=l(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let s=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:n.A})))},30289:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"}},44624:(e,t,l)=>{"use strict";l.d(t,{$r:()=>n,BS:()=>i,kV:()=>a});let r=["parentNode"];function n(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function a(e,t){if(!e.length)return;let l=e.join("_");return t?`${t}_${l}`:r.includes(l)?`form_item_${l}`:l}function i(e,t,l,r,n,a){let i=r;return void 0!==a?i=a:l.validating?i="validating":e.length?i="error":t.length?i="warning":(l.touched||n&&l.validated)&&(i="success"),i}},45551:(e,t,l)=>{"use strict";function r(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),l=e/Math.pow(1024,t);return"".concat(l.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let l=Math.floor(Math.floor((Date.now()-e)/1e3)/60),r=Math.floor(l/60),n=Math.floor(r/24);return n>30?new Date(e).toLocaleDateString(t):"en-US"===t?n>0?"".concat(n,"d ago"):r>0?"".concat(r,"h ago"):l>0?"".concat(l,"m ago"):"Just now":n>0?"".concat(n," 天前"):r>0?"".concat(r," 小时前"):l>0?"".concat(l," 分钟前"):"刚刚"}l.d(t,{Jm:()=>s,fw:()=>n,z3:()=>r});let a={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},i={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===l?i:a)[e])?t:e}},48893:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M553.1 509.1l-77.8 99.2-41.1-52.4a8 8 0 00-12.6 0l-99.8 127.2a7.98 7.98 0 006.3 12.9H696c6.7 0 10.4-7.7 6.3-12.9l-136.5-174a8.1 8.1 0 00-12.7 0zM360 442a40 40 0 1080 0 40 40 0 10-80 0zm494.6-153.4L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file-image",theme:"outlined"}},53234:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM496 208H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 544h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm328 244a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"hdd",theme:"outlined"}},58209:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var r=l(97109),n=l(23793),a=l(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let s=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:n.A})))},58520:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 00-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 00-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z"}}]},name:"file-word",theme:"outlined"}},61825:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var r=l(97109),n=l(30289),a=l(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let s=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:n.A})))},82738:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>ee});var r=l(65321),n=l(97109),a=l(79059),i=l(43220),s=l.n(i),o=l(86109),c=l(17807),u=l(25258),d=l(11702),h=l(33442),f=l(14932),m=l(85114),p=l(7576),g=l(57271),v=l(68787),y=l(99605),x=l(21289),w=l(56768),j=l(48893),b=l(88483);function _(){return(_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let A=n.forwardRef((e,t)=>n.createElement(b.A,_({},e,{ref:t,icon:j.A})));var C=l(13067);function z(){return(z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let k=n.forwardRef((e,t)=>n.createElement(b.A,z({},e,{ref:t,icon:C.A})));var P=l(58520);function S(){return(S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let M=n.forwardRef((e,t)=>n.createElement(b.A,S({},e,{ref:t,icon:P.A})));var N=l(90939);function I(){return(I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let H=n.forwardRef((e,t)=>n.createElement(b.A,I({},e,{ref:t,icon:N.A})));var E=l(93314),F=l(61825),O=l(26619),V=l(29606),T=l(26631),B=l(64254),L=l(64629),R=l(58209),D=l(30486),W=l(92803);function $(){return($=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let U=n.forwardRef((e,t)=>n.createElement(b.A,$({},e,{ref:t,icon:W.A})));var J=l(84742),Q=l(38762),X=l(6578),q=l(45551),G=l(14569),K=l.n(G);let Y=["document","spreadsheet","image","cad","code","data","web","diagram","other"],Z=/\.(zip|jar|war|apk|tar|gz|tgz|bz2|rar|7z)$/iu;function ee(){let e=(0,a.Vr)("knowledge"),{locale:t}=(0,a.x_)(),{message:l}=c.A.useApp(),i=(0,o.useRouter)(),j="string"==typeof i.query.category?i.query.category:"",[b,_]=(0,n.useState)([]),[C,z]=(0,n.useState)(!1),[P,S]=(0,n.useState)(""),[N,I]=(0,n.useState)(""),[W,$]=(0,n.useState)(j),[G,ee]=(0,n.useState)(!1),[et,el]=(0,n.useState)(!1),[er,en]=(0,n.useState)([]),[ea,ei]=(0,n.useState)([]),[es,eo]=(0,n.useState)(new Set),[ec,eu]=(0,n.useState)("all"),[ed,eh]=(0,n.useState)("user"),[ef,em]=(0,n.useState)(!0),[ep,eg]=(0,n.useState)([]),[ev,ey]=(0,n.useState)(new Set),ex=(0,n.useRef)(W);(0,n.useEffect)(()=>{ex.current=W},[W]),(0,n.useEffect)(()=>{$("string"==typeof i.query.category?i.query.category:"")},[i.query.category]);let ew=(0,n.useCallback)(async(e,t)=>{let l=null!=e?e:ex.current;(null==t?void 0:t.silent)||(z(!0),S(""));try{let e=await (0,X.HT)({category:l||void 0,limit:200});_(e.files||[]),e.initializing&&window.setTimeout(()=>{ew(l,{silent:!0})},3e3)}catch(e){(null==t?void 0:t.silent)||(_([]),S(e instanceof Error?e.message:"文件列表加载失败"))}finally{(null==t?void 0:t.silent)||z(!1)}},[]);(0,n.useEffect)(()=>{ew(W)},[W,ew]);let ej=e=>({id:e.id,type:e.type,title:e.title,description:e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,textLength:e.textLength,extractionMode:e.extractionMode,error:e.error,createdAt:e.createdAt}),eb=(0,n.useCallback)(async()=>{try{let e=(await (0,X.Qx)()).operations.map(ej);en(t=>{let l=new Set(e.map(e=>e.id).filter(Boolean)),r=e.map(e=>{var l;let r=t.find(t=>t.id===e.id);return r?{...r,...e,createdAt:null!=(l=r.createdAt)?l:e.createdAt}:e}),n=t.filter(e=>e.id&&!l.has(e.id)&&"processing"===e.status);return[...r,...n].slice(0,50)})}catch(e){}},[]),e_=(0,n.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];en(l=>{let r=l.findIndex(l=>e.id&&l.id===e.id||t.includes(l.title));if(r>=0){var n;let t=[...l];return t[r]={...l[r],...e,createdAt:null!=(n=l[r].createdAt)?n:e.createdAt},t}return[e,...l].slice(0,50)})},[]);(0,n.useEffect)(()=>{eb()},[eb]);let eA=async()=>{try{await (0,X.H7)(),en([]),l.success("任务状态已清空")}catch(e){l.error("清空任务状态失败")}},eC=async(e,t)=>{if(t.stopPropagation(),e.id)try{await (0,X.CU)(e.id)}catch(e){}en(t=>t.filter(t=>t!==e))},ez=(0,n.useMemo)(()=>{let e=0,t=0,l=0;for(let r of er)"processing"===r.status?e++:"success"===r.status?t++:("error"===r.status||"warning"===r.status)&&l++;return{processing:e,success:t,error:l}},[er]);(0,n.useEffect)(()=>{ez.processing>0&&em(!1)},[ez.processing]),(0,n.useEffect)(()=>{if(0===ez.processing)return;let e=window.setInterval(()=>{eb()},2e3),t=window.setInterval(()=>{ew(void 0,{silent:!0})},8e3);return()=>{window.clearInterval(e),window.clearInterval(t)}},[ew,eb,ez.processing]);let ek="all"===ec?er:er.filter(e=>"processing"===ec?"processing"===e.status:"success"===ec?"success"===e.status:"error"!==ec||"error"===e.status||"warning"===e.status),eP=async e=>{let t=e.filter(e=>!Z.test(e.name)),r=e.length-t.length;if(r>0&&l.warning("已跳过 ".concat(r," 个压缩包,请解压后上传内部文件")),0===t.length)return;let n=1===t.length?t[0].name:"".concat(t.length," 个文件");ee(!0);let a="".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2));e_({id:a,type:"upload",title:"上传 ".concat(n),description:"等待上传、解析、切片和入库",status:"processing",percent:5});try{await (0,X.c1)(t,void 0,a,e=>{e_({id:a,type:"upload",title:"上传 ".concat(n),description:"正在上传文件:".concat(e.uploadedFiles,"/").concat(e.totalFiles,",批次 ").concat(e.batchIndex+1,"/").concat(e.totalBatches),status:"processing",percent:Math.min(5,Math.max(1,Math.round(e.uploadedFiles/Math.max(1,e.totalFiles)*5)))})}),l.info("文件已上传,正在后台解析、切片和入库,可在顶部“后台任务”查看进度"),I(""),$(""),ei([]),ex.current="",await eb(),window.setTimeout(()=>{ew(void 0,{silent:!0})},2e3)}catch(t){let e=t instanceof Error?t.message:"请重试或检查文件格式";l.error(e||"上传失败"),e_({id:a,type:"error",title:"上传失败 ".concat(n),description:e,status:"error",percent:100})}finally{ee(!1)}},eS=async()=>{el(!0);let e="reindex-ui-".concat(Date.now());e_({id:e,type:"reindex",title:"重新解析入库",description:"正在提交后台任务",status:"processing",percent:5});try{var t;let r=await (0,X.H1)(),n=r.operationId||e,a=r.job;l.info(r.alreadyRunning?"已有重新解析任务正在后台执行":"已提交重新解析入库任务,可在顶部“后台任务”查看进度"),e_({id:n,type:"reindex",title:(null==a?void 0:a.title)||"重新解析入库",description:(null==a?void 0:a.message)||"后台将重新扫描文件、解析、切片并重建索引",status:(null==a?void 0:a.status)||"processing",percent:null!=(t=null==a?void 0:a.percent)?t:10,error:null==a?void 0:a.error},["重新解析入库"]);for(let e=0;e<360;e++){let e=await (0,X.ax)(n).then(e=>e.job).catch(async()=>(await (0,X.Qx)()).operations.find(e=>e.id===n));if(e){let t="success"===e.status||"error"===e.status;if(e_({id:n,type:"error"===e.status?"error":"reindex",title:"success"===e.status?"重新解析入库完成":"error"===e.status?"重新解析入库失败":e.title,description:e.error||e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,error:e.error}),t){"success"===e.status?l.success(e.message||"重新解析入库完成"):l.error(e.error||e.message||"重新解析入库失败");break}}await new Promise(e=>setTimeout(e,1e3))}await ew(),await eb()}catch(r){let t=r instanceof Error?r.message:"重新解析入库失败";l.error(t),e_({id:e,type:"error",title:"重新解析入库失败",description:t,status:"error",percent:100},["重新解析入库","重新解析入库完成","重新解析入库失败"])}finally{el(!1)}},eM=async e=>{if(e.builtIn)return void l.info("内置示例资料不可重新解析");let t="file-reindex-ui-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2));ey(t=>new Set(t).add(e.relativePath)),e_({id:t,type:"reindex",title:"重新解析 ".concat(e.relativePath),description:"正在提交单文件后台任务",status:"processing",percent:5,filePath:e.relativePath});try{var r;let n=await (0,X.HC)(e.relativePath),a=n.operationId||t,i=n.job;l.info(n.alreadyRunning?"已有知识库任务正在后台执行":"已提交单文件重新解析任务"),e_({id:a,type:"reindex",title:(null==i?void 0:i.title)||"重新解析 ".concat(e.relativePath),description:(null==i?void 0:i.message)||"后台将重新解析、分块并入库该文件",status:(null==i?void 0:i.status)||"processing",percent:null!=(r=null==i?void 0:i.percent)?r:10,filePath:(null==i?void 0:i.filePath)||e.relativePath,chunkCount:null==i?void 0:i.chunkCount,error:null==i?void 0:i.error},["重新解析 ".concat(e.relativePath)]);for(let t=0;t<240;t++){let t=await (0,X.ax)(a).then(e=>e.job).catch(async()=>(await (0,X.Qx)()).operations.find(e=>e.id===a));if(t){let r="success"===t.status||"error"===t.status;if(e_({id:a,type:"error"===t.status?"error":"reindex",title:"success"===t.status?"重新解析完成 ".concat(e.relativePath):"error"===t.status?"重新解析失败 ".concat(e.relativePath):t.title,description:t.error||t.message,status:t.status,percent:t.percent,filePath:t.filePath||e.relativePath,chunkCount:t.chunkCount,error:t.error}),await ew(),r){"success"===t.status?l.success(t.message||"单文件重新解析完成"):l.error(t.error||t.message||"单文件重新解析失败");break}}await new Promise(e=>setTimeout(e,1e3))}await ew(),await eb()}catch(n){let r=n instanceof Error?n.message:"单文件重新解析失败";l.error(r),e_({id:t,type:"error",title:"重新解析失败 ".concat(e.relativePath),description:r,status:"error",percent:100,filePath:e.relativePath},["重新解析 ".concat(e.relativePath)])}finally{ey(t=>{let l=new Set(t);return l.delete(e.relativePath),l})}},eN=t=>{let r="selected"===t?e$:"filtered"===t?eH.filter(e=>!e.builtIn).map(e=>e.relativePath):[],n=b.filter(e=>!e.builtIn).length;if("all"!==t&&0===r.length||"all"===t&&0===n)return void l.info("没有可删除的用户文件");let a="all"===t?"删除全部用户文件 ".concat(n," 个?"):"filtered"===t?"删除当前筛选结果中的用户文件 ".concat(r.length," 个?"):"删除已选用户文件 ".concat(r.length," 个?");u.A.confirm({title:a,content:"将同时删除文件、切片、索引和向量记录。此操作不可撤销。",okText:e("common.delete"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{en(e=>[{type:"delete",title:a,description:"正在批量删除文件和索引",status:"processing",percent:10},...e].slice(0,50));try{var e;let a=null!=(e=("all"===t?await (0,X.X8)():"selected"===t?await (0,X.tZ)(eW,eD):await (0,X.SJ)(r)).deleted)?e:"all"===t?n:r.length;l.success("已删除 ".concat(a," 个文件")),ei([]),en(e=>[{type:"delete",title:"批量删除完成",description:"已删除 ".concat(a," 个文件、切片和索引"),status:"success"},...e].slice(0,50)),await ew(),await eb()}catch(e){l.error("批量删除失败"),en(e=>[{type:"error",title:"批量删除失败",description:"请重试",status:"error"},...e].slice(0,50))}}})},eI=(0,n.useMemo)(()=>"all"===ed?b:b.filter(e=>"builtIn"===ed?e.builtIn:!e.builtIn),[b,ed]),eH=(0,n.useMemo)(()=>N?eI.filter(e=>e.relativePath.toLowerCase().includes(N.toLowerCase())):eI,[N,eI]),eE=(0,n.useMemo)(()=>b.filter(e=>!e.builtIn),[b]),eF=(0,n.useMemo)(()=>b.filter(e=>e.builtIn),[b]),eO=(0,n.useMemo)(()=>eH.filter(e=>!e.builtIn),[eH]),eV=(0,n.useMemo)(()=>eH.filter(e=>e.builtIn),[eH]),eT=(0,n.useMemo)(()=>new Set(eH.map(e=>e.relativePath)),[eH]),eB=(0,n.useMemo)(()=>{let e={};for(let l of[...eH].sort((e,t)=>e.relativePath.localeCompare(t.relativePath))){let r=l.relativePath.split("/"),n="";for(let a=0;a<r.length;a++){let i=r[a],s=n;n=n?"".concat(n,"/").concat(i):i;let o=a===r.length-1;if(e[n])o||e[n].isFolder?o&&(e[n].isFolder=!1,e[n].file=l,e[n].fileCount=1,e[n].userFileCount=+!l.builtIn,e[n].totalSize=l.fileSize,e[n].totalChunks=l.chunkCount):(e[n].isFolder=!0,e[n].children=[],e[n].fileCount=0,e[n].userFileCount=0,e[n].totalSize=0,e[n].totalChunks=0);else{var t;e[n]={key:n,name:i,isFolder:!o,...o?{file:l,fileCount:1,userFileCount:+!l.builtIn,totalSize:l.fileSize,totalChunks:l.chunkCount}:{children:[],fileCount:0,userFileCount:0,totalSize:0,totalChunks:0}},s&&(null==(t=e[s])?void 0:t.children)&&e[s].children.push(e[n])}}}let l=e=>{for(let i of e)if(i.children){l(i.children);let e=0,s=0,o=0,c=0;for(let l of i.children){var t,r,n,a;e+=null!=(t=l.fileCount)?t:0,s+=null!=(r=l.userFileCount)?r:0,o+=null!=(n=l.totalSize)?n:0,c+=null!=(a=l.totalChunks)?a:0}i.fileCount=e,i.userFileCount=s,i.totalSize=o,i.totalChunks=c}},r=e=>e.map(e=>e.children?{...e,children:r(e.children)}:e).filter(e=>{var t,l,r;return!e.isFolder||(null!=(l=e.fileCount)?l:0)>0&&(null!=(r=null==(t=e.children)?void 0:t.length)?r:0)>0}),n=Object.values(e).filter(e=>!e.key.includes("/"));return l(n),r(n)},[eH]),eL=(0,n.useMemo)(()=>{let e=[],t=l=>{for(let r of l)e.push(r.key),r.children&&t(r.children)};return t(eB),e},[eB]),eR=(0,n.useMemo)(()=>new Set([...eT,...eL]),[eL,eT]),eD=(0,n.useMemo)(()=>ea.map(String).filter(e=>!eT.has(e)&&eL.includes(e)),[eL,ea,eT]),eW=(0,n.useMemo)(()=>ea.map(String).filter(e=>eT.has(e)),[ea,eT]),e$=(0,n.useMemo)(()=>{let e=new Set;for(let t of eW){let l=b.find(e=>e.relativePath===t);l&&!l.builtIn&&e.add(l.relativePath)}for(let t of eD){let l="".concat(t,"/");for(let t of b)!t.builtIn&&t.relativePath.startsWith(l)&&e.add(t.relativePath)}return Array.from(e)},[b,eW,eD]),eU=e$.length;(0,n.useEffect)(()=>{ei(e=>e.filter(e=>eR.has(String(e))))},[eR]);let eJ=(0,n.useMemo)(()=>N?eL:eB.map(e=>e.key),[N,eL,eB]);(0,n.useEffect)(()=>{eg(eJ)},[eJ]);let eQ=(e,t)=>{eg(l=>e?[...l,t.key]:l.filter(e=>e!==t.key))},eX=[{title:e("fileName"),dataIndex:"name",key:"name",render:(e,t)=>{var l;return(0,r.jsxs)("span",{className:K().fileNameCell,children:[t.isFolder?(0,r.jsx)("span",{style:{cursor:"pointer"},onClick:e=>{e.stopPropagation(),eQ(!ep.includes(t.key),t)},children:(e=>{let t=e.children;return t&&0!==t.length?(0,r.jsx)(B.A,{style:{color:"#fa8c16",fontSize:15}}):(0,r.jsx)(V.A,{style:{color:"#fa8c16",fontSize:15}})})(t)}):(e=>{if(!e)return(0,r.jsx)(w.A,{style:{fontSize:15}});let t=e.category;return"image"===t?(0,r.jsx)(A,{style:{color:"#eb2f96",fontSize:15}}):"spreadsheet"===t?(0,r.jsx)(k,{style:{color:"#52c41a",fontSize:15}}):"document"===t?(0,r.jsx)(M,{style:{color:"#1677ff",fontSize:15}}):"code"===t?(0,r.jsx)(H,{style:{color:"#fa8c16",fontSize:15}}):"archive"===t?(0,r.jsx)(E.A,{style:{color:"#8c8c8c",fontSize:15}}):"web"===t?(0,r.jsx)(F.A,{style:{color:"#13c2c2",fontSize:15}}):"data"===t?(0,r.jsx)(O.A,{style:{color:"#722ed1",fontSize:15}}):"cad"===t?(0,r.jsx)(V.A,{style:{color:"#fa541c",fontSize:15}}):"diagram"===t?(0,r.jsx)(A,{style:{color:"#a0d911",fontSize:15}}):(0,r.jsx)(T.A,{style:{fontSize:15}})})(t.file),t.isFolder?(0,r.jsx)("span",{className:K().folderName,onClick:e=>{e.stopPropagation(),eQ(!ep.includes(t.key),t)},children:t.name}):(0,r.jsxs)(r.Fragment,{children:[(null==(l=t.file)?void 0:l.builtIn)&&(0,r.jsx)(d.A,{color:"gold",style:{fontSize:11,lineHeight:"18px"},children:"内置"}),(0,r.jsx)(s(),{className:"truncate max-w-[380px] inline-block",href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(t.key)),children:t.name})]})]})}},{title:e("fileCategory"),dataIndex:"category",key:"cat",width:110,render:(e,l)=>{var n,a;return l.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,r.jsx)(d.A,{children:(0,q.Jm)(null!=(a=null==(n=l.file)?void 0:n.category)?a:"",t)})}},{title:e("fileSize"),dataIndex:"fileSize",key:"size",width:90,render:(e,t)=>{var l,r,n;return(0,q.z3)(t.isFolder?null!=(r=t.totalSize)?r:0:null!=(n=null==(l=t.file)?void 0:l.fileSize)?n:0)}},{title:"切片",dataIndex:"chunkCount",key:"chunks",width:80,render:(e,t)=>{var l,n,a;let i=t.isFolder?null!=(n=t.totalChunks)?n:0:null!=(a=null==(l=t.file)?void 0:l.chunkCount)?a:0;return(0,r.jsx)(d.A,{color:i>1?"green":"orange",children:i})}},{title:"解析状态",dataIndex:"status",key:"status",width:100,render:(e,t)=>{var l,n,a,i;return t.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,r.jsx)(d.A,{color:"active"===(i=null==(l=t.file)?void 0:l.status)?"green":"processing"===i||"indexing"===i?"blue":"error"===i?"red":"orange",children:(null==(n=t.file)?void 0:n.errorMessage)||(null==(a=t.file)?void 0:a.status)||"—"})}},{title:e("fileDate"),dataIndex:"mtime",key:"date",width:130,render:(e,l)=>{var n;return l.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(null==(n=l.file)?void 0:n.mtime)?new Date(l.file.mtime).toLocaleDateString(t):"—"}},{title:"来源",key:"source",width:100,render:(e,t)=>{var l;return t.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(null==(l=t.file)?void 0:l.builtIn)?(0,r.jsx)(d.A,{color:"gold",children:"内置示例"}):(0,r.jsx)(d.A,{color:"cyan",children:"我的文件"})}},{title:"",key:"act",width:100,render:(t,n)=>{var a,i;return n.isFolder?null:(0,r.jsxs)(h.A,{size:4,children:[(0,r.jsx)(f.A,{title:"重新解析、分块并入库",children:(0,r.jsx)(m.Ay,{type:"text",size:"small",disabled:null==(a=n.file)?void 0:a.builtIn,loading:!!(n.file&&ev.has(n.file.relativePath)),icon:(0,r.jsx)(L.A,{}),onClick:()=>{eM(n.file)}})}),(0,r.jsx)(m.Ay,{type:"text",danger:!0,size:"small",disabled:null==(i=n.file)?void 0:i.builtIn,icon:(0,r.jsx)(R.A,{}),onClick:()=>(t=>{if(t.builtIn)return void l.info("内置示例资料不可删除");u.A.confirm({title:e("delete"),content:e("deleteConfirm"),okText:e("common.confirm"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{en(e=>[{type:"delete",title:"删除 ".concat(t.relativePath),description:"正在删除文件记录",status:"processing"},...e].slice(0,50));try{await (0,X.xq)(t.relativePath),l.success("已删除"),en(e=>[{type:"delete",title:"删除完成 ".concat(t.relativePath),description:"文件和索引记录已移除",status:"success"},...e].slice(0,50)),ei(e=>e.filter(e=>e!==t.relativePath)),await ew(),await eb()}catch(e){l.error("删除失败"),en(e=>[{type:"error",title:"删除失败 ".concat(t.relativePath),description:"请重试",status:"error"},...e].slice(0,50))}}})})(n.file)})]})}}];return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsx)("h2",{className:"pageTitle",children:e("files")}),(0,r.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,r.jsx)(p.A,{placeholder:e("searchPlaceholder"),prefix:(0,r.jsx)(D.A,{}),value:N,onChange:e=>{I(e.target.value)},allowClear:!0,className:K().filterInput}),(0,r.jsx)(g.A,{value:W||void 0,onChange:e=>{$(e||"")},placeholder:e("filterCategory"),allowClear:!0,className:K().filterSelect,options:[{label:e("allCategories"),value:""},...Y.map(e=>({label:(0,q.Jm)(e,t),value:e}))]}),(0,r.jsx)(g.A,{value:ed,onChange:eh,className:K().filterSelect,options:[{label:"全部来源 (".concat(b.length,")"),value:"all"},{label:"我的文件 (".concat(eE.length,")"),value:"user"},{label:"内置示例 (".concat(eF.length,")"),value:"builtIn"}]}),(0,r.jsx)(m.Ay,{type:"primary",icon:(0,r.jsx)(U,{}),loading:G,onClick:()=>{var e;return null==(e=document.getElementById("kb-file-upload-input"))?void 0:e.click()},children:G?e("uploading"):e("upload")}),(0,r.jsx)(m.Ay,{icon:(0,r.jsx)(U,{}),loading:G,onClick:()=>{var e;return null==(e=document.getElementById("kb-folder-upload-input"))?void 0:e.click()},children:"上传文件夹"}),(0,r.jsx)(m.Ay,{icon:(0,r.jsx)(L.A,{}),loading:et,onClick:()=>{eS()},children:"重新解析入库"}),(0,r.jsx)("input",{id:"kb-file-upload-input",type:"file",multiple:!0,hidden:!0,accept:".pdf,.doc,.docx,.txt,.md,.csv,.tsv,.xls,.xlsx,.png,.jpg,.jpeg,.webp,.svg,.dwg,.dxf,.step,.stp,.iges,.igs,.js,.ts,.tsx,.jsx,.py,.go,.java,.cs,.cpp,.c,.h,.json,.jsonl,.yaml,.yml,.xml,.html,.htm,.drawio,.dio,.vsdx,.vdx,.puml,.plantuml,.mmd,.mermaid,.excalidraw",onChange:e=>{var t;let l=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",eP(l)}}),(0,r.jsx)("input",{id:"kb-folder-upload-input",type:"file",multiple:!0,hidden:!0,webkitdirectory:"",onChange:e=>{var t;let l=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",eP(l)}})]}),(0,r.jsxs)(v.A,{size:"small",className:K().statusCard,styles:{body:{padding:0}},children:[(0,r.jsxs)("div",{className:K().statusSummary,onClick:()=>em(!ef),children:[(0,r.jsx)("span",{className:K().statusSummaryText,children:0===er.length?"暂无文件任务":(0,r.jsxs)(h.A,{size:6,children:[ez.processing>0&&(0,r.jsxs)(d.A,{color:"processing",style:{margin:0},icon:(0,r.jsx)(L.A,{spin:!0}),children:["处理中 ",ez.processing]}),(0,r.jsxs)(d.A,{color:"success",style:{margin:0},icon:(0,r.jsx)(J.A,{}),children:["已完成 ",ez.success]}),(0,r.jsxs)(d.A,{color:"error",style:{margin:0},icon:(0,r.jsx)(Q.A,{}),children:["失败 ",ez.error]})]})}),er.length>0&&(0,r.jsxs)(h.A,{size:6,children:[(0,r.jsx)(m.Ay,{size:"small",className:K().statusClearBtn,onClick:e=>{e.stopPropagation(),eA()},children:"清空"}),(0,r.jsx)(m.Ay,{size:"small",className:K().statusExpandBtn,onClick:e=>{e.stopPropagation(),em(!ef)},children:ef?"展开":"收起"})]})]}),!ef&&er.length>0&&(0,r.jsxs)("div",{className:K().statusPanel,children:[(0,r.jsxs)("div",{className:K().statusFilters,children:[(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("all"===ec?K().filterPillActive:""),style:"all"===ec?{color:"#1677ff"}:void 0,onClick:()=>eu("all"),children:["全部 ",(0,r.jsx)("b",{children:er.length})]}),(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("processing"===ec?K().filterPillActive:""),style:"processing"===ec?{color:"#1677ff"}:void 0,onClick:()=>eu("processing"),children:[(0,r.jsx)(L.A,{spin:ez.processing>0})," 处理中 ",(0,r.jsx)("b",{children:ez.processing})]}),(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("success"===ec?K().filterPillActive:""),style:"success"===ec?{color:"#52c41a"}:void 0,onClick:()=>eu("success"),children:[(0,r.jsx)(J.A,{})," 已完成 ",(0,r.jsx)("b",{children:ez.success})]}),(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("error"===ec?K().filterPillActive:""),style:"error"===ec?{color:"#ff4d4f"}:void 0,onClick:()=>eu("error"),children:[(0,r.jsx)(Q.A,{})," 失败 ",(0,r.jsx)("b",{children:ez.error})]})]}),(0,r.jsx)("div",{className:K().timelineList,children:0===ek.length?(0,r.jsx)("div",{className:K().statusEmpty,children:"没有匹配的任务"}):ek.map((e,l)=>{var n;let a=e.id||"".concat(e.type,"-").concat(null!=(n=e.createdAt)?n:e.title,"-").concat(l),i=es.has(a);return(0,r.jsxs)("div",{className:K().timelineItem,children:[(0,r.jsxs)("div",{className:K().timelineRow,onClick:()=>{eo(e=>{let t=new Set(e);return t.has(a)?t.delete(a):t.add(a),t})},children:[(0,r.jsx)("span",{className:K().timelineStatusIcon,children:"success"===e.status?(0,r.jsx)(J.A,{style:{color:"#52c41a"}}):"processing"===e.status?(0,r.jsx)(L.A,{spin:!0,style:{color:"#1677ff"}}):"error"===e.status?(0,r.jsx)(Q.A,{style:{color:"#ff4d4f"}}):(0,r.jsx)("span",{style:{color:"#fa8c16",fontWeight:700},children:"!"})}),(0,r.jsx)("span",{className:K().timelineTitle,children:e.title}),"number"==typeof e.percent&&"processing"===e.status&&(0,r.jsxs)("span",{className:K().timelinePercent,children:[e.percent,"%"]}),(0,r.jsx)(m.Ay,{type:"text",size:"small",danger:!0,icon:(0,r.jsx)(R.A,{}),style:{width:22,height:22,padding:0,fontSize:12},onClick:t=>{eC(e,t)}})]}),i&&(0,r.jsxs)("div",{className:K().timelineDetail,children:["number"==typeof e.percent&&"processing"===e.status&&(0,r.jsx)(y.A,{percent:e.percent,size:"small",strokeColor:"#1677ff"}),e.description&&(0,r.jsx)("div",{className:K().timelineDesc,children:e.description}),e.error&&(0,r.jsx)("div",{style:{color:"var(--colorError)",fontSize:12,wordBreak:"break-word"},children:e.error}),e.filePath&&(0,r.jsx)(f.A,{title:e.filePath,children:(0,r.jsx)("div",{className:K().timelinePath,children:e.filePath})}),(0,r.jsxs)("div",{className:K().timelineMeta,children:["number"==typeof e.chunkCount&&(0,r.jsxs)("span",{className:K().timelineMetaTag,children:["切片 ",(0,r.jsx)("b",{children:e.chunkCount})]}),"number"==typeof e.textLength&&(0,r.jsxs)("span",{className:K().timelineMetaTag,children:["正文 ",(0,r.jsx)("b",{children:e.textLength.toLocaleString(t)})," 字符"]}),e.extractionMode&&(0,r.jsxs)("span",{className:K().timelineMetaTag,children:["解析 ",(0,r.jsx)("b",{children:e.extractionMode})]})]}),"error"===e.status&&(0,r.jsx)("div",{style:{color:"var(--colorError)",fontSize:12},children:"此任务失败,请重新上传文件或重试操作"})]})]},a)})})]})]}),(0,r.jsxs)(v.A,{title:"文件列表",extra:(0,r.jsxs)(h.A,{size:8,children:[(0,r.jsxs)(m.Ay,{danger:!0,size:"small",disabled:0===eU,icon:(0,r.jsx)(R.A,{}),onClick:()=>eN("selected"),children:["删除已选 ",eU||""]}),(0,r.jsx)(m.Ay,{danger:!0,size:"small",disabled:0===eE.length,onClick:()=>eN("all"),children:"删除全部用户文件"})]}),children:[P&&(0,r.jsxs)("div",{className:K().statusEmpty,children:["文件列表加载失败:",P]}),(0,r.jsx)(x.A,{rowKey:"key",columns:eX,dataSource:eB,loading:C,size:"middle",expandable:{expandedRowKeys:ep,onExpand:eQ,childrenColumnName:"children"},locale:{emptyText:C?"正在加载文件列表...":N?e("emptySearch"):e("noFiles")},pagination:!1,rowClassName:e=>e.isFolder?K().folderRow:"",rowSelection:{selectedRowKeys:ea,onChange:ei,checkStrictly:!1,getCheckboxProps:e=>{var t,l;return{disabled:e.isFolder?(null!=(l=e.userFileCount)?l:0)===0:!!(null==(t=e.file)?void 0:t.builtIn)}}},footer:()=>(0,r.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["当前展示 ",eH.length," 个文件,其中我的文件 ",eO.length," 个、内置示例 ",eV.length," 个;全部我的文件 ",eE.length," 个、内置示例 ",eF.length," 个;",eB.length," 个顶层目录"]})})]})]})}},90426:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/files",function(){return l(82738)}])},90939:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"}},92803:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"}},93314:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var r=l(97109),n=l(53234),a=l(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let s=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:n.A})))}},e=>{e.O(0,[433,787,576,985,150,289,636,593,792],()=>e(e.s=90426)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{27549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(34508)}])},34508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>Z});var l=r(65321),i=r(97109),o=r(79059),n=r(17807),a=r(33442),s=r(11702),c=r(56985),d=r(85114),p=r(26171),h=r(68787),u=r(88762),m=r(7576),x=r(57271),y=r(49292),f=r(55122),g=r(84253),j=r(34052),v=r(42700),w=r(54746),S=r(99650),A=r(58209),b=r(26631),C=r(29606),k=r(96091),z=r(81668),T=r(30486),N=r(46082),E=r(42758),F=r(24810),P=r(7492);async function R(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function O(e,t,r){let l=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t,name:r})});if(!l.ok)throw Error("Failed");return l.json()}async function I(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function B(e,t){let r=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function W(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"select",selectedIds:e})});if(!t.ok)throw Error("Failed");return t.json()}async function H(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"import",...e&&"object"==typeof e?e:{prompts:[]}})});if(!t.ok)throw Error(await t.text());return t.json()}async function D(){let e=await fetch("/api/kb/files?limit=200");if(!e.ok)throw Error("Failed");return(await e.json()).files||[]}async function _(e){let t=await fetch("/api/kb/files/detail?relativePath=".concat(encodeURIComponent(e)));if(!t.ok)throw Error("Failed");return((await t.json()).chunks||[]).map(e=>e.content||"").filter(Boolean).join("\n\n").slice(0,12e3)}async function J(e){let t=await fetch("/api/prompt/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.text();try{let t=JSON.parse(e);throw Error(t.error||t.message||e||"AI 对话失败")}catch(t){throw Error(e||"AI 对话失败")}}return t.json()}function L(e){return e.id.startsWith("builtin:")}function M(e){return e.id.startsWith("custom:")}function U(e){return L(e)?"builtin":M(e)?"custom":e.isCurrent?"current":"project"}function G(e){return"custom"===e?"我的提示词":"current"===e?"当前项目":"project"===e?"其他项目":"builtin"===e?"内置示例":"全部"}function X(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:220,r=e.hasFile&&e.content?e.content.replace(/^#.*$/gm,"").replace(/\n{3,}/g,"\n\n").trim():"";return r.length>t?"".concat(r.slice(0,t),"..."):r}function Y(e){let t=Date.parse(e);return Number.isNaN(t)?"-":new Date(t).toLocaleString()}function Z(){let e=(0,o.Vr)(),{message:t}=n.A.useApp(),[r,Z]=(0,i.useState)(!0),[K,V]=(0,i.useState)([]),[$,q]=(0,i.useState)(!1),[Q,ee]=(0,i.useState)(null),[et,er]=(0,i.useState)(""),[el,ei]=(0,i.useState)(""),[eo,en]=(0,i.useState)(!1),[ea,es]=(0,i.useState)(!1),[ec,ed]=(0,i.useState)("custom"),[ep,eh]=(0,i.useState)("all"),[eu,em]=(0,i.useState)("mtime"),[ex,ey]=(0,i.useState)("list"),[ef,eg]=(0,i.useState)(""),[ej,ev]=(0,i.useState)(null),[ew,eS]=(0,i.useState)([]),[eA,eb]=(0,i.useState)(!1),[eC,ek]=(0,i.useState)([]),[ez,eT]=(0,i.useState)(""),[eN,eE]=(0,i.useState)(""),[eF,eP]=(0,i.useState)(!1),[eR,eO]=(0,i.useState)([]),[eI,eB]=(0,i.useState)([]),[eW,eH]=(0,i.useState)(!1),[eD,e_]=(0,i.useState)(!1),eJ=(0,i.useRef)(null),eL=(0,i.useRef)(null),eM=async()=>{Z(!0);try{V(await R())}catch(r){t.error(e("common.error"))}finally{Z(!1)}};(0,i.useEffect)(()=>{eM()},[]),(0,i.useEffect)(()=>{let e=window.localStorage.getItem("customize-agent:prompt-view-mode");("list"===e||"card"===e)&&ey(e)},[]),(0,i.useEffect)(()=>{window.localStorage.setItem("customize-agent:prompt-view-mode",ex)},[ex]),(0,i.useEffect)(()=>{let e=eL.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),ez&&window.localStorage.setItem(ez,JSON.stringify(eC.slice(-30)))},[eC,eF,ez]),(0,i.useEffect)(()=>{!$||eR.length>0||eW||(eH(!0),D().then(eO).catch(()=>void 0).finally(()=>eH(!1)))},[$,eR.length,eW]);let eU=K.find(e=>e.isCurrent),eG=K.filter(M),eX={all:K.length,custom:K.filter(e=>"custom"===U(e)).length,current:K.filter(e=>"current"===U(e)).length,project:K.filter(e=>"project"===U(e)).length,builtin:K.filter(e=>"builtin"===U(e)).length,selected:K.filter(e=>e.selected).length,unselected:K.filter(e=>!e.selected).length,hasFile:K.filter(e=>e.hasFile).length,missingFile:K.filter(e=>!e.hasFile).length},eY=K.filter(e=>{var t;let r=U(e);return("all"===ec||r===ec)&&("selected"!==ep||!!e.selected)&&("unselected"!==ep||!e.selected)&&("hasFile"!==ep||!!e.hasFile)&&("missingFile"!==ep||!e.hasFile)&&(!ef.trim()||(t=ef.trim(),!!"".concat(e.projectName,"\n").concat(e.projectRoot||"","\n").concat(e.customizePath||"","\n").concat(e.content||"").toLowerCase().includes(t.toLowerCase())))}).sort((e,t)=>"name"===eu?e.projectName.localeCompare(t.projectName):"source"===eu?["custom","current","project","builtin"].indexOf(U(e))-["custom","current","project","builtin"].indexOf(U(t)):"selected"===eu&&Number(t.selected)-Number(e.selected)||Date.parse(t.mtime||"")-Date.parse(e.mtime||"")),eZ=eY.find(e=>e.id===ej)||eY[0]||null,eK=ew.filter(e=>eY.some(t=>t.id===e)),eV=(e,t)=>{let r="customize-agent:prompt-chat:".concat((null==e?void 0:e.id)||(null==e?void 0:e.customizePath)||t||"new");eT(r),ek(function(e){try{let t=JSON.parse(window.localStorage.getItem(e)||"[]");return Array.isArray(t)?t.filter(e=>("user"===e.role||"assistant"===e.role)&&"string"==typeof e.content).slice(-30):[]}catch(e){return[]}}(r)),eE(""),eP(!1),eB([]),e_(!1)},e$=r=>{if(null==r?void 0:r.projectRoot)return void I(r.projectRoot).then(()=>{t.success(e("common.success")),eM()}).catch(()=>t.error(e("common.error")));ee(null),es(!0),ei(""),er(""),eV(null,"new"),q(!0)},eq=async()=>{if(!el.trim())return void t.error("请输入名称");en(!0);try{Q?await O(Q.customizePath,et,M(Q)?el.trim():void 0):await B(el.trim(),et||"# ".concat(el.trim(),"\n")),t.success(e("common.success")),q(!1),await eM()}catch(r){t.error(e("common.error"))}finally{en(!1)}},eQ=async()=>{let e=Array.from(new Set([...eI,...eR.filter(e=>eN.includes("@".concat(e.relativePath))).map(e=>e.relativePath)])).slice(0,3),t=[];for(let r of e){let e=await _(r);e&&t.push({relativePath:r,content:e})}return t},e0=async()=>{let e=eN.trim();if(!e||eF)return;let r=[...eC,{role:"user",content:e}];ek(r),eE(""),e_(!1),eP(!0);try{let t=await eQ(),l=await J({name:el||(null==Q?void 0:Q.projectName)||"未命名提示词",content:et,message:e,history:eC,references:t});ek([...r,{role:"assistant",content:l.content||"AI 未返回内容"}])}catch(e){t.error(e instanceof Error?e.message:"AI 对话失败,请检查模型配置"),ek(r)}finally{eP(!1)}},e1=async(r,l)=>{let i=l?Array.from(new Set([...K.filter(e=>e.selected).map(e=>e.id),r.id])):K.filter(e=>e.selected&&e.id!==r.id).map(e=>e.id);try{await W(i),V(e=>e.map(e=>({...e,selected:i.includes(e.id)})))}catch(r){t.error(e("common.error"))}},e2=async r=>{let l=K.filter(e=>e.selected).map(e=>e.id),i=r?Array.from(new Set([...l,...eK])):l.filter(e=>!eK.includes(e));try{await W(i),V(e=>e.map(e=>({...e,selected:i.includes(e.id)}))),eS([]),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},e8=async r=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:r.projectId,filePath:r.customizePath})})).ok)throw Error("Failed");t.success(e("common.success")),eS(e=>e.filter(e=>e!==r.id)),await eM()}catch(r){t.error(e("common.error"))}},e6=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"custom",r="checked"===e?K.filter(e=>eK.includes(e.id)):"filtered"===e?eY:eG;!function(e,t){let r=new Blob([t],{type:"text/plain;charset=utf-8"}),l=URL.createObjectURL(r),i=document.createElement("a");i.href=l,i.download=e,i.click(),URL.revokeObjectURL(l)}("customize-prompts-".concat(new Date().toISOString().slice(0,10),".txt"),r.map(e=>["# Prompt: ".concat(e.projectName),"Source: ".concat(G(U(e))),"Path: ".concat(e.customizePath||"-"),"Project: ".concat(e.projectRoot||"-"),"Selected: ".concat(e.selected?"true":"false"),"Updated: ".concat(Y(e.mtime)),"",e.content||""].join("\n")).join("\n\n---\n\n")),t.success("已导出 ".concat(r.length," 条提示词"))},e4=async e=>{if(e){eb(!0);try{let r=await e.text(),l=JSON.parse(r),i=await H(l);t.success("已导入 ".concat(i.imported," 条提示词")),await eM()}catch(e){t.error("导入失败,请确认 JSON 文件格式正确")}finally{eb(!1),eJ.current&&(eJ.current.value="")}}},e7=e=>{let t=U(e);return(0,l.jsxs)(a.A,{size:4,wrap:!0,children:[(0,l.jsx)(s.A,{color:"custom"===t?"cyan":"current"===t?"green":"project"===t?"blue":"builtin"===t?"gold":"default",style:{margin:0},children:G(t)}),e.selected&&(0,l.jsx)(s.A,{color:"purple",style:{margin:0},children:"已选中"}),!e.hasFile&&(0,l.jsx)(s.A,{style:{margin:0},children:"无文件"})]})},e5=e=>(0,l.jsxs)(a.A,{size:6,children:[e.hasFile&&(0,l.jsx)(c.A,{checked:e.selected,onChange:t=>{e1(e,t.target.checked)},children:"选中"}),!e.hasFile&&e.projectRoot&&(0,l.jsx)(d.Ay,{size:"small",icon:(0,l.jsx)(w.A,{}),onClick:()=>e$(e),children:"创建"}),e.hasFile&&(0,l.jsx)(d.Ay,{size:"small",icon:(0,l.jsx)(S.A,{}),onClick:()=>(e=>{if(L(e)){let r=e.projectName.replace(/^内置|/,"")+" Copy";ee(null),es(!0),ei(r),er(e.content||""),eV(null,r),q(!0),t.info("内置提示词不可直接编辑,已为你创建副本");return}ee(e),es(!1),ei(e.projectName),er(e.content||""),eV(e,e.projectName),q(!0)})(e),children:L(e)?"复制":"编辑"}),(0,l.jsx)(p.A,{title:L(e)?"删除内置提示词?":M(e)?"删除自定义提示词?":"删除项目记录及文件?",disabled:L(e),onConfirm:()=>{e8(e)},children:(0,l.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,l.jsx)(A.A,{}),disabled:L(e)})})]});return r?(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsx)(u.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,l.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:Array.from({length:4}).map((e,t)=>(0,l.jsx)(h.A,{size:"small",children:(0,l.jsx)(u.A,{active:!0,paragraph:{rows:4}})},t))})]}):(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"pageTitle",children:e("nav.promptManagement")}),(0,l.jsx)("p",{className:"pageDesc",children:e("prompt.description")})]}),(0,l.jsxs)(a.A,{wrap:!0,children:[eU&&(0,l.jsxs)(s.A,{color:"green",style:{lineHeight:"22px"},children:[(0,l.jsx)(C.A,{})," ",eU.projectRoot]}),(0,l.jsx)("input",{ref:eJ,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:e=>{var t;e4(null==(t=e.target.files)?void 0:t[0])}}),(0,l.jsx)(d.Ay,{icon:(0,l.jsx)(k.A,{}),loading:eA,onClick:()=>{var e;return null==(e=eJ.current)?void 0:e.click()},children:"导入"}),(0,l.jsx)(d.Ay,{icon:(0,l.jsx)(z.A,{}),disabled:0===eY.length,onClick:()=>e6("filtered"),children:"导出筛选"}),(0,l.jsx)(d.Ay,{type:"primary",icon:(0,l.jsx)(w.A,{}),onClick:()=>e$(),children:"创建提示词"})]})]}),(0,l.jsxs)(h.A,{size:"small",styles:{body:{display:"flex",gap:10,flexWrap:"wrap",alignItems:"center"}},children:[(0,l.jsx)(m.A,{prefix:(0,l.jsx)(T.A,{}),allowClear:!0,placeholder:"搜索名称、内容、路径...",value:ef,onChange:e=>eg(e.target.value),style:{width:280}}),(0,l.jsx)(x.A,{value:ec,onChange:ed,style:{width:150},options:[{label:"全部 (".concat(eX.all,")"),value:"all"},{label:"我的提示词 (".concat(eX.custom,")"),value:"custom"},{label:"当前项目 (".concat(eX.current,")"),value:"current"},{label:"其他项目 (".concat(eX.project,")"),value:"project"},{label:"内置示例 (".concat(eX.builtin,")"),value:"builtin"}]}),(0,l.jsx)(x.A,{value:ep,onChange:eh,style:{width:130},options:[{label:"全部状态",value:"all"},{label:"已选中 (".concat(eX.selected,")"),value:"selected"},{label:"未选中 (".concat(eX.unselected,")"),value:"unselected"},{label:"有文件 (".concat(eX.hasFile,")"),value:"hasFile"},{label:"无文件 (".concat(eX.missingFile,")"),value:"missingFile"}]}),(0,l.jsx)(x.A,{value:eu,onChange:em,style:{width:140},options:[{label:"最近修改优先",value:"mtime"},{label:"名称 A-Z",value:"name"},{label:"来源优先",value:"source"},{label:"已选中优先",value:"selected"}]}),(0,l.jsx)(y.A,{value:ex,onChange:e=>ey(e),options:[{label:(0,l.jsx)(N.A,{}),value:"list"},{label:(0,l.jsx)(E.A,{}),value:"card"}]}),(0,l.jsx)("div",{style:{flex:1}}),(0,l.jsxs)("span",{style:{color:"var(--colorTextSecondary)",fontSize:13},children:["已显示 ",eY.length," / ",K.length]})]}),(0,l.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"190px minmax(0, 1fr) 300px",gap:14,alignItems:"start"},children:[(0,l.jsxs)(h.A,{size:"small",title:"分组导航",styles:{body:{padding:8}},children:[[["all","全部",eX.all],["custom","我的提示词",eX.custom],["current","当前项目",eX.current],["project","其他项目",eX.project],["builtin","内置示例",eX.builtin]].map(e=>{let[t,r,i]=e;return(0,l.jsxs)("button",{onClick:()=>ed(t),style:{width:"100%",border:"none",background:ec===t?"var(--colorFillSecondary)":"transparent",color:"var(--colorText)",padding:"9px 10px",borderRadius:8,display:"flex",justifyContent:"space-between",cursor:"pointer",fontWeight:ec===t?700:400},children:[(0,l.jsx)("span",{children:r}),(0,l.jsx)("span",{children:i})]},t)}),(0,l.jsx)(f.A,{style:{margin:"8px 0"}}),[["selected","已选中",eX.selected],["unselected","未选中",eX.unselected]].map(e=>{let[t,r,i]=e;return(0,l.jsxs)("button",{onClick:()=>eh(ep===t?"all":t),style:{width:"100%",border:"none",background:ep===t?"var(--colorFillSecondary)":"transparent",color:"var(--colorText)",padding:"9px 10px",borderRadius:8,display:"flex",justifyContent:"space-between",cursor:"pointer",fontWeight:ep===t?700:400},children:[(0,l.jsx)("span",{children:r}),(0,l.jsx)("span",{children:i})]},t)})]}),(0,l.jsxs)("div",{style:{minWidth:0},children:[eK.length>0&&(0,l.jsxs)(h.A,{size:"small",style:{marginBottom:12},styles:{body:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"}},children:[(0,l.jsxs)("span",{style:{fontWeight:600},children:["已选择 ",eK.length," 项"]}),(0,l.jsx)(d.Ay,{size:"small",onClick:()=>{e2(!0)},children:"批量选中"}),(0,l.jsx)(d.Ay,{size:"small",onClick:()=>{e2(!1)},children:"取消选中"}),(0,l.jsx)(d.Ay,{size:"small",icon:(0,l.jsx)(z.A,{}),onClick:()=>e6("checked"),children:"导出选中"}),(0,l.jsx)(d.Ay,{size:"small",onClick:()=>eS([]),children:"清空选择"})]}),0===eY.length?(0,l.jsx)(h.A,{children:(0,l.jsx)(g.A,{description:ef||"all"!==ep?"没有找到匹配的提示词,请尝试更换关键词或清空筛选条件":"当前分组没有提示词"})}):"list"===ex?(0,l.jsx)(a.A,{direction:"vertical",size:10,style:{width:"100%"},children:eY.map(e=>{let t=X(e,180),r=(null==eZ?void 0:eZ.id)===e.id;return(0,l.jsxs)("div",{onClick:()=>ev(e.id),style:{display:"grid",gridTemplateColumns:"28px minmax(0, 1fr) auto",gap:12,alignItems:"center",padding:14,border:"1px solid ".concat(r?"var(--colorAccent)":"var(--colorBorderSecondary)"),borderRadius:12,background:r?"var(--colorFillSecondary)":"var(--colorBgContainer)",cursor:"pointer",transition:"all .2s ease"},children:[(0,l.jsx)(c.A,{checked:ew.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eS(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,l.jsxs)("div",{style:{minWidth:0},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[(0,l.jsx)(b.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)"}}),(0,l.jsx)("span",{style:{fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.projectName}),e7(e)]}),(0,l.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:6*!!t},children:[(0,l.jsx)(C.A,{style:{marginRight:4}}),e.projectRoot||e.customizePath||"本地提示词"," \xb7 ",Y(e.mtime)]}),t&&(0,l.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.6,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"pre-wrap"},children:t})]}),(0,l.jsx)("div",{onClick:e=>e.stopPropagation(),children:e5(e)})]},e.id)})}):(0,l.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:12},children:eY.map(e=>{let t=X(e,180),r=(null==eZ?void 0:eZ.id)===e.id;return(0,l.jsxs)(h.A,{size:"small",hoverable:!0,onClick:()=>ev(e.id),style:{borderColor:r?"var(--colorAccent)":void 0},styles:{body:{display:"flex",flexDirection:"column",minHeight:210}},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,l.jsx)(c.A,{checked:ew.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eS(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,l.jsx)(b.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)"}}),(0,l.jsx)("span",{style:{fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.projectName})]}),(0,l.jsx)("div",{style:{marginBottom:8},children:e7(e)}),(0,l.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:[(0,l.jsx)(C.A,{style:{marginRight:4}}),e.projectRoot||e.customizePath||"本地提示词"]}),(0,l.jsx)("div",{style:{padding:10,background:"var(--colorFillAlter)",borderRadius:8,color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.6,minHeight:72,maxHeight:72,overflow:"hidden",whiteSpace:"pre-wrap"},children:t||"暂无内容预览"}),(0,l.jsxs)("div",{style:{marginTop:"auto",paddingTop:10,borderTop:"1px solid var(--colorBorderSecondary)",display:"flex",justifyContent:"space-between",alignItems:"center"},onClick:e=>e.stopPropagation(),children:[(0,l.jsx)("span",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:Y(e.mtime)}),e5(e)]})]},e.id)})})]}),(0,l.jsx)(h.A,{size:"small",title:"详情预览",styles:{body:{display:"flex",flexDirection:"column",gap:10}},children:eZ?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,l.jsx)(b.A,{style:{color:"var(--colorAccent)"}}),(0,l.jsx)("strong",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:eZ.projectName})]}),(0,l.jsx)("div",{children:e7(eZ)}),(0,l.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.7},children:[(0,l.jsxs)("div",{children:["更新时间:",Y(eZ.mtime)]}),(0,l.jsxs)("div",{children:["文件路径:",eZ.customizePath||"-"]}),(0,l.jsxs)("div",{children:["项目路径:",eZ.projectRoot||"-"]})]}),(0,l.jsx)("div",{style:{padding:10,borderRadius:8,background:"var(--colorFillAlter)",color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.7,maxHeight:260,overflow:"auto",whiteSpace:"pre-wrap"},children:X(eZ,1200)||"暂无内容预览"}),(0,l.jsx)("div",{children:e5(eZ)})]}):(0,l.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:"请选择一个提示词"})})]}),(0,l.jsxs)(j.A,{title:ea?"创建提示词":Q&&M(Q)?"编辑我的提示词 — ".concat(el||Q.projectName):"编辑项目提示词 — ".concat((null==Q?void 0:Q.projectName)||""),open:$,onClose:()=>q(!1),width:980,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px",display:"grid",gridTemplateRows:"minmax(320px, 1fr) 420px",gap:14,height:"100%"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,l.jsxs)(a.A,{children:[(0,l.jsx)(d.Ay,{onClick:()=>q(!1),children:e("common.cancel")}),(0,l.jsx)(d.Ay,{type:"primary",loading:eo,onClick:()=>{eq()},children:e("common.save")})]}),children:[(0,l.jsxs)("div",{style:{minHeight:0,display:"flex",flexDirection:"column"},children:[(0,l.jsx)("div",{style:{marginBottom:12},children:ea||Q&&M(Q)?(0,l.jsxs)(a.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,l.jsx)(m.A,{placeholder:"提示词名称",value:el,onChange:e=>ei(e.target.value),style:{maxWidth:520}}),!ea&&(0,l.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==Q?void 0:Q.customizePath})]}):(0,l.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==Q?void 0:Q.customizePath})}),(0,l.jsx)(m.A.TextArea,{value:et,onChange:e=>er(e.target.value),style:{flex:1,minHeight:280,fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13,resize:"none"}})]}),(0,l.jsxs)("div",{style:{minHeight:0,border:"1px solid var(--colorBorderSecondary)",borderRadius:10,background:"var(--colorBgContainer)",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 8px 24px rgba(15, 23, 42, 0.06)"},children:[(0,l.jsxs)("div",{style:{padding:"10px 12px",borderBottom:"1px solid var(--colorBorderSecondary)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,l.jsxs)(a.A,{size:6,children:[(0,l.jsx)(F.A,{style:{color:"var(--colorAccent)"}}),(0,l.jsx)("span",{style:{fontWeight:600},children:"AI 提示词助手"})]}),(0,l.jsxs)(a.A,{size:6,children:[eC.length>0&&(0,l.jsx)(d.Ay,{size:"small",onClick:()=>ek([]),children:"清空历史"}),eF?(0,l.jsx)(s.A,{color:"processing",style:{margin:0},children:"生成中"}):(0,l.jsx)(s.A,{color:"blue",style:{margin:0},children:"可对话优化"})]})]}),(0,l.jsx)("div",{ref:eL,style:{flex:1,minHeight:0,overflowY:"auto",padding:14,background:"var(--colorFillAlter)"},children:0!==eC.length||eF?(0,l.jsxs)(a.A,{direction:"vertical",size:12,style:{width:"100%"},children:[eC.map((e,r)=>{let i="user"===e.role;return(0,l.jsx)("div",{style:{display:"flex",justifyContent:i?"flex-end":"flex-start"},children:(0,l.jsxs)("div",{style:{maxWidth:"78%",padding:"10px 12px",borderRadius:12,background:i?"var(--colorFillSecondary)":"var(--colorBgContainer)",color:"var(--colorText)",border:"1px solid var(--colorBorderSecondary)",whiteSpace:"pre-wrap",lineHeight:1.7,fontSize:13,transition:"all .2s ease"},children:[e.content,!i&&(0,l.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:8},children:(0,l.jsx)(d.Ay,{size:"small",type:"primary",onClick:()=>{er(e.content),t.success("已应用到编辑内容,请确认后保存")},children:"应用"})})]})},"".concat(e.role,"-").concat(r))}),eF&&(0,l.jsx)("div",{style:{display:"flex",justifyContent:"flex-start"},children:(0,l.jsxs)("div",{style:{padding:"10px 12px",borderRadius:12,background:"var(--colorBgContainer)",border:"1px solid var(--colorBorderSecondary)",color:"var(--colorTextSecondary)",fontSize:13},children:[(0,l.jsx)(v.A,{size:"small",style:{marginRight:8}}),"AI 正在分析并生成内容..."]})})]}):(0,l.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:"输入 @ 召回知识库文件,再描述你的优化目标"})}),(0,l.jsx)(f.A,{style:{margin:0}}),(0,l.jsxs)("div",{style:{padding:12},children:[eI.length>0&&(0,l.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:eI.map(e=>(0,l.jsxs)(s.A,{closable:!0,onClose:()=>eB(t=>t.filter(t=>t!==e)),style:{margin:0,maxWidth:360,overflow:"hidden",textOverflow:"ellipsis"},children:["@",e]},e))}),eD&&(0,l.jsx)("div",{style:{maxHeight:150,overflowY:"auto",marginBottom:8,border:"1px solid var(--colorBorderSecondary)",borderRadius:8,background:"var(--colorBgContainer)"},children:eW?(0,l.jsxs)("div",{style:{padding:10,color:"var(--colorTextSecondary)",fontSize:12},children:[(0,l.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在加载知识库文件..."]}):0===eR.length?(0,l.jsx)("div",{style:{padding:10,color:"var(--colorTextSecondary)",fontSize:12},children:"暂无可召回的知识库文件"}):eR.slice(0,30).map(e=>(0,l.jsxs)("div",{onMouseDown:t=>{var r;t.preventDefault(),r=e.relativePath,eB(e=>e.includes(r)?e:[...e,r]),eE(e=>e.endsWith("@")?"".concat(e).concat(r," "):"".concat(e," @").concat(r," ")),e_(!1)},style:{padding:"8px 10px",cursor:"pointer",borderBottom:"1px solid var(--colorBorderSecondary)",fontSize:12},children:[(0,l.jsx)(b.A,{style:{marginRight:6,color:"var(--colorAccent)"}}),e.relativePath]},e.relativePath))}),(0,l.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-end"},children:[(0,l.jsx)(m.A.TextArea,{value:eN,onChange:e=>{eE(e.target.value),e_(e.target.value.endsWith("@"))},onFocus:()=>e_(eN.endsWith("@")),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),e0())},disabled:eF,placeholder:"输入 @ 召回知识库文件,再描述优化目标...",autoSize:{minRows:2,maxRows:5},style:{fontSize:13,lineHeight:1.6}}),(0,l.jsx)(d.Ay,{type:"primary",icon:(0,l.jsx)(P.A,{}),loading:eF,disabled:!eN.trim(),onClick:()=>{e0()},children:"发送"})]})]})]})]})]})}}},e=>{e.O(0,[433,787,576,195,985,525,636,593,792],()=>e(e.s=27549)),_N_E=e.O()}]);
@@ -1,3 +1,5 @@
1
+ import type { NextConfig } from 'next';
2
+
1
3
  /** 需要在服务端而非客户端打包的外部依赖(原生模块/大型库) */
2
4
  const serverExternalPackages = [
3
5
  '@customize-agent/knowledge',
@@ -14,8 +16,7 @@ const serverExternalPackages = [
14
16
  'xlsx',
15
17
  ];
16
18
 
17
- /** @type {import('next').NextConfig} */
18
- const nextConfig = {
19
+ const nextConfig: NextConfig = {
19
20
  eslint: {
20
21
  ignoreDuringBuilds: true,
21
22
  },
@@ -51,4 +52,4 @@ const nextConfig = {
51
52
  },
52
53
  };
53
54
 
54
- module.exports = nextConfig;
55
+ export default nextConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@customize-agent/server",
3
- "version": "4.0.17",
3
+ "version": "4.0.19",
4
4
  "description": "Customize Agent Web 管理控制台",
5
5
  "exports": {
6
6
  "./package.json": "./package.json"
@@ -18,7 +18,7 @@
18
18
  ".next/images-manifest.json",
19
19
  ".next/react-loadable-manifest.json",
20
20
  "public",
21
- "next.config.js",
21
+ "next.config.ts",
22
22
  "postcss.config.mjs",
23
23
  "scripts",
24
24
  "package.json"
@@ -47,6 +47,7 @@
47
47
  "react": "19.2.7",
48
48
  "react-dom": "19.2.7",
49
49
  "tesseract.js": "^7.0.0",
50
+ "typescript": "^6.0.3",
50
51
  "xlsx": "^0.18.5",
51
52
  "@customize-agent/knowledge": "^4.0.7",
52
53
  "@customize-agent/runtime": "^3.0.6",
@@ -61,8 +62,7 @@
61
62
  "@types/react-dom": "^19.0.0",
62
63
  "postcss": "^8.4.49",
63
64
  "sass": "^1.101.0",
64
- "tailwindcss": "^4.3.2",
65
- "typescript": "^6.0.3"
65
+ "tailwindcss": "^4.3.2"
66
66
  },
67
67
  "scripts": {
68
68
  "dev": "next dev -p 17321",
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[36],{7492:(t,e,r)=>{r.d(e,{A:()=>l});var n=r(97109),a=r(33460),i=r(88483);function o(){return(o=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}let l=n.forwardRef((t,e)=>n.createElement(i.A,o({},t,{ref:e,icon:a.A})))},12887:(t,e)=>{e.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},23830:(t,e)=>{e.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z"}}]},name:"folder",theme:"outlined"}},24810:(t,e,r)=>{r.d(e,{A:()=>l});var n=r(97109),a=r(31738),i=r(88483);function o(){return(o=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}let l=n.forwardRef((t,e)=>n.createElement(i.A,o({},t,{ref:e,icon:a.A})))},26631:(t,e,r)=>{r.d(e,{A:()=>l});var n=r(97109),a=r(12887),i=r(88483);function o(){return(o=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}let l=n.forwardRef((t,e)=>n.createElement(i.A,o({},t,{ref:e,icon:a.A})))},29606:(t,e,r)=>{r.d(e,{A:()=>l});var n=r(97109),a=r(23830),i=r(88483);function o(){return(o=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}let l=n.forwardRef((t,e)=>n.createElement(i.A,o({},t,{ref:e,icon:a.A})))},31738:(t,e)=>{e.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"}},33460:(t,e)=>{e.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"}}]},name:"send",theme:"outlined"}},53707:(t,e)=>{e.A={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"}},55122:(t,e,r)=>{r.d(e,{A:()=>m});var n=r(97109),a=r(3638),i=r(5045),o=r(92162),l=r(26047),d=r(74567),c=r(27273),s=r(15561),h=r(7961),f=r(10540),g=r(28403);let v=(0,f.OF)("Divider",t=>{let e=(0,g.oX)(t,{dividerHorizontalWithTextGutterMargin:t.margin,sizePaddingEdgeHorizontal:0});return[(t=>{let{componentCls:e,sizePaddingEdgeHorizontal:r,colorSplit:n,lineWidth:a,textPaddingInline:i,orientationMargin:o,verticalMarginInline:l}=t,d=`${e}-rail`;return{[e]:{...(0,h.dF)(t),borderBlockStart:`${(0,s.zA)(a)} solid ${n}`,[d]:{borderBlockStart:`${(0,s.zA)(a)} solid ${n}`},"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:l,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:`${(0,s.zA)(a)} solid ${n}`},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:`${(0,s.zA)(t.marginLG)} 0`},[`&-horizontal${e}-with-text`]:{display:"flex",alignItems:"center",margin:`${(0,s.zA)(t.dividerHorizontalWithTextGutterMargin)} 0`,color:t.colorTextHeading,fontWeight:500,fontSize:t.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:`0 ${n}`,[`${d}-start, ${d}-end`]:{width:"50%",borderBlockStartColor:"inherit",borderBlockEnd:0,content:"''"}},[`&-horizontal${e}-with-text-start`]:{[`${d}-start`]:{width:`calc(${o} * 100%)`},[`${d}-end`]:{width:`calc(100% - ${o} * 100%)`}},[`&-horizontal${e}-with-text-end`]:{[`${d}-start`]:{width:`calc(100% - ${o} * 100%)`},[`${d}-end`]:{width:`calc(${o} * 100%)`}},[`${e}-inner-text`]:{display:"inline-block",paddingBlock:0,paddingInline:i},"&-dashed":{background:"none",borderColor:n,borderStyle:"dashed",borderWidth:`${(0,s.zA)(a)} 0 0`,[d]:{borderBlockStart:`${(0,s.zA)(a)} dashed ${n}`}},[`&-horizontal${e}-with-text${e}-dashed`]:{[`${d}-start, ${d}-end`]:{borderStyle:"dashed none none"}},[`&-vertical${e}-dashed`]:{borderInlineStartWidth:a,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},"&-dotted":{background:"none",borderColor:n,borderStyle:"dotted",borderWidth:`${(0,s.zA)(a)} 0 0`,[d]:{borderBlockStart:`${(0,s.zA)(a)} dotted ${n}`}},[`&-horizontal${e}-with-text${e}-dotted`]:{"&::before, &::after":{borderStyle:"dotted none none"}},[`&-vertical${e}-dotted`]:{borderInlineStartWidth:a,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},[`&-plain${e}-with-text`]:{color:t.colorText,fontWeight:"normal",fontSize:t.fontSize},[`&-horizontal${e}-with-text-start${e}-no-default-orientation-margin-start`]:{[`${d}-start`]:{width:0},[`${d}-end`]:{width:"100%"},[`${e}-inner-text`]:{paddingInlineStart:r}},[`&-horizontal${e}-with-text-end${e}-no-default-orientation-margin-end`]:{[`${d}-start`]:{width:"100%"},[`${d}-end`]:{width:0},[`${e}-inner-text`]:{paddingInlineEnd:r}}}}})(e),(t=>{let{componentCls:e}=t;return{[e]:{"&-horizontal":{[`&${e}`]:{"&-sm":{marginBlock:t.marginXS},"&-md":{marginBlock:t.margin}}}}}})(e)]},t=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:t.marginXS}),{unitless:{orientationMargin:!0}}),$=["left","right","center","start","end"],m=t=>{let{getPrefixCls:e,direction:r,className:s,style:h,classNames:f,styles:g}=(0,d.TP)("divider"),{prefixCls:m,type:b,orientation:u,vertical:p,titlePlacement:z,orientationMargin:w,className:A,rootClassName:y,children:x,dashed:O,variant:M="solid",plain:S,style:k,size:E,classNames:B,styles:H,...j}=t,I=e("divider",m),V=`${I}-rail`,[P,L]=v(I),N=(0,c.A)(E),W=!!x,C=$.includes(u||""),R=n.useMemo(()=>{let t=z??(C?u:"center");return"left"===t?"rtl"===r?"end":"start":"right"===t?"rtl"===r?"start":"end":t},[r,u,z,C]),T="start"===R&&null!=w,G="end"===R&&null!=w,[_,F]=(0,i.M)(u,p,b),X={...t,orientation:_,titlePlacement:R,size:N},[D,q]=(0,o.AV)([f,B],[g,H],{props:X}),J=(0,a.$)(I,s,P,L,`${I}-${_}`,{[`${I}-with-text`]:W,[`${I}-with-text-${R}`]:W,[`${I}-dashed`]:!!O,[`${I}-${M}`]:"solid"!==M,[`${I}-plain`]:!!S,[`${I}-rtl`]:"rtl"===r,[`${I}-no-default-orientation-margin-start`]:T,[`${I}-no-default-orientation-margin-end`]:G,[`${I}-md`]:"medium"===N||"middle"===N,[`${I}-sm`]:"small"===N,[V]:!x,[D.rail]:D.rail&&!x},A,y,D.root),K=n.useMemo(()=>(0,l.Et)(w)?w:/^\d+$/.test(w)?Number(w):w,[w]);return n.createElement("div",{className:J,style:{...h,...q.root,...x?{}:q.rail,...k},...j,role:"separator"},x&&!F&&n.createElement(n.Fragment,null,n.createElement("div",{className:(0,a.$)(V,`${V}-start`,D.rail),style:q.rail}),n.createElement("span",{className:(0,a.$)(`${I}-inner-text`,D.content),style:{marginInlineStart:T?K:void 0,marginInlineEnd:G?K:void 0,...q.content}},x),n.createElement("div",{className:(0,a.$)(V,`${V}-end`,D.rail),style:q.rail})))}},81668:(t,e,r)=>{r.d(e,{A:()=>l});var n=r(97109),a=r(96724),i=r(88483);function o(){return(o=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}let l=n.forwardRef((t,e)=>n.createElement(i.A,o({},t,{ref:e,icon:a.A})))},96091:(t,e,r)=>{r.d(e,{A:()=>l});var n=r(97109),a=r(53707),i=r(88483);function o(){return(o=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}let l=n.forwardRef((t,e)=>n.createElement(i.A,o({},t,{ref:e,icon:a.A})))},96724:(t,e)=>{e.A={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"}}]},name:"export",theme:"outlined"}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{27549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(34508)}])},34508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>_});var o=r(65321),i=r(97109),n=r(79059),l=r(17807),a=r(88762),s=r(68787),c=r(33442),d=r(11702),p=r(57271),h=r(85114),x=r(84253),m=r(56985),y=r(26171),u=r(34052),f=r(7576),g=r(42700),j=r(55122),v=r(29606),S=r(96091),A=r(81668),w=r(54746),b=r(26631),C=r(99650),k=r(58209),z=r(24810),T=r(7492);async function E(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function N(e,t,r){let o=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t,name:r})});if(!o.ok)throw Error("Failed");return o.json()}async function O(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function R(e,t){let r=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function I(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"select",selectedIds:e})});if(!t.ok)throw Error("Failed");return t.json()}async function F(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"import",...e&&"object"==typeof e?e:{prompts:[]}})});if(!t.ok)throw Error(await t.text());return t.json()}async function B(e){let t=await fetch("/api/prompt/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.text();try{let t=JSON.parse(e);throw Error(t.error||t.message||e||"AI 对话失败")}catch(t){throw Error(e||"AI 对话失败")}}return t.json()}function P(e){return e.id.startsWith("builtin:")}function H(e){return e.id.startsWith("custom:")}function _(){let e=(0,n.Vr)(),{message:t}=l.A.useApp(),[r,_]=(0,i.useState)(!0),[J,D]=(0,i.useState)([]),[W,L]=(0,i.useState)(!1),[M,U]=(0,i.useState)(null),[X,G]=(0,i.useState)(""),[K,V]=(0,i.useState)(""),[Y,Z]=(0,i.useState)(!1),[$,q]=(0,i.useState)(!1),[Q,ee]=(0,i.useState)("custom"),[et,er]=(0,i.useState)(!1),[eo,ei]=(0,i.useState)([]),[en,el]=(0,i.useState)(""),[ea,es]=(0,i.useState)(!1),ec=(0,i.useRef)(null),ed=(0,i.useRef)(null),ep=async()=>{_(!0);try{D(await E())}catch(r){t.error(e("common.error"))}finally{_(!1)}};(0,i.useEffect)(()=>{ep()},[]),(0,i.useEffect)(()=>{let e=ed.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[eo,ea]);let eh=()=>{ei([]),el(""),es(!1)},ex=r=>{if(eh(),null==r?void 0:r.projectRoot)return void O(r.projectRoot).then(()=>{t.success(e("common.success")),ep()}).catch(()=>t.error(e("common.error")));U(null),q(!0),V(""),G(""),L(!0)},em=async()=>{if(!K.trim())return void t.error("请输入名称");Z(!0);try{M?await N(M.customizePath,X,H(M)?K.trim():void 0):await R(K.trim(),X||"# ".concat(K.trim(),"\n")),t.success(e("common.success")),L(!1),await ep()}catch(r){t.error(e("common.error"))}finally{Z(!1)}},ey=async()=>{let e=en.trim();if(!e||ea)return;let r=[...eo,{role:"user",content:e}];ei(r),el(""),es(!0);try{let t=await B({name:K||(null==M?void 0:M.projectName)||"未命名提示词",content:X,message:e,history:eo});ei([...r,{role:"assistant",content:t.content||"AI 未返回内容"}])}catch(e){t.error(e instanceof Error?e.message:"AI 对话失败,请检查模型配置"),ei(r)}finally{es(!1)}},eu=async(r,o)=>{let i=o?Array.from(new Set([...J.filter(e=>e.selected).map(e=>e.id),r.id])):J.filter(e=>e.selected&&e.id!==r.id).map(e=>e.id);try{await I(i),D(e=>e.map(e=>({...e,selected:i.includes(e.id)})))}catch(r){t.error(e("common.error"))}},ef=async r=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:r.projectId,filePath:r.customizePath})})).ok)throw Error("Failed");t.success(e("common.success")),await ep()}catch(r){t.error(e("common.error"))}},eg=async e=>{if(e){er(!0);try{let r=await e.text(),o=JSON.parse(r),i=await F(o);t.success("已导入 ".concat(i.imported," 条提示词")),await ep()}catch(e){t.error("导入失败,请确认 JSON 文件格式正确")}finally{er(!1),ec.current&&(ec.current.value="")}}},ej=J.find(e=>e.isCurrent),ev=J.filter(P),eS=J.filter(H),eA=J.filter(e=>!P(e)&&!H(e)),ew="all"===Q?J:"builtin"===Q?ev:"custom"===Q?eS:eA;return r?(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsx)(a.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:Array.from({length:4}).map((e,t)=>(0,o.jsx)(s.A,{size:"small",children:(0,o.jsx)(a.A,{active:!0,paragraph:{rows:4}})},t))})]}):(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.promptManagement")}),(0,o.jsx)("p",{className:"pageDesc",children:e("prompt.description")})]}),(0,o.jsxs)(c.A,{children:[ej&&(0,o.jsxs)(d.A,{color:"green",style:{lineHeight:"22px"},children:[(0,o.jsx)(v.A,{})," ",ej.projectRoot]}),(0,o.jsx)(p.A,{value:Q,onChange:ee,style:{width:160},options:[{label:"全部 (".concat(J.length,")"),value:"all"},{label:"我的提示词 (".concat(eS.length,")"),value:"custom"},{label:"项目提示词 (".concat(eA.length,")"),value:"project"},{label:"内置示例 (".concat(ev.length,")"),value:"builtin"}]}),(0,o.jsx)("input",{ref:ec,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:e=>{var t;eg(null==(t=e.target.files)?void 0:t[0])}}),(0,o.jsx)(h.Ay,{icon:(0,o.jsx)(S.A,{}),loading:et,onClick:()=>{var e;return null==(e=ec.current)?void 0:e.click()},children:"导入"}),(0,o.jsx)(h.Ay,{icon:(0,o.jsx)(A.A,{}),disabled:0===eS.length,onClick:()=>{let e=eS.map(e=>({name:e.projectName,content:e.content,selected:e.selected}));!function(e,t){let r=new Blob([JSON.stringify(t,null,2)],{type:"application/json;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=e,i.click(),URL.revokeObjectURL(o)}("customize-prompts-".concat(new Date().toISOString().slice(0,10),".json"),{version:1,exportedAt:new Date().toISOString(),prompts:e}),t.success("已导出 ".concat(e.length," 条我的提示词"))},children:"导出"}),(0,o.jsx)(h.Ay,{type:"primary",icon:(0,o.jsx)(w.A,{}),onClick:()=>ex(),children:"创建提示词"})]})]}),0===ew.length?(0,o.jsx)(x.A,{description:e("prompt.noProjects")}):(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:ew.map(e=>{let r=e.hasFile&&e.content?e.content.replace(/^#.*$/gm,"").replace(/\n{3,}/g,"\n\n").trim():"";return(0,o.jsxs)(s.A,{size:"small",hoverable:!0,styles:{body:{display:"flex",flexDirection:"column",height:"100%"}},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[(0,o.jsx)(b.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)",fontSize:14,flexShrink:0}}),(0,o.jsx)("span",{style:{fontWeight:600,fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.projectName}),!e.hasFile&&e.projectRoot&&(0,o.jsx)(h.Ay,{size:"small",icon:(0,o.jsx)(w.A,{}),onClick:()=>ex(e)})]}),e.projectRoot&&(0,o.jsxs)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:6,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[(0,o.jsx)(v.A,{style:{marginRight:4}}),e.projectRoot]}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:[e.isCurrent&&(0,o.jsx)(d.A,{color:"green",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"当前项目"}),P(e)&&(0,o.jsx)(d.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"内置示例"}),H(e)&&(0,o.jsx)(d.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的提示词"}),!P(e)&&!H(e)&&(0,o.jsx)(d.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"项目提示词"}),e.selected&&(0,o.jsx)(d.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"已选中"}),e.hasFile?(0,o.jsx)(d.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"有文件"}):(0,o.jsx)(d.A,{color:"default",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"无文件"})]}),r&&(0,o.jsxs)("div",{style:{padding:8,background:"var(--colorFillAlter)",borderRadius:6,fontSize:11,maxHeight:80,overflow:"hidden",color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap",fontFamily:"monospace",marginBottom:8,lineHeight:1.5},children:[r.slice(0,180),r.length>180?"...":""]}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,paddingTop:8,borderTop:"1px solid var(--colorBorderSecondary)",marginTop:"auto"},children:[e.hasFile?(0,o.jsx)(m.A,{checked:e.selected,onChange:t=>{eu(e,t.target.checked)},style:{fontSize:12},children:"选中"}):(0,o.jsx)("span",{}),(0,o.jsx)("div",{style:{flex:1}}),e.hasFile&&(0,o.jsx)(h.Ay,{size:"small",icon:(0,o.jsx)(C.A,{}),onClick:()=>(e=>{if(eh(),P(e)){U(null),q(!0),V(e.projectName.replace(/^内置|/,"")+" Copy"),G(e.content||""),L(!0),t.info("内置提示词不可直接编辑,已为你创建副本");return}U(e),q(!1),V(e.projectName),G(e.content||""),L(!0)})(e),children:P(e)?"复制":"编辑"}),(0,o.jsx)(y.A,{title:P(e)?"删除内置提示词?":H(e)?"删除自定义提示词?":"删除项目记录及文件?",disabled:P(e),onConfirm:()=>{ef(e)},children:(0,o.jsx)(h.Ay,{size:"small",danger:!0,icon:(0,o.jsx)(k.A,{}),disabled:P(e)})})]})]},e.id)})}),(0,o.jsxs)(u.A,{title:$?"创建提示词":M&&H(M)?"编辑我的提示词 — ".concat(K||M.projectName):"编辑项目提示词 — ".concat((null==M?void 0:M.projectName)||""),open:W,onClose:()=>L(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px",display:"flex",flexDirection:"column",gap:12,height:"100%"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,o.jsxs)(c.A,{children:[(0,o.jsx)(h.Ay,{onClick:()=>L(!1),children:e("common.cancel")}),(0,o.jsx)(h.Ay,{type:"primary",loading:Y,onClick:()=>{em()},children:e("common.save")})]}),children:[(0,o.jsxs)("div",{style:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column"},children:[(0,o.jsx)("div",{style:{marginBottom:12},children:$||M&&H(M)?(0,o.jsxs)(c.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,o.jsx)(f.A,{placeholder:"提示词名称",value:K,onChange:e=>V(e.target.value),style:{maxWidth:400}}),!$&&(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==M?void 0:M.customizePath})]}):(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==M?void 0:M.customizePath})}),(0,o.jsx)(f.A.TextArea,{value:X,onChange:e=>G(e.target.value),style:{flex:1,minHeight:280,fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13,resize:"none"}})]}),(0,o.jsxs)("div",{style:{flex:"0 0 300px",border:"1px solid var(--colorBorderSecondary)",borderRadius:10,background:"var(--colorBgContainer)",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 8px 24px rgba(15, 23, 42, 0.06)"},children:[(0,o.jsxs)("div",{style:{padding:"10px 12px",borderBottom:"1px solid var(--colorBorderSecondary)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,o.jsxs)(c.A,{size:6,children:[(0,o.jsx)(z.A,{style:{color:"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:600},children:"AI 提示词助手"})]}),ea?(0,o.jsx)(d.A,{color:"processing",style:{margin:0},children:"生成中"}):(0,o.jsx)(d.A,{color:"blue",style:{margin:0},children:"可对话优化"})]}),(0,o.jsx)("div",{ref:ed,style:{flex:1,minHeight:0,overflowY:"auto",padding:12,background:"var(--colorFillAlter)"},children:0!==eo.length||ea?(0,o.jsxs)(c.A,{direction:"vertical",size:10,style:{width:"100%"},children:[eo.map((e,r)=>{let i="user"===e.role;return(0,o.jsx)("div",{style:{display:"flex",justifyContent:i?"flex-end":"flex-start"},children:(0,o.jsxs)("div",{style:{maxWidth:"88%",padding:"8px 10px",borderRadius:10,background:i?"var(--colorAccent)":"var(--colorBgContainer)",color:i?"#fff":"var(--colorText)",border:i?"none":"1px solid var(--colorBorderSecondary)",whiteSpace:"pre-wrap",lineHeight:1.6,fontSize:13,transition:"all .2s ease"},children:[e.content,!i&&(0,o.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:8},children:(0,o.jsx)(h.Ay,{size:"small",type:"primary",onClick:()=>{G(e.content),t.success("已应用到编辑内容,请确认后保存")},children:"应用"})})]})},"".concat(e.role,"-").concat(r))}),ea&&(0,o.jsx)("div",{style:{display:"flex",justifyContent:"flex-start"},children:(0,o.jsxs)("div",{style:{padding:"8px 10px",borderRadius:10,background:"var(--colorBgContainer)",border:"1px solid var(--colorBorderSecondary)",color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(g.A,{size:"small",style:{marginRight:8}}),"AI 正在分析并生成内容..."]})})]}):(0,o.jsx)(x.A,{image:x.A.PRESENTED_IMAGE_SIMPLE,description:"输入你的修改目标,例如:帮我变得更适合事实抽取"})}),(0,o.jsx)(j.A,{style:{margin:0}}),(0,o.jsxs)("div",{style:{padding:10,display:"flex",gap:8,alignItems:"flex-end"},children:[(0,o.jsx)(f.A.TextArea,{value:en,onChange:e=>el(e.target.value),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),ey())},disabled:ea,placeholder:"向 AI 描述你想怎么优化这个提示词...",autoSize:{minRows:1,maxRows:3}}),(0,o.jsx)(h.Ay,{type:"primary",icon:(0,o.jsx)(T.A,{}),loading:ea,disabled:!en.trim(),onClick:()=>{ey()},children:"发送"})]})]})]})]})}}},e=>{e.O(0,[433,787,576,195,985,36,636,593,792],()=>e(e.s=27549)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- self.__BUILD_MANIFEST=function(s,e,t,c,a,n,d,i,u,o,r,f,k,g,h,l,b){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:g,bitArray:[]},__routerFilterDynamic:{numItems:u,errorRate:1e-4,numBits:u,numHashes:g,bitArray:[]},"/":["static/chunks/pages/index-c5e0758e6b31deee.js"],"/_error":["static/chunks/pages/_error-282257fbdcc167b4.js"],"/asset-library":[s,e,n,"static/chunks/749-dcb0cd85d1455f34.js","static/chunks/pages/asset-library-e9ddfe1cbaac42d9.js"],"/context/long-term":[s,e,t,c,a,n,d,i,h,"static/chunks/pages/context/long-term-2e6a30a8f879df47.js"],"/context/short-term":[s,e,t,c,a,n,d,i,h,"static/chunks/pages/context/short-term-730211234fa3add6.js"],"/document-roles":[s,e,t,c,d,"static/chunks/698-625f34d5d0052e87.js","static/chunks/pages/document-roles-7197641736843503.js"],"/document-specs":[s,e,t,c,d,r,"static/chunks/265-c3a46cef96364aac.js","static/chunks/pages/document-specs-033d848b03b54df3.js"],"/documents":[s,e,t,c,d,o,l,"static/chunks/447-772df02993a8609b.js","static/chunks/pages/documents-3b2f23e2d6b27f1b.js"],"/guide":[s,e,l,"static/chunks/20-23d24b40b69faf0f.js","static/chunks/pages/guide-cdf68a096918c979.js"],"/knowledge":["static/chunks/pages/knowledge-905248d8dcb15453.js"],"/knowledge/file-detail":[s,e,t,a,n,i,o,b,f,"static/chunks/pages/knowledge/file-detail-0a5e267f77f4e8b3.js"],"/knowledge/files":[s,e,t,a,n,i,f,"static/chunks/pages/knowledge/files-a1727a21113f99cd.js"],"/knowledge/manage":[s,e,o,"static/chunks/788-f74cda5d27cf4390.js","static/chunks/pages/knowledge/manage-25eb1a993b155450.js"],"/knowledge/search":[s,e,t,o,r,f,"static/chunks/pages/knowledge/search-2cee4e8b8792170c.js"],"/models":[s,e,t,c,a,d,r,"static/chunks/pages/models-b5f68c4c70257495.js"],"/overview":[s,e,"static/chunks/131-96749f5b6e1460d1.js","static/chunks/pages/overview-28c7ceeca56e6a78.js"],"/prompt":[s,e,t,c,a,"static/chunks/36-205281971ae6919f.js","static/chunks/pages/prompt-31107707a8e8d33c.js"],"/settings":[s,e,"static/chunks/pages/settings-fa9d6a56898ba678.js"],"/system/logs":[s,t,c,a,n,i,b,"static/chunks/pages/system/logs-f4e222140dc7b30c.js"],sortedPages:["/","/_app","/_error","/asset-library","/context/long-term","/context/short-term","/document-roles","/document-specs","/documents","/guide","/knowledge","/knowledge/file-detail","/knowledge/files","/knowledge/manage","/knowledge/search","/models","/overview","/prompt","/settings","/system/logs"]}}("static/chunks/433-ef3d7675b81826a9.js","static/chunks/787-196a2bed7b11745a.js","static/chunks/576-679ab6348b33b960.js","static/chunks/195-9f2e4c67a9deff05.js","static/chunks/985-da0b1f68e59d1e76.js","static/chunks/150-a7b953a600cbd7e0.js","static/chunks/455-9e1e1c7e96845347.js","static/chunks/289-36c210992d5009d5.js",0,"static/chunks/506-b97aadd3e451b379.js","static/chunks/938-0063785681203bb5.js","static/css/09be1fdeab8595ab.css",1e-4,NaN,"static/chunks/932-823e1ae10dd43b8b.js","static/chunks/412-b9c854c6a76db67d.js","static/chunks/512-e2813c7e9454d53c.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();