@customize-agent/server 4.0.94 → 4.0.95

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 (93) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +25 -57
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/routes-manifest.json +0 -12
  5. package/.next/server/chunks/1936.js +2 -2
  6. package/.next/server/chunks/5840.js +1 -0
  7. package/.next/server/chunks/6041.js +176 -0
  8. package/.next/server/chunks/8204.js +1 -1
  9. package/.next/server/chunks/8661.js +1 -1
  10. package/.next/server/middleware-build-manifest.js +1 -1
  11. package/.next/server/pages/404.html +1 -1
  12. package/.next/server/pages/500.html +1 -1
  13. package/.next/server/pages/api/assets/generated/preview.js +1 -1
  14. package/.next/server/pages/api/assets/generated/preview.js.nft.json +1 -1
  15. package/.next/server/pages/api/assets/generated.js +1 -1
  16. package/.next/server/pages/api/assets/generated.js.nft.json +1 -1
  17. package/.next/server/pages/api/config/web-access.js +1 -0
  18. package/.next/server/pages/api/config/web-access.js.nft.json +1 -0
  19. package/.next/server/pages/api/documents/chapter/regenerate.js +1 -1
  20. package/.next/server/pages/api/documents/chapter/regenerate.js.nft.json +1 -1
  21. package/.next/server/pages/api/documents/export.js +1 -1
  22. package/.next/server/pages/api/documents/export.js.nft.json +1 -1
  23. package/.next/server/pages/api/documents/generate.js +2 -2
  24. package/.next/server/pages/api/documents/generate.js.nft.json +1 -1
  25. package/.next/server/pages/api/documents/generated/[id].js +1 -1
  26. package/.next/server/pages/api/documents/generated/[id].js.nft.json +1 -1
  27. package/.next/server/pages/api/documents/generated.js +1 -1
  28. package/.next/server/pages/api/documents/generated.js.nft.json +1 -1
  29. package/.next/server/pages/api/documents/roles.js +1 -1
  30. package/.next/server/pages/api/documents/roles.js.nft.json +1 -1
  31. package/.next/server/pages/api/documents/templates.js +1 -1
  32. package/.next/server/pages/api/documents/templates.js.nft.json +1 -1
  33. package/.next/server/pages/asset-library.html +1 -1
  34. package/.next/server/pages/document-roles.html +1 -1
  35. package/.next/server/pages/documents.html +1 -1
  36. package/.next/server/pages/guide.html +1 -1
  37. package/.next/server/pages/index.html +1 -1
  38. package/.next/server/pages/knowledge/file-detail.html +1 -1
  39. package/.next/server/pages/knowledge/files.html +1 -1
  40. package/.next/server/pages/knowledge/manage.html +1 -1
  41. package/.next/server/pages/knowledge/search.html +1 -1
  42. package/.next/server/pages/knowledge.html +1 -1
  43. package/.next/server/pages/models.html +1 -1
  44. package/.next/server/pages/overview.html +1 -1
  45. package/.next/server/pages/prompt.html +1 -1
  46. package/.next/server/pages/settings.html +1 -1
  47. package/.next/server/pages/system/logs.html +1 -1
  48. package/.next/server/pages-manifest.json +25 -27
  49. package/.next/static/3nHhxjRVb6Sv1RCvTTJ6o/_buildManifest.js +1 -0
  50. package/.next/static/chunks/192-dee7faefaf840b17.js +1 -0
  51. package/.next/static/chunks/238-4ad320af4f787bd6.js +1 -0
  52. package/.next/static/chunks/405-74ecbacd0b5a3128.js +8 -0
  53. package/.next/static/chunks/621-1c48b0d6d904f023.js +4 -0
  54. package/.next/static/chunks/{795-d8fb7a0420512701.js → 795-e8cfd56df2293576.js} +1 -1
  55. package/.next/static/chunks/{455-97ad88d6604f54b7.js → 797-9166f495bb6138e3.js} +1 -1
  56. package/.next/static/chunks/pages/{_app-e1434faf3490a025.js → _app-d0d7f3a02373fa7e.js} +14 -14
  57. package/.next/static/chunks/pages/{asset-library-37f844cb358f5457.js → asset-library-c744f6c91b24629f.js} +1 -1
  58. package/.next/static/chunks/pages/{document-roles-6134d2d3284a530a.js → document-roles-5108efe16c9b0dd0.js} +1 -1
  59. package/.next/static/chunks/pages/documents-1fad70e8cff2eff9.js +1 -0
  60. package/.next/static/chunks/pages/guide-e00b6e23a8dd41b3.js +1 -0
  61. package/.next/static/chunks/pages/knowledge/{file-detail-87669392540614e4.js → file-detail-44e52d9e351e8784.js} +1 -1
  62. package/.next/static/chunks/pages/knowledge/{files-14ef1012fd201e47.js → files-4f7bacb11528982e.js} +1 -1
  63. package/.next/static/chunks/pages/knowledge/{manage-ed99a6cb254ddbb7.js → manage-205647551376b193.js} +1 -1
  64. package/.next/static/chunks/pages/knowledge/{search-afb423fc22eb623b.js → search-577f08171a786578.js} +1 -1
  65. package/.next/static/chunks/pages/models-47a9542ac5bec5c0.js +1 -0
  66. package/.next/static/chunks/pages/{prompt-9b869fbe3463020d.js → prompt-aad4329e419fb442.js} +1 -1
  67. package/.next/static/chunks/pages/{settings-fa9d6a56898ba678.js → settings-78d0d5322fd61afe.js} +1 -1
  68. package/.next/static/chunks/pages/system/{logs-cbeeb77dc70086ae.js → logs-c97311a24d1a67e1.js} +1 -1
  69. package/messages/en-US.json +0 -16
  70. package/messages/zh-CN.json +0 -16
  71. package/package.json +8 -4
  72. package/scripts/start-server.cjs +79 -0
  73. package/scripts/upload-matrix.cjs +258 -0
  74. package/.next/server/chunks/7111.js +0 -182
  75. package/.next/server/chunks/7899.js +0 -1
  76. package/.next/server/pages/api/context.js +0 -11
  77. package/.next/server/pages/api/context.js.nft.json +0 -1
  78. package/.next/server/pages/context/long-term.html +0 -1
  79. package/.next/server/pages/context/long-term.js.nft.json +0 -1
  80. package/.next/server/pages/context/short-term.html +0 -1
  81. package/.next/server/pages/context/short-term.js.nft.json +0 -1
  82. package/.next/static/4gglXEsvX5p_wlAU1zB1F/_buildManifest.js +0 -1
  83. package/.next/static/chunks/466-1cd359f130473697.js +0 -1
  84. package/.next/static/chunks/63-dd8eeb8edd766bae.js +0 -4
  85. package/.next/static/chunks/642-708b928fbafc6c20.js +0 -8
  86. package/.next/static/chunks/647-d5e08fda405f7059.js +0 -1
  87. package/.next/static/chunks/932-2f195f4200ce9378.js +0 -1
  88. package/.next/static/chunks/pages/context/long-term-29cbf51a281951d9.js +0 -1
  89. package/.next/static/chunks/pages/context/short-term-fcae99e1744d998a.js +0 -1
  90. package/.next/static/chunks/pages/documents-aa14e6ec02784787.js +0 -1
  91. package/.next/static/chunks/pages/guide-c00be7803483b703.js +0 -1
  92. package/.next/static/chunks/pages/models-e2914678369d2823.js +0 -1
  93. /package/.next/static/{4gglXEsvX5p_wlAU1zB1F → 3nHhxjRVb6Sv1RCvTTJ6o}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[958],{63806:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>_});var n=i(65321),l=i(97109),o=i(17807),a=i(25258),r=i(88762),s=i(2256),c=i(38770),d=i(68787),p=i(33442),h=i(85114),x=i(84253),g=i(71102),y=i(384),f=i(11702),m=i(58209),u=i(93051),j=i(81668),v=i(64254),w=i(85855),A=i(75548),b=i(56768),k=i(79059),S=i(6578);let z={knowledge_base:"知识库",generated:"AI生成",uploaded:"上传",external_url:"外部URL"},C={cover:"magenta",reference:"blue",generated:"purple",attachment:"cyan",map:"orange",operator:"geekblue"};function _(){let e=(0,k.Vr)(),{message:t}=o.A.useApp(),[i,_]=(0,l.useState)([]),[I,R]=(0,l.useState)(new Set),[N,T]=(0,l.useState)(!0),[E,F]=(0,l.useState)(""),P=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:E;try{_((await (0,S.f$)(e||void 0)).assets)}catch(e){_([])}};(0,l.useEffect)(()=>{let e=!1;return T(!0),(0,S.dx)().then(t=>{var i,n,l;if(e)return;let o=(null==(i=t.find(e=>e.selected))?void 0:i.projectRoot)||(null==(n=t.find(e=>e.isCurrent))?void 0:n.projectRoot)||(null==(l=t[0])?void 0:l.projectRoot)||"";return F(o),P(o)}).finally(()=>{e||T(!1)}),()=>{e=!0}},[]);let B=async e=>{var i;e&&(await (null==(i=navigator.clipboard)?void 0:i.writeText(e)),t.success("已复制路径"))},D=async(e,i)=>{try{"openFile"===i?await (0,S.oS)(e,"file",E||void 0):"openDirectory"===i?await (0,S.oS)(e,"directory",E||void 0):"delete"===i&&(_((await (0,S.JU)(e,E||void 0)).assets),R(t=>{let i=new Set(t);return i.delete(e),i}))}catch(e){t.error(e instanceof Error?e.message:"操作失败")}},W=n=>{let l="selected"===n?[...I]:i.map(e=>e.id);0!==l.length&&a.A.confirm({title:"all"===n?"删除全部资源?":"删除已选 ".concat(l.length," 个资源?"),content:"此操作不可撤销。",okText:e("common.confirm"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{T(!0);try{await Promise.all(l.map(e=>(0,S.JU)(e,E||void 0))),await P(),R(new Set),t.success("已删除 ".concat(l.length," 个资源"))}catch(e){t.error("批量删除失败")}finally{T(!1)}}})},O=e=>{R(t=>{let i=new Set(t);return i.has(e)?i.delete(e):i.add(e),i})};return N?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(r.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,n.jsx)(s.A,{gutter:[12,12],children:Array.from({length:6}).map((e,t)=>(0,n.jsx)(c.A,{xs:24,sm:12,md:8,xl:6,children:(0,n.jsx)(d.A,{size:"small",children:(0,n.jsx)(r.A,{active:!0,paragraph:{rows:3}})})},t))})]}):(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:e("nav.assetLibrary")}),(0,n.jsx)("p",{className:"pageDesc",children:"管理模板运行生成的文档、图片和附件。生成结果仅保存在生成资源中,不进入知识库。"})]}),(0,n.jsxs)(p.A,{size:8,children:[(0,n.jsxs)("span",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["共 ",i.length," 个资源"]}),(0,n.jsxs)(h.Ay,{danger:!0,size:"small",disabled:0===I.size,icon:(0,n.jsx)(m.A,{}),onClick:()=>W("selected"),children:["删除已选 ",I.size||""]}),(0,n.jsx)(h.Ay,{danger:!0,size:"small",disabled:0===i.length,onClick:()=>W("all"),children:"删除全部"})]})]}),0===i.length?(0,n.jsx)(x.A,{description:"暂无生成资源"}):(0,n.jsx)(s.A,{gutter:[12,12],children:i.map((t,i)=>{let l="image"===t.type&&t.path?"/api/assets/generated/preview?id=".concat(encodeURIComponent(t.id)).concat(E?"&projectRoot=".concat(encodeURIComponent(E)):""):void 0,o=I.has(t.id),a=[...t.path?[{key:"copy",icon:(0,n.jsx)(u.A,{}),label:"复制路径",onClick:()=>{B(t.path)}}]:[],...t.path?[{key:"open",icon:(0,n.jsx)(j.A,{}),label:"打开文件",onClick:()=>{D(t.id,"openFile")}}]:[],...t.path?[{key:"folder",icon:(0,n.jsx)(v.A,{}),label:"打开目录",onClick:()=>{D(t.id,"openDirectory")}}]:[],{type:"divider"},{key:"delete",icon:(0,n.jsx)(m.A,{}),label:e("common.delete"),danger:!0,onClick:()=>{D(t.id,"delete")}}];return(0,n.jsx)(c.A,{xs:24,sm:12,md:8,xl:6,children:(0,n.jsxs)(d.A,{size:"small",hoverable:!0,styles:{body:{padding:12}},style:{border:o?"2px solid #1677ff":void 0,cursor:"pointer",position:"relative"},onClick:()=>O(t.id),children:[(0,n.jsx)("div",{onClick:e=>{e.stopPropagation(),O(t.id)},style:{position:"absolute",top:8,left:8,zIndex:2,width:22,height:22,borderRadius:5,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.15s",background:o?"#1677ff":"rgba(0,0,0,0.6)",color:"#fff",fontSize:12,fontWeight:700},children:o?"✓":""}),(0,n.jsx)(g.A,{menu:{items:a},trigger:["click"],placement:"bottomRight",children:(0,n.jsx)(h.Ay,{type:"text",size:"small",icon:(0,n.jsx)(w.A,{}),style:{position:"absolute",top:6,right:6,zIndex:2,width:24,height:24,padding:0,background:"var(--colorBgContainer)",borderRadius:6,boxShadow:"0 1px 3px rgba(0,0,0,0.08)"},onClick:e=>e.stopPropagation()})}),l&&(0,n.jsx)("div",{style:{margin:"-12px -12px 10px -12px",borderRadius:"10px 10px 0 0",overflow:"hidden",height:140,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--colorFillAlter)"},children:(0,n.jsx)(y.A,{src:l,alt:t.name,style:{width:"100%",height:"100%",objectFit:"cover"},onClick:e=>e.stopPropagation()})}),(0,n.jsx)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,marginBottom:6},children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,flex:1},children:[!l&&("image"===t.type?(0,n.jsx)(A.A,{style:{color:"var(--colorWarning)",fontSize:15,flexShrink:0}}):(0,n.jsx)(b.A,{style:{color:"var(--colorAccent)",fontSize:15,flexShrink:0}})),(0,n.jsx)("span",{style:{fontWeight:600,fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name})]})}),(0,n.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:[(0,n.jsx)(f.A,{color:C[t.role]||"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:t.role}),(0,n.jsx)(f.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:t.type})]}),(0,n.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",lineHeight:1.5,marginBottom:6},children:[t.path&&(0,n.jsx)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:11},children:t.path}),(0,n.jsxs)("div",{children:[z[t.source]||t.source," \xb7 ",t.usedByDocumentIds.length," 个文档 \xb7 ",new Date(t.updatedAt).toLocaleDateString()]})]})]})},t.id)})})]})}},85015:(e,t,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/asset-library",function(){return i(63806)}])}},e=>{e.O(0,[433,787,102,767,636,593,792],()=>e(e.s=85015)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[958],{63806:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>_});var n=i(65321),l=i(97109),o=i(17807),a=i(25258),r=i(88762),s=i(2256),c=i(38770),d=i(68787),p=i(33442),h=i(85114),x=i(84253),g=i(71102),y=i(384),f=i(11702),m=i(58209),u=i(93051),j=i(81668),v=i(64254),w=i(85855),A=i(75548),b=i(56768),k=i(44494),S=i(6578);let z={knowledge_base:"知识库",generated:"AI生成",uploaded:"上传",external_url:"外部URL"},C={cover:"magenta",reference:"blue",generated:"purple",attachment:"cyan",map:"orange",operator:"geekblue"};function _(){let e=(0,k.Vr)(),{message:t}=o.A.useApp(),[i,_]=(0,l.useState)([]),[I,R]=(0,l.useState)(new Set),[N,T]=(0,l.useState)(!0),[E,F]=(0,l.useState)(""),P=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:E;try{_((await (0,S.f$)(e||void 0)).assets)}catch(e){_([])}};(0,l.useEffect)(()=>{let e=!1;return T(!0),(0,S.dx)().then(t=>{var i,n,l;if(e)return;let o=(null==(i=t.find(e=>e.selected))?void 0:i.projectRoot)||(null==(n=t.find(e=>e.isCurrent))?void 0:n.projectRoot)||(null==(l=t[0])?void 0:l.projectRoot)||"";return F(o),P(o)}).finally(()=>{e||T(!1)}),()=>{e=!0}},[]);let B=async e=>{var i;e&&(await (null==(i=navigator.clipboard)?void 0:i.writeText(e)),t.success("已复制路径"))},D=async(e,i)=>{try{"openFile"===i?await (0,S.oS)(e,"file",E||void 0):"openDirectory"===i?await (0,S.oS)(e,"directory",E||void 0):"delete"===i&&(_((await (0,S.JU)(e,E||void 0)).assets),R(t=>{let i=new Set(t);return i.delete(e),i}))}catch(e){t.error(e instanceof Error?e.message:"操作失败")}},W=n=>{let l="selected"===n?[...I]:i.map(e=>e.id);0!==l.length&&a.A.confirm({title:"all"===n?"删除全部资源?":"删除已选 ".concat(l.length," 个资源?"),content:"此操作不可撤销。",okText:e("common.confirm"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{T(!0);try{await Promise.all(l.map(e=>(0,S.JU)(e,E||void 0))),await P(),R(new Set),t.success("已删除 ".concat(l.length," 个资源"))}catch(e){t.error("批量删除失败")}finally{T(!1)}}})},O=e=>{R(t=>{let i=new Set(t);return i.has(e)?i.delete(e):i.add(e),i})};return N?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(r.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,n.jsx)(s.A,{gutter:[12,12],children:Array.from({length:6}).map((e,t)=>(0,n.jsx)(c.A,{xs:24,sm:12,md:8,xl:6,children:(0,n.jsx)(d.A,{size:"small",children:(0,n.jsx)(r.A,{active:!0,paragraph:{rows:3}})})},t))})]}):(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:e("nav.assetLibrary")}),(0,n.jsx)("p",{className:"pageDesc",children:"管理模板运行生成的文档、图片和附件。生成结果仅保存在生成资源中,不进入知识库。"})]}),(0,n.jsxs)(p.A,{size:8,children:[(0,n.jsxs)("span",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["共 ",i.length," 个资源"]}),(0,n.jsxs)(h.Ay,{danger:!0,size:"small",disabled:0===I.size,icon:(0,n.jsx)(m.A,{}),onClick:()=>W("selected"),children:["删除已选 ",I.size||""]}),(0,n.jsx)(h.Ay,{danger:!0,size:"small",disabled:0===i.length,onClick:()=>W("all"),children:"删除全部"})]})]}),0===i.length?(0,n.jsx)(x.A,{description:"暂无生成资源"}):(0,n.jsx)(s.A,{gutter:[12,12],children:i.map((t,i)=>{let l="image"===t.type&&t.path?"/api/assets/generated/preview?id=".concat(encodeURIComponent(t.id)).concat(E?"&projectRoot=".concat(encodeURIComponent(E)):""):void 0,o=I.has(t.id),a=[...t.path?[{key:"copy",icon:(0,n.jsx)(u.A,{}),label:"复制路径",onClick:()=>{B(t.path)}}]:[],...t.path?[{key:"open",icon:(0,n.jsx)(j.A,{}),label:"打开文件",onClick:()=>{D(t.id,"openFile")}}]:[],...t.path?[{key:"folder",icon:(0,n.jsx)(v.A,{}),label:"打开目录",onClick:()=>{D(t.id,"openDirectory")}}]:[],{type:"divider"},{key:"delete",icon:(0,n.jsx)(m.A,{}),label:e("common.delete"),danger:!0,onClick:()=>{D(t.id,"delete")}}];return(0,n.jsx)(c.A,{xs:24,sm:12,md:8,xl:6,children:(0,n.jsxs)(d.A,{size:"small",hoverable:!0,styles:{body:{padding:12}},style:{border:o?"2px solid #1677ff":void 0,cursor:"pointer",position:"relative"},onClick:()=>O(t.id),children:[(0,n.jsx)("div",{onClick:e=>{e.stopPropagation(),O(t.id)},style:{position:"absolute",top:8,left:8,zIndex:2,width:22,height:22,borderRadius:5,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.15s",background:o?"#1677ff":"rgba(0,0,0,0.6)",color:"#fff",fontSize:12,fontWeight:700},children:o?"✓":""}),(0,n.jsx)(g.A,{menu:{items:a},trigger:["click"],placement:"bottomRight",children:(0,n.jsx)(h.Ay,{type:"text",size:"small",icon:(0,n.jsx)(w.A,{}),style:{position:"absolute",top:6,right:6,zIndex:2,width:24,height:24,padding:0,background:"var(--colorBgContainer)",borderRadius:6,boxShadow:"0 1px 3px rgba(0,0,0,0.08)"},onClick:e=>e.stopPropagation()})}),l&&(0,n.jsx)("div",{style:{margin:"-12px -12px 10px -12px",borderRadius:"10px 10px 0 0",overflow:"hidden",height:140,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--colorFillAlter)"},children:(0,n.jsx)(y.A,{src:l,alt:t.name,style:{width:"100%",height:"100%",objectFit:"cover"},onClick:e=>e.stopPropagation()})}),(0,n.jsx)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,marginBottom:6},children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,flex:1},children:[!l&&("image"===t.type?(0,n.jsx)(A.A,{style:{color:"var(--colorWarning)",fontSize:15,flexShrink:0}}):(0,n.jsx)(b.A,{style:{color:"var(--colorAccent)",fontSize:15,flexShrink:0}})),(0,n.jsx)("span",{style:{fontWeight:600,fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name})]})}),(0,n.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:[(0,n.jsx)(f.A,{color:C[t.role]||"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:t.role}),(0,n.jsx)(f.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:t.type})]}),(0,n.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",lineHeight:1.5,marginBottom:6},children:[t.path&&(0,n.jsx)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:11},children:t.path}),(0,n.jsxs)("div",{children:[z[t.source]||t.source," \xb7 ",t.usedByDocumentIds.length," 个文档 \xb7 ",new Date(t.updatedAt).toLocaleDateString()]})]})]})},t.id)})})]})}},85015:(e,t,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/asset-library",function(){return i(63806)}])}},e=>{e.O(0,[433,787,102,767,636,593,792],()=>e(e.s=85015)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[623],{23507:(e,l,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return r(59889)}])},59889:(e,l,r)=>{"use strict";r.r(l),r.d(l,{default:()=>K});var i=r(65321),n=r(97109),s=r(35292),t=r(17807),o=r(63455),a=r(11702),c=r(84253),d=r(68787),p=r(85114),x=r(26171),m=r(33442),h=r(57271),u=r(85493),y=r(34052),f=r(7576),g=r(2256),j=r(38770),A=r(58569),v=r(25345),b=r(80042),w=r(75548),I=r(26631),S=r(84662),z=r(30486),T=r(99650),R=r(8263),k=r(84742),C=r(43094),B=r(8579),_=r(81668),F=r(58209),N=r(96091),E=r(54746),O=r(96651),W=r(60470),D=r(6578),H=r(79059);let{Paragraph:P}=s.A,L={rule:(0,i.jsx)(v.A,{}),table:(0,i.jsx)(b.A,{}),drawing:(0,i.jsx)(w.A,{}),specification:(0,i.jsx)(I.A,{}),reference:(0,i.jsx)(S.A,{})},U={fact_extraction:(0,i.jsx)(z.A,{}),chapter_generation:(0,i.jsx)(T.A,{}),llm_review:(0,i.jsx)(R.A,{}),validation:(0,i.jsx)(k.A,{}),formatting:(0,i.jsx)(C.A,{}),reference:(0,i.jsx)(S.A,{})},q={rule:"#fa8c16",table:"#52c41a",drawing:"#722ed1",specification:"#eb2f96",reference:"#13c2c2"},V={fact_extraction:"#fa8c16",chapter_generation:"#1677ff",llm_review:"#722ed1",validation:"#52c41a",formatting:"#eb2f96",reference:"#13c2c2"},G={rule:"roles.ruleFile",table:"roles.tableFile",drawing:"roles.drawingFile",specification:"roles.specificationFile",reference:"roles.reference"},Q={fact_extraction:"roles.factExtraction",chapter_generation:"roles.chapterGeneration",llm_review:"roles.llmReview",validation:"roles.validation",formatting:"roles.formatting",reference:"roles.reference"};function J(e,l){let r=new Blob([JSON.stringify(l,null,2)],{type:"application/json;charset=utf-8"}),i=URL.createObjectURL(r),n=document.createElement("a");n.href=i,n.download=e,n.click(),URL.revokeObjectURL(i)}function M(e){return e.trim().replace(/[\\/:*?"<>|]/g,"-").slice(0,80)||"untitled"}function X(e,l){return{type:"customize-agent.documentRoles",version:1,exportedAt:new Date().toISOString(),roles:e,configs:l}}function K(){let e,l,r=(0,H.Vr)(),{message:s}=t.A.useApp(),[v]=o.A.useForm(),[b]=o.A.useForm(),[w,S]=(0,n.useState)([]),[z,R]=(0,n.useState)([]),[k,C]=(0,n.useState)([]),[K,Y]=(0,n.useState)(!1),[Z,$]=(0,n.useState)(!1),[ee,el]=(0,n.useState)(!1),[er,ei]=(0,n.useState)("file"),[en,es]=(0,n.useState)("custom"),[et,eo]=(0,n.useState)(!1),ea=(0,n.useRef)(null),ec=async()=>{let[e,l]=await Promise.all([(0,D.lv)(),(0,D.dx)()]);S(e.roles),R(e.configs),C(l)};(0,n.useEffect)(()=>{ec().catch(()=>s.error(r("common.error")))},[s,r]);let ed=()=>"all"===en||"custom"===en,ep=w.filter(ed),ex=z.filter(ed),em=ep.filter(e=>"file"===e.type),eh=ep.filter(e=>"prompt"===e.type),eu=w.filter(e=>"file"===e.type),ey=w.filter(e=>"prompt"===e.type),ef=async()=>{try{let e=await v.validateFields(),l="file"===e.type?{...e,resourceId:void 0,resourceIds:[]}:e,i=await (0,D.dg)(l);S(i.roles),R(i.configs),Y(!1),s.success(r("common.success"))}catch(e){s.error(r("common.error"))}},eg=async()=>{try{let e=await b.validateFields(),l=e=>(null!=e?e:[]).map((e,l)=>{var r;return{roleId:e.roleId,order:Number(null!=(r=e.order)?r:l)}}),i=await (0,D.NR)({...e,fileRoles:l(e.fileRoles),promptRoles:l(e.promptRoles)});S(i.roles),R(i.configs),$(!1),s.success(r("common.success"))}catch(e){s.error(r("common.error"))}},ej=async e=>{try{let l=await (0,D.FV)(e.type,e.id);S(l.roles),R(l.configs),s.success("角色已删除")}catch(e){s.error(e instanceof Error?e.message:"角色删除失败")}},eA=async e=>{try{let l=await (0,D.dw)(e);S(l.roles),R(l.configs),s.success("项目角色配置已删除")}catch(e){s.error(e instanceof Error?e.message:"项目角色配置删除失败")}},ev=async e=>{if(e){eo(!0);try{let l=JSON.parse(await e.text()),r=await fetch("/api/documents/roles?mode=import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw Error(await r.text());let i=await r.json();S(i.roles),R(i.configs),s.success("已导入 ".concat(i.importedRoles," 个角色、").concat(i.importedConfigs," 个配置"))}catch(e){s.error("导入失败,请确认 JSON 文件格式正确")}finally{eo(!1),ea.current&&(ea.current.value="")}}},eb=function(e){var l;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";v.setFieldsValue(e?{...e,resourceIds:(null==(l=e.resourceIds)?void 0:l.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]}:{id:"role-".concat(Date.now()),name:"",description:"",type:r,resourceIds:[],executionType:"prompt"===r?"reference":void 0,processingType:"file"===r?"reference":void 0}),Y(!0)},ew=e=>{b.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[],builtIn:!1}),$(!0)},eI=e=>w.find(l=>l.id===e),eS=e=>{var l;return(null==e?void 0:e.type)==="prompt"?(null==(l=e.resourceIds)?void 0:l.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]:[]},ez=e=>{var l;return(null==(l=k.find(l=>l.id===e))?void 0:l.projectName)||e},eT=e=>(0,i.jsx)(a.A,{closable:e.closable,onClose:e.onClose,color:"purple",title:e.value,style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:ez(e.value)}),eR=(e,l)=>{let n="file"===l?"blue":"purple",s="file"===l?G:Q,t=[...e].sort((e,l)=>{var r,i;return Number(null!=(r=e.order)?r:0)-Number(null!=(i=l.order)?i:0)}).map(e=>eI(e.roleId)).filter(e=>!!e);return 0===t.length?(0,i.jsx)(c.A,{image:c.A.PRESENTED_IMAGE_SIMPLE,description:"file"===l?"暂未选择文件角色":"暂未选择提示词角色"}):(0,i.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:t.map((e,l)=>{var t,o;let c=eS(e),d="file"===e.type?null!=(t=e.processingType)?t:"":null!=(o=e.executionType)?o:"";return(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:8,background:"var(--colorBgContainer)",border:"1px solid var(--colorBorderSecondary)"},children:[(0,i.jsxs)(a.A,{color:n,style:{margin:0},children:["#",l+1]}),(0,i.jsx)("span",{style:{fontWeight:600,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),(0,i.jsx)(a.A,{style:{margin:0},children:r(s[d]||"roles.reference")}),"prompt"===e.type&&(0,i.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",c.length," 个提示词"]})]},e.id)})})},ek=e=>{if(!e)return null;let l=eS(e);return(0,i.jsxs)("div",{style:{marginTop:8,padding:8,borderRadius:8,background:"var(--colorFillQuaternary)",fontSize:12,color:"var(--colorTextSecondary)"},children:[e.description&&(0,i.jsx)("div",{style:{marginBottom:4*("prompt"===e.type)},children:e.description}),"prompt"===e.type&&(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[l.slice(0,4).map(e=>(0,i.jsx)(a.A,{title:e,style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:180,overflow:"hidden",textOverflow:"ellipsis"},children:ez(e)},e)),l.length>4&&(0,i.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",l.length-4]}),0===l.length&&(0,i.jsx)("span",{children:"未绑定提示词"})]})]})};return(0,i.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"pageTitle",children:r("roles.title")}),(0,i.jsx)("p",{className:"pageDesc",children:r("roles.description")})]}),(0,i.jsxs)(m.A,{children:[(0,i.jsx)(h.A,{value:en,onChange:es,style:{width:170},options:[{label:"我的配置 (".concat(w.length+z.length,")"),value:"custom"},{label:"全部来源 (".concat(w.length+z.length,")"),value:"all"}]}),(0,i.jsx)("input",{ref:ea,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:e=>{var l;ev(null==(l=e.target.files)?void 0:l[0])}}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(N.A,{}),loading:et,onClick:()=>{var e;return null==(e=ea.current)?void 0:e.click()},children:"导入"}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(_.A,{}),disabled:w.length+z.length===0,onClick:()=>{J("customize-document-roles-".concat(new Date().toISOString().slice(0,10),".json"),X(w,z)),s.success("已导出 ".concat(w.length," 个角色、").concat(z.length," 个配置"))},children:"导出全部"}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(E.A,{}),onClick:()=>eb(void 0,"file"),children:r("roles.newFileRole")}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(E.A,{}),onClick:()=>eb(void 0,"prompt"),children:r("roles.newPromptRole")}),(0,i.jsx)(p.Ay,{type:"primary",icon:(0,i.jsx)(E.A,{}),onClick:()=>ew(),children:r("roles.newConfig")})]})]}),(0,i.jsx)(u.A,{type:"info",showIcon:!0,message:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)("span",{children:r("roles.plainGuideTitle")}),(0,i.jsx)(p.Ay,{type:"link",size:"small",icon:ee?(0,i.jsx)(O.A,{}):(0,i.jsx)(W.A,{}),onClick:()=>el(!ee),style:{padding:"0 4px"},children:ee?"收起说明":"展开说明"})]}),description:ee?r("roles.plainGuideDesc"):void 0}),(0,i.jsx)(d.A,{size:"small",tabList:[{key:"file",label:"文件角色 (".concat(em.length,")")},{key:"prompt",label:"提示词角色 (".concat(eh.length,")")},{key:"configs",label:"项目角色配置 (".concat(ex.length,")")}],activeTabKey:er,onTabChange:ei,children:"configs"===er?0===ex.length?(0,i.jsx)(c.A,{description:r("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:ex.map(e=>{let l=e.fileRoles.map(e=>({...e,role:eI(e.roleId)})).filter(e=>e.role),n=e.promptRoles.map(e=>({...e,role:eI(e.roleId)})).filter(e=>e.role);return(0,i.jsxs)(d.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:6},children:[(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.name}),(0,i.jsx)(a.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的配置"}),(0,i.jsxs)("div",{style:{display:"flex",gap:4,flexShrink:0},children:[(0,i.jsx)(p.Ay,{size:"small",icon:(0,i.jsx)(T.A,{}),onClick:()=>ew(e),children:"编辑"}),!e.builtIn&&(0,i.jsx)(p.Ay,{size:"small",icon:(0,i.jsx)(_.A,{}),onClick:()=>(e=>{let l=new Set([...e.fileRoles.map(e=>e.roleId),...e.promptRoles.map(e=>e.roleId)]);J("customize-role-config-".concat(M(e.name),"-").concat(new Date().toISOString().slice(0,10),".json"),X(w.filter(e=>l.has(e.id)&&!e.builtIn),[e])),s.success("已导出 1 个配置")})(e),children:"导出"}),(0,i.jsx)(x.A,{title:r("common.confirm"),onConfirm:()=>{eA(e.id)},children:(0,i.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(F.A,{})})})]})]}),e.description&&(0,i.jsx)(P,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,i.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,i.jsxs)("div",{style:{marginBottom:4},children:[(0,i.jsxs)("span",{children:["文件角色 (",e.fileRoles.length,"): "]}),l.length>0?(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[l.slice(0,4).map(e=>(0,i.jsx)(a.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),l.length>4&&(0,i.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",l.length-4]})]}):(0,i.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("span",{children:["提示词角色 (",e.promptRoles.length,"): "]}),n.length>0?(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[n.slice(0,4).map(e=>(0,i.jsx)(a.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),n.length>4&&(0,i.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",n.length-4]})]}):(0,i.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]})]})]},e.id)})}):(e="file"===er?em:eh,l=r,0===e.length?(0,i.jsx)(c.A,{description:r("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(270px, 1fr))",gap:12},children:e.map(e=>{var n,t,o,c,m,h,u,y,f;let g="prompt"===e.type?(null==(n=e.resourceIds)?void 0:n.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]:[],j=g.slice(0,3),A=g.length-j.length,v="file"===e.type?null!=(o=L[null!=(t=e.processingType)?t:""])?o:(0,i.jsx)(I.A,{}):null!=(m=U[null!=(c=e.executionType)?c:""])?m:(0,i.jsx)(B.A,{}),b="file"===e.type?null!=(u=q[null!=(h=e.processingType)?h:""])?u:"var(--colorAccent)":null!=(f=V[null!=(y=e.executionType)?y:""])?f:"var(--colorWarning)";return(0,i.jsxs)(d.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:8},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,flex:1},children:[(0,i.jsx)("span",{style:{color:b,fontSize:16,flexShrink:0,lineHeight:1},children:v}),(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"20px"},children:e.name})]}),(0,i.jsx)("div",{style:{display:"flex",gap:4,flexShrink:0},children:(0,i.jsx)(a.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的角色"})})]}),e.description&&(0,i.jsx)(P,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,i.jsxs)("div",{style:{marginBottom:8,display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,i.jsx)(a.A,{color:"file"===e.type?"blue":"purple",style:{margin:0},children:function(e,l){var r,i,n;let s="file"===e.type?G[null!=(r=e.processingType)?r:""]:Q[null!=(i=e.executionType)?i:""];return s?l(s):null!=(n="file"===e.type?e.processingType:e.executionType)?n:""}(e,l)}),g.length>0&&(0,i.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",g.length," 个提示词"]})]}),j.length>0&&(0,i.jsx)("div",{style:{marginBottom:10},children:(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[j.map(e=>(0,i.jsx)(a.A,{color:"purple",title:e,style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"},children:ez(e)},e)),A>0&&(0,i.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",A]})]})}),(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:6,paddingTop:4,borderTop:"1px solid var(--colorBorderSecondary)"},children:[(0,i.jsx)(p.Ay,{size:"small",icon:(0,i.jsx)(T.A,{}),onClick:()=>eb(e),children:"编辑"}),!e.builtIn&&(0,i.jsx)(p.Ay,{size:"small",icon:(0,i.jsx)(_.A,{}),onClick:()=>{J("customize-role-".concat(M(e.name),"-").concat(new Date().toISOString().slice(0,10),".json"),X([e],[])),s.success("已导出 1 个角色")},children:"导出"}),(0,i.jsx)(x.A,{title:r("common.confirm"),onConfirm:()=>{ej(e)},children:(0,i.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(F.A,{})})})]})]},e.id)})}))}),(0,i.jsx)(y.A,{title:r("roles.roleEditor"),open:K,onClose:()=>Y(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,i.jsx)(p.Ay,{type:"primary",onClick:()=>{ef()},children:r("common.save")}),children:(0,i.jsxs)(o.A,{form:v,layout:"vertical",children:[(0,i.jsx)(o.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(f.A,{})}),(0,i.jsxs)(g.A,{gutter:16,children:[(0,i.jsx)(j.A,{span:12,children:(0,i.jsx)(o.A.Item,{name:"type",label:r("roles.roleType"),rules:[{required:!0}],children:(0,i.jsx)(h.A,{options:[{label:r("roles.fileRole"),value:"file"},{label:r("roles.promptRole"),value:"prompt"}]})})}),(0,i.jsx)(j.A,{span:12,children:(0,i.jsx)(o.A.Item,{name:"name",label:r("roles.roleName"),rules:[{required:!0}],children:(0,i.jsx)(f.A,{})})})]}),(0,i.jsx)(o.A.Item,{name:"description",label:r("roles.roleDescription"),children:(0,i.jsx)(f.A.TextArea,{rows:2})}),(0,i.jsx)(o.A.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.type!==l.type,children:e=>{let{getFieldValue:l}=e,n="prompt"===l("type");return(0,i.jsx)(d.A,{size:"small",title:n?"提示词角色配置":"文件角色配置",style:{border:"1px solid var(--colorBorderSecondary)"},children:n?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.A.Item,{name:"executionType",label:r("roles.executionType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,i.jsx)(h.A,{options:[{label:r("roles.factExtraction"),value:"fact_extraction"},{label:r("roles.chapterGeneration"),value:"chapter_generation"},{label:r("roles.validation"),value:"validation"},{label:r("roles.formatting"),value:"formatting"},{label:r("roles.reference"),value:"reference"}]})}),(0,i.jsx)(o.A.Item,{name:"resourceIds",label:r("roles.bindPrompt"),style:{marginBottom:0},help:(0,i.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:r("roles.multiBindPromptHelp")}),children:(0,i.jsx)(h.A,{mode:"multiple",showSearch:!0,tagRender:eT,placeholder:"选择提示词",options:k.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.A.Item,{name:"processingType",label:r("roles.processingType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,i.jsx)(h.A,{options:[{label:r("roles.ruleFile"),value:"rule"},{label:r("roles.tableFile"),value:"table"},{label:r("roles.drawingFile"),value:"drawing"},{label:r("roles.specificationFile"),value:"specification"},{label:r("roles.reference"),value:"reference"}]})}),(0,i.jsx)(u.A,{type:"info",showIcon:!0,message:"文件角色只定义处理类型",description:"具体项目文件由生成流程自动识别,或在模板的高级固定绑定资料中手动覆盖;这里不再绑定知识库文件,避免角色复用时混入其他项目资料。"})]})})}})]})}),(0,i.jsx)(y.A,{title:r("roles.configEditor"),open:Z,onClose:()=>$(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,i.jsx)(p.Ay,{type:"primary",onClick:()=>{eg()},children:r("common.save")}),children:(0,i.jsxs)(o.A,{form:b,layout:"vertical",children:[(0,i.jsx)(o.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(f.A,{})}),(0,i.jsxs)(g.A,{gutter:16,children:[(0,i.jsx)(j.A,{span:12,children:(0,i.jsx)(o.A.Item,{name:"name",label:r("roles.configName"),rules:[{required:!0}],children:(0,i.jsx)(f.A,{})})}),(0,i.jsx)(j.A,{span:12,children:(0,i.jsx)(o.A.Item,{name:"description",label:r("roles.configDescription"),children:(0,i.jsx)(f.A,{})})})]}),(0,i.jsx)(o.A.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.fileRoles!==l.fileRoles||e.promptRoles!==l.promptRoles,children:e=>{let{getFieldValue:l}=e,n=l("fileRoles")||[],s=l("promptRoles")||[];return(0,i.jsx)(A.A,{destroyInactiveTabPane:!1,items:[{key:"file",label:"文件角色 (".concat(n.length,"/").concat(eu.length,")"),children:(0,i.jsx)(o.A.List,{name:"fileRoles",children:(e,l)=>{let{add:s,remove:t}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[(0,i.jsx)(d.A,{size:"small",title:"已选文件角色",style:{background:"var(--colorFillQuaternary)"},children:eR(n,"file")}),0===e.length&&(0,i.jsx)(c.A,{description:"暂未添加文件角色"}),e.map((e,l)=>(0,i.jsxs)(d.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsxs)("div",{style:{position:"absolute",top:-10,left:12,background:"#1677ff",color:"#fff",fontSize:11,fontWeight:700,padding:"1px 8px",borderRadius:10},children:["#",l+1]}),(0,i.jsx)(p.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(F.A,{}),onClick:()=>t(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsxs)(g.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,i.jsxs)(j.A,{flex:"auto",children:[(0,i.jsx)(o.A.Item,{name:[e.name,"roleId"],label:"文件角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(h.A,{placeholder:"选择文件角色",size:"small",options:eu.map(e=>{var l;return{label:"".concat(e.name," (").concat(r(G[null!=(l=e.processingType)?l:""]||"roles.reference"),")"),value:e.id}})})}),(0,i.jsx)(o.A.Item,{noStyle:!0,shouldUpdate:!0,children:l=>{let{getFieldValue:r}=l;return ek(eI(r(["fileRoles",e.name,"roleId"])))}})]}),(0,i.jsx)(j.A,{style:{width:90},children:(0,i.jsx)(o.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(f.A,{type:"number",size:"small"})})})]})]},e.key)),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(E.A,{}),onClick:()=>s({order:e.length}),children:r("roles.addRole")})]})}})},{key:"prompt",label:"提示词角色 (".concat(s.length,"/").concat(ey.length,")"),children:(0,i.jsx)(o.A.List,{name:"promptRoles",children:(e,l)=>{let{add:n,remove:t}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[(0,i.jsx)(d.A,{size:"small",title:"已选提示词角色",style:{background:"var(--colorFillQuaternary)"},children:eR(s,"prompt")}),0===e.length&&(0,i.jsx)(c.A,{description:"暂未添加提示词角色"}),e.map((e,l)=>(0,i.jsxs)(d.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsxs)("div",{style:{position:"absolute",top:-10,left:12,background:"#722ed1",color:"#fff",fontSize:11,fontWeight:700,padding:"1px 8px",borderRadius:10},children:["#",l+1]}),(0,i.jsx)(p.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(F.A,{}),onClick:()=>t(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsxs)(g.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,i.jsxs)(j.A,{flex:"auto",children:[(0,i.jsx)(o.A.Item,{name:[e.name,"roleId"],label:"提示词角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(h.A,{placeholder:"选择提示词角色",size:"small",options:ey.map(e=>{var l;return{label:"".concat(e.name," (").concat(r(Q[null!=(l=e.executionType)?l:""]||"roles.reference"),")"),value:e.id}})})}),(0,i.jsx)(o.A.Item,{noStyle:!0,shouldUpdate:!0,children:l=>{let{getFieldValue:r}=l;return ek(eI(r(["promptRoles",e.name,"roleId"])))}})]}),(0,i.jsx)(j.A,{style:{width:90},children:(0,i.jsx)(o.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(f.A,{type:"number",size:"small"})})})]})]},e.key)),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(E.A,{}),onClick:()=>n({order:e.length}),children:r("roles.addRole")})]})}})}]})}})]})})]})}}},e=>{e.O(0,[433,787,576,195,455,466,636,593,792],()=>e(e.s=23507)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[623],{23507:(e,l,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return r(59889)}])},59889:(e,l,r)=>{"use strict";r.r(l),r.d(l,{default:()=>K});var i=r(65321),n=r(97109),s=r(35292),t=r(17807),o=r(63455),a=r(11702),c=r(84253),d=r(68787),p=r(85114),x=r(26171),m=r(33442),h=r(57271),u=r(85493),y=r(34052),f=r(7576),g=r(2256),j=r(38770),A=r(58569),v=r(25345),b=r(80042),w=r(75548),I=r(26631),S=r(84662),z=r(30486),T=r(99650),R=r(8263),k=r(84742),C=r(43094),B=r(8579),_=r(81668),F=r(58209),N=r(96091),E=r(54746),O=r(96651),W=r(60470),D=r(6578),H=r(44494);let{Paragraph:P}=s.A,L={rule:(0,i.jsx)(v.A,{}),table:(0,i.jsx)(b.A,{}),drawing:(0,i.jsx)(w.A,{}),specification:(0,i.jsx)(I.A,{}),reference:(0,i.jsx)(S.A,{})},U={fact_extraction:(0,i.jsx)(z.A,{}),chapter_generation:(0,i.jsx)(T.A,{}),llm_review:(0,i.jsx)(R.A,{}),validation:(0,i.jsx)(k.A,{}),formatting:(0,i.jsx)(C.A,{}),reference:(0,i.jsx)(S.A,{})},q={rule:"#fa8c16",table:"#52c41a",drawing:"#722ed1",specification:"#eb2f96",reference:"#13c2c2"},V={fact_extraction:"#fa8c16",chapter_generation:"#1677ff",llm_review:"#722ed1",validation:"#52c41a",formatting:"#eb2f96",reference:"#13c2c2"},G={rule:"roles.ruleFile",table:"roles.tableFile",drawing:"roles.drawingFile",specification:"roles.specificationFile",reference:"roles.reference"},Q={fact_extraction:"roles.factExtraction",chapter_generation:"roles.chapterGeneration",llm_review:"roles.llmReview",validation:"roles.validation",formatting:"roles.formatting",reference:"roles.reference"};function J(e,l){let r=new Blob([JSON.stringify(l,null,2)],{type:"application/json;charset=utf-8"}),i=URL.createObjectURL(r),n=document.createElement("a");n.href=i,n.download=e,n.click(),URL.revokeObjectURL(i)}function M(e){return e.trim().replace(/[\\/:*?"<>|]/g,"-").slice(0,80)||"untitled"}function X(e,l){return{type:"customize-agent.documentRoles",version:1,exportedAt:new Date().toISOString(),roles:e,configs:l}}function K(){let e,l,r=(0,H.Vr)(),{message:s}=t.A.useApp(),[v]=o.A.useForm(),[b]=o.A.useForm(),[w,S]=(0,n.useState)([]),[z,R]=(0,n.useState)([]),[k,C]=(0,n.useState)([]),[K,Y]=(0,n.useState)(!1),[Z,$]=(0,n.useState)(!1),[ee,el]=(0,n.useState)(!1),[er,ei]=(0,n.useState)("file"),[en,es]=(0,n.useState)("custom"),[et,eo]=(0,n.useState)(!1),ea=(0,n.useRef)(null),ec=async()=>{let[e,l]=await Promise.all([(0,D.lv)(),(0,D.dx)()]);S(e.roles),R(e.configs),C(l)};(0,n.useEffect)(()=>{ec().catch(()=>s.error(r("common.error")))},[s,r]);let ed=()=>"all"===en||"custom"===en,ep=w.filter(ed),ex=z.filter(ed),em=ep.filter(e=>"file"===e.type),eh=ep.filter(e=>"prompt"===e.type),eu=w.filter(e=>"file"===e.type),ey=w.filter(e=>"prompt"===e.type),ef=async()=>{try{let e=await v.validateFields(),l="file"===e.type?{...e,resourceId:void 0,resourceIds:[]}:e,i=await (0,D.dg)(l);S(i.roles),R(i.configs),Y(!1),s.success(r("common.success"))}catch(e){s.error(r("common.error"))}},eg=async()=>{try{let e=await b.validateFields(),l=e=>(null!=e?e:[]).map((e,l)=>{var r;return{roleId:e.roleId,order:Number(null!=(r=e.order)?r:l)}}),i=await (0,D.NR)({...e,fileRoles:l(e.fileRoles),promptRoles:l(e.promptRoles)});S(i.roles),R(i.configs),$(!1),s.success(r("common.success"))}catch(e){s.error(r("common.error"))}},ej=async e=>{try{let l=await (0,D.FV)(e.type,e.id);S(l.roles),R(l.configs),s.success("角色已删除")}catch(e){s.error(e instanceof Error?e.message:"角色删除失败")}},eA=async e=>{try{let l=await (0,D.dw)(e);S(l.roles),R(l.configs),s.success("项目角色配置已删除")}catch(e){s.error(e instanceof Error?e.message:"项目角色配置删除失败")}},ev=async e=>{if(e){eo(!0);try{let l=JSON.parse(await e.text()),r=await fetch("/api/documents/roles?mode=import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw Error(await r.text());let i=await r.json();S(i.roles),R(i.configs),s.success("已导入 ".concat(i.importedRoles," 个角色、").concat(i.importedConfigs," 个配置"))}catch(e){s.error("导入失败,请确认 JSON 文件格式正确")}finally{eo(!1),ea.current&&(ea.current.value="")}}},eb=function(e){var l;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";v.setFieldsValue(e?{...e,resourceIds:(null==(l=e.resourceIds)?void 0:l.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]}:{id:"role-".concat(Date.now()),name:"",description:"",type:r,resourceIds:[],executionType:"prompt"===r?"reference":void 0,processingType:"file"===r?"reference":void 0}),Y(!0)},ew=e=>{b.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[],builtIn:!1}),$(!0)},eI=e=>w.find(l=>l.id===e),eS=e=>{var l;return(null==e?void 0:e.type)==="prompt"?(null==(l=e.resourceIds)?void 0:l.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]:[]},ez=e=>{var l;return(null==(l=k.find(l=>l.id===e))?void 0:l.projectName)||e},eT=e=>(0,i.jsx)(a.A,{closable:e.closable,onClose:e.onClose,color:"purple",title:e.value,style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:ez(e.value)}),eR=(e,l)=>{let n="file"===l?"blue":"purple",s="file"===l?G:Q,t=[...e].sort((e,l)=>{var r,i;return Number(null!=(r=e.order)?r:0)-Number(null!=(i=l.order)?i:0)}).map(e=>eI(e.roleId)).filter(e=>!!e);return 0===t.length?(0,i.jsx)(c.A,{image:c.A.PRESENTED_IMAGE_SIMPLE,description:"file"===l?"暂未选择文件角色":"暂未选择提示词角色"}):(0,i.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:t.map((e,l)=>{var t,o;let c=eS(e),d="file"===e.type?null!=(t=e.processingType)?t:"":null!=(o=e.executionType)?o:"";return(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:8,background:"var(--colorBgContainer)",border:"1px solid var(--colorBorderSecondary)"},children:[(0,i.jsxs)(a.A,{color:n,style:{margin:0},children:["#",l+1]}),(0,i.jsx)("span",{style:{fontWeight:600,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),(0,i.jsx)(a.A,{style:{margin:0},children:r(s[d]||"roles.reference")}),"prompt"===e.type&&(0,i.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",c.length," 个提示词"]})]},e.id)})})},ek=e=>{if(!e)return null;let l=eS(e);return(0,i.jsxs)("div",{style:{marginTop:8,padding:8,borderRadius:8,background:"var(--colorFillQuaternary)",fontSize:12,color:"var(--colorTextSecondary)"},children:[e.description&&(0,i.jsx)("div",{style:{marginBottom:4*("prompt"===e.type)},children:e.description}),"prompt"===e.type&&(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[l.slice(0,4).map(e=>(0,i.jsx)(a.A,{title:e,style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:180,overflow:"hidden",textOverflow:"ellipsis"},children:ez(e)},e)),l.length>4&&(0,i.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",l.length-4]}),0===l.length&&(0,i.jsx)("span",{children:"未绑定提示词"})]})]})};return(0,i.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"pageTitle",children:r("roles.title")}),(0,i.jsx)("p",{className:"pageDesc",children:r("roles.description")})]}),(0,i.jsxs)(m.A,{children:[(0,i.jsx)(h.A,{value:en,onChange:es,style:{width:170},options:[{label:"我的配置 (".concat(w.length+z.length,")"),value:"custom"},{label:"全部来源 (".concat(w.length+z.length,")"),value:"all"}]}),(0,i.jsx)("input",{ref:ea,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:e=>{var l;ev(null==(l=e.target.files)?void 0:l[0])}}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(N.A,{}),loading:et,onClick:()=>{var e;return null==(e=ea.current)?void 0:e.click()},children:"导入"}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(_.A,{}),disabled:w.length+z.length===0,onClick:()=>{J("customize-document-roles-".concat(new Date().toISOString().slice(0,10),".json"),X(w,z)),s.success("已导出 ".concat(w.length," 个角色、").concat(z.length," 个配置"))},children:"导出全部"}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(E.A,{}),onClick:()=>eb(void 0,"file"),children:r("roles.newFileRole")}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(E.A,{}),onClick:()=>eb(void 0,"prompt"),children:r("roles.newPromptRole")}),(0,i.jsx)(p.Ay,{type:"primary",icon:(0,i.jsx)(E.A,{}),onClick:()=>ew(),children:r("roles.newConfig")})]})]}),(0,i.jsx)(u.A,{type:"info",showIcon:!0,message:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)("span",{children:r("roles.plainGuideTitle")}),(0,i.jsx)(p.Ay,{type:"link",size:"small",icon:ee?(0,i.jsx)(O.A,{}):(0,i.jsx)(W.A,{}),onClick:()=>el(!ee),style:{padding:"0 4px"},children:ee?"收起说明":"展开说明"})]}),description:ee?r("roles.plainGuideDesc"):void 0}),(0,i.jsx)(d.A,{size:"small",tabList:[{key:"file",label:"文件角色 (".concat(em.length,")")},{key:"prompt",label:"提示词角色 (".concat(eh.length,")")},{key:"configs",label:"项目角色配置 (".concat(ex.length,")")}],activeTabKey:er,onTabChange:ei,children:"configs"===er?0===ex.length?(0,i.jsx)(c.A,{description:r("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:ex.map(e=>{let l=e.fileRoles.map(e=>({...e,role:eI(e.roleId)})).filter(e=>e.role),n=e.promptRoles.map(e=>({...e,role:eI(e.roleId)})).filter(e=>e.role);return(0,i.jsxs)(d.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:6},children:[(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.name}),(0,i.jsx)(a.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的配置"}),(0,i.jsxs)("div",{style:{display:"flex",gap:4,flexShrink:0},children:[(0,i.jsx)(p.Ay,{size:"small",icon:(0,i.jsx)(T.A,{}),onClick:()=>ew(e),children:"编辑"}),!e.builtIn&&(0,i.jsx)(p.Ay,{size:"small",icon:(0,i.jsx)(_.A,{}),onClick:()=>(e=>{let l=new Set([...e.fileRoles.map(e=>e.roleId),...e.promptRoles.map(e=>e.roleId)]);J("customize-role-config-".concat(M(e.name),"-").concat(new Date().toISOString().slice(0,10),".json"),X(w.filter(e=>l.has(e.id)&&!e.builtIn),[e])),s.success("已导出 1 个配置")})(e),children:"导出"}),(0,i.jsx)(x.A,{title:r("common.confirm"),onConfirm:()=>{eA(e.id)},children:(0,i.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(F.A,{})})})]})]}),e.description&&(0,i.jsx)(P,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,i.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,i.jsxs)("div",{style:{marginBottom:4},children:[(0,i.jsxs)("span",{children:["文件角色 (",e.fileRoles.length,"): "]}),l.length>0?(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[l.slice(0,4).map(e=>(0,i.jsx)(a.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),l.length>4&&(0,i.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",l.length-4]})]}):(0,i.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("span",{children:["提示词角色 (",e.promptRoles.length,"): "]}),n.length>0?(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[n.slice(0,4).map(e=>(0,i.jsx)(a.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),n.length>4&&(0,i.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",n.length-4]})]}):(0,i.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]})]})]},e.id)})}):(e="file"===er?em:eh,l=r,0===e.length?(0,i.jsx)(c.A,{description:r("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(270px, 1fr))",gap:12},children:e.map(e=>{var n,t,o,c,m,h,u,y,f;let g="prompt"===e.type?(null==(n=e.resourceIds)?void 0:n.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]:[],j=g.slice(0,3),A=g.length-j.length,v="file"===e.type?null!=(o=L[null!=(t=e.processingType)?t:""])?o:(0,i.jsx)(I.A,{}):null!=(m=U[null!=(c=e.executionType)?c:""])?m:(0,i.jsx)(B.A,{}),b="file"===e.type?null!=(u=q[null!=(h=e.processingType)?h:""])?u:"var(--colorAccent)":null!=(f=V[null!=(y=e.executionType)?y:""])?f:"var(--colorWarning)";return(0,i.jsxs)(d.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:8},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,flex:1},children:[(0,i.jsx)("span",{style:{color:b,fontSize:16,flexShrink:0,lineHeight:1},children:v}),(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"20px"},children:e.name})]}),(0,i.jsx)("div",{style:{display:"flex",gap:4,flexShrink:0},children:(0,i.jsx)(a.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的角色"})})]}),e.description&&(0,i.jsx)(P,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,i.jsxs)("div",{style:{marginBottom:8,display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,i.jsx)(a.A,{color:"file"===e.type?"blue":"purple",style:{margin:0},children:function(e,l){var r,i,n;let s="file"===e.type?G[null!=(r=e.processingType)?r:""]:Q[null!=(i=e.executionType)?i:""];return s?l(s):null!=(n="file"===e.type?e.processingType:e.executionType)?n:""}(e,l)}),g.length>0&&(0,i.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",g.length," 个提示词"]})]}),j.length>0&&(0,i.jsx)("div",{style:{marginBottom:10},children:(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[j.map(e=>(0,i.jsx)(a.A,{color:"purple",title:e,style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"},children:ez(e)},e)),A>0&&(0,i.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",A]})]})}),(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:6,paddingTop:4,borderTop:"1px solid var(--colorBorderSecondary)"},children:[(0,i.jsx)(p.Ay,{size:"small",icon:(0,i.jsx)(T.A,{}),onClick:()=>eb(e),children:"编辑"}),!e.builtIn&&(0,i.jsx)(p.Ay,{size:"small",icon:(0,i.jsx)(_.A,{}),onClick:()=>{J("customize-role-".concat(M(e.name),"-").concat(new Date().toISOString().slice(0,10),".json"),X([e],[])),s.success("已导出 1 个角色")},children:"导出"}),(0,i.jsx)(x.A,{title:r("common.confirm"),onConfirm:()=>{ej(e)},children:(0,i.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(F.A,{})})})]})]},e.id)})}))}),(0,i.jsx)(y.A,{title:r("roles.roleEditor"),open:K,onClose:()=>Y(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,i.jsx)(p.Ay,{type:"primary",onClick:()=>{ef()},children:r("common.save")}),children:(0,i.jsxs)(o.A,{form:v,layout:"vertical",children:[(0,i.jsx)(o.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(f.A,{})}),(0,i.jsxs)(g.A,{gutter:16,children:[(0,i.jsx)(j.A,{span:12,children:(0,i.jsx)(o.A.Item,{name:"type",label:r("roles.roleType"),rules:[{required:!0}],children:(0,i.jsx)(h.A,{options:[{label:r("roles.fileRole"),value:"file"},{label:r("roles.promptRole"),value:"prompt"}]})})}),(0,i.jsx)(j.A,{span:12,children:(0,i.jsx)(o.A.Item,{name:"name",label:r("roles.roleName"),rules:[{required:!0}],children:(0,i.jsx)(f.A,{})})})]}),(0,i.jsx)(o.A.Item,{name:"description",label:r("roles.roleDescription"),children:(0,i.jsx)(f.A.TextArea,{rows:2})}),(0,i.jsx)(o.A.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.type!==l.type,children:e=>{let{getFieldValue:l}=e,n="prompt"===l("type");return(0,i.jsx)(d.A,{size:"small",title:n?"提示词角色配置":"文件角色配置",style:{border:"1px solid var(--colorBorderSecondary)"},children:n?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.A.Item,{name:"executionType",label:r("roles.executionType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,i.jsx)(h.A,{options:[{label:r("roles.factExtraction"),value:"fact_extraction"},{label:r("roles.chapterGeneration"),value:"chapter_generation"},{label:r("roles.validation"),value:"validation"},{label:r("roles.formatting"),value:"formatting"},{label:r("roles.reference"),value:"reference"}]})}),(0,i.jsx)(o.A.Item,{name:"resourceIds",label:r("roles.bindPrompt"),style:{marginBottom:0},help:(0,i.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:r("roles.multiBindPromptHelp")}),children:(0,i.jsx)(h.A,{mode:"multiple",showSearch:!0,tagRender:eT,placeholder:"选择提示词",options:k.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.A.Item,{name:"processingType",label:r("roles.processingType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,i.jsx)(h.A,{options:[{label:r("roles.ruleFile"),value:"rule"},{label:r("roles.tableFile"),value:"table"},{label:r("roles.drawingFile"),value:"drawing"},{label:r("roles.specificationFile"),value:"specification"},{label:r("roles.reference"),value:"reference"}]})}),(0,i.jsx)(u.A,{type:"info",showIcon:!0,message:"文件角色只定义处理类型",description:"具体项目文件由生成流程自动识别,或在模板的高级固定绑定资料中手动覆盖;这里不再绑定知识库文件,避免角色复用时混入其他项目资料。"})]})})}})]})}),(0,i.jsx)(y.A,{title:r("roles.configEditor"),open:Z,onClose:()=>$(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,i.jsx)(p.Ay,{type:"primary",onClick:()=>{eg()},children:r("common.save")}),children:(0,i.jsxs)(o.A,{form:b,layout:"vertical",children:[(0,i.jsx)(o.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(f.A,{})}),(0,i.jsxs)(g.A,{gutter:16,children:[(0,i.jsx)(j.A,{span:12,children:(0,i.jsx)(o.A.Item,{name:"name",label:r("roles.configName"),rules:[{required:!0}],children:(0,i.jsx)(f.A,{})})}),(0,i.jsx)(j.A,{span:12,children:(0,i.jsx)(o.A.Item,{name:"description",label:r("roles.configDescription"),children:(0,i.jsx)(f.A,{})})})]}),(0,i.jsx)(o.A.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.fileRoles!==l.fileRoles||e.promptRoles!==l.promptRoles,children:e=>{let{getFieldValue:l}=e,n=l("fileRoles")||[],s=l("promptRoles")||[];return(0,i.jsx)(A.A,{destroyInactiveTabPane:!1,items:[{key:"file",label:"文件角色 (".concat(n.length,"/").concat(eu.length,")"),children:(0,i.jsx)(o.A.List,{name:"fileRoles",children:(e,l)=>{let{add:s,remove:t}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[(0,i.jsx)(d.A,{size:"small",title:"已选文件角色",style:{background:"var(--colorFillQuaternary)"},children:eR(n,"file")}),0===e.length&&(0,i.jsx)(c.A,{description:"暂未添加文件角色"}),e.map((e,l)=>(0,i.jsxs)(d.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsxs)("div",{style:{position:"absolute",top:-10,left:12,background:"#1677ff",color:"#fff",fontSize:11,fontWeight:700,padding:"1px 8px",borderRadius:10},children:["#",l+1]}),(0,i.jsx)(p.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(F.A,{}),onClick:()=>t(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsxs)(g.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,i.jsxs)(j.A,{flex:"auto",children:[(0,i.jsx)(o.A.Item,{name:[e.name,"roleId"],label:"文件角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(h.A,{placeholder:"选择文件角色",size:"small",options:eu.map(e=>{var l;return{label:"".concat(e.name," (").concat(r(G[null!=(l=e.processingType)?l:""]||"roles.reference"),")"),value:e.id}})})}),(0,i.jsx)(o.A.Item,{noStyle:!0,shouldUpdate:!0,children:l=>{let{getFieldValue:r}=l;return ek(eI(r(["fileRoles",e.name,"roleId"])))}})]}),(0,i.jsx)(j.A,{style:{width:90},children:(0,i.jsx)(o.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(f.A,{type:"number",size:"small"})})})]})]},e.key)),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(E.A,{}),onClick:()=>s({order:e.length}),children:r("roles.addRole")})]})}})},{key:"prompt",label:"提示词角色 (".concat(s.length,"/").concat(ey.length,")"),children:(0,i.jsx)(o.A.List,{name:"promptRoles",children:(e,l)=>{let{add:n,remove:t}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[(0,i.jsx)(d.A,{size:"small",title:"已选提示词角色",style:{background:"var(--colorFillQuaternary)"},children:eR(s,"prompt")}),0===e.length&&(0,i.jsx)(c.A,{description:"暂未添加提示词角色"}),e.map((e,l)=>(0,i.jsxs)(d.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsxs)("div",{style:{position:"absolute",top:-10,left:12,background:"#722ed1",color:"#fff",fontSize:11,fontWeight:700,padding:"1px 8px",borderRadius:10},children:["#",l+1]}),(0,i.jsx)(p.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(F.A,{}),onClick:()=>t(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsxs)(g.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,i.jsxs)(j.A,{flex:"auto",children:[(0,i.jsx)(o.A.Item,{name:[e.name,"roleId"],label:"提示词角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(h.A,{placeholder:"选择提示词角色",size:"small",options:ey.map(e=>{var l;return{label:"".concat(e.name," (").concat(r(Q[null!=(l=e.executionType)?l:""]||"roles.reference"),")"),value:e.id}})})}),(0,i.jsx)(o.A.Item,{noStyle:!0,shouldUpdate:!0,children:l=>{let{getFieldValue:r}=l;return ek(eI(r(["promptRoles",e.name,"roleId"])))}})]}),(0,i.jsx)(j.A,{style:{width:90},children:(0,i.jsx)(o.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(f.A,{type:"number",size:"small"})})})]})]},e.key)),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(E.A,{}),onClick:()=>n({order:e.length}),children:r("roles.addRole")})]})}})}]})}})]})})]})}}},e=>{e.O(0,[433,787,576,195,797,192,636,593,792],()=>e(e.s=23507)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{16403:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return r(19562)}])},19562:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>ec});var l=r(65321),n=r(97109),s=r(7576),i=r(35292),o=r(33442),a=r(11702),c=r(17807),d=r(63455),u=r(88762),p=r(85114),h=r(68787),m=r(84253),g=r(38332),x=r(26171),f=r(34052),j=r(42700),v=r(58569),y=r(2256),w=r(38770),A=r(76506),S=r(57271),b=r(49604),k=r(23216),I=r(26619),C=r(8263),z=r(16285),T=r(8579),R=r(75548),E=r(7851),M=r(84742),B=r(29071),_=r(63552),D=r(26631),F=r(29606),P=r(83914),L=r(58209),W=r(54746),G=r(71330),N=r(64068),O=r(93051),H=r(38762),q=r(64629),K=r(67547),V=r(76830),U=r(1310),X=r(6578),Q=r(44494);let{TextArea:J}=s.A,{Text:Y}=i.A;function Z(e){let{type:t="info",title:r,children:n,style:s}=e,i="error"===t?"var(--colorError)":"warning"===t?"var(--colorWarning)":"success"===t?"var(--colorSuccess)":"var(--colorInfo)";return(0,l.jsxs)("div",{style:{border:"1px solid ".concat(i),background:"error"===t?"var(--colorErrorBg)":"warning"===t?"var(--colorWarningBg)":"success"===t?"var(--colorSuccessBg)":"var(--colorInfoBg)",borderRadius:8,padding:"9px 12px",...s},children:[(0,l.jsx)(Y,{strong:!0,style:{color:i},children:r}),n&&(0,l.jsx)("div",{style:{marginTop:4,color:"var(--colorTextSecondary)",fontSize:12},children:n})]})}function $(e){let{children:t,gap:r=12,style:n}=e;return(0,l.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:r,...n},children:t})}let ee=null;function et(){null==ee||ee.listeners.forEach(e=>e())}let er={role_binding:(0,l.jsx)(k.A,{}),knowledge_retrieval:(0,l.jsx)(I.A,{}),file_understanding:(0,l.jsx)(C.A,{}),fact_extraction:(0,l.jsx)(z.A,{}),chapter_generation:(0,l.jsx)(T.A,{}),asset_generation:(0,l.jsx)(R.A,{}),validation:(0,l.jsx)(E.A,{}),formatting:(0,l.jsx)(M.A,{}),llm_review:(0,l.jsx)(B.A,{}),export_ready:(0,l.jsx)(_.A,{}),reference:(0,l.jsx)(R.A,{})},el={施工组织设计:(0,l.jsx)(E.A,{}),投标文件:(0,l.jsx)(_.A,{}),技术方案:(0,l.jsx)(z.A,{}),报告:(0,l.jsx)(D.A,{}),自定义:(0,l.jsx)(T.A,{})};function en(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function es(e){return e?e.split(/[\\/]/u).pop()||e:""}function ei(e){let t=[],r=e=>{for(let l of e)l.isFolder?l.children&&r(l.children):t.push(l.key)};return r(e),t}let eo={role_binding:"角色配置绑定",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",asset_generation:"多模态资源生成",validation:"规则校验",formatting:"格式化排版",llm_review:"LLM 审查优化",export_ready:"导出就绪",reference:"参考资源处理"},ea={"knowledge-base":"知识库","document-readiness":"生成准备度检查","quality-repair":"质量补写","export-gate":"导出门禁","context-memory":"项目上下文","final-format":"正式排版","multimodal-files":"多模态文件理解",tender_announcement:"招标公告"};function ec(){var e,t,r,i,R;let ec=(0,Q.Vr)(),{message:ed}=c.A.useApp(),[eu]=d.A.useForm(),ep=(0,n.useRef)(null),[eh,em]=(0,n.useState)([]),[eg,ex]=(0,n.useState)("construction-organization-design"),[ef,ej]=(0,n.useState)([]),[ev,ey]=(0,n.useState)([]),[ew,eA]=(0,n.useState)([]),[eS,eb]=(0,n.useState)([]),[ek,eI]=(0,n.useState)(!1),[eC,ez]=(0,n.useState)(""),[eT,eR]=(0,n.useState)(),[eE,eM]=(0,n.useState)([]),[eB,e_]=(0,n.useState)(!0),[eD,eF]=(0,n.useState)(!1),[eP,eL]=(0,n.useState)(null),[eW,eG]=(0,n.useState)(""),[eN,eO]=(0,n.useState)([]),[eH,eq]=(0,n.useState)(null),[eK,eV]=(0,n.useState)(null),[eU,eX]=(0,n.useState)(""),[eQ,eJ]=(0,n.useState)(!1),[eY,eZ]=(0,n.useState)("idle"),[e$,e0]=(0,n.useState)(null),[e1,e2]=(0,n.useState)(null),[e6,e8]=(0,n.useState)({start:0,end:0}),[e4,e3]=(0,n.useState)([]),[e7,e5]=(0,n.useState)(!1),[e9,te]=(0,n.useState)(!1),[tt,tr]=(0,n.useState)({}),tl=d.A.useWatch("projectRoleConfigId",eu),tn=(0,n.useMemo)(()=>ev.find(e=>e.id===tl),[ev,tl]),ts=(0,n.useMemo)(()=>new Set(((null==tn?void 0:tn.fileRoles)||[]).map(e=>e.roleId)),[tn]),ti=(0,n.useMemo)(()=>ef.filter(e=>"file"===e.type&&(!tl||ts.has(e.id))).map(e=>({label:e.name,value:e.id})),[ef,ts,tl]),to=(0,n.useMemo)(()=>ti.find(e=>e.value===eT)||ti[0],[eT,ti]),ta=d.A.useWatch("fileBindingGroups",eu)||{},tc=(0,n.useMemo)(()=>(function(e){let t={};for(let n of[...e].sort((e,t)=>e.relativePath.localeCompare(t.relativePath,"zh-CN"))){let e=n.relativePath.split("/").filter(Boolean),s="";for(let i=0;i<e.length;i++){let a=e[i],c=s;s=s?"".concat(s,"/").concat(a):a;let d=i===e.length-1;if(!t[s]){var r;t[s]={key:s,rawTitle:a,title:d?(0,l.jsx)("span",{title:n.relativePath,children:a}):(0,l.jsxs)(o.A,{size:4,children:[(0,l.jsx)(F.A,{style:{color:"#faad14"}}),(0,l.jsx)("span",{children:a})]}),isFolder:!d,fileCount:+!!d,...d?{}:{children:[]}},c&&(null==(r=t[c])?void 0:r.children)&&t[c].children.push(t[s])}d&&(t[s].fileCount=1)}}let n=e=>{for(let r of e){var t;(null==(t=r.children)?void 0:t.length)&&(n(r.children),r.fileCount=r.children.reduce((e,t)=>e+t.fileCount,0),r.title=(0,l.jsxs)(o.A,{size:4,children:[(0,l.jsx)(F.A,{style:{color:"#faad14"}}),(0,l.jsx)("span",{children:r.rawTitle}),(0,l.jsx)(a.A,{style:{margin:0},children:r.fileCount})]}))}},s=Object.values(t).filter(e=>!e.key.includes("/"));return n(s),s.filter(e=>!e.isFolder||e.fileCount>0)})(eS),[eS]),td=(0,n.useMemo)(()=>(function e(t,r){let l=r.trim().toLowerCase();return l?t.flatMap(t=>{let r=t.children?e(t.children,l):void 0;return t.key.toLowerCase().includes(l)||t.rawTitle.toLowerCase().includes(l)||(null==r?void 0:r.length)?[{...t,children:r}]:[]}):t})(tc,eC),[tc,eC]),tu=(0,n.useMemo)(()=>ei(tc),[tc]),tp=(0,n.useMemo)(()=>{var e,t,r;return(null==(e=ew.find(e=>e.selected))?void 0:e.projectRoot)||(null==(t=ew.find(e=>e.isCurrent))?void 0:t.projectRoot)||(null==(r=ew[0])?void 0:r.projectRoot)||""},[ew]),th=(0,n.useMemo)(()=>{let e=[],t=r=>{for(let l of r)e.push(l.key),l.children&&t(l.children)};return t(tc),e},[tc]);(0,n.useEffect)(()=>{if(!e9||!tl)return;let e=eu.getFieldValue("fileBindingGroups")||{},t=Object.fromEntries(Object.entries(e).filter(e=>{let[t]=e;return ts.has(t)}));Object.keys(t).length!==Object.keys(e).length&&eu.setFieldValue("fileBindingGroups",t)},[eu,ts,tl,e9]),(0,n.useEffect)(()=>{if(e9){if(0===ti.length)return void eR(void 0);eT&&ti.some(e=>e.value===eT)||eR(ti[0].value)}},[eT,ti,e9]);let[tm,tg]=(0,n.useState)([]),[tx,tf]=(0,n.useState)(null),[tj,tv]=(0,n.useState)(null),[ty,tw]=(0,n.useState)("templates"),[tA,tS]=(0,n.useState)(!1),[tb,tk]=(0,n.useState)("workflow"),tI=(0,n.useRef)(null),tC=(0,n.useRef)(null),tz=(0,n.useRef)(0),tT=(0,n.useMemo)(()=>"activeGenDocId:".concat(tp||"default"),[tp]),tR=async()=>{try{eO((await (0,X.cQ)(tp||void 0)).documents)}catch(e){eO([])}};(0,n.useEffect)(()=>{let e=()=>{ee&&(tg(ee.flowSteps),tf(ee.activeFlowKey),eF(ee.loading),ee.documentId&&eq(ee.documentId),ee.draft&&eL(ee.draft),void 0!==ee.content&&eG(ee.content))},t=ee;return null==t||t.listeners.add(e),e(),()=>{null==t||t.listeners.delete(e)}},[]),(0,n.useEffect)(()=>{e_(!0),Promise.all([(0,X.Dl)().then(e=>{var t,r;em(e.templates),ex(null!=(r=null==(t=e.templates[0])?void 0:t.id)?r:"construction-organization-design")}),(0,X.lv)().then(e=>{ej(e.roles),ey(e.configs)}),(0,X.dx)().then(e=>eA(e))]).catch(()=>ed.error(ec("common.error"))).finally(()=>e_(!1))},[ed,ec]),(0,n.useEffect)(()=>{tp&&(localStorage.removeItem("activeGenDocId"),tR())},[tp]),(0,n.useEffect)(()=>{if(0===eN.length)return;let e=localStorage.getItem(tT);if(!e)return;if(!eN.find(t=>t.id===e&&"generating"===t.status))return void localStorage.removeItem(tT);let t=setInterval(()=>{(async()=>{try{let{document:r}=await (0,X.v7)(e,!1,tp||void 0);await tR(),"generating"!==r.status&&(localStorage.removeItem(tT),clearInterval(t))}catch(e){clearInterval(t)}})()},3e3);return()=>clearInterval(t)},[eN]);let tE=(0,n.useMemo)(()=>eh.find(e=>e.id===eg),[eh,eg]),tM=ev.map(e=>({label:e.name,value:e.id})),tB=Math.max(0,tm.findIndex(e=>e.key===tx)),t_=e=>{var t;return e?(null==(t=ef.find(t=>t.id===e))?void 0:t.name)||ea[e]||"未知角色":""},tD=e=>e.subtitle||e.roleName||t_(e.roleId)||eo[e.type]||e.type,tF=e=>{var t,r,l;return e.promptName||((t=e.promptId)?(null==(r=ew.find(e=>e.id===t))?void 0:r.projectName)||(null==(l=ef.find(e=>e.id===t))?void 0:l.name)||ea[t]||"未知提示词":"")},tP=()=>{tz.current+=1,eX(""),e0(null),e2(null),e3([]),e5(!1),eJ(!1),eZ("idle")},tL=e=>{ex(e),eq(null),eL(null),eG(""),tP(),tk("workflow"),tS(!0),tw("drafts")},tW=async e=>{eq(e.id),ex(e.templateId);let t=tG(e.status);if(t||"failed"===e.status||"aborted"===e.status){tP(),tv(e),eL(null),eG(""),eF(t),tk("workflow"),tS(!0);try{let{document:t}=await (0,X.v7)(e.id,!1,e.projectRoot||tp||void 0);tH(t),tG(t.status)?tq(t.id,t.projectRoot||e.projectRoot||tp||void 0):await tR()}catch(t){tH(e)}return}tk("editor"),tg([]),tf(null),tP();try{let{document:t}=await (0,X.v7)(e.id,!1,e.projectRoot||tp||void 0);eL(t.draft||null),eG(t.editedMarkdown||t.markdown)}catch(e){ed.error(ec("common.error"))}tS(!0)},tG=e=>"completed"!==e&&"warning"!==e&&"failed"!==e&&"aborted"!==e,tN=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:eD;(null==ee?void 0:ee.loading)&&(ee.flowSteps=e,ee.activeFlowKey=t,ee.loading=r,et())},tO=e=>{var t,r,n,s,i;let o=e.executionStages||(null==(t=e.draft)?void 0:t.executionStages)||[];if(o.length>0){let t=o.map((t,r)=>{var n;let s,i=("failed"===e.status||"aborted"===e.status)&&"running"===t.status||"failed"===(s=t.status)?"error":"running"===s?"process":"fallback"===s?"warning":"finish";return{key:"".concat(t.type,"-").concat(r),title:t.title||eo[t.type]||t.type,subtitle:tD(t),description:t.message||"",status:i,icon:"role_binding"===(n=t.type)?(0,l.jsx)(k.A,{}):"knowledge_retrieval"===n?(0,l.jsx)(I.A,{}):"file_understanding"===n?(0,l.jsx)(C.A,{}):"fact_extraction"===n?(0,l.jsx)(z.A,{}):"chapter_generation"===n?(0,l.jsx)(T.A,{}):"llm_review"===n?(0,l.jsx)(B.A,{}):"validation"===n?(0,l.jsx)(E.A,{}):"formatting"===n?(0,l.jsx)(M.A,{}):"export_ready"===n?(0,l.jsx)(_.A,{}):(0,l.jsx)(D.A,{}),subSteps:((e,t,r)=>{let l=Array.isArray(e.details)?e.details.filter(Boolean):[],n=e.progress?"".concat(e.progress.label||"进度",":").concat(e.progress.current,"/").concat(e.progress.total):"",s=[...n?[n]:[],...l];return 0===s.length?[{key:"stage-".concat(r),title:tF(e)?"提示词:".concat(tF(e)):tD(e),status:t}]:s.slice(0,8).map((e,l)=>({key:"stage-".concat(r,"-").concat(l),title:e,status:"process"===t&&0===l?"process":"error"===t&&0===l?"error":"warning"===t?"warning":"process"===t?"finish":t}))})(t,i,r)}});"generating"===e.status&&t.length>0&&(null==(r=t.at(-1))?void 0:r.status)==="finish"&&(t[t.length-1]={...t[t.length-1],status:"process"});let a="generating"===e.status?(null==(n=t.at(-1))?void 0:n.key)||"prepare":"failed"===e.status||"aborted"===e.status?(null==(s=t.find(e=>"error"===e.status))?void 0:s.key)||(null==(i=t.at(-1))?void 0:i.key)||"prepare":"done";return{steps:t,activeKey:a}}return{steps:[],activeKey:null}},tH=e=>{tv(e);let{steps:t,activeKey:r}=tO(e);tg(t),tf(r),eF(tG(e.status)),tN(t,r,tG(e.status)),("failed"===e.status||"aborted"===e.status)&&tk("workflow"),("completed"===e.status||"warning"===e.status)&&e.draft&&(eL(e.draft),eG(e.editedMarkdown||e.markdown),tk("editor"),tg([]),tf(null))},tq=(e,t)=>{tI.current&&clearInterval(tI.current),tI.current=setInterval(()=>{(async()=>{try{let{document:r}=await (0,X.v7)(e,!0,t||tp||void 0);tH(r),await tR(),tG(r.status)||(tI.current&&clearInterval(tI.current),tI.current=null,localStorage.removeItem(tT))}catch(e){}})()},2e3)};(0,n.useEffect)(()=>()=>{tI.current&&(clearInterval(tI.current),tI.current=null),tC.current&&(clearTimeout(tC.current),tC.current=null)},[]),(0,n.useEffect)(()=>{if(!eD||!tx)return;let e=window.setInterval(()=>tg(e=>{let t=e.map(e=>{if(e.key!==tx||"process"!==e.status)return e;let t=e.subSteps.findIndex(e=>"process"===e.status),r=t<0?0:Math.min(t+1,e.subSteps.length-1);return{...e,subSteps:e.subSteps.map((e,t)=>t<r?{...e,status:"finish"}:t===r?{...e,status:"process"}:{...e,status:"wait"})}});return tN(t,tx),t}),1400);return()=>window.clearInterval(e)},[tx,eD]);let tK=async()=>{eI(!0);try{let e=await (0,X.HT)({limit:5e3,projectRoot:tp||void 0});eb(e.files)}catch(e){ed.error("知识库文件加载失败")}finally{eI(!1)}},tV=e=>{var t,r,l;let n=null!=e?e:{id:"tpl-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,chapters:[],fileBindings:[]};eu.resetFields(),eu.setFieldsValue({...n,fileBindingGroups:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.reduce((e,t)=>(t.roleId&&t.filePath&&(e[t.roleId]=en([...e[t.roleId]||[],t.filePath])),e),{})}(n.fileBindings)}),eR(null==(l=ev.find(e=>e.id===n.projectRoleConfigId))||null==(r=l.fileRoles)||null==(t=r[0])?void 0:t.roleId),ez(""),tK(),te(!0)},tU=(e,t)=>{let r=eu.getFieldValue("fileBindingGroups")||{};eu.setFieldValue("fileBindingGroups",{...r,[e]:en(t)})},tX=async()=>{try{var e;await eu.validateFields();let t=eu.getFieldsValue(!0),r=new Set(((null==(e=ev.find(e=>e.id===t.projectRoleConfigId))?void 0:e.fileRoles)||[]).map(e=>e.roleId)),l=t.fileBindingGroups||{},n=Object.entries(l).filter(e=>{let[t]=e;return 0===r.size||r.has(t)}).flatMap(e=>{let[t,r]=e;return en(r||[]).map(e=>({roleId:t,filePath:e}))}),{fileBindingGroups:s,...i}=t,o={...i,chapters:[],fileBindings:n},a=await (0,X.l2)(o);em(a.templates),ex(a.template.id),te(!1),await tR(),ed.success(ec("common.success"))}catch(e){e instanceof Error&&ed.error(e.message)}},tQ=async e=>{try{let t=await (0,X.bV)(e);em(t.templates),ex(t.template.id),ed.success(ec("common.success"))}catch(e){ed.error(ec("common.error"))}},tJ=async e=>{try{var t,r;let l=await (0,X.h0)(e);em(l.templates),ex(null!=(r=null==(t=l.templates[0])?void 0:t.id)?r:""),ed.success(ec("common.success"))}catch(e){ed.error(ec("common.error"))}},tY=async e=>{try{let{validation:t}=await (0,X.SM)(e,tp||void 0);tr(r=>({...r,[e]:t}));let r=t.issues.filter(e=>"error"===e.level);if(ex(e),r.length>0)return void ed.warning("模板运行前检查未通过,请先处理阻断项");if(t.issues.length>0)return void ed.warning("模板存在警告,可在检查面板确认后继续运行");tL(e)}catch(e){ed.error(e instanceof Error?e.message:"模板运行前检查失败")}},tZ=async e=>{try{await (0,X.QG)(e.id,e.projectRoot||tp||void 0),eH===e.id&&(eq(null),eL(null),eG("")),await tR(),ed.success(ec("common.success"))}catch(e){ed.error(ec("common.error"))}},t$=async(e,t)=>{let r=Date.now(),l=0,n=Date.now();for(;;){let s;if(null==t?void 0:t.aborted)throw Error("用户中止");let i=new AbortController;t&&(t.pollController=i);try{({document:s}=await (0,X.v7)(e,!0,tp||void 0,i.signal))}finally{(null==t?void 0:t.pollController)===i&&(t.pollController=void 0)}if(tH(s),s.updatedAt!==l&&(l=s.updatedAt,n=Date.now()),("completed"===s.status||"warning"===s.status)&&s.draft)return s;if("failed"===s.status||"aborted"===s.status)throw Error(s.error||("aborted"===s.status?"生成已中止":"生成失败"));if(Date.now()-r>75e5||Date.now()-n>96e4)throw Error("生成任务疑似卡住,请点击继续生成或重新生成");await new Promise(e=>window.setTimeout(e,1500))}},t0=async()=>{if(!eg)return;if((null==ee?void 0:ee.aborted)&&(ee=null),null==ee?void 0:ee.loading){tg(ee.flowSteps),tf(ee.activeFlowKey),eF(!0);return}if(!tp)return void ed.error("未识别当前项目,请先选择或打开项目后再生成文件");eF(!0);let e=(0,X.OX)({templateId:eg,projectRoot:tp});ee={id:Date.now(),templateId:eg,loading:!0,flowSteps:[],activeFlowKey:null,promise:e,listeners:new Set},tg([]),tf(null);let t=[];try{let r=await e;r.documentId&&(localStorage.setItem(tT,r.documentId),eq(r.documentId),(null==ee?void 0:ee.promise)===e&&(ee.documentId=r.documentId)),await tR();let l=r.documentId?await t$(r.documentId,(null==ee?void 0:ee.promise)===e?ee:void 0):void 0,n=r.draft||(null==l?void 0:l.draft);if(!n)throw Error("生成结果为空");(r.documentId||(null==l?void 0:l.id))&&eq(r.documentId||l.id),t.forEach(e=>window.clearTimeout(e)),eL(n),eG((null==l?void 0:l.editedMarkdown)||(null==l?void 0:l.markdown)||n.markdown),(null==ee?void 0:ee.promise)===e&&(ee.draft=n,ee.content=(null==l?void 0:l.editedMarkdown)||(null==l?void 0:l.markdown)||n.markdown);let s=l||{id:r.documentId||"draft-".concat(Date.now()),templateId:eg,title:n.title,requirement:n.requirement,projectRoot:n.projectRoot||tp,projectId:n.projectId,markdown:n.markdown,status:n.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!n.exportGate.passed?"warning":"completed",draft:n,executionStages:n.executionStages,assets:n.assets||[],createdAt:n.generatedAt,updatedAt:Date.now()},{steps:i}=tO(s);tg(i),tN(i,"done",!1),tf("done"),(null==ee?void 0:ee.promise)===e&&(ee.activeFlowKey="done",ee.loading=!1,et(),ee=null),localStorage.removeItem(tT),await tR(),ed.success(ec("common.success")),window.setTimeout(()=>{var e;return null==(e=ep.current)?void 0:e.scrollIntoView({behavior:"smooth",block:"start"})},200)}catch(l){localStorage.removeItem(tT);let t=l instanceof Error?l.message:ec("common.error"),r=/用户中止|abort|aborted/i.test(t);r||tg(e=>{let r=e.map(e=>"process"===e.status?{...e,status:"error",description:t,subSteps:((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 r=e.subSteps.findIndex(e=>"wait"===e.status);return e.subSteps.map((e,t)=>t<r||-1===r?{...e,status:"finish"}:t===r?{...e,status:"process"}:e)})(e,"error")}:e);return tN(r,tx,!1),r}),(null==ee?void 0:ee.promise)===e&&(ee.loading=!1,ee.error=t,et(),ee=null),await tR().catch(()=>void 0),r||ed.error(t)}finally{t.forEach(e=>window.clearTimeout(e)),eF(!1),(null==ee?void 0:ee.promise)===e&&(ee.loading=!1,et())}},t1=(0,n.useRef)(!1);(0,n.useEffect)(()=>(tC.current&&(clearTimeout(tC.current),tC.current=null),!tA||"workflow"!==tb||eH||t1.current||(null==ee?void 0:ee.loading)||null==tE||!tE.projectRoleConfigId||(t1.current=!0,tC.current=setTimeout(()=>{tC.current=null,tA&&"workflow"===tb&&!eH&&eg==eg&&t0()},300)),tA||(t1.current=!1),()=>{tC.current&&(clearTimeout(tC.current),tC.current=null)}),[tA,tb,eH,tE,eg]);let t2=async e=>{try{eq(e.id),ex(e.templateId),tk("workflow"),tS(!0),eF(!0);let t=await (0,X.UQ)(e.id,e.projectRoot||tp||void 0);localStorage.setItem(tT,t.documentId),await tR();let r=await t$(t.documentId);r.draft&&(eL(r.draft),eG(r.editedMarkdown||r.markdown||r.draft.markdown),tk("editor")),localStorage.removeItem(tT),await tR(),ed.success("已继续生成并完成")}catch(e){ed.error(e instanceof Error?e.message:"继续生成失败")}finally{eF(!1)}},t6=async e=>{if((null==ee?void 0:ee.loading)&&ee.documentId===e.id){var t;ee.aborted=!0,null==(t=ee.pollController)||t.abort(),ee.loading=!1,ee.error="用户中止",et(),ee=null,eF(!1)}localStorage.removeItem(tT),tI.current&&(clearInterval(tI.current),tI.current=null);try{await (0,X.r)(e.id,e.projectRoot||tp||void 0),ed.success("已中止生成任务")}catch(e){ed.info("任务已不在运行,已刷新状态")}finally{await tR(),eH===e.id&&(eq(null),tv(null),eL(null),eG(""))}},t8=async e=>{if(eP){eV(e);try{eP.exportGate.passed||ed.warning("导出门禁存在风险项,已允许导出,请下载后人工复核。");let t={documentId:eH||void 0,title:eP.title,markdown:eW,format:e,enforceGate:!1,exportGate:eP.exportGate,useClientMarkdown:!0,projectRoot:eP.projectRoot||tp||void 0},r=await (0,X.UE)(t);((e,t,r)=>{let l=new Blob([e],{type:r}),n=URL.createObjectURL(l),s=document.createElement("a");s.href=n,s.download=t,s.target="_self",s.rel="noopener",s.style.display="none",document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),s.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)})(r,"".concat(eP.title,".").concat("markdown"===e?"md":e),{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){ed.error(e instanceof Error?e.message:ec("common.error"))}finally{eV(null)}}},t4=async()=>{if(eP)try{if(eH)await (0,X.a6)(eH,{editedMarkdown:eW,markdown:eW},eP.projectRoot||tp||void 0);else{let e=await (0,X.Af)({...eP,markdown:eW});eL(e.draft)}await tR(),ed.success(ec("common.success"))}catch(e){ed.error(ec("common.error"))}},t3=(e,t)=>{e3(r=>[{id:"".concat(Date.now()),content:e,prompt:t,createdAt:Date.now()},...r].slice(0,12))},t7=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&eX(""),e0(null),e2(null),e8({start:0,end:0})},t5=(e,t)=>{var r,l;return{title:(null==eP?void 0:eP.title)||"未命名文档",markdown:t,instruction:e,facts:null==eP||null==(r=eP.structuredFacts)?void 0:r.map(e=>"".concat(e.key,": ").concat(e.value)),chapters:null==eP||null==(l=eP.chapters)?void 0:l.map(e=>e.title),...(()=>{let e=e6.start,t=e6.end;return t>e?{selection:{start:e,end:t,text:eW.slice(e,t)},cursorOffset:e}:{cursorOffset:e}})()}},t9=async()=>{let e=eU.trim();if(!eP||!e||eQ)return;let t=tz.current+1;tz.current=t,eJ(!0),eZ("planning"),e2(null);try{let r=await (0,X.Gi)({mode:"plan",...t5(e,eW)});if(tz.current!==t||eH!=eH)return;if(!r.plan)throw Error("AI 未返回修改计划");e0(r.plan)}catch(e){tz.current===t&&ed.error(e instanceof Error?e.message:ec("common.error"))}finally{tz.current===t&&(eJ(!1),eZ("idle"))}},re=async e=>{let t=eU.trim();if(!eP||!t||eQ)return;let r=tz.current+1;tz.current=r,eJ(!0),eZ("applying");try{let l=await (0,X.Gi)({mode:"apply",...t5(t,eW),plan:e});if(tz.current!==r||eH!=eH)return;if(!l.markdown)throw Error("AI 未返回修改结果");e2({plan:l.plan||e,markdown:l.markdown,beforeSnippet:l.beforeSnippet,afterSnippet:l.afterSnippet,summary:l.summary,changedChars:l.changedChars,prompt:t,before:eW})}catch(e){tz.current===r&&ed.error(e instanceof Error?e.message:ec("common.error"))}finally{tz.current===r&&(eJ(!1),eZ("idle"))}};if(eB)return(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsx)(u.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,l.jsx)(u.A,{active:!0,paragraph:{rows:2}}),(0,l.jsx)(u.A,{active:!0,paragraph:{rows:8}})]});let rt="workflow"===tb?"工作流:".concat((null==tE?void 0:tE.name)||"选择模板"):"编辑:".concat((null==eP?void 0:eP.title)||(null==tE?void 0:tE.outputTitle)||"文档");return(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"pageTitle",children:ec("documents.title")}),(0,l.jsx)("p",{className:"pageDesc",children:ec("documents.description")})]}),(0,l.jsx)(p.Ay,{type:"primary",icon:(0,l.jsx)(W.A,{}),onClick:()=>tV(),children:ec("documents.newTemplate")})]}),(0,l.jsx)(h.A,{size:"small",tabList:[{key:"templates",label:"模板库 (".concat(eh.length,")")},{key:"drafts",label:"生成记录 (".concat(eN.length,")")}],activeTabKey:ty,onTabChange:tw,children:"templates"===ty?0===eh.length?(0,l.jsx)(m.A,{description:ec("common.noData")}):(0,l.jsx)(g.A,{dataSource:eh,renderItem:e=>{var t,r;return(0,l.jsx)(g.A.Item,{style:{cursor:"pointer",padding:"10px 0"},actions:[(0,l.jsx)(p.Ay,{size:"small",icon:(0,l.jsx)(G.A,{}),onClick:t=>{t.stopPropagation(),tV(e)},children:"配置"},"cfg"),(0,l.jsx)(p.Ay,{size:"small",type:"primary",icon:(0,l.jsx)(N.A,{}),onClick:t=>{t.stopPropagation(),tY(e.id)},children:"运行"},"run"),(0,l.jsx)(p.Ay,{size:"small",icon:(0,l.jsx)(O.A,{}),onClick:t=>{t.stopPropagation(),tQ(e.id)}},"copy"),(0,l.jsx)(x.A,{title:ec("documents.deleteTemplateConfirm"),onConfirm:t=>{null==t||t.stopPropagation(),tJ(e.id)},children:(0,l.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,l.jsx)(L.A,{}),onClick:e=>e.stopPropagation()})},"del")],onClick:()=>ex(e.id),children:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[function(e,t){let r=el[e]||(0,l.jsx)(D.A,{});return(0,l.jsx)("span",{style:{color:t?"var(--colorAccent)":"var(--colorTextSecondary)",fontSize:16,marginTop:2,flexShrink:0},children:r})}(e.category,eg===e.id),(0,l.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,l.jsx)("span",{style:{fontWeight:eg===e.id?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),eg===e.id&&(0,l.jsx)(a.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"当前"}),(0,l.jsx)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:e.category}),tt[e.id]&&(0,l.jsxs)(a.A,{color:tt[e.id].issues.some(e=>"error"===e.level)?"error":tt[e.id].issues.length?"warning":"success",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:["检查 ",tt[e.id].fileDiagnostics.length," 文件 / ",tt[e.id].promptDiagnostics.length," 提示词"]})]}),e.description&&(0,l.jsx)(Y,{type:"secondary",style:{fontSize:12,lineHeight:"18px"},children:e.description}),tt[e.id]&&(0,l.jsx)("div",{onClick:e=>e.stopPropagation(),style:{marginTop:8,padding:10,border:"1px solid ".concat(tt[e.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBorder)":tt[e.id].issues.length?"var(--colorWarningBorder)":"var(--colorSuccessBorder)"),borderRadius:10,background:tt[e.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBg)":tt[e.id].issues.length?"var(--colorWarningBg)":"var(--colorSuccessBg)"},children:(0,l.jsxs)($,{gap:6,style:{width:"100%"},children:[(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)(Y,{strong:!0,children:tt[e.id].issues.some(e=>"error"===e.level)?"运行前检查未通过":tt[e.id].issues.length?"运行前检查存在警告":"运行前检查通过"}),(0,l.jsxs)(a.A,{color:"blue",children:["文件角色 ",tt[e.id].fileDiagnostics.length]}),(0,l.jsxs)(a.A,{color:"purple",children:["提示词角色 ",tt[e.id].promptDiagnostics.length]}),tt[e.id].readiness&&(0,l.jsxs)(a.A,{color:tt[e.id].readiness.ready?"green":"error",children:["资料覆盖 ",Math.round(100*tt[e.id].readiness.materialCoverageRate),"%"]}),tt[e.id].readiness&&(0,l.jsxs)(a.A,{color:"cyan",children:["角色满足 ",Math.round(100*tt[e.id].readiness.roleSatisfactionRate),"%"]}),tt[e.id].readiness&&(0,l.jsxs)(a.A,{color:"geekblue",children:["规范完整 ",Math.round(100*tt[e.id].readiness.specCompletenessRate),"%"]})]}),null==(r=tt[e.id].readiness)||null==(t=r.chapterDiagnostics)?void 0:t.filter(e=>e.readinessRate<.7||e.missingFacts.length>0).slice(0,5).map(e=>(0,l.jsx)(Z,{type:e.readinessRate<.5?"warning":"info",title:"章节预检:".concat(e.title," \xb7 覆盖 ").concat(Math.round(100*e.readinessRate),"% \xb7 证据 ").concat(e.evidenceCount," 条").concat(e.missingFacts.length?" \xb7 缺失 ".concat(e.missingFacts.slice(0,4).join("、")):"")},e.chapterId)),tt[e.id].issues.length>0?tt[e.id].issues.map(e=>(0,l.jsx)(Z,{type:"error"===e.level?"error":"warning",title:e.message},e.message)):(0,l.jsx)(Z,{type:"success",title:"文件角色、提示词角色和后台自动规范检查通过,可以运行。"}),!tt[e.id].issues.some(e=>"error"===e.level)&&tt[e.id].issues.length>0&&(0,l.jsx)("div",{children:(0,l.jsx)(p.Ay,{size:"small",type:"primary",icon:(0,l.jsx)(N.A,{}),onClick:()=>tL(e.id),children:"忽略警告并继续运行"})})]})})]})]})})}}):0===eN.length?(0,l.jsx)(m.A,{description:ec("common.noData")}):(0,l.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:eN.slice(0,15).map((e,t)=>{var r,n,s,i,c;let d,u;return(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,padding:"10px 12px",border:"1px solid var(--colorBorderSecondary)",borderRadius:10,cursor:"pointer",background:eH===e.id?"var(--colorFillAlter)":void 0,minWidth:0},onClick:()=>{tW(e)},children:["completed"===e.status?(0,l.jsx)(M.A,{style:{fontSize:18,color:"var(--colorOk)",flexShrink:0,marginTop:2}}):"failed"===e.status||"aborted"===e.status?(0,l.jsx)(H.A,{style:{fontSize:18,color:"var(--colorDanger)",flexShrink:0,marginTop:2}}):"warning"===e.status?(0,l.jsx)(E.A,{style:{fontSize:18,color:"var(--colorWarning)",flexShrink:0,marginTop:2}}):(0,l.jsx)(q.A,{spin:!0,style:{fontSize:18,color:"#1677ff",flexShrink:0,marginTop:2}}),(0,l.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,l.jsx)("div",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:3},children:e.title}),(0,l.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px 10px",color:"var(--colorTextSecondary)",fontSize:11},children:[(0,l.jsx)("span",{children:new Date(e.updatedAt).toLocaleString()}),(0,l.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 r=Math.floor(t/60),l=t%60;if(r<60)return l?"".concat(r," 分 ").concat(l," 秒"):"".concat(r," 分");let n=Math.floor(r/60),s=r%60;return s?"".concat(n," 小时 ").concat(s," 分"):"".concat(n," 小时")})(e)]})]}),e.partialChapters&&e.partialChapters.length>0&&(0,l.jsxs)("div",{style:{marginTop:3,fontSize:11,color:"var(--colorTextSecondary)"},children:["已完成章节 ",e.partialChapters.filter(e=>"completed"===e.status).length,"/",e.partialChapters.length," \xb7 ",e.partialChapters.reduce((e,t)=>e+t.chars,0).toLocaleString()," 字"]}),("warning"===e.status||"failed"===e.status||"aborted"===e.status)&&(0,l.jsx)("div",{style:{marginTop:3,color:"failed"===e.status||"aborted"===e.status?"var(--colorError)":"var(--colorWarning)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.error||(null==(r=e.warningIssues)?void 0:r[0])||(null==(s=e.draft)||null==(n=s.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message)||"需复核"})]}),(0,l.jsxs)(o.A,{size:4,align:"center",children:[(0,l.jsx)(a.A,{color:"completed"===(d=e.status)?"success":"warning"===d?"warning":"failed"===d?"error":"aborted"===d?"default":"processing",style:{margin:0,fontSize:10,lineHeight:"18px"},children:"completed"===(u=e.status)?"已完成":"warning"===u?"需复核":"failed"===u?"失败":"aborted"===u?"已中止":"生成中"}),(0,l.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"18px"},children:["#",t+1]}),(0,l.jsx)(x.A,{title:"确认删除?",onConfirm:t=>{null==t||t.stopPropagation(),tZ(e)},children:(0,l.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,l.jsx)(L.A,{}),onClick:e=>e.stopPropagation()})}),tG(e.status)&&(0,l.jsx)(x.A,{title:"确定中止此生成任务?",onConfirm:t=>{null==t||t.stopPropagation(),t6(e)},children:(0,l.jsx)(p.Ay,{size:"small",danger:!0,onClick:e=>e.stopPropagation(),children:"中止"})}),("failed"===e.status||"aborted"===e.status||"warning"===e.status&&!!(null==(i=e.checkpointChapters)?void 0:i.length)&&/继续生成|重新生成|中断|卡住|未完成/u.test(e.error||(null==(c=e.warningIssues)?void 0:c.join(";"))||""))&&(0,l.jsx)(p.Ay,{size:"small",onClick:t=>{t.stopPropagation(),t2(e)},children:"继续"}),(0,l.jsx)(p.Ay,{size:"small",type:"primary",icon:tG(e.status)?(0,l.jsx)(q.A,{spin:!0}):(0,l.jsx)(N.A,{}),onClick:t=>{t.stopPropagation(),tW(e)},children:"打开"})]})]},e.id)})})}),(0,l.jsx)(f.A,{title:rt,open:tA,onClose:()=>{tS(!1),tI.current&&(clearInterval(tI.current),tI.current=null)},size:800,mask:{closable:!1},style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:eP?(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)(p.Ay,{icon:(0,l.jsx)(K.A,{}),disabled:eQ,onClick:()=>{t4()},children:ec("documents.saveDraft")}),(0,l.jsx)(p.Ay,{icon:(0,l.jsx)(V.A,{}),disabled:eQ,loading:"markdown"===eK,onClick:()=>{t8("markdown")},children:"MD"}),(0,l.jsx)(p.Ay,{disabled:eQ,loading:"html"===eK,onClick:()=>{t8("html")},children:"HTML"}),(0,l.jsx)(p.Ay,{disabled:eQ,loading:"docx"===eK,onClick:()=>{t8("docx")},children:"DOCX"}),(0,l.jsx)(p.Ay,{type:"primary",disabled:eQ,loading:"pdf"===eK,onClick:()=>{t8("pdf")},children:"PDF"})]}):eD&&"workflow"===tb?(0,l.jsx)(p.Ay,{danger:!0,onClick:()=>{(async()=>{if(eH&&await (0,X.r)(eH,tp||void 0).catch(()=>void 0),ee){var e;ee.aborted=!0,null==(e=ee.pollController)||e.abort(),ee.loading=!1,ee.error="用户中止",et(),ee=null}localStorage.removeItem(tT),tI.current&&(clearInterval(tI.current),tI.current=null),eF(!1),tg([]),tf(null),tS(!1),await tR(),ed.info("已中止生成任务")})()},children:"中止任务"}):void 0,children:(0,l.jsxs)($,{style:{width:"100%"},gap:16,children:["workflow"===tb&&tm.length>0&&(0,l.jsx)($,{gap:10,children:tm.map((e,t)=>{let r;return(0,l.jsxs)("div",{style:{display:"flex",gap:10,padding:10,border:"1px solid var(--colorBorderSecondary)",borderRadius:10,background:t===tB?"var(--colorFillAlter)":"var(--colorBgContainer)"},children:[(0,l.jsx)("span",{children:"process"===e.status?(0,l.jsx)(P.A,{}):"warning"===e.status?(0,l.jsx)(E.A,{style:{color:"var(--colorWarning)"}}):e.icon}),(0,l.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)(Y,{strong:!0,children:e.title}),(0,l.jsx)(a.A,{color:"finish"===e.status?"success":"error"===e.status?"error":"warning"===e.status?"warning":"process"===e.status?"processing":"default",children:"warning"===(r=e.status)?"finish":r})]}),(0,l.jsx)("div",{style:{marginTop:4,color:"var(--colorTextSecondary)",fontSize:12,whiteSpace:"pre-wrap"},children:(0,l.jsxs)("div",{children:[e.subtitle&&(0,l.jsx)("div",{style:{marginBottom:4},children:(0,l.jsx)(a.A,{children:e.subtitle})}),(0,l.jsx)("div",{children:e.description}),(0,l.jsx)("div",{style:{marginTop:4},children:e.subSteps.map(e=>{var t;return(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:12,color:"process"===e.status?"var(--colorPrimary)":"var(--colorTextSecondary)"},children:["process"===(t=e.status)?(0,l.jsx)(P.A,{}):"finish"===t?(0,l.jsx)(M.A,{}):"warning"===t?(0,l.jsx)(E.A,{style:{color:"var(--colorWarning)"}}):"error"===t?(0,l.jsx)(L.A,{}):(0,l.jsx)("span",{style:{display:"inline-block",height:6,width:6,borderRadius:"50%",background:"var(--colorTextTertiary)"}}),(0,l.jsx)("span",{children:e.title})]},e.key)})})]})})]})]},e.key)})}),"workflow"===tb&&(null==tj?void 0:tj.partialChapters)&&tj.partialChapters.length>0&&(0,l.jsx)(h.A,{size:"small",title:"章节进度",extra:(0,l.jsxs)(a.A,{color:"blue",children:[tj.partialChapters.filter(e=>"completed"===e.status).length,"/",tj.partialChapters.length]}),children:(0,l.jsx)($,{gap:6,style:{width:"100%"},children:tj.partialChapters.map(e=>(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,fontSize:12},children:[(0,l.jsx)(Y,{ellipsis:!0,style:{maxWidth:480},children:e.title}),(0,l.jsxs)(o.A,{size:6,children:[(0,l.jsx)(a.A,{color:"failed"===e.status?"error":"success",children:"failed"===e.status?"失败":"完成"}),(0,l.jsxs)(Y,{type:"secondary",children:[e.chars.toLocaleString()," 字"]})]})]},e.id))})}),"workflow"===tb&&(null==tj||null==(e=tj.reviewMetadata)?void 0:e.diagnostics)&&(0,l.jsx)(Z,{type:"info",title:"后台自动优化",children:"策略:".concat(tj.reviewMetadata.diagnostics.strategy.mode,";LLM 调用 ").concat(tj.reviewMetadata.diagnostics.llm.calls," 次;噪声过滤 ").concat((null==(t=tj.reviewMetadata.diagnostics.evidence)?void 0:t.filteredNoise)||0," 条;质量门禁 阻断").concat((null==(r=tj.reviewMetadata.diagnostics.quality)?void 0:r.blockingCount)||0,"/重要").concat((null==(i=tj.reviewMetadata.diagnostics.quality)?void 0:i.importantCount)||0,"/轻微").concat((null==(R=tj.reviewMetadata.diagnostics.quality)?void 0:R.minorCount)||0,";自动限流调整 ").concat(tj.reviewMetadata.diagnostics.llm.limitAdjustments," 次。审查与诊断信息仅用于系统修复,不会写入正文或导出文件。")}),"workflow"===tb&&eD&&0===tm.length&&(0,l.jsxs)("div",{style:{textAlign:"center",padding:40},children:[(0,l.jsx)(j.A,{}),(0,l.jsx)("div",{style:{marginTop:12,color:"var(--colorTextSecondary)"},children:"正在准备生成…"})]}),eP&&(0,l.jsx)("div",{ref:ep,children:(0,l.jsx)(v.A,{items:[{key:"edit",label:ec("documents.edit"),children:(0,l.jsxs)($,{gap:16,style:{width:"100%"},children:[(0,l.jsx)(J,{rows:28,value:eW,disabled:eQ,onSelect:e=>{var t,r,l;return e8({start:null!=(t=e.currentTarget.selectionStart)?t:0,end:null!=(l=null!=(r=e.currentTarget.selectionEnd)?r:e.currentTarget.selectionStart)?l:0})},onChange:e=>{var t,r,l;eG(e.target.value),e0(null),e2(null),e8({start:null!=(t=e.target.selectionStart)?t:0,end:null!=(l=null!=(r=e.target.selectionEnd)?r:e.target.selectionStart)?l:0})}}),(0,l.jsx)(h.A,{size:"small",style:{borderRadius:12,background:"linear-gradient(135deg, var(--colorFillAlter), var(--colorBgContainer))"},children:(0,l.jsxs)($,{gap:16,style:{width:"100%"},children:[(0,l.jsxs)(o.A,{align:"start",style:{width:"100%",justifyContent:"space-between"},children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)(o.A,{size:6,children:[(0,l.jsx)(B.A,{style:{color:"var(--colorAccent)"}}),(0,l.jsx)(Y,{strong:!0,children:"精准修改"}),(0,l.jsx)(a.A,{color:"blue",children:"AI 辅助"})]}),(0,l.jsx)("div",{style:{marginTop:4,color:"var(--colorTextSecondary)",fontSize:12},children:"针对当前编辑内容补充更具体的要求,AI 会保留文档结构并按你的提示细化修改。"})]}),(0,l.jsxs)(p.Ay,{size:"small",icon:(0,l.jsx)(U.A,{}),onClick:()=>e5(e=>!e),disabled:0===e4.length,children:["历史版本 ",e4.length>0?e4.length:""]})]}),(0,l.jsx)(Z,{type:"info",title:"系统只负责识别修改范围,不改写你的提示词;选中文字后优先只改选区,没有选区时按光标所在小节/章节定位。"}),(0,l.jsx)(J,{rows:4,value:eU,disabled:eQ,onChange:e=>{eX(e.target.value),e0(null),e2(null)},placeholder:"例如:写细一点;润色这段;第七章补充高处作业和临电安全措施;把安全检查频次改成每周一次。"}),(0,l.jsxs)(o.A,{wrap:!0,style:{width:"100%",justifyContent:"space-between"},children:[(0,l.jsx)(o.A,{wrap:!0,children:["写细一点","更专业","只润色选区","补充可执行措施"].map(e=>(0,l.jsx)(p.Ay,{size:"small",disabled:eQ,onClick:()=>eX(t=>t?"".concat(t,";").concat(e):e),children:e},e))}),(0,l.jsx)(p.Ay,{type:"primary",icon:(0,l.jsx)(B.A,{}),loading:eQ&&"planning"===eY,disabled:!eU.trim()||eQ,onClick:()=>{t9()},children:"识别修改范围"})]}),e$&&!e1&&(0,l.jsx)(h.A,{size:"small",style:{borderRadius:10,borderColor:"var(--colorAccent)"},children:(0,l.jsxs)($,{gap:8,style:{width:"100%"},children:[(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)(a.A,{color:"purple",children:e$.scope}),(0,l.jsx)(a.A,{color:"blue",children:e$.action}),(0,l.jsxs)(a.A,{color:e$.confidence>=.8?"green":"orange",children:["置信度 ",Math.round(100*e$.confidence),"%"]}),e$.targetTitle&&(0,l.jsx)(Y,{strong:!0,children:e$.targetTitle})]}),(0,l.jsx)(Y,{children:e$.summary}),(0,l.jsx)(Y,{type:"secondary",style:{fontSize:12},children:"将按你的原始提示词执行,不添加额外编辑任务。"}),(0,l.jsxs)(o.A,{children:[(0,l.jsx)(p.Ay,{type:"primary",loading:eQ&&"applying"===eY,onClick:()=>{re(e$)},children:"执行并预览"}),(0,l.jsx)(p.Ay,{disabled:eQ,onClick:()=>e0(null),children:"取消"})]})]})}),e1&&(0,l.jsx)(h.A,{size:"small",style:{borderRadius:10,borderColor:"var(--colorSuccess)"},children:(0,l.jsxs)($,{gap:8,style:{width:"100%"},children:[(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)(a.A,{color:"green",children:"修改预览"}),(0,l.jsx)(Y,{children:e1.summary||e1.plan.summary}),(0,l.jsxs)(a.A,{children:[e1.changedChars&&e1.changedChars>0?"+".concat(e1.changedChars):e1.changedChars," 字符"]})]}),(0,l.jsxs)(y.A,{gutter:12,children:[(0,l.jsxs)(w.A,{span:12,children:[(0,l.jsx)(Y,{strong:!0,children:"修改前"}),(0,l.jsx)("div",{style:{marginTop:6,maxHeight:180,overflow:"auto",padding:10,borderRadius:8,background:"var(--colorFillAlter)",whiteSpace:"pre-wrap",fontSize:12},children:e1.beforeSnippet||"无片段预览"})]}),(0,l.jsxs)(w.A,{span:12,children:[(0,l.jsx)(Y,{strong:!0,children:"修改后"}),(0,l.jsx)("div",{style:{marginTop:6,maxHeight:180,overflow:"auto",padding:10,borderRadius:8,background:"var(--colorFillAlter)",whiteSpace:"pre-wrap",fontSize:12},children:e1.afterSnippet||"无片段预览"})]})]}),(0,l.jsxs)(o.A,{children:[(0,l.jsx)(p.Ay,{type:"primary",onClick:()=>{e1&&(t3(e1.before,e1.prompt),eG(e1.markdown),t7(!0),ed.success("已应用精准修改"))},children:"应用到文档"}),(0,l.jsx)(p.Ay,{onClick:()=>e2(null),children:"返回计划"}),(0,l.jsx)(p.Ay,{danger:!0,onClick:()=>{e0(null),e2(null)},children:"放弃"})]})]})}),e7&&(0,l.jsx)("div",{style:{borderTop:"1px solid var(--colorBorderSecondary)",paddingTop:12},children:(0,l.jsx)(g.A,{size:"small",dataSource:e4,locale:{emptyText:"暂无历史版本"},renderItem:e=>(0,l.jsx)(g.A.Item,{actions:[(0,l.jsx)(p.Ay,{size:"small",disabled:eQ,onClick:()=>{t3(eW,"恢复前版本"),eG(e.content),t7(!0),ed.success("已恢复历史版本")},children:"恢复"},"restore")],children:(0,l.jsx)(g.A.Item.Meta,{title:(0,l.jsxs)(o.A,{children:[(0,l.jsx)(Y,{children:new Date(e.createdAt).toLocaleString()}),(0,l.jsx)(a.A,{children:e.prompt})]}),description:(0,l.jsx)(Y,{type:"secondary",ellipsis:!0,children:e.content.replace(/\s+/gu," ").slice(0,120)})})})})})]})})]})},{key:"chapters-facts",label:"章节与事实",children:(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[eP.chapters.length>0&&(0,l.jsxs)("div",{children:[(0,l.jsxs)(Y,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["章节 (",eP.chapters.length,")"]}),(0,l.jsx)(g.A,{size:"small",dataSource:eP.chapters,renderItem:e=>(0,l.jsx)(g.A.Item,{children:(0,l.jsx)(g.A.Item.Meta,{title:e.title,description:"证据: ".concat(e.evidence.length," \xb7 缺失: ").concat(e.missingFacts.length)})})})]}),eP.structuredFacts.length>0&&(0,l.jsxs)("div",{children:[(0,l.jsxs)(Y,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["结构化事实 (",eP.structuredFacts.length,")"]}),(0,l.jsx)(A.A,{size:"small",column:1,bordered:!0,children:eP.structuredFacts.map((e,t)=>(0,l.jsxs)(A.A.Item,{label:e.key,children:[(0,l.jsx)("span",{children:e.value}),(0,l.jsx)(a.A,{style:{marginLeft:8},children:e.confidence.toFixed(2)}),(0,l.jsx)(Y,{type:"secondary",style:{fontSize:11,marginLeft:8},children:e.sourceFile})]},t))})]})]})},{key:"sources-missing",label:"来源与缺失",children:(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)(Y,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["引用来源 (",eP.sources.length,")"]}),0===eP.sources.length?(0,l.jsx)(m.A,{description:"暂无"}):(0,l.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:eP.sources.map(e=>(0,l.jsxs)(a.A,{color:"blue",children:[e.filePath," (",e.count,")"]},e.filePath))})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)(Y,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["缺失项 (",eP.missingItems.length,")"]}),0===eP.missingItems.length?(0,l.jsx)(m.A,{description:"无缺失"}):(0,l.jsx)(g.A,{size:"small",dataSource:eP.missingItems,renderItem:e=>(0,l.jsx)(g.A.Item,{children:e})})]})]})},{key:"validation",label:"校验 (".concat(eP.validationIssues.length,")"),children:0===eP.validationIssues.length?(0,l.jsx)(m.A,{description:"校验通过"}):(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[eP.validationIssues.map(e=>(0,l.jsxs)("div",{style:{border:"1px solid var(--colorBorderSecondary)",borderRadius:8,padding:12},children:[(0,l.jsx)(a.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:e.level}),(0,l.jsx)("div",{style:{marginTop:6,whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.message}),e.suggestion&&(0,l.jsx)("div",{style:{marginTop:6,color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all"},children:e.suggestion})]},"".concat(e.level,"-").concat(e.message))),eP.exportGate.checklist.length>0&&(0,l.jsxs)("div",{style:{marginTop:8},children:[(0,l.jsx)(Y,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:"导出门禁"}),(0,l.jsx)(g.A,{size:"small",dataSource:eP.exportGate.checklist,renderItem:e=>(0,l.jsxs)(g.A.Item,{children:[(0,l.jsx)(Y,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.label}),(0,l.jsx)(a.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})]})]})},{key:"stages",label:"执行阶段 (".concat(eP.executionStages.length,")"),children:(0,l.jsx)(g.A,{size:"small",dataSource:eP.executionStages,renderItem:e=>(0,l.jsxs)(g.A.Item,{children:[(0,l.jsx)(g.A.Item.Meta,{avatar:er[e.type]||(0,l.jsx)(D.A,{}),title:(0,l.jsx)(Y,{title:e.roleId,style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:"".concat(eo[e.type]||e.type," \xb7 ").concat(e.roleName||t_(e.roleId))}),description:(0,l.jsx)(Y,{type:"secondary",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})}),(0,l.jsx)(a.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})})}]})})]})}),(0,l.jsx)(f.A,{title:ec("documents.templateEditor"),open:e9,onClose:()=>te(!1),size:860,mask:{closable:!1},styles:{body:{padding:20,overflow:"auto"},header:{borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,l.jsxs)(o.A,{children:[(0,l.jsx)(p.Ay,{onClick:()=>te(!1),children:ec("common.cancel")}),(0,l.jsx)(p.Ay,{type:"primary",onClick:()=>{tX()},children:ec("common.save")})]}),children:(0,l.jsxs)(d.A,{form:eu,layout:"vertical",requiredMark:"optional",children:[(0,l.jsxs)(y.A,{gutter:12,children:[(0,l.jsx)(d.A.Item,{name:"id",hidden:!0,children:(0,l.jsx)(s.A,{})}),(0,l.jsx)(w.A,{xs:24,md:8,children:(0,l.jsx)(d.A.Item,{name:"name",label:ec("documents.templateName"),rules:[{required:!0}],children:(0,l.jsx)(s.A,{})})}),(0,l.jsx)(w.A,{xs:24,md:8,children:(0,l.jsx)(d.A.Item,{name:"category",label:ec("documents.templateCategory"),children:(0,l.jsx)(s.A,{})})}),(0,l.jsx)(w.A,{xs:24,md:8,children:(0,l.jsx)(d.A.Item,{name:"outputTitle",label:ec("documents.outputTitle"),children:(0,l.jsx)(s.A,{})})}),(0,l.jsx)(w.A,{xs:24,md:12,children:(0,l.jsx)(d.A.Item,{name:"description",label:ec("documents.templateDescription"),children:(0,l.jsx)(s.A,{})})})]}),(0,l.jsx)(d.A.Item,{name:"projectRoleConfigId",label:ec("documents.projectRoleConfig"),rules:[{required:!0,message:ec("documents.projectRoleConfigRequired")}],children:(0,l.jsx)(S.A,{showSearch:!0,placeholder:ec("documents.projectRoleConfigRequired"),options:tM})}),(0,l.jsxs)("div",{style:{marginBottom:16},children:[(0,l.jsxs)(o.A,{style:{width:"100%",justifyContent:"space-between",marginBottom:8},children:[(0,l.jsx)(Y,{strong:!0,children:"项目文件绑定"}),(0,l.jsx)(a.A,{color:"blue",children:"按文件角色多选"})]}),(0,l.jsx)(Z,{type:"info",title:"每个文件角色可直接勾选文件或文件夹;勾选文件夹会自动绑定该文件夹下所有文件。保存时仍按具体文件路径绑定,兼容现有模板和生成流程。",style:{marginBottom:12}}),(0,l.jsx)(s.A.Search,{allowClear:!0,placeholder:"搜索文件或文件夹",value:eC,onChange:e=>ez(e.target.value),style:{marginBottom:12}}),ek?(0,l.jsxs)("div",{style:{textAlign:"center",padding:24},children:[(0,l.jsx)(j.A,{}),(0,l.jsx)("div",{style:{marginTop:12,color:"var(--colorTextSecondary)"},children:"正在加载知识库文件…"})]}):0===ti.length?(0,l.jsx)(m.A,{image:m.A.PRESENTED_IMAGE_SIMPLE,description:tl?"当前项目角色未配置文件角色":"请先选择项目角色"}):0===tc.length?(0,l.jsx)(m.A,{image:m.A.PRESENTED_IMAGE_SIMPLE,description:"暂无知识库文件"}):(()=>{let e=null==to?void 0:to.value,t=e?en(ta[e]||[]).filter(e=>tu.includes(e)):[],r=new Set(ei(td));return(0,l.jsxs)(y.A,{gutter:12,children:[(0,l.jsx)(w.A,{xs:24,md:7,children:(0,l.jsx)(h.A,{size:"small",title:"文件角色",bodyStyle:{padding:8,maxHeight:360,overflow:"auto"},children:(0,l.jsx)(o.A,{direction:"vertical",style:{width:"100%"},size:6,children:ti.map(t=>{let r=en(ta[t.value]||[]).filter(e=>tu.includes(e)).length;return(0,l.jsx)(p.Ay,{block:!0,type:t.value===e?"primary":"default",onClick:()=>eR(t.value),style:{textAlign:"left",height:"auto",padding:"6px 8px"},children:(0,l.jsxs)(o.A,{style:{width:"100%",justifyContent:"space-between"},children:[(0,l.jsx)("span",{children:t.label}),(0,l.jsx)(a.A,{color:r>0?"blue":"default",children:r})]})},t.value)})})})}),(0,l.jsx)(w.A,{xs:24,md:17,children:(0,l.jsxs)(h.A,{size:"small",title:(0,l.jsxs)(o.A,{children:[(0,l.jsx)(Y,{children:null==to?void 0:to.label}),(0,l.jsxs)(a.A,{color:"blue",children:["已选 ",t.length]})]}),extra:(0,l.jsx)(p.Ay,{size:"small",disabled:!e||0===t.length,onClick:()=>e&&tU(e,[]),children:"清空"}),children:[e&&(0,l.jsx)(d.A.Item,{name:["fileBindingGroups",e],hidden:!0,children:(0,l.jsx)(s.A,{})}),(0,l.jsx)("div",{style:{marginBottom:8,color:"var(--colorTextSecondary)",fontSize:12},children:t.length>0?t.slice(0,4).map(es).join("、")+(t.length>4?" 等 ".concat(t.length," 个文件"):""):"未选择文件"}),(0,l.jsx)(b.A,{checkable:!0,blockNode:!0,height:360,treeData:td,checkedKeys:t,expandedKeys:eC.trim()?th:eE,onExpand:e=>eM(e),onCheck:(l,n)=>{if(!e)return;let s=new Set(t.filter(e=>!r.has(e)));for(let e of n.checkedNodes)e.isFolder?ei([e]).forEach(e=>s.add(e)):s.add(e.key);tU(e,Array.from(s))}})]})})]})})()]}),(0,l.jsx)(Z,{type:"info",title:"文档规范由后台根据模板、提示词和角色绑定自动生成,无需手动维护规范包。"})]})})]})}}},e=>{e.O(0,[433,787,576,195,375,506,797,621,636,593,792],()=>e(e.s=16403)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[920],{2548:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>w});var i=l(65321),r=l(35292),c=l(68787),n=l(2256),d=l(38770),t=l(11702),x=l(80300),h=l(55122),j=l(15622),a=l(71330),m=l(8579),A=l(66926),o=l(7851),g=l(84742),p=l(44494);let{Paragraph:u,Title:z,Text:N}=r.A,k=[{icon:(0,i.jsx)(a.A,{}),title:"准备阶段",color:"blue",items:["配置模型","上传知识库资料","创建提示词"]},{icon:(0,i.jsx)(m.A,{}),title:"编排阶段",color:"purple",items:["创建文件角色","创建提示词角色","创建项目角色配置并排序"]},{icon:(0,i.jsx)(A.A,{}),title:"生成阶段",color:"processing",items:["创建模板","知识库证据增强","动态执行状态"]},{icon:(0,i.jsx)(o.A,{}),title:"交付阶段",color:"green",items:["检查事实和来源","检查导出门禁","导出正式文件"]}],y=[{title:"第一步:配置模型",goal:"让系统具备 LLM JSON 事实抽取、章节生成、自动规则检查和修复能力。",path:"左侧菜单 → 模型配置",steps:["点击新增供应商,选择 OpenAI、DeepSeek、OpenRouter、Ollama 或其他兼容 OpenAI 协议的服务。","填写 Base URL、API Key、供应商名称并保存。","添加模型名称,建议至少准备一个用于生成和推理的模型。","把模型设置为当前启用模型。","执行健康检查,确认模型可调用。"],checks:["模型健康检查通过","至少有一个启用模型","API Key 和 Base URL 正确"],tips:"如果模型不可用,系统会回退到本地确定性抽取,但事实抽取质量会下降。"},{title:"第二步:上传知识库资料",goal:"把项目资料放入系统,让后续文件角色可以绑定。",path:"左侧菜单 → 知识库 → 文件管理 / 管理",steps:["上传招标文件、工程概况、合同条件、技术要求等项目事实资料。","上传工程量清单、劳动力计划、机械设备计划、材料计划等表格资料。","上传图纸目录、图纸说明、设计说明等图纸类资料。","上传规范、规程、企业标准、评分办法、编制要求等规则类资料。","等待索引完成,并在知识库文件列表中确认文件可见。"],checks:["文件上传成功","索引完成","文件能在文件角色绑定下拉框中看到"],tips:"表格资料最好有清晰表头;图纸资料最好附带目录或文字说明。"},{title:"第三步:创建提示词",goal:"定义每个执行阶段的模型行为,并写清系统需要自动抽取的检查规则。",path:"左侧菜单 → 提示词管理",steps:["创建事实抽取提示词:要求只抽取资料中明确出现的事实,返回结构化 JSON,不允许编造。","创建章节生成提示词:定义文档类型、专业语气、章节风格、引用事实和禁止事项。","在总控、章节生成或角色提示词中写清工程名称、工期、质量目标、数字、表格引用、章节完整性等约束,系统运行时会自动抽取为检查规则。","创建格式化提示词:定义编号、表格、分页和正式输出样式。","保存后确认提示词能在提示词角色绑定下拉框中看到。"],checks:["事实抽取提示词已创建","章节生成提示词已创建","格式化提示词或角色约束已创建"],tips:"提示词越明确,生成结果越稳定。系统会自动抽取规则用于生成、检查和修复,建议明确写上“没有来源的数据不要写”。"},{title:"第四步:创建文件角色",goal:"告诉系统每个文件在生成流程中的用途。",path:"左侧菜单 → 角色配置 → 新建文件角色",steps:["填写角色名称,例如“招标文件事实源”“工程量清单表格”“图纸说明文件”。","选择处理类型:规则文件、项目事实文件、表格数据、图纸文件、规范文件或参考资料。","绑定对应知识库文件。","保存角色。","按文件用途创建多个文件角色,不建议把不同用途资料混在一个角色里。"],checks:["文件角色有名称","已选择处理类型","具体项目文件由生成流程自动识别"],tips:"处理类型很重要:系统会根据它决定是否进行表格解析、事实抽取、规则引用或来源追踪。"},{title:"第五步:创建提示词角色",goal:"告诉系统每条提示词在哪个执行阶段使用,并让系统从提示词中自动抽取检查规则。",path:"左侧菜单 → 角色配置 → 新建提示词角色",steps:["填写角色名称,例如“施工组织设计事实抽取”“章节生成规则”“格式与交付规则”。","选择执行类型:事实抽取、章节生成、格式化或参考;需要检查的要求直接写进对应提示词,系统运行时会自动抽取规则。","绑定对应提示词。","保存角色。","一个执行阶段可以有多个提示词角色,后续在项目角色配置中排序。"],checks:["提示词角色有名称","已选择执行类型","已绑定提示词"],tips:"不需要单独维护检查类提示词;系统会从已绑定提示词中抽取禁止项、章节规则、事实规则、字数要求和导出检查规则。"},{title:"第六步:创建项目角色配置并排序",goal:"把文件角色和提示词角色组合成一个可复用的项目生成方案。",path:"左侧菜单 → 角色配置 → 新建项目配置",steps:["填写配置名称,例如“某项目施工组织设计配置”。","添加文件角色,并设置顺序。推荐:规则文件 → 项目事实文件 → 表格数据 → 图纸文件 → 规范文件 → 参考资料。","添加提示词角色,并设置顺序。推荐:事实抽取 → 章节生成 → 格式化 → 参考;检查规则会从已绑定提示词中自动抽取。","保存项目角色配置。","后续模板只绑定项目角色配置,不再重复绑定文件和提示词。"],checks:["至少包含一个文件角色","至少包含一个提示词角色","顺序符合业务流程"],tips:"排序决定系统读取资料和应用提示词的优先级,是生产级生成稳定性的关键。"},{title:"第七步:创建模板并绑定项目配置",goal:"定义要生成哪种文档,以及使用哪套项目角色配置。",path:"左侧菜单 → 生成编辑 → 新建模板",steps:["填写模板 ID。ID 由系统生成或保持唯一,不建议手动频繁修改。","填写模板名称,例如“施工组织设计”“技术标文件”“专项施工方案”。","填写分类、输出标题和模板说明。","选择第六步创建的项目角色配置。","为章节填写查询词和必需事实;系统会自动按章节检索知识库证据。","高级优先证据通常无需填写;只有必须指定某份官方资料、图纸或表格时才使用。","保存模板。"],checks:["模板名称清晰","输出标题正确","已绑定项目角色配置"],tips:"模板负责文档入口;项目角色配置负责资料、提示词和顺序。两者分离后更容易复用。"},{title:"第八步:执行生成并查看状态",goal:"让用户明确知道生成流程进行到哪一步。",path:"左侧菜单 → 生成编辑 → 选择模板 → 点击生成",steps:["点击生成按钮后,页面会出现“执行状态”卡片。","系统会先绑定文件角色和提示词角色,再按章节自动检索知识库证据;只有在必须指定官方资料、图纸或表格时,才需要使用高级优先证据。","执行状态会根据当前模板、后台自动规范、文件角色、提示词角色、运行时规则、证据增强和章节自动生成,不是固定工程流程。","当前执行节点会高亮显示,子状态会展示正在处理的章节、事实字段、文件角色、运行时规则、增强贡献或门禁规则。","生成任务在后台运行,页面通过 documentId 轮询;切换页面后回到生成编辑仍可恢复状态。","生成完成后,系统会用后端真实 executionStages 回填最终状态。","如果导出门禁存在风险,生成完成节点会提示需要查看规则检查结果。"],checks:["执行状态 Card 出现","当前节点有高亮","生成完成后有执行阶段结果"],tips:"如果长时间停留在某一步,优先检查模型配置、知识库索引和文件角色绑定。"},{title:"第九步:审查结果并导出",goal:"确保文档可追溯、可检查、可交付,同时能区分高风险问题和可复核 warning。",path:"生成编辑 → 编辑器下方 Tabs → 导出按钮 / 草稿历史",steps:["查看“结构化事实”,确认事实字段是否按后台自动规范动态 schema 抽取,并检查冲突提示。","查看“来源”,确认事实来自后台自动规范要求的文件角色和绑定资料。","查看“缺失项”,补齐缺失资料或调整角色配置。","查看“规则检查”,优先处理 error;warning 表示可导出但建议复核。","查看“导出门禁”,真实 blockingIssues 会作为风险提示保留,但不阻断用户导出。","在草稿历史中确认生成状态、warning 原因、整体生成耗时,并可删除不需要的记录。","可以先导出 HTML 预览排版,再导出 DOCX/PDF。"],checks:["无真实阻断问题","关键事实有来源","章节有证据","warning 原因已复核","导出文件可打开"],tips:"导出不是简单放行:真实阻断仍会拦截;生成完成但存在可复核问题时显示 warning,用户可以继续导出并按原因优化资料。"}];function w(){let e=(0,p.Vr)();return(0,i.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,i.jsxs)(c.A,{className:"cardGlass",styles:{body:{padding:24}},children:[(0,i.jsx)(z,{level:2,className:"mb-2",children:e("guide.title")}),(0,i.jsx)(u,{className:"pageDesc mb-0",children:e("guide.description")})]}),(0,i.jsx)(n.A,{gutter:[16,16],children:k.map(e=>(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(c.A,{className:"h-full",title:(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon,e.title]}),children:(0,i.jsx)("div",{className:"space-y-2",children:e.items.map(s=>(0,i.jsx)("div",{children:(0,i.jsx)(t.A,{color:e.color,children:s})},s))})})},e.title))}),(0,i.jsx)(c.A,{title:e("guide.fullFlow"),children:(0,i.jsx)(n.A,{gutter:[12,12],children:y.map((e,s)=>(0,i.jsx)(d.A,{xs:24,sm:12,lg:8,xl:6,children:(0,i.jsx)(c.A,{size:"small",className:"h-full",children:(0,i.jsxs)("div",{className:"flex items-start gap-3",children:[(0,i.jsx)(t.A,{color:"blue",className:"mt-1",children:s+1}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)(N,{strong:!0,children:e.title.replace(/^第.+?:/u,"")}),(0,i.jsx)(u,{className:"mb-1 text-xs",ellipsis:{rows:2,tooltip:e.goal},children:e.goal}),(0,i.jsx)(N,{type:"secondary",className:"text-xs break-words",children:e.path})]})]})})},e.title))})}),(0,i.jsx)(c.A,{title:"详细步骤说明:照着做即可跑通",children:(0,i.jsx)(x.A,{mode:"left",items:y.map(e=>({dot:(0,i.jsx)(g.A,{}),children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(z,{level:4,className:"mb-0",children:e.title}),(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"目标:"}),e.goal]}),(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"入口:"}),e.path]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(N,{strong:!0,children:"操作步骤:"}),(0,i.jsx)("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:e.steps.map(e=>(0,i.jsx)("li",{children:e},e))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(N,{strong:!0,children:"完成检查:"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:e.checks.map(e=>(0,i.jsx)(t.A,{color:"success",children:e},e))})]}),(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"提示:"}),e.tips]}),(0,i.jsx)(h.A,{})]})}))})}),(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{title:e("guide.roleDesign"),children:[(0,i.jsx)(u,{children:e("guide.roleDesignDesc")}),(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(t.A,{color:"blue",children:"file"}),(0,i.jsx)(N,{strong:!0,children:e("guide.fileRole")}),(0,i.jsx)(u,{children:e("guide.fileRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(t.A,{color:"purple",children:"prompt"}),(0,i.jsx)(N,{strong:!0,children:e("guide.promptRole")}),(0,i.jsx)(u,{children:e("guide.promptRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(t.A,{color:"processing",children:"config"}),(0,i.jsx)(N,{strong:!0,children:e("guide.projectConfig")}),(0,i.jsx)(u,{children:e("guide.projectConfigDesc")})]})]})]})}),(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{title:e("guide.generationEngine"),children:[(0,i.jsx)(u,{children:e("guide.generationEngineDesc")}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(t.A,{children:e("roles.factExtraction")}),(0,i.jsx)(t.A,{children:e("roles.chapterGeneration")}),(0,i.jsx)(t.A,{children:"自动规则检查"}),(0,i.jsx)(t.A,{children:e("roles.formatting")}),(0,i.jsx)(t.A,{children:e("documents.exportGate")})]})]})})]}),(0,i.jsx)(c.A,{title:"文件角色和提示词角色案例:它们在模板生成中到底起什么作用",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{size:"small",title:"案例 A:创建文件角色“招标文件事实源”",children:[(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"怎么创建:"}),"类型选择 file,处理类型选择“项目事实文件”,绑定招标文件、合同摘要或项目概况。"]}),(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"生成时的作用:"}),"系统会从这个角色绑定的文件里抽取工程名称、建设地点、工期、质量目标、范围边界等事实,并把来源带入结构化事实和章节证据。"]}),(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"带来的提升:"}),"模型不再凭空补项目事实;章节生成和导出校验都会追踪“这句话来自哪个文件角色、哪个文件”。"]})]})}),(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{size:"small",title:"案例 B:创建文件角色“工程量清单表格”",children:[(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"怎么创建:"}),"类型选择 file,处理类型选择“表格数据”,绑定 Excel、CSV、清单表或计划表。"]}),(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"生成时的作用:"}),"系统会读取 Sheet、表头、行列和来源范围,把表格数据转换成可引用的结构化资源证据。"]}),(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"带来的提升:"}),"章节中涉及数量、清单、计划、资源配置时,优先引用表格来源,减少数字编造和漏项。"]})]})}),(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{size:"small",title:"案例 C:创建提示词角色“章节生成规则”",children:[(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"怎么创建:"}),"先在提示词管理中写好生成规则,例如“必须引用来源、不要写无来源数据、输出正式报告语气”;再创建 prompt 角色,执行类型选择“章节生成”。"]}),(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"生成时的作用:"}),"系统生成每个章节时会把这个提示词加入 LLM 上下文,用它约束语气、结构、引用方式和禁止事项。"]}),(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"带来的提升:"}),"同一套资料可以生成更稳定的文档风格;不同模板只需替换提示词角色,就能调整写法而不改知识库文件。"]})]})}),(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{size:"small",title:"案例 D:在提示词中写入交付检查要求",children:[(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"怎么创建:"}),"提示词内容写清楚必须检查的交付要求,例如“不能出现资料未提供、图片引用必须可访问、关键事实必须有来源”;执行类型选择章节生成、格式化或参考即可。"]}),(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"生成时的作用:"}),"系统会在运行时自动抽取这些要求,结合证据来源、事实落位和导出门禁检查文档是否可交付。"]}),(0,i.jsxs)(u,{children:[(0,i.jsx)(N,{strong:!0,children:"带来的提升:"}),"不需要维护单独检查类提示词,也能把人工审稿经验前置到生成流程,降低导出后才发现缺来源、缺图片、格式不合格的概率。"]})]})})]})}),(0,i.jsx)(c.A,{title:"运行时规则自动抽取说明",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"用户只维护业务提示词",children:(0,i.jsx)(u,{children:"系统不要求用户单独创建检查类提示词。用户只需要在总控、章节生成、格式化或参考提示词中写清“必须怎么写、不能写什么、字数和章节要求”。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"运行时自动抽取规则",children:(0,i.jsx)(u,{children:"生成开始时,系统会从已绑定提示词中抽取禁止词、章节规则、主体表达、商务敏感项、事实真实性、字数要求和角色关注点,并统一用于生成、检查和修复。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"执行状态可追踪",children:(0,i.jsx)(u,{children:"生成状态会展示提示词规则执行摘要,方便确认用户写入的约束是否被识别并参与本次生成流程。"})})})]})}),(0,i.jsx)(c.A,{title:"联网增强说明",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"默认关闭",children:(0,i.jsx)(u,{children:"联网增强在模型配置页手动开启。开启后,系统会受控检索公开规范、政策和通用技术资料,用于增强措施准确性。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"不覆盖项目事实",children:(0,i.jsx)(u,{children:"联网资料不会用于生成或修改项目名称、地点、规模、工期、质量标准、工程量、材料规格、商务数据等项目事实。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"有报告和门禁",children:(0,i.jsx)(u,{children:"生成状态会展示联网增强报告;导出前会检查并清理联网过程性话术,避免正式正文出现搜索过程描述。"})})})]})}),(0,i.jsx)(c.A,{title:"我的数据和门禁规则说明",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"使用自己的数据",children:(0,i.jsx)(u,{children:"文件、提示词、角色配置和规范包都来自用户自己创建或上传的内容,生成流程会按当前项目配置读取,并自动抽取检查规则参与生成和导出门禁。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"自定义门禁类型会执行",children:(0,i.jsx)(u,{children:"门禁规则由后台根据模板、提示词和角色绑定自动形成,并与系统门禁一起参与规则检查,不需要用户手动维护单独检查类提示词。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"上传后关注索引状态",children:(0,i.jsx)(u,{children:"文件上传完成后,知识库索引会继续在后台写入。请在文件管理页查看状态,如果失败,页面会展示原因,方便重新配置模型或重试。"})})})]})}),(0,i.jsx)(c.A,{title:"知识库证据和增强贡献说明",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(c.A,{size:"small",title:"自动检索为主",children:(0,i.jsx)(u,{children:"模板章节的查询词、章节目的和必需事实会驱动系统自动检索知识库证据。高级优先证据只是兜底能力,用于必须指定官方资料、图纸或表格的场景,不是日常必填项。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(c.A,{size:"small",title:"增强贡献可追踪",children:(0,i.jsx)(u,{children:"生成流程会展示知识库证据、人工确认/固定证据和自动检索证据的数量,帮助判断本次增强是否真的参与生成,而不是增加用户维护成本。"})})})]})}),(0,i.jsx)(c.A,{title:"动态 schema、证据和执行状态说明",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"动态事实 schema",children:(0,i.jsx)(u,{children:"系统不会写死工程字段。后台自动规范会结合模板章节 requiredFacts、角色绑定和提示词形成抽取 schema,并驱动事实抽取、冲突检测、规则检查和导出门禁。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"结构化资源证据",children:(0,i.jsx)(u,{children:"文本、PDF/Word、Excel/CSV、图片、地图图纸和其他附件都会被整理成资源证据,包含文件角色、处理类型、正文用途、关联事实和证据片段,模型据此理解资料关系。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"动态执行状态",children:(0,i.jsx)(u,{children:"生成编辑页的执行节点会随模板、规范包、文件角色、提示词角色、章节和门禁规则变化;用户生成不同项目文件时看到的是对应项目的流程,而不是固定示例流程。"})})})]})}),(0,i.jsx)(c.A,{title:"生成记录、warning 和导出门禁怎么理解",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,lg:8,children:(0,i.jsxs)(c.A,{size:"small",title:"草稿历史记录",children:[(0,i.jsxs)(u,{children:["每次后台生成都会写入全局项目目录 ",(0,i.jsxs)(N,{code:!0,children:["~/.customize-agent/projects/","{projectId}","/generatedDocuments"]}),"。记录会保存标题、模板、状态、创建时间、完成时间、生成耗时、正文、结构化结果和资源引用。"]}),(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"completed:生成完成且无需要关注的问题。"}),(0,i.jsx)("li",{children:"warning:生成完成,但存在可复核问题。"}),(0,i.jsx)("li",{children:"failed:生成失败,需要查看错误原因。"}),(0,i.jsx)("li",{children:"generating:后台任务仍在执行,可轮询恢复。"})]})]})}),(0,i.jsx)(d.A,{xs:24,lg:8,children:(0,i.jsxs)(c.A,{size:"small",title:"warning 不是失败",children:[(0,i.jsx)(u,{children:"warning 用于提醒用户“文档已经生成,但建议复核”。例如必需事实没有在最佳来源角色中抽到、部分来源需要人工确认、格式或内容有优化建议。warning 会显示在草稿历史和校验详情中,并保留导出能力。"}),(0,i.jsx)(u,{children:"如果存在明确风险问题,例如正文包含临时图片生成 URL、出现“资料未提供”占位、真实 blockingIssues 未解决,导出门禁会提示风险,但仍保留 DOCX/PDF 导出能力。"})]})}),(0,i.jsx)(d.A,{xs:24,lg:8,children:(0,i.jsxs)(c.A,{size:"small",title:"导出门禁规则",children:[(0,i.jsx)(u,{children:"门禁分为“高风险提示”和“复核建议”。系统不会禁止导出,但会在出现高风险问题时提醒用户复核交付质量。"}),(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"Markdown/HTML 更适合快速预览和人工调整。"}),(0,i.jsx)("li",{children:"DOCX/PDF 会启用真实门禁检查。"}),(0,i.jsx)("li",{children:"草稿历史可保留多个版本,便于对比和再次导出。"})]})]})})]})}),(0,i.jsx)(c.A,{title:"生成资源和知识库的关系",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsxs)(c.A,{size:"small",title:"生成资源不进入知识库",children:[(0,i.jsx)(u,{children:"模板运行生成的文档、图片、封面或后处理资源只会登记到生成资源管理页,不会写入 knowledgeBase,也不会建立知识库索引。"}),(0,i.jsx)(u,{children:"这样可以避免模型产物污染事实来源;需要作为资料复用时,应由用户明确上传到知识库。"})]})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsxs)(c.A,{size:"small",title:"资源预览和坏图处理",children:[(0,i.jsx)(u,{children:"资源预览会从全局 generatedDocuments 目录解析文件,不依赖当前页面临时路径。图片下载会识别“image is generating”等占位响应,并校验 PNG/JPEG/WebP 字节,避免把占位文本当成图片保存。"}),(0,i.jsx)(u,{children:"如果预览失败,优先查看资源管理页中的文件路径、资源状态和原始生成记录。"})]})})]})}),(0,i.jsx)(c.A,{title:"文件角色处理类型大白话说明",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(c.A,{size:"small",title:"规则文件",children:(0,i.jsx)(u,{children:"用来告诉系统“必须怎么写、不能怎么写、按什么标准判断”。适合放评分办法、甲方编制要求、攻略写作要求、输出格式要求。生成时会优先作为约束使用。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(c.A,{size:"small",title:"项目事实文件",children:(0,i.jsx)(u,{children:"用来告诉系统“真实情况是什么”。适合放项目概况、合同摘要、招标文件关键信息、游戏角色资料、产品资料。事实字段通常从这里抽取。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(c.A,{size:"small",title:"表格数据",children:(0,i.jsx)(u,{children:"用来解析结构化数据。适合放 Excel、CSV、清单、计划表、评分表、推荐指数表。系统会读取 Sheet、表头、行列和来源范围。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(c.A,{size:"small",title:"图纸文件",children:(0,i.jsx)(u,{children:"用来表达空间关系、路线、结构、站位或设计说明。可以是图纸目录、设计说明、路线示意、阵型图说明。没有 CAD 时也可以用文字图纸说明。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(c.A,{size:"small",title:"规范文件",children:(0,i.jsx)(u,{children:"用来作为专业依据。适合放国家规范、行业标准、企业标准、攻略结构规范、质量标准。生成、规则检查和导出门禁会把它当成依据。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(c.A,{size:"small",title:"参考资料",children:(0,i.jsx)(u,{children:"只作为辅助阅读材料,不建议放关键事实。适合放图片来源、公开网页链接、背景资料、案例资料。系统可以参考,但不应把它当成强事实。"})})})]})}),(0,i.jsx)(c.A,{title:"推荐资料清单",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"必备资料",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"项目事实文件"}),(0,i.jsx)("li",{children:"招标或编制规则"}),(0,i.jsx)("li",{children:"章节生成提示词"})]})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"强烈建议",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"表格数据"}),(0,i.jsx)("li",{children:"图纸说明"}),(0,i.jsx)("li",{children:"规范或企业标准"})]})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"导出前确认",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"无 error 校验"}),(0,i.jsx)("li",{children:"事实有来源"}),(0,i.jsx)("li",{children:"导出门禁通过"})]})})})]})}),(0,i.jsx)(c.A,{title:"生产级生成前检查清单",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(c.A,{size:"small",title:"资料完整性",children:(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"事实源、规则源、表格源、图片/图纸源分开绑定。"}),(0,i.jsx)("li",{children:"关键事实在知识库检索中可以搜索到。"}),(0,i.jsx)("li",{children:"表格有清晰表头,图片和图纸有说明文字。"}),(0,i.jsx)("li",{children:"只有必须指定资料时才维护高级优先证据。"})]})})}),(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(c.A,{size:"small",title:"角色配置",children:(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"文件角色处理类型选对。"}),(0,i.jsx)("li",{children:"提示词角色执行类型选对。"}),(0,i.jsx)("li",{children:"项目角色配置排序符合生成流程。"}),(0,i.jsx)("li",{children:"生成后查看增强贡献,确认上下文和证据是否真实参与。"})]})})}),(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(c.A,{size:"small",title:"规范包",children:(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"required fact 不要过度配置。"}),(0,i.jsx)("li",{children:"sourceRoleIds 只绑定真正应该提供该事实的角色。"}),(0,i.jsx)("li",{children:"gateRules 区分 error 和 warning。"})]})})}),(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(c.A,{size:"small",title:"交付检查",children:(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"草稿历史记录状态合理。"}),(0,i.jsx)("li",{children:"warning 原因已经阅读。"}),(0,i.jsx)("li",{children:"导出文件打开正常,图片和表格可读。"})]})})})]})}),(0,i.jsx)(c.A,{title:"常见问题和处理建议",children:(0,i.jsx)(j.A,{items:[{key:"warning-export",label:"为什么生成完成后显示 warning,但仍然可以导出?",children:(0,i.jsx)(u,{children:"warning 表示文档已生成,但存在建议复核的问题,例如来源角色不完全匹配、某些事实需要人工确认或格式可优化。它不是失败,也不会阻断导出;真实 blockingIssues 或 error 级门禁问题会作为高风险提示展示,导出后请人工复核。"})},{key:"missing-facts",label:"为什么提示必需事实缺失?",children:(0,i.jsx)(u,{children:"优先检查后台自动规范生成的事实字段、模板章节 requiredFacts 和文件角色绑定。很多情况下不是模型失败,而是资料没有被绑定到正确角色,或字段要求比资料实际内容更严格。"})},{key:"draft-duration",label:"草稿历史里的耗时怎么计算?",children:(0,i.jsx)(u,{children:"耗时使用生成记录的 createdAt 到 completedAt 计算;旧记录或未完成记录会使用 updatedAt 兜底。它用于判断本次生成链路整体成本,包括知识库检索、事实抽取、章节生成、资源处理、校验和格式化。"})},{key:"asset-index",label:"生成资源会如何进入知识库?",children:(0,i.jsx)(u,{children:"生成资源不会自动或手动写入知识库,也不会建立知识库索引,避免生成内容再次被当作事实证据召回。确需复用时,请由用户明确上传到知识库。"})},{key:"priority-evidence",label:"什么时候需要维护高级优先证据?",children:(0,i.jsx)(u,{children:"日常不需要维护。只有当某章必须引用指定官方资料、图纸、表格,或自动检索结果不稳定时,才从知识库搜索页复制文件路径并填入章节高级优先证据。"})}]})}),(0,i.jsx)(j.A,{items:[{key:"prepare",label:e("guide.prepareTitle"),children:(0,i.jsx)(u,{children:e("guide.prepareContent")})},{key:"roles",label:e("guide.rolesTitle"),children:(0,i.jsx)(u,{children:e("guide.rolesContent")})},{key:"template",label:e("guide.templateTitle"),children:(0,i.jsx)(u,{children:e("guide.templateContent")})},{key:"generate",label:e("guide.generateTitle"),children:(0,i.jsx)(u,{children:e("guide.generateContent")})},{key:"qa",label:e("guide.qaTitle"),children:(0,i.jsx)(u,{children:e("guide.qaContent")})}]})]})}},34899:(e,s,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/guide",function(){return l(2548)}])}},e=>{e.O(0,[433,787,405,636,593,792],()=>e(e.s=34899)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[309],{1873:(e,t,l)=>{e.exports=l(91952)},4632:(e,t)=>{"use strict";function l(e){var t;let{config:l,src:n,width:r,quality:i}=e,a=i||(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(n)+"&w="+r+"&q="+a+(n.startsWith("/_next/static/media/"),"")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}}),l.__next_img_default=!0;let n=l},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},37690:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return l(70107)}])},45551:(e,t,l)=>{"use strict";function n(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),l=e/Math.pow(1024,t);return"".concat(l.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let l=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(l/60),r=Math.floor(n/24);return r>30?new Date(e).toLocaleDateString(t):"en-US"===t?r>0?"".concat(r,"d ago"):n>0?"".concat(n,"h ago"):l>0?"".concat(l,"m ago"):"Just now":r>0?"".concat(r," 天前"):n>0?"".concat(n," 小时前"):l>0?"".concat(l," 分钟前"):"刚刚"}l.d(t,{Jm:()=>s,fw:()=>r,z3:()=>n});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},a={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===l?a:i)[e])?t:e}},49952:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return w}});let n=l(34007),r=l(26908),i=l(65321),a=r._(l(97109)),s=n._(l(61222)),o=n._(l(64041)),c=l(62956),d=l(83149),u=l(65059);l(28965);let h=l(99318),m=n._(l(4632)),g=l(47503),p={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 f(e,t,l,n,r,i,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&&r(!0),null==l?void 0:l.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let n=!1,r=!1;l.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>n,isPropagationStopped:()=>r,persist:()=>{},preventDefault:()=>{n=!0,t.preventDefault()},stopPropagation:()=>{r=!0,t.stopPropagation()}})}(null==n?void 0:n.current)&&n.current(e)}}))}function y(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}let _=(0,a.forwardRef)((e,t)=>{let{src:l,srcSet:n,sizes:r,height:s,width:o,decoding:c,className:d,style:u,fetchPriority:h,placeholder:m,loading:p,unoptimized:_,fill:x,onLoadRef:w,onLoadingCompleteRef:v,setBlurComplete:j,setShowAltText:b,sizesInput:C,onLoad:A,onError:S,...P}=e,k=(0,a.useCallback)(e=>{e&&(S&&(e.src=e.src),e.complete&&f(e,m,w,v,j,_,C))},[l,m,w,v,j,S,_,C]),R=(0,g.useMergedRef)(t,k);return(0,i.jsx)("img",{...P,...y(h),loading:p,width:o,height:s,decoding:c,"data-nimg":x?"fill":"1",className:d,style:u,sizes:r,srcSet:n,src:l,ref:R,onLoad:e=>{f(e.currentTarget,m,w,v,j,_,C)},onError:e=>{b(!0),"empty"!==m&&j(!0),S&&S(e)}})});function x(e){let{isAppRouter:t,imgAttributes:l}=e,n={as:"image",imageSrcSet:l.srcSet,imageSizes:l.sizes,crossOrigin:l.crossOrigin,referrerPolicy:l.referrerPolicy,...y(l.fetchPriority)};return t&&s.default.preload?(s.default.preload(l.src,n),null):(0,i.jsx)(o.default,{children:(0,i.jsx)("link",{rel:"preload",href:l.srcSet?void 0:l.src,...n},"__nimg-"+l.src+l.srcSet+l.sizes)})}let w=(0,a.forwardRef)((e,t)=>{let l=(0,a.useContext)(h.RouterContext),n=(0,a.useContext)(u.ImageConfigContext),r=(0,a.useMemo)(()=>{var e;let t=p||n||d.imageConfigDefault,l=[...t.deviceSizes,...t.imageSizes].sort((e,t)=>e-t),r=t.deviceSizes.sort((e,t)=>e-t),i=null==(e=t.qualities)?void 0:e.sort((e,t)=>e-t);return{...t,allSizes:l,deviceSizes:r,qualities:i}},[n]),{onLoad:s,onLoadingComplete:o}=e,g=(0,a.useRef)(s);(0,a.useEffect)(()=>{g.current=s},[s]);let f=(0,a.useRef)(o);(0,a.useEffect)(()=>{f.current=o},[o]);let[y,w]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1),{props:b,meta:C}=(0,c.getImgProps)(e,{defaultLoader:m.default,imgConf:r,blurComplete:y,showAltText:v});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_,{...b,unoptimized:C.unoptimized,placeholder:C.placeholder,fill:C.fill,onLoadRef:g,onLoadingCompleteRef:f,setBlurComplete:w,setShowAltText:j,sizesInput:e.sizes,ref:t}),C.priority?(0,i.jsx)(x,{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)},58970:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"}},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 n=l(65545),r=l(83149),i=["-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:g=!1,priority:p=!1,loading:f,className:y,quality:_,width:x,height:w,fill:v=!1,style:j,overrideSrc:b,onLoad:C,onLoadingComplete:A,placeholder:S="empty",blurDataURL:P,fetchPriority:k,decoding:R="async",layout:I,objectFit:z,objectPosition:O,lazyBoundary:E,lazyRoot:N,...M}=e,{imgConf:D,showAltText:L,blurComplete:F,defaultLoader:T}=t,B=D||r.imageConfigDefault;if("allSizes"in B)c=B;else{let e=[...B.deviceSizes,...B.imageSizes].sort((e,t)=>e-t),t=B.deviceSizes.sort((e,t)=>e-t),n=null==(l=B.qualities)?void 0:l.sort((e,t)=>e-t);c={...B,allSizes:e,deviceSizes:t,qualities:n}}if(void 0===T)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 J=M.loader||T;delete M.loader,delete M.srcSet;let V="__next_img_default"in J;if(V){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=J;J=t=>{let{config:l,...n}=t;return e(n)}}if(I){"fill"===I&&(v=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[I];e&&(j={...j,...e});let t={responsive:"100vw",fill:"100vw"}[I];t&&!m&&(m=t)}let H="",K=s(x),G=s(w);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,P=P||e.blurDataURL,H=e.src,!v)if(K||G){if(K&&!G){let t=K/e.width;G=Math.round(e.height*t)}else if(!K&&G){let t=G/e.height;K=Math.round(e.width*t)}}else K=e.width,G=e.height}let W=!p&&("lazy"===f||void 0===f);(!(h="string"==typeof h?h:H)||h.startsWith("data:")||h.startsWith("blob:"))&&(g=!0,W=!1),c.unoptimized&&(g=!0),V&&!c.dangerouslyAllowSVG&&h.split("?",1)[0].endsWith(".svg")&&(g=!0);let U=s(_),X=Object.assign(v?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:z,objectPosition:O}:{},L?{}:{color:"transparent"},j),q=F||"empty"===S?null:"blur"===S?'url("data:image/svg+xml;charset=utf-8,'+(0,n.getImageBlurSvg)({widthInt:K,heightInt:G,blurWidth:d,blurHeight:u,blurDataURL:P||"",objectFit:X.objectFit})+'")':'url("'+S+'")',$=i.includes(X.objectFit)?"fill"===X.objectFit?"100% 100%":"cover":X.objectFit,Y=q?{backgroundSize:$,backgroundPosition:X.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:q}:{},Z=function(e){let{config:t,src:l,unoptimized:n,width:r,quality:i,sizes:a,loader:s}=e;if(n)return{src:l,srcSet:void 0,sizes:void 0};let{widths:o,kind:c}=function(e,t,l){let{deviceSizes:n,allSizes:r}=e;if(l){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let n;n=e.exec(l);)t.push(parseInt(n[2]));if(t.length){let e=.01*Math.min(...t);return{widths:r.filter(t=>t>=n[0]*e),kind:"w"}}return{widths:r,kind:"w"}}return"number"!=typeof t?{widths:n,kind:"w"}:{widths:[...new Set([t,2*t].map(e=>r.find(t=>t>=e)||r[r.length-1]))],kind:"x"}}(t,r,a),d=o.length-1;return{sizes:a||"w"!==c?a:"100vw",srcSet:o.map((e,n)=>s({config:t,src:l,quality:i,width:e})+" "+("w"===c?e:n+1)+c).join(", "),src:s({config:t,src:l,quality:i,width:o[d]})}}({config:c,src:h,unoptimized:g,width:K,quality:U,sizes:m,loader:J});return{props:{...M,loading:W?"lazy":f,fetchPriority:k,width:K,height:G,decoding:R,className:y,style:{...X,...Y},sizes:Z.sizes,srcSet:Z.srcSet,src:b||Z.src},meta:{unoptimized:g,priority:p,placeholder:S,fill:v}}}},65545:(e,t)=>{"use strict";function l(e){let{widthInt:t,heightInt:l,blurWidth:n,blurHeight:r,blurDataURL:i,objectFit:a}=e,s=n?40*n:t,o=r?40*r: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='"+i+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return l}})},70107:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>F});var n=l(65321),r=l(97109),i=l(1873),a=l.n(i),s=l(86109),o=l(35292),c=l(76506),d=l(33442),u=l(11702),h=l(9137),m=l(21289),g=l(68787),p=l(56985),f=l(49604),y=l(88762),_=l(85493),x=l(84253),w=l(85114),v=l(58569),j=l(7576),b=l(58970),C=l(88483);function A(){return(A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e}).apply(this,arguments)}let S=r.forwardRef((e,t)=>r.createElement(C.A,A({},e,{ref:t,icon:b.A})));var P=l(6578),k=l(79059),R=l(45551),I=l(14569),z=l.n(I);let{Paragraph:O}=o.A;function E(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}function N(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).slice(0,30):[]}function M(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 r=RegExp("(".concat(l.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(r).map((e,t)=>l.some(t=>t.toLowerCase()===e.toLowerCase())?(0,n.jsx)("mark",{children:e},t):e)}function D(e,t,l){return null==t||""===t||Array.isArray(t)&&0===t.length?null:(0,n.jsx)(c.A.Item,{label:e,children:Array.isArray(t)?(0,n.jsx)(d.A,{wrap:!0,children:t.map(e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>null==l?void 0:l(String(e)),children:String(e)},String(e)))}):String(t)})}function L(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 F(){var e,t,l,i,o;let b=(0,k.Vr)(),C=(0,s.useRouter)(),A="string"==typeof C.query.relativePath?C.query.relativePath:"",[I,F]=(0,r.useState)(),[T,B]=(0,r.useState)(!1),[J,V]=(0,r.useState)(""),[H,K]=(0,r.useState)(!1),[G,W]=(0,r.useState)(""),[U,X]=(0,r.useState)([]);(0,r.useEffect)(()=>{A&&(B(!0),V(""),(0,P.xC)(A).then(F).catch(e=>{F(void 0),V(e instanceof Error?e.message:"文件详情加载失败")}).finally(()=>B(!1)))},[A]);let q=(0,r.useMemo)(()=>(function(e){let t=E(null==e?void 0:e.file.metadataJson);return"object"==typeof t.extraction&&t.extraction?t.extraction:t})(I),[I]),$=N(q.layerNames);(0,r.useEffect)(()=>{X($)},[null==I?void 0:I.file.relativePath,$.join("|")]);let Y=G.trim().toLowerCase(),Z=(0,r.useMemo)(()=>{var e;return I&&Y?I.chunks.filter(e=>{let t=E(e.metadataJson);return[e.content,e.sectionTitle,t.rowRange,t.chunkKind,t.parentId,JSON.stringify(t)].some(e=>String(null!=e?e:"").toLowerCase().includes(Y))}):null!=(e=null==I?void 0:I.chunks)?e:[]},[I,Y]),Q=(0,r.useMemo)(()=>{var e;return I&&Y?I.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(Y))):null!=(e=null==I?void 0:I.parents)?e:[]},[I,Y]),ee=async()=>{if(A){K(!0);try{let e=await (0,P.HC)(A);e.detail&&F(e.detail),h.Ay.success("文件索引已重建")}finally{K(!1)}}},et=async e=>{e&&(await navigator.clipboard.writeText(e),h.Ay.success("已复制"))},el=async e=>{A&&(await (0,P.tn)(A,e),h.Ay.success("file"===e?"已请求打开文件":"已请求打开目录"))},en=(0,r.useMemo)(()=>{var e,t,l,r,i,s;let o=[],h=N(q.sheetNames),y=N(q.columnNames),_=N(q.layerNames),x=N(q.blockNames),w=N(q.entityTypes),v=N(q.productNames),j=N(q.materialNames),b=N(q.entityNames),C=N(q.dataPaths),A=h.length>0||y.length>0||null!=q.rowCount||null!=q.columnCount||null!=q.formulaCount||null!=q.mergeCount,S=L(y,"column"),P=(null!=(e=null==I?void 0:I.chunks)?e:[]).map(e=>E(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,t)=>({key:"row-".concat(t),name:e})),k=(null!=(t=null==I?void 0:I.chunks)?t:[]).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)}));(A||S.length>0||P.length>0||k.length>0)&&o.push({key:"table",label:"表格",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[A&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[D("Sheet",h,W),D("表头",y,W),D("行数",q.rowCount),D("列数",q.columnCount),D("公式数",q.formulaCount),D("合并单元格",q.mergeCount)]}),S.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:S,columns:[{title:"列名",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})}]}),P.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:P,columns:[{title:"行范围",dataIndex:"name",render:e=>(0,n.jsxs)(u.A,{color:"gold",className:"cursor-pointer",onClick:()=>W(String(e)),children:["行 ",String(e)]})}]}),k.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:k,pagination:{pageSize:10},columns:[{title:"表格网格预览",dataIndex:"cells",render:e=>(0,n.jsx)(d.A,{wrap:!0,children:e.map((e,t)=>(0,n.jsx)(u.A,{children:e},"".concat(e,"-").concat(t)))})}]})]})});let R=_.length>0||x.length>0||w.length>0||v.length>0||j.length>0||b.length>0,M=[...L(_,"layer").map(e=>({...e,type:"图层"})),...L(w,"entity").map(e=>({...e,type:"实体类型"})),...L(x,"block").map(e=>({...e,type:"块/符号"}))];(R||_.length>0||M.length>0)&&o.push({key:"drawing",label:"图纸",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[R&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[D("图层",_,W),D("块/符号",x,W),D("实体类型",w,W),D("产品/零件",v,W),D("材料",j,W),D("实体名称",b,W)]}),_.length>0&&(0,n.jsxs)(g.A,{size:"small",title:"图层开关 / 图纸预览",children:[(0,n.jsx)(p.A.Group,{value:U,options:_.map(e=>({label:e,value:e})),onChange:e=>X(e.map(String))}),(0,n.jsx)("div",{className:z().drawingPreview,children:U.map(e=>(0,n.jsx)(u.A,{color:"blue",children:e},e))})]}),M.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:M,columns:[{title:"类型",dataIndex:"type",width:120},{title:"名称",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})}]})]})});let F=(null!=(l=null==I?void 0:I.chunks)?l:[]).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,n,r,i;let a=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(t),path:null!=(r=null==a||null==(l=a[1])?void 0:l.trim())?r:e,value:null!=(i=null==a||null==(n=a[2])?void 0:n.trim())?i:""}});(C.length>0||F.length>0)&&o.push({key:"data",label:"数据路径",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[C.length>0&&(0,n.jsx)(f.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[n,r]=e;return{title:n,key:t?"".concat(t,".").concat(n):n,children:l(r,t?"".concat(t,".").concat(n):n)}})};return l(t)}(C),onSelect:e=>{var t;return W(String(null!=(t=e[0])?t:""))}}),F.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:F,pagination:{pageSize:20},columns:[{title:"Path",dataIndex:"path",width:260,render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})},{title:"Value",dataIndex:"value",render:e=>(0,n.jsx)("span",{className:"break-all",children:String(e)})}]})]})});let T=[q.ocrRecommended,q.ocrReason,q.ocrProvider,q.ocrLanguages,q.ocrTextLength,q.pdfPageOcrSupported,q.ocrPageCount,q.pdfOcrPageLimit,q.pdfRenderer,q.pdfPageCount,q.textPages,q.ocrAugmented,q.ocrPages,q.failedPages,q.imagePreprocessor].some(e=>null!=e),B=(null!=(r=null==I?void 0:I.chunks)?r:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,t,l,n)=>{var r,i,a;return l%2==0&&e.push({key:"page-".concat(t),page:t,text:null!=(a=null==(i=n[l+1])||null==(r=i.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:r.trim())?a:""}),e},[]),J=(null==I?void 0:I.file.format)==="pdf";return(T||J||B.length>0)&&o.push({key:"ocr",label:"OCR/PDF",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[T&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[D("OCR 建议",q.ocrRecommended),D("OCR 原因",q.ocrReason),D("OCR 引擎",q.ocrProvider),D("OCR 语言",q.ocrLanguages),D("OCR 文本长度",q.ocrTextLength),D("PDF 总页数",q.pdfPageCount),D("PDF 文本页数",q.textPages),D("PDF 已 OCR 增强",q.ocrAugmented),D("PDF OCR 页码",Array.isArray(q.ocrPages)?q.ocrPages.join(", "):q.ocrPages),D("PDF 失败页",Array.isArray(q.failedPages)?q.failedPages.map(e=>JSON.stringify(e)).join("; "):q.failedPages),D("PDF 页面 OCR 支持",q.pdfPageOcrSupported),D("PDF OCR 页数",q.ocrPageCount),D("PDF OCR 页数上限",q.pdfOcrPageLimit),D("PDF 渲染器",q.pdfRenderer),D("图像预处理",q.imagePreprocessor)]}),J&&(0,n.jsx)("div",{className:z().pdfPreviewStrip,children:Array.from({length:Math.min(Number(null!=(s=null!=(i=q.pdfPageCount)?i:q.ocrPageCount)?s:1)||1,6)},(e,t)=>(0,n.jsx)(a(),{width:220,height:320,src:"/api/kb/files/preview-pdf-page?relativePath=".concat(encodeURIComponent(I.file.relativePath),"&page=").concat(t+1),alt:"PDF 第 ".concat(t+1," 页"),unoptimized:!0},t))}),B.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:B,pagination:{pageSize:10},columns:[{title:"页码",dataIndex:"page",width:90},{title:"OCR 文本",dataIndex:"text",render:e=>(0,n.jsx)(O,{ellipsis:{rows:4,expandable:!0,symbol:"展开"},children:String(e)})}]})]})}),o},[q,I,U]),er=[{title:"序号",key:"index",width:70,render:(e,t,l)=>l+1},{title:b("knowledge.chunkIndex"),dataIndex:"chunkIndex",width:90,render:e=>String(e)},{title:b("knowledge.chunkType"),width:110,render:(e,t)=>{var l;return(0,n.jsx)(u.A,{children:String(null!=(l=E(t.metadataJson).chunkKind)?l:t.category)})}},{title:b("knowledge.sectionOrRange"),width:220,render:(e,t)=>{let l=E(t.metadataJson),r="string"==typeof l.rowRange?l.rowRange:void 0;return(0,n.jsxs)(d.A,{wrap:!0,children:[t.sectionTitle?(0,n.jsx)(u.A,{color:"cyan",children:t.sectionTitle}):null,r?(0,n.jsxs)(u.A,{color:"gold",children:["行 ",r]}):null]})}},{title:"Token",dataIndex:"tokenCount",width:90},{title:b("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(O,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:z().searchContent,children:M(t.content,G)})}],ei=[{title:"序号",key:"index",width:70,render:(e,t,l)=>l+1},{title:b("knowledge.parentChunkId"),dataIndex:"parentId",width:260,render:e=>(0,n.jsx)("span",{className:"break-all",children:e})},{title:"切片数",dataIndex:"chunkCount",width:90},{title:"章节",dataIndex:"sectionTitle",width:220},{title:b("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(O,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:z().searchContent,children:M(t.content,G)})}];return T?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(y.A,{active:!0,paragraph:{rows:1}}),(0,n.jsx)(g.A,{size:"small",children:(0,n.jsx)(y.A,{active:!0,paragraph:{rows:6}})}),(0,n.jsx)(g.A,{size:"small",children:(0,n.jsx)(y.A,{active:!0,paragraph:{rows:4}})})]}):J?(0,n.jsx)(_.A,{type:"error",showIcon:!0,message:"文件详情加载失败",description:J}):I?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(w.Ay,{icon:(0,n.jsx)(S,{}),href:"/knowledge/files",size:"small",style:{marginBottom:12},children:"返回文件列表"}),(0,n.jsxs)("div",{className:z().searchResultHeader,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:"文件详情"}),(0,n.jsx)("p",{className:"pageDesc",children:"查看解析结果、图纸/表格/数据结构化字段、parent chunk 和 child chunk。"})]}),(0,n.jsxs)(d.A,{children:[(0,n.jsx)(w.Ay,{onClick:()=>{et(null==I?void 0:I.absolutePath)},children:"复制原文件路径"}),(0,n.jsx)(w.Ay,{onClick:()=>{et(null==I?void 0:I.directory)},children:"复制所在目录"}),(0,n.jsx)(w.Ay,{onClick:()=>{el("file")},children:"打开文件"}),(0,n.jsx)(w.Ay,{onClick:()=>{el("directory")},children:"打开目录"}),"pdf"===I.file.format?(0,n.jsx)(w.Ay,{loading:H,onClick:()=>{ee()},children:"重新 OCR"}):null,(0,n.jsx)(w.Ay,{type:"primary",loading:H,onClick:()=>{ee()},children:"重建该文件索引"})]})]})]}),(0,n.jsx)(g.A,{size:"small",title:"基础信息",children:(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[(0,n.jsx)(c.A.Item,{label:"路径",children:I.file.relativePath}),(0,n.jsx)(c.A.Item,{label:"原文件",children:null!=(e=I.absolutePath)?e:"-"}),(0,n.jsx)(c.A.Item,{label:"所在目录",children:null!=(t=I.directory)?t:"-"}),(0,n.jsxs)(c.A.Item,{label:"分类",children:[(0,n.jsx)(u.A,{children:(0,R.Jm)(I.file.category)})," ",(0,n.jsx)(u.A,{children:I.file.format})]}),(0,n.jsx)(c.A.Item,{label:"大小",children:(0,R.z3)(I.file.fileSize)}),(0,n.jsx)(c.A.Item,{label:"切片数",children:I.file.chunkCount}),(0,n.jsx)(c.A.Item,{label:"状态",children:I.file.status}),(0,n.jsx)(c.A.Item,{label:"解析模式",children:String(null!=(l=q.extractionMode)?l:"-")}),(0,n.jsx)(c.A.Item,{label:"覆盖范围",children:String(null!=(i=q.contentCoverage)?i:"-")}),(0,n.jsx)(c.A.Item,{label:"正文长度",children:String(null!=(o=q.textLength)?o:"-")})]})}),en.length>0&&(0,n.jsx)(g.A,{size:"small",title:"结构化信息",children:(0,n.jsx)(v.A,{items:en})}),(0,n.jsx)(g.A,{size:"small",title:"详情筛选",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[(0,n.jsx)(j.A,{allowClear:!0,value:G,onChange:e=>W(e.target.value),placeholder:"筛选 rowRange、图层、实体、data path、section、chunk 内容"}),G?(0,n.jsxs)(d.A,{wrap:!0,children:[(0,n.jsxs)(u.A,{color:"blue",children:[b("knowledge.parentMatches")," ",Q.length]}),(0,n.jsxs)(u.A,{color:"green",children:[b("knowledge.childMatches")," ",Z.length]}),(0,n.jsxs)(u.A,{color:"purple",children:[b("knowledge.filterTerm")," ",G]})]}):null]})}),(0,n.jsxs)(g.A,{size:"small",title:"".concat(b("knowledge.parentChunks")," (").concat(Q.length,"/").concat(I.parents.length,")"),children:[(0,n.jsx)(_.A,{type:"info",showIcon:!0,message:b("knowledge.parentChunkHint"),style:{marginBottom:12}}),(0,n.jsx)(m.A,{rowKey:"id",columns:ei,dataSource:Q,pagination:{pageSize:10},size:"small"})]}),(0,n.jsx)(g.A,{size:"small",title:"".concat(b("knowledge.childChunks")," (").concat(Z.length,"/").concat(I.chunks.length,")"),children:(0,n.jsx)(m.A,{rowKey:"id",columns:er,dataSource:Z,pagination:{pageSize:20},size:"small"})})]}):(0,n.jsx)(x.A,{description:"请选择文件"})}},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 n=l(34007),r=l(62956),i=l(49952),a=n._(l(4632));function s(e){let{props:t}=(0,r.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=i.Image}},e=>{e.O(0,[433,787,576,985,375,102,289,506,861,636,593,792],()=>e(e.s=37690)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[309],{1873:(e,t,l)=>{e.exports=l(91952)},4632:(e,t)=>{"use strict";function l(e){var t;let{config:l,src:n,width:r,quality:i}=e,a=i||(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(n)+"&w="+r+"&q="+a+(n.startsWith("/_next/static/media/"),"")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}}),l.__next_img_default=!0;let n=l},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},37690:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return l(70107)}])},45551:(e,t,l)=>{"use strict";function n(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),l=e/Math.pow(1024,t);return"".concat(l.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let l=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(l/60),r=Math.floor(n/24);return r>30?new Date(e).toLocaleDateString(t):"en-US"===t?r>0?"".concat(r,"d ago"):n>0?"".concat(n,"h ago"):l>0?"".concat(l,"m ago"):"Just now":r>0?"".concat(r," 天前"):n>0?"".concat(n," 小时前"):l>0?"".concat(l," 分钟前"):"刚刚"}l.d(t,{Jm:()=>s,fw:()=>r,z3:()=>n});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},a={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===l?a:i)[e])?t:e}},49952:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return w}});let n=l(34007),r=l(26908),i=l(65321),a=r._(l(97109)),s=n._(l(61222)),o=n._(l(64041)),c=l(62956),d=l(83149),u=l(65059);l(28965);let h=l(99318),m=n._(l(4632)),g=l(47503),p={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 f(e,t,l,n,r,i,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&&r(!0),null==l?void 0:l.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let n=!1,r=!1;l.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>n,isPropagationStopped:()=>r,persist:()=>{},preventDefault:()=>{n=!0,t.preventDefault()},stopPropagation:()=>{r=!0,t.stopPropagation()}})}(null==n?void 0:n.current)&&n.current(e)}}))}function y(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}let _=(0,a.forwardRef)((e,t)=>{let{src:l,srcSet:n,sizes:r,height:s,width:o,decoding:c,className:d,style:u,fetchPriority:h,placeholder:m,loading:p,unoptimized:_,fill:x,onLoadRef:w,onLoadingCompleteRef:v,setBlurComplete:j,setShowAltText:b,sizesInput:C,onLoad:A,onError:S,...P}=e,k=(0,a.useCallback)(e=>{e&&(S&&(e.src=e.src),e.complete&&f(e,m,w,v,j,_,C))},[l,m,w,v,j,S,_,C]),R=(0,g.useMergedRef)(t,k);return(0,i.jsx)("img",{...P,...y(h),loading:p,width:o,height:s,decoding:c,"data-nimg":x?"fill":"1",className:d,style:u,sizes:r,srcSet:n,src:l,ref:R,onLoad:e=>{f(e.currentTarget,m,w,v,j,_,C)},onError:e=>{b(!0),"empty"!==m&&j(!0),S&&S(e)}})});function x(e){let{isAppRouter:t,imgAttributes:l}=e,n={as:"image",imageSrcSet:l.srcSet,imageSizes:l.sizes,crossOrigin:l.crossOrigin,referrerPolicy:l.referrerPolicy,...y(l.fetchPriority)};return t&&s.default.preload?(s.default.preload(l.src,n),null):(0,i.jsx)(o.default,{children:(0,i.jsx)("link",{rel:"preload",href:l.srcSet?void 0:l.src,...n},"__nimg-"+l.src+l.srcSet+l.sizes)})}let w=(0,a.forwardRef)((e,t)=>{let l=(0,a.useContext)(h.RouterContext),n=(0,a.useContext)(u.ImageConfigContext),r=(0,a.useMemo)(()=>{var e;let t=p||n||d.imageConfigDefault,l=[...t.deviceSizes,...t.imageSizes].sort((e,t)=>e-t),r=t.deviceSizes.sort((e,t)=>e-t),i=null==(e=t.qualities)?void 0:e.sort((e,t)=>e-t);return{...t,allSizes:l,deviceSizes:r,qualities:i}},[n]),{onLoad:s,onLoadingComplete:o}=e,g=(0,a.useRef)(s);(0,a.useEffect)(()=>{g.current=s},[s]);let f=(0,a.useRef)(o);(0,a.useEffect)(()=>{f.current=o},[o]);let[y,w]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1),{props:b,meta:C}=(0,c.getImgProps)(e,{defaultLoader:m.default,imgConf:r,blurComplete:y,showAltText:v});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_,{...b,unoptimized:C.unoptimized,placeholder:C.placeholder,fill:C.fill,onLoadRef:g,onLoadingCompleteRef:f,setBlurComplete:w,setShowAltText:j,sizesInput:e.sizes,ref:t}),C.priority?(0,i.jsx)(x,{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)},58970:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"}},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 n=l(65545),r=l(83149),i=["-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:g=!1,priority:p=!1,loading:f,className:y,quality:_,width:x,height:w,fill:v=!1,style:j,overrideSrc:b,onLoad:C,onLoadingComplete:A,placeholder:S="empty",blurDataURL:P,fetchPriority:k,decoding:R="async",layout:I,objectFit:z,objectPosition:O,lazyBoundary:E,lazyRoot:N,...M}=e,{imgConf:D,showAltText:L,blurComplete:F,defaultLoader:T}=t,B=D||r.imageConfigDefault;if("allSizes"in B)c=B;else{let e=[...B.deviceSizes,...B.imageSizes].sort((e,t)=>e-t),t=B.deviceSizes.sort((e,t)=>e-t),n=null==(l=B.qualities)?void 0:l.sort((e,t)=>e-t);c={...B,allSizes:e,deviceSizes:t,qualities:n}}if(void 0===T)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 J=M.loader||T;delete M.loader,delete M.srcSet;let V="__next_img_default"in J;if(V){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=J;J=t=>{let{config:l,...n}=t;return e(n)}}if(I){"fill"===I&&(v=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[I];e&&(j={...j,...e});let t={responsive:"100vw",fill:"100vw"}[I];t&&!m&&(m=t)}let H="",K=s(x),G=s(w);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,P=P||e.blurDataURL,H=e.src,!v)if(K||G){if(K&&!G){let t=K/e.width;G=Math.round(e.height*t)}else if(!K&&G){let t=G/e.height;K=Math.round(e.width*t)}}else K=e.width,G=e.height}let W=!p&&("lazy"===f||void 0===f);(!(h="string"==typeof h?h:H)||h.startsWith("data:")||h.startsWith("blob:"))&&(g=!0,W=!1),c.unoptimized&&(g=!0),V&&!c.dangerouslyAllowSVG&&h.split("?",1)[0].endsWith(".svg")&&(g=!0);let U=s(_),X=Object.assign(v?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:z,objectPosition:O}:{},L?{}:{color:"transparent"},j),q=F||"empty"===S?null:"blur"===S?'url("data:image/svg+xml;charset=utf-8,'+(0,n.getImageBlurSvg)({widthInt:K,heightInt:G,blurWidth:d,blurHeight:u,blurDataURL:P||"",objectFit:X.objectFit})+'")':'url("'+S+'")',$=i.includes(X.objectFit)?"fill"===X.objectFit?"100% 100%":"cover":X.objectFit,Y=q?{backgroundSize:$,backgroundPosition:X.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:q}:{},Z=function(e){let{config:t,src:l,unoptimized:n,width:r,quality:i,sizes:a,loader:s}=e;if(n)return{src:l,srcSet:void 0,sizes:void 0};let{widths:o,kind:c}=function(e,t,l){let{deviceSizes:n,allSizes:r}=e;if(l){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let n;n=e.exec(l);)t.push(parseInt(n[2]));if(t.length){let e=.01*Math.min(...t);return{widths:r.filter(t=>t>=n[0]*e),kind:"w"}}return{widths:r,kind:"w"}}return"number"!=typeof t?{widths:n,kind:"w"}:{widths:[...new Set([t,2*t].map(e=>r.find(t=>t>=e)||r[r.length-1]))],kind:"x"}}(t,r,a),d=o.length-1;return{sizes:a||"w"!==c?a:"100vw",srcSet:o.map((e,n)=>s({config:t,src:l,quality:i,width:e})+" "+("w"===c?e:n+1)+c).join(", "),src:s({config:t,src:l,quality:i,width:o[d]})}}({config:c,src:h,unoptimized:g,width:K,quality:U,sizes:m,loader:J});return{props:{...M,loading:W?"lazy":f,fetchPriority:k,width:K,height:G,decoding:R,className:y,style:{...X,...Y},sizes:Z.sizes,srcSet:Z.srcSet,src:b||Z.src},meta:{unoptimized:g,priority:p,placeholder:S,fill:v}}}},65545:(e,t)=>{"use strict";function l(e){let{widthInt:t,heightInt:l,blurWidth:n,blurHeight:r,blurDataURL:i,objectFit:a}=e,s=n?40*n:t,o=r?40*r: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='"+i+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return l}})},70107:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>F});var n=l(65321),r=l(97109),i=l(1873),a=l.n(i),s=l(86109),o=l(35292),c=l(76506),d=l(33442),u=l(11702),h=l(9137),m=l(21289),g=l(68787),p=l(56985),f=l(49604),y=l(88762),_=l(85493),x=l(84253),w=l(85114),v=l(58569),j=l(7576),b=l(58970),C=l(88483);function A(){return(A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e}).apply(this,arguments)}let S=r.forwardRef((e,t)=>r.createElement(C.A,A({},e,{ref:t,icon:b.A})));var P=l(6578),k=l(44494),R=l(45551),I=l(14569),z=l.n(I);let{Paragraph:O}=o.A;function E(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}function N(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).slice(0,30):[]}function M(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 r=RegExp("(".concat(l.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(r).map((e,t)=>l.some(t=>t.toLowerCase()===e.toLowerCase())?(0,n.jsx)("mark",{children:e},t):e)}function D(e,t,l){return null==t||""===t||Array.isArray(t)&&0===t.length?null:(0,n.jsx)(c.A.Item,{label:e,children:Array.isArray(t)?(0,n.jsx)(d.A,{wrap:!0,children:t.map(e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>null==l?void 0:l(String(e)),children:String(e)},String(e)))}):String(t)})}function L(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 F(){var e,t,l,i,o;let b=(0,k.Vr)(),C=(0,s.useRouter)(),A="string"==typeof C.query.relativePath?C.query.relativePath:"",[I,F]=(0,r.useState)(),[T,B]=(0,r.useState)(!1),[J,V]=(0,r.useState)(""),[H,K]=(0,r.useState)(!1),[G,W]=(0,r.useState)(""),[U,X]=(0,r.useState)([]);(0,r.useEffect)(()=>{A&&(B(!0),V(""),(0,P.xC)(A).then(F).catch(e=>{F(void 0),V(e instanceof Error?e.message:"文件详情加载失败")}).finally(()=>B(!1)))},[A]);let q=(0,r.useMemo)(()=>(function(e){let t=E(null==e?void 0:e.file.metadataJson);return"object"==typeof t.extraction&&t.extraction?t.extraction:t})(I),[I]),$=N(q.layerNames);(0,r.useEffect)(()=>{X($)},[null==I?void 0:I.file.relativePath,$.join("|")]);let Y=G.trim().toLowerCase(),Z=(0,r.useMemo)(()=>{var e;return I&&Y?I.chunks.filter(e=>{let t=E(e.metadataJson);return[e.content,e.sectionTitle,t.rowRange,t.chunkKind,t.parentId,JSON.stringify(t)].some(e=>String(null!=e?e:"").toLowerCase().includes(Y))}):null!=(e=null==I?void 0:I.chunks)?e:[]},[I,Y]),Q=(0,r.useMemo)(()=>{var e;return I&&Y?I.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(Y))):null!=(e=null==I?void 0:I.parents)?e:[]},[I,Y]),ee=async()=>{if(A){K(!0);try{let e=await (0,P.HC)(A);e.detail&&F(e.detail),h.Ay.success("文件索引已重建")}finally{K(!1)}}},et=async e=>{e&&(await navigator.clipboard.writeText(e),h.Ay.success("已复制"))},el=async e=>{A&&(await (0,P.tn)(A,e),h.Ay.success("file"===e?"已请求打开文件":"已请求打开目录"))},en=(0,r.useMemo)(()=>{var e,t,l,r,i,s;let o=[],h=N(q.sheetNames),y=N(q.columnNames),_=N(q.layerNames),x=N(q.blockNames),w=N(q.entityTypes),v=N(q.productNames),j=N(q.materialNames),b=N(q.entityNames),C=N(q.dataPaths),A=h.length>0||y.length>0||null!=q.rowCount||null!=q.columnCount||null!=q.formulaCount||null!=q.mergeCount,S=L(y,"column"),P=(null!=(e=null==I?void 0:I.chunks)?e:[]).map(e=>E(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,t)=>({key:"row-".concat(t),name:e})),k=(null!=(t=null==I?void 0:I.chunks)?t:[]).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)}));(A||S.length>0||P.length>0||k.length>0)&&o.push({key:"table",label:"表格",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[A&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[D("Sheet",h,W),D("表头",y,W),D("行数",q.rowCount),D("列数",q.columnCount),D("公式数",q.formulaCount),D("合并单元格",q.mergeCount)]}),S.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:S,columns:[{title:"列名",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})}]}),P.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:P,columns:[{title:"行范围",dataIndex:"name",render:e=>(0,n.jsxs)(u.A,{color:"gold",className:"cursor-pointer",onClick:()=>W(String(e)),children:["行 ",String(e)]})}]}),k.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:k,pagination:{pageSize:10},columns:[{title:"表格网格预览",dataIndex:"cells",render:e=>(0,n.jsx)(d.A,{wrap:!0,children:e.map((e,t)=>(0,n.jsx)(u.A,{children:e},"".concat(e,"-").concat(t)))})}]})]})});let R=_.length>0||x.length>0||w.length>0||v.length>0||j.length>0||b.length>0,M=[...L(_,"layer").map(e=>({...e,type:"图层"})),...L(w,"entity").map(e=>({...e,type:"实体类型"})),...L(x,"block").map(e=>({...e,type:"块/符号"}))];(R||_.length>0||M.length>0)&&o.push({key:"drawing",label:"图纸",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[R&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[D("图层",_,W),D("块/符号",x,W),D("实体类型",w,W),D("产品/零件",v,W),D("材料",j,W),D("实体名称",b,W)]}),_.length>0&&(0,n.jsxs)(g.A,{size:"small",title:"图层开关 / 图纸预览",children:[(0,n.jsx)(p.A.Group,{value:U,options:_.map(e=>({label:e,value:e})),onChange:e=>X(e.map(String))}),(0,n.jsx)("div",{className:z().drawingPreview,children:U.map(e=>(0,n.jsx)(u.A,{color:"blue",children:e},e))})]}),M.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:M,columns:[{title:"类型",dataIndex:"type",width:120},{title:"名称",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})}]})]})});let F=(null!=(l=null==I?void 0:I.chunks)?l:[]).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,n,r,i;let a=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(t),path:null!=(r=null==a||null==(l=a[1])?void 0:l.trim())?r:e,value:null!=(i=null==a||null==(n=a[2])?void 0:n.trim())?i:""}});(C.length>0||F.length>0)&&o.push({key:"data",label:"数据路径",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[C.length>0&&(0,n.jsx)(f.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[n,r]=e;return{title:n,key:t?"".concat(t,".").concat(n):n,children:l(r,t?"".concat(t,".").concat(n):n)}})};return l(t)}(C),onSelect:e=>{var t;return W(String(null!=(t=e[0])?t:""))}}),F.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:F,pagination:{pageSize:20},columns:[{title:"Path",dataIndex:"path",width:260,render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})},{title:"Value",dataIndex:"value",render:e=>(0,n.jsx)("span",{className:"break-all",children:String(e)})}]})]})});let T=[q.ocrRecommended,q.ocrReason,q.ocrProvider,q.ocrLanguages,q.ocrTextLength,q.pdfPageOcrSupported,q.ocrPageCount,q.pdfOcrPageLimit,q.pdfRenderer,q.pdfPageCount,q.textPages,q.ocrAugmented,q.ocrPages,q.failedPages,q.imagePreprocessor].some(e=>null!=e),B=(null!=(r=null==I?void 0:I.chunks)?r:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,t,l,n)=>{var r,i,a;return l%2==0&&e.push({key:"page-".concat(t),page:t,text:null!=(a=null==(i=n[l+1])||null==(r=i.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:r.trim())?a:""}),e},[]),J=(null==I?void 0:I.file.format)==="pdf";return(T||J||B.length>0)&&o.push({key:"ocr",label:"OCR/PDF",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[T&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[D("OCR 建议",q.ocrRecommended),D("OCR 原因",q.ocrReason),D("OCR 引擎",q.ocrProvider),D("OCR 语言",q.ocrLanguages),D("OCR 文本长度",q.ocrTextLength),D("PDF 总页数",q.pdfPageCount),D("PDF 文本页数",q.textPages),D("PDF 已 OCR 增强",q.ocrAugmented),D("PDF OCR 页码",Array.isArray(q.ocrPages)?q.ocrPages.join(", "):q.ocrPages),D("PDF 失败页",Array.isArray(q.failedPages)?q.failedPages.map(e=>JSON.stringify(e)).join("; "):q.failedPages),D("PDF 页面 OCR 支持",q.pdfPageOcrSupported),D("PDF OCR 页数",q.ocrPageCount),D("PDF OCR 页数上限",q.pdfOcrPageLimit),D("PDF 渲染器",q.pdfRenderer),D("图像预处理",q.imagePreprocessor)]}),J&&(0,n.jsx)("div",{className:z().pdfPreviewStrip,children:Array.from({length:Math.min(Number(null!=(s=null!=(i=q.pdfPageCount)?i:q.ocrPageCount)?s:1)||1,6)},(e,t)=>(0,n.jsx)(a(),{width:220,height:320,src:"/api/kb/files/preview-pdf-page?relativePath=".concat(encodeURIComponent(I.file.relativePath),"&page=").concat(t+1),alt:"PDF 第 ".concat(t+1," 页"),unoptimized:!0},t))}),B.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:B,pagination:{pageSize:10},columns:[{title:"页码",dataIndex:"page",width:90},{title:"OCR 文本",dataIndex:"text",render:e=>(0,n.jsx)(O,{ellipsis:{rows:4,expandable:!0,symbol:"展开"},children:String(e)})}]})]})}),o},[q,I,U]),er=[{title:"序号",key:"index",width:70,render:(e,t,l)=>l+1},{title:b("knowledge.chunkIndex"),dataIndex:"chunkIndex",width:90,render:e=>String(e)},{title:b("knowledge.chunkType"),width:110,render:(e,t)=>{var l;return(0,n.jsx)(u.A,{children:String(null!=(l=E(t.metadataJson).chunkKind)?l:t.category)})}},{title:b("knowledge.sectionOrRange"),width:220,render:(e,t)=>{let l=E(t.metadataJson),r="string"==typeof l.rowRange?l.rowRange:void 0;return(0,n.jsxs)(d.A,{wrap:!0,children:[t.sectionTitle?(0,n.jsx)(u.A,{color:"cyan",children:t.sectionTitle}):null,r?(0,n.jsxs)(u.A,{color:"gold",children:["行 ",r]}):null]})}},{title:"Token",dataIndex:"tokenCount",width:90},{title:b("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(O,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:z().searchContent,children:M(t.content,G)})}],ei=[{title:"序号",key:"index",width:70,render:(e,t,l)=>l+1},{title:b("knowledge.parentChunkId"),dataIndex:"parentId",width:260,render:e=>(0,n.jsx)("span",{className:"break-all",children:e})},{title:"切片数",dataIndex:"chunkCount",width:90},{title:"章节",dataIndex:"sectionTitle",width:220},{title:b("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(O,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:z().searchContent,children:M(t.content,G)})}];return T?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(y.A,{active:!0,paragraph:{rows:1}}),(0,n.jsx)(g.A,{size:"small",children:(0,n.jsx)(y.A,{active:!0,paragraph:{rows:6}})}),(0,n.jsx)(g.A,{size:"small",children:(0,n.jsx)(y.A,{active:!0,paragraph:{rows:4}})})]}):J?(0,n.jsx)(_.A,{type:"error",showIcon:!0,message:"文件详情加载失败",description:J}):I?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(w.Ay,{icon:(0,n.jsx)(S,{}),href:"/knowledge/files",size:"small",style:{marginBottom:12},children:"返回文件列表"}),(0,n.jsxs)("div",{className:z().searchResultHeader,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:"文件详情"}),(0,n.jsx)("p",{className:"pageDesc",children:"查看解析结果、图纸/表格/数据结构化字段、parent chunk 和 child chunk。"})]}),(0,n.jsxs)(d.A,{children:[(0,n.jsx)(w.Ay,{onClick:()=>{et(null==I?void 0:I.absolutePath)},children:"复制原文件路径"}),(0,n.jsx)(w.Ay,{onClick:()=>{et(null==I?void 0:I.directory)},children:"复制所在目录"}),(0,n.jsx)(w.Ay,{onClick:()=>{el("file")},children:"打开文件"}),(0,n.jsx)(w.Ay,{onClick:()=>{el("directory")},children:"打开目录"}),"pdf"===I.file.format?(0,n.jsx)(w.Ay,{loading:H,onClick:()=>{ee()},children:"重新 OCR"}):null,(0,n.jsx)(w.Ay,{type:"primary",loading:H,onClick:()=>{ee()},children:"重建该文件索引"})]})]})]}),(0,n.jsx)(g.A,{size:"small",title:"基础信息",children:(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[(0,n.jsx)(c.A.Item,{label:"路径",children:I.file.relativePath}),(0,n.jsx)(c.A.Item,{label:"原文件",children:null!=(e=I.absolutePath)?e:"-"}),(0,n.jsx)(c.A.Item,{label:"所在目录",children:null!=(t=I.directory)?t:"-"}),(0,n.jsxs)(c.A.Item,{label:"分类",children:[(0,n.jsx)(u.A,{children:(0,R.Jm)(I.file.category)})," ",(0,n.jsx)(u.A,{children:I.file.format})]}),(0,n.jsx)(c.A.Item,{label:"大小",children:(0,R.z3)(I.file.fileSize)}),(0,n.jsx)(c.A.Item,{label:"切片数",children:I.file.chunkCount}),(0,n.jsx)(c.A.Item,{label:"状态",children:I.file.status}),(0,n.jsx)(c.A.Item,{label:"解析模式",children:String(null!=(l=q.extractionMode)?l:"-")}),(0,n.jsx)(c.A.Item,{label:"覆盖范围",children:String(null!=(i=q.contentCoverage)?i:"-")}),(0,n.jsx)(c.A.Item,{label:"正文长度",children:String(null!=(o=q.textLength)?o:"-")})]})}),en.length>0&&(0,n.jsx)(g.A,{size:"small",title:"结构化信息",children:(0,n.jsx)(v.A,{items:en})}),(0,n.jsx)(g.A,{size:"small",title:"详情筛选",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[(0,n.jsx)(j.A,{allowClear:!0,value:G,onChange:e=>W(e.target.value),placeholder:"筛选 rowRange、图层、实体、data path、section、chunk 内容"}),G?(0,n.jsxs)(d.A,{wrap:!0,children:[(0,n.jsxs)(u.A,{color:"blue",children:[b("knowledge.parentMatches")," ",Q.length]}),(0,n.jsxs)(u.A,{color:"green",children:[b("knowledge.childMatches")," ",Z.length]}),(0,n.jsxs)(u.A,{color:"purple",children:[b("knowledge.filterTerm")," ",G]})]}):null]})}),(0,n.jsxs)(g.A,{size:"small",title:"".concat(b("knowledge.parentChunks")," (").concat(Q.length,"/").concat(I.parents.length,")"),children:[(0,n.jsx)(_.A,{type:"info",showIcon:!0,message:b("knowledge.parentChunkHint"),style:{marginBottom:12}}),(0,n.jsx)(m.A,{rowKey:"id",columns:ei,dataSource:Q,pagination:{pageSize:10},size:"small"})]}),(0,n.jsx)(g.A,{size:"small",title:"".concat(b("knowledge.childChunks")," (").concat(Z.length,"/").concat(I.chunks.length,")"),children:(0,n.jsx)(m.A,{rowKey:"id",columns:er,dataSource:Z,pagination:{pageSize:20},size:"small"})})]}):(0,n.jsx)(x.A,{description:"请选择文件"})}},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 n=l(34007),r=l(62956),i=l(49952),a=n._(l(4632));function s(e){let{props:t}=(0,r.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=i.Image}},e=>{e.O(0,[433,787,576,985,375,102,506,289,861,636,593,792],()=>e(e.s=37690)),_N_E=e.O()}]);