@customize-agent/server 4.0.6 → 4.0.8

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 (165) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +176 -271
  3. package/.next/package.json +1 -0
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/routes-manifest.json +8 -0
  6. package/.next/server/chunks/1936.js +385 -0
  7. package/.next/server/chunks/8204.js +1 -1
  8. package/.next/server/chunks/9301.js +2 -2
  9. package/.next/server/middleware-build-manifest.js +1 -1
  10. package/.next/server/pages/404.html +1 -1
  11. package/.next/server/pages/500.html +1 -1
  12. package/.next/server/pages/_app.js +1 -1
  13. package/.next/server/pages/_app.js.nft.json +1 -1
  14. package/.next/server/pages/_error.js +1 -1
  15. package/.next/server/pages/_error.js.nft.json +1 -1
  16. package/.next/server/pages/api/config/models.js +1 -1
  17. package/.next/server/pages/api/jobs/[id].js +2 -0
  18. package/.next/server/pages/api/jobs/[id].js.nft.json +1 -0
  19. package/.next/server/pages/api/jobs.js +2 -0
  20. package/.next/server/pages/api/jobs.js.nft.json +1 -0
  21. package/.next/server/pages/api/kb/files/open.js +1 -1
  22. package/.next/server/pages/api/kb/files.js +2 -2
  23. package/.next/server/pages/api/kb/operations.js +2 -2
  24. package/.next/server/pages/api/kb/reindex.js +2 -2
  25. package/.next/server/pages/api/kb/reindex.js.nft.json +1 -1
  26. package/.next/server/pages/api/kb/upload.js +2 -2
  27. package/.next/server/pages/api/kb/upload.js.nft.json +1 -1
  28. package/.next/server/pages/asset-library.html +1 -1
  29. package/.next/server/pages/asset-library.js.nft.json +1 -1
  30. package/.next/server/pages/context/long-term.html +1 -1
  31. package/.next/server/pages/context/long-term.js.nft.json +1 -1
  32. package/.next/server/pages/context/short-term.html +1 -1
  33. package/.next/server/pages/context/short-term.js.nft.json +1 -1
  34. package/.next/server/pages/document-roles.html +1 -1
  35. package/.next/server/pages/document-roles.js.nft.json +1 -1
  36. package/.next/server/pages/document-specs.html +1 -1
  37. package/.next/server/pages/document-specs.js.nft.json +1 -1
  38. package/.next/server/pages/documents.html +1 -1
  39. package/.next/server/pages/documents.js.nft.json +1 -1
  40. package/.next/server/pages/guide.html +1 -1
  41. package/.next/server/pages/guide.js.nft.json +1 -1
  42. package/.next/server/pages/index.html +1 -1
  43. package/.next/server/pages/index.js.nft.json +1 -1
  44. package/.next/server/pages/knowledge/file-detail.html +1 -1
  45. package/.next/server/pages/knowledge/file-detail.js.nft.json +1 -1
  46. package/.next/server/pages/knowledge/files.html +1 -1
  47. package/.next/server/pages/knowledge/files.js.nft.json +1 -1
  48. package/.next/server/pages/knowledge/manage.html +1 -1
  49. package/.next/server/pages/knowledge/manage.js.nft.json +1 -1
  50. package/.next/server/pages/knowledge/search.html +1 -1
  51. package/.next/server/pages/knowledge/search.js.nft.json +1 -1
  52. package/.next/server/pages/knowledge.html +1 -1
  53. package/.next/server/pages/knowledge.js.nft.json +1 -1
  54. package/.next/server/pages/models.html +1 -1
  55. package/.next/server/pages/models.js.nft.json +1 -1
  56. package/.next/server/pages/overview.html +1 -1
  57. package/.next/server/pages/overview.js.nft.json +1 -1
  58. package/.next/server/pages/prompt.html +1 -1
  59. package/.next/server/pages/prompt.js.nft.json +1 -1
  60. package/.next/server/pages/settings.html +1 -1
  61. package/.next/server/pages/settings.js.nft.json +1 -1
  62. package/.next/server/pages/system/logs.html +1 -1
  63. package/.next/server/pages/system/logs.js.nft.json +1 -1
  64. package/.next/server/pages-manifest.json +32 -30
  65. package/.next/static/chunks/131-96749f5b6e1460d1.js +1 -0
  66. package/.next/static/chunks/{7150-123ff059dd0e2eb9.js → 150-a7b953a600cbd7e0.js} +3 -3
  67. package/.next/static/chunks/195-9f2e4c67a9deff05.js +1 -0
  68. package/.next/static/chunks/20-23d24b40b69faf0f.js +8 -0
  69. package/.next/static/chunks/265-c3a46cef96364aac.js +1 -0
  70. package/.next/static/chunks/{1289-c788c44e65e9dc64.js → 289-36c210992d5009d5.js} +1 -1
  71. package/.next/static/chunks/412-b9c854c6a76db67d.js +1 -0
  72. package/.next/static/chunks/433-ef3d7675b81826a9.js +1 -0
  73. package/.next/static/chunks/447-772df02993a8609b.js +1 -0
  74. package/.next/static/chunks/455-9e1e1c7e96845347.js +6 -0
  75. package/.next/static/chunks/506-b97aadd3e451b379.js +1 -0
  76. package/.next/static/chunks/512-e2813c7e9454d53c.js +1 -0
  77. package/.next/static/chunks/576-679ab6348b33b960.js +1 -0
  78. package/.next/static/chunks/698-625f34d5d0052e87.js +1 -0
  79. package/.next/static/chunks/749-dcb0cd85d1455f34.js +1 -0
  80. package/.next/static/chunks/{8787-c8bea0f25cbd3cf0.js → 787-196a2bed7b11745a.js} +1 -1
  81. package/.next/static/chunks/788-f74cda5d27cf4390.js +1 -0
  82. package/.next/static/chunks/932-823e1ae10dd43b8b.js +1 -0
  83. package/.next/static/chunks/938-0063785681203bb5.js +1 -0
  84. package/.next/static/chunks/985-da0b1f68e59d1e76.js +4 -0
  85. package/.next/static/chunks/framework-161be364fd69a7ce.js +1 -0
  86. package/.next/static/chunks/main-91fb767ebd74c9c1.js +1 -0
  87. package/.next/static/chunks/pages/_app-e38deed037bfbced.js +212 -0
  88. package/.next/static/chunks/pages/_error-282257fbdcc167b4.js +1 -0
  89. package/.next/static/chunks/pages/asset-library-e9ddfe1cbaac42d9.js +1 -0
  90. package/.next/static/chunks/pages/context/{long-term-820cba5f1ae3a6cd.js → long-term-2e6a30a8f879df47.js} +1 -1
  91. package/.next/static/chunks/pages/context/short-term-730211234fa3add6.js +1 -0
  92. package/.next/static/chunks/pages/document-roles-7197641736843503.js +1 -0
  93. package/.next/static/chunks/pages/document-specs-033d848b03b54df3.js +1 -0
  94. package/.next/static/chunks/pages/documents-3b2f23e2d6b27f1b.js +1 -0
  95. package/.next/static/chunks/pages/guide-cdf68a096918c979.js +1 -0
  96. package/.next/static/chunks/pages/index-c5e0758e6b31deee.js +1 -0
  97. package/.next/static/chunks/pages/knowledge/file-detail-0a5e267f77f4e8b3.js +1 -0
  98. package/.next/static/chunks/pages/knowledge/files-4d2754cc303c2a70.js +1 -0
  99. package/.next/static/chunks/pages/knowledge/manage-25eb1a993b155450.js +1 -0
  100. package/.next/static/chunks/pages/knowledge/search-2cee4e8b8792170c.js +1 -0
  101. package/.next/static/chunks/pages/knowledge-905248d8dcb15453.js +1 -0
  102. package/.next/static/chunks/pages/models-b5f68c4c70257495.js +1 -0
  103. package/.next/static/chunks/pages/overview-380088496f0dae68.js +1 -0
  104. package/.next/static/chunks/pages/prompt-4cf07545f8388d85.js +1 -0
  105. package/.next/static/chunks/pages/settings-fa9d6a56898ba678.js +1 -0
  106. package/.next/static/chunks/pages/system/logs-f4e222140dc7b30c.js +1 -0
  107. package/.next/static/chunks/{webpack-689755a4ff6d1f93.js → webpack-77d10b4726f13aa5.js} +1 -1
  108. package/.next/static/e3Tj4PCt-LpKFkNO9YWjs/_buildManifest.js +1 -0
  109. package/package.json +13 -13
  110. package/scripts/kb-index-worker.cjs +128 -0
  111. package/.next/server/chunks/1547.js +0 -385
  112. package/.next/server/chunks/550.js +0 -1
  113. package/.next/server/chunks/9270.js +0 -1
  114. package/.next/static/JXFgoYPwWCEiyRggKTXQU/_buildManifest.js +0 -1
  115. package/.next/static/chunks/1515-051d4383493143c9.js +0 -1
  116. package/.next/static/chunks/2073-244191fe7cc6e330.js +0 -4
  117. package/.next/static/chunks/2225-a90b5cc9338c63fa.js +0 -1
  118. package/.next/static/chunks/261-8a5ce39d74fc746e.js +0 -1
  119. package/.next/static/chunks/2884-b2944538a4a0d9b2.js +0 -1
  120. package/.next/static/chunks/3057-9eda004e07594513.js +0 -1
  121. package/.next/static/chunks/3455-c73ce4738620db20.js +0 -6
  122. package/.next/static/chunks/347-62c74776c299477d.js +0 -4
  123. package/.next/static/chunks/4052-9caaaa494d67a7e0.js +0 -1
  124. package/.next/static/chunks/4277-ba039fcf8f4e9cdc.js +0 -1
  125. package/.next/static/chunks/4427-302c5267a1f8493e.js +0 -1
  126. package/.next/static/chunks/4833-bf56f1203e2daffa.js +0 -28
  127. package/.next/static/chunks/5292-e65eab4f54b9f7ff.js +0 -16
  128. package/.next/static/chunks/5938-da5d441b981ec422.js +0 -1
  129. package/.next/static/chunks/6506-9d3cdc1ea816d7c4.js +0 -1
  130. package/.next/static/chunks/6578-6422ce4e29eb07d4.js +0 -1
  131. package/.next/static/chunks/6985-29200efa04920cb3.js +0 -4
  132. package/.next/static/chunks/7223-58376fd8a1d62df4.js +0 -1
  133. package/.next/static/chunks/7271-587c30b66ea4e619.js +0 -16
  134. package/.next/static/chunks/7576-b34ccf53f6efc388.js +0 -1
  135. package/.next/static/chunks/7889-8531b79751a71e39.js +0 -1
  136. package/.next/static/chunks/8326-b79c7555af5866e7.js +0 -8
  137. package/.next/static/chunks/861-dd60ef688592115e.js +0 -1
  138. package/.next/static/chunks/8676-5982391f15ea1190.js +0 -1
  139. package/.next/static/chunks/8732-69ffc27ed6c68f6f.js +0 -4
  140. package/.next/static/chunks/8932-e1bb3137986c259a.js +0 -1
  141. package/.next/static/chunks/9144-51689069a3d341e5.js +0 -1
  142. package/.next/static/chunks/9189-03f286defdb92816.js +0 -10
  143. package/.next/static/chunks/9773-53116cd0bf4b961a.js +0 -1
  144. package/.next/static/chunks/framework-fbc6f575b16f07d7.js +0 -1
  145. package/.next/static/chunks/main-105db6ecf7f64ff3.js +0 -1
  146. package/.next/static/chunks/pages/_app-03f3204a695aa8bc.js +0 -140
  147. package/.next/static/chunks/pages/_error-c01b6fb772028676.js +0 -1
  148. package/.next/static/chunks/pages/asset-library-634d18652eb7507d.js +0 -1
  149. package/.next/static/chunks/pages/context/short-term-3332ffb90b3b58a9.js +0 -1
  150. package/.next/static/chunks/pages/document-roles-ab6dfead3fd99a2c.js +0 -1
  151. package/.next/static/chunks/pages/document-specs-565cf77237fce3d5.js +0 -1
  152. package/.next/static/chunks/pages/documents-471786ecea050f17.js +0 -1
  153. package/.next/static/chunks/pages/guide-2a3ec07403e02e1f.js +0 -1
  154. package/.next/static/chunks/pages/index-cc55686ed0309a22.js +0 -1
  155. package/.next/static/chunks/pages/knowledge/file-detail-f5e8f9bc35ebb92d.js +0 -1
  156. package/.next/static/chunks/pages/knowledge/files-88aba3534bd722f9.js +0 -1
  157. package/.next/static/chunks/pages/knowledge/manage-5629ccce14402b99.js +0 -1
  158. package/.next/static/chunks/pages/knowledge/search-ad678d4bc8137cb5.js +0 -1
  159. package/.next/static/chunks/pages/knowledge-55e4c53985e79449.js +0 -1
  160. package/.next/static/chunks/pages/models-1788b9741155e3ce.js +0 -1
  161. package/.next/static/chunks/pages/overview-5235c02260509635.js +0 -1
  162. package/.next/static/chunks/pages/prompt-0184d79af09db7e1.js +0 -1
  163. package/.next/static/chunks/pages/settings-fd31c9ef833cf0af.js +0 -1
  164. package/.next/static/chunks/pages/system/logs-8040fb1e0c814a0c.js +0 -1
  165. /package/.next/static/{JXFgoYPwWCEiyRggKTXQU → e3Tj4PCt-LpKFkNO9YWjs}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[414],{45551:(e,l,t)=>{"use strict";function n(e){if(0===e)return"0 B";let l=Math.floor(Math.log(e)/Math.log(1024)),t=e/Math.pow(1024,l);return"".concat(t.toFixed(+(0!==l))," ").concat(["B","KB","MB","GB","TB"][l])}function a(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===l?"Never":"从未";let t=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(t/60),a=Math.floor(n/24);return a>30?new Date(e).toLocaleDateString(l):"en-US"===l?a>0?"".concat(a,"d ago"):n>0?"".concat(n,"h ago"):t>0?"".concat(t,"m ago"):"Just now":a>0?"".concat(a," 天前"):n>0?"".concat(n," 小时前"):t>0?"".concat(t," 分钟前"):"刚刚"}t.d(l,{Jm:()=>o,fw:()=>a,z3:()=>n});let r={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 o(e){var l;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(l=("en-US"===t?s:r)[e])?l:e}},50423:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>E});var n=t(65321),a=t(97109),r=t(34986),s=t(79059),o=t(17807),c=t(33442),i=t(85114),d=t(2256),u=t(38770),h=t(68787),x=t(54849),g=t(57271),m=t(76506),j=t(11702),A=t(29606),f=t(30486),w=t(99811),v=t(56768),k=t(26619),p=t(93314),y=t(58740),b=t(35459),C=t(23216),S=t(63663),z=t(49484),D=t(6578),N=t(45551);let _=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function E(){var e,l,t,E;let I=(0,s.Vr)(),{locale:T}=(0,s.x_)(),M=(0,r.useRouter)(),{stats:B,loading:F,reload:R}=function(){let[e,l]=(0,a.useState)(null),[t,n]=(0,a.useState)(!1),r=(0,a.useCallback)(async()=>{n(!0);try{l(await (0,D.hc)())}catch(e){}finally{n(!1)}},[]);return(0,a.useEffect)(()=>{r()},[r]),{stats:e,loading:t,reload:r}}(),O=function(){let[e,l]=(0,a.useState)(null);return(0,a.useEffect)(()=>{(0,D.VW)().then(l).catch(()=>{})},[]),e}(),{reindexing:P,reindex:J}=function(){let[e,l]=(0,a.useState)(!1);return{reindexing:e,reindex:(0,a.useCallback)(async()=>{l(!0);try{return await (0,D.H1)(),!0}catch(e){return!1}finally{l(!1)}},[])}}(),[U,V]=(0,a.useState)("document"),[W,H]=(0,a.useState)({count:0,totalSize:0,totalChunks:0}),{message:X}=o.A.useApp(),G=(0,a.useCallback)(async e=>{try{let l=await (0,D.HT)({category:e,limit:1e4}),t=0,n=0;if(Array.isArray(l.files))for(let e of l.files)t+=e.fileSize||0,n+=e.chunkCount||0;H({count:l.total||0,totalSize:t,totalChunks:n})}catch(e){H({count:0,totalSize:0,totalChunks:0})}},[]);(0,a.useEffect)(()=>{G(U)},[U,G]);let K=async()=>{await J()?await Promise.all([R(),G(U)]):X.error(I("common.error"))};return(0,n.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:I("knowledge.manageTitle")}),(0,n.jsx)("p",{className:"pageDesc",children:I("knowledge.manageDesc")})]}),(0,n.jsxs)(c.A,{children:[(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(A.A,{}),onClick:()=>M.push("/knowledge/files"),children:I("knowledge.files")}),(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(f.A,{}),onClick:()=>M.push("/knowledge/search"),children:I("knowledge.search")}),(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(w.A,{}),loading:P,onClick:()=>{K()},children:I("knowledge.reindex")})]})]}),(0,n.jsx)(d.A,{gutter:[16,16],children:[{icon:(0,n.jsx)(v.A,{}),label:I("knowledge.totalFiles"),value:null!=(l=null==B?void 0:B.fileCount)?l:0},{icon:(0,n.jsx)(k.A,{}),label:I("knowledge.totalChunks"),value:null!=(t=null==B?void 0:B.chunkCount)?t:0},{icon:(0,n.jsx)(p.A,{}),label:I("knowledge.totalSize"),value:(0,N.z3)(null!=(E=null==B?void 0:B.totalSizeBytes)?E:0)},{icon:(0,n.jsx)(y.A,{}),label:I("knowledge.lastIndexed"),value:(null==B?void 0:B.lastIndexedAt)?(0,N.fw)(B.lastIndexedAt,T):I("common.never")}].map((e,l)=>(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(h.A,{size:"small",loading:F&&!B,children:(0,n.jsx)(x.A,{title:e.label,value:e.value,prefix:e.icon})})},l))}),(0,n.jsxs)(h.A,{title:I("knowledge.categories"),size:"small",children:[(0,n.jsx)(g.A,{value:U,onChange:e=>V(e),options:_.map(e=>({label:(0,N.Jm)(e,T),value:e})),style:{width:160,marginBottom:16}}),(0,n.jsxs)(d.A,{gutter:[16,16],children:[(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.fileCount"),value:W.count,prefix:(0,n.jsx)(v.A,{style:{color:"var(--colorAccent)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.totalSize"),value:(0,N.z3)(W.totalSize),prefix:(0,n.jsx)(p.A,{style:{color:"var(--colorWarning)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:"切片数",value:W.totalChunks,prefix:(0,n.jsx)(b.A,{style:{color:"var(--colorOk)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:"平均大小",value:W.count>0?(0,N.z3)(W.totalSize/W.count):"—",prefix:(0,n.jsx)(k.A,{style:{color:"var(--colorDanger)"}})})})]})]}),O&&(0,n.jsx)(h.A,{title:I("knowledge.features"),size:"small",children:(0,n.jsxs)(m.A,{size:"small",column:{xs:1,sm:2},bordered:!0,children:[(0,n.jsx)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(C.A,{style:{marginRight:4}}),"Vector Store"]}),children:(0,n.jsx)(j.A,{color:"blue",children:O.vectorStore})}),(0,n.jsx)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b.A,{style:{marginRight:4}}),"Embedding"]}),children:(0,n.jsx)(j.A,{color:"purple",children:O.embeddingProvider})}),(0,n.jsxs)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(S.A,{style:{marginRight:4}}),I("knowledge.featureDedup")]}),children:[(0,n.jsx)(j.A,{color:"green",children:O.dedupEngine}),(0,n.jsx)("div",{className:"text-xs",style:{color:"var(--colorTextSecondary)",marginTop:2},children:I("knowledge.featureDedupDesc")})]}),(0,n.jsxs)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z.A,{style:{marginRight:4}}),I("knowledge.featureChunker")]}),children:[(0,n.jsx)(j.A,{color:"orange",children:O.chunker}),(0,n.jsx)("div",{className:"text-xs",style:{color:"var(--colorTextSecondary)",marginTop:2},children:I("knowledge.featureChunkerDesc")})]}),(null==(e=O.externalExtractors)?void 0:e.length)>0&&(0,n.jsx)(m.A.Item,{label:"外部提取器",span:2,children:(0,n.jsx)(c.A,{wrap:!0,children:O.externalExtractors.map(e=>(0,n.jsx)(j.A,{color:"cyan",children:e},e))})})]})})]})}},54178:(e,l,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/manage",function(){return t(50423)}])}},e=>{e.O(0,[433,787,506,788,636,593,792],()=>e(e.s=54178)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[207],{4184:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>E});var l=t(65321),r=t(43220),i=t.n(r),a=t(97109),n=t(35292),c=t(17807),o=t(85114),u=t(85493),d=t(68787),_=t(33442),h=t(7576),m=t(48318),y=t(76506),p=t(11702),x=t(42700),j=t(84253),w=t(30486),A=t(79059),f=t(6578),g=t(14569),b=t.n(g);let{Paragraph:v}=n.A,S=["keyword","vector","rewrite","hybridBonus"],k=["keywordScore","bm25Score","vectorScore","rerankBoost","hybridScore"];function P(e){return"number"==typeof e?e.toFixed(2):"-"}function C(e,s,t){let l=e(s);return l===s?t:l}function E(){var e,s,t;let{message:r}=c.A.useApp(),n=(0,A.Vr)("knowledge"),[g,E]=(0,a.useState)(""),[I,N]=(0,a.useState)(!1),[R,T]=(0,a.useState)([]),[L,F]=(0,a.useState)(),[B,D]=(0,a.useState)(),[z,M]=(0,a.useState)(""),[V,O]=(0,a.useState)({keyword:1,vector:.9,rewrite:.72,hybridBonus:.35}),H=async e=>{await navigator.clipboard.writeText(e),r.success(n("copyPriorityEvidenceSuccess"))},W=async()=>{let e=g.trim();if(e){N(!0),M("");try{let s=await (0,f.W2)(e,{limit:10,weights:V});T(s.results),F(s.queryTimeMs),D(s.debug)}catch(e){T([]),M(e instanceof Error?e.message:n("searchFailed"))}finally{N(!1)}}};return(0,l.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"pageTitle",children:n("searchTitle")}),(0,l.jsx)("p",{className:"pageDesc",children:n("searchDesc")})]}),(0,l.jsx)(i(),{href:"/documents",children:(0,l.jsx)(o.Ay,{children:n("goToDocuments")})})]}),(0,l.jsx)(u.A,{type:"info",showIcon:!0,message:n("autoSearchFirst"),description:n("autoSearchFirstDesc")}),(0,l.jsx)(d.A,{size:"small",children:(0,l.jsxs)(_.A.Compact,{className:"w-full",children:[(0,l.jsx)(h.A,{value:g,onChange:e=>E(e.target.value),onPressEnter:()=>{W()},placeholder:n("searchContentPlaceholder")}),(0,l.jsx)(o.Ay,{type:"primary",icon:(0,l.jsx)(w.A,{}),loading:I,onClick:()=>{W()},children:n("searchAction")})]})}),(0,l.jsx)(d.A,{size:"small",title:n("recallWeightTuning"),children:(0,l.jsx)(_.A,{wrap:!0,children:S.map(e=>(0,l.jsxs)("span",{children:[C(n,"weights.".concat(e),e)," ",(0,l.jsx)(m.A,{min:0,max:"hybridBonus"===e?2:5,step:"hybridBonus"===e?.05:.1,value:V[e],onChange:s=>O(t=>({...t,[e]:Number(null!=s?s:t[e])}))})]},e))})}),B&&(0,l.jsx)(d.A,{size:"small",title:n("debugPanel"),children:(0,l.jsxs)(y.A,{size:"small",column:2,bordered:!0,children:[(0,l.jsx)(y.A.Item,{label:n("originalQuery"),children:B.originalQuery}),(0,l.jsx)(y.A.Item,{label:n("reranker"),children:B.reranker}),(0,l.jsx)(y.A.Item,{label:n("rewrittenQueries"),span:2,children:(0,l.jsx)(_.A,{wrap:!0,children:null==(e=B.rewrittenQueries)?void 0:e.map(e=>(0,l.jsx)(p.A,{children:e},e))})}),(0,l.jsx)(y.A.Item,{label:n("recallCounts"),span:2,children:(0,l.jsx)(_.A,{wrap:!0,children:Object.entries(null!=(s=B.recallCounts)?s:{}).map(e=>{let[s,t]=e;return(0,l.jsxs)(p.A,{children:[C(n,"recallSources.".concat(s),s),": ",t]},s)})})}),(0,l.jsx)(y.A.Item,{label:n("recallWeights"),span:2,children:(0,l.jsx)(_.A,{wrap:!0,children:Object.entries(null!=(t=B.weights)?t:{}).map(e=>{let[s,t]=e;return(0,l.jsxs)(p.A,{children:[C(n,"weights.".concat(s),s),": ",t]},s)})})})]})}),(0,l.jsxs)(d.A,{size:"small",title:n("searchResults"),extra:"number"==typeof L?"".concat(L," ms"):void 0,children:[z?(0,l.jsx)(u.A,{type:"error",showIcon:!0,message:n("searchFailed"),description:z,className:"mb-4"}):null,I?(0,l.jsx)(x.A,{}):0===R.length?(0,l.jsx)(j.A,{description:n("noSearchResults")}):(0,l.jsx)("div",{className:b().searchResultList,children:R.map((e,s)=>{var t,r;return(0,l.jsxs)("div",{className:b().searchResultItem,children:[(0,l.jsxs)("div",{className:b().searchResultHeader,children:[(0,l.jsxs)(_.A,{size:8,wrap:!0,children:[(0,l.jsxs)(p.A,{children:[n("resultIndex")," ",s+1]}),(0,l.jsx)(p.A,{color:"hybrid"===e.source?"purple":"vector"===e.source?"blue":"green",children:C(n,"recallSources.".concat(null!=(t=e.source)?t:"keyword"),null!=(r=e.source)?r:"keyword")}),(0,l.jsx)(p.A,{children:C(n,"scopes.".concat(e.scope),e.scope)}),e.chunkKind&&(0,l.jsx)(p.A,{color:"geekblue",children:e.chunkKind}),e.rowRange&&(0,l.jsxs)(p.A,{color:"gold",children:[n("rowRange")," ",e.rowRange]}),e.sectionTitle&&(0,l.jsx)(p.A,{color:"cyan",children:e.sectionTitle})]}),(0,l.jsx)("strong",{children:P(e.score)})]}),(0,l.jsx)("div",{className:b().statusPath,children:(0,l.jsxs)(_.A,{size:8,wrap:!0,children:[(0,l.jsx)(i(),{href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(e.filePath)),children:e.filePath}),"number"==typeof e.chunkIndex?" #".concat(e.chunkIndex):"",(0,l.jsx)(o.Ay,{size:"small",onClick:()=>{H(e.filePath)},children:n("copyAsPriorityEvidence")})]})}),(0,l.jsx)(v,{ellipsis:{rows:6,expandable:!0,symbol:n("expand")},className:b().searchContent,children:function(e,s){let t=[s.trim(),...s.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,s)=>s.length-e.length);if(0===t.length)return e;let r=RegExp("(".concat(t.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(r).map((e,s)=>t.some(s=>s.toLowerCase()===e.toLowerCase())?(0,l.jsx)("mark",{children:e},s):e)}(e.content,g)}),e.facets&&Object.keys(e.facets).length>0&&(0,l.jsx)("div",{className:b().statusMeta,children:Object.entries(e.facets).slice(0,8).map(e=>{let[s,t]=e;return(0,l.jsxs)("span",{children:[s," ",(0,l.jsx)("b",{children:Array.isArray(t)?t.join(", "):String(t)})]},s)})}),(0,l.jsx)("div",{className:b().statusMeta,children:k.map(s=>{var t;return(0,l.jsxs)("span",{children:[C(n,"scoreDetails.".concat(s),s)," ",(0,l.jsx)("b",{children:P(null==(t=e.scoreDetails)?void 0:t[s])})]},s)})})]},e.id)})})]})]})}},9208:(e,s,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/search",function(){return t(4184)}])},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"}}},e=>{e.O(0,[433,787,576,506,938,636,593,792],()=>e(e.s=9208)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[12],{29735:(e,n,u)=>{"use strict";u.r(n),u.d(n,{default:()=>l});var _=u(97109),t=u(86109);function l(){let e=(0,t.useRouter)();return(0,_.useEffect)(()=>{e.replace("/knowledge/manage")},[e]),null}},74183:(e,n,u)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge",function(){return u(29735)}])}},e=>{e.O(0,[636,593,792],()=>e(e.s=74183)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46],{69:(e,l)=>{"use strict";l.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5L255.8 713.6l-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l110.3 111.2c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.1 304.1 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112m161.2 465.2C726.2 620.3 668.9 644 608 644s-118.2-23.7-161.2-66.8C403.7 534.2 380 476.9 380 416s23.7-118.2 66.8-161.2c43-43.1 100.3-66.8 161.2-66.8s118.2 23.7 161.2 66.8c43.1 43 66.8 100.3 66.8 161.2s-23.7 118.2-66.8 161.2"}}]},name:"key",theme:"outlined"}},2256:(e,l,a)=>{"use strict";a.d(l,{A:()=>s});let s=a(25341).A},5450:(e,l)=>{"use strict";l.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"}},13114:(e,l,a)=>{"use strict";a.d(l,{A:()=>i});var s=a(97109),o=a(5450),t=a(88483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var a=arguments[l];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}let i=s.forwardRef((e,l)=>s.createElement(t.A,r({},e,{ref:l,icon:o.A})))},15437:(e,l,a)=>{"use strict";a.d(l,{A:()=>s});let s=e=>{let{componentCls:l,antCls:a,motionDurationMid:s,motionEaseInOut:o}=e;return{[l]:{[`${a}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`${["height","opacity"].map(e=>`${e} ${s} ${o}`).join(", ")} !important`}},[`${a}-motion-collapse`]:{overflow:"hidden",transition:`${["height","opacity"].map(e=>`${e} ${s} ${o}`).join(", ")} !important`}}}}},29071:(e,l,a)=>{"use strict";a.d(l,{A:()=>i});var s=a(97109),o=a(78847),t=a(88483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var a=arguments[l];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}let i=s.forwardRef((e,l)=>s.createElement(t.A,r({},e,{ref:l,icon:o.A})))},30289:(e,l)=>{"use strict";l.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"}},38770:(e,l,a)=>{"use strict";a.d(l,{A:()=>s});let s=a(51916).A},61825:(e,l,a)=>{"use strict";a.d(l,{A:()=>i});var s=a(97109),o=a(30289),t=a(88483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var a=arguments[l];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}let i=s.forwardRef((e,l)=>s.createElement(t.A,r({},e,{ref:l,icon:o.A})))},77305:(e,l,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return a(98841)}])},78847:(e,l)=>{"use strict";l.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"}},98841:(e,l,a)=>{"use strict";a.r(l),a.d(l,{default:()=>R});var s=a(65321),o=a(97109),t=a(79059),r=a(17807),i=a(88762),n=a(68787),c=a(85114),d=a(2256),m=a(38770),h=a(33442),p=a(26171),u=a(11702),x=a(85493),v=a(57271),y=a(7576),g=a(48318),j=a(34052),A=a(63455),f=a(56985),b=a(54746),z=a(29071),w=a(59188),S=a(4216),k=a(13114),C=a(99650),O=a(58209),B=a(69),I=a(88483);function T(){return(T=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var a=arguments[l];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}let P=o.forwardRef((e,l)=>o.createElement(I.A,T({},e,{ref:l,icon:B.A})));var E=a(61825),K=a(6578);let M=[{label:"OpenAI 兼容",value:"openai"},{label:"Anthropic",value:"anthropic"},{label:"Google",value:"google"},{label:"Ollama",value:"ollama"},{label:"OpenRouter",value:"openrouter"}],H=[{key:"reader",labelKey:"models.tierReader",descKey:"models.tierReaderDesc"},{key:"reasoning",labelKey:"models.tierReasoning",descKey:"models.tierReasoningDesc"},{key:"action",labelKey:"models.tierAction",descKey:"models.tierActionDesc"}],L=[{key:"imageGeneration",label:"图片生成"},{key:"imageUnderstanding",label:"图片理解"},{key:"fileUnderstanding",label:"文件理解"},{key:"audio",label:"音频能力"},{key:"video",label:"视频能力"}];function R(){let e=(0,t.Vr)(),{message:l}=r.A.useApp(),[a,B]=(0,o.useState)(!0),[I,T]=(0,o.useState)([]),[R,N]=(0,o.useState)(null),[U,_]=(0,o.useState)({provider:"transformers-local",model:"BAAI/bge-small-zh-v1.5",dimensions:512}),[$,F]=(0,o.useState)(!1),[V,D]=(0,o.useState)(!1),[W,G]=(0,o.useState)(null),[X,Z]=(0,o.useState)(null),[q,J]=(0,o.useState)({}),[Q,Y]=(0,o.useState)(!1),[ee,el]=(0,o.useState)(!1),[ea,es]=(0,o.useState)(""),[eo,et]=(0,o.useState)(""),[er,ei]=(0,o.useState)(""),[en,ec]=(0,o.useState)(""),[ed,em]=(0,o.useState)("openai"),[eh,ep]=(0,o.useState)(!1),[eu,ex]=(0,o.useState)({}),[ev,ey]=(0,o.useState)(!1),eg=async()=>{B(!0);try{let[e,l,a]=await Promise.all([(0,K.Z3)().catch(()=>[]),(0,K.zr)().catch(()=>null),(0,K.II)().catch(()=>({provider:"transformers-local",model:"BAAI/bge-small-zh-v1.5",dimensions:512}))]);T(e),N(l),_(a)}catch(a){l.error(e("common.error"))}finally{B(!1)}};(0,o.useEffect)(()=>{eg()},[]);let ej=async e=>{el(!0),es(e.name),et(e.name),ei(""),ec(e.baseUrl||""),em(e.protocol||e.detectedProtocol||"openai"),ex(e.capabilities||{});try{let l=await (0,K.Bh)(e.name);ei(l.apiKey?"••••••••":""),ec(l.baseUrl||""),ex(l.capabilities||{})}catch(e){}Y(!0)},eA=async()=>{if(eo.trim()){ey(!0);try{let a=ee&&er.includes("•")?void 0:er||void 0;await (0,K._m)(eo.trim(),{oldName:ee?ea:void 0,apiKey:a,baseUrl:en||void 0,protocol:ed,directEndpoint:eh,capabilities:eu}),Y(!1),await eg(),l.success(e("common.success"))}catch(a){l.error(e("common.error"))}finally{ey(!1)}}},ef=async a=>{try{await (0,K.h1)(a),await eg(),l.success(e("common.success"))}catch(a){l.error(e("common.error"))}},eb=async a=>{Z(a);try{let s=await (0,K.bZ)(a);J(e=>({...e,[a]:s.success})),l[s.success?"success":"error"](s.success?e("models.connected"):e("models.connectionFailed"))}catch(e){J(e=>({...e,[a]:!1}))}finally{Z(null)}},ez=async(a,s)=>{if(!R)return;let o={...R},t=o[a];if(!s){t.active="",N(o);try{await (0,K.aP)(o)}catch(a){l.error(e("common.error"))}return}let[r,i]=s.includes(":")?s.split(":"):[s,s];t.active=i,t.list.some(e=>e.name===i&&e.provider===r)||t.list.push({name:i,provider:r}),N(o);try{await (0,K.aP)(o)}catch(a){l.error(e("common.error"))}},ew=async()=>{F(!0);try{let a=await (0,K.dd)(U);_(a),G(null),l.success(e("common.success"))}catch(a){l.error(e("common.error"))}finally{F(!1)}},eS=async()=>{D(!0);try{let a=await (0,K.u6)();G(a.success),l[a.success?"success":"error"](a.message||(a.success?e("models.connected"):e("models.connectionFailed")))}catch(e){G(!1)}finally{D(!1)}};return a?(0,s.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,s.jsx)(i.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,s.jsx)(n.A,{size:"small",children:(0,s.jsx)(i.A,{active:!0,paragraph:{rows:6}})}),(0,s.jsx)(n.A,{size:"small",children:(0,s.jsx)(i.A,{active:!0,paragraph:{rows:4}})}),(0,s.jsx)(n.A,{size:"small",children:(0,s.jsx)(i.A,{active:!0,paragraph:{rows:3}})})]}):(0,s.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"pageTitle",children:e("models.title")}),(0,s.jsx)("p",{className:"pageDesc",children:e("models.description")})]}),(0,s.jsx)(c.Ay,{type:"primary",icon:(0,s.jsx)(b.A,{}),onClick:()=>{el(!1),es(""),et(""),ei(""),ec(""),em("openai"),ep(!1),ex({}),Y(!0)},children:e("models.addModel")})]}),(0,s.jsx)(n.A,{size:"small",title:"".concat(e("models.modelList")," (").concat(I.length,")"),children:0===I.length?(0,s.jsx)("span",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:e("models.noProviders")}):(0,s.jsx)(d.A,{gutter:[12,12],children:I.map((l,a)=>(0,s.jsx)(m.A,{xs:24,sm:12,lg:8,xl:6,children:(0,s.jsxs)(n.A,{size:"small",hoverable:!0,style:{height:"100%"},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:8,minWidth:0},children:[(0,s.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,s.jsx)("div",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.name}),(0,s.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,s.jsx)(z.A,{})," ",l.protocol||l.detectedProtocol||"openai"]})]}),(0,s.jsxs)(h.A,{size:2,children:[(0,s.jsx)(c.Ay,{size:"small",loading:X===l.name,onClick:()=>{eb(l.name)},icon:!0===q[l.name]?(0,s.jsx)(w.A,{style:{color:"var(--colorOk)"}}):!1===q[l.name]?(0,s.jsx)(S.A,{style:{color:"var(--colorDanger)"}}):(0,s.jsx)(k.A,{})}),(0,s.jsx)(c.Ay,{size:"small",icon:(0,s.jsx)(C.A,{}),onClick:()=>{ej(l)}}),(0,s.jsx)(p.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{ef(l.name)},children:(0,s.jsx)(c.Ay,{size:"small",danger:!0,icon:(0,s.jsx)(O.A,{})})})]})]}),(0,s.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,s.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,s.jsx)(P,{})," ",l.hasApiKey?"••••••••":"—"]}),l.baseUrl&&(0,s.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:l.baseUrl,children:[(0,s.jsx)(E.A,{})," ",l.baseUrl]}),(0,s.jsx)(h.A,{size:4,wrap:!0,children:L.filter(e=>{var a;return null==(a=l.capabilities)?void 0:a[e.key]}).map(e=>(0,s.jsx)(u.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.label},e.key))})]})]})},l.name))})}),(0,s.jsxs)(n.A,{size:"small",title:e("models.embeddingConfig"),children:[(0,s.jsx)(x.A,{type:"info",showIcon:!0,message:e("models.embeddingHint"),style:{marginBottom:16}}),(0,s.jsxs)(d.A,{gutter:[12,12],children:[(0,s.jsxs)(m.A,{xs:24,sm:8,children:[(0,s.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:e("models.embeddingProvider")}),(0,s.jsx)(v.A,{value:U.provider,style:{width:"100%"},options:[{label:"本地语义模型(推荐)",value:"transformers-local"},{label:"外部 Embedding(高级)",value:"openai-compatible"}],onChange:e=>_(l=>({...l,provider:e,model:"transformers-local"===e?l.model||"BAAI/bge-small-zh-v1.5":l.model,dimensions:"transformers-local"===e?512:l.dimensions||1024}))})]}),"openai-compatible"===U.provider&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(m.A,{xs:24,sm:8,children:[(0,s.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:"Base URL"}),(0,s.jsx)(y.A,{value:U.baseUrl,onChange:e=>_(l=>({...l,baseUrl:e.target.value})),placeholder:"http://localhost:11434/v1"})]}),(0,s.jsxs)(m.A,{xs:24,sm:8,children:[(0,s.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:e("models.model")}),(0,s.jsx)(y.A,{value:U.model,onChange:e=>_(l=>({...l,model:e.target.value})),placeholder:"bge-m3"})]}),(0,s.jsxs)(m.A,{xs:24,sm:8,children:[(0,s.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:e("models.apiKey")}),(0,s.jsx)(y.A.Password,{value:U.apiKey,onFocus:()=>{var e;(null==(e=U.apiKey)?void 0:e.includes("•"))&&_(e=>({...e,apiKey:""}))},onChange:e=>_(l=>({...l,apiKey:e.target.value})),placeholder:e("models.optional")}),U.hasApiKey&&(0,s.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginTop:4},children:e("models.embeddingApiKeyHint")})]})]}),"transformers-local"===U.provider&&(0,s.jsxs)(m.A,{xs:24,sm:8,children:[(0,s.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:e("models.model")}),(0,s.jsx)(y.A,{value:U.model,onChange:e=>_(l=>({...l,model:e.target.value})),placeholder:"BAAI/bge-small-zh-v1.5"})]}),(0,s.jsxs)(m.A,{xs:24,sm:8,children:[(0,s.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:e("models.dimensions")}),(0,s.jsx)(g.A,{style:{width:"100%"},min:1,value:U.dimensions,onChange:e=>_(l=>({...l,dimensions:Number(e||("transformers-local"===l.provider?512:1024))}))})]}),(0,s.jsxs)(m.A,{xs:24,sm:8,children:[(0,s.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:e("models.status")}),(0,s.jsxs)(h.A,{children:[(0,s.jsx)(u.A,{color:"blue",children:"transformers-local"===U.provider?"本地语义模型":e("models.openAICompatible")}),!0===W&&(0,s.jsx)(u.A,{color:"success",children:e("models.connected")}),!1===W&&(0,s.jsx)(u.A,{color:"error",children:e("models.connectionFailed")})]})]})]}),(0,s.jsxs)(h.A,{style:{marginTop:16},children:[(0,s.jsx)(c.Ay,{type:"primary",loading:$,onClick:()=>{ew()},children:e("models.saveEmbedding")}),(0,s.jsx)(c.Ay,{loading:V,onClick:()=>{eS()},children:e("models.testEmbedding")})]})]}),R&&(0,s.jsx)(n.A,{size:"small",title:e("models.modelTiers"),children:(0,s.jsx)(d.A,{gutter:[12,12],children:H.map(l=>{let{key:a,labelKey:o,descKey:t}=l,r=R[a],i=r.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),c=I.filter(e=>!r.list.some(l=>l.provider===e.name)).map(e=>({label:e.name,value:"".concat(e.name,":").concat(e.name)})),d=r.active?r.list.find(e=>e.name===r.active):null;return(0,s.jsx)(m.A,{xs:24,lg:8,children:(0,s.jsxs)(n.A,{size:"small",title:(0,s.jsx)("span",{style:{fontSize:14},children:e(o)}),style:{height:"100%"},children:[(0,s.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8,lineHeight:1.5},children:e(t)}),(0,s.jsx)(v.A,{value:r.active?"".concat((null==d?void 0:d.provider)||"",":").concat(r.active):void 0,onChange:e=>{ez(a,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),style:{width:"100%"},options:[...i,...c]}),d&&(()=>{let e=I.find(e=>e.name===d.provider);return(0,s.jsxs)("div",{style:{marginTop:12,padding:"8px 12px",background:"var(--colorBgElevated)",borderRadius:6,border:"1px solid var(--colorBorderSecondary)",display:"flex",alignItems:"center",gap:8},children:[(0,s.jsx)(k.A,{style:{color:"var(--colorAccent)",fontSize:14,flexShrink:0}}),(0,s.jsx)("span",{style:{fontSize:12,fontWeight:500,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.provider}),(null==e?void 0:e.capabilities)&&L.filter(l=>e.capabilities[l.key]).length>0&&(0,s.jsx)(h.A,{size:4,wrap:!0,style:{flexShrink:0},children:L.filter(l=>e.capabilities[l.key]).slice(0,2).map(e=>(0,s.jsx)(u.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.label},e.key))}),(0,s.jsx)(u.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"18px",flexShrink:0},children:"激活"})]})})()]})},a)})})}),(0,s.jsx)(j.A,{title:ee?e("models.editModel"):e("models.addModel"),open:Q,onClose:()=>Y(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,s.jsx)(c.Ay,{type:"primary",loading:ev,onClick:()=>{eA()},children:e("common.save")}),children:(0,s.jsxs)(A.A,{layout:"vertical",children:[(0,s.jsx)(A.A.Item,{label:e("models.modelName"),children:(0,s.jsx)(y.A,{value:eo,onChange:e=>et(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,s.jsx)(A.A.Item,{label:e("models.apiKey"),help:ee?e("models.apiKeyEditHint"):void 0,children:(0,s.jsx)(y.A.Password,{value:er,onFocus:()=>{ee&&er.includes("•")&&ei("")},onChange:e=>ei(e.target.value),placeholder:ee?e("models.apiKeyEditPlaceholder"):"sk-..."})}),(0,s.jsx)(A.A.Item,{label:e("models.baseUrl"),children:(0,s.jsx)(y.A,{value:en,onChange:e=>ec(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,s.jsx)(A.A.Item,{label:e("models.protocol"),children:(0,s.jsx)(v.A,{value:ed,onChange:em,options:M})}),(0,s.jsx)(A.A.Item,{label:"直连端点",children:(0,s.jsx)(f.A,{checked:eh,onChange:e=>ep(e.target.checked),children:"Base URL 是完整接口地址"})}),(0,s.jsx)(A.A.Item,{label:"多模态能力",children:(0,s.jsx)(f.A.Group,{value:L.filter(e=>eu[e.key]).map(e=>e.key),options:L.map(e=>({label:e.label,value:e.key})),onChange:e=>ex(Object.fromEntries(L.map(l=>[l.key,e.includes(l.key)])))})})]})})]})}}},e=>{e.O(0,[433,787,576,195,985,455,938,636,593,792],()=>e(e.s=77305)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[449],{27795:(e,l,s)=>{"use strict";s.r(l),s.d(l,{default:()=>T});var t=s(65321),r=s(97109),i=s(79059),c=s(85114),o=s(2256),n=s(38770),a=s(68787),x=s(99605),d=s(54849),h=s(33442),v=s(11702),m=s(99811),u=s(520),j=s(93314),A=s(13114),y=s(29071),p=s(26631),g=s(84742),f=s(38762),w=s(8579),k=s(9020),z=s(32632),S=s(95118),N=s(24810),_=s(6578);function T(){var e,l,s,T,P,b,O,C,D,E,M,F;let I=(0,i.Vr)(),[B,W]=(0,r.useState)(null),[U,X]=(0,r.useState)(!0),[R,V]=(0,r.useState)(0),[Z,q]=(0,r.useState)(0),[G,H]=(0,r.useState)(0),[J,K]=(0,r.useState)(0),[L,Q]=(0,r.useState)(0),[Y,$]=(0,r.useState)(null),ee=(0,r.useCallback)(async()=>{X(!0);try{let[e,l,s,t,r,i]=await Promise.all([(0,_.FC)(),(0,_.Z3)().catch(()=>[]),(0,_.lv)().catch(()=>({roles:[],configs:[]})),(0,_.mx)().catch(()=>({specs:[]})),(0,_.Dl)().catch(()=>({templates:[]})),(0,_.II)().catch(()=>null)]);W(e),V(Array.isArray(l)?l.length:0);let c=Array.isArray(s.roles)?s.roles:[];q(c.filter(e=>"file"===e.type).length),H(c.filter(e=>"prompt"===e.type).length),K(Array.isArray(t.specs)?t.specs.length:0),Q(Array.isArray(r.templates)?r.templates.length:0),$(i)}catch(e){}finally{X(!1)}},[]);(0,r.useEffect)(()=>{ee();let e=setInterval(()=>{ee()},1e4);return()=>clearInterval(e)},[ee]);let el=(null!=(l=null==B?void 0:B.cpu.usagePercent)?l:0)>80?"var(--colorDanger)":(null!=(s=null==B?void 0:B.cpu.usagePercent)?s:0)>50?"var(--colorWarning)":"var(--colorOk)",es=(null!=(T=null==B?void 0:B.memory.usagePercent)?T:0)>80?"var(--colorDanger)":(null!=(P=null==B?void 0:B.memory.usagePercent)?P:0)>50?"var(--colorWarning)":"var(--colorOk)",et=(null==B?void 0:B.tasks.total)?Math.round(B.tasks.success/B.tasks.total*100):0,er=null==B||null==(e=B.models)?void 0:e[0];return(0,t.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"pageTitle",children:I("overview.title")}),(0,t.jsx)("p",{className:"pageDesc",children:I("overview.description")})]}),(0,t.jsx)(c.Ay,{icon:(0,t.jsx)(m.A,{spin:U}),loading:U,onClick:()=>{ee()},children:I("common.retry")})]}),(0,t.jsxs)(o.A,{gutter:[16,16],children:[(0,t.jsx)(n.A,{xs:24,sm:12,children:(0,t.jsx)(a.A,{size:"small",title:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.A,{})," CPU"]}),children:(0,t.jsxs)("div",{style:{textAlign:"center"},children:[(0,t.jsx)(x.A,{type:"circle",percent:null!=(b=null==B?void 0:B.cpu.usagePercent)?b:0,size:120,strokeColor:el,format:e=>"".concat(null==e?void 0:e.toFixed(1),"%")}),(0,t.jsxs)("div",{className:"text-xs mt-2",style:{color:"var(--colorTextSecondary)"},children:[null!=(O=null==B?void 0:B.cpu.cores)?O:0," ",I("overview.cores")]})]})})}),(0,t.jsx)(n.A,{xs:24,sm:12,children:(0,t.jsx)(a.A,{size:"small",title:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.A,{})," ",I("overview.memory")]}),children:(0,t.jsxs)("div",{style:{textAlign:"center"},children:[(0,t.jsx)(x.A,{type:"circle",percent:null!=(C=null==B?void 0:B.memory.usagePercent)?C:0,size:120,strokeColor:es,format:e=>"".concat(e,"%")}),(0,t.jsxs)("div",{className:"text-xs mt-2",style:{color:"var(--colorTextSecondary)"},children:[null!=(D=null==B?void 0:B.memory.processMB)?D:0," MB / ",null!=(E=null==B?void 0:B.memory.totalMB)?E:0," MB"]})]})})})]}),(0,t.jsxs)(o.A,{gutter:[16,16],children:[(0,t.jsx)(n.A,{xs:12,sm:6,children:(0,t.jsx)(a.A,{size:"small",children:(0,t.jsx)(d.A,{title:"运行时间",value:B?Math.floor(B.uptime/3600):0,suffix:"小时",prefix:(0,t.jsx)(A.A,{})})})}),(0,t.jsx)(n.A,{xs:12,sm:6,children:(0,t.jsx)(a.A,{size:"small",children:(0,t.jsx)(d.A,{title:I("overview.tokensUsed"),value:null!=(M=null==B?void 0:B.tokens.total)?M:0,prefix:(0,t.jsx)(y.A,{})})})}),(0,t.jsx)(n.A,{xs:12,sm:6,children:(0,t.jsx)(a.A,{size:"small",children:(0,t.jsx)(d.A,{title:I("overview.tasksTotal"),value:null!=(F=null==B?void 0:B.tasks.total)?F:0,prefix:(0,t.jsx)(p.A,{})})})}),(0,t.jsx)(n.A,{xs:12,sm:6,children:(0,t.jsx)(a.A,{size:"small",children:(0,t.jsx)(d.A,{title:I("overview.successRate"),value:et,suffix:"%",prefix:et>80?(0,t.jsx)(g.A,{style:{color:"var(--colorOk)"}}):(0,t.jsx)(f.A,{style:{color:"var(--colorDanger)"}})})})})]}),(0,t.jsx)(a.A,{size:"small",title:"资源概览",children:(0,t.jsxs)(o.A,{gutter:[16,16],children:[(0,t.jsx)(n.A,{xs:24,sm:12,md:8,lg:4,children:(0,t.jsx)(a.A,{size:"small",style:{height:"100%"},children:(0,t.jsx)(d.A,{title:"文件角色",value:Z,prefix:(0,t.jsx)(p.A,{style:{color:"var(--colorAccent)"}})})})}),(0,t.jsx)(n.A,{xs:24,sm:12,md:8,lg:4,children:(0,t.jsx)(a.A,{size:"small",style:{height:"100%"},children:(0,t.jsx)(d.A,{title:"提示词角色",value:G,prefix:(0,t.jsx)(w.A,{style:{color:"var(--colorWarning)"}})})})}),(0,t.jsx)(n.A,{xs:24,sm:12,md:8,lg:4,children:(0,t.jsx)(a.A,{size:"small",style:{height:"100%"},children:(0,t.jsx)(d.A,{title:"文档规范包",value:J,prefix:(0,t.jsx)(k.A,{style:{color:"var(--colorOk)"}})})})}),(0,t.jsx)(n.A,{xs:24,sm:12,md:8,lg:4,children:(0,t.jsx)(a.A,{size:"small",style:{height:"100%"},children:(0,t.jsx)(d.A,{title:"模板",value:L,prefix:(0,t.jsx)(z.A,{style:{color:"var(--colorDanger)"}})})})}),(0,t.jsx)(n.A,{xs:24,sm:12,md:8,lg:4,children:(0,t.jsxs)(a.A,{size:"small",style:{height:"100%",overflow:"hidden"},children:[(0,t.jsx)(d.A,{title:"语义模型",value:(null==Y?void 0:Y.provider)==="openai-compatible"?"外部 Embedding":Y?"本地语义模型":"—",prefix:(0,t.jsx)(S.A,{style:{color:"var(--colorAccent)"}}),valueStyle:{fontSize:18,whiteSpace:"nowrap"}}),(null==Y?void 0:Y.model)&&(0,t.jsxs)("div",{className:"text-xs mt-1",style:{color:"var(--colorTextSecondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:"".concat(Y.model).concat(Y.dimensions?" \xb7 ".concat(Y.dimensions,"维"):""),children:[Y.model,Y.dimensions?" \xb7 ".concat(Y.dimensions,"维"):""]})]})}),(0,t.jsx)(n.A,{xs:24,sm:12,md:8,lg:4,children:(0,t.jsx)(a.A,{size:"small",style:{height:"100%"},children:(0,t.jsx)(d.A,{title:"模型供应商",value:R,prefix:(0,t.jsx)(N.A,{style:{color:"var(--colorAccent)"}})})})})]})}),(0,t.jsxs)(o.A,{gutter:[16,16],children:[(0,t.jsx)(n.A,{xs:24,sm:12,children:(0,t.jsx)(a.A,{size:"small",title:I("overview.topModel"),style:{height:"100%"},children:er?(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(A.A,{style:{fontSize:24,color:"var(--colorAccent)"}}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-semibold",children:er.model}),(0,t.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["@",er.provider," — ",er.count," ",I("overview.calls")]})]})]}):(0,t.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:I("common.noData")})})}),(0,t.jsx)(n.A,{xs:24,sm:12,children:(0,t.jsx)(a.A,{size:"small",title:I("overview.taskTypes"),style:{height:"100%"},children:(null==B?void 0:B.tasks.types)&&Object.keys(B.tasks.types).length>0?(0,t.jsx)(h.A,{wrap:!0,children:Object.entries(B.tasks.types).map(e=>{let[l,s]=e;return(0,t.jsxs)(v.A,{children:[l.slice(0,30),": ",s]},l)})}):(0,t.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:I("common.noData")})})})]})]})}},53139:(e,l,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/overview",function(){return s(27795)}])}},e=>{e.O(0,[433,787,131,636,593,792],()=>e(e.s=53139)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{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"}},23830:(e,t)=>{"use strict";t.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"}},26631:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var o=r(97109),i=r(12887),n=r(88483);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 o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let l=o.forwardRef((e,t)=>o.createElement(n.A,a({},e,{ref:t,icon:i.A})))},27549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(34508)}])},29606:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var o=r(97109),i=r(23830),n=r(88483);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 o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let l=o.forwardRef((e,t)=>o.createElement(n.A,a({},e,{ref:t,icon:i.A})))},34508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>H});var o=r(65321),i=r(97109),n=r(79059),a=r(17807),l=r(88762),s=r(68787),c=r(33442),d=r(11702),p=r(57271),h=r(85114),m=r(84253),u=r(56985),f=r(26171),y=r(34052),x=r(7576),g=r(29606),j=r(54746),v=r(26631),w=r(99650),A=r(58209);async function S(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function b(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 z(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 C(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 T(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()}function O(e){return e.id.startsWith("builtin:")}function k(e){return e.id.startsWith("custom:")}function H(){let e=(0,n.Vr)(),{message:t}=a.A.useApp(),[r,H]=(0,i.useState)(!0),[N,E]=(0,i.useState)([]),[F,P]=(0,i.useState)(!1),[R,_]=(0,i.useState)(null),[B,M]=(0,i.useState)(""),[I,V]=(0,i.useState)(""),[W,J]=(0,i.useState)(!1),[L,D]=(0,i.useState)(!1),[U,X]=(0,i.useState)("custom"),Z=async()=>{H(!0);try{E(await S())}catch(r){t.error(e("common.error"))}finally{H(!1)}};(0,i.useEffect)(()=>{Z()},[]);let $=r=>{if(null==r?void 0:r.projectRoot)return void z(r.projectRoot).then(()=>{t.success(e("common.success")),Z()}).catch(()=>t.error(e("common.error")));_(null),D(!0),V(""),M(""),P(!0)},q=async()=>{if(!I.trim())return void t.error("请输入名称");J(!0);try{R?await b(R.customizePath,B,k(R)?I.trim():void 0):await C(I.trim(),B||"# ".concat(I.trim(),"\n")),t.success(e("common.success")),P(!1),await Z()}catch(r){t.error(e("common.error"))}finally{J(!1)}},G=async(r,o)=>{let i=o?Array.from(new Set([...N.filter(e=>e.selected).map(e=>e.id),r.id])):N.filter(e=>e.selected&&e.id!==r.id).map(e=>e.id);try{await T(i),E(e=>e.map(e=>({...e,selected:i.includes(e.id)})))}catch(r){t.error(e("common.error"))}},K=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 Z()}catch(r){t.error(e("common.error"))}},Q=N.find(e=>e.isCurrent),Y=N.filter(O),ee=N.filter(k),et=N.filter(e=>!O(e)&&!k(e)),er="all"===U?N:"builtin"===U?Y:"custom"===U?ee:et;return r?(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsx)(l.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)(l.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:[Q&&(0,o.jsxs)(d.A,{color:"green",style:{lineHeight:"22px"},children:[(0,o.jsx)(g.A,{})," ",Q.projectRoot]}),(0,o.jsx)(p.A,{value:U,onChange:X,style:{width:160},options:[{label:"全部 (".concat(N.length,")"),value:"all"},{label:"我的提示词 (".concat(ee.length,")"),value:"custom"},{label:"项目提示词 (".concat(et.length,")"),value:"project"},{label:"内置示例 (".concat(Y.length,")"),value:"builtin"}]}),(0,o.jsx)(h.Ay,{type:"primary",icon:(0,o.jsx)(j.A,{}),onClick:()=>$(),children:"创建提示词"})]})]}),0===er.length?(0,o.jsx)(m.A,{description:e("prompt.noProjects")}):(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:er.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)(v.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)(j.A,{}),onClick:()=>$(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)(g.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:"当前项目"}),O(e)&&(0,o.jsx)(d.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"内置示例"}),k(e)&&(0,o.jsx)(d.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的提示词"}),!O(e)&&!k(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)(u.A,{checked:e.selected,onChange:t=>{G(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)(w.A,{}),onClick:()=>(e=>{if(O(e)){_(null),D(!0),V(e.projectName.replace(/^内置|/,"")+" Copy"),M(e.content||""),P(!0),t.info("内置提示词不可直接编辑,已为你创建副本");return}_(e),D(!1),V(e.projectName),M(e.content||""),P(!0)})(e),children:O(e)?"复制":"编辑"}),(0,o.jsx)(f.A,{title:O(e)?"删除内置提示词?":k(e)?"删除自定义提示词?":"删除项目记录及文件?",disabled:O(e),onConfirm:()=>{K(e)},children:(0,o.jsx)(h.Ay,{size:"small",danger:!0,icon:(0,o.jsx)(A.A,{}),disabled:O(e)})})]})]},e.id)})}),(0,o.jsxs)(y.A,{title:L?"创建提示词":R&&k(R)?"编辑我的提示词 — ".concat(I||R.projectName):"编辑项目提示词 — ".concat((null==R?void 0:R.projectName)||""),open:F,onClose:()=>P(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,o.jsxs)(c.A,{children:[(0,o.jsx)(h.Ay,{onClick:()=>P(!1),children:e("common.cancel")}),(0,o.jsx)(h.Ay,{type:"primary",loading:W,onClick:()=>{q()},children:e("common.save")})]}),children:[(0,o.jsx)("div",{style:{marginBottom:12},children:L||R&&k(R)?(0,o.jsxs)(c.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,o.jsx)(x.A,{placeholder:"提示词名称",value:I,onChange:e=>V(e.target.value),style:{maxWidth:400}}),!L&&(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==R?void 0:R.customizePath})]}):(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==R?void 0:R.customizePath})}),(0,o.jsx)(x.A.TextArea,{value:B,onChange:e=>M(e.target.value),rows:25,style:{fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13}})]})]})}}},e=>{e.O(0,[433,787,576,195,985,636,593,792],()=>e(e.s=27549)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[199],{2256:(e,l,s)=>{"use strict";s.d(l,{A:()=>i});let i=s(25341).A},7368:(e,l,s)=>{"use strict";s.r(l),s.d(l,{default:()=>S});var i=s(65321),t=s(97109),r=s(79059),n=s(49759),o=s(88762),d=s(2256),a=s(38770),c=s(68787),x=s(11702),h=s(73340),y=s(1278);let g=(0,y.A)("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);var v=s(56733),j=s(38300);let p=(0,y.A)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);var m=s(87824);let u=(0,y.A)("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var f=s(6578);let A=(e,l,s)=>(0,i.jsx)("div",{style:{width:32,height:32,borderRadius:8,background:l,display:"flex",alignItems:"center",justifyContent:"center",color:s,flexShrink:0},children:e});function S(){var e,l;let s=(0,r.Vr)("settings"),{theme:y,resolvedTheme:S,setTheme:b}=(0,n.D)(),{locale:z,setLocale:k}=(0,r.x_)(),[w,T]=(0,t.useState)(null),[B,N]=(0,t.useState)(null),[F,_]=(0,t.useState)(null),[C,I]=(0,t.useState)(!0);(0,t.useEffect)(()=>{I(!0),Promise.all([(0,f.FC)().catch(()=>null),(0,f.le)().catch(()=>null),(0,f.II)().catch(()=>null)]).then(e=>{let[l,s,i]=e;T(l),N(s),_(i)}).finally(()=>I(!1))},[]);let W="system"===y?"system":S,M=e=>"applePill".concat(e?" applePillActive":"");return C?(0,i.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,i.jsx)(o.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,i.jsxs)(d.A,{gutter:[16,16],children:[Array.from({length:4}).map((e,l)=>(0,i.jsx)(a.A,{xs:24,md:12,children:(0,i.jsx)(c.A,{size:"small",children:(0,i.jsx)(o.A,{active:!0,paragraph:{rows:2}})})},l)),(0,i.jsx)(a.A,{xs:24,children:(0,i.jsx)(c.A,{size:"small",children:(0,i.jsx)(o.A,{active:!0,paragraph:{rows:4}})})})]})]}):(0,i.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"pageTitle",children:s("title")}),(0,i.jsx)("p",{className:"pageDesc",children:s("description")})]}),(0,i.jsxs)(d.A,{gutter:[16,16],children:[(0,i.jsx)(a.A,{xs:24,md:12,style:{display:"flex"},children:(0,i.jsxs)(c.A,{size:"small",style:{flex:1},styles:{body:{padding:"14px 18px"}},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:14},children:[A((0,i.jsx)(h.A,{size:16}),"rgba(88,86,214,0.1)","#5856d6"),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{style:{fontWeight:600,fontSize:14},children:s("language")}),(0,i.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:s("languageDesc")})]})]}),(0,i.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,i.jsx)("button",{className:M("zh-CN"===z),onClick:()=>k("zh-CN"),children:"中文"}),(0,i.jsx)("button",{className:M("en-US"===z),onClick:()=>k("en-US"),children:"English"})]})]})}),(0,i.jsx)(a.A,{xs:24,md:12,style:{display:"flex"},children:(0,i.jsxs)(c.A,{size:"small",style:{flex:1},styles:{body:{padding:"14px 18px"}},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:14},children:[A((0,i.jsx)(g,{size:16}),"rgba(250,140,22,0.1)","#fa8c16"),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{style:{fontWeight:600,fontSize:14},children:s("theme")}),(0,i.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:s("themeDesc")})]})]}),(0,i.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,i.jsxs)("button",{className:M("light"===W),onClick:()=>b("light"),children:[(0,i.jsx)(v.A,{size:14}),s("light")]}),(0,i.jsxs)("button",{className:M("dark"===W),onClick:()=>b("dark"),children:[(0,i.jsx)(j.A,{size:14}),s("dark")]}),(0,i.jsxs)("button",{className:M("system"===W),onClick:()=>b("system"),children:[(0,i.jsx)(g,{size:14}),s("system")]})]})]})}),(0,i.jsx)(a.A,{xs:24,md:12,style:{display:"flex"},children:(0,i.jsxs)(c.A,{size:"small",style:{flex:1},styles:{body:{padding:"14px 18px"}},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:14},children:[A((0,i.jsx)(p,{size:16}),"rgba(22,119,255,0.1)","#1677ff"),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{style:{fontWeight:600,fontSize:14},children:"服务运行状态"}),(0,i.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:"查看当前服务是否正常,以及本机资源占用情况。"})]})]}),(0,i.jsxs)(d.A,{gutter:[12,12],children:[(0,i.jsx)(a.A,{span:12,children:(0,i.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,i.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"状态"}),(0,i.jsx)(x.A,{color:(null==B?void 0:B.status)==="ok"?"success":"error",style:{margin:0},children:(null==B?void 0:B.status)==="ok"?"运行中":"—"})]})}),(0,i.jsx)(a.A,{span:12,children:(0,i.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,i.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"运行时间"}),(0,i.jsx)("div",{style:{fontSize:14,fontWeight:600},children:B?(e=>{let l=Math.floor(e/86400),s=Math.floor(e%86400/3600),i=Math.floor(e%3600/60);return l>0?"".concat(l," 天 ").concat(s," 小时"):s>0?"".concat(s," 小时 ").concat(i," 分"):"".concat(i," 分")})(B.uptime):"—"})]})}),(0,i.jsx)(a.A,{span:12,children:(0,i.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,i.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"CPU"}),(0,i.jsx)("div",{style:{fontSize:14,fontWeight:600},children:w?"".concat(w.cpu.usagePercent.toFixed(1),"%"):"—"}),(0,i.jsxs)("div",{style:{fontSize:10,color:"var(--colorTextSecondary)"},children:[null!=(e=null==w?void 0:w.cpu.cores)?e:0," 核"]})]})}),(0,i.jsx)(a.A,{span:12,children:(0,i.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,i.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"内存"}),(0,i.jsx)("div",{style:{fontSize:14,fontWeight:600},children:w?"".concat(w.memory.processMB," MB"):"—"}),(0,i.jsxs)("div",{style:{fontSize:10,color:"var(--colorTextSecondary)"},children:["/ ",null!=(l=null==w?void 0:w.memory.totalMB)?l:0," MB"]})]})})]})]})}),(0,i.jsx)(a.A,{xs:24,md:12,style:{display:"flex"},children:(0,i.jsxs)(c.A,{size:"small",style:{flex:1},styles:{body:{padding:"14px 18px"}},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:14},children:[A((0,i.jsx)(m.A,{size:16}),"rgba(82,196,26,0.1)","#52c41a"),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{style:{fontWeight:600,fontSize:14},children:"知识库向量配置"}),(0,i.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:"用于知识库检索。修改模型或维度后,建议重新索引知识库。"})]})]}),(0,i.jsxs)(d.A,{gutter:[12,12],children:[(0,i.jsx)(a.A,{span:12,children:(0,i.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,i.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"供应商"}),(0,i.jsx)(x.A,{color:"blue",style:{margin:0},children:(null==F?void 0:F.provider)||"—"})]})}),(0,i.jsx)(a.A,{span:12,children:(0,i.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,i.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"密钥状态"}),(null==F?void 0:F.hasApiKey)?(0,i.jsx)(x.A,{color:"success",style:{margin:0},children:"已配置"}):(0,i.jsx)(x.A,{color:"default",style:{margin:0},children:"未配置"})]})}),(0,i.jsx)(a.A,{span:12,children:(0,i.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,i.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"模型"}),(0,i.jsx)("div",{style:{fontSize:12,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(null==F?void 0:F.model)||"—"})]})}),(0,i.jsx)(a.A,{span:12,children:(0,i.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,i.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"维度"}),(0,i.jsx)("div",{style:{fontSize:14,fontWeight:600},children:(null==F?void 0:F.dimensions)?"".concat(F.dimensions):"—"})]})})]})]})}),(0,i.jsx)(a.A,{xs:24,children:(0,i.jsxs)(c.A,{size:"small",styles:{body:{padding:"14px 18px"}},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:14},children:[A((0,i.jsx)(u,{size:16}),"rgba(114,46,209,0.1)","#722ed1"),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{style:{fontWeight:600,fontSize:14},children:"本地数据与使用概况"}),(0,i.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:"用户数据保存在本机,包含知识库、提示词、角色配置、规范包、生成记录和日志。"})]})]}),(0,i.jsx)(d.A,{gutter:[8,8],children:[{label:"用户数据目录",value:"~/.customize-agent/",mono:!0},{label:"知识库数据",value:"本地索引与向量库"},{label:"生成记录",value:"草稿、导出和资源"},{label:"配置数据",value:"提示词、角色、规范包"},{label:"累计任务",value:w?w.tasks.total.toLocaleString():"—"},{label:"Token 用量",value:w?w.tokens.total.toLocaleString():"—"},{label:"日志",value:"本地运行日志"},{label:"数据范围",value:"仅保存在本机"}].map(e=>(0,i.jsx)(a.A,{xs:12,sm:6,children:(0,i.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"8px 12px"},children:[(0,i.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:2},children:e.label}),(0,i.jsx)("div",{style:{fontSize:13,fontWeight:600,fontFamily:e.mono?"monospace":void 0},children:e.value})]})},e.label))})]})})]})]})}},38770:(e,l,s)=>{"use strict";s.d(l,{A:()=>i});let i=s(51916).A},58451:(e,l,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/settings",function(){return s(7368)}])}},e=>{e.O(0,[433,787,636,593,792],()=>e(e.s=58451)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[979],{14995:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"}},39214:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/system/logs",function(){return r(91698)}])},91698:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>k});var a=r(65321),s=r(97109),i=r(35292),n=r(9137),l=r(11702),o=r(88762),c=r(33442),d=r(85114),h=r(26171),p=r(85493),g=r(7576),u=r(21289),x=r(84253),f=r(99811),y=r(58209),m=r(96651),w=r(60470),j=r(79059),v=r(6578);let{Text:A,Paragraph:b}=i.A;function k(){let e=(0,j.Vr)(),[t,r]=(0,s.useState)([]),[i,k]=(0,s.useState)(!0),[S,z]=(0,s.useState)(""),[I,C]=(0,s.useState)(!1),N=async()=>{k(!0);try{r((await (0,v.oH)(500)).logs)}catch(e){n.Ay.error(e instanceof Error?e.message:"加载日志失败")}finally{k(!1)}};(0,s.useEffect)(()=>{N()},[]);let B=(0,s.useMemo)(()=>{let e=S.trim().toLowerCase();return e?t.filter(t=>[t.id,t.level,t.source,t.functionName,t.message,t.stack].filter(Boolean).some(t=>String(t).toLowerCase().includes(e))):t},[S,t]),O=[{title:"序号",key:"index",width:70,render:(e,t,r)=>r+1},{title:"时间",dataIndex:"createdAt",width:170,render:e=>new Date(e).toLocaleString()},{title:"级别",dataIndex:"level",width:80,render:e=>(0,a.jsx)(l.A,{color:"error"===e?"error":"warn"===e?"warning":"blue",style:{margin:0},children:e})},{title:"来源",dataIndex:"source",width:200,render:e=>(0,a.jsx)(A,{code:!0,style:{fontSize:12},children:e})},{title:"函数",dataIndex:"functionName",width:160,render:e=>e?(0,a.jsx)(A,{code:!0,style:{fontSize:12},children:e}):(0,a.jsx)(A,{type:"secondary",children:"-"})},{title:"错误信息",dataIndex:"message",render:e=>(0,a.jsx)(b,{style:{maxWidth:480,overflowWrap:"anywhere",wordBreak:"break-all",marginBottom:0,fontSize:12},ellipsis:{rows:2,expandable:!0,symbol:"展开"},children:e})},{title:"Request ID",dataIndex:"id",width:200,render:e=>(0,a.jsx)(A,{copyable:!0,code:!0,style:{fontSize:12},children:e.slice(0,8)})}];return i&&0===t.length?(0,a.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,a.jsx)(o.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,a.jsx)(o.A,{active:!0,paragraph:{rows:12}})]}):(0,a.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle",children:e("nav.systemLogs")}),(0,a.jsx)("p",{className:"pageDesc",children:"查看 API 异常、模型健康检查失败、PDF 降级等运行时问题。"})]}),(0,a.jsxs)(c.A,{children:[(0,a.jsx)(d.Ay,{icon:(0,a.jsx)(f.A,{}),loading:i,onClick:()=>void N(),children:"刷新"}),(0,a.jsx)(h.A,{title:"确认清空所有错误日志?",onConfirm:()=>{(async()=>{await (0,v.hH)(),n.Ay.success("已清空"),await N()})()},children:(0,a.jsx)(d.Ay,{danger:!0,icon:(0,a.jsx)(y.A,{}),children:"清空日志"})})]})]}),(0,a.jsx)(p.A,{type:"info",showIcon:!0,message:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,a.jsx)("span",{children:"日志保存在本机 ~/.customize-agent/logs/errors.jsonl,最多读取最近 500 条。"}),(0,a.jsx)(d.Ay,{type:"link",size:"small",icon:I?(0,a.jsx)(m.A,{}):(0,a.jsx)(w.A,{}),onClick:()=>C(!I),style:{padding:"0 4px"},children:I?"收起":"展开"})]}),description:I?"系统自动记录未捕获的异常、API 错误、模型健康检查失败等运行时问题。日志文件超过 2MB 会自动轮转。":void 0}),(0,a.jsx)(g.A.Search,{allowClear:!0,placeholder:"搜索 requestId / source / function / message / stack",value:S,onChange:e=>z(e.target.value),style:{maxWidth:480}}),(0,a.jsx)(u.A,{rowKey:"id",loading:i,dataSource:B,columns:O,size:"middle",locale:{emptyText:(0,a.jsx)(x.A,{description:"暂无错误日志"})},pagination:{pageSize:20,showSizeChanger:!0,showTotal:e=>"共 ".concat(e," 条")},expandable:{expandedRowRender:e=>(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:"8px 0"},children:[e.request&&(0,a.jsxs)("div",{children:[(0,a.jsx)(A,{strong:!0,style:{fontSize:12,marginBottom:4,display:"block"},children:"Request"}),(0,a.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0,padding:10,background:"var(--colorFillAlter)",borderRadius:8,fontSize:12,lineHeight:1.5},children:JSON.stringify(e.request,null,2)})]}),void 0!==e.meta&&(0,a.jsxs)("div",{children:[(0,a.jsx)(A,{strong:!0,style:{fontSize:12,marginBottom:4,display:"block"},children:"Meta"}),(0,a.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0,padding:10,background:"var(--colorFillAlter)",borderRadius:8,fontSize:12,lineHeight:1.5},children:JSON.stringify(e.meta,null,2)})]}),e.stack&&(0,a.jsxs)("div",{children:[(0,a.jsx)(A,{strong:!0,style:{fontSize:12,marginBottom:4,display:"block"},children:"Stack"}),(0,a.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0,padding:10,background:"var(--colorFillAlter)",borderRadius:8,fontSize:12,lineHeight:1.5,maxHeight:300,overflow:"auto"},children:e.stack})]})]})}})]})}},92123:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"}},96651:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var a=r(97109),s=r(92123),i=r(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}let l=a.forwardRef((e,t)=>a.createElement(i.A,n({},e,{ref:t,icon:s.A})))},99811:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var a=r(97109),s=r(14995),i=r(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}let l=a.forwardRef((e,t)=>a.createElement(i.A,n({},e,{ref:t,icon:s.A})))}},e=>{e.O(0,[433,576,195,985,150,289,512,636,593,792],()=>e(e.s=39214)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (()=>{"use strict";var e={},r={};function t(o){var n=r[o];if(void 0!==n)return n.exports;var a=r[o]={exports:{}},f=!0;try{e[o](a,a.exports,t),f=!1}finally{f&&delete r[o]}return a.exports}t.m=e,(()=>{var e=[];t.O=(r,o,n,a)=>{if(o){a=a||0;for(var f=e.length;f>0&&e[f-1][2]>a;f--)e[f]=e[f-1];e[f]=[o,n,a];return}for(var l=1/0,f=0;f<e.length;f++){for(var[o,n,a]=e[f],u=!0,i=0;i<o.length;i++)(!1&a||l>=a)&&Object.keys(t.O).every(e=>t.O[e](o[i]))?o.splice(i--,1):(u=!1,a<l&&(l=a));if(u){e.splice(f--,1);var p=n();void 0!==p&&(r=p)}}return r}})(),t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},(()=>{var e,r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;t.t=function(o,n){if(1&n&&(o=this(o)),8&n||"object"==typeof o&&o&&(4&n&&o.__esModule||16&n&&"function"==typeof o.then))return o;var a=Object.create(null);t.r(a);var f={};e=e||[null,r({}),r([]),r(r)];for(var l=2&n&&o;"object"==typeof l&&!~e.indexOf(l);l=r(l))Object.getOwnPropertyNames(l).forEach(e=>f[e]=()=>o[e]);return f.default=()=>o,t.d(a,f),a}})(),t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.p="/_next/",(()=>{var e={8068:0};t.O.j=r=>0===e[r];var r=(r,o)=>{var n,a,[f,l,u]=o,i=0;if(f.some(r=>0!==e[r])){for(n in l)t.o(l,n)&&(t.m[n]=l[n]);if(u)var p=u(t)}for(r&&r(o);i<f.length;i++)a=f[i],t.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return t.O(p)},o=self.webpackChunk_N_E=self.webpackChunk_N_E||[];o.forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o))})()})();
1
+ (()=>{"use strict";var e={},r={};function t(o){var n=r[o];if(void 0!==n)return n.exports;var a=r[o]={exports:{}},f=!0;try{e[o](a,a.exports,t),f=!1}finally{f&&delete r[o]}return a.exports}t.m=e,(()=>{var e=[];t.O=(r,o,n,a)=>{if(o){a=a||0;for(var f=e.length;f>0&&e[f-1][2]>a;f--)e[f]=e[f-1];e[f]=[o,n,a];return}for(var l=1/0,f=0;f<e.length;f++){for(var[o,n,a]=e[f],u=!0,i=0;i<o.length;i++)(!1&a||l>=a)&&Object.keys(t.O).every(e=>t.O[e](o[i]))?o.splice(i--,1):(u=!1,a<l&&(l=a));if(u){e.splice(f--,1);var p=n();void 0!==p&&(r=p)}}return r}})(),t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},(()=>{var e,r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;t.t=function(o,n){if(1&n&&(o=this(o)),8&n||"object"==typeof o&&o&&(4&n&&o.__esModule||16&n&&"function"==typeof o.then))return o;var a=Object.create(null);t.r(a);var f={};e=e||[null,r({}),r([]),r(r)];for(var l=2&n&&o;"object"==typeof l&&!~e.indexOf(l);l=r(l))Object.getOwnPropertyNames(l).forEach(e=>f[e]=()=>o[e]);return f.default=()=>o,t.d(a,f),a}})(),t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.p="/_next/",(()=>{var e={68:0};t.O.j=r=>0===e[r];var r=(r,o)=>{var n,a,[f,l,u]=o,i=0;if(f.some(r=>0!==e[r])){for(n in l)t.o(l,n)&&(t.m[n]=l[n]);if(u)var p=u(t)}for(r&&r(o);i<f.length;i++)a=f[i],t.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return t.O(p)},o=self.webpackChunk_N_E=self.webpackChunk_N_E||[];o.forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o))})()})();
@@ -0,0 +1 @@
1
+ self.__BUILD_MANIFEST=function(s,e,t,c,a,n,d,i,o,u,r,f,k,g,l,h,b){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:g,bitArray:[]},__routerFilterDynamic:{numItems:o,errorRate:1e-4,numBits:o,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,l,"static/chunks/pages/context/long-term-2e6a30a8f879df47.js"],"/context/short-term":[s,e,t,c,a,n,d,i,l,"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,u,h,"static/chunks/447-772df02993a8609b.js","static/chunks/pages/documents-3b2f23e2d6b27f1b.js"],"/guide":[s,e,h,"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,u,b,f,"static/chunks/pages/knowledge/file-detail-0a5e267f77f4e8b3.js"],"/knowledge/files":[s,e,t,a,n,i,f,"static/chunks/pages/knowledge/files-4d2754cc303c2a70.js"],"/knowledge/manage":[s,e,u,"static/chunks/788-f74cda5d27cf4390.js","static/chunks/pages/knowledge/manage-25eb1a993b155450.js"],"/knowledge/search":[s,e,t,u,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-380088496f0dae68.js"],"/prompt":[s,e,t,c,a,"static/chunks/pages/prompt-4cf07545f8388d85.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();
package/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "@customize-agent/server",
3
- "version": "4.0.6",
3
+ "version": "4.0.8",
4
4
  "description": "Customize Agent Web 管理控制台",
5
5
  "exports": {
6
6
  "./package.json": "./package.json"
7
7
  },
8
+ "scripts": {
9
+ "dev": "next dev -p 17321",
10
+ "build": "node -e \"require('fs').rmSync('.next', { recursive: true, force: true, maxRetries: 5, retryDelay: 200 })\" && next build && node scripts/verify-next-static.js && node -e \"require('fs').rmSync('.next/cache', { recursive: true, force: true, maxRetries: 5, retryDelay: 200 })\"",
11
+ "prestart": "node scripts/verify-next-static.js",
12
+ "start": "next start -p 17321",
13
+ "lint": "eslint src/"
14
+ },
8
15
  "files": [
9
16
  ".next/BUILD_ID",
10
17
  ".next/app-build-manifest.json",
@@ -32,6 +39,9 @@
32
39
  "dependencies": {
33
40
  "@ant-design/icons": "^6.3.2",
34
41
  "@napi-rs/canvas": "^0.1.82",
42
+ "@customize-agent/knowledge": "workspace:^",
43
+ "@customize-agent/llm": "workspace:^",
44
+ "@customize-agent/runtime": "workspace:^",
35
45
  "antd": "^6.5.0",
36
46
  "better-sqlite3": "^12.10.0",
37
47
  "jszip": "^3.10.1",
@@ -46,10 +56,7 @@
46
56
  "react": "19.2.7",
47
57
  "react-dom": "19.2.7",
48
58
  "tesseract.js": "^7.0.0",
49
- "xlsx": "^0.18.5",
50
- "@customize-agent/knowledge": "^4.0.2",
51
- "@customize-agent/llm": "^3.0.4",
52
- "@customize-agent/runtime": "^3.0.6"
59
+ "xlsx": "^0.18.5"
53
60
  },
54
61
  "devDependencies": {
55
62
  "@tailwindcss/postcss": "^4.3.2",
@@ -61,12 +68,5 @@
61
68
  "sass": "^1.101.0",
62
69
  "tailwindcss": "^4.3.2",
63
70
  "typescript": "^6.0.3"
64
- },
65
- "scripts": {
66
- "dev": "next dev -p 17321",
67
- "build": "node -e \"require('fs').rmSync('.next', { recursive: true, force: true, maxRetries: 5, retryDelay: 200 })\" && next build && node scripts/verify-next-static.js && node -e \"require('fs').rmSync('.next/cache', { recursive: true, force: true, maxRetries: 5, retryDelay: 200 })\"",
68
- "prestart": "node scripts/verify-next-static.js",
69
- "start": "next start -p 17321",
70
- "lint": "eslint src/"
71
71
  }
72
- }
72
+ }
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env node
2
+ const fs = require('node:fs');
3
+ const os = require('node:os');
4
+ const path = require('node:path');
5
+
6
+ function computeProjectId(projectRoot) {
7
+ let hash = 2166136261;
8
+ for (let i = 0; i < projectRoot.length; i += 1) {
9
+ hash ^= projectRoot.charCodeAt(i);
10
+ hash = Math.imul(hash, 16777619);
11
+ }
12
+ return (hash >>> 0).toString(16).padStart(8, '0');
13
+ }
14
+
15
+ function logPath(projectRoot) {
16
+ return path.join(os.homedir(), '.customize-agent', 'projects', computeProjectId(path.resolve(projectRoot)), 'kb-operations.jsonl');
17
+ }
18
+
19
+ function readAll(projectRoot) {
20
+ const file = logPath(projectRoot);
21
+ if (!fs.existsSync(file)) return [];
22
+ return fs.readFileSync(file, 'utf8').split('\n').filter(Boolean).flatMap(line => {
23
+ try { return [JSON.parse(line)]; } catch { return []; }
24
+ });
25
+ }
26
+
27
+ function writeAll(projectRoot, records) {
28
+ const file = logPath(projectRoot);
29
+ fs.mkdirSync(path.dirname(file), { recursive: true });
30
+ fs.writeFileSync(file, `${records.slice(-200).map(record => JSON.stringify(record)).join('\n')}\n`, 'utf8');
31
+ }
32
+
33
+ function upsert(projectRoot, patch) {
34
+ const now = Date.now();
35
+ const records = readAll(projectRoot);
36
+ const index = records.findIndex(record => record.id === patch.id);
37
+ const current = index >= 0 ? records[index] : undefined;
38
+ const next = {
39
+ id: patch.id,
40
+ type: patch.type,
41
+ title: patch.title,
42
+ stage: patch.stage ?? current?.stage ?? 'uploading',
43
+ status: patch.status ?? current?.status ?? 'processing',
44
+ message: patch.message ?? current?.message ?? '',
45
+ percent: patch.percent ?? current?.percent ?? 0,
46
+ fileName: patch.fileName ?? current?.fileName,
47
+ filePath: patch.filePath ?? current?.filePath,
48
+ chunkCount: patch.chunkCount ?? current?.chunkCount,
49
+ textLength: patch.textLength ?? current?.textLength,
50
+ extractionMode: patch.extractionMode ?? current?.extractionMode,
51
+ error: patch.error ?? current?.error,
52
+ createdAt: current?.createdAt ?? now,
53
+ updatedAt: now,
54
+ };
55
+ if (index >= 0) records[index] = next;
56
+ else records.push(next);
57
+ writeAll(projectRoot, records);
58
+ if (process.send) process.send({ type: 'progress', record: next });
59
+ return next;
60
+ }
61
+
62
+ function toStage(stage) {
63
+ if (['parsing', 'chunking', 'vectorizing', 'done', 'error'].includes(stage)) return stage;
64
+ if (stage === 'indexing') return 'chunking';
65
+ if (stage === 'scanning') return 'uploading';
66
+ return 'vectorizing';
67
+ }
68
+
69
+ async function main() {
70
+ const job = JSON.parse(process.argv[2] || '{}');
71
+ const projectRoot = path.resolve(job.projectRoot);
72
+ const operationId = job.operationId || job.id;
73
+ const operationType = job.uploadOperationId ? 'upload' : 'reindex';
74
+ const operationTitle = job.uploadOperationId ? `上传 ${job.uploadTitle || '文件'}` : '知识库后台索引';
75
+ upsert(projectRoot, { id: operationId, type: operationType, title: operationTitle, stage: 'uploading', status: 'processing', percent: 5, message: '索引任务已在独立后台进程启动' });
76
+
77
+ const knowledge = await import('@customize-agent/knowledge');
78
+ const manager = new knowledge.MultiProjectManager();
79
+ const project = await manager.getProject(projectRoot);
80
+ const onProgress = progress => upsert(projectRoot, {
81
+ id: operationId,
82
+ type: operationType,
83
+ title: operationTitle,
84
+ stage: toStage(progress.stage),
85
+ status: progress.stage === 'error' ? 'error' : 'processing',
86
+ percent: progress.percent,
87
+ message: progress.message,
88
+ filePath: progress.filePath,
89
+ chunkCount: progress.chunkCount,
90
+ error: progress.vectorStatus?.error,
91
+ });
92
+
93
+ let diff = job.forceReindexAll
94
+ ? await project.forceReindexAll({ vectorMode: job.vectorMode, onProgress })
95
+ : await project.consumePendingIndexJobs({ vectorMode: job.vectorMode, onProgress });
96
+
97
+ while (project.countPendingIndexJobs() > 0) {
98
+ const nextDiff = await project.consumePendingIndexJobs({ vectorMode: job.vectorMode, onProgress });
99
+ diff = {
100
+ newFiles: [...diff.newFiles, ...nextDiff.newFiles],
101
+ modifiedFiles: [...diff.modifiedFiles, ...nextDiff.modifiedFiles],
102
+ deletedFiles: [...diff.deletedFiles, ...nextDiff.deletedFiles],
103
+ unchangedCount: diff.unchangedCount + nextDiff.unchangedCount,
104
+ mtimeOnlyCount: diff.mtimeOnlyCount + nextDiff.mtimeOnlyCount,
105
+ skippedFiles: [...diff.skippedFiles, ...nextDiff.skippedFiles],
106
+ hasChanges: diff.hasChanges || nextDiff.hasChanges,
107
+ diffTimeMs: diff.diffTimeMs + nextDiff.diffTimeMs,
108
+ };
109
+ }
110
+
111
+ const vectorStatus = project.getVectorStatus();
112
+ if (vectorStatus.status === 'error') {
113
+ const error = vectorStatus.error || 'HNSWLib 向量入库失败';
114
+ upsert(projectRoot, { id: operationId, type: operationType, title: operationTitle, stage: 'error', status: 'error', percent: 100, message: error, error });
115
+ process.exitCode = 1;
116
+ return;
117
+ }
118
+ upsert(projectRoot, { id: operationId, type: operationType, title: operationTitle, stage: 'done', status: 'success', percent: 100, message: '知识库后台索引完成' });
119
+ }
120
+
121
+ main().catch(error => {
122
+ const job = JSON.parse(process.argv[2] || '{}');
123
+ const projectRoot = job.projectRoot ? path.resolve(job.projectRoot) : process.cwd();
124
+ const operationId = job.operationId || job.id || `worker-error-${Date.now()}`;
125
+ const message = error instanceof Error ? (error.stack || error.message) : String(error);
126
+ upsert(projectRoot, { id: operationId, type: job.uploadOperationId ? 'upload' : 'reindex', title: job.uploadOperationId ? `上传 ${job.uploadTitle || '文件'}` : '知识库后台索引', stage: 'error', status: 'error', percent: 100, message, error: message });
127
+ process.exit(1);
128
+ });