@customize-agent/server 3.0.28 → 4.0.1

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 (117) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +186 -188
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/chunks/774.js +1 -1
  5. package/.next/server/chunks/8204.js +1 -1
  6. package/.next/server/chunks/9270.js +1 -1
  7. package/.next/server/chunks/9301.js +2 -2
  8. package/.next/server/middleware-build-manifest.js +1 -1
  9. package/.next/server/pages/404.html +1 -1
  10. package/.next/server/pages/500.html +1 -1
  11. package/.next/server/pages/api/kb/files.js +2 -2
  12. package/.next/server/pages/api/kb/operations.js +2 -2
  13. package/.next/server/pages/api/kb/upload.js +2 -2
  14. package/.next/server/pages/asset-library.html +1 -1
  15. package/.next/server/pages/context/long-term.html +1 -1
  16. package/.next/server/pages/context/short-term.html +1 -1
  17. package/.next/server/pages/document-roles.html +1 -1
  18. package/.next/server/pages/document-specs.html +1 -1
  19. package/.next/server/pages/documents.html +1 -1
  20. package/.next/server/pages/guide.html +1 -1
  21. package/.next/server/pages/index.html +1 -1
  22. package/.next/server/pages/knowledge/file-detail.html +1 -1
  23. package/.next/server/pages/knowledge/file-detail.js.nft.json +1 -1
  24. package/.next/server/pages/knowledge/files.html +1 -1
  25. package/.next/server/pages/knowledge/manage.html +1 -1
  26. package/.next/server/pages/knowledge/search.html +1 -1
  27. package/.next/server/pages/knowledge.html +1 -1
  28. package/.next/server/pages/models.html +1 -1
  29. package/.next/server/pages/overview.html +1 -1
  30. package/.next/server/pages/prompt.html +1 -1
  31. package/.next/server/pages/settings.html +1 -1
  32. package/.next/server/pages/system/logs.html +1 -1
  33. package/.next/server/pages-manifest.json +25 -25
  34. package/.next/static/Qg6HhehDEGMR0UQnE32Qh/_buildManifest.js +1 -0
  35. package/.next/static/chunks/{9382-2be85f64a2a04466.js → 1210-248760e61b298769.js} +6 -3
  36. package/.next/static/chunks/1289-ada402215e8934cc.js +38 -0
  37. package/.next/static/chunks/1515-051d4383493143c9.js +1 -0
  38. package/.next/static/chunks/2073-244191fe7cc6e330.js +4 -0
  39. package/.next/static/chunks/2169-61474562e3e8475e.js +1 -0
  40. package/.next/static/chunks/2427-1f06499470a4acd3.js +1 -0
  41. package/.next/static/chunks/{2700-03ae5530fdc95014.js → 2700-1fbf324dcb6a552a.js} +1 -1
  42. package/.next/static/chunks/4052-9caaaa494d67a7e0.js +1 -0
  43. package/.next/static/chunks/4123-905de4c001b14351.js +4 -0
  44. package/.next/static/chunks/{4260-18140c66386111a7.js → 4260-46debd1ad52f4fde.js} +2 -2
  45. package/.next/static/chunks/4277-ba039fcf8f4e9cdc.js +1 -0
  46. package/.next/static/chunks/{1054-0bc42843b140e120.js → 4427-302c5267a1f8493e.js} +1 -1
  47. package/.next/static/chunks/{4696-8675ea601a3cf725.js → 4696-5a425ced63368f89.js} +1 -1
  48. package/.next/static/chunks/4976-2d6f56260b2ddff9.js +1 -0
  49. package/.next/static/chunks/{5292-860654c8ecbfa554.js → 5292-e65eab4f54b9f7ff.js} +1 -1
  50. package/.next/static/chunks/5695-7c19c1352a381c69.js +6 -0
  51. package/.next/static/chunks/5938-da5d441b981ec422.js +1 -0
  52. package/.next/static/chunks/6506-9d3cdc1ea816d7c4.js +1 -0
  53. package/.next/static/chunks/{6985-c62a7a9c8c9ce25d.js → 6985-29200efa04920cb3.js} +1 -1
  54. package/.next/static/chunks/7150-123ff059dd0e2eb9.js +41 -0
  55. package/.next/static/chunks/7576-c41e699f2110b989.js +1 -0
  56. package/.next/static/chunks/7888-7b28d859128998a2.js +1 -0
  57. package/.next/static/chunks/7889-8531b79751a71e39.js +1 -0
  58. package/.next/static/chunks/{8332-df14c832a569ee70.js → 8332-b27e9ac89c517608.js} +1 -1
  59. package/.next/static/chunks/8449-641d34b05c795c85.js +8 -0
  60. package/.next/static/chunks/{861-91cbdd34b8e23151.js → 861-dd60ef688592115e.js} +1 -1
  61. package/.next/static/chunks/8932-e1bb3137986c259a.js +1 -0
  62. package/.next/static/chunks/9189-03f286defdb92816.js +10 -0
  63. package/.next/static/chunks/9551-0bb7ba56a79b7cd7.js +16 -0
  64. package/.next/static/chunks/{9958-4f828ecf03e2f16c.js → 9958-af48a40832894bb6.js} +1 -1
  65. package/.next/static/chunks/9978-3df3ef9c76cee8b8.js +1 -0
  66. package/.next/static/chunks/pages/{_app-d769a06b2dd2bbe2.js → _app-78551e7d4385884b.js} +13 -13
  67. package/.next/static/chunks/pages/asset-library-0665e1c9afd893f0.js +1 -0
  68. package/.next/static/chunks/pages/context/{long-term-3b59c9386df2b218.js → long-term-1f59d30548b89c31.js} +1 -1
  69. package/.next/static/chunks/pages/context/{short-term-b1ab1b56112896bf.js → short-term-851f8aee7b0abff1.js} +1 -1
  70. package/.next/static/chunks/pages/document-roles-14631ba08e2f829f.js +1 -0
  71. package/.next/static/chunks/pages/document-specs-afd35d3937f2cadb.js +1 -0
  72. package/.next/static/chunks/pages/documents-2b15480b93097015.js +1 -0
  73. package/.next/static/chunks/pages/{guide-8cee9c05d4b3e9ec.js → guide-34569e4ab4e65192.js} +1 -1
  74. package/.next/static/chunks/pages/knowledge/file-detail-ae28021746550a37.js +1 -0
  75. package/.next/static/chunks/pages/knowledge/files-cf84b9b9e834dfc7.js +1 -0
  76. package/.next/static/chunks/pages/knowledge/manage-0ab6c109beca045d.js +1 -0
  77. package/.next/static/chunks/pages/knowledge/search-8cb8614a649bb57c.js +1 -0
  78. package/.next/static/chunks/pages/models-d761e0a64090c564.js +1 -0
  79. package/.next/static/chunks/pages/overview-4389fb201fd42078.js +1 -0
  80. package/.next/static/chunks/pages/prompt-69407f71ba27bf48.js +1 -0
  81. package/.next/static/chunks/pages/system/logs-27588e6d25aee564.js +1 -0
  82. package/.next/static/css/7938cb5de6aedc8c.css +1 -0
  83. package/package.json +3 -3
  84. package/.next/static/8Hckk1ERcHOx4mYtNEle8/_buildManifest.js +0 -1
  85. package/.next/static/chunks/1539-4cbefe760ca0ae2c.js +0 -1
  86. package/.next/static/chunks/1830-cabd00b9e865a498.js +0 -4
  87. package/.next/static/chunks/224-9a7074031493793b.js +0 -1
  88. package/.next/static/chunks/257-e4ebae17a8ee8412.js +0 -1
  89. package/.next/static/chunks/2856-ac8dbcb84c6960e4.js +0 -1
  90. package/.next/static/chunks/288-304992fa705244a2.js +0 -6
  91. package/.next/static/chunks/2969-2b1c9dec09863c33.js +0 -11
  92. package/.next/static/chunks/4020-964ab4dd1c8bc8dc.js +0 -1
  93. package/.next/static/chunks/5174-963b6343ef5d5628.js +0 -10
  94. package/.next/static/chunks/6288-afb4a972f5ec0f8c.js +0 -1
  95. package/.next/static/chunks/6474-e99853dc4b0b4f37.js +0 -1
  96. package/.next/static/chunks/7167-3194cd6d7b0156e9.js +0 -1
  97. package/.next/static/chunks/7271-0d4dab9994570a7c.js +0 -16
  98. package/.next/static/chunks/7576-e1b7b82dcd20a6dc.js +0 -4
  99. package/.next/static/chunks/8628-3438dc642afd4462.js +0 -1
  100. package/.next/static/chunks/9015-eb03937bff81f42d.js +0 -4
  101. package/.next/static/chunks/9400-3f253e755a16dd1a.js +0 -78
  102. package/.next/static/chunks/9969-01dc77acd9935a57.js +0 -1
  103. package/.next/static/chunks/9978-ef33e50fc2b65303.js +0 -1
  104. package/.next/static/chunks/pages/asset-library-764f3ad063f40fff.js +0 -1
  105. package/.next/static/chunks/pages/document-roles-0288a3e6e00e6e02.js +0 -1
  106. package/.next/static/chunks/pages/document-specs-e2337e693c352897.js +0 -1
  107. package/.next/static/chunks/pages/documents-cd370a6de9223124.js +0 -1
  108. package/.next/static/chunks/pages/knowledge/file-detail-9d493b7de07860dc.js +0 -1
  109. package/.next/static/chunks/pages/knowledge/files-0de1287c0c3e9663.js +0 -1
  110. package/.next/static/chunks/pages/knowledge/manage-1e8b62ae3c336814.js +0 -1
  111. package/.next/static/chunks/pages/knowledge/search-50b40e01b826e035.js +0 -1
  112. package/.next/static/chunks/pages/models-58d14888232c7212.js +0 -1
  113. package/.next/static/chunks/pages/overview-5c5f37e743f251c9.js +0 -1
  114. package/.next/static/chunks/pages/prompt-ecb8772b12e5a7e0.js +0 -1
  115. package/.next/static/chunks/pages/system/logs-7a90a654d4931f5f.js +0 -1
  116. package/.next/static/css/d284a7454d6f6b06.css +0 -1
  117. /package/.next/static/{8Hckk1ERcHOx4mYtNEle8 → Qg6HhehDEGMR0UQnE32Qh}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9978],{6578:(n,t,e)=>{async function o(n,t){let e=await fetch(n,t);if(!e.ok){let n=await e.text(),t=n||"HTTP ".concat(e.status);try{let e=JSON.parse(n);t=e.error||e.message||t}catch(n){}throw Error(t)}return e.json()}async function a(n){let t=n?"?projectRoot=".concat(encodeURIComponent(n)):"";return o("/api/kb/stats".concat(t))}async function i(n){var t,e;let a=new URLSearchParams;return(null==n?void 0:n.projectRoot)&&a.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&a.set("category",n.category),(null==n?void 0:n.page)&&a.set("page",String(null!=(t=n.page)?t:1)),(null==n?void 0:n.limit)&&a.set("limit",String(null!=(e=n.limit)?e:50)),o("/api/kb/files?".concat(a))}async function c(n,t){let e=new URLSearchParams({relativePath:n});return t&&e.set("projectRoot",t),o("/api/kb/files/detail?".concat(e))}async function r(n,t){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:n,projectRoot:t})})}async function s(n,t,e){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:n,target:t,projectRoot:e})})}async function d(n){return new Promise((t,e)=>{let o=new FileReader;o.onload=()=>{let n=o.result,e=n.indexOf(",");t(e>=0?n.slice(e+1):n)},o.onerror=e,o.readAsDataURL(n)})}async function p(n,t,e){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(n.map(async n=>({fileName:n.name,fileData:await d(n),relativePath:n.webkitRelativePath||void 0}))),projectRoot:t,uploadId:e})})}async function u(n){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(n)))}async function l(n){let t=new URLSearchParams({limit:"50"});return n&&t.set("projectRoot",n),o("/api/kb/operations?".concat(t))}async function y(n){let t=new URLSearchParams;return n&&t.set("projectRoot",n),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function f(n,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:n,projectRoot:t})})}async function h(n,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:n,projectRoot:t})})}async function m(n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:n})})}async function g(n){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:n})})}async function T(){return o("/api/kb/features")}async function S(n,t){var e,a,i,c,r;let s=new URLSearchParams({q:n});return(null==t?void 0:t.projectRoot)&&s.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&s.set("category",t.category),(null==t?void 0:t.limit)&&s.set("limit",String(null!=(r=t.limit)?r:20)),(null==t||null==(e=t.weights)?void 0:e.keyword)!=null&&s.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(a=t.weights)?void 0:a.vector)!=null&&s.set("vectorWeight",String(t.weights.vector)),(null==t||null==(i=t.weights)?void 0:i.rewrite)!=null&&s.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(c=t.weights)?void 0:c.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function b(){return o("/api/prompt")}async function C(n){return o("/api/documents/roles".concat(n?"?type=".concat(n):""))}async function E(n){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function O(n,t){return o("/api/documents/roles?type=".concat(n,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function w(n){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function j(n){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function v(){return o("/api/documents/specs")}async function P(n){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function N(n){return o("/api/documents/specs?id=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function R(){return o("/api/documents/templates")}async function U(n){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function J(n){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function k(n){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:n})})}async function D(n){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function x(){return o("/api/documents/generated")}async function L(n){return o("/api/documents/generated/".concat(encodeURIComponent(n)))}async function I(n,t){return o("/api/documents/generated/".concat(encodeURIComponent(n)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function B(n){return o("/api/documents/generated/".concat(encodeURIComponent(n)),{method:"DELETE"})}async function H(){return o("/api/assets/generated")}async function M(n){return o("/api/assets/generated?id=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function A(n){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n,action:"index"})})}async function W(n,t){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n,action:"open",target:t})})}async function z(n){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function _(n,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:n,id:t})})}async function F(n){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===n.format?"application/pdf":"*/*"},body:JSON.stringify(n)}),e=t.headers.get("content-type")||"",o=async()=>{let n=await t.text(),e=n||"导出失败";try{var o;let t=JSON.parse(n),a=null==(o=t.issues)?void 0:o.map(n=>n.message).filter(Boolean).slice(0,3).join(";");e=a?"".concat(t.error||"导出失败",":").concat(a):t.error||e}catch(n){}throw Error(e.length>300?"".concat(e.slice(0,300),"..."):e)};return t.ok||await o(),"pdf"!==n.format||e.includes("application/pdf")||await o(),"docx"!==n.format||e.includes("officedocument.wordprocessingml.document")||await o(),t.blob()}async function Q(){return o("/api/config/providers")}async function V(n,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n,...t})})}async function q(n){return o("/api/config/providers/".concat(encodeURIComponent(n)),{method:"DELETE"})}async function G(){return o("/api/config/models")}async function K(n){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function X(){return o("/api/config/embedding")}async function Z(n){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function $(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(n){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n})})}async function nn(){return o("/api/system/stats")}async function nt(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return o("/api/system/logs?limit=".concat(n))}async function ne(){return o("/api/system/logs",{method:"DELETE"})}async function no(n,t){let e=t?"?type=".concat(n,"&search=").concat(encodeURIComponent(t)):"?type=".concat(n);return o("/api/context".concat(e))}async function na(n){return o("/api/context?type=".concat(n,"&stats=1"))}async function ni(n){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:n})})}async function nc(n){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:n})})}async function nr(n){return o("/api/context?id=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function ns(n,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n,...t})})}async function nd(n){return o("/api/config/providers/".concat(encodeURIComponent(n)))}e.d(t,{Af:()=>_,Bh:()=>nd,Dl:()=>R,E:()=>nc,EK:()=>P,ER:()=>N,FC:()=>nn,FV:()=>O,H1:()=>g,H7:()=>y,HC:()=>r,HT:()=>i,II:()=>X,JU:()=>M,NR:()=>w,OX:()=>D,PH:()=>ni,QG:()=>B,QT:()=>u,Qx:()=>l,R1:()=>z,SJ:()=>h,UE:()=>F,VW:()=>T,W2:()=>S,X8:()=>m,Z3:()=>Q,_m:()=>V,a6:()=>I,aP:()=>K,bV:()=>k,bZ:()=>Y,c1:()=>p,cQ:()=>x,dd:()=>Z,dg:()=>E,dw:()=>j,dx:()=>b,f$:()=>H,h0:()=>J,h1:()=>q,hH:()=>ne,hc:()=>a,hn:()=>no,l2:()=>U,lv:()=>C,mx:()=>v,oH:()=>nt,oS:()=>W,p:()=>na,tn:()=>s,u6:()=>$,uc:()=>A,v7:()=>L,xC:()=>c,xq:()=>f,xw:()=>nr,zo:()=>ns,zr:()=>G})},45551:(n,t,e)=>{function o(n){if(0===n)return"0 B";let t=Math.floor(Math.log(n)/Math.log(1024)),e=n/Math.pow(1024,t);return"".concat(e.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function a(n){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!n||n<=0)return"en-US"===t?"Never":"从未";let e=Math.floor(Math.floor((Date.now()-n)/1e3)/60),o=Math.floor(e/60),a=Math.floor(o/24);return a>30?new Date(n).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):o>0?"".concat(o,"h ago"):e>0?"".concat(e,"m ago"):"Just now":a>0?"".concat(a," 天前"):o>0?"".concat(o," 小时前"):e>0?"".concat(e," 分钟前"):"刚刚"}e.d(t,{Jm:()=>r,fw:()=>a,z3:()=>o});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},c={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function r(n){var t;let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===e?c:i)[n])?t:n}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2958],{6578:(e,n,t)=>{"use strict";async function o(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function i(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(n))}async function a(e){var n,t;let i=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&i.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&i.set("category",e.category),(null==e?void 0:e.page)&&i.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&i.set("limit",String(null!=(t=e.limit)?t:50)),o("/api/kb/files?".concat(i))}async function c(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),o("/api/kb/files/detail?".concat(t))}async function s(e,n){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function r(e,n,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function d(e){return new Promise((n,t)=>{let o=new FileReader;o.onload=()=>{let e=o.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},o.onerror=t,o.readAsDataURL(e)})}async function p(e,n,t){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await d(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function l(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n))}async function y(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function h(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function f(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function m(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function j(){return o("/api/kb/features")}async function T(e,n){var t,i,a,c,s;let r=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&r.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&r.set("category",n.category),(null==n?void 0:n.limit)&&r.set("limit",String(null!=(s=n.limit)?s:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&r.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(i=n.weights)?void 0:i.vector)!=null&&r.set("vectorWeight",String(n.weights.vector)),(null==n||null==(a=n.weights)?void 0:a.rewrite)!=null&&r.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(c=n.weights)?void 0:c.hybridBonus)!=null&&r.set("hybridBonus",String(n.weights.hybridBonus)),o("/api/kb/search?".concat(r))}async function x(){return o("/api/prompt")}async function S(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function b(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function C(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(){return o("/api/documents/specs")}async function v(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(){return o("/api/documents/templates")}async function R(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function A(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function U(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function k(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J(){return o("/api/documents/generated")}async function I(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,n){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function L(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function _(){return o("/api/assets/generated")}async function H(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function B(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function F(e,n){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function W(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Q(e,n){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function X(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),t=n.headers.get("content-type")||"",o=async()=>{let e=await n.text(),t=e||"导出失败";try{var o;let n=JSON.parse(e),i=null==(o=n.issues)?void 0:o.map(e=>e.message).filter(Boolean).slice(0,3).join(";");t=i?"".concat(n.error||"导出失败",":").concat(i):n.error||t}catch(e){}throw Error(t.length>300?"".concat(t.slice(0,300),"..."):t)};return n.ok||await o(),"pdf"!==e.format||t.includes("application/pdf")||await o(),"docx"!==e.format||t.includes("officedocument.wordprocessingml.document")||await o(),n.blob()}async function z(){return o("/api/config/providers")}async function V(e,n){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function q(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function Z(){return o("/api/config/models")}async function $(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function G(){return o("/api/config/embedding")}async function K(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function M(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function ee(){return o("/api/system/stats")}async function en(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return o("/api/system/logs?limit=".concat(e))}async function et(){return o("/api/system/logs",{method:"DELETE"})}async function eo(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function ei(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function ea(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ec(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function es(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function er(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ed(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>Q,Bh:()=>ed,Dl:()=>P,E:()=>ec,EK:()=>v,ER:()=>N,FC:()=>ee,FV:()=>w,H1:()=>g,H7:()=>y,HC:()=>s,HT:()=>a,II:()=>G,JU:()=>H,NR:()=>C,OX:()=>k,PH:()=>ea,QG:()=>L,QT:()=>l,Qx:()=>u,R1:()=>W,SJ:()=>f,UE:()=>X,VW:()=>j,W2:()=>T,X8:()=>m,Z3:()=>z,_m:()=>V,a6:()=>D,aP:()=>$,bV:()=>U,bZ:()=>Y,c1:()=>p,cQ:()=>J,dd:()=>K,dg:()=>b,dw:()=>E,dx:()=>x,f$:()=>_,h0:()=>A,h1:()=>q,hH:()=>et,hc:()=>i,hn:()=>eo,l2:()=>R,lv:()=>S,mx:()=>O,oH:()=>en,oS:()=>F,p:()=>ei,tn:()=>r,u6:()=>M,uc:()=>B,v7:()=>I,xC:()=>c,xq:()=>h,xw:()=>es,zo:()=>er,zr:()=>Z})},63806:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>E});var o=t(65321),i=t(97109),a=t(35292),c=t(17807),s=t(68787),r=t(38332),d=t(84253),p=t(85114),l=t(26171),u=t(384),y=t(33442),h=t(11702),f=t(93051),m=t(81668),g=t(64254),j=t(26619),T=t(58209),x=t(75548),S=t(56768),b=t(6578);let{Text:w,Paragraph:C}=a.A;function E(){let{message:e}=c.A.useApp(),[n,t]=(0,i.useState)([]),[a,E]=(0,i.useState)(null),O=async()=>{try{t((await (0,b.f$)()).assets)}catch(e){t([])}};(0,i.useEffect)(()=>{O()},[]);let v=async n=>{var t;n&&(await (null==(t=navigator.clipboard)?void 0:t.writeText(n)),e.success("已复制路径"))},N=async(n,o)=>{E(n);try{"index"===o&&t((await (0,b.uc)(n)).assets),"openFile"===o&&await (0,b.oS)(n,"file"),"openDirectory"===o&&await (0,b.oS)(n,"directory"),"delete"===o&&t((await (0,b.JU)(n)).assets),"index"===o&&e.success("已加入知识库索引")}catch(n){e.error(n instanceof Error?n.message:"操作失败")}finally{E(null)}},P=e=>{var n;return"image"===e.type&&(null==(n=e.path)?void 0:n.startsWith("generatedDocuments/assets/"))?"/api/assets/generated/preview?id=".concat(encodeURIComponent(e.id)):void 0};return(0,o.jsxs)("div",{className:"page-shell",children:[(0,o.jsxs)("div",{className:"mb-4",children:[(0,o.jsx)("h1",{className:"text-2xl font-semibold",children:"生成资源"}),(0,o.jsx)("p",{className:"text-[var(--colorTextSecondary)]",children:"管理文档生成产生的本地资源。生成资源默认不进入知识库,可在后续操作中手动加入知识库。"})]}),(0,o.jsx)(s.A,{children:(0,o.jsx)(r.A,{dataSource:n,locale:{emptyText:(0,o.jsx)(d.A,{description:"暂无生成资源"})},renderItem:(e,n)=>(0,o.jsx)(r.A.Item,{actions:[e.path?(0,o.jsx)(p.Ay,{icon:(0,o.jsx)(f.A,{}),onClick:()=>{v(e.path)},children:"复制路径"},"copy"):null,e.path?(0,o.jsx)(p.Ay,{icon:(0,o.jsx)(m.A,{}),loading:a===e.id,onClick:()=>{N(e.id,"openFile")},children:"打开"},"open"):null,e.path?(0,o.jsx)(p.Ay,{icon:(0,o.jsx)(g.A,{}),loading:a===e.id,onClick:()=>{N(e.id,"openDirectory")},children:"目录"},"folder"):null,!e.indexed&&e.path?(0,o.jsx)(p.Ay,{icon:(0,o.jsx)(j.A,{}),loading:a===e.id,onClick:()=>{N(e.id,"index")},children:"加入知识库"},"index"):null,(0,o.jsx)(l.A,{title:"确认删除该生成资源记录?",onConfirm:()=>{N(e.id,"delete")},children:(0,o.jsx)(p.Ay,{danger:!0,icon:(0,o.jsx)(T.A,{}),loading:a===e.id,children:"删除"})},"delete")],children:(0,o.jsx)(r.A.Item.Meta,{avatar:P(e)?(0,o.jsx)(u.A,{width:64,height:40,src:P(e),alt:e.name,style:{objectFit:"cover"}}):"image"===e.type?(0,o.jsx)(x.A,{}):(0,o.jsx)(S.A,{}),title:(0,o.jsxs)(y.A,{wrap:!0,children:[(0,o.jsxs)(h.A,{children:["序号 ",n+1]}),(0,o.jsx)("span",{children:e.name}),(0,o.jsx)(h.A,{children:e.type}),(0,o.jsx)(h.A,{color:e.indexed?"success":"default",children:e.indexed?"已入库":"未入库"}),(0,o.jsx)(h.A,{color:"blue",children:e.role})]}),description:(0,o.jsxs)(y.A,{direction:"vertical",size:2,className:"w-full",children:[(0,o.jsxs)(w,{type:"secondary",children:["路径:",e.path||e.url||"—"]}),(0,o.jsxs)(w,{type:"secondary",children:["来源:",e.source," \xb7 使用文档:",e.usedByDocumentIds.length," \xb7 更新时间:",new Date(e.updatedAt).toLocaleString()]}),e.prompt&&(0,o.jsxs)(C,{ellipsis:{rows:2,expandable:!0},className:"!mb-0",children:["提示词:",e.prompt]})]})})})})})]})}},85015:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/asset-library",function(){return t(63806)}])}},e=>{e.O(0,[4260,7167,9382,8628,7271,2700,5174,4696,5292,8332,1830,636,6593,8792],()=>e(e.s=85015)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8623],{6578:(e,n,t)=>{"use strict";async function o(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function i(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(n))}async function r(e){var n,t;let i=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&i.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&i.set("category",e.category),(null==e?void 0:e.page)&&i.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&i.set("limit",String(null!=(t=e.limit)?t:50)),o("/api/kb/files?".concat(i))}async function s(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),o("/api/kb/files/detail?".concat(t))}async function a(e,n){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function c(e,n,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function l(e){return new Promise((n,t)=>{let o=new FileReader;o.onload=()=>{let e=o.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},o.onerror=t,o.readAsDataURL(e)})}async function d(e,n,t){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function p(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n))}async function m(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function y(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function h(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function x(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function j(){return o("/api/kb/features")}async function g(e,n){var t,i,r,s,a;let c=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&c.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&c.set("category",n.category),(null==n?void 0:n.limit)&&c.set("limit",String(null!=(a=n.limit)?a:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&c.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(i=n.weights)?void 0:i.vector)!=null&&c.set("vectorWeight",String(n.weights.vector)),(null==n||null==(r=n.weights)?void 0:r.rewrite)!=null&&c.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(s=n.weights)?void 0:s.hybridBonus)!=null&&c.set("hybridBonus",String(n.weights.hybridBonus)),o("/api/kb/search?".concat(c))}async function A(){return o("/api/prompt")}async function b(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function T(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function S(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(){return o("/api/documents/specs")}async function I(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function R(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return o("/api/documents/templates")}async function O(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function k(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function P(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function U(){return o("/api/documents/generated")}async function J(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,n){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function F(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function L(){return o("/api/assets/generated")}async function _(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function H(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function q(e,n){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function V(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function B(e,n){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function G(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),t=n.headers.get("content-type")||"",o=async()=>{let e=await n.text(),t=e||"导出失败";try{var o;let n=JSON.parse(e),i=null==(o=n.issues)?void 0:o.map(e=>e.message).filter(Boolean).slice(0,3).join(";");t=i?"".concat(n.error||"导出失败",":").concat(i):n.error||t}catch(e){}throw Error(t.length>300?"".concat(t.slice(0,300),"..."):t)};return n.ok||await o(),"pdf"!==e.format||t.includes("application/pdf")||await o(),"docx"!==e.format||t.includes("officedocument.wordprocessingml.document")||await o(),n.blob()}async function W(){return o("/api/config/providers")}async function Q(e,n){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function X(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function z(){return o("/api/config/models")}async function M(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Z(){return o("/api/config/embedding")}async function K(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function ee(){return o("/api/system/stats")}async function en(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return o("/api/system/logs?limit=".concat(e))}async function et(){return o("/api/system/logs",{method:"DELETE"})}async function eo(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function ei(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function er(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function es(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ea(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ec(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function el(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>B,Bh:()=>el,Dl:()=>E,E:()=>es,EK:()=>I,ER:()=>R,FC:()=>ee,FV:()=>v,H1:()=>x,H7:()=>m,HC:()=>a,HT:()=>r,II:()=>Z,JU:()=>_,NR:()=>S,OX:()=>P,PH:()=>er,QG:()=>F,QT:()=>p,Qx:()=>u,R1:()=>V,SJ:()=>h,UE:()=>G,VW:()=>j,W2:()=>g,X8:()=>f,Z3:()=>W,_m:()=>Q,a6:()=>D,aP:()=>M,bV:()=>k,bZ:()=>Y,c1:()=>d,cQ:()=>U,dd:()=>K,dg:()=>T,dw:()=>w,dx:()=>A,f$:()=>L,h0:()=>N,h1:()=>X,hH:()=>et,hc:()=>i,hn:()=>eo,l2:()=>O,lv:()=>b,mx:()=>C,oH:()=>en,oS:()=>q,p:()=>ei,tn:()=>c,u6:()=>$,uc:()=>H,v7:()=>J,xC:()=>s,xq:()=>y,xw:()=>ea,zo:()=>ec,zr:()=>z})},23507:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return t(59889)}])},59889:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>C});var o=t(65321),i=t(97109),r=t(17807),s=t(63455),a=t(38332),c=t(84253),l=t(85114),d=t(26171),p=t(33442),u=t(11702),m=t(68787),y=t(85493),h=t(2256),f=t(38770),x=t(25258),j=t(57271),g=t(7576),A=t(58569),b=t(99650),T=t(58209),v=t(54746),S=t(6578),w=t(64209);function C(){let e=(0,w.Vr)(),{message:n}=r.A.useApp(),[t]=s.A.useForm(),[C]=s.A.useForm(),[I,R]=(0,i.useState)([]),[E,O]=(0,i.useState)([]),[N,k]=(0,i.useState)([]),[P,U]=(0,i.useState)([]),[J,D]=(0,i.useState)(!1),[F,L]=(0,i.useState)(!1),_=async()=>{let[e,n,t]=await Promise.all([(0,S.lv)(),(0,S.HT)(),(0,S.dx)()]);R(e.roles),O(e.configs),k(n.files),U(t)};(0,i.useEffect)(()=>{_().catch(()=>n.error(e("common.error")))},[n,e]);let H=I.filter(e=>"file"===e.type),q=I.filter(e=>"prompt"===e.type),V=async()=>{try{let o=await t.validateFields(),i=await (0,S.dg)(o);R(i.roles),O(i.configs),D(!1),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},B=async()=>{try{let t=await C.validateFields(),o=e=>(null!=e?e:[]).map((e,n)=>{var t;return{roleId:e.roleId,order:Number(null!=(t=e.order)?t:n)}}),i=await (0,S.NR)({...t,fileRoles:o(t.fileRoles),promptRoles:o(t.promptRoles)});R(i.roles),O(i.configs),L(!1),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},G=async e=>{let n=await (0,S.FV)(e.type,e.id);R(n.roles),O(n.configs)},W=async e=>{let n=await (0,S.dw)(e);R(n.roles),O(n.configs)},Q=function(e){var n;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";t.setFieldsValue(e?{...e,resourceIds:(null==(n=e.resourceIds)?void 0:n.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]}:{id:"role-".concat(Date.now()),name:"",description:"",type:o,resourceIds:[],executionType:"prompt"===o?"reference":void 0,processingType:"file"===o?"reference":void 0}),D(!0)},X=e=>{C.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[]}),L(!0)},z=n=>(0,o.jsx)(a.A,{dataSource:I.filter(e=>e.type===n),locale:{emptyText:(0,o.jsx)(c.A,{description:e("common.noData")})},renderItem:(n,t)=>{var i;return(0,o.jsx)(a.A.Item,{actions:[(0,o.jsx)(l.Ay,{type:"text",icon:(0,o.jsx)(b.A,{}),onClick:()=>Q(n)},"edit"),(0,o.jsx)(d.A,{title:e("common.confirm"),disabled:n.builtIn,onConfirm:()=>{G(n)},children:(0,o.jsx)(l.Ay,{type:"text",danger:!0,icon:(0,o.jsx)(T.A,{}),disabled:n.builtIn})},"delete")],children:(0,o.jsx)(a.A.Item.Meta,{title:(0,o.jsxs)(p.A,{children:[(0,o.jsxs)(u.A,{children:["序号 ",t+1]}),(0,o.jsx)("span",{children:n.name}),n.builtIn&&(0,o.jsx)(u.A,{color:"gold",children:e("documents.builtIn")}),(0,o.jsx)(u.A,{children:n.id})]}),description:(0,o.jsxs)(p.A,{direction:"vertical",children:[(0,o.jsx)("span",{children:n.description}),(0,o.jsx)("span",{children:"prompt"===n.type?n.executionType:n.processingType}),(0,o.jsx)("span",{children:((null==(i=n.resourceIds)?void 0:i.length)?n.resourceIds:n.resourceId?[n.resourceId]:[]).join("、")||"-"})]})})})}});return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsx)(m.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,o.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle mb-1",children:e("roles.title")}),(0,o.jsx)("p",{className:"pageDesc mb-0",children:e("roles.description")})]}),(0,o.jsxs)(p.A,{children:[(0,o.jsx)(l.Ay,{icon:(0,o.jsx)(v.A,{}),onClick:()=>Q(void 0,"file"),children:e("roles.newFileRole")}),(0,o.jsx)(l.Ay,{icon:(0,o.jsx)(v.A,{}),onClick:()=>Q(void 0,"prompt"),children:e("roles.newPromptRole")}),(0,o.jsx)(l.Ay,{type:"primary",icon:(0,o.jsx)(v.A,{}),onClick:()=>X(),children:e("roles.newConfig")})]})]})}),(0,o.jsx)(y.A,{type:"info",showIcon:!0,message:e("roles.plainGuideTitle"),description:e("roles.plainGuideDesc")}),(0,o.jsxs)(h.A,{gutter:[16,16],children:[(0,o.jsx)(f.A,{xs:24,lg:12,children:(0,o.jsx)(m.A,{title:e("roles.fileRoles"),children:z("file")})}),(0,o.jsx)(f.A,{xs:24,lg:12,children:(0,o.jsx)(m.A,{title:e("roles.promptRoles"),children:z("prompt")})}),(0,o.jsx)(f.A,{xs:24,children:(0,o.jsx)(m.A,{title:e("roles.configs"),children:(0,o.jsx)(a.A,{dataSource:E,locale:{emptyText:(0,o.jsx)(c.A,{description:e("common.noData")})},renderItem:(n,t)=>(0,o.jsx)(a.A.Item,{actions:[(0,o.jsx)(l.Ay,{type:"text",icon:(0,o.jsx)(b.A,{}),onClick:()=>X(n)},"edit"),(0,o.jsx)(d.A,{title:e("common.confirm"),onConfirm:()=>{W(n.id)},children:(0,o.jsx)(l.Ay,{type:"text",danger:!0,icon:(0,o.jsx)(T.A,{})})},"delete")],children:(0,o.jsx)(a.A.Item.Meta,{title:(0,o.jsxs)(p.A,{children:[(0,o.jsxs)(u.A,{children:["序号 ",t+1]}),n.name,(0,o.jsx)(u.A,{children:n.id})]}),description:"".concat(e("roles.fileRoles"),": ").concat(n.fileRoles.length," \xb7 ").concat(e("roles.promptRoles"),": ").concat(n.promptRoles.length)})})})})})]}),(0,o.jsx)(x.A,{maskClosable:!1,title:e("roles.roleEditor"),open:J,onOk:()=>{V()},onCancel:()=>D(!1),centered:!0,okText:e("common.save"),children:(0,o.jsxs)(s.A,{form:t,layout:"vertical",children:[(0,o.jsx)(s.A.Item,{name:"type",label:e("roles.roleType"),rules:[{required:!0}],children:(0,o.jsx)(j.A,{options:[{label:e("roles.fileRole"),value:"file"},{label:e("roles.promptRole"),value:"prompt"}]})}),(0,o.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(g.A,{disabled:!0})}),(0,o.jsx)(s.A.Item,{name:"name",label:e("roles.roleName"),rules:[{required:!0}],children:(0,o.jsx)(g.A,{})}),(0,o.jsx)(s.A.Item,{name:"description",label:e("roles.roleDescription"),children:(0,o.jsx)(g.A,{})}),(0,o.jsx)(s.A.Item,{noStyle:!0,shouldUpdate:(e,n)=>e.type!==n.type,children:n=>{let{getFieldValue:t}=n;return"prompt"===t("type")?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.A.Item,{name:"executionType",label:e("roles.executionType"),rules:[{required:!0}],extra:e("roles.executionTypeHelp"),children:(0,o.jsx)(j.A,{options:[{label:e("roles.factExtraction"),value:"fact_extraction"},{label:e("roles.chapterGeneration"),value:"chapter_generation"},{label:e("roles.validation"),value:"validation"},{label:e("roles.formatting"),value:"formatting"},{label:e("roles.reference"),value:"reference"}]})}),(0,o.jsx)(s.A.Item,{name:"resourceIds",label:e("roles.bindPrompt"),extra:e("roles.multiBindPromptHelp"),children:(0,o.jsx)(j.A,{mode:"multiple",showSearch:!0,options:P.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.A.Item,{name:"processingType",label:e("roles.processingType"),rules:[{required:!0}],extra:e("roles.processingTypeHelp"),children:(0,o.jsx)(j.A,{options:[{label:e("roles.ruleFile"),value:"rule"},{label:e("roles.projectFactFile"),value:"project_fact"},{label:e("roles.tableFile"),value:"table"},{label:e("roles.drawingFile"),value:"drawing"},{label:e("roles.specificationFile"),value:"specification"},{label:e("roles.reference"),value:"reference"}]})}),(0,o.jsx)(s.A.Item,{name:"resourceIds",label:e("roles.bindFile"),extra:e("roles.multiBindFileHelp"),children:(0,o.jsx)(j.A,{mode:"multiple",showSearch:!0,options:N.map(e=>({label:e.relativePath,value:e.relativePath}))})})]})}})]})}),(0,o.jsx)(x.A,{maskClosable:!1,title:e("roles.configEditor"),open:F,onOk:()=>{B()},onCancel:()=>L(!1),width:820,centered:!0,okText:e("common.save"),children:(0,o.jsxs)(s.A,{form:C,layout:"vertical",children:[(0,o.jsxs)(h.A,{gutter:12,children:[(0,o.jsx)(f.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(g.A,{disabled:!0})})}),(0,o.jsx)(f.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"name",label:e("roles.configName"),rules:[{required:!0}],children:(0,o.jsx)(g.A,{})})}),(0,o.jsx)(f.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"description",label:e("roles.configDescription"),children:(0,o.jsx)(g.A,{})})})]}),(0,o.jsx)(A.A,{items:[{key:"file",label:e("roles.fileRoles"),children:(0,o.jsx)(s.A.List,{name:"fileRoles",children:(n,t)=>{let{add:i,remove:r}=t;return(0,o.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[n.map((e,n)=>(0,o.jsxs)(h.A,{gutter:8,children:[(0,o.jsx)(f.A,{span:16,children:(0,o.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],children:(0,o.jsx)(j.A,{options:H.map(e=>({label:e.name,value:e.id}))})})}),(0,o.jsx)(f.A,{span:6,children:(0,o.jsx)(s.A.Item,{name:[e.name,"order"],initialValue:n,children:(0,o.jsx)(g.A,{type:"number"})})}),(0,o.jsx)(f.A,{span:2,children:(0,o.jsx)(l.Ay,{danger:!0,onClick:()=>r(e.name),children:"-"})})]},e.key)),(0,o.jsx)(l.Ay,{onClick:()=>i({order:n.length}),children:e("roles.addRole")})]})}})},{key:"prompt",label:e("roles.promptRoles"),children:(0,o.jsx)(s.A.List,{name:"promptRoles",children:(n,t)=>{let{add:i,remove:r}=t;return(0,o.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[n.map((e,n)=>(0,o.jsxs)(h.A,{gutter:8,children:[(0,o.jsx)(f.A,{span:16,children:(0,o.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],children:(0,o.jsx)(j.A,{options:q.map(e=>({label:e.name,value:e.id}))})})}),(0,o.jsx)(f.A,{span:6,children:(0,o.jsx)(s.A.Item,{name:[e.name,"order"],initialValue:n,children:(0,o.jsx)(g.A,{type:"number"})})}),(0,o.jsx)(f.A,{span:2,children:(0,o.jsx)(l.Ay,{danger:!0,onClick:()=>r(e.name),children:"-"})})]},e.key)),(0,o.jsx)(l.Ay,{onClick:()=>i({order:n.length}),children:e("roles.addRole")})]})}})}]})]})})]})}}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,2700,5174,4696,288,8332,2856,636,6593,8792],()=>e(e.s=23507)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7580],{6578:(e,n,t)=>{"use strict";async function a(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function s(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(n))}async function i(e){var n,t;let s=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&s.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&s.set("category",e.category),(null==e?void 0:e.page)&&s.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&s.set("limit",String(null!=(t=e.limit)?t:50)),a("/api/kb/files?".concat(s))}async function c(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),a("/api/kb/files/detail?".concat(t))}async function o(e,n){return a("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function r(e,n,t){return a("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function l(e){return new Promise((n,t)=>{let a=new FileReader;a.onload=()=>{let e=a.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},a.onerror=t,a.readAsDataURL(e)})}async function d(e,n,t){return a("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function p(e){return a("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),a("/api/kb/operations?".concat(n))}async function m(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),a("/api/kb/operations?".concat(n),{method:"DELETE"})}async function h(e,n){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function y(e,n){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function f(e){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function j(e){return a("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return a("/api/kb/features")}async function g(e,n){var t,s,i,c,o;let r=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&r.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&r.set("category",n.category),(null==n?void 0:n.limit)&&r.set("limit",String(null!=(o=n.limit)?o:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&r.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(s=n.weights)?void 0:s.vector)!=null&&r.set("vectorWeight",String(n.weights.vector)),(null==n||null==(i=n.weights)?void 0:i.rewrite)!=null&&r.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(c=n.weights)?void 0:c.hybridBonus)!=null&&r.set("hybridBonus",String(n.weights.hybridBonus)),a("/api/kb/search?".concat(r))}async function A(){return a("/api/prompt")}async function b(e){return a("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function T(e){return a("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e,n){return a("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function w(e){return a("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function S(e){return a("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(){return a("/api/documents/specs")}async function I(e){return a("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return a("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function N(){return a("/api/documents/templates")}async function O(e){return a("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function R(e){return a("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function k(e){return a("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function P(e){return a("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(){return a("/api/documents/generated")}async function D(e){return a("/api/documents/generated/".concat(encodeURIComponent(e)))}async function J(e,n){return a("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function U(e){return a("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function _(){return a("/api/assets/generated")}async function L(e){return a("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function F(e){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function H(e,n){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function V(e){return a("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function W(e,n){return a("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function B(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),t=n.headers.get("content-type")||"",a=async()=>{let e=await n.text(),t=e||"导出失败";try{var a;let n=JSON.parse(e),s=null==(a=n.issues)?void 0:a.map(e=>e.message).filter(Boolean).slice(0,3).join(";");t=s?"".concat(n.error||"导出失败",":").concat(s):n.error||t}catch(e){}throw Error(t.length>300?"".concat(t.slice(0,300),"..."):t)};return n.ok||await a(),"pdf"!==e.format||t.includes("application/pdf")||await a(),"docx"!==e.format||t.includes("officedocument.wordprocessingml.document")||await a(),n.blob()}async function G(){return a("/api/config/providers")}async function z(e,n){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function Q(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function X(){return a("/api/config/models")}async function K(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Z(){return a("/api/config/embedding")}async function M(e){return a("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(){return a("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function ee(){return a("/api/system/stats")}async function en(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return a("/api/system/logs?limit=".concat(e))}async function et(){return a("/api/system/logs",{method:"DELETE"})}async function ea(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return a("/api/context".concat(t))}async function es(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function ei(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ec(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function eo(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function er(e,n){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function el(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>W,Bh:()=>el,Dl:()=>N,E:()=>ec,EK:()=>I,ER:()=>E,FC:()=>ee,FV:()=>v,H1:()=>j,H7:()=>m,HC:()=>o,HT:()=>i,II:()=>Z,JU:()=>L,NR:()=>w,OX:()=>P,PH:()=>ei,QG:()=>U,QT:()=>p,Qx:()=>u,R1:()=>V,SJ:()=>y,UE:()=>B,VW:()=>x,W2:()=>g,X8:()=>f,Z3:()=>G,_m:()=>z,a6:()=>J,aP:()=>K,bV:()=>k,bZ:()=>Y,c1:()=>d,cQ:()=>q,dd:()=>M,dg:()=>T,dw:()=>S,dx:()=>A,f$:()=>_,h0:()=>R,h1:()=>Q,hH:()=>et,hc:()=>s,hn:()=>ea,l2:()=>O,lv:()=>b,mx:()=>C,oH:()=>en,oS:()=>H,p:()=>es,tn:()=>r,u6:()=>$,uc:()=>F,v7:()=>D,xC:()=>c,xq:()=>h,xw:()=>eo,zo:()=>er,zr:()=>X})},16734:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>R});var a=t(65321),s=t(97109),i=t(17807),c=t(63455),o=t(68787),r=t(85114),l=t(85493),d=t(38332),p=t(84253),u=t(26171),m=t(33442),h=t(11702),y=t(25258),f=t(2256),j=t(38770),x=t(7576),g=t(58569),A=t(57271),b=t(44534),T=t(94992),v=t(54746),w=t(99650),S=t(58209),C=t(6578),I=t(64209);let E=[{label:"文本",value:"text"},{label:"数字",value:"number"},{label:"日期",value:"date"},{label:"表格",value:"table"},{label:"列表",value:"list"}],N=[{label:"必需事实",value:"required_fact"},{label:"必需章节",value:"required_chapter"},{label:"必需文件角色",value:"required_file_role"},{label:"必需提示词角色",value:"required_prompt_role"},{label:"事实必须有来源",value:"source_required"},{label:"禁止出现文本",value:"forbidden_text"},{label:"章节最低字数",value:"min_chapter_length"},{label:"必须有表格",value:"table_required"}],O=[{label:"错误(阻断)",value:"error"},{label:"警告(提醒)",value:"warning"},{label:"信息(提示)",value:"info"}];function R(){var e;let n=(0,I.Vr)(),{message:t}=i.A.useApp(),[R]=c.A.useForm(),[k,P]=(0,s.useState)([]),[q,D]=(0,s.useState)([]),[J,U]=(0,s.useState)(!1),_=async()=>{let[e,n]=await Promise.all([(0,C.mx)(),(0,C.lv)()]);P(e.specs),D(n.roles)};(0,s.useEffect)(()=>{_().catch(()=>t.error(n("common.error")))},[t,n]);let L=q.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),F=q.filter(e=>"prompt"===e.type).map(e=>({label:e.name,value:e.id})),H=(null!=(e=c.A.useWatch("factFields",R))?e:[]).filter(e=>e.id&&e.name).map(e=>({label:"".concat(e.name,"(").concat(e.id,")"),value:e.id})),V=e=>{R.setFieldsValue(null!=e?e:{id:"spec-".concat(Date.now()),name:"",description:"",factFields:[{id:"document-goal",name:"文档目标",type:"text",required:!0},{id:"target-audience",name:"目标读者",type:"text",required:!1},{id:"key-conclusion",name:"关键结论",type:"list",required:!0}],chapterRules:[],gateRules:[]}),U(!0)},W=async()=>{try{let e=await R.validateFields(),a=await (0,C.EK)(e);P(a.specs),U(!1),t.success(n("common.success"))}catch(e){e instanceof Error&&t.error(e.message)}},B=async e=>{P((await (0,C.ER)(e)).specs)};return(0,a.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,a.jsx)(o.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle mb-1",children:n("specs.title")}),(0,a.jsx)("p",{className:"pageDesc mb-0",children:n("specs.description")})]}),(0,a.jsx)(r.Ay,{type:"primary",icon:(0,a.jsx)(v.A,{}),onClick:()=>V(),children:n("specs.newSpec")})]})}),(0,a.jsx)(l.A,{type:"info",showIcon:!0,message:n("specs.plainGuideTitle"),description:n("specs.plainGuideDesc")}),(0,a.jsx)(o.A,{title:n("specs.list"),children:(0,a.jsx)(d.A,{dataSource:k,locale:{emptyText:(0,a.jsx)(p.A,{description:n("common.noData")})},renderItem:(e,t)=>(0,a.jsx)(d.A.Item,{actions:[(0,a.jsx)(r.Ay,{type:"text",icon:(0,a.jsx)(w.A,{}),onClick:()=>V(e)},"edit"),(0,a.jsx)(u.A,{title:n("common.confirm"),disabled:e.builtIn,onConfirm:()=>{B(e.id)},children:(0,a.jsx)(r.Ay,{type:"text",danger:!0,icon:(0,a.jsx)(S.A,{}),disabled:e.builtIn})},"delete")],children:(0,a.jsx)(d.A.Item.Meta,{title:(0,a.jsxs)(m.A,{children:[(0,a.jsxs)(h.A,{children:["序号 ",t+1]}),(0,a.jsx)("span",{children:e.name}),e.builtIn&&(0,a.jsx)(h.A,{color:"gold",children:n("documents.builtIn")}),(0,a.jsx)(h.A,{children:e.id})]}),description:"".concat(e.description||"-"," \xb7 ").concat(n("specs.facts"),": ").concat(e.factFields.length," \xb7 ").concat(n("specs.chapters"),": ").concat(e.chapterRules.length," \xb7 ").concat(n("specs.gates"),": ").concat(e.gateRules.length)})})})}),(0,a.jsx)(y.A,{maskClosable:!1,title:n("specs.editor"),open:J,onOk:()=>{W()},onCancel:()=>U(!1),width:980,centered:!0,okText:n("common.save"),children:(0,a.jsxs)(c.A,{form:R,layout:"vertical",children:[(0,a.jsxs)(f.A,{gutter:12,children:[(0,a.jsx)(j.A,{span:8,children:(0,a.jsx)(c.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,a.jsx)(x.A,{disabled:!0})})}),(0,a.jsx)(j.A,{span:8,children:(0,a.jsx)(c.A.Item,{name:"name",label:n("specs.name"),rules:[{required:!0}],children:(0,a.jsx)(x.A,{})})}),(0,a.jsx)(j.A,{span:8,children:(0,a.jsx)(c.A.Item,{name:"wordTemplatePath",label:n("specs.wordTemplatePath"),children:(0,a.jsx)(x.A,{placeholder:"/path/to/template.docx"})})})]}),(0,a.jsx)(c.A.Item,{name:"description",label:n("specs.specDescription"),children:(0,a.jsx)(x.A,{})}),(0,a.jsx)(g.A,{items:[{key:"facts",label:n("specs.facts"),children:(0,a.jsx)(c.A.List,{name:"factFields",children:(e,t)=>{let{add:s,remove:i}=t;return(0,a.jsxs)(m.A,{direction:"vertical",className:"w-full",children:[e.map(e=>(0,a.jsxs)(o.A,{size:"small",children:[(0,a.jsxs)(f.A,{gutter:8,children:[(0,a.jsx)(j.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"id"],label:"ID",initialValue:"fact-".concat(Date.now()),children:(0,a.jsx)(x.A,{disabled:!0})})}),(0,a.jsx)(j.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"name"],label:n("specs.factName"),rules:[{required:!0}],children:(0,a.jsx)(x.A,{})})}),(0,a.jsx)(j.A,{span:4,children:(0,a.jsx)(c.A.Item,{name:[e.name,"type"],label:n("specs.factType"),initialValue:"text",children:(0,a.jsx)(A.A,{options:E})})}),(0,a.jsx)(j.A,{span:4,children:(0,a.jsx)(c.A.Item,{name:[e.name,"required"],label:n("specs.required"),valuePropName:"checked",children:(0,a.jsx)(b.A,{})})}),(0,a.jsx)(j.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"sourceRoleIds"],label:n("specs.sourceRoles"),children:(0,a.jsx)(A.A,{mode:"multiple",options:L})})}),(0,a.jsx)(j.A,{span:1,children:(0,a.jsx)(r.Ay,{danger:!0,onClick:()=>i(e.name),children:"-"})})]}),(0,a.jsx)(c.A.Item,{name:[e.name,"extractionHint"],label:n("specs.extractionHint"),children:(0,a.jsx)(x.A,{})}),(0,a.jsx)(c.A.Item,{name:[e.name,"validationHint"],label:n("specs.validationHint"),children:(0,a.jsx)(x.A,{})})]},e.key)),(0,a.jsx)(r.Ay,{onClick:()=>s({id:"fact-".concat(Date.now()),type:"text",required:!0}),children:n("specs.addFact")})]})}})},{key:"chapters",label:n("specs.chapters"),children:(0,a.jsx)(c.A.List,{name:"chapterRules",children:(e,t)=>{let{add:s,remove:i}=t;return(0,a.jsxs)(m.A,{direction:"vertical",className:"w-full",children:[e.map((e,t)=>(0,a.jsxs)(o.A,{size:"small",children:[(0,a.jsxs)(f.A,{gutter:8,children:[(0,a.jsx)(j.A,{span:4,children:(0,a.jsx)(c.A.Item,{name:[e.name,"id"],label:"ID",initialValue:"chapter-".concat(Date.now()),children:(0,a.jsx)(x.A,{disabled:!0})})}),(0,a.jsx)(j.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"title"],label:n("specs.chapterTitle"),rules:[{required:!0}],children:(0,a.jsx)(x.A,{})})}),(0,a.jsx)(j.A,{span:3,children:(0,a.jsx)(c.A.Item,{name:[e.name,"order"],label:n("specs.order"),initialValue:t,children:(0,a.jsx)(T.A,{className:"w-full"})})}),(0,a.jsx)(j.A,{span:3,children:(0,a.jsx)(c.A.Item,{name:[e.name,"minWords"],label:n("specs.minWords"),children:(0,a.jsx)(T.A,{className:"w-full"})})}),(0,a.jsx)(j.A,{span:3,children:(0,a.jsx)(c.A.Item,{name:[e.name,"required"],label:n("specs.required"),valuePropName:"checked",children:(0,a.jsx)(b.A,{})})}),(0,a.jsx)(j.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"requiredFactIds"],label:n("specs.requiredFacts"),extra:"仅可选择当前规范包“事实字段”中已定义的字段。",children:(0,a.jsx)(A.A,{mode:"multiple",showSearch:!0,optionFilterProp:"label",placeholder:"请选择事实字段",options:H})})}),(0,a.jsx)(j.A,{span:1,children:(0,a.jsx)(r.Ay,{danger:!0,onClick:()=>i(e.name),children:"-"})})]}),(0,a.jsxs)(f.A,{gutter:8,children:[(0,a.jsx)(j.A,{span:12,children:(0,a.jsx)(c.A.Item,{name:[e.name,"requiredFileRoleIds"],label:n("specs.requiredFileRoles"),children:(0,a.jsx)(A.A,{mode:"multiple",options:L})})}),(0,a.jsx)(j.A,{span:12,children:(0,a.jsx)(c.A.Item,{name:[e.name,"requiredPromptRoleIds"],label:n("specs.requiredPromptRoles"),children:(0,a.jsx)(A.A,{mode:"multiple",options:F})})})]}),(0,a.jsx)(c.A.Item,{name:[e.name,"generationHint"],label:n("specs.generationHint"),children:(0,a.jsx)(x.A,{})})]},e.key)),(0,a.jsx)(r.Ay,{onClick:()=>s({id:"chapter-".concat(Date.now()),order:e.length,required:!0}),children:n("specs.addChapter")})]})}})},{key:"gates",label:n("specs.gates"),children:(0,a.jsx)(c.A.List,{name:"gateRules",children:(e,t)=>{let{add:s,remove:i}=t;return(0,a.jsxs)(m.A,{direction:"vertical",className:"w-full",children:[e.map(e=>(0,a.jsxs)(f.A,{gutter:8,children:[(0,a.jsx)(j.A,{span:4,children:(0,a.jsx)(c.A.Item,{name:[e.name,"id"],initialValue:"gate-".concat(Date.now()),children:(0,a.jsx)(x.A,{disabled:!0})})}),(0,a.jsx)(j.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"name"],rules:[{required:!0}],children:(0,a.jsx)(x.A,{placeholder:n("specs.gateName")})})}),(0,a.jsx)(j.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"type"],initialValue:"required_fact",children:(0,a.jsx)(A.A,{options:N})})}),(0,a.jsx)(j.A,{span:4,children:(0,a.jsx)(c.A.Item,{name:[e.name,"level"],initialValue:"error",children:(0,a.jsx)(A.A,{options:O})})}),(0,a.jsx)(j.A,{span:3,children:(0,a.jsx)(c.A.Item,{name:[e.name,"target"],children:(0,a.jsx)(x.A,{placeholder:"target"})})}),(0,a.jsx)(j.A,{span:2,children:(0,a.jsx)(c.A.Item,{name:[e.name,"value"],children:(0,a.jsx)(x.A,{placeholder:"value"})})}),(0,a.jsx)(j.A,{span:1,children:(0,a.jsx)(r.Ay,{danger:!0,onClick:()=>i(e.name),children:"-"})})]},e.key)),(0,a.jsx)(r.Ay,{onClick:()=>s({id:"gate-".concat(Date.now()),type:"required_fact",level:"error"}),children:n("specs.addGate")})]})}})}]})]})})]})}},94773:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-specs",function(){return t(16734)}])}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,2700,5174,4696,288,8332,4020,1539,636,6593,8792],()=>e(e.s=94773)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4298],{6578:(e,t,n)=>{"use strict";async function s(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function o(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return s("/api/kb/stats".concat(t))}async function i(e){var t,n;let o=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&o.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&o.set("category",e.category),(null==e?void 0:e.page)&&o.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&o.set("limit",String(null!=(n=e.limit)?n:50)),s("/api/kb/files?".concat(o))}async function a(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),s("/api/kb/files/detail?".concat(n))}async function r(e,t){return s("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function c(e,t,n){return s("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let s=new FileReader;s.onload=()=>{let e=s.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},s.onerror=n,s.readAsDataURL(e)})}async function d(e,t,n){return s("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return s("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function f(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function y(e){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return s("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return s("/api/kb/features")}async function w(e,t){var n,o,i,a,r;let c=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&c.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&c.set("category",t.category),(null==t?void 0:t.limit)&&c.set("limit",String(null!=(r=t.limit)?r:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(o=t.weights)?void 0:o.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(i=t.weights)?void 0:i.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(a=t.weights)?void 0:a.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),s("/api/kb/search?".concat(c))}async function j(){return s("/api/prompt")}async function v(e){return s("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function b(e){return s("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function A(e,t){return s("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function k(e){return s("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function S(e){return s("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function I(){return s("/api/documents/specs")}async function T(e){return s("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e){return s("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return s("/api/documents/templates")}async function R(e){return s("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return s("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(e){return s("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function P(e){return s("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(){return s("/api/documents/generated")}async function L(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,t){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function U(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function M(){return s("/api/assets/generated")}async function J(e){return s("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function W(e){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function F(e,t){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function z(e){return s("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function B(e,t){return s("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function H(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),n=t.headers.get("content-type")||"",s=async()=>{let e=await t.text(),n=e||"导出失败";try{var s;let t=JSON.parse(e),o=null==(s=t.issues)?void 0:s.map(e=>e.message).filter(Boolean).slice(0,3).join(";");n=o?"".concat(t.error||"导出失败",":").concat(o):t.error||n}catch(e){}throw Error(n.length>300?"".concat(n.slice(0,300),"..."):n)};return t.ok||await s(),"pdf"!==e.format||n.includes("application/pdf")||await s(),"docx"!==e.format||n.includes("officedocument.wordprocessingml.document")||await s(),t.blob()}async function q(){return s("/api/config/providers")}async function G(e,t){return s("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function K(e){return s("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function Q(){return s("/api/config/models")}async function V(e){return s("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function X(){return s("/api/config/embedding")}async function Z(e){return s("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(){return s("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return s("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function ee(){return s("/api/system/stats")}async function et(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return s("/api/system/logs?limit=".concat(e))}async function en(){return s("/api/system/logs",{method:"DELETE"})}async function es(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return s("/api/context".concat(n))}async function eo(e){return s("/api/context?type=".concat(e,"&stats=1"))}async function ei(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ea(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function er(e){return s("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ec(e,t){return s("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function el(e){return s("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>B,Bh:()=>el,Dl:()=>E,E:()=>ea,EK:()=>T,ER:()=>C,FC:()=>ee,FV:()=>A,H1:()=>g,H7:()=>m,HC:()=>r,HT:()=>i,II:()=>X,JU:()=>J,NR:()=>k,OX:()=>P,PH:()=>ei,QG:()=>U,QT:()=>u,Qx:()=>p,R1:()=>z,SJ:()=>f,UE:()=>H,VW:()=>x,W2:()=>w,X8:()=>y,Z3:()=>q,_m:()=>G,a6:()=>D,aP:()=>V,bV:()=>O,bZ:()=>Y,c1:()=>d,cQ:()=>_,dd:()=>Z,dg:()=>b,dw:()=>S,dx:()=>j,f$:()=>M,h0:()=>N,h1:()=>K,hH:()=>en,hc:()=>o,hn:()=>es,l2:()=>R,lv:()=>v,mx:()=>I,oH:()=>et,oS:()=>F,p:()=>eo,tn:()=>c,u6:()=>$,uc:()=>W,v7:()=>L,xC:()=>a,xq:()=>h,xw:()=>er,zo:()=>ec,zr:()=>Q})},16403:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return n(19562)}])},19562:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>Q});var s=n(65321),o=n(97109),i=n(7576),a=n(35292),r=n(17807),c=n(63455),l=n(68787),d=n(85114),u=n(2256),p=n(38770),m=n(38332),h=n(84253),f=n(26171),y=n(33442),g=n(11702),x=n(57271),w=n(9730),j=n(58569),v=n(25258),b=n(26631),A=n(23216),k=n(26619),S=n(8263),I=n(16285),T=n(8579),C=n(75548),E=n(7851),R=n(84742),N=n(29071),O=n(63552),P=n(76830),_=n(83914),L=n(58209),D=n(54746),U=n(93051),M=n(99650),J=n(67547),W=n(99811),F=n(6578),z=n(64209);let{TextArea:B}=i.A,{Paragraph:H,Text:q}=a.A,G=null;function K(){null==G||G.listeners.forEach(e=>e())}function Q(){var e,t,n;let a=(0,z.Vr)(),{message:Q}=r.A.useApp(),[V]=c.A.useForm(),[X,Z]=(0,o.useState)([]),[$,Y]=(0,o.useState)("construction-organization-design"),[ee,et]=(0,o.useState)([]),[en,es]=(0,o.useState)([]),[eo,ei]=(0,o.useState)([]),[ea,er]=(0,o.useState)(!1),[ec,el]=(0,o.useState)(null),[ed,eu]=(0,o.useState)(""),[ep,em]=(0,o.useState)([]),[eh,ef]=(0,o.useState)(null),[ey,eg]=(0,o.useState)(!1),[ex,ew]=(0,o.useState)(null),[ej,ev]=(0,o.useState)(!1),[eb,eA]=(0,o.useState)([]),[ek,eS]=(0,o.useState)(null),eI=async()=>{try{em((await (0,F.cQ)()).documents)}catch(e){em([])}};(0,o.useEffect)(()=>{let e=()=>{G&&(eA(G.flowSteps),eS(G.activeFlowKey),er(G.loading),G.draft&&el(G.draft),void 0!==G.content&&eu(G.content))};return null==G||G.listeners.add(e),e(),()=>{null==G||G.listeners.delete(e)}},[]),(0,o.useEffect)(()=>{(0,F.Dl)().then(e=>{var t,n;Z(e.templates),Y(null!=(n=null==(t=e.templates[0])?void 0:t.id)?n:"construction-organization-design")}).catch(()=>Q.error(a("common.error"))),(0,F.lv)().then(e=>{et(e.roles),es(e.configs)}).catch(()=>{et([]),es([])}),(0,F.mx)().then(e=>ei(e.specs)).catch(()=>ei([])),eI()},[Q,a]);let eT=(0,o.useMemo)(()=>X.find(e=>e.id===$),[X,$]),eC=en.map(e=>({label:e.name,value:e.id})),eE=eo.map(e=>({label:e.name,value:e.id})),eR=Math.max(0,eb.findIndex(e=>e.key===ek)),eN=e=>e.map((e,t)=>({key:"sub-".concat(t),title:e,status:"wait"})),eO=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eT,t=eo.find(t=>t.id===(null==e?void 0:e.documentSpecId)),n=en.find(t=>t.id===(null==e?void 0:e.projectRoleConfigId)),o=((null==n?void 0:n.fileRoles)||[]).map(e=>{var t;return(null==(t=ee.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),i=((null==n?void 0:n.promptRoles)||[]).map(e=>{var t;return(null==(t=ee.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),r=(null==t?void 0:t.factFields.map(e=>e.name))||(null==e?void 0:e.chapters.flatMap(e=>e.requiredFacts))||[],c=(null==e?void 0:e.chapters.map(e=>e.title))||[],l=i.some(e=>/封面|图片|资源|cover|image/iu.test(e));return[{key:"prepare",title:a("documents.flowPrepare"),description:"读取“".concat((null==e?void 0:e.name)||"当前模板","”并创建后台生成任务"),status:"process",icon:(0,s.jsx)(b.A,{}),subSteps:eN(["读取模板参数",(null==e?void 0:e.documentSpecId)?"加载规范包:".concat((null==t?void 0:t.name)||e.documentSpecId):"未绑定规范包,使用模板章节要求","创建后台生成任务"])},{key:"role_binding",title:"动态角色配置绑定",description:"绑定 ".concat(o.length," 个文件角色、").concat(i.length," 个提示词角色"),status:"wait",icon:(0,s.jsx)(A.A,{}),subSteps:eN([...o.length?o.map(e=>"文件角色:".concat(e)):["没有文件角色,使用模板绑定文件"],...i.length?i.map(e=>"提示词角色:".concat(e)):["没有提示词角色,使用默认生成策略"]].slice(0,10))},{key:"knowledge_retrieval",title:"知识库证据检索",description:"按 ".concat(c.length," 个章节检索文本、文档、表格、图片、图纸和附件"),status:"wait",icon:(0,s.jsx)(k.A,{}),subSteps:eN(c.length?c.slice(0,10).map(e=>"检索章节:".concat(e)):["按模板标题检索证据"])},{key:"file_understanding",title:"多类型文件理解",description:"按文件角色处理文本、PDF/Word、表格、图片、图纸和附件",status:"wait",icon:(0,s.jsx)(S.A,{}),subSteps:eN(["识别文件类型和角色","构建结构化资源证据包","必要时调用多模态文件理解"])},{key:"fact_extraction",title:"动态 schema 事实抽取",description:"按 ".concat(r.length," 个规范/章节事实字段抽取并检测冲突"),status:"wait",icon:(0,s.jsx)(I.A,{}),subSteps:eN(r.length?r.slice(0,10).map(e=>"抽取事实:".concat(e)):["抽取模板要求的事实","合并来源和角色","检测事实冲突"])},{key:"chapter_generation",title:"章节生成",description:"按 ".concat(c.length," 个模板章节逐章生成"),status:"wait",icon:(0,s.jsx)(T.A,{}),subSteps:eN(c.length?c.slice(0,10).map(e=>"生成:".concat(e)):["构造章节提示词","等待 LLM 生成","整理章节证据"])},...l?[{key:"asset_generation",title:"生成资源处理",description:"根据资源/图片提示词生成或登记本地资源",status:"wait",icon:(0,s.jsx)(C.A,{}),subSteps:eN(["生成资源提示词","保存到 generatedDocuments/assets","登记资源元数据"])}]:[],{key:"validation",title:"规范包与门禁校验",description:t?"执行 ".concat(t.gateRules.length," 条门禁规则"):"执行模板基础校验",status:"wait",icon:(0,s.jsx)(E.A,{}),subSteps:eN([...(null==t?void 0:t.factFields.filter(e=>e.required).map(e=>"必填事实:".concat(e.name)))||[],...(null==t?void 0:t.gateRules.map(e=>"门禁:".concat(e.name)))||["检查章节证据","检查缺失项","检查导出门禁"]].slice(0,10))},{key:"formatting",title:a("documents.flowFormatting"),description:"整理标题、表格、图片、附件引用和正式 Markdown",status:"wait",icon:(0,s.jsx)(R.A,{}),subSteps:eN(["整理标题层级","整理多类型资源引用","生成正式 Markdown"])},{key:"llm_review",title:"LLM 审查优化",description:"再次使用动态 schema、角色和结构化证据审查优化初稿",status:"wait",icon:(0,s.jsx)(N.A,{}),subSteps:eN(["构造审查提示词","检查事实来源和冲突","回填优化后的 Markdown"])},{key:"export_ready",title:"导出就绪",description:"确认 Markdown/HTML/DOCX/PDF 可导出",status:"wait",icon:(0,s.jsx)(O.A,{}),subSteps:eN(["生成导出检查清单","确认阻断项","准备导出格式"])},{key:"done",title:a("documents.flowDone"),description:a("documents.flowDoneDesc"),status:"wait",icon:(0,s.jsx)(P.A,{}),subSteps:eN(["展示生成结果","允许编辑正文","允许导出文件"])}]},eP=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ea;(null==G?void 0:G.loading)&&(G.flowSteps=e,G.activeFlowKey=t,G.loading=n,K())},e_=(e,t)=>{if("wait"===t)return e.subSteps.map(e=>({...e,status:"wait"}));if("finish"===t)return e.subSteps.map(e=>({...e,status:"finish"}));if("error"===t)return e.subSteps.map((e,t)=>({...e,status:0===t?"error":e.status}));let n=e.subSteps.findIndex(e=>"wait"===e.status);return e.subSteps.map((e,t)=>t<n||-1===n?{...e,status:"finish"}:t===n?{...e,status:"process"}:e)},eL=(e,t,n)=>{eS(e),eA(s=>{let o=s.map(s=>s.key===e?{...s,status:t,description:n||s.description,subSteps:e_(s,t)}:s);return eP(o,e),o})};(0,o.useEffect)(()=>{if(!ea||!ek)return;let e=window.setInterval(()=>{eA(e=>{let t=e.map(e=>{if(e.key!==ek||"process"!==e.status)return e;let t=e.subSteps.findIndex(e=>"process"===e.status),n=t<0?0:Math.min(t+1,e.subSteps.length-1);return{...e,subSteps:e.subSteps.map((e,t)=>t<n?{...e,status:"finish"}:t===n?{...e,status:"process"}:{...e,status:"wait"})}});return eP(t,ek),t})},1400);return()=>window.clearInterval(e)},[ek,ea]);let eD=e=>{eA(t=>{let n=t.findIndex(t=>t.key===e),s=t.map((e,t)=>t<n&&"error"!==e.status?{...e,status:"finish",subSteps:e_(e,"finish")}:e);return eP(s,e),s})},eU=e=>{V.setFieldsValue(null!=e?e:{id:"custom-template-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,documentSpecId:void 0,chapters:[]}),ev(!0)},eM=async()=>{try{let e=await V.validateFields(),t=await (0,F.l2)(e);Z(t.templates),Y(t.template.id),ev(!1),await eI(),Q.success(a("common.success"))}catch(e){e instanceof Error&&Q.error(e.message)}},eJ=async e=>{try{let t=await (0,F.bV)(e);Z(t.templates),Y(t.template.id),Q.success(a("common.success"))}catch(e){Q.error(a("common.error"))}},eW=async e=>{try{var t,n;let s=await (0,F.h0)(e);Z(s.templates),Y(null!=(n=null==(t=s.templates[0])?void 0:t.id)?n:""),Q.success(a("common.success"))}catch(e){Q.error(a("common.error"))}},eF=async e=>{try{await (0,F.QG)(e),eh===e&&(ef(null),el(null),eu("")),await eI(),Q.success(a("common.success"))}catch(e){Q.error(a("common.error"))}},ez=async e=>{let t=[{key:"chapter_generation",message:"后台任务已创建,正在轮询等待 LLM 章节生成完成…"},{key:"asset_generation",message:"正在轮询等待封面和生成资源写入本地记录…"},{key:"validation",message:"正在轮询等待校验、导出门禁和格式化完成…"},{key:"llm_review",message:"正在轮询等待 LLM 审查优化完成…"}],n=0;for(;;){let{document:s}=await (0,F.v7)(e);if(("completed"===s.status||"warning"===s.status)&&s.draft)return s;if("failed"===s.status)throw Error(s.error||"生成失败");let o=t[Math.min(n,t.length-1)];eD(o.key),eL(o.key,"process",o.message),n+=1,await new Promise(e=>window.setTimeout(e,1500))}},eB=async()=>{if(!$)return;if(null==G?void 0:G.loading){eA(G.flowSteps),eS(G.activeFlowKey),er(!0);return}er(!0);let e=eO(X.find(e=>e.id===$)||eT),t=(0,F.OX)({templateId:$});G={id:Date.now(),templateId:$,loading:!0,flowSteps:e,activeFlowKey:"prepare",promise:t,listeners:new Set},eA(e),eS("prepare");let n=[{key:"role_binding",message:"正在读取模板、文件角色、提示词角色和文档规范包…"},{key:"knowledge_retrieval",message:"正在从知识库检索章节证据、表格、图片和附件…"},{key:"file_understanding",message:"正在准备多模态文件理解;如果模型支持图片/文件理解,会等待模型返回…"},{key:"fact_extraction",message:"正在等待 LLM 事实抽取和后续章节生成结果,请不要关闭页面…"}].map((e,t)=>window.setTimeout(()=>{eD(e.key),eL(e.key,"process",e.message)},600+900*t));try{let e=await t,s=e.documentId?await ez(e.documentId):void 0,o=e.draft||(null==s?void 0:s.draft);if(!o)throw Error("生成结果为空");(e.documentId||(null==s?void 0:s.id))&&ef(e.documentId||s.id),n.forEach(e=>window.clearTimeout(e)),eD("done"),el(o),eu((null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown),(null==G?void 0:G.promise)===t&&(G.draft=o,G.content=(null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown),eA(e=>{let t=e.map(e=>{let t=o.executionStages.find(t=>t.type===e.key);if("prepare"===e.key)return{...e,status:"finish",description:a("documents.flowPrepareDone"),subSteps:e_(e,"finish")};if("done"===e.key){var n;let t=o.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!o.exportGate.passed,s=t?"warning":"finish",i=null==(n=o.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message;return{...e,status:s,description:t?"生成完成,但需要复核:".concat(i||a("documents.flowGateFailed")):a("documents.flowDoneDesc"),subSteps:e_(e,s)}}if(!t)return"process"===e.status?{...e,status:"finish",subSteps:e_(e,"finish")}:e;let s="failed"===t.status?"error":"finish";return{...e,status:s,description:"".concat(t.status.toUpperCase(),":").concat(t.message||e.description),subSteps:e_(e,s)}});return eP(t,"done",!1),t}),eS("done"),(null==G?void 0:G.promise)===t&&(G.activeFlowKey="done",G.loading=!1,K()),await eI(),Q.success(a("common.success"))}catch(n){let e=n instanceof Error?n.message:a("common.error");eA(t=>{let n=t.map(t=>"process"===t.status?{...t,status:"error",description:e,subSteps:e_(t,"error")}:t);return eP(n,ek,!1),n}),(null==G?void 0:G.promise)===t&&(G.loading=!1,G.error=e,K()),Q.error(e)}finally{n.forEach(e=>window.clearTimeout(e)),er(!1),(null==G?void 0:G.promise)===t&&(G.loading=!1,K())}},eH=async e=>{if(ec){eg(!0);try{var t;let n="markdown"===e?"md":e,s=null==(t=eo.find(e=>e.id===(null==eT?void 0:eT.documentSpecId)))?void 0:t.wordTemplatePath,o=await (0,F.UE)({documentId:eh||void 0,title:ec.title,markdown:ed,format:e,enforceGate:!1,exportGate:ec.exportGate,wordTemplatePath:s});((e,t,n)=>{let s=new Blob([e],{type:n}),o=URL.createObjectURL(s),i=document.createElement("a");i.href=o,i.download=t,i.target="_self",i.rel="noopener",i.style.display="none",document.body.appendChild(i),i.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),i.remove(),window.setTimeout(()=>URL.revokeObjectURL(o),1e3)})(o,"".concat(ec.title,".").concat(n),{markdown:"text/markdown;charset=utf-8",html:"text/html;charset=utf-8",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}[e])}catch(e){Q.error(e instanceof Error?e.message:a("common.error"))}finally{eg(!1)}}},eq=async()=>{if(ec)try{if(eh)await (0,F.a6)(eh,{editedMarkdown:ed,markdown:ed});else{let e=await (0,F.Af)({...ec,markdown:ed});el(e.draft)}await eI(),Q.success(a("common.success"))}catch(e){Q.error(a("common.error"))}},eG=async e=>{if(ec){ew(e.id);try{var t;let n=await (0,F.R1)({templateId:ec.templateId,chapterId:e.id}),s=ec.chapters.map(t=>t.id===e.id?n.chapter:t);el({...ec,chapters:s}),t=n.chapter,eu(n=>n.includes(e.content)?n.replace(e.content,t.content):"".concat(n,"\n\n").concat(t.content)),Q.success(a("common.success"))}catch(e){Q.error(a("common.error"))}finally{ew(null)}}};return(0,s.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,s.jsx)(l.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"pageTitle mb-1",children:a("documents.title")}),(0,s.jsx)("p",{className:"pageDesc mb-0",children:a("documents.description")})]}),(0,s.jsx)(d.Ay,{type:"primary",size:"large",icon:(0,s.jsx)(D.A,{}),onClick:()=>eU(),children:a("documents.newTemplate")})]})}),(0,s.jsxs)(u.A,{gutter:[16,16],align:"top",children:[(0,s.jsxs)(p.A,{xs:24,lg:8,children:[(0,s.jsx)(l.A,{size:"small",title:a("documents.templateLibrary"),children:(0,s.jsx)(m.A,{dataSource:X,locale:{emptyText:(0,s.jsx)(h.A,{description:a("common.noData")})},renderItem:(e,t)=>(0,s.jsx)(m.A.Item,{onClick:()=>Y(e.id),className:"cursor-pointer",actions:[(0,s.jsx)(d.Ay,{size:"small",type:"text",icon:(0,s.jsx)(U.A,{}),onClick:t=>{t.stopPropagation(),eJ(e.id)}},"copy"),(0,s.jsx)(d.Ay,{size:"small",type:"text",icon:(0,s.jsx)(M.A,{}),disabled:e.builtIn,onClick:t=>{t.stopPropagation(),eU(e)}},"edit"),(0,s.jsx)(f.A,{title:a("documents.deleteTemplateConfirm"),disabled:e.builtIn,onConfirm:t=>{null==t||t.stopPropagation(),eW(e.id)},children:(0,s.jsx)(d.Ay,{size:"small",type:"text",danger:!0,icon:(0,s.jsx)(L.A,{}),disabled:e.builtIn,onClick:e=>e.stopPropagation()})},"delete")],children:(0,s.jsx)(m.A.Item.Meta,{avatar:(0,s.jsx)(b.A,{}),title:(0,s.jsxs)(y.A,{children:[(0,s.jsxs)(g.A,{children:["序号 ",t+1]}),(0,s.jsx)("span",{children:e.name}),e.builtIn&&(0,s.jsx)(g.A,{children:a("documents.builtIn")}),$===e.id&&(0,s.jsx)(g.A,{color:"blue",children:a("documents.selected")})]}),description:(0,s.jsxs)(y.A,{direction:"vertical",size:2,children:[(0,s.jsx)("span",{children:e.description}),(0,s.jsx)(g.A,{children:e.category})]})})})})}),(0,s.jsx)(l.A,{className:"mt-4",size:"small",title:a("documents.draftHistory"),children:0===ep.length?(0,s.jsx)(h.A,{description:a("common.noData")}):(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:ep.slice(0,8).map((e,t)=>{var n,o,i;let a,r;return(0,s.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>{(async()=>{ef(e.id),Y(e.templateId);let{document:t}=await (0,F.v7)(e.id);el(t.draft||null),eu(t.editedMarkdown||t.markdown)})()},onKeyDown:e=>{"Enter"===e.key&&e.currentTarget.click()},style:{display:"flex",gap:8,alignItems:"flex-start",justifyContent:"space-between",padding:"8px 0",borderBottom:"1px solid var(--colorBorderSecondary)",cursor:"pointer",minWidth:0},children:[(0,s.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:[(0,s.jsxs)(g.A,{style:{marginInlineEnd:0},children:["序号 ",t+1]}),(0,s.jsx)("span",{style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:600},children:e.title}),(0,s.jsx)(g.A,{style:{marginInlineEnd:0},color:"completed"===(a=e.status)?"success":"warning"===a?"warning":"failed"===a?"error":"processing",children:"warning"===e.status?"warning":e.status})]}),(0,s.jsxs)("div",{style:{marginTop:4,display:"flex",flexWrap:"wrap",gap:"4px 8px",color:"var(--colorTextSecondary)",fontSize:12},children:[(0,s.jsx)("span",{children:new Date(e.updatedAt).toLocaleString()}),(0,s.jsxs)("span",{children:["耗时:",(e=>{let t=Math.max(0,Math.round(((e.completedAt||e.updatedAt)-e.createdAt)/1e3));if(t<60)return"".concat(t," 秒");let n=Math.floor(t/60),s=t%60;if(n<60)return s?"".concat(n," 分 ").concat(s," 秒"):"".concat(n," 分");let o=Math.floor(n/60),i=n%60;return i?"".concat(o," 小时 ").concat(i," 分"):"".concat(o," 小时")})(e)]})]}),"warning"===e.status&&(0,s.jsx)("div",{style:{marginTop:4,color:"failed"===(r=e.status)?"var(--colorError)":"warning"===r?"var(--colorWarning)":"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflowWrap:"anywhere",wordBreak:"break-all"},children:(null==(n=e.warningIssues)?void 0:n[0])||(null==(i=e.draft)||null==(o=i.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:o.message)||"生成完成,但存在需要复核的问题"})]}),(0,s.jsx)(f.A,{title:"确认删除这条生成记录?",onConfirm:t=>{null==t||t.stopPropagation(),eF(e.id)},children:(0,s.jsx)(d.Ay,{size:"small",danger:!0,title:"删除记录","aria-label":"删除记录",icon:(0,s.jsx)(L.A,{}),onClick:e=>e.stopPropagation()})})]},e.id)})})})]}),(0,s.jsx)(p.A,{xs:24,lg:16,children:(0,s.jsx)(l.A,{size:"small",title:a("documents.workflow"),children:(0,s.jsxs)(y.A,{direction:"vertical",className:"w-full",size:"middle",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block mb-1",children:a("documents.template")}),(0,s.jsx)(x.A,{className:"w-full",value:$,onChange:Y,options:X.map(e=>({label:e.name,value:e.id}))})]}),eT&&(0,s.jsxs)(l.A,{size:"small",type:"inner",title:eT.outputTitle,children:[(0,s.jsx)(H,{children:eT.description}),(0,s.jsxs)(y.A,{wrap:!0,children:[eT.projectRoleConfigId?(0,s.jsx)(g.A,{color:"geekblue",children:(null==(e=en.find(e=>e.id===eT.projectRoleConfigId))?void 0:e.name)||eT.projectRoleConfigId}):(0,s.jsx)(g.A,{color:"warning",children:a("documents.noRoleConfig")}),eT.documentSpecId?(0,s.jsx)(g.A,{color:"cyan",children:(null==(t=eo.find(e=>e.id===eT.documentSpecId))?void 0:t.name)||eT.documentSpecId}):null]})]}),eT&&(0,s.jsx)(y.A,{direction:"vertical",size:4,children:(0,s.jsxs)("span",{children:[a("documents.projectRoleConfig"),": ",(null==(n=en.find(e=>e.id===eT.projectRoleConfigId))?void 0:n.name)||a("documents.noRoleConfig")]})}),(0,s.jsx)(d.Ay,{type:"primary",size:"large",block:!0,icon:(0,s.jsx)(N.A,{}),loading:ea,disabled:!(null==eT?void 0:eT.projectRoleConfigId),onClick:()=>{eB()},children:a("documents.generate")}),eb.length>0&&(0,s.jsx)(l.A,{size:"small",type:"inner",title:a("documents.executionStatus"),children:(0,s.jsx)(w.A,{direction:"vertical",size:"small",current:eR,items:eb.map(e=>{let t;return{title:e.title,description:(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{children:e.description}),(0,s.jsx)("div",{className:"space-y-0.5",children:e.subSteps.map(e=>{var t;return(0,s.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--colorTextSecondary)]",children:["process"===(t=e.status)?(0,s.jsx)(_.A,{}):"finish"===t?(0,s.jsx)(R.A,{}):"warning"===t?(0,s.jsx)(E.A,{className:"text-[var(--colorWarning)]"}):"error"===t?(0,s.jsx)(L.A,{}):(0,s.jsx)("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-[var(--colorTextTertiary)]"}),(0,s.jsx)("span",{children:e.title})]},e.key)})})]}),status:"warning"===(t=e.status)?"finish":t,icon:"process"===e.status?(0,s.jsx)(_.A,{}):"warning"===e.status?(0,s.jsx)(E.A,{className:"text-[var(--colorWarning)]"}):e.icon}})})})]})})})]}),(0,s.jsx)(l.A,{size:"small",title:a("documents.editor"),extra:(0,s.jsx)(y.A,{wrap:!0,children:ec&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Ay,{icon:(0,s.jsx)(J.A,{}),onClick:()=>{eq()},children:a("documents.saveDraft")}),(0,s.jsx)(d.Ay,{icon:(0,s.jsx)(P.A,{}),loading:ey,onClick:()=>{eH("markdown")},children:a("documents.downloadMarkdown")}),(0,s.jsx)(d.Ay,{loading:ey,onClick:()=>{eH("html")},children:a("documents.exportHtml")}),(0,s.jsx)(d.Ay,{loading:ey,onClick:()=>{eH("docx")},children:a("documents.exportDocx")}),(0,s.jsx)(d.Ay,{type:"primary",loading:ey,onClick:()=>{eH("pdf")},children:a("documents.exportPdf")})]})}),children:ec?(0,s.jsx)(j.A,{items:[{key:"edit",label:a("documents.edit"),children:(0,s.jsx)(B,{rows:26,value:ed,onChange:e=>eu(e.target.value)})},{key:"chapters",label:a("documents.chapters"),children:(0,s.jsx)(m.A,{dataSource:ec.chapters,renderItem:(e,t)=>(0,s.jsx)(m.A.Item,{actions:[(0,s.jsx)(d.Ay,{size:"small",icon:(0,s.jsx)(W.A,{}),loading:ex===e.id,onClick:()=>{eG(e)},children:a("documents.regenerateChapter")},"regen")],children:(0,s.jsx)(m.A.Item.Meta,{title:(0,s.jsxs)(y.A,{children:[(0,s.jsxs)(g.A,{children:["序号 ",t+1]}),e.title]}),description:(0,s.jsxs)(y.A,{direction:"vertical",children:[(0,s.jsxs)("span",{children:[a("documents.evidenceCount"),": ",e.evidence.length]}),(0,s.jsxs)("span",{children:[a("documents.missingCount"),": ",e.missingFacts.length]})]})})})})},{key:"facts",label:a("documents.structuredFacts"),children:(0,s.jsx)(m.A,{dataSource:ec.structuredFacts,renderItem:(e,t)=>{var n;return(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)(m.A.Item.Meta,{title:(0,s.jsxs)(y.A,{children:[(0,s.jsxs)(g.A,{children:["序号 ",t+1]}),"".concat(e.key,": ").concat(e.value)]}),description:"".concat(e.sourceFile," \xb7 ").concat((null==(n=ee.find(t=>t.id===e.roleId))?void 0:n.name)||e.roleId)}),(0,s.jsx)(g.A,{children:e.confidence.toFixed(2)})]})}})},{key:"sources",label:a("documents.sources"),children:(0,s.jsx)(m.A,{dataSource:ec.sources,renderItem:e=>(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)("span",{children:e.filePath}),(0,s.jsx)(g.A,{children:e.count})]})})},{key:"missing",label:a("documents.missingItems"),children:0===ec.missingItems.length?(0,s.jsx)(h.A,{description:a("common.noData")}):(0,s.jsx)(m.A,{dataSource:ec.missingItems,renderItem:e=>(0,s.jsx)(m.A.Item,{children:e})})},{key:"validation",label:a("documents.validation"),children:0===ec.validationIssues.length?(0,s.jsx)(h.A,{description:a("common.noData")}):(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8,minWidth:0,maxWidth:"100%",overflow:"hidden"},children:ec.validationIssues.map(e=>(0,s.jsxs)("div",{style:{minWidth:0,maxWidth:"100%",overflow:"hidden",border:"1px solid var(--colorBorderSecondary)",borderRadius:8,padding:12,background:"var(--colorBgContainer)"},children:[(0,s.jsx)(g.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:e.level}),(0,s.jsx)("div",{style:{marginTop:6,maxWidth:"100%",whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.message}),e.suggestion&&(0,s.jsx)("div",{style:{marginTop:6,maxWidth:"100%",color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.suggestion})]},"".concat(e.level,"-").concat(e.message)))})},{key:"gate",label:a("documents.exportGate"),children:(0,s.jsx)(m.A,{dataSource:ec.exportGate.checklist,renderItem:e=>(0,s.jsxs)(m.A.Item,{className:"min-w-0",children:[(0,s.jsxs)(y.A,{direction:"vertical",size:2,className:"min-w-0 flex-1",children:[(0,s.jsx)(q,{className:"block max-w-full",style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.label}),e.message&&(0,s.jsx)(q,{type:"secondary",className:"block max-w-full",style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})]}),(0,s.jsx)(g.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})},{key:"stages",label:a("documents.executionStages"),children:(0,s.jsx)(m.A,{dataSource:ec.executionStages,renderItem:e=>{var t,n;return(0,s.jsxs)(m.A.Item,{className:"min-w-0",children:[(0,s.jsx)(m.A.Item.Meta,{avatar:(t=e.type,({role_binding:(0,s.jsx)(A.A,{}),knowledge_retrieval:(0,s.jsx)(k.A,{}),file_understanding:(0,s.jsx)(S.A,{}),fact_extraction:(0,s.jsx)(I.A,{}),chapter_generation:(0,s.jsx)(T.A,{}),asset_generation:(0,s.jsx)(C.A,{}),validation:(0,s.jsx)(E.A,{}),formatting:(0,s.jsx)(R.A,{}),llm_review:(0,s.jsx)(N.A,{}),export_ready:(0,s.jsx)(O.A,{}),reference:(0,s.jsx)(C.A,{})})[t]||(0,s.jsx)(b.A,{})),title:(0,s.jsx)(q,{className:"block max-w-full",style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:"".concat({role_binding:"角色配置绑定",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",asset_generation:"多模态资源生成",validation:"规则校验",formatting:"格式化排版",llm_review:"LLM 审查优化",export_ready:"导出就绪",reference:"参考资源处理"}[n=e.type]||n," \xb7 ").concat(e.roleId)}),description:(0,s.jsx)(q,{type:"secondary",className:"block max-w-full whitespace-pre-wrap",style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})}),(0,s.jsx)(g.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})}})}]}):(0,s.jsx)(h.A,{description:a("documents.noDraft")})}),(0,s.jsx)(v.A,{maskClosable:!1,title:a("documents.templateEditor"),open:ej,onOk:()=>{eM()},onCancel:()=>ev(!1),width:760,centered:!0,okText:a("common.save"),children:(0,s.jsxs)(c.A,{form:V,layout:"vertical",requiredMark:"optional",children:[(0,s.jsxs)(u.A,{gutter:12,children:[(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,s.jsx)(i.A,{disabled:!0})})}),(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"name",label:a("documents.templateName"),rules:[{required:!0}],children:(0,s.jsx)(i.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"category",label:a("documents.templateCategory"),children:(0,s.jsx)(i.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:12,children:(0,s.jsx)(c.A.Item,{name:"outputTitle",label:a("documents.outputTitle"),children:(0,s.jsx)(i.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:12,children:(0,s.jsx)(c.A.Item,{name:"description",label:a("documents.templateDescription"),children:(0,s.jsx)(i.A,{})})})]}),(0,s.jsx)(c.A.Item,{name:"projectRoleConfigId",label:a("documents.projectRoleConfig"),rules:[{required:!0,message:a("documents.projectRoleConfigRequired")}],children:(0,s.jsx)(x.A,{showSearch:!0,placeholder:a("documents.projectRoleConfigRequired"),options:eC})}),(0,s.jsx)(c.A.Item,{name:"documentSpecId",label:a("documents.documentSpec"),children:(0,s.jsx)(x.A,{allowClear:!0,showSearch:!0,placeholder:a("documents.documentSpecPlaceholder"),options:eE})})]})})]})}}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,2700,5174,4696,288,5292,8332,1054,6474,636,6593,8792],()=>e(e.s=16403)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3309],{1873:(e,t,l)=>{e.exports=l(91952)},4632:(e,t)=>{"use strict";function l(e){var t;let{config:l,src:r,width:i,quality:n}=e,a=n||(null==(t=l.qualities)?void 0:t.reduce((e,t)=>Math.abs(t-75)<Math.abs(e-75)?t:e))||75;return l.path+"?url="+encodeURIComponent(r)+"&w="+i+"&q="+a+(r.startsWith("/_next/static/media/"),"")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r}}),l.__next_img_default=!0;let r=l},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusPanel:"style_statusPanel__9arTu",statusPanelHeader:"style_statusPanelHeader__nKv1I",statusEmpty:"style_statusEmpty__8LWzH",statusList:"style_statusList__FpNgC",statusItem:"style_statusItem__uzO80",statusHeader:"style_statusHeader__o9q_b",statusDesc:"style_statusDesc__XiWFa",statusPath:"style_statusPath__Udxvv",statusMeta:"style_statusMeta__XukHt",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"}},37690:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return l(48200)}])},48200:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>M});var r=l(65321),i=l(97109),n=l(1873),a=l.n(n),s=l(43220),o=l.n(s),c=l(86109),d=l(35292),u=l(76506),h=l(33442),m=l(11702),p=l(9137),f=l(59400),g=l(68787),x=l(56985),y=l(49604),v=l(84253),j=l(42700),w=l(85493),_=l(85114),b=l(58569),S=l(7576),A=l(6578),C=l(45551),k=l(14569),P=l.n(k);let{Paragraph:R}=d.A;function z(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}function I(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).slice(0,30):[]}function N(e,t){let l=t.trim()?[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length):[];if(0===l.length)return e;let i=RegExp("(".concat(l.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(i).map((e,t)=>l.some(t=>t.toLowerCase()===e.toLowerCase())?(0,r.jsx)("mark",{children:e},t):e)}function O(e,t,l){return null==t||""===t||Array.isArray(t)&&0===t.length?null:(0,r.jsx)(u.A.Item,{label:e,children:Array.isArray(t)?(0,r.jsx)(h.A,{wrap:!0,children:t.map(e=>(0,r.jsx)(m.A,{className:"cursor-pointer",onClick:()=>null==l?void 0:l(String(e)),children:String(e)},String(e)))}):String(t)})}function E(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return e.map((e,l)=>({key:"".concat(t,"-").concat(l),name:e}))}function M(){var e,t,l,n,s,d,k,M,D,L;let T=(0,c.useRouter)(),F="string"==typeof T.query.relativePath?T.query.relativePath:"",[J,K]=(0,i.useState)(),[B,H]=(0,i.useState)(!1),[X,G]=(0,i.useState)(""),[V,q]=(0,i.useState)(!1),[W,U]=(0,i.useState)(""),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{F&&(H(!0),G(""),(0,A.xC)(F).then(K).catch(e=>{K(void 0),G(e instanceof Error?e.message:"文件详情加载失败")}).finally(()=>H(!1)))},[F]);let Z=(0,i.useMemo)(()=>(function(e){let t=z(null==e?void 0:e.file.metadataJson);return"object"==typeof t.extraction&&t.extraction?t.extraction:t})(J),[J]),Q=I(Z.layerNames);(0,i.useEffect)(()=>{Y(Q)},[null==J?void 0:J.file.relativePath,Q.join("|")]);let ee=W.trim().toLowerCase(),et=(0,i.useMemo)(()=>{var e;return J&&ee?J.chunks.filter(e=>{let t=z(e.metadataJson);return[e.content,e.sectionTitle,t.rowRange,t.chunkKind,t.parentId,JSON.stringify(t)].some(e=>String(null!=e?e:"").toLowerCase().includes(ee))}):null!=(e=null==J?void 0:J.chunks)?e:[]},[J,ee]),el=(0,i.useMemo)(()=>{var e;return J&&ee?J.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(ee))):null!=(e=null==J?void 0:J.parents)?e:[]},[J,ee]),er=async()=>{if(F){q(!0);try{let e=await (0,A.HC)(F);e.detail&&K(e.detail),p.Ay.success("文件索引已重建")}finally{q(!1)}}},ei=async e=>{e&&(await navigator.clipboard.writeText(e),p.Ay.success("已复制"))},en=async e=>{F&&(await (0,A.tn)(F,e),p.Ay.success("file"===e?"已请求打开文件":"已请求打开目录"))},ea=[{key:"table",label:"表格",children:(0,r.jsxs)(h.A,{direction:"vertical",className:"w-full",children:[(0,r.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[O("Sheet",I(Z.sheetNames),U),O("表头",I(Z.columnNames),U),O("行数",Z.rowCount),O("列数",Z.columnCount),O("公式数",Z.formulaCount),O("合并单元格",Z.mergeCount)]}),(0,r.jsx)(f.A,{size:"small",pagination:!1,rowKey:"key",dataSource:E(I(Z.columnNames),"column"),columns:[{title:"列名",dataIndex:"name",render:e=>(0,r.jsx)(m.A,{className:"cursor-pointer",onClick:()=>U(String(e)),children:String(e)})}]}),(0,r.jsx)(f.A,{size:"small",pagination:!1,rowKey:"key",dataSource:(null!=(k=null==J?void 0:J.chunks)?k:[]).map(e=>z(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,t)=>({key:"row-".concat(t),name:e})),columns:[{title:"行范围",dataIndex:"name",render:e=>(0,r.jsxs)(m.A,{color:"gold",className:"cursor-pointer",onClick:()=>U(String(e)),children:["行 ",String(e)]})}]}),(0,r.jsx)(f.A,{size:"small",rowKey:"key",dataSource:(null!=(M=null==J?void 0:J.chunks)?M:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>e.includes("|")).slice(0,80).map((e,t)=>({key:"grid-".concat(t),cells:e.split("|").map(e=>e.trim()).filter(Boolean)})),pagination:{pageSize:10},columns:[{title:"表格网格预览",dataIndex:"cells",render:e=>(0,r.jsx)(h.A,{wrap:!0,children:e.map((e,t)=>(0,r.jsx)(m.A,{children:e},"".concat(e,"-").concat(t)))})}]})]})},{key:"drawing",label:"图纸",children:(0,r.jsxs)(h.A,{direction:"vertical",className:"w-full",children:[(0,r.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[O("图层",I(Z.layerNames),U),O("块/符号",I(Z.blockNames),U),O("实体类型",I(Z.entityTypes),U),O("产品/零件",I(Z.productNames),U),O("材料",I(Z.materialNames),U),O("实体名称",I(Z.entityNames),U)]}),Q.length>0?(0,r.jsxs)(g.A,{size:"small",title:"图层开关 / 图纸预览",children:[(0,r.jsx)(x.A.Group,{value:$,options:Q.map(e=>({label:e,value:e})),onChange:e=>Y(e.map(String))}),(0,r.jsx)("div",{className:P().drawingPreview,children:$.map(e=>(0,r.jsx)(m.A,{color:"blue",children:e},e))})]}):null,(0,r.jsx)(f.A,{size:"small",pagination:!1,rowKey:"key",dataSource:[...E(Q,"layer").map(e=>({...e,type:"图层"})),...E(I(Z.entityTypes),"entity").map(e=>({...e,type:"实体类型"})),...E(I(Z.blockNames),"block").map(e=>({...e,type:"块/符号"}))],columns:[{title:"类型",dataIndex:"type",width:120},{title:"名称",dataIndex:"name",render:e=>(0,r.jsx)(m.A,{className:"cursor-pointer",onClick:()=>U(String(e)),children:String(e)})}]})]})},{key:"data",label:"数据路径",children:(0,r.jsxs)(h.A,{direction:"vertical",className:"w-full",children:[I(Z.dataPaths).length>0?(0,r.jsx)(y.A,{defaultExpandAll:!0,treeData:function(e){let t=new Map;for(let l of e){let e=t;for(let t of l.replace(/\[(\d+)\]/gu,".$1").split(".").filter(Boolean))e.has(t)||e.set(t,new Map),e=e.get(t)}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return[...e.entries()].map(e=>{let[r,i]=e;return{title:r,key:t?"".concat(t,".").concat(r):r,children:l(i,t?"".concat(t,".").concat(r):r)}})};return l(t)}(I(Z.dataPaths)),onSelect:e=>{var t;return U(String(null!=(t=e[0])?t:""))}}):(0,r.jsx)(v.A,{description:"暂无数据路径"}),(0,r.jsx)(f.A,{size:"small",rowKey:"key",dataSource:(null!=(D=null==J?void 0:J.chunks)?D:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>/^[\w.[\]-]+\s*[:=]/u.test(e)).slice(0,200).map((e,t)=>{var l,r,i,n;let a=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(t),path:null!=(i=null==a||null==(l=a[1])?void 0:l.trim())?i:e,value:null!=(n=null==a||null==(r=a[2])?void 0:r.trim())?n:""}}),pagination:{pageSize:20},columns:[{title:"Path",dataIndex:"path",width:260,render:e=>(0,r.jsx)(m.A,{className:"cursor-pointer",onClick:()=>U(String(e)),children:String(e)})},{title:"Value",dataIndex:"value",render:e=>(0,r.jsx)("span",{className:"break-all",children:String(e)})}]})]})},{key:"ocr",label:"OCR/PDF",children:(0,r.jsxs)(h.A,{direction:"vertical",className:"w-full",children:[(0,r.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[O("OCR 建议",Z.ocrRecommended),O("OCR 原因",Z.ocrReason),O("OCR 引擎",Z.ocrProvider),O("OCR 语言",Z.ocrLanguages),O("OCR 文本长度",Z.ocrTextLength),O("PDF 页面 OCR 支持",Z.pdfPageOcrSupported),O("PDF OCR 页数",Z.ocrPageCount),O("PDF OCR 页数上限",Z.pdfOcrPageLimit),O("PDF 渲染器",Z.pdfRenderer)]}),(null==J?void 0:J.file.format)==="pdf"?(0,r.jsx)("div",{className:P().pdfPreviewStrip,children:Array.from({length:Math.min(Number(null!=(e=Z.ocrPageCount)?e:1)||1,6)},(e,t)=>(0,r.jsx)(a(),{width:220,height:320,src:"/api/kb/files/preview-pdf-page?relativePath=".concat(encodeURIComponent(J.file.relativePath),"&page=").concat(t+1),alt:"PDF 第 ".concat(t+1," 页"),unoptimized:!0},t))}):null,(0,r.jsx)(f.A,{size:"small",rowKey:"key",dataSource:(null!=(L=null==J?void 0:J.chunks)?L:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,t,l,r)=>{var i,n,a;return l%2==0&&e.push({key:"page-".concat(t),page:t,text:null!=(a=null==(n=r[l+1])||null==(i=n.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:i.trim())?a:""}),e},[]),pagination:{pageSize:10},columns:[{title:"页码",dataIndex:"page",width:90},{title:"OCR 文本",dataIndex:"text",render:e=>(0,r.jsx)(R,{ellipsis:{rows:4,expandable:!0,symbol:"展开"},children:String(e)})}]})]})}],es=[{title:"序号",key:"index",width:70,render:(e,t,l)=>l+1},{title:"#",dataIndex:"chunkIndex",width:70,render:e=>String(e)},{title:"类型",width:110,render:(e,t)=>{var l;return(0,r.jsx)(m.A,{children:String(null!=(l=z(t.metadataJson).chunkKind)?l:t.category)})}},{title:"章节/范围",width:220,render:(e,t)=>{let l=z(t.metadataJson),i="string"==typeof l.rowRange?l.rowRange:void 0;return(0,r.jsxs)(h.A,{wrap:!0,children:[t.sectionTitle?(0,r.jsx)(m.A,{color:"cyan",children:t.sectionTitle}):null,i?(0,r.jsxs)(m.A,{color:"gold",children:["行 ",i]}):null]})}},{title:"Token",dataIndex:"tokenCount",width:90},{title:"内容",render:(e,t)=>(0,r.jsx)(R,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:P().searchContent,children:N(t.content,W)})}],eo=[{title:"序号",key:"index",width:70,render:(e,t,l)=>l+1},{title:"Parent",dataIndex:"parentId",width:260,render:e=>(0,r.jsx)("span",{className:"break-all",children:e})},{title:"切片数",dataIndex:"chunkCount",width:90},{title:"章节",dataIndex:"sectionTitle",width:220},{title:"内容",render:(e,t)=>(0,r.jsx)(R,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:P().searchContent,children:N(t.content,W)})}];return B?(0,r.jsx)(j.A,{}):X?(0,r.jsx)(w.A,{type:"error",showIcon:!0,message:"文件详情加载失败",description:X}):J?(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(o(),{href:"/knowledge/files",children:"返回文件列表"}),(0,r.jsxs)("div",{className:P().searchResultHeader,children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"pageTitle",children:"文件详情"}),(0,r.jsx)("p",{className:"pageDesc",children:"查看解析结果、图纸/表格/数据结构化字段、parent chunk 和 child chunk。"})]}),(0,r.jsxs)(h.A,{children:[(0,r.jsx)(_.Ay,{onClick:()=>{ei(null==J?void 0:J.absolutePath)},children:"复制原文件路径"}),(0,r.jsx)(_.Ay,{onClick:()=>{ei(null==J?void 0:J.directory)},children:"复制所在目录"}),(0,r.jsx)(_.Ay,{onClick:()=>{en("file")},children:"打开文件"}),(0,r.jsx)(_.Ay,{onClick:()=>{en("directory")},children:"打开目录"}),"pdf"===J.file.format?(0,r.jsx)(_.Ay,{loading:V,onClick:()=>{er()},children:"重新 OCR"}):null,(0,r.jsx)(_.Ay,{type:"primary",loading:V,onClick:()=>{er()},children:"重建该文件索引"})]})]})]}),(0,r.jsx)(g.A,{size:"small",title:"基础信息",children:(0,r.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[(0,r.jsx)(u.A.Item,{label:"路径",children:J.file.relativePath}),(0,r.jsx)(u.A.Item,{label:"原文件",children:null!=(t=J.absolutePath)?t:"-"}),(0,r.jsx)(u.A.Item,{label:"所在目录",children:null!=(l=J.directory)?l:"-"}),(0,r.jsxs)(u.A.Item,{label:"分类",children:[(0,r.jsx)(m.A,{children:(0,C.Jm)(J.file.category)})," ",(0,r.jsx)(m.A,{children:J.file.format})]}),(0,r.jsx)(u.A.Item,{label:"大小",children:(0,C.z3)(J.file.fileSize)}),(0,r.jsx)(u.A.Item,{label:"切片数",children:J.file.chunkCount}),(0,r.jsx)(u.A.Item,{label:"状态",children:J.file.status}),(0,r.jsx)(u.A.Item,{label:"解析模式",children:String(null!=(n=Z.extractionMode)?n:"-")}),(0,r.jsx)(u.A.Item,{label:"覆盖范围",children:String(null!=(s=Z.contentCoverage)?s:"-")}),(0,r.jsx)(u.A.Item,{label:"正文长度",children:String(null!=(d=Z.textLength)?d:"-")})]})}),(0,r.jsx)(g.A,{size:"small",title:"结构化信息",children:(0,r.jsx)(b.A,{items:ea})}),(0,r.jsx)(g.A,{size:"small",title:"详情筛选",children:(0,r.jsxs)(h.A,{direction:"vertical",className:"w-full",children:[(0,r.jsx)(S.A,{allowClear:!0,value:W,onChange:e=>U(e.target.value),placeholder:"筛选 rowRange、图层、实体、data path、section、chunk 内容"}),W?(0,r.jsxs)(h.A,{wrap:!0,children:[(0,r.jsxs)(m.A,{color:"blue",children:["Parent 命中 ",el.length]}),(0,r.jsxs)(m.A,{color:"green",children:["Child 命中 ",et.length]}),(0,r.jsxs)(m.A,{color:"purple",children:["筛选词 ",W]})]}):null]})}),(0,r.jsx)(g.A,{size:"small",title:"Parent Chunks (".concat(el.length,"/").concat(J.parents.length,")"),children:(0,r.jsx)(f.A,{rowKey:"id",columns:eo,dataSource:el,pagination:{pageSize:10},size:"small"})}),(0,r.jsx)(g.A,{size:"small",title:"Child Chunks (".concat(et.length,"/").concat(J.chunks.length,")"),children:(0,r.jsx)(f.A,{rowKey:"id",columns:es,dataSource:et,pagination:{pageSize:20},size:"small"})})]}):(0,r.jsx)(v.A,{description:"请选择文件"})}},49952:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return j}});let r=l(34007),i=l(26908),n=l(65321),a=i._(l(97109)),s=r._(l(61222)),o=r._(l(64041)),c=l(62956),d=l(83149),u=l(65059);l(28965);let h=l(99318),m=r._(l(4632)),p=l(47503),f={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function g(e,t,l,r,i,n,a){let s=null==e?void 0:e.src;e&&e["data-loaded-src"]!==s&&(e["data-loaded-src"]=s,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&i(!0),null==l?void 0:l.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let r=!1,i=!1;l.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>r,isPropagationStopped:()=>i,persist:()=>{},preventDefault:()=>{r=!0,t.preventDefault()},stopPropagation:()=>{i=!0,t.stopPropagation()}})}(null==r?void 0:r.current)&&r.current(e)}}))}function x(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}let y=(0,a.forwardRef)((e,t)=>{let{src:l,srcSet:r,sizes:i,height:s,width:o,decoding:c,className:d,style:u,fetchPriority:h,placeholder:m,loading:f,unoptimized:y,fill:v,onLoadRef:j,onLoadingCompleteRef:w,setBlurComplete:_,setShowAltText:b,sizesInput:S,onLoad:A,onError:C,...k}=e,P=(0,a.useCallback)(e=>{e&&(C&&(e.src=e.src),e.complete&&g(e,m,j,w,_,y,S))},[l,m,j,w,_,C,y,S]),R=(0,p.useMergedRef)(t,P);return(0,n.jsx)("img",{...k,...x(h),loading:f,width:o,height:s,decoding:c,"data-nimg":v?"fill":"1",className:d,style:u,sizes:i,srcSet:r,src:l,ref:R,onLoad:e=>{g(e.currentTarget,m,j,w,_,y,S)},onError:e=>{b(!0),"empty"!==m&&_(!0),C&&C(e)}})});function v(e){let{isAppRouter:t,imgAttributes:l}=e,r={as:"image",imageSrcSet:l.srcSet,imageSizes:l.sizes,crossOrigin:l.crossOrigin,referrerPolicy:l.referrerPolicy,...x(l.fetchPriority)};return t&&s.default.preload?(s.default.preload(l.src,r),null):(0,n.jsx)(o.default,{children:(0,n.jsx)("link",{rel:"preload",href:l.srcSet?void 0:l.src,...r},"__nimg-"+l.src+l.srcSet+l.sizes)})}let j=(0,a.forwardRef)((e,t)=>{let l=(0,a.useContext)(h.RouterContext),r=(0,a.useContext)(u.ImageConfigContext),i=(0,a.useMemo)(()=>{var e;let t=f||r||d.imageConfigDefault,l=[...t.deviceSizes,...t.imageSizes].sort((e,t)=>e-t),i=t.deviceSizes.sort((e,t)=>e-t),n=null==(e=t.qualities)?void 0:e.sort((e,t)=>e-t);return{...t,allSizes:l,deviceSizes:i,qualities:n}},[r]),{onLoad:s,onLoadingComplete:o}=e,p=(0,a.useRef)(s);(0,a.useEffect)(()=>{p.current=s},[s]);let g=(0,a.useRef)(o);(0,a.useEffect)(()=>{g.current=o},[o]);let[x,j]=(0,a.useState)(!1),[w,_]=(0,a.useState)(!1),{props:b,meta:S}=(0,c.getImgProps)(e,{defaultLoader:m.default,imgConf:i,blurComplete:x,showAltText:w});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(y,{...b,unoptimized:S.unoptimized,placeholder:S.placeholder,fill:S.fill,onLoadRef:p,onLoadingCompleteRef:g,setBlurComplete:j,setShowAltText:_,sizesInput:e.sizes,ref:t}),S.priority?(0,n.jsx)(v,{isAppRouter:!l,imgAttributes:b}):null]})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},62956:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return o}}),l(28965);let r=l(65545),i=l(83149),n=["-moz-initial","fill","none","scale-down",void 0];function a(e){return void 0!==e.default}function s(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function o(e,t){var l,o;let c,d,u,{src:h,sizes:m,unoptimized:p=!1,priority:f=!1,loading:g,className:x,quality:y,width:v,height:j,fill:w=!1,style:_,overrideSrc:b,onLoad:S,onLoadingComplete:A,placeholder:C="empty",blurDataURL:k,fetchPriority:P,decoding:R="async",layout:z,objectFit:I,objectPosition:N,lazyBoundary:O,lazyRoot:E,...M}=e,{imgConf:D,showAltText:L,blurComplete:T,defaultLoader:F}=t,J=D||i.imageConfigDefault;if("allSizes"in J)c=J;else{let e=[...J.deviceSizes,...J.imageSizes].sort((e,t)=>e-t),t=J.deviceSizes.sort((e,t)=>e-t),r=null==(l=J.qualities)?void 0:l.sort((e,t)=>e-t);c={...J,allSizes:e,deviceSizes:t,qualities:r}}if(void 0===F)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let K=M.loader||F;delete M.loader,delete M.srcSet;let B="__next_img_default"in K;if(B){if("custom"===c.loader)throw Object.defineProperty(Error('Image with src "'+h+'" is missing "loader" prop.\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader'),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=K;K=t=>{let{config:l,...r}=t;return e(r)}}if(z){"fill"===z&&(w=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[z];e&&(_={..._,...e});let t={responsive:"100vw",fill:"100vw"}[z];t&&!m&&(m=t)}let H="",X=s(v),G=s(j);if((o=h)&&"object"==typeof o&&(a(o)||void 0!==o.src)){let e=a(h)?h.default:h;if(!e.src)throw Object.defineProperty(Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received "+JSON.stringify(e)),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!e.height||!e.width)throw Object.defineProperty(Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received "+JSON.stringify(e)),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(d=e.blurWidth,u=e.blurHeight,k=k||e.blurDataURL,H=e.src,!w)if(X||G){if(X&&!G){let t=X/e.width;G=Math.round(e.height*t)}else if(!X&&G){let t=G/e.height;X=Math.round(e.width*t)}}else X=e.width,G=e.height}let V=!f&&("lazy"===g||void 0===g);(!(h="string"==typeof h?h:H)||h.startsWith("data:")||h.startsWith("blob:"))&&(p=!0,V=!1),c.unoptimized&&(p=!0),B&&!c.dangerouslyAllowSVG&&h.split("?",1)[0].endsWith(".svg")&&(p=!0);let q=s(y),W=Object.assign(w?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:I,objectPosition:N}:{},L?{}:{color:"transparent"},_),U=T||"empty"===C?null:"blur"===C?'url("data:image/svg+xml;charset=utf-8,'+(0,r.getImageBlurSvg)({widthInt:X,heightInt:G,blurWidth:d,blurHeight:u,blurDataURL:k||"",objectFit:W.objectFit})+'")':'url("'+C+'")',$=n.includes(W.objectFit)?"fill"===W.objectFit?"100% 100%":"cover":W.objectFit,Y=U?{backgroundSize:$,backgroundPosition:W.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:U}:{},Z=function(e){let{config:t,src:l,unoptimized:r,width:i,quality:n,sizes:a,loader:s}=e;if(r)return{src:l,srcSet:void 0,sizes:void 0};let{widths:o,kind:c}=function(e,t,l){let{deviceSizes:r,allSizes:i}=e;if(l){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let r;r=e.exec(l);)t.push(parseInt(r[2]));if(t.length){let e=.01*Math.min(...t);return{widths:i.filter(t=>t>=r[0]*e),kind:"w"}}return{widths:i,kind:"w"}}return"number"!=typeof t?{widths:r,kind:"w"}:{widths:[...new Set([t,2*t].map(e=>i.find(t=>t>=e)||i[i.length-1]))],kind:"x"}}(t,i,a),d=o.length-1;return{sizes:a||"w"!==c?a:"100vw",srcSet:o.map((e,r)=>s({config:t,src:l,quality:n,width:e})+" "+("w"===c?e:r+1)+c).join(", "),src:s({config:t,src:l,quality:n,width:o[d]})}}({config:c,src:h,unoptimized:p,width:X,quality:q,sizes:m,loader:K});return{props:{...M,loading:V?"lazy":g,fetchPriority:P,width:X,height:G,decoding:R,className:x,style:{...W,...Y},sizes:Z.sizes,srcSet:Z.srcSet,src:b||Z.src},meta:{unoptimized:p,priority:f,placeholder:C,fill:w}}}},65545:(e,t)=>{"use strict";function l(e){let{widthInt:t,heightInt:l,blurWidth:r,blurHeight:i,blurDataURL:n,objectFit:a}=e,s=r?40*r:t,o=i?40*i:l,c=s&&o?"viewBox='0 0 "+s+" "+o+"'":"";return"%3Csvg xmlns='http://www.w3.org/2000/svg' "+c+"%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='"+(c?"none":"contain"===a?"xMidYMid":"cover"===a?"xMidYMid slice":"none")+"' style='filter: url(%23b);' href='"+n+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return l}})},91952:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var l in t)Object.defineProperty(e,l,{enumerable:!0,get:t[l]})}(t,{default:function(){return o},getImageProps:function(){return s}});let r=l(34007),i=l(62956),n=l(49952),a=r._(l(4632));function s(e){let{props:t}=(0,i.getImgProps)(e,{defaultLoader:a.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,l]of Object.entries(t))void 0===l&&delete t[e];return{props:t}}let o=n.Image}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,2700,5174,6985,9400,5292,861,9969,9978,636,6593,8792],()=>e(e.s=37690)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9028],{14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusPanel:"style_statusPanel__9arTu",statusPanelHeader:"style_statusPanelHeader__nKv1I",statusEmpty:"style_statusEmpty__8LWzH",statusList:"style_statusList__FpNgC",statusItem:"style_statusItem__uzO80",statusHeader:"style_statusHeader__o9q_b",statusDesc:"style_statusDesc__XiWFa",statusPath:"style_statusPath__Udxvv",statusMeta:"style_statusMeta__XukHt",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},23793:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"}},25258:(e,t,a)=>{"use strict";a.d(t,{A:()=>_});var s=a(51541),r=a(61848),l=a(1249),n=a(97109),i=a(72658),c=a(3638),o=a(92162),d=a(82725),u=a(74567),h=a(632),p=a(49517),f=a(79412),y=a(19527);let g=(0,d.U)(e=>{let{prefixCls:t,className:a,closeIcon:s,closable:r,type:l,title:d,children:g,footer:x,classNames:m,styles:v,..._}=e,{getPrefixCls:w}=n.useContext(u.QO),{className:j,style:A,classNames:k,styles:P}=(0,u.TP)("modal"),b=w(),C=t||w("modal"),N=(0,h.A)(b),[S,I]=(0,y.Ay)(C,N),[E,L]=(0,o.AV)([k,m],[P,v],{props:e}),M=`${C}-confirm`,z={};return z=l?{closable:r??!1,title:"",footer:"",children:n.createElement(p.k,{...e,prefixCls:C,confirmPrefixCls:M,rootPrefixCls:b,content:g})}:{closable:r??!0,title:d,footer:null!==x&&n.createElement(f.w,{...e}),children:g},n.createElement(i.Z,{prefixCls:C,className:(0,c.$)(S,`${C}-pure-panel`,l&&M,l&&`${M}-${l}`,a,j,I,N,E.root),style:{...A,...L.root},..._,closeIcon:(0,f.O)(C,s),closable:r,classNames:E,styles:L,...z})});var x=a(99739);function m(e){return(0,s.Ay)((0,s.fp)(e))}let v=l.A;v.useModal=x.A,v.info=function(e){return(0,s.Ay)((0,s.$D)(e))},v.success=function(e){return(0,s.Ay)((0,s.Ej)(e))},v.error=function(e){return(0,s.Ay)((0,s.jT)(e))},v.warning=m,v.warn=m,v.confirm=function(e){return(0,s.Ay)((0,s.lr)(e))},v.destroyAll=function(){for(;r.A.length;){let e=r.A.pop();e&&e()}},v.config=s.FB,v._InternalPanelDoNotUseOrYouWillBeFired=g;let _=v},36451:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>L});var s=a(65321),r=a(97109),l=a(64209),n=a(43220),i=a.n(n),c=a(86109),o=a(17807),d=a(25258),u=a(33442),h=a(11702),p=a(85114),f=a(7576),y=a(57271),g=a(14932),x=a(99605),m=a(68787),v=a(59400),_=a(26631),w=a(58209),j=a(30486),A=a(92803),k=a(88483);function P(){return(P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}let b=r.forwardRef((e,t)=>r.createElement(k.A,P({},e,{ref:t,icon:A.A})));var C=a(6578),N=a(45551),S=a(14569),I=a.n(S);let E=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function L(){let e=(0,l.Vr)("knowledge"),{locale:t}=(0,l.x_)(),{message:a}=o.A.useApp(),n=(0,c.useRouter)(),A="string"==typeof n.query.category?n.query.category:"",[k,P]=(0,r.useState)([]),[S,L]=(0,r.useState)(!1),[M,z]=(0,r.useState)(""),[H,O]=(0,r.useState)(""),[T,R]=(0,r.useState)(A),[V,D]=(0,r.useState)(!1),[B,F]=(0,r.useState)([]),[J,X]=(0,r.useState)([]),[q,U]=(0,r.useState)(1),$=(0,r.useRef)(T);(0,r.useEffect)(()=>{$.current=T},[T]),(0,r.useEffect)(()=>{R("string"==typeof n.query.category?n.query.category:"")},[n.query.category]);let K=(0,r.useCallback)(async e=>{let t=null!=e?e:$.current;L(!0),z("");try{let e=await (0,C.HT)({category:t||void 0,limit:200});P(e.files||[]),e.initializing&&window.setTimeout(()=>{K(t)},1500)}catch(e){P([]),z(e instanceof Error?e.message:"文件列表加载失败")}finally{L(!1)}},[]);(0,r.useEffect)(()=>{K(T)},[T,K]);let Q=e=>({type:e.type,title:e.title,description:e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,textLength:e.textLength,extractionMode:e.extractionMode}),W=(0,r.useCallback)(async()=>{try{let e=await (0,C.Qx)();F(e.operations.map(Q))}catch(e){}},[]);(0,r.useEffect)(()=>{W()},[W]);let Z=async()=>{try{await (0,C.H7)(),F([]),a.success("任务状态已清空")}catch(e){a.error("清空任务状态失败")}},G=async e=>{if(0===e.length)return;let t=1===e.length?e[0].name:"".concat(e.length," 个文件");D(!0),F(e=>[{type:"upload",title:"上传 ".concat(t),description:"等待上传、解析、切片和入库",status:"processing",percent:10},...e].slice(0,50));let s="".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2)),r=setInterval(()=>{(0,C.QT)(s).then(e=>{F(a=>[{type:"upload",title:"上传 ".concat(t),description:"".concat(e.message).concat(e.chunkCount?",".concat(e.chunkCount," 个切片"):""),status:"error"===e.stage?"warning":"processing",percent:e.percent},...a.filter(e=>e.title!=="上传 ".concat(t))].slice(0,50))}).catch(()=>void 0)},500);try{var l,n,i,c;let o=await (0,C.c1)(e,void 0,s);clearInterval(r),(null==(l=o.vectorStatus)?void 0:l.status)==="error"?a.info("文件已上传,正在后台入库"):a.success("上传成功"),O(""),R(""),X([]),U(1),$.current="";let d=(null==(n=o.uploadedFiles)?void 0:n.length)?o.uploadedFiles:null!=(c=null==(i=o.files)?void 0:i.filter(e=>e.relativePath===o.relativePath))?c:[],u=d[0],h=(e=>{if(!e)return{};let t={};try{t=e.metadataJson?JSON.parse(e.metadataJson):{}}catch(e){}let a="object"==typeof t.extraction&&t.extraction?t.extraction:t;return{textLength:"number"==typeof a.textLength?a.textLength:void 0,extractionMode:"string"==typeof a.extractionMode?a.extractionMode:void 0}})(u);await W(),F(e=>[{type:"upload",title:"上传完成 ".concat(t),description:"解析、分块和入库流程已完成",status:"success",filePath:null==u?void 0:u.relativePath,chunkCount:null==u?void 0:u.chunkCount,textLength:h.textLength,extractionMode:h.extractionMode},...e.filter(e=>e.title!=="上传 ".concat(t))].slice(0,50)),d.length>0&&P(e=>{let t=new Map(e.map(e=>[e.relativePath,e]));for(let e of d)t.set(e.relativePath,e);return Array.from(t.values()).sort((e,t)=>t.mtime-e.mtime)}),await W()}catch(s){let e=s instanceof Error?s.message:"请重试或检查文件格式";a.error(e||"上传失败"),F(a=>[{type:"error",title:"上传失败 ".concat(t),description:e,status:"error"},...a].slice(0,50))}finally{clearInterval(r),D(!1)}},Y=e=>{let t="selected"===e?J.map(String):"filtered"===e?ee.map(e=>e.relativePath):[];if("all"!==e&&0===t.length)return;let s="all"===e?"删除全部文件?":"filtered"===e?"删除当前筛选结果 ".concat(t.length," 个文件?"):"删除已选 ".concat(t.length," 个文件?");d.A.confirm({title:s,content:"将同时删除文件、切片、索引和向量记录。此操作不可撤销。",okText:"确认删除",cancelText:"取消",okButtonProps:{danger:!0},onOk:async()=>{F(e=>[{type:"delete",title:s,description:"正在批量删除文件和索引",status:"processing",percent:10},...e].slice(0,50));try{var r;let s=null!=(r=("all"===e?await (0,C.X8)():await (0,C.SJ)(t)).deleted)?r:t.length;a.success("已删除 ".concat(s," 个文件")),X([]),F(e=>[{type:"delete",title:"批量删除完成",description:"已删除 ".concat(s," 个文件、切片和索引"),status:"success"},...e].slice(0,50)),await K(),await W()}catch(e){a.error("批量删除失败"),F(e=>[{type:"error",title:"批量删除失败",description:"请重试",status:"error"},...e].slice(0,50))}}})},ee=H?k.filter(e=>e.relativePath.toLowerCase().includes(H.toLowerCase())):k,et=[{title:"序号",key:"index",width:70,render:(e,t,a)=>(q-1)*50+a+1},{title:e("fileName"),dataIndex:"relativePath",key:"name",render:(e,t)=>(0,s.jsxs)(u.A,{children:[(0,s.jsx)(_.A,{}),t.builtIn&&(0,s.jsx)(h.A,{color:"gold",children:"内置"}),(0,s.jsx)(i(),{className:"truncate max-w-[400px] inline-block",href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(e)),children:e})]})},{title:e("fileCategory"),dataIndex:"category",key:"cat",width:120,render:e=>(0,s.jsx)(h.A,{children:(0,N.Jm)(e,t)})},{title:e("fileSize"),dataIndex:"fileSize",key:"size",width:100,render:e=>(0,N.z3)(e)},{title:"切片",dataIndex:"chunkCount",key:"chunks",width:90,render:e=>(0,s.jsx)(h.A,{color:e>1?"green":"orange",children:e})},{title:"解析状态",dataIndex:"status",key:"status",width:110,render:(e,t)=>(0,s.jsx)(h.A,{color:"active"===e?"green":"red",children:t.errorMessage||e})},{title:e("fileDate"),dataIndex:"mtime",key:"date",width:140,render:e=>e?new Date(e).toLocaleDateString(t):"—"},{title:"",key:"act",width:60,render:(t,r)=>(0,s.jsx)(p.Ay,{type:"text",danger:!0,size:"small",icon:(0,s.jsx)(w.A,{}),onClick:()=>{d.A.confirm({title:e("delete"),content:e("deleteConfirm"),okText:"确认",cancelText:"取消",okButtonProps:{danger:!0},onOk:async()=>{F(e=>[{type:"delete",title:"删除 ".concat(r.relativePath),description:"正在删除文件记录",status:"processing"},...e].slice(0,50));try{await (0,C.xq)(r.relativePath),a.success("已删除"),F(e=>[{type:"delete",title:"删除完成 ".concat(r.relativePath),description:"文件和索引记录已移除",status:"success"},...e].slice(0,50)),X(e=>e.filter(e=>e!==r.relativePath)),await K(),await W()}catch(e){a.error("删除失败"),F(e=>[{type:"error",title:"删除失败 ".concat(r.relativePath),description:"请重试",status:"error"},...e].slice(0,50))}}})}})}];return(0,s.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,s.jsx)("h2",{className:"pageTitle",children:e("fileList")}),(0,s.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,s.jsx)(f.A,{placeholder:e("searchPlaceholder"),prefix:(0,s.jsx)(j.A,{}),value:H,onChange:e=>{O(e.target.value),U(1)},allowClear:!0,className:I().filterInput}),(0,s.jsx)(y.A,{value:T||void 0,onChange:e=>{R(e||""),U(1)},placeholder:e("filterCategory"),allowClear:!0,className:I().filterSelect,options:[{label:e("allCategories"),value:""},...E.map(e=>({label:(0,N.Jm)(e,t),value:e}))]}),(0,s.jsx)(p.Ay,{type:"primary",icon:(0,s.jsx)(b,{}),loading:V,onClick:()=>{var e;return null==(e=document.getElementById("kb-file-upload-input"))?void 0:e.click()},children:V?e("uploading"):e("upload")}),(0,s.jsx)(p.Ay,{icon:(0,s.jsx)(b,{}),loading:V,onClick:()=>{var e;return null==(e=document.getElementById("kb-folder-upload-input"))?void 0:e.click()},children:"上传文件夹"}),(0,s.jsxs)(p.Ay,{danger:!0,disabled:0===J.length,icon:(0,s.jsx)(w.A,{}),onClick:()=>Y("selected"),children:["删除已选 ",J.length||""]}),(0,s.jsx)(p.Ay,{danger:!0,disabled:0===ee.length||!H&&!T,onClick:()=>Y("filtered"),children:"删除筛选结果"}),(0,s.jsx)(p.Ay,{danger:!0,disabled:0===k.length,onClick:()=>Y("all"),children:"删除全部"}),(0,s.jsx)("input",{id:"kb-file-upload-input",type:"file",multiple:!0,hidden:!0,onChange:e=>{var t;let a=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",G(a)}}),(0,s.jsx)("input",{id:"kb-folder-upload-input",type:"file",multiple:!0,hidden:!0,webkitdirectory:"",onChange:e=>{var t;let a=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",G(a)}})]}),(0,s.jsxs)("div",{className:I().statusPanel,children:[(0,s.jsxs)("div",{className:I().statusPanelHeader,children:[(0,s.jsxs)(u.A,{children:[(0,s.jsx)(_.A,{}),"文件任务状态"]}),(0,s.jsx)(p.Ay,{size:"small",type:"text",disabled:0===B.length,onClick:()=>void Z(),children:"清空"})]}),0===B.length?(0,s.jsx)("div",{className:I().statusEmpty,children:"暂无文件任务。"}):(0,s.jsx)("div",{className:I().statusList,children:B.map((e,a)=>(0,s.jsxs)("div",{className:I().statusItem,children:[(0,s.jsxs)("div",{className:I().statusHeader,children:[(0,s.jsxs)(u.A,{size:8,wrap:!0,children:[(0,s.jsx)(h.A,{color:"success"===e.status?"green":"error"===e.status?"red":"warning"===e.status?"orange":"blue",children:"upload"===e.type?"上传":"delete"===e.type?"删除":"reindex"===e.type?"重建":"失败"}),(0,s.jsx)(g.A,{title:e.title,children:(0,s.jsx)("strong",{children:e.title})})]}),(0,s.jsx)(h.A,{color:"success"===e.status?"success":"processing"===e.status?"processing":"warning"===e.status?"warning":"error",children:"success"===e.status?"完成":"processing"===e.status?"处理中":"warning"===e.status?"需关注":"失败"})]}),(0,s.jsx)(g.A,{title:e.description,children:(0,s.jsx)("div",{className:I().statusDesc,children:e.description})}),e.filePath&&(0,s.jsx)(g.A,{title:e.filePath,children:(0,s.jsx)("div",{className:I().statusPath,children:e.filePath})}),(0,s.jsxs)("div",{className:I().statusMeta,children:["number"==typeof e.chunkCount&&(0,s.jsxs)("span",{children:["切片 ",(0,s.jsx)("b",{children:e.chunkCount})]}),"number"==typeof e.textLength&&(0,s.jsxs)("span",{children:["正文 ",(0,s.jsx)("b",{children:e.textLength.toLocaleString(t)})," 字符"]}),e.extractionMode&&(0,s.jsxs)("span",{children:["解析 ",(0,s.jsx)("b",{children:e.extractionMode})]})]}),"number"==typeof e.percent&&"processing"===e.status&&(0,s.jsx)(x.A,{percent:e.percent,size:"small"})]},"".concat(e.title,"-").concat(a)))})]}),(0,s.jsxs)(m.A,{children:[M&&(0,s.jsxs)("div",{className:I().statusEmpty,children:["文件列表加载失败:",M]}),(0,s.jsx)(v.A,{rowKey:"relativePath",columns:et,dataSource:ee,loading:S,size:"middle",locale:{emptyText:S?"正在加载文件列表...":H?e("emptySearch"):e("noFiles")},pagination:{current:q,pageSize:50,showSizeChanger:!1,onChange:U},rowSelection:{selectedRowKeys:J,onChange:X}})]})]})}},58209:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var s=a(97109),r=a(23793),l=a(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];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,t)=>s.createElement(l.A,n({},e,{ref:t,icon:r.A})))},90426:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/files",function(){return a(36451)}])},92803:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"}}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,2700,5174,6985,9400,9015,9978,636,6593,8792],()=>e(e.s=90426)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3414],{50423:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>z});var a=t(65321),n=t(97109),s=t(34986),i=t(64209),d=t(17807),r=t(33442),c=t(85114),o=t(2256),u=t(38770),k=t(68787),x=t(54849),g=t(49292),h=t(59400),f=t(11702),w=t(29606),m=t(30486),j=t(99811),A=t(56768),v=t(26619),y=t(93314),b=t(58740),p=t(6578),S=t(45551);let C=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function z(){var e,l,t;let z=(0,i.Vr)(),{locale:_}=(0,i.x_)(),E=(0,s.useRouter)(),{stats:N,loading:D,reload:I}=function(){let[e,l]=(0,n.useState)(null),[t,a]=(0,n.useState)(!1),s=(0,n.useCallback)(async()=>{a(!0);try{l(await (0,p.hc)())}catch(e){}finally{a(!1)}},[]);return(0,n.useEffect)(()=>{s()},[s]),{stats:e,loading:t,reload:s}}(),T=function(){let[e,l]=(0,n.useState)(null);return(0,n.useEffect)(()=>{(0,p.VW)().then(l).catch(()=>{})},[]),e}(),{reindexing:V,reindex:P}=function(){let[e,l]=(0,n.useState)(!1);return{reindexing:e,reindex:(0,n.useCallback)(async()=>{l(!0);try{return await (0,p.H1)(),!0}catch(e){return!1}finally{l(!1)}},[])}}(),[F,H]=(0,n.useState)("document"),[O,X]=(0,n.useState)({count:0,totalSize:0}),{message:B}=d.A.useApp(),J=(0,n.useCallback)(async e=>{try{let l=await (0,p.HT)({category:e,limit:1e4}),t=0;if(Array.isArray(l.files))for(let e of l.files)t+=e.fileSize||0;X({count:l.total||0,totalSize:t})}catch(e){X({count:0,totalSize:0})}},[]);(0,n.useEffect)(()=>{J(F)},[F,J]);let R=async()=>{await P()?await Promise.all([I(),J(F)]):B.error(z("common.error"))};return(0,a.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle",children:z("knowledge.manageTitle")}),(0,a.jsx)("p",{className:"pageDesc",children:z("knowledge.manageDesc")})]}),(0,a.jsxs)(r.A,{children:[(0,a.jsx)(c.Ay,{icon:(0,a.jsx)(w.A,{}),onClick:()=>E.push("/knowledge/files"),children:z("knowledge.files")}),(0,a.jsx)(c.Ay,{icon:(0,a.jsx)(m.A,{}),onClick:()=>E.push("/knowledge/search"),children:z("knowledge.search")}),(0,a.jsx)(c.Ay,{icon:(0,a.jsx)(j.A,{}),loading:V,onClick:()=>{R()},children:z("knowledge.reindex")})]})]}),(0,a.jsx)(o.A,{gutter:[16,16],children:[{icon:(0,a.jsx)(A.A,{}),label:z("knowledge.totalFiles"),value:null!=(e=null==N?void 0:N.fileCount)?e:0},{icon:(0,a.jsx)(v.A,{}),label:z("knowledge.totalChunks"),value:null!=(l=null==N?void 0:N.chunkCount)?l:0},{icon:(0,a.jsx)(y.A,{}),label:z("knowledge.totalSize"),value:(0,S.z3)(null!=(t=null==N?void 0:N.totalSizeBytes)?t:0)},{icon:(0,a.jsx)(b.A,{}),label:z("knowledge.lastIndexed"),value:(null==N?void 0:N.lastIndexedAt)?(0,S.fw)(N.lastIndexedAt,_):z("common.never")}].map((e,l)=>(0,a.jsx)(u.A,{xs:12,sm:6,children:(0,a.jsx)(k.A,{size:"small",loading:D&&!N,children:(0,a.jsx)(x.A,{title:e.label,value:e.value,prefix:e.icon})})},l))}),(0,a.jsxs)(k.A,{title:z("knowledge.categories"),size:"small",children:[(0,a.jsx)(g.A,{value:F,onChange:e=>H(String(e)),options:C.map(e=>({label:(0,S.Jm)(e,_),value:e})),className:"mb-4"}),(0,a.jsxs)(o.A,{gutter:[16,16],children:[(0,a.jsx)(u.A,{xs:12,sm:8,children:(0,a.jsx)(x.A,{title:z("knowledge.fileCount"),value:O.count,prefix:(0,a.jsx)(A.A,{})})}),(0,a.jsx)(u.A,{xs:12,sm:8,children:(0,a.jsx)(x.A,{title:z("knowledge.totalSize"),value:(0,S.z3)(O.totalSize),prefix:(0,a.jsx)(y.A,{})})})]})]}),T&&(0,a.jsx)(k.A,{title:z("knowledge.features"),size:"small",children:(0,a.jsx)(h.A,{dataSource:[{key:"vectorStore",label:"Vector Store",desc:z("knowledge.featureVectorStoreDesc"),value:T.vectorStore},{key:"embedding",label:"Embedding",desc:z("knowledge.featureEmbeddingDesc"),value:T.embeddingProvider},{key:"dedup",label:z("knowledge.featureDedup"),desc:z("knowledge.featureDedupDesc"),value:T.dedupEngine},{key:"chunker",label:z("knowledge.featureChunker"),desc:z("knowledge.featureChunkerDesc"),value:T.chunker}],columns:[{title:"序号",key:"index",width:70,render:(e,l,t)=>t+1},{title:z("knowledge.featureName"),dataIndex:"label",key:"label",width:120},{title:z("knowledge.featureDesc"),dataIndex:"desc",key:"desc"},{title:z("knowledge.featureValue"),dataIndex:"value",key:"value",render:e=>(0,a.jsx)(f.A,{color:"blue",children:e})}],pagination:!1,size:"small"})})]})}},54178:(e,l,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/manage",function(){return t(50423)}])}},e=>{e.O(0,[4260,7167,9382,8628,7271,2700,5174,6985,9400,9958,6288,9978,636,6593,8792],()=>e(e.s=54178)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5207],{838:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"}},4184:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>S});var s=n(65321),a=n(43220),r=n.n(a),o=n(97109),i=n(35292),c=n(68787),l=n(33442),d=n(7576),u=n(85114),p=n(94992),h=n(76506),y=n(11702),m=n(85493),f=n(42700),g=n(84253),j=n(30486),b=n(6578),x=n(14569),w=n.n(x);let{Paragraph:v}=i.A;function _(e){return"number"==typeof e?e.toFixed(2):"-"}function S(){var e,t,n;let[a,i]=(0,o.useState)(""),[x,S]=(0,o.useState)(!1),[T,C]=(0,o.useState)([]),[O,E]=(0,o.useState)(),[P,k]=(0,o.useState)(),[N,R]=(0,o.useState)(""),[A,I]=(0,o.useState)({keyword:1,vector:.9,rewrite:.72,hybridBonus:.35}),U=async()=>{let e=a.trim();if(e){S(!0),R("");try{let t=await (0,b.W2)(e,{limit:10,weights:A});C(t.results),E(t.queryTimeMs),k(t.debug)}catch(e){C([]),R(e instanceof Error?e.message:"搜索失败")}finally{S(!1)}}};return(0,s.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"pageTitle",children:"知识库搜索"}),(0,s.jsx)("p",{className:"pageDesc",children:"查看 hybrid 检索、parent 回填、分块来源和评分明细。"})]}),(0,s.jsx)(c.A,{size:"small",children:(0,s.jsxs)(l.A.Compact,{className:"w-full",children:[(0,s.jsx)(d.A,{value:a,onChange:e=>i(e.target.value),onPressEnter:()=>{U()},placeholder:"输入要搜索的知识库内容"}),(0,s.jsx)(u.Ay,{type:"primary",icon:(0,s.jsx)(j.A,{}),loading:x,onClick:()=>{U()},children:"搜索"})]})}),(0,s.jsx)(c.A,{size:"small",title:"召回权重调节",children:(0,s.jsxs)(l.A,{wrap:!0,children:[(0,s.jsxs)("span",{children:["Keyword ",(0,s.jsx)(p.A,{min:0,max:5,step:.1,value:A.keyword,onChange:e=>I(t=>({...t,keyword:Number(null!=e?e:1)}))})]}),(0,s.jsxs)("span",{children:["Vector ",(0,s.jsx)(p.A,{min:0,max:5,step:.1,value:A.vector,onChange:e=>I(t=>({...t,vector:Number(null!=e?e:.9)}))})]}),(0,s.jsxs)("span",{children:["Rewrite ",(0,s.jsx)(p.A,{min:0,max:5,step:.1,value:A.rewrite,onChange:e=>I(t=>({...t,rewrite:Number(null!=e?e:.72)}))})]}),(0,s.jsxs)("span",{children:["Hybrid Bonus ",(0,s.jsx)(p.A,{min:0,max:2,step:.05,value:A.hybridBonus,onChange:e=>I(t=>({...t,hybridBonus:Number(null!=e?e:.35)}))})]})]})}),P&&(0,s.jsx)(c.A,{size:"small",title:"检索调试面板",children:(0,s.jsxs)(h.A,{size:"small",column:2,bordered:!0,children:[(0,s.jsx)(h.A.Item,{label:"原始查询",children:P.originalQuery}),(0,s.jsx)(h.A.Item,{label:"Reranker",children:P.reranker}),(0,s.jsx)(h.A.Item,{label:"查询改写",span:2,children:(0,s.jsx)(l.A,{wrap:!0,children:null==(e=P.rewrittenQueries)?void 0:e.map(e=>(0,s.jsx)(y.A,{children:e},e))})}),(0,s.jsx)(h.A.Item,{label:"召回数量",span:2,children:(0,s.jsx)(l.A,{wrap:!0,children:Object.entries(null!=(t=P.recallCounts)?t:{}).map(e=>{let[t,n]=e;return(0,s.jsxs)(y.A,{children:[t,": ",n]},t)})})}),(0,s.jsx)(h.A.Item,{label:"召回权重",span:2,children:(0,s.jsx)(l.A,{wrap:!0,children:Object.entries(null!=(n=P.weights)?n:{}).map(e=>{let[t,n]=e;return(0,s.jsxs)(y.A,{children:[t,": ",n]},t)})})})]})}),(0,s.jsxs)(c.A,{size:"small",title:"搜索结果",extra:"number"==typeof O?"".concat(O," ms"):void 0,children:[N?(0,s.jsx)(m.A,{type:"error",showIcon:!0,message:"搜索失败",description:N,className:"mb-4"}):null,x?(0,s.jsx)(f.A,{}):0===T.length?(0,s.jsx)(g.A,{description:"暂无结果"}):(0,s.jsx)("div",{className:w().searchResultList,children:T.map((e,t)=>{var n,o,i,c,d,u;return(0,s.jsxs)("div",{className:w().searchResultItem,children:[(0,s.jsxs)("div",{className:w().searchResultHeader,children:[(0,s.jsxs)(l.A,{size:8,wrap:!0,children:[(0,s.jsxs)(y.A,{children:["序号 ",t+1]}),(0,s.jsx)(y.A,{color:"hybrid"===e.source?"purple":"vector"===e.source?"blue":"green",children:null!=(u=e.source)?u:"keyword"}),(0,s.jsx)(y.A,{children:e.scope}),e.chunkKind&&(0,s.jsx)(y.A,{color:"geekblue",children:e.chunkKind}),e.rowRange&&(0,s.jsxs)(y.A,{color:"gold",children:["行 ",e.rowRange]}),e.sectionTitle&&(0,s.jsx)(y.A,{color:"cyan",children:e.sectionTitle})]}),(0,s.jsx)("strong",{children:_(e.score)})]}),(0,s.jsxs)("div",{className:w().statusPath,children:[(0,s.jsx)(r(),{href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(e.filePath)),children:e.filePath}),"number"==typeof e.chunkIndex?" #".concat(e.chunkIndex):""]}),(0,s.jsx)(v,{ellipsis:{rows:6,expandable:!0,symbol:"展开"},className:w().searchContent,children:function(e,t){let n=[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length);if(0===n.length)return e;let a=RegExp("(".concat(n.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(a).map((e,t)=>n.some(t=>t.toLowerCase()===e.toLowerCase())?(0,s.jsx)("mark",{children:e},t):e)}(e.content,a)}),e.facets&&Object.keys(e.facets).length>0&&(0,s.jsx)("div",{className:w().statusMeta,children:Object.entries(e.facets).slice(0,8).map(e=>{let[t,n]=e;return(0,s.jsxs)("span",{children:[t," ",(0,s.jsx)("b",{children:Array.isArray(n)?n.join(", "):String(n)})]},t)})}),(0,s.jsxs)("div",{className:w().statusMeta,children:[(0,s.jsxs)("span",{children:["keyword ",(0,s.jsx)("b",{children:_(null==(n=e.scoreDetails)?void 0:n.keywordScore)})]}),(0,s.jsxs)("span",{children:["bm25 ",(0,s.jsx)("b",{children:_(null==(o=e.scoreDetails)?void 0:o.bm25Score)})]}),(0,s.jsxs)("span",{children:["vector ",(0,s.jsx)("b",{children:_(null==(i=e.scoreDetails)?void 0:i.vectorScore)})]}),(0,s.jsxs)("span",{children:["rerank ",(0,s.jsx)("b",{children:_(null==(c=e.scoreDetails)?void 0:c.rerankBoost)})]}),(0,s.jsxs)("span",{children:["hybrid ",(0,s.jsx)("b",{children:_(null==(d=e.scoreDetails)?void 0:d.hybridScore)})]})]})]},e.id)})})]})]})}},6578:(e,t,n)=>{"use strict";async function s(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function a(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return s("/api/kb/stats".concat(t))}async function r(e){var t,n;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(n=e.limit)?n:50)),s("/api/kb/files?".concat(a))}async function o(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),s("/api/kb/files/detail?".concat(n))}async function i(e,t){return s("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function c(e,t,n){return s("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let s=new FileReader;s.onload=()=>{let e=s.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},s.onerror=n,s.readAsDataURL(e)})}async function d(e,t,n){return s("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return s("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t))}async function h(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t),{method:"DELETE"})}async function y(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function m(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return s("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function j(){return s("/api/kb/features")}async function b(e,t){var n,a,r,o,i;let c=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&c.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&c.set("category",t.category),(null==t?void 0:t.limit)&&c.set("limit",String(null!=(i=t.limit)?i:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(a=t.weights)?void 0:a.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(r=t.weights)?void 0:r.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(o=t.weights)?void 0:o.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),s("/api/kb/search?".concat(c))}async function x(){return s("/api/prompt")}async function w(e){return s("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function v(e){return s("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(e,t){return s("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function S(e){return s("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return s("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(){return s("/api/documents/specs")}async function O(e){return s("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return s("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(){return s("/api/documents/templates")}async function k(e){return s("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return s("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return s("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function A(e){return s("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function I(){return s("/api/documents/generated")}async function U(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)))}async function J(e,t){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function L(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function D(){return s("/api/assets/generated")}async function H(e){return s("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function B(e){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function z(e,t){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function V(e){return s("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function X(e,t){return s("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function F(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),n=t.headers.get("content-type")||"",s=async()=>{let e=await t.text(),n=e||"导出失败";try{var s;let t=JSON.parse(e),a=null==(s=t.issues)?void 0:s.map(e=>e.message).filter(Boolean).slice(0,3).join(";");n=a?"".concat(t.error||"导出失败",":").concat(a):t.error||n}catch(e){}throw Error(n.length>300?"".concat(n.slice(0,300),"..."):n)};return t.ok||await s(),"pdf"!==e.format||n.includes("application/pdf")||await s(),"docx"!==e.format||n.includes("officedocument.wordprocessingml.document")||await s(),t.blob()}async function M(){return s("/api/config/providers")}async function W(e,t){return s("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function K(e){return s("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function Q(){return s("/api/config/models")}async function q(e){return s("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Z(){return s("/api/config/embedding")}async function $(e){return s("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function G(){return s("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return s("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function ee(){return s("/api/system/stats")}async function et(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return s("/api/system/logs?limit=".concat(e))}async function en(){return s("/api/system/logs",{method:"DELETE"})}async function es(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return s("/api/context".concat(n))}async function ea(e){return s("/api/context?type=".concat(e,"&stats=1"))}async function er(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function eo(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ei(e){return s("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ec(e,t){return s("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function el(e){return s("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>X,Bh:()=>el,Dl:()=>P,E:()=>eo,EK:()=>O,ER:()=>E,FC:()=>ee,FV:()=>_,H1:()=>g,H7:()=>h,HC:()=>i,HT:()=>r,II:()=>Z,JU:()=>H,NR:()=>S,OX:()=>A,PH:()=>er,QG:()=>L,QT:()=>u,Qx:()=>p,R1:()=>V,SJ:()=>m,UE:()=>F,VW:()=>j,W2:()=>b,X8:()=>f,Z3:()=>M,_m:()=>W,a6:()=>J,aP:()=>q,bV:()=>R,bZ:()=>Y,c1:()=>d,cQ:()=>I,dd:()=>$,dg:()=>v,dw:()=>T,dx:()=>x,f$:()=>D,h0:()=>N,h1:()=>K,hH:()=>en,hc:()=>a,hn:()=>es,l2:()=>k,lv:()=>w,mx:()=>C,oH:()=>et,oS:()=>z,p:()=>ea,tn:()=>c,u6:()=>G,uc:()=>B,v7:()=>U,xC:()=>o,xq:()=>y,xw:()=>ei,zo:()=>ec,zr:()=>Q})},9208:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/search",function(){return n(4184)}])},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusPanel:"style_statusPanel__9arTu",statusPanelHeader:"style_statusPanelHeader__nKv1I",statusEmpty:"style_statusEmpty__8LWzH",statusList:"style_statusList__FpNgC",statusItem:"style_statusItem__uzO80",statusHeader:"style_statusHeader__o9q_b",statusDesc:"style_statusDesc__XiWFa",statusPath:"style_statusPath__Udxvv",statusMeta:"style_statusMeta__XukHt",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"}},60470:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var s=n(97109),a=n(838),r=n(88483);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}let i=s.forwardRef((e,t)=>s.createElement(r.A,o({},e,{ref:t,icon:a.A})))},63214:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"}},84190:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var s=n(97109),a=n(63214),r=n(88483);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}let i=s.forwardRef((e,t)=>s.createElement(r.A,o({},e,{ref:t,icon:a.A})))}},e=>{e.O(0,[4260,7167,9382,8628,7576,2700,5292,4020,9969,636,6593,8792],()=>e(e.s=9208)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4046],{69:(e,t)=>{"use strict";t.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,t,n)=>{"use strict";n.d(t,{A:()=>o});let o=n(25341).A},5450:(e,t)=>{"use strict";t.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"}},6578:(e,t,n)=>{"use strict";async function o(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function a(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function i(e){var t,n;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(a))}async function r(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function l(e,t){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function s(e,t,n){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function c(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await c(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function f(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function y(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function v(){return o("/api/kb/features")}async function b(e,t){var n,a,i,r,l;let s=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&s.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&s.set("category",t.category),(null==t?void 0:t.limit)&&s.set("limit",String(null!=(l=t.limit)?l:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&s.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(a=t.weights)?void 0:a.vector)!=null&&s.set("vectorWeight",String(t.weights.vector)),(null==t||null==(i=t.weights)?void 0:i.rewrite)!=null&&s.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(r=t.weights)?void 0:r.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function j(){return o("/api/prompt")}async function x(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function A(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function C(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function S(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function T(){return o("/api/documents/specs")}async function O(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function k(){return o("/api/documents/templates")}async function E(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function _(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function I(){return o("/api/documents/generated")}async function L(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function U(e,t){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function M(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function z(){return o("/api/assets/generated")}async function H(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function D(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function J(e,t){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function F(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function K(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function B(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),n=t.headers.get("content-type")||"",o=async()=>{let e=await t.text(),n=e||"导出失败";try{var o;let t=JSON.parse(e),a=null==(o=t.issues)?void 0:o.map(e=>e.message).filter(Boolean).slice(0,3).join(";");n=a?"".concat(t.error||"导出失败",":").concat(a):t.error||n}catch(e){}throw Error(n.length>300?"".concat(n.slice(0,300),"..."):n)};return t.ok||await o(),"pdf"!==e.format||n.includes("application/pdf")||await o(),"docx"!==e.format||n.includes("officedocument.wordprocessingml.document")||await o(),t.blob()}async function W(){return o("/api/config/providers")}async function V(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function $(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function G(){return o("/api/config/models")}async function X(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Q(){return o("/api/config/embedding")}async function Z(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function ee(){return o("/api/system/stats")}async function et(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return o("/api/system/logs?limit=".concat(e))}async function en(){return o("/api/system/logs",{method:"DELETE"})}async function eo(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function ea(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function ei(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function er(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function el(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function es(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ec(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>K,Bh:()=>ec,Dl:()=>k,E:()=>er,EK:()=>O,ER:()=>N,FC:()=>ee,FV:()=>w,H1:()=>g,H7:()=>m,HC:()=>l,HT:()=>i,II:()=>Q,JU:()=>H,NR:()=>C,OX:()=>_,PH:()=>ei,QG:()=>M,QT:()=>u,Qx:()=>p,R1:()=>F,SJ:()=>f,UE:()=>B,VW:()=>v,W2:()=>b,X8:()=>y,Z3:()=>W,_m:()=>V,a6:()=>U,aP:()=>X,bV:()=>R,bZ:()=>Y,c1:()=>d,cQ:()=>I,dd:()=>Z,dg:()=>A,dw:()=>S,dx:()=>j,f$:()=>z,h0:()=>P,h1:()=>$,hH:()=>en,hc:()=>a,hn:()=>eo,l2:()=>E,lv:()=>x,mx:()=>T,oH:()=>et,oS:()=>J,p:()=>ea,tn:()=>s,u6:()=>q,uc:()=>D,v7:()=>L,xC:()=>r,xq:()=>h,xw:()=>el,zo:()=>es,zr:()=>G})},10218:(e,t,n)=>{"use strict";n.d(t,{A:()=>y,H:()=>h});var o=n(97109),a=n(4932),i=n(42644);let r=e=>"object"==typeof e&&null!=e&&1===e.nodeType,l=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,s=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return l(n.overflowY,t)||l(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},c=(e,t,n,o,a,i,r,l)=>i<e&&r>t||i>e&&r<t?0:i<=e&&l<=n||r>=t&&l>=n?i-e-o:r>t&&l<n||i<e&&l>n?r-t+a:0,d=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},u=(e,t)=>{var n,o,a,i;if("undefined"==typeof document)return[];let{scrollMode:l,block:u,inline:p,boundary:m,skipOverflowHiddenElements:h}=t,f="function"==typeof m?m:e=>e!==m;if(!r(e))throw TypeError("Invalid target");let y=document.scrollingElement||document.documentElement,g=[],v=e;for(;r(v)&&f(v);){if((v=d(v))===y){g.push(v);break}null!=v&&v===document.body&&s(v)&&!s(document.documentElement)||null!=v&&s(v,h)&&g.push(v)}let b=null!=(o=null==(n=window.visualViewport)?void 0:n.width)?o:innerWidth,j=null!=(i=null==(a=window.visualViewport)?void 0:a.height)?i:innerHeight,{scrollX:x,scrollY:A}=window,{height:w,width:C,top:S,right:T,bottom:O,left:N}=e.getBoundingClientRect(),{top:k,right:E,bottom:P,left:R}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),_="start"===u||"nearest"===u?S-k:"end"===u?O+P:S+w/2-k+P,I="center"===p?N+C/2-R+E:"end"===p?T+E:N-R,L=[];for(let e=0;e<g.length;e++){let t=g[e],{height:n,width:o,top:a,right:i,bottom:r,left:d}=t.getBoundingClientRect();if("if-needed"===l&&S>=0&&N>=0&&O<=j&&T<=b&&(t===y&&!s(t)||S>=a&&O<=r&&N>=d&&T<=i))break;let m=getComputedStyle(t),h=parseInt(m.borderLeftWidth,10),f=parseInt(m.borderTopWidth,10),v=parseInt(m.borderRightWidth,10),k=parseInt(m.borderBottomWidth,10),E=0,P=0,R="offsetWidth"in t?t.offsetWidth-t.clientWidth-h-v:0,U="offsetHeight"in t?t.offsetHeight-t.clientHeight-f-k:0,M="offsetWidth"in t?0===t.offsetWidth?0:o/t.offsetWidth:0,z="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(y===t)E="start"===u?_:"end"===u?_-j:"nearest"===u?c(A,A+j,j,f,k,A+_,A+_+w,w):_-j/2,P="start"===p?I:"center"===p?I-b/2:"end"===p?I-b:c(x,x+b,b,h,v,x+I,x+I+C,C),E=Math.max(0,E+A),P=Math.max(0,P+x);else{E="start"===u?_-a-f:"end"===u?_-r+k+U:"nearest"===u?c(a,r,n,f,k+U,_,_+w,w):_-(a+n/2)+U/2,P="start"===p?I-d-h:"center"===p?I-(d+o/2)+R/2:"end"===p?I-i+v+R:c(d,i,o,h,v+R,I,I+C,C);let{scrollLeft:e,scrollTop:l}=t;E=0===z?0:Math.max(0,Math.min(l+E/z,t.scrollHeight-n/z+U)),P=0===M?0:Math.max(0,Math.min(e+P/M,t.scrollWidth-o/M+R)),_+=l-E,I+=e-P}L.push({el:t,top:E,left:P})}return L};var p=n(26047),m=n(44624);function h(e){return(0,m.$r)(e).join("_")}function f(e,t){let n=t.getFieldInstance(e),o=(0,i.rb)(n);if(o)return o;let a=(0,m.kV)((0,m.$r)(e),t.__INTERNAL__.name);if(a)return document.getElementById(a)}function y(e){let[t]=(0,a.mN)(),n=o.useRef({}),i=o.useMemo(()=>e??{...t,__INTERNAL__:{itemRef:e=>t=>{let o=h(e);t?n.current[o]=t:delete n.current[o]}},scrollToField:(e,t={})=>{let{focus:n,...o}=t,a=f(e,i);a&&(!function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let n=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(u(e,t));let o="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:a,top:i,left:r}of u(e,!1===t?{block:"end",inline:"nearest"}:t===Object(t)&&0!==Object.keys(t).length?t:{block:"start",inline:"nearest"})){let e=i-n.top+n.bottom,t=r-n.left+n.right;a.scroll({top:e,left:t,behavior:o})}}(a,{scrollMode:"if-needed",block:"nearest",...o}),n&&i.focusField(e))},focusField:e=>{let t=i.getFieldInstance(e);(0,p.Tn)(t?.focus)?t.focus():f(e,i)?.focus?.()},getFieldInstance:e=>{let t=h(e);return n.current[t]}},[e,t]);return[i]}},13114:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var o=n(97109),a=n(5450),i=n(88483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let l=o.forwardRef((e,t)=>o.createElement(i.A,r({},e,{ref:t,icon:a.A})))},15437:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});let o=e=>{let{componentCls:t,antCls:n,motionDurationMid:o,motionEaseInOut:a}=e;return{[t]:{[`${n}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`${["height","opacity"].map(e=>`${e} ${o} ${a}`).join(", ")} !important`}},[`${n}-motion-collapse`]:{overflow:"hidden",transition:`${["height","opacity"].map(e=>`${e} ${o} ${a}`).join(", ")} !important`}}}}},15527:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>J});var o=n(65321),a=n(97109),i=n(64209),r=n(17807),l=n(85114),s=n(68787),c=n(2256),d=n(38770),u=n(11702),p=n(33442),m=n(26171),h=n(85493),f=n(63455),y=n(57271),g=n(7576),v=n(94992),b=n(25258),j=n(56985),x=n(54746),A=n(29071),w=n(59188),C=n(4216),S=n(13114),T=n(99650),O=n(58209),N=n(69),k=n(88483);function E(){return(E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let P=a.forwardRef((e,t)=>a.createElement(k.A,E({},e,{ref:t,icon:N.A})));var R=n(30289);function _(){return(_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let I=a.forwardRef((e,t)=>a.createElement(k.A,_({},e,{ref:t,icon:R.A})));var L=n(6578),U=n(42323),M=n.n(U);let z=[{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"}],D=[{key:"imageGeneration",label:"图片生成"},{key:"imageUnderstanding",label:"图片理解"},{key:"fileUnderstanding",label:"文件理解"},{key:"audio",label:"音频能力"},{key:"video",label:"视频能力"}];function J(){let e=(0,i.Vr)(),{message:t}=r.A.useApp(),n=[{label:e("models.embeddingProviderHash"),value:"hash"},{label:e("models.embeddingProviderOpenAI"),value:"openai-compatible"}],[N,k]=(0,a.useState)(!0),[E,R]=(0,a.useState)([]),[_,U]=(0,a.useState)(null),[J,F]=(0,a.useState)({provider:"hash",dimensions:384}),[K,B]=(0,a.useState)(!1),[W,V]=(0,a.useState)(!1),[$,G]=(0,a.useState)(null),[X,Q]=(0,a.useState)(!1),[Z,q]=(0,a.useState)(""),[Y,ee]=(0,a.useState)(""),[et,en]=(0,a.useState)(""),[eo,ea]=(0,a.useState)("openai"),[ei,er]=(0,a.useState)(!1),[el,es]=(0,a.useState)({}),[ec,ed]=(0,a.useState)(!1),[eu,ep]=(0,a.useState)(!1),[em,eh]=(0,a.useState)(""),[ef,ey]=(0,a.useState)(""),[eg,ev]=(0,a.useState)(""),[eb,ej]=(0,a.useState)(""),[ex,eA]=(0,a.useState)("openai"),[ew,eC]=(0,a.useState)(!1),[eS,eT]=(0,a.useState)({}),[eO,eN]=(0,a.useState)(!1),[ek,eE]=(0,a.useState)(null),[eP,eR]=(0,a.useState)({}),e_=async()=>{k(!0);try{let[e,t,n]=await Promise.all([(0,L.Z3)().catch(()=>[]),(0,L.zr)().catch(()=>null),(0,L.II)().catch(()=>({provider:"hash",dimensions:384}))]);R(e),U(t),F(n)}catch(n){t.error(e("common.error"))}finally{k(!1)}};(0,a.useEffect)(()=>{e_()},[]);let eI=async()=>{if(Z.trim()){ed(!0);try{await (0,L._m)(Z.trim(),{apiKey:Y||void 0,baseUrl:et||void 0,protocol:eo,directEndpoint:ei,capabilities:el}),Q(!1),q(""),ee(""),en(""),ea("openai"),er(!1),es({}),await e_(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{ed(!1)}}},eL=async n=>{try{await (0,L.h1)(n),await e_(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}},eU=async e=>{eh(e.name),ey(e.name),ev("");try{let t=await (0,L.Bh)(e.name);ev(t.apiKey?"••••••••":""),ej(t.baseUrl||""),eA(t.protocol||t.detectedProtocol||"openai"),eT(t.capabilities||{})}catch(t){ej(e.baseUrl||""),eA(e.protocol||e.detectedProtocol||"openai"),eT(e.capabilities||{})}ep(!0)},eM=async()=>{if(ef.trim()){eN(!0);try{let n=eg.includes("•")?void 0:eg||void 0;await (0,L._m)(ef.trim(),{oldName:em,apiKey:n,baseUrl:eb||void 0,protocol:ex,directEndpoint:ew,capabilities:eS}),ep(!1),eh(""),ey(""),ev(""),ej(""),eA("openai"),eC(!1),eT({}),await e_(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{eN(!1)}}},ez=async n=>{eE(n);try{let o=await (0,L.bZ)(n);eR(e=>({...e,[n]:o.success})),t[o.success?"success":"error"](o.success?e("models.connected"):e("models.connectionFailed"))}catch(e){eR(e=>({...e,[n]:!1}))}finally{eE(null)}},eH=async()=>{B(!0);try{let n=await (0,L.dd)(J);F(n),G(null),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{B(!1)}},eD=async()=>{V(!0);try{let n=await (0,L.u6)();G(n.success),t[n.success?"success":"error"](n.message||(n.success?e("models.connected"):e("models.connectionFailed")))}catch(n){G(!1),t.error(e("common.error"))}finally{V(!1)}},eJ=async(n,o)=>{if(!_)return;let a={..._},i=a[n];if(!o){i.active="",U(a);try{await (0,L.aP)(a)}catch(n){t.error(e("common.error"))}return}let r=o.indexOf(":"),l=r>=0?o.slice(0,r):o,s=r>=0?o.slice(r+1):o;i.active=s,i.list.some(e=>e.name===s&&e.provider===l)||i.list.push({name:s,provider:l}),U(a);try{await (0,L.aP)(a)}catch(n){t.error(e("common.error"))}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("models.title")}),(0,o.jsx)("p",{className:"pageDesc",children:e("models.description")})]}),(0,o.jsx)(l.Ay,{type:"primary",icon:(0,o.jsx)(x.A,{}),onClick:()=>Q(!0),children:e("models.addModel")})]}),(0,o.jsx)(s.A,{title:e("models.modelList"),size:"small",loading:N,children:0===E.length?(0,o.jsx)("span",{className:M().cardMeta,children:e("models.noProviders")}):(0,o.jsx)(c.A,{gutter:[12,12],align:"stretch",children:E.map((t,n)=>(0,o.jsx)(d.A,{xs:24,sm:12,lg:8,xl:6,className:M().providerGrid,children:(0,o.jsxs)(s.A,{size:"small",className:M().providerCard,children:[(0,o.jsxs)("div",{className:M().cardAction,children:[(0,o.jsxs)("div",{className:M().cardMain,children:[(0,o.jsxs)("div",{className:M().cardName,title:t.name,children:[(0,o.jsxs)(u.A,{children:["序号 ",n+1]}),t.name]}),(0,o.jsxs)("div",{className:M().cardMeta,children:[(0,o.jsx)(A.A,{})," ",t.protocol||t.detectedProtocol||"openai"]})]}),(0,o.jsxs)(p.A,{size:2,wrap:!1,children:[(0,o.jsx)(l.Ay,{size:"small",type:"text",loading:ek===t.name,onClick:()=>{ez(t.name)},icon:!0===eP[t.name]?(0,o.jsx)(w.A,{className:"text-[var(--colorOk)]"}):!1===eP[t.name]?(0,o.jsx)(C.A,{className:"text-[var(--colorDanger)]"}):(0,o.jsx)(S.A,{})}),(0,o.jsx)(l.Ay,{size:"small",type:"text",icon:(0,o.jsx)(T.A,{}),onClick:()=>{eU(t)}}),(0,o.jsx)(m.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{eL(t.name)},children:(0,o.jsx)(l.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(O.A,{})})})]})]}),(0,o.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,o.jsxs)("span",{className:"".concat(M().cardMeta," text-xs"),children:[(0,o.jsx)(P,{})," ",t.hasApiKey?"••••••••":"—"]}),t.baseUrl&&(0,o.jsxs)("span",{className:"".concat(M().cardMeta," ").concat(M().urlLine," text-xs"),title:t.baseUrl,children:[(0,o.jsx)(I,{})," ",t.baseUrl]}),(0,o.jsx)(p.A,{size:[4,4],wrap:!0,children:D.filter(e=>{var n;return null==(n=t.capabilities)?void 0:n[e.key]}).map(e=>(0,o.jsx)(u.A,{color:"purple",children:e.label},e.key))})]})]})},t.name))})}),(0,o.jsxs)(s.A,{title:e("models.embeddingConfig"),size:"small",loading:N,children:[(0,o.jsx)(h.A,{className:"mb-4",type:"info",showIcon:!0,message:e("models.embeddingHint")}),(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsxs)(c.A,{gutter:[12,12],children:[(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.embeddingProvider"),children:(0,o.jsx)(y.A,{value:J.provider,options:n,onChange:e=>F(t=>({...t,provider:e,dimensions:"hash"===e?384:t.dimensions||1024}))})})}),"openai-compatible"===J.provider&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:"Base URL",children:(0,o.jsx)(g.A,{value:J.baseUrl,onChange:e=>F(t=>({...t,baseUrl:e.target.value})),placeholder:"http://localhost:11434/v1"})})}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.model"),children:(0,o.jsx)(g.A,{value:J.model,onChange:e=>F(t=>({...t,model:e.target.value})),placeholder:"bge-m3"})})}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.apiKey"),help:J.hasApiKey?e("models.embeddingApiKeyHint"):void 0,children:(0,o.jsx)(g.A.Password,{value:J.apiKey,onFocus:()=>{var e;(null==(e=J.apiKey)?void 0:e.includes("•"))&&F(e=>({...e,apiKey:""}))},onChange:e=>F(t=>({...t,apiKey:e.target.value})),placeholder:e("models.optional")})})})]}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.dimensions"),children:(0,o.jsx)(v.A,{className:"w-full",min:1,value:J.dimensions,onChange:e=>F(t=>({...t,dimensions:Number(e||("hash"===t.provider?384:1024))}))})})}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.status"),children:(0,o.jsxs)(p.A,{children:[(0,o.jsx)(u.A,{color:"hash"===J.provider?"default":"blue",children:"hash"===J.provider?e("models.localHash"):e("models.openAICompatible")}),!0===$&&(0,o.jsx)(u.A,{color:"success",children:e("models.connected")}),!1===$&&(0,o.jsx)(u.A,{color:"error",children:e("models.connectionFailed")})]})})})]}),(0,o.jsxs)(p.A,{children:[(0,o.jsx)(l.Ay,{type:"primary",loading:K,onClick:()=>{eH()},children:e("models.saveEmbedding")}),(0,o.jsx)(l.Ay,{icon:(0,o.jsx)(S.A,{}),loading:W,onClick:()=>{eD()},children:e("models.testEmbedding")})]})]})]}),_&&(0,o.jsx)(s.A,{title:e("models.modelTiers"),size:"small",children:(0,o.jsx)(c.A,{gutter:[12,12],children:H.map(n=>{var a;let{key:i,labelKey:r,descKey:l}=n,c=_[i],p=c.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),m=E.filter(e=>!c.list.some(t=>t.provider===e.name)).map(e=>({label:"".concat(e.name," / ").concat(e.name),value:"".concat(e.name,":").concat(e.name)}));return(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsxs)(s.A,{size:"small",title:e(r),children:[(0,o.jsx)("span",{className:M().tierDesc,children:e(l)}),(0,o.jsx)(y.A,{value:c.active?"".concat((null==(a=c.list.find(e=>e.name===c.active))?void 0:a.provider)||"",":").concat(c.active):void 0,onChange:e=>{eJ(i,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),className:"w-full",options:[...p,...m]}),c.list.length>0&&(0,o.jsx)("div",{className:M().modelTags,children:c.list.map(n=>(0,o.jsxs)(u.A,{color:n.name===c.active?"blue":void 0,closable:!0,onClose:()=>{var o,a;let r={..._},l=r[i];l.list=l.list.filter(e=>e.name!==n.name||e.provider!==n.provider),l.active===n.name&&(l.active=null!=(a=null==(o=l.list[0])?void 0:o.name)?a:""),U(r),(0,L.aP)(r).catch(()=>t.error(e("common.error")))},children:[n.provider,"/",n.name]},"".concat(n.provider,":").concat(n.name)))})]})},i)})})}),(0,o.jsx)(b.A,{maskClosable:!1,title:e("models.addModel"),open:X,onCancel:()=>{Q(!1),q(""),ee(""),en(""),ea("openai"),er(!1)},onOk:()=>{eI()},confirmLoading:ec,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("models.modelName"),children:(0,o.jsx)(g.A,{value:Z,onChange:e=>q(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,o.jsx)(f.A.Item,{label:e("models.apiKey"),children:(0,o.jsx)(g.A.Password,{value:Y,onChange:e=>ee(e.target.value),placeholder:"sk-..."})}),(0,o.jsx)(f.A.Item,{label:e("models.baseUrl"),children:(0,o.jsx)(g.A,{value:et,onChange:e=>en(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,o.jsx)(f.A.Item,{label:e("models.protocol"),children:(0,o.jsx)(y.A,{value:eo,onChange:ea,options:z})}),(0,o.jsx)(f.A.Item,{label:"直连端点",tooltip:"开启后 Base URL 会作为完整请求地址使用,不再自动拼接接口路径。",children:(0,o.jsx)(j.A,{checked:ei,onChange:e=>er(e.target.checked),children:"Base URL 是完整接口地址"})}),(0,o.jsx)(f.A.Item,{label:"多模态能力",children:(0,o.jsx)(j.A.Group,{value:D.filter(e=>el[e.key]).map(e=>e.key),options:D.map(e=>({label:e.label,value:e.key})),onChange:e=>es(Object.fromEntries(D.map(t=>[t.key,e.includes(t.key)])))})})]})}),(0,o.jsx)(b.A,{maskClosable:!1,title:e("models.editModel"),open:eu,onCancel:()=>{ep(!1),eh(""),ey(""),ev(""),ej(""),eA("openai"),eC(!1)},onOk:()=>{eM()},confirmLoading:eO,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("models.modelName"),children:(0,o.jsx)(g.A,{value:ef,onChange:e=>ey(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,o.jsx)(f.A.Item,{label:e("models.apiKey"),help:e("models.apiKeyEditHint"),children:(0,o.jsx)(g.A.Password,{value:eg,onFocus:()=>{eg.includes("•")&&ev("")},onCopy:e=>e.preventDefault(),onChange:e=>ev(e.target.value),placeholder:e("models.apiKeyEditPlaceholder")})}),(0,o.jsx)(f.A.Item,{label:e("models.baseUrl"),children:(0,o.jsx)(g.A,{value:eb,onChange:e=>ej(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,o.jsx)(f.A.Item,{label:e("models.protocol"),children:(0,o.jsx)(y.A,{value:ex,onChange:eA,options:z})}),(0,o.jsx)(f.A.Item,{label:"直连端点",tooltip:"开启后 Base URL 会作为完整请求地址使用,不再自动拼接接口路径。",children:(0,o.jsx)(j.A,{checked:ew,onChange:e=>eC(e.target.checked),children:"Base URL 是完整接口地址"})}),(0,o.jsx)(f.A.Item,{label:"多模态能力",children:(0,o.jsx)(j.A.Group,{value:D.filter(e=>eS[e.key]).map(e=>e.key),options:D.map(e=>({label:e.label,value:e.key})),onChange:e=>eT(Object.fromEntries(D.map(t=>[t.key,e.includes(t.key)])))})})]})})]})}},29071:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var o=n(97109),a=n(78847),i=n(88483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let l=o.forwardRef((e,t)=>o.createElement(i.A,r({},e,{ref:t,icon:a.A})))},30289:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"}},38770:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});let o=n(51916).A},42323:e=>{e.exports={cardMeta:"style_cardMeta__6KOa3",cardName:"style_cardName__WcLAf",cardAction:"style_cardAction__XUfPD",cardMain:"style_cardMain__qI1jU",providerCard:"style_providerCard__tLKGs",providerGrid:"style_providerGrid__Gx5GR",urlLine:"style_urlLine__DuMYs",tierDesc:"style_tierDesc__wOd6p",modelTags:"style_modelTags__nmMVj"}},44624:(e,t,n)=>{"use strict";n.d(t,{$r:()=>a,BS:()=>r,kV:()=>i});let o=["parentNode"];function a(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function i(e,t){if(!e.length)return;let n=e.join("_");return t?`${t}_${n}`:o.includes(n)?`form_item_${n}`:n}function r(e,t,n,o,a,i){let r=o;return void 0!==i?r=i:n.validating?r="validating":e.length?r="error":t.length?r="warning":(n.touched||a&&n.validated)&&(r="success"),r}},77305:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return n(15527)}])},78847:(e,t)=>{"use strict";t.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"}}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,4696,6985,288,4020,636,6593,8792],()=>e(e.s=77305)),_N_E=e.O()}]);