@customize-agent/server 4.1.7 → 4.1.9

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 (36) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/chunks/1924.js +85 -72
  5. package/.next/server/chunks/5840.js +1 -1
  6. package/.next/server/chunks/8203.js +1 -1
  7. package/.next/server/chunks/8661.js +3 -3
  8. package/.next/server/middleware-build-manifest.js +1 -1
  9. package/.next/server/pages/404.html +1 -1
  10. package/.next/server/pages/500.html +1 -1
  11. package/.next/server/pages/api/documents/export.js +4 -4
  12. package/.next/server/pages/api/kb/evaluate.js +10 -0
  13. package/.next/server/pages/api/kb/evaluate.js.nft.json +1 -0
  14. package/.next/server/pages/api/kb/files/reindex.js +1 -1
  15. package/.next/server/pages/asset-library.html +1 -1
  16. package/.next/server/pages/document-roles.html +1 -1
  17. package/.next/server/pages/documents.html +1 -1
  18. package/.next/server/pages/guide.html +1 -1
  19. package/.next/server/pages/index.html +1 -1
  20. package/.next/server/pages/knowledge/file-detail.html +1 -1
  21. package/.next/server/pages/knowledge/files.html +1 -1
  22. package/.next/server/pages/knowledge/manage.html +1 -1
  23. package/.next/server/pages/knowledge.html +1 -1
  24. package/.next/server/pages/models.html +1 -1
  25. package/.next/server/pages/overview.html +1 -1
  26. package/.next/server/pages/prompt.html +1 -1
  27. package/.next/server/pages/settings.html +1 -1
  28. package/.next/server/pages/system/logs.html +1 -1
  29. package/.next/server/pages-manifest.json +35 -34
  30. package/.next/static/{nK9OeE3ShyoUYlQv98vDl → 36CQbX6U97QG4cfpNGQMs}/_buildManifest.js +1 -1
  31. package/.next/static/chunks/pages/knowledge/files-3b5d049efb076e4b.js +1 -0
  32. package/package.json +13 -13
  33. package/scripts/kb-index-worker.cjs +9 -7
  34. package/.next/package.json +0 -1
  35. package/.next/static/chunks/pages/knowledge/files-1717b23d66330620.js +0 -1
  36. /package/.next/static/{nK9OeE3ShyoUYlQv98vDl → 36CQbX6U97QG4cfpNGQMs}/_ssgManifest.js +0 -0
@@ -86,14 +86,16 @@ async function main() {
86
86
  error: progress.vectorStatus?.error,
87
87
  });
88
88
 
89
- let diff = job.relativePath
90
- ? await project.reindexFile(job.relativePath, { vectorMode: job.vectorMode, onProgress })
91
- : job.forceReindexAll
92
- ? await project.forceReindexAll({ vectorMode: job.vectorMode, onProgress })
93
- : await project.consumePendingIndexJobs({ vectorMode: job.vectorMode, onProgress, waitForUploadId: job.uploadOperationId });
89
+ let diff = job.relativePaths?.length
90
+ ? await project.incrementalIndex({ vectorMode: job.vectorMode, onProgress, onlyRelativePaths: job.relativePaths })
91
+ : job.relativePath
92
+ ? await project.reindexFile(job.relativePath, { vectorMode: job.vectorMode, onProgress })
93
+ : job.forceReindexAll
94
+ ? await project.forceReindexAll({ vectorMode: job.vectorMode, onProgress })
95
+ : await project.consumePendingIndexJobs({ vectorMode: job.vectorMode, onProgress, waitForUploadId: job.uploadOperationId });
94
96
 
95
97
  let idleChecks = 0;
96
- while (!job.relativePath && (project.countPendingIndexJobs() > 0 || (job.uploadOperationId && project.uploadSessionIsOpen(job.uploadOperationId) && idleChecks < 120))) {
98
+ while (!job.relativePath && !job.relativePaths?.length && (project.countPendingIndexJobs() > 0 || (job.uploadOperationId && project.uploadSessionIsOpen(job.uploadOperationId) && idleChecks < 120))) {
97
99
  if (project.countPendingIndexJobs() === 0) {
98
100
  idleChecks += 1;
99
101
  await new Promise(resolve => setTimeout(resolve, 1000));
@@ -124,7 +126,7 @@ async function main() {
124
126
  process.exitCode = 1;
125
127
  return;
126
128
  }
127
- upsert(projectRoot, { id: operationId, type: operationType, title: operationTitle, stage: 'done', status: 'success', percent: 100, message: job.relativePath ? '单文件重新解析完成' : '知识库后台索引完成', filePath: job.relativePath, fileName: job.relativePath ? path.basename(job.relativePath) : undefined });
129
+ upsert(projectRoot, { id: operationId, type: operationType, title: operationTitle, stage: 'done', status: 'success', percent: 100, message: job.relativePaths?.length ? '文件夹重新解析完成' : job.relativePath ? '单文件重新解析完成' : '知识库后台索引完成', filePath: job.relativePath, fileName: job.relativePath ? path.basename(job.relativePath) : undefined });
128
130
  }
129
131
 
130
132
  main().catch(error => {
@@ -1 +0,0 @@
1
- {"type": "commonjs"}
@@ -1 +0,0 @@
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"}},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,r)=>{"use strict";r.d(t,{A:()=>b});var l=r(51541),a=r(61848),n=r(5669),s=r(97109),i=r(72658),o=r(3638),c=r(92162),d=r(82725),u=r(74567),h=r(632),f=r(49517),m=r(79412),v=r(19527);let p=(0,d.U)(e=>{let{prefixCls:t,className:r,closeIcon:l,closable:a,type:n,title:d,children:p,footer:g,classNames:x,styles:y,...b}=e,{getPrefixCls:w}=s.useContext(u.QO),{className:j,style:_,classNames:A,styles:z}=(0,u.TP)("modal"),k=w(),C=t||w("modal"),S=(0,h.A)(k),[P,M]=(0,v.Ay)(C,S),[N,O]=(0,c.AV)([A,x],[z,y],{props:e}),H=`${C}-confirm`,T={};return T=n?{closable:a??!1,title:"",footer:"",children:s.createElement(f.k,{...e,prefixCls:C,confirmPrefixCls:H,rootPrefixCls:k,content:p})}:{closable:a??!0,title:d,footer:null!==g&&s.createElement(m.w,{...e}),children:p},s.createElement(i.Z,{prefixCls:C,className:(0,o.$)(P,`${C}-pure-panel`,n&&H,n&&`${H}-${n}`,r,j,M,S,N.root),style:{..._,...O.root},...b,closeIcon:(0,m.O)(C,l),closable:a,classNames:N,styles:O,...T})});var g=r(99739);function x(e){return(0,l.Ay)((0,l.fp)(e))}let y=n.A;y.useModal=g.A,y.info=function(e){return(0,l.Ay)((0,l.$D)(e))},y.success=function(e){return(0,l.Ay)((0,l.Ej)(e))},y.error=function(e){return(0,l.Ay)((0,l.jT)(e))},y.warning=x,y.warn=x,y.confirm=function(e){return(0,l.Ay)((0,l.lr)(e))},y.destroyAll=function(){for(;a.A.length;){let e=a.A.pop();e&&e()}},y.config=l.FB,y._InternalPanelDoNotUseOrYouWillBeFired=p;let b=y},26619:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(1611),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))},26631:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(12887),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.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"}},35311:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M456 231a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"more",theme:"outlined"}},45551:(e,t,r)=>{"use strict";function l(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),r=e/Math.pow(1024,t);return"".concat(r.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let r=Math.floor(Math.floor((Date.now()-e)/1e3)/60),l=Math.floor(r/60),a=Math.floor(l/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):l>0?"".concat(l,"h ago"):r>0?"".concat(r,"m ago"):"Just now":a>0?"".concat(a," 天前"):l>0?"".concat(l," 小时前"):r>0?"".concat(r," 分钟前"):"刚刚"}r.d(t,{Jm:()=>i,fw:()=>a,z3:()=>l});let n={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},s={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function i(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===r?s:n)[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"}},54746:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(71242),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))},58209:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(23793),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.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,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(30289),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))},64207:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>ee});var l=r(65321),a=r(97109),n=r(48321),s=r(43220),i=r.n(s),o=r(86109),c=r(17807),d=r(25258),u=r(11702),h=r(71102),f=r(85114),m=r(7576),v=r(50883),p=r(33442),g=r(21289),x=r(56768),y=r(48893),b=r(88483);function w(){return(w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let j=a.forwardRef((e,t)=>a.createElement(b.A,w({},e,{ref:t,icon:y.A})));var _=r(13067);function A(){return(A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let z=a.forwardRef((e,t)=>a.createElement(b.A,A({},e,{ref:t,icon:_.A})));var k=r(58520);function C(){return(C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let S=a.forwardRef((e,t)=>a.createElement(b.A,C({},e,{ref:t,icon:k.A})));var P=r(90939);function M(){return(M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let N=a.forwardRef((e,t)=>a.createElement(b.A,M({},e,{ref:t,icon:P.A})));var O=r(93314),H=r(61825),T=r(26619),E=r(7225),F=r(26631),V=r(64254),B=r(64629),I=r(58209),R=r(85855),L=r(30486),D=r(54746),q=r(84742),$=r(38762),J=r(39219),Q=r(22931),U=r(6578),W=r(45551),X=r(14569),G=r.n(X);let K=["document","spreadsheet","image","cad","code","data","web","diagram","other"],Z=/\.(zip|jar|war|apk|tar|gz|tgz|bz2|rar|7z)$/iu,Y=/(^|\/)\.DS_Store$|(^|\/)Thumbs\.db$|(^|\/)__MACOSX\/|\.bak$/iu;function ee(){let e=(0,n.Vr)("knowledge"),{locale:t}=(0,n.x_)(),{message:r}=c.A.useApp(),s=(0,o.useRouter)(),y="string"==typeof s.query.category?s.query.category:"",[b,w]=(0,a.useState)([]),[_,A]=(0,a.useState)(!1),[k,C]=(0,a.useState)(""),[P,M]=(0,a.useState)(""),[X,ee]=(0,a.useState)(y),[et,er]=(0,a.useState)(!1),[el,ea]=(0,a.useState)(!1),[en,es]=(0,a.useState)([]),[ei,eo]=(0,a.useState)([]),[ec,ed]=(0,a.useState)([]),eu=(0,a.useRef)(X);(0,a.useEffect)(()=>{eu.current=X},[X]),(0,a.useEffect)(()=>{ee("string"==typeof s.query.category?s.query.category:"")},[s.query.category]);let eh=(0,a.useCallback)(async(e,t)=>{let r=null!=e?e:eu.current;(null==t?void 0:t.silent)||(A(!0),C(""));try{let e=await (0,U.HT)({category:r||void 0,limit:5e3});w(e.files||[]),e.initializing&&window.setTimeout(()=>{eh(r,{silent:!0})},3e3)}catch(e){(null==t?void 0:t.silent)||(w([]),C(e instanceof Error?e.message:"文件列表加载失败"))}finally{(null==t?void 0:t.silent)||A(!1)}},[]);(0,a.useEffect)(()=>{eh(X)},[X,eh]);let ef=e=>"document"===e.type?null:{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},em=(0,a.useCallback)(async()=>{try{let e=(await (0,U.Qx)()).operations.map(ef).filter(e=>!!e);es(t=>{let r=new Set(e.map(e=>e.id).filter(Boolean)),l=e.map(e=>{var r;let l=t.find(t=>t.id===e.id);return l?{...l,...e,createdAt:null!=(r=l.createdAt)?r:e.createdAt}:e}),a=t.filter(e=>e.id&&!r.has(e.id)&&"processing"===e.status);return[...l,...a].slice(0,50)})}catch(e){}},[]),ev=(0,a.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];es(r=>{let l=r.findIndex(r=>e.id&&r.id===e.id||t.includes(r.title));if(l>=0){var a;let t=[...r];return t[l]={...r[l],...e,createdAt:null!=(a=r[l].createdAt)?a:e.createdAt},t}return[e,...r].slice(0,50)})},[]);(0,a.useEffect)(()=>{em()},[em]);let ep=(0,a.useMemo)(()=>{let e=0,t=0,r=0;for(let l of en)"processing"===l.status?e++:"success"===l.status?t++:("error"===l.status||"warning"===l.status)&&r++;return{processing:e,success:t,error:r}},[en]);(0,a.useEffect)(()=>{if(0===ep.processing)return;let e=window.setInterval(()=>{em()},2e3),t=window.setInterval(()=>{eh(void 0,{silent:!0})},8e3);return()=>{window.clearInterval(e),window.clearInterval(t)}},[eh,em,ep.processing]);let eg=async e=>{let t=e.filter(e=>{let t=e.webkitRelativePath||e.name;return e.size>0&&!Z.test(e.name)&&!Y.test(t)}),l=e.length-t.length;if(l>0&&r.warning("已跳过 ".concat(l," 个空文件、系统文件、备份文件或压缩包")),0===t.length)return;let a=1===t.length?t[0].name:"".concat(t.length," 个文件");er(!0);let n="".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2));ev({id:n,type:"upload",title:"上传 ".concat(a),description:"等待上传、解析、切片和入库;同路径文件会更新,其他已有文件不会清除",status:"processing",percent:5});try{await (0,U.c1)(t,void 0,n,e=>{ev({id:n,type:"upload",title:"上传 ".concat(a),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)))})}),r.info("文件已上传,正在后台解析、切片和入库;同路径文件会更新,其他已有文件不会清除,可在顶部“后台任务”查看进度"),M(""),ee(""),eo([]),eu.current="",await em(),window.setTimeout(()=>{eh(void 0,{silent:!0})},2e3)}catch(t){let e=t instanceof Error?t.message:"请重试或检查文件格式";r.error(e||"上传失败"),ev({id:n,type:"error",title:"上传失败 ".concat(a),description:e,status:"error",percent:100})}finally{er(!1)}},ex=async()=>{ea(!0);let e="reindex-ui-".concat(Date.now());ev({id:e,type:"reindex",title:"重新解析入库",description:"正在提交后台任务",status:"processing",percent:5});try{var t;let l=await (0,U.H1)(),a=l.operationId||e,n=l.job;r.info(l.alreadyRunning?"已有重新解析任务正在后台执行":"已提交重新解析入库任务,可在顶部“后台任务”查看进度"),ev({id:a,type:"reindex",title:(null==n?void 0:n.title)||"重新解析入库",description:(null==n?void 0:n.message)||"后台将重新扫描文件、解析、切片并重建索引",status:(null==n?void 0:n.status)||"processing",percent:null!=(t=null==n?void 0:n.percent)?t:10,error:null==n?void 0:n.error},["重新解析入库"]);for(let e=0;e<360;e++){let e=await (0,U.ax)(a).then(e=>e.job).catch(async()=>(await (0,U.Qx)()).operations.find(e=>e.id===a));if(e){let t="success"===e.status||"error"===e.status;if(ev({id:a,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?r.success(e.message||"重新解析入库完成"):r.error(e.error||e.message||"重新解析入库失败");break}}await new Promise(e=>setTimeout(e,1e3))}await eh(),await em()}catch(l){let t=l instanceof Error?l.message:"重新解析入库失败";r.error(t),ev({id:e,type:"error",title:"重新解析入库失败",description:t,status:"error",percent:100},["重新解析入库","重新解析入库完成","重新解析入库失败"])}finally{ea(!1)}},ey=async e=>{let t="file-reindex-ui-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2));ev({id:t,type:"reindex",title:"重新解析 ".concat(e.relativePath),description:"正在提交单文件后台任务",status:"processing",percent:5,filePath:e.relativePath});try{var l;let a=await (0,U.HC)(e.relativePath),n=a.operationId||t,s=a.job;r.info(a.alreadyRunning?"已有知识库任务正在后台执行":"已提交单文件重新解析任务"),ev({id:n,type:"reindex",title:(null==s?void 0:s.title)||"重新解析 ".concat(e.relativePath),description:(null==s?void 0:s.message)||"后台将重新解析、分块并入库该文件",status:(null==s?void 0:s.status)||"processing",percent:null!=(l=null==s?void 0:s.percent)?l:10,filePath:(null==s?void 0:s.filePath)||e.relativePath,chunkCount:null==s?void 0:s.chunkCount,error:null==s?void 0:s.error},["重新解析 ".concat(e.relativePath)]);for(let t=0;t<240;t++){let t=await (0,U.ax)(n).then(e=>e.job).catch(async()=>(await (0,U.Qx)()).operations.find(e=>e.id===n));if(t){let l="success"===t.status||"error"===t.status;if(ev({id:n,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 eh(),l){"success"===t.status?r.success(t.message||"单文件重新解析完成"):r.error(t.error||t.message||"单文件重新解析失败");break}}await new Promise(e=>setTimeout(e,1e3))}await eh(),await em()}catch(a){let l=a instanceof Error?a.message:"单文件重新解析失败";r.error(l),ev({id:t,type:"error",title:"重新解析失败 ".concat(e.relativePath),description:l,status:"error",percent:100,filePath:e.relativePath},["重新解析 ".concat(e.relativePath)])}},eb=t=>{let l="selected"===t?eS:"filtered"===t?ew.map(e=>e.relativePath):[],a=b.length;if("all"!==t&&0===l.length||"all"===t&&0===a)return void r.info("没有可删除的文件");let n="all"===t?"删除全部文件 ".concat(a," 个?"):"filtered"===t?"删除当前筛选结果中的文件 ".concat(l.length," 个?"):"删除已选文件 ".concat(l.length," 个?");d.A.confirm({title:n,content:"将同时删除文件、切片、索引和向量记录。此操作不可撤销。",okText:e("common.delete"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{es(e=>[{type:"delete",title:n,description:"正在批量删除文件和索引",status:"processing",percent:10},...e].slice(0,50));try{var e;let n=null!=(e=("all"===t?await (0,U.X8)():"selected"===t?await (0,U.tZ)(eC,ek):await (0,U.SJ)(l)).deleted)?e:"all"===t?a:l.length;r.success("已删除 ".concat(n," 个文件")),eo([]),es(e=>[{type:"delete",title:"批量删除完成",description:"已删除 ".concat(n," 个文件、切片和索引"),status:"success"},...e].slice(0,50)),await eh(),await em()}catch(e){r.error("批量删除失败"),es(e=>[{type:"error",title:"批量删除失败",description:"请重试",status:"error"},...e].slice(0,50))}}})},ew=(0,a.useMemo)(()=>P?b.filter(e=>e.relativePath.toLowerCase().includes(P.toLowerCase())):b,[P,b]),ej=(0,a.useMemo)(()=>new Set(ew.map(e=>e.relativePath)),[ew]),e_=(0,a.useMemo)(()=>{let e={};for(let r of[...ew].sort((e,t)=>e.relativePath.localeCompare(t.relativePath))){let l=r.relativePath.split("/"),a="";for(let n=0;n<l.length;n++){let s=l[n],i=a;a=a?"".concat(a,"/").concat(s):s;let o=n===l.length-1;if(e[a])o||e[a].isFolder?o&&(e[a].isFolder=!1,e[a].file=r,e[a].fileCount=1,e[a].totalSize=r.fileSize,e[a].totalChunks=r.chunkCount):(e[a].isFolder=!0,e[a].children=[],e[a].fileCount=0,e[a].totalSize=0,e[a].totalChunks=0);else{var t;e[a]={key:a,name:s,isFolder:!o,...o?{file:r,fileCount:1,totalSize:r.fileSize,totalChunks:r.chunkCount}:{children:[],fileCount:0,totalSize:0,totalChunks:0}},i&&(null==(t=e[i])?void 0:t.children)&&e[i].children.push(e[a])}}}let r=e=>{for(let n of e)if(n.children){r(n.children);let e=0,s=0,i=0;for(let r of n.children){var t,l,a;e+=null!=(t=r.fileCount)?t:0,s+=null!=(l=r.totalSize)?l:0,i+=null!=(a=r.totalChunks)?a:0}n.fileCount=e,n.totalSize=s,n.totalChunks=i}},l=e=>e.map(e=>e.children?{...e,children:l(e.children)}:e).filter(e=>{var t,r,l;return!e.isFolder||(null!=(r=e.fileCount)?r:0)>0&&(null!=(l=null==(t=e.children)?void 0:t.length)?l:0)>0}),a=Object.values(e).filter(e=>!e.key.includes("/"));return r(a),l(a)},[ew]),eA=(0,a.useMemo)(()=>{let e=[],t=r=>{for(let l of r)e.push(l.key),l.children&&t(l.children)};return t(e_),e},[e_]),ez=(0,a.useMemo)(()=>new Set([...ej,...eA]),[eA,ej]),ek=(0,a.useMemo)(()=>ei.map(String).filter(e=>!ej.has(e)&&eA.includes(e)),[eA,ei,ej]),eC=(0,a.useMemo)(()=>ei.map(String).filter(e=>ej.has(e)),[ei,ej]),eS=(0,a.useMemo)(()=>{let e=new Set;for(let t of eC){let r=b.find(e=>e.relativePath===t);r&&e.add(r.relativePath)}for(let t of ek){let r="".concat(t,"/");for(let t of b)t.relativePath.startsWith(r)&&e.add(t.relativePath)}return Array.from(e)},[b,eC,ek]),eP=eS.length;(0,a.useEffect)(()=>{eo(e=>e.filter(e=>ez.has(String(e))))},[ez]);let eM=(0,a.useMemo)(()=>P?eA:[],[P,eA]);(0,a.useEffect)(()=>{ed(eM)},[eM]);let eN=(e,t)=>{ed(r=>e?[...r,t.key]:r.filter(e=>e!==t.key))},eO=[{title:e("fileName"),dataIndex:"name",key:"name",render:(e,t)=>(0,l.jsxs)("span",{className:G().fileNameCell,children:[t.isFolder?(0,l.jsx)("span",{style:{cursor:"pointer"},onClick:e=>{e.stopPropagation(),eN(!ec.includes(t.key),t)},children:(e=>{let t=e.children;return t&&0!==t.length?(0,l.jsx)(V.A,{style:{color:"#fa8c16",fontSize:15}}):(0,l.jsx)(E.A,{style:{color:"#fa8c16",fontSize:15}})})(t)}):(e=>{if(!e)return(0,l.jsx)(x.A,{style:{fontSize:15}});let t=e.category;return"image"===t?(0,l.jsx)(j,{style:{color:"#eb2f96",fontSize:15}}):"spreadsheet"===t?(0,l.jsx)(z,{style:{color:"#52c41a",fontSize:15}}):"document"===t?(0,l.jsx)(S,{style:{color:"#1677ff",fontSize:15}}):"code"===t?(0,l.jsx)(N,{style:{color:"#fa8c16",fontSize:15}}):"archive"===t?(0,l.jsx)(O.A,{style:{color:"#8c8c8c",fontSize:15}}):"web"===t?(0,l.jsx)(H.A,{style:{color:"#13c2c2",fontSize:15}}):"data"===t?(0,l.jsx)(T.A,{style:{color:"#722ed1",fontSize:15}}):"cad"===t?(0,l.jsx)(E.A,{style:{color:"#fa541c",fontSize:15}}):"diagram"===t?(0,l.jsx)(j,{style:{color:"#a0d911",fontSize:15}}):(0,l.jsx)(F.A,{style:{fontSize:15}})})(t.file),t.isFolder?(0,l.jsx)("span",{className:G().folderName,onClick:e=>{e.stopPropagation(),eN(!ec.includes(t.key),t)},children:t.name}):(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(i(),{className:"min-w-0 max-w-[520px] whitespace-normal break-words leading-relaxed",href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(t.key)),children:t.name})})]})},{title:e("fileCategory"),dataIndex:"category",key:"cat",width:110,render:(e,r)=>{var a,n;return r.isFolder?(0,l.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,l.jsx)(u.A,{children:(0,W.Jm)(null!=(n=null==(a=r.file)?void 0:a.category)?n:"",t)})}},{title:e("fileSize"),dataIndex:"fileSize",key:"size",width:90,render:(e,t)=>{var r,l,a;return(0,W.z3)(t.isFolder?null!=(l=t.totalSize)?l:0:null!=(a=null==(r=t.file)?void 0:r.fileSize)?a:0)}},{title:e("chunksCount"),dataIndex:"chunkCount",key:"chunks",width:80,render:(e,t)=>{var r,a,n;let s=t.isFolder?null!=(a=t.totalChunks)?a:0:null!=(n=null==(r=t.file)?void 0:r.chunkCount)?n:0;return(0,l.jsx)(u.A,{color:s>1?"green":"orange",children:s})}},{title:e("parsingStatus"),dataIndex:"status",key:"status",width:100,render:(e,t)=>{var r,a,n,s;return t.isFolder?(0,l.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,l.jsx)(u.A,{color:"active"===(s=null==(r=t.file)?void 0:r.status)?"green":"processing"===s||"indexing"===s?"blue":"error"===s?"red":"orange",children:(null==(a=t.file)?void 0:a.errorMessage)||(null==(n=t.file)?void 0:n.status)||"—"})}},{title:e("fileDate"),dataIndex:"mtime",key:"date",width:130,render:(e,r)=>{var a;return r.isFolder?(0,l.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(null==(a=r.file)?void 0:a.mtime)?new Date(r.file.mtime).toLocaleDateString(t):"—"}},{title:e("source"),key:"source",width:100,render:(t,r)=>r.isFolder?(0,l.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,l.jsx)(u.A,{color:"cyan",children:e("fileSource")})},{title:"",key:"act",width:80,align:"center",render:(t,a)=>a.isFolder?null:(0,l.jsx)(h.A,{menu:{items:[{key:"reindex",label:e("reindex"),icon:(0,l.jsx)(B.A,{}),onClick:()=>{ey(a.file)}},{type:"divider"},{key:"delete",label:e("delete"),icon:(0,l.jsx)(I.A,{}),danger:!0,onClick:()=>{var t;return t=a.file,void d.A.confirm({title:e("delete"),content:e("deleteConfirm"),okText:e("common.confirm"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{es(e=>[{type:"delete",title:"删除 ".concat(t.relativePath),description:"正在删除文件记录",status:"processing"},...e].slice(0,50));try{await (0,U.xq)(t.relativePath),r.success("已删除"),es(e=>[{type:"delete",title:"删除完成 ".concat(t.relativePath),description:"文件和索引记录已移除",status:"success"},...e].slice(0,50)),eo(e=>e.filter(e=>e!==t.relativePath)),await eh(),await em()}catch(e){r.error("删除失败"),es(e=>[{type:"error",title:"删除失败 ".concat(t.relativePath),description:"请重试",status:"error"},...e].slice(0,50))}}})}}]},trigger:["click"],children:(0,l.jsx)(f.Ay,{type:"text",size:"small",icon:(0,l.jsx)(R.A,{})})})}],eH=(0,l.jsxs)("div",{className:"flex flex-1 md:flex-none w-full md:w-auto items-center gap-3",children:[(0,l.jsx)(m.A,{placeholder:e("searchPlaceholder"),prefix:(0,l.jsx)(L.A,{className:"text-[var(--colorTextTertiary)]"}),value:P,onChange:e=>{M(e.target.value)},allowClear:!0,variant:"borderless",className:"max-w-[300px] flex-1 bg-transparent hover:bg-transparent focus:bg-transparent",style:{borderBottom:"1px solid var(--borderColor)",borderRadius:0,paddingLeft:0,paddingRight:0}}),(0,l.jsx)(v.A,{value:X||void 0,onChange:e=>{ee(e||"")},placeholder:e("filterCategory"),allowClear:!0,style:{width:140},variant:"borderless",options:[{label:e("allCategories"),value:""},...K.map(e=>({label:(0,W.Jm)(e,t),value:e}))]}),(0,l.jsx)("div",{className:"w-[1px] h-6 bg-[var(--borderColor)] mx-1"}),(0,l.jsx)(h.A,{menu:{items:[{key:"file",label:e("uploadFiles"),icon:(0,l.jsx)(x.A,{}),onClick:()=>{var e;return null==(e=document.getElementById("kb-file-upload-input"))?void 0:e.click()}},{key:"folder",label:e("uploadFolder"),icon:(0,l.jsx)(E.A,{}),onClick:()=>{var e;return null==(e=document.getElementById("kb-folder-upload-input"))?void 0:e.click()}},{type:"divider"},{key:"reindex",label:e("reindexAll"),icon:(0,l.jsx)(B.A,{}),onClick:()=>{ex()},danger:!0}]},trigger:["click"],children:(0,l.jsx)(f.Ay,{type:"primary",icon:(0,l.jsx)(D.A,{}),loading:et||el,className:"rounded-md px-4",children:e("new")})}),(0,l.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 r=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",eg(r)}}),(0,l.jsx)("input",{id:"kb-folder-upload-input",type:"file",multiple:!0,hidden:!0,webkitdirectory:"",onChange:e=>{var t;let r=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",eg(r)}})]});return(0,l.jsxs)("div",{className:"h-[calc(100vh-140px)] flex flex-col",children:[(0,l.jsxs)("div",{className:"bg-[var(--colorBgContainer)] rounded-2xl border border-[var(--borderColor)] p-6 mb-4 shrink-0 animateFadeIn",children:[(0,l.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-6 pb-6 border-b border-[var(--borderColor)]",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("h1",{className:"text-2xl font-bold tracking-tight text-[var(--colorText)] mb-1 flex items-center gap-2",children:[(0,l.jsx)(T.A,{className:"text-[var(--colorAccent)]"}),e("files")]}),(0,l.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)] m-0",children:e("manageRawFiles")})]}),eH]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6 pt-6 stagger-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("div",{className:"w-12 h-12 rounded-xl bg-[var(--colorBgHover)] flex items-center justify-center text-xl text-[var(--colorTextSecondary)]",children:(0,l.jsx)(V.A,{})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-[11px] font-semibold text-[var(--colorTextTertiary)] uppercase tracking-wider mb-1",children:e("totalRootFolders")}),(0,l.jsx)("div",{className:"text-xl font-bold text-[var(--colorText)] leading-none",children:e_.length})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("div",{className:"w-12 h-12 rounded-xl bg-[var(--colorBgHover)] flex items-center justify-center text-xl text-[var(--colorTextSecondary)]",children:(0,l.jsx)(F.A,{})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-[11px] font-semibold text-[var(--colorTextTertiary)] uppercase tracking-wider mb-1",children:e("totalFilesStats")}),(0,l.jsx)("div",{className:"text-xl font-bold text-[var(--colorText)] leading-none",children:b.length})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("div",{className:"w-12 h-12 rounded-xl bg-green-50 dark:bg-green-900/20 flex items-center justify-center text-xl text-green-600 dark:text-green-500",children:(0,l.jsx)(q.A,{})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-[11px] font-semibold text-[var(--colorTextTertiary)] uppercase tracking-wider mb-1",children:e("successfullyParsed")}),(0,l.jsx)("div",{className:"text-xl font-bold text-[var(--colorText)] leading-none",children:b.filter(e=>"success"===e.status).length})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("div",{className:"w-12 h-12 rounded-xl bg-red-50 dark:bg-red-900/20 flex items-center justify-center text-xl text-red-600 dark:text-red-500",children:(0,l.jsx)($.A,{})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-[11px] font-semibold text-[var(--colorTextTertiary)] uppercase tracking-wider mb-1",children:e("parsingErrors")}),(0,l.jsx)("div",{className:"text-xl font-bold text-[var(--colorText)] leading-none",children:b.filter(e=>"error"===e.status).length})]})]})]})]}),k&&(0,l.jsx)("div",{className:"p-4 mb-4 bg-[var(--colorDanger)]/10 text-[var(--colorDanger)] rounded-xl border border-[var(--colorDanger)]/20",children:k}),(0,l.jsxs)("div",{className:"flex-1 min-h-0 bg-[var(--colorBgContainer)] rounded-2xl border border-[var(--borderColor)] overflow-hidden flex flex-col animateFadeIn stagger-3",style:{opacity:0},children:[(0,l.jsxs)("div",{className:"flex justify-between items-center p-4 bg-[var(--colorBgHover)] border-b border-[var(--borderColor)] shrink-0",children:[(0,l.jsx)("div",{className:"text-xs text-[var(--colorTextSecondary)] font-medium",children:e("showingMatchingFiles").replace("{count}",String(ew.length))}),(0,l.jsxs)(p.A,{size:8,children:[eP>0&&(0,l.jsxs)(f.Ay,{danger:!0,size:"small",icon:(0,l.jsx)(I.A,{}),onClick:()=>eb("selected"),className:"rounded-lg",children:[e("deleteSelected")," (",eP,")"]}),(0,l.jsx)(f.Ay,{danger:!0,size:"small",disabled:0===b.length,onClick:()=>eb("all"),className:"rounded-lg",children:e("deleteAll")})]})]}),(0,l.jsx)(g.A,{rowKey:"key",columns:eO,dataSource:e_,loading:_&&!et&&!el,size:"middle",className:"flex-1 custom-table border-0",scroll:{y:"calc(100vh - 460px)"},expandable:{expandedRowKeys:ec,onExpand:eN,expandIcon:e=>{let{expanded:t,onExpand:r,record:a}=e;return a.isFolder?(0,l.jsx)("button",{type:"button",onClick:e=>r(a,e),className:"w-6 h-6 mr-1 inline-flex items-center justify-center align-middle text-[var(--colorTextTertiary)] hover:text-[var(--colorText)] transition-colors bg-transparent border-0 p-0 leading-none",children:t?(0,l.jsx)(J.A,{size:16}):(0,l.jsx)(Q.A,{size:16})}):(0,l.jsx)("span",{className:"w-6 h-6 inline-flex"})}},locale:{emptyText:_?e("common.loading"):P?e("emptySearch"):e("noFiles")},pagination:!1,rowClassName:e=>"hover:bg-[var(--colorBgHover)] transition-colors ".concat(e.isFolder?"font-medium bg-[var(--colorBgSecondary)]/30":""),rowSelection:{selectedRowKeys:ei,onChange:eo,checkStrictly:!1,getCheckboxProps:e=>{var t;return{disabled:!!e.isFolder&&(null!=(t=e.fileCount)?t:0)===0}}}})]})]})}},71242:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"}},85855:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(35311),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))},90426:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/files",function(){return r(64207)}])},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"}},93314:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(53234),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))}},e=>{e.O(0,[580,665,576,209,7,289,636,593,792],()=>e(e.s=90426)),_N_E=e.O()}]);