@customize-agent/server 4.0.1 → 4.0.2
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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +143 -121
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/chunks/{774.js → 1547.js} +12 -12
- package/.next/server/chunks/3328.js +2 -2
- package/.next/server/chunks/3445.js +14 -14
- package/.next/server/chunks/550.js +1 -0
- package/.next/server/chunks/7367.js +1 -0
- package/.next/server/chunks/8204.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/_app.js +1 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_error.js +1 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/api/assets/generated/preview.js +1 -1
- package/.next/server/pages/api/assets/generated/preview.js.nft.json +1 -1
- package/.next/server/pages/api/assets/generated.js +1 -1
- package/.next/server/pages/api/assets/generated.js.nft.json +1 -1
- package/.next/server/pages/api/config/embedding/healthCheck.js +1 -1
- package/.next/server/pages/api/config/embedding/healthCheck.js.nft.json +1 -1
- package/.next/server/pages/api/config/embedding.js +1 -1
- package/.next/server/pages/api/config/healthCheck.js +2 -2
- package/.next/server/pages/api/config/providers.js +2 -2
- package/.next/server/pages/api/documents/chapter/regenerate.js +1 -1
- package/.next/server/pages/api/documents/chapter/regenerate.js.nft.json +1 -1
- package/.next/server/pages/api/documents/export.js +3 -3
- package/.next/server/pages/api/documents/export.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generate.js +2 -2
- package/.next/server/pages/api/documents/generate.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id].js +1 -1
- package/.next/server/pages/api/documents/generated/[id].js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated.js +1 -1
- package/.next/server/pages/api/documents/generated.js.nft.json +1 -1
- package/.next/server/pages/api/documents/roles.js +1 -1
- package/.next/server/pages/api/documents/specs.js +1 -1
- package/.next/server/pages/api/documents/specs.js.nft.json +1 -1
- package/.next/server/pages/api/documents/templates.js +1 -1
- package/.next/server/pages/api/documents/templates.js.nft.json +1 -1
- package/.next/server/pages/api/kb/categories.js.nft.json +1 -1
- package/.next/server/pages/api/kb/duplicates.js.nft.json +1 -1
- package/.next/server/pages/api/kb/features.js +1 -1
- package/.next/server/pages/api/kb/files/detail.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/open.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/preview-pdf-page.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/reindex.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files.js +2 -2
- package/.next/server/pages/api/kb/files.js.nft.json +1 -1
- package/.next/server/pages/api/kb/ignore.js.nft.json +1 -1
- package/.next/server/pages/api/kb/operations.js.nft.json +1 -1
- package/.next/server/pages/api/kb/reindex.js +2 -1
- package/.next/server/pages/api/kb/reindex.js.nft.json +1 -1
- package/.next/server/pages/api/kb/search.js.nft.json +1 -1
- package/.next/server/pages/api/kb/stats.js.nft.json +1 -1
- package/.next/server/pages/api/kb/tags.js.nft.json +1 -1
- package/.next/server/pages/api/kb/upload/progress.js +1 -1
- package/.next/server/pages/api/kb/upload/progress.js.nft.json +1 -1
- package/.next/server/pages/api/kb/upload.js +1 -1
- package/.next/server/pages/api/kb/upload.js.nft.json +1 -1
- package/.next/server/pages/api/prompt.js +1 -1
- package/.next/server/pages/api/system/logs.js +2 -2
- package/.next/server/pages/asset-library.html +1 -1
- package/.next/server/pages/asset-library.js.nft.json +1 -1
- package/.next/server/pages/context/long-term.html +1 -1
- package/.next/server/pages/context/long-term.js.nft.json +1 -1
- package/.next/server/pages/context/short-term.html +1 -1
- package/.next/server/pages/context/short-term.js.nft.json +1 -1
- package/.next/server/pages/document-roles.html +1 -1
- package/.next/server/pages/document-roles.js.nft.json +1 -1
- package/.next/server/pages/document-specs.html +1 -1
- package/.next/server/pages/document-specs.js.nft.json +1 -1
- package/.next/server/pages/documents.html +1 -1
- package/.next/server/pages/documents.js.nft.json +1 -1
- package/.next/server/pages/guide.html +1 -1
- package/.next/server/pages/guide.js.nft.json +1 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/file-detail.js.nft.json +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/files.js.nft.json +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/manage.js.nft.json +1 -1
- package/.next/server/pages/knowledge/search.html +1 -1
- package/.next/server/pages/knowledge/search.js.nft.json +1 -1
- package/.next/server/pages/knowledge.html +1 -1
- package/.next/server/pages/knowledge.js.nft.json +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/models.js.nft.json +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages/overview.js.nft.json +1 -1
- package/.next/server/pages/prompt.html +1 -1
- package/.next/server/pages/prompt.js.nft.json +1 -1
- package/.next/server/pages/settings.html +1 -1
- package/.next/server/pages/settings.js.nft.json +1 -1
- package/.next/server/pages/system/logs.html +1 -1
- package/.next/server/pages/system/logs.js.nft.json +1 -1
- package/.next/server/pages-manifest.json +24 -25
- package/.next/static/JSSClm7Ao89P7zD8JkYIG/_buildManifest.js +1 -0
- package/.next/static/chunks/{1289-ada402215e8934cc.js → 1289-c788c44e65e9dc64.js} +2 -2
- package/.next/static/chunks/2225-a90b5cc9338c63fa.js +1 -0
- package/.next/static/chunks/261-8a5ce39d74fc746e.js +1 -0
- package/.next/static/chunks/2884-b2944538a4a0d9b2.js +1 -0
- package/.next/static/chunks/3057-9eda004e07594513.js +1 -0
- package/.next/static/chunks/3455-c73ce4738620db20.js +6 -0
- package/.next/static/chunks/347-62c74776c299477d.js +4 -0
- package/.next/static/chunks/4833-bf56f1203e2daffa.js +28 -0
- package/.next/static/chunks/6578-6422ce4e29eb07d4.js +1 -0
- package/.next/static/chunks/7223-58376fd8a1d62df4.js +1 -0
- package/.next/static/chunks/7271-587c30b66ea4e619.js +16 -0
- package/.next/static/chunks/7576-b34ccf53f6efc388.js +1 -0
- package/.next/static/chunks/{8449-641d34b05c795c85.js → 8326-b79c7555af5866e7.js} +3 -3
- package/.next/static/chunks/8676-5982391f15ea1190.js +1 -0
- package/.next/static/chunks/8732-69ffc27ed6c68f6f.js +4 -0
- package/.next/static/chunks/8787-c8bea0f25cbd3cf0.js +25 -0
- package/.next/static/chunks/9144-51689069a3d341e5.js +1 -0
- package/.next/static/chunks/9773-53116cd0bf4b961a.js +1 -0
- package/.next/static/chunks/pages/_app-38ff7f551a80399f.js +140 -0
- package/.next/static/chunks/pages/asset-library-634d18652eb7507d.js +1 -0
- package/.next/static/chunks/pages/context/long-term-820cba5f1ae3a6cd.js +1 -0
- package/.next/static/chunks/pages/context/short-term-3332ffb90b3b58a9.js +1 -0
- package/.next/static/chunks/pages/document-roles-ab6dfead3fd99a2c.js +1 -0
- package/.next/static/chunks/pages/document-specs-565cf77237fce3d5.js +1 -0
- package/.next/static/chunks/pages/documents-c04e4ed600384e6a.js +1 -0
- package/.next/static/chunks/pages/guide-c5ef2e13eab4c312.js +1 -0
- package/.next/static/chunks/pages/knowledge/file-detail-f5e8f9bc35ebb92d.js +1 -0
- package/.next/static/chunks/pages/knowledge/files-88aba3534bd722f9.js +1 -0
- package/.next/static/chunks/pages/knowledge/manage-5629ccce14402b99.js +1 -0
- package/.next/static/chunks/pages/knowledge/search-72a46d6d1200ef93.js +1 -0
- package/.next/static/chunks/pages/models-a37db9926d9a0a52.js +1 -0
- package/.next/static/chunks/pages/overview-3dd4c539302d7349.js +1 -0
- package/.next/static/chunks/pages/prompt-0184d79af09db7e1.js +1 -0
- package/.next/static/chunks/pages/settings-fd31c9ef833cf0af.js +1 -0
- package/.next/static/chunks/pages/system/logs-8040fb1e0c814a0c.js +1 -0
- package/.next/static/css/09be1fdeab8595ab.css +1 -0
- package/.next/static/css/38dba0a7a42a8df3.css +1 -0
- package/README.md +38 -179
- package/package.json +3 -3
- package/.next/server/pages/api/assets/generated/test-generate.js +0 -1
- package/.next/server/pages/api/assets/generated/test-generate.js.nft.json +0 -1
- package/.next/static/Qg6HhehDEGMR0UQnE32Qh/_buildManifest.js +0 -1
- package/.next/static/chunks/1210-248760e61b298769.js +0 -28
- package/.next/static/chunks/2169-61474562e3e8475e.js +0 -1
- package/.next/static/chunks/2427-1f06499470a4acd3.js +0 -1
- package/.next/static/chunks/2700-1fbf324dcb6a552a.js +0 -1
- package/.next/static/chunks/4123-905de4c001b14351.js +0 -4
- package/.next/static/chunks/4260-46debd1ad52f4fde.js +0 -28
- package/.next/static/chunks/4696-5a425ced63368f89.js +0 -1
- package/.next/static/chunks/4976-2d6f56260b2ddff9.js +0 -1
- package/.next/static/chunks/5695-7c19c1352a381c69.js +0 -6
- package/.next/static/chunks/7576-c41e699f2110b989.js +0 -1
- package/.next/static/chunks/7888-7b28d859128998a2.js +0 -1
- package/.next/static/chunks/8332-b27e9ac89c517608.js +0 -1
- package/.next/static/chunks/9551-0bb7ba56a79b7cd7.js +0 -16
- package/.next/static/chunks/9958-af48a40832894bb6.js +0 -1
- package/.next/static/chunks/9978-3df3ef9c76cee8b8.js +0 -1
- package/.next/static/chunks/pages/_app-78551e7d4385884b.js +0 -140
- package/.next/static/chunks/pages/asset-library-0665e1c9afd893f0.js +0 -1
- package/.next/static/chunks/pages/context/long-term-1f59d30548b89c31.js +0 -1
- package/.next/static/chunks/pages/context/short-term-851f8aee7b0abff1.js +0 -1
- package/.next/static/chunks/pages/document-roles-14631ba08e2f829f.js +0 -1
- package/.next/static/chunks/pages/document-specs-afd35d3937f2cadb.js +0 -1
- package/.next/static/chunks/pages/documents-2b15480b93097015.js +0 -1
- package/.next/static/chunks/pages/guide-34569e4ab4e65192.js +0 -1
- package/.next/static/chunks/pages/knowledge/file-detail-ae28021746550a37.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-cf84b9b9e834dfc7.js +0 -1
- package/.next/static/chunks/pages/knowledge/manage-0ab6c109beca045d.js +0 -1
- package/.next/static/chunks/pages/knowledge/search-8cb8614a649bb57c.js +0 -1
- package/.next/static/chunks/pages/models-d761e0a64090c564.js +0 -1
- package/.next/static/chunks/pages/overview-4389fb201fd42078.js +0 -1
- package/.next/static/chunks/pages/prompt-69407f71ba27bf48.js +0 -1
- package/.next/static/chunks/pages/settings-af3b67f0b96364b5.js +0 -1
- package/.next/static/chunks/pages/system/logs-27588e6d25aee564.js +0 -1
- package/.next/static/css/0e153583d22cc52e.css +0 -1
- package/.next/static/css/7938cb5de6aedc8c.css +0 -1
- package/.next/static/css/82b6ddff0ef364fe.css +0 -1
- package/.next/static/css/9af88fe8ee791d26.css +0 -1
- /package/.next/static/{Qg6HhehDEGMR0UQnE32Qh → JSSClm7Ao89P7zD8JkYIG}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2958],{63806:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>I});var n=i(65321),l=i(97109),a=i(17807),s=i(25258),r=i(88762),o=i(2256),c=i(38770),d=i(68787),p=i(33442),x=i(85114),h=i(84253),g=i(71102),y=i(384),m=i(11702),f=i(58209),u=i(93051),j=i(81668),w=i(64254),v=i(26619),A=i(85855),b=i(75548),k=i(56768),S=i(32620),z=i(6578);let C={knowledge_base:"知识库",generated:"AI生成",uploaded:"上传",external_url:"外部URL"},_={cover:"magenta",reference:"blue",generated:"purple",attachment:"cyan",map:"orange",operator:"geekblue"};function I(){let e=(0,S.Vr)(),{message:t}=a.A.useApp(),[i,I]=(0,l.useState)([]),[N,T]=(0,l.useState)(new Set),[E,F]=(0,l.useState)(!0),P=async()=>{try{I((await (0,z.f$)()).assets)}catch(e){I([])}};(0,l.useEffect)(()=>{F(!0),P().finally(()=>F(!1))},[]);let B=async e=>{var i;e&&(await (null==(i=navigator.clipboard)?void 0:i.writeText(e)),t.success("已复制路径"))},D=async(e,i)=>{try{"index"===i?(I((await (0,z.uc)(e)).assets),t.success("已加入知识库索引")):"openFile"===i?await (0,z.oS)(e,"file"):"openDirectory"===i?await (0,z.oS)(e,"directory"):"delete"===i&&(I((await (0,z.JU)(e)).assets),T(t=>{let i=new Set(t);return i.delete(e),i}))}catch(e){t.error(e instanceof Error?e.message:"操作失败")}},R=n=>{let l="selected"===n?[...N]:i.map(e=>e.id);0!==l.length&&s.A.confirm({title:"all"===n?"删除全部资源?":"删除已选 ".concat(l.length," 个资源?"),content:"此操作不可撤销。",okText:e("common.confirm"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{F(!0);try{await Promise.all(l.map(e=>(0,z.JU)(e))),await P(),T(new Set),t.success("已删除 ".concat(l.length," 个资源"))}catch(e){t.error("批量删除失败")}finally{F(!1)}}})},W=e=>{T(t=>{let i=new Set(t);return i.has(e)?i.delete(e):i.add(e),i})};return E?(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)(o.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)(x.Ay,{danger:!0,size:"small",disabled:0===N.size,icon:(0,n.jsx)(f.A,{}),onClick:()=>R("selected"),children:["删除已选 ",N.size||""]}),(0,n.jsx)(x.Ay,{danger:!0,size:"small",disabled:0===i.length,onClick:()=>R("all"),children:"删除全部"})]})]}),0===i.length?(0,n.jsx)(h.A,{description:"暂无生成资源"}):(0,n.jsx)(o.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)):void 0,a=N.has(t.id),s=[...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)(w.A,{}),label:"打开目录",onClick:()=>{D(t.id,"openDirectory")}}]:[],...!t.indexed&&t.path?[{key:"index",icon:(0,n.jsx)(v.A,{}),label:"加入知识库",onClick:()=>{D(t.id,"index")}}]:[],{type:"divider"},{key:"delete",icon:(0,n.jsx)(f.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:a?"2px solid #1677ff":void 0,cursor:"pointer",position:"relative"},onClick:()=>W(t.id),children:[(0,n.jsx)("div",{onClick:e=>{e.stopPropagation(),W(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:a?"#1677ff":"rgba(0,0,0,0.6)",color:"#fff",fontSize:12,fontWeight:700},children:a?"✓":""}),(0,n.jsx)(g.A,{menu:{items:s},trigger:["click"],placement:"bottomRight",children:(0,n.jsx)(x.Ay,{type:"text",size:"small",icon:(0,n.jsx)(A.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)(b.A,{style:{color:"var(--colorWarning)",fontSize:15,flexShrink:0}}):(0,n.jsx)(k.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)(m.A,{color:t.indexed?"success":"default",style:{margin:0,fontSize:10,lineHeight:"16px"},children:t.indexed?"已入库":"未入库"}),(0,n.jsx)(m.A,{color:_[t.role]||"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:t.role}),(0,n.jsx)(m.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:[C[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,[347,8787,4277,7889,7150,2073,6578,636,6593,8792],()=>e(e.s=85015)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[893],{260:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>k});var n=a(65321),o=a(97109),c=a(32620),r=a(17807),s=a(11702),l=a(85114),i=a(26171),d=a(33442),m=a(7576),h=a(68787),u=a(54849),x=a(21289),g=a(25258),p=a(63455),f=a(99650),w=a(58209),j=a(30486),A=a(83374),y=a(8383),v=a(26619),S=a(53998),_=a(6578),C=a(45551);let z={project_fact:"项目知识",user_preference:"用户偏好",feedback:"历史纠偏",pattern:"解决方案"},N={high:"red",medium:"orange",low:"default"};function k(){let e=(0,c.Vr)(),{message:t}=r.A.useApp(),[a,k]=(0,o.useState)(!0),[T,b]=(0,o.useState)([]),[D,I]=(0,o.useState)({count:0,totalBytes:0}),[M,B]=(0,o.useState)(""),[E,P]=(0,o.useState)(!1),[O,L]=(0,o.useState)(null),[U,F]=(0,o.useState)(""),[H,J]=(0,o.useState)(""),[K,X]=(0,o.useState)(!1),G=async a=>{k(!0);try{let[e,t]=await Promise.all([(0,_.hn)("long_term",a),(0,_.p)("long_term")]);b(e),I(t)}catch(a){t.error(e("common.error"))}finally{k(!1)}};(0,o.useEffect)(()=>{G()},[]);let V=async a=>{try{await (0,_.xw)(a),t.success(e("common.success")),await G(M)}catch(a){t.error(e("common.error"))}},W=async()=>{try{await (0,_.PH)("long_term"),t.success(e("common.success")),await G(M)}catch(a){t.error(e("common.error"))}},q=async()=>{try{await (0,_.E)("long_term"),t.success(e("common.success")),await G(M)}catch(a){t.error(e("common.error"))}},Q=async()=>{if(O&&U.trim()){X(!0);try{await (0,_.zo)(O.id,{content:U.trim(),context:H||void 0}),t.success(e("common.success")),P(!1),await G(M)}catch(a){t.error(e("common.error"))}finally{X(!1)}}},R=[{title:"序号",key:"index",width:70,render:(e,t,a)=>a+1},{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:"类型",dataIndex:"type",width:90,render:e=>(0,n.jsx)(s.A,{children:z[e]||e})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,n.jsx)(s.A,{color:N[e]||"default",children:"high"===e?"高":"medium"===e?"中":"低"})},{title:e("context.source"),dataIndex:"source",width:100,ellipsis:!0},{title:e("context.updatedAt"),dataIndex:"updated_at",width:140,render:e=>e?new Date(e).toLocaleString():"-"},{title:e("common.edit"),width:100,render:(t,a)=>(0,n.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,n.jsx)(l.Ay,{size:"small",type:"text",icon:(0,n.jsx)(f.A,{}),onClick:()=>{L(a),F(a.content),J(""),P(!0)}}),(0,n.jsx)(i.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{V(a.id)},children:(0,n.jsx)(l.Ay,{size:"small",type:"text",danger:!0,icon:(0,n.jsx)(w.A,{})})})]})}];return(0,n.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:e("nav.longTermContext")}),(0,n.jsx)("p",{className:"pageDesc",children:e("context.longTermDesc")})]}),(0,n.jsxs)(d.A,{wrap:!0,children:[(0,n.jsx)(m.A,{prefix:(0,n.jsx)(j.A,{}),placeholder:e("common.search"),value:M,onChange:e=>B(e.target.value),onPressEnter:()=>{G(M)},allowClear:!0,style:{width:240}}),(0,n.jsx)(l.Ay,{icon:(0,n.jsx)(A.A,{}),onClick:()=>{W()},children:"压缩"}),(0,n.jsx)(i.A,{title:"确定清除长期上下文吗?",onConfirm:()=>{q()},children:(0,n.jsx)(l.Ay,{danger:!0,icon:(0,n.jsx)(y.A,{}),children:"清除"})})]})]}),(0,n.jsx)(h.A,{size:"small",children:(0,n.jsx)(u.A,{title:"总上下文大小",value:(0,C.z3)(D.totalBytes),prefix:(0,n.jsx)(v.A,{}),suffix:" / ".concat(D.count," 条")})}),(0,n.jsxs)(h.A,{size:"small",children:[(0,n.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,n.jsx)(S.A,{})," ",e("context.longTermSource")]}),(0,n.jsx)(x.A,{rowKey:"id",columns:R,dataSource:T,loading:a,size:"small",pagination:{pageSize:15}})]}),(0,n.jsx)(g.A,{maskClosable:!1,title:e("models.editModel"),open:E,onCancel:()=>P(!1),onOk:()=>{Q()},confirmLoading:K,okText:e("common.save"),cancelText:e("common.cancel"),children:(0,n.jsxs)(p.A,{layout:"vertical",size:"middle",children:[(0,n.jsx)(p.A.Item,{label:e("context.content"),children:(0,n.jsx)(m.A.TextArea,{rows:6,value:U,onChange:e=>F(e.target.value)})}),(0,n.jsx)(p.A.Item,{label:e("context.source"),children:(0,n.jsx)(m.A,{value:H,onChange:e=>J(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}},36382:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/long-term",function(){return a(260)}])},45551:(e,t,a)=>{"use strict";function n(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),a=e/Math.pow(1024,t);return"".concat(a.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let a=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(a/60),o=Math.floor(n/24);return o>30?new Date(e).toLocaleDateString(t):"en-US"===t?o>0?"".concat(o,"d ago"):n>0?"".concat(n,"h ago"):a>0?"".concat(a,"m ago"):"Just now":o>0?"".concat(o," 天前"):n>0?"".concat(n," 小时前"):a>0?"".concat(a," 分钟前"):"刚刚"}a.d(t,{Jm:()=>s,fw:()=>o,z3:()=>n});let c={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},r={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 a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===a?r:c)[e])?t:e}}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,2884,9144,9189,6985,7150,3455,1289,8932,6578,636,6593,8792],()=>e(e.s=36382)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6409],{19164:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/short-term",function(){return a(51162)}])},45551:(e,t,a)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),a=e/Math.pow(1024,t);return"".concat(a.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let a=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(a/60),n=Math.floor(o/24);return n>30?new Date(e).toLocaleDateString(t):"en-US"===t?n>0?"".concat(n,"d ago"):o>0?"".concat(o,"h ago"):a>0?"".concat(a,"m ago"):"Just now":n>0?"".concat(n," 天前"):o>0?"".concat(o," 小时前"):a>0?"".concat(a," 分钟前"):"刚刚"}a.d(t,{Jm:()=>s,fw:()=>n,z3:()=>o});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},c={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===a?c:r)[e])?t:e}},51162:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>N});var o=a(65321),n=a(97109),r=a(32620),c=a(17807),s=a(11702),i=a(85114),l=a(26171),d=a(33442),m=a(7576),h=a(68787),u=a(54849),x=a(21289),w=a(25258),f=a(63455),p=a(99650),g=a(58209),j=a(30486),A=a(83374),y=a(8383),v=a(26619),S=a(53998),C=a(6578),_=a(45551);let z={high:"red",medium:"orange",low:"default"};function N(){let e=(0,r.Vr)(),{message:t}=c.A.useApp(),[a,N]=(0,n.useState)(!0),[T,k]=(0,n.useState)([]),[D,M]=(0,n.useState)({count:0,totalBytes:0}),[b,B]=(0,n.useState)(""),[I,E]=(0,n.useState)(!1),[P,O]=(0,n.useState)(null),[L,U]=(0,n.useState)(""),[F,H]=(0,n.useState)(""),[J,K]=(0,n.useState)(!1),X=async a=>{N(!0);try{let[e,t]=await Promise.all([(0,C.hn)("short_term",a),(0,C.p)("short_term")]);k(e),M(t)}catch(a){t.error(e("common.error"))}finally{N(!1)}};(0,n.useEffect)(()=>{X()},[]);let G=async a=>{try{await (0,C.xw)(a),t.success(e("common.success")),await X(b)}catch(a){t.error(e("common.error"))}},V=async()=>{try{await (0,C.PH)("short_term"),t.success(e("common.success")),await X(b)}catch(a){t.error(e("common.error"))}},W=async()=>{try{await (0,C.E)("short_term"),t.success(e("common.success")),await X(b)}catch(a){t.error(e("common.error"))}},q=async()=>{if(P&&L.trim()){K(!0);try{await (0,C.zo)(P.id,{content:L.trim(),context:F||void 0}),t.success(e("common.success")),E(!1),await X(b)}catch(a){t.error(e("common.error"))}finally{K(!1)}}},Q=[{title:"序号",key:"index",width:70,render:(e,t,a)=>a+1},{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,o.jsx)(s.A,{color:z[e]||"default",children:"high"===e?"高":"medium"===e?"中":"低"})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.source"),dataIndex:"source",width:120,ellipsis:!0},{title:e("context.updatedAt"),dataIndex:"updated_at",width:140,render:e=>e?new Date(e).toLocaleString():"-"},{title:e("common.edit"),width:100,render:(t,a)=>(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,o.jsx)(i.Ay,{size:"small",type:"text",icon:(0,o.jsx)(p.A,{}),onClick:()=>{O(a),U(a.content),H(""),E(!0)}}),(0,o.jsx)(l.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{G(a.id)},children:(0,o.jsx)(i.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(g.A,{})})})]})}];return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.shortTermContext")}),(0,o.jsx)("p",{className:"pageDesc",children:e("context.shortTermDesc")})]}),(0,o.jsxs)(d.A,{wrap:!0,children:[(0,o.jsx)(m.A,{prefix:(0,o.jsx)(j.A,{}),placeholder:e("common.search"),value:b,onChange:e=>B(e.target.value),onPressEnter:()=>{X(b)},allowClear:!0,style:{width:240}}),(0,o.jsx)(i.Ay,{icon:(0,o.jsx)(A.A,{}),onClick:()=>{V()},children:"压缩"}),(0,o.jsx)(l.A,{title:"确定清除短期上下文吗?",onConfirm:()=>{W()},children:(0,o.jsx)(i.Ay,{danger:!0,icon:(0,o.jsx)(y.A,{}),children:"清除"})})]})]}),(0,o.jsx)(h.A,{size:"small",children:(0,o.jsx)(u.A,{title:"总上下文大小",value:(0,_.z3)(D.totalBytes),prefix:(0,o.jsx)(v.A,{}),suffix:" / ".concat(D.count," 条")})}),(0,o.jsxs)(h.A,{size:"small",children:[(0,o.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(S.A,{})," ",e("context.shortTermSource")]}),(0,o.jsx)(x.A,{rowKey:"id",columns:Q,dataSource:T,loading:a,size:"small",pagination:{pageSize:15}})]}),(0,o.jsx)(w.A,{maskClosable:!1,title:e("models.editModel"),open:I,onCancel:()=>E(!1),onOk:()=>{q()},confirmLoading:J,okText:e("common.save"),cancelText:e("common.cancel"),children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("context.content"),children:(0,o.jsx)(m.A.TextArea,{rows:6,value:L,onChange:e=>U(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(m.A,{value:F,onChange:e=>H(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,2884,9144,9189,6985,7150,3455,1289,8932,6578,636,6593,8792],()=>e(e.s=19164)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8623],{23507:(e,l,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return i(59889)}])},59889:(e,l,i)=>{"use strict";i.r(l),i.d(l,{default:()=>K});var r=i(65321),n=i(97109),s=i(35292),t=i(11702),o=i(17807),a=i(63455),c=i(84253),d=i(68787),p=i(85114),x=i(26171),m=i(33442),h=i(57271),u=i(85493),f=i(34052),y=i(7576),g=i(2256),j=i(38770),A=i(58569),b=i(25345),v=i(43979),I=i(80042),w=i(75548),S=i(26631),T=i(84662),z=i(30486),C=i(99650),k=i(8263),R=i(84742),_=i(43094),F=i(8579),B=i(58209),H=i(54746),W=i(96651),N=i(60470),D=i(6578),E=i(32620);let{Paragraph:P}=s.A,q={rule:(0,r.jsx)(b.A,{}),project_fact:(0,r.jsx)(v.A,{}),table:(0,r.jsx)(I.A,{}),drawing:(0,r.jsx)(w.A,{}),specification:(0,r.jsx)(S.A,{}),reference:(0,r.jsx)(T.A,{})},V={fact_extraction:(0,r.jsx)(z.A,{}),chapter_generation:(0,r.jsx)(C.A,{}),llm_review:(0,r.jsx)(k.A,{}),validation:(0,r.jsx)(R.A,{}),formatting:(0,r.jsx)(_.A,{}),reference:(0,r.jsx)(T.A,{})},O={rule:"#fa8c16",project_fact:"#1677ff",table:"#52c41a",drawing:"#722ed1",specification:"#eb2f96",reference:"#13c2c2"},G={fact_extraction:"#fa8c16",chapter_generation:"#1677ff",llm_review:"#722ed1",validation:"#52c41a",formatting:"#eb2f96",reference:"#13c2c2"},L={rule:"roles.ruleFile",project_fact:"roles.projectFactFile",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"},X=e=>(0,r.jsx)(t.A,{closable:e.closable,onClose:e.onClose,color:"blue",style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:e.label});function K(){let e,l,i=(0,E.Vr)(),{message:s}=o.A.useApp(),[b]=a.A.useForm(),[v]=a.A.useForm(),[I,w]=(0,n.useState)([]),[T,z]=(0,n.useState)([]),[k,R]=(0,n.useState)([]),[_,K]=(0,n.useState)([]),[U,J]=(0,n.useState)(!1),[M,Y]=(0,n.useState)(!1),[Z,$]=(0,n.useState)(!1),[ee,el]=(0,n.useState)("file"),[ei,er]=(0,n.useState)("custom"),en=async()=>{let[e,l,i]=await Promise.all([(0,D.lv)(),(0,D.HT)(),(0,D.dx)()]);w(e.roles),z(e.configs),R(l.files),K(i)};(0,n.useEffect)(()=>{en().catch(()=>s.error(i("common.error")))},[s,i]);let es=I.filter(e=>!e.builtIn),et=I.filter(e=>e.builtIn),eo=T.filter(e=>!e.builtIn),ea=T.filter(e=>e.builtIn),ec=e=>"all"===ei||("builtin"===ei?e.builtIn:!e.builtIn),ed=I.filter(ec),ep=T.filter(ec),ex=ed.filter(e=>"file"===e.type),em=ed.filter(e=>"prompt"===e.type),eh=I.filter(e=>"file"===e.type),eu=I.filter(e=>"prompt"===e.type),ef=async()=>{try{let e=await b.validateFields(),l=await (0,D.dg)(e);w(l.roles),z(l.configs),J(!1),s.success(i("common.success"))}catch(e){s.error(i("common.error"))}},ey=async()=>{try{let e=await v.validateFields(),l=e=>(null!=e?e:[]).map((e,l)=>{var i;return{roleId:e.roleId,order:Number(null!=(i=e.order)?i:l)}}),r=await (0,D.NR)({...e,fileRoles:l(e.fileRoles),promptRoles:l(e.promptRoles)});w(r.roles),z(r.configs),Y(!1),s.success(i("common.success"))}catch(e){s.error(i("common.error"))}},eg=async e=>{let l=await (0,D.FV)(e.type,e.id);w(l.roles),z(l.configs)},ej=async e=>{let l=await (0,D.dw)(e);w(l.roles),z(l.configs)},eA=function(e){var l;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file",r=(null==e?void 0:e.builtIn)?{...e,id:"".concat(e.id,"-copy-").concat(Date.now()),name:"".concat(e.name," Copy"),builtIn:!1}:e;(null==e?void 0:e.builtIn)&&s.info("内置角色不可直接编辑,已为你创建副本"),b.setFieldsValue(r?{...r,resourceIds:(null==(l=r.resourceIds)?void 0:l.length)?r.resourceIds:r.resourceId?[r.resourceId]:[]}:{id:"role-".concat(Date.now()),name:"",description:"",type:i,resourceIds:[],executionType:"prompt"===i?"reference":void 0,processingType:"file"===i?"reference":void 0}),J(!0)},eb=e=>{let l=(null==e?void 0:e.builtIn)?{...e,id:"".concat(e.id,"-copy-").concat(Date.now()),name:"".concat(e.name," Copy"),builtIn:!1}:e;(null==e?void 0:e.builtIn)&&s.info("内置项目配置不可直接编辑,已为你创建副本"),v.setFieldsValue(null!=l?l:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[],builtIn:!1}),Y(!0)},ev=e=>I.find(l=>l.id===e);return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"pageTitle",children:i("roles.title")}),(0,r.jsx)("p",{className:"pageDesc",children:i("roles.description")})]}),(0,r.jsxs)(m.A,{children:[(0,r.jsx)(h.A,{value:ei,onChange:er,style:{width:170},options:[{label:"我的配置 (".concat(es.length+eo.length,")"),value:"custom"},{label:"内置示例 (".concat(et.length+ea.length,")"),value:"builtin"},{label:"全部来源 (".concat(I.length+T.length,")"),value:"all"}]}),(0,r.jsx)(p.Ay,{icon:(0,r.jsx)(H.A,{}),onClick:()=>eA(void 0,"file"),children:i("roles.newFileRole")}),(0,r.jsx)(p.Ay,{icon:(0,r.jsx)(H.A,{}),onClick:()=>eA(void 0,"prompt"),children:i("roles.newPromptRole")}),(0,r.jsx)(p.Ay,{type:"primary",icon:(0,r.jsx)(H.A,{}),onClick:()=>eb(),children:i("roles.newConfig")})]})]}),(0,r.jsx)(u.A,{type:"info",showIcon:!0,message:(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsx)("span",{children:i("roles.plainGuideTitle")}),(0,r.jsx)(p.Ay,{type:"link",size:"small",icon:Z?(0,r.jsx)(W.A,{}):(0,r.jsx)(N.A,{}),onClick:()=>$(!Z),style:{padding:"0 4px"},children:Z?"收起说明":"展开说明"})]}),description:Z?i("roles.plainGuideDesc"):void 0}),(0,r.jsx)(d.A,{size:"small",tabList:[{key:"file",label:"文件角色 (".concat(ex.length,")")},{key:"prompt",label:"提示词角色 (".concat(em.length,")")},{key:"configs",label:"项目角色配置 (".concat(ep.length,")")}],activeTabKey:ee,onTabChange:el,children:"configs"===ee?0===ep.length?(0,r.jsx)(c.A,{description:i("common.noData")}):(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:ep.map(e=>{let l=e.fileRoles.map(e=>({...e,role:ev(e.roleId)})).filter(e=>e.role),n=e.promptRoles.map(e=>({...e,role:ev(e.roleId)})).filter(e=>e.role);return(0,r.jsxs)(d.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:6},children:[(0,r.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.name}),e.builtIn?(0,r.jsx)(t.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"内置示例"}):(0,r.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的配置"}),(0,r.jsxs)("div",{style:{display:"flex",gap:4,flexShrink:0},children:[(0,r.jsx)(p.Ay,{size:"small",icon:(0,r.jsx)(C.A,{}),onClick:()=>eb(e),children:e.builtIn?"复制":"编辑"}),(0,r.jsx)(x.A,{title:i("common.confirm"),disabled:e.builtIn,onConfirm:()=>{ej(e.id)},children:(0,r.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,r.jsx)(B.A,{}),disabled:e.builtIn})})]})]}),e.description&&(0,r.jsx)(P,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,r.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,r.jsxs)("div",{style:{marginBottom:4},children:[(0,r.jsxs)("span",{children:["文件角色 (",e.fileRoles.length,"): "]}),l.length>0?(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[l.slice(0,4).map(e=>(0,r.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),l.length>4&&(0,r.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",l.length-4]})]}):(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("span",{children:["提示词角色 (",e.promptRoles.length,"): "]}),n.length>0?(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[n.slice(0,4).map(e=>(0,r.jsx)(t.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),n.length>4&&(0,r.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",n.length-4]})]}):(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]})]})]},e.id)})}):(e="file"===ee?ex:em,l=i,0===e.length?(0,r.jsx)(c.A,{description:i("common.noData")}):(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(270px, 1fr))",gap:12},children:e.map((e,n)=>{var s,o,a,c,m,h,u,f,y;let g=(null==(s=e.resourceIds)?void 0:s.length)?e.resourceIds:e.resourceId?[e.resourceId]:[],j=g.slice(0,3),A=g.length-j.length,b="file"===e.type?null!=(a=q[null!=(o=e.processingType)?o:""])?a:(0,r.jsx)(S.A,{}):null!=(m=V[null!=(c=e.executionType)?c:""])?m:(0,r.jsx)(F.A,{}),v="file"===e.type?null!=(u=O[null!=(h=e.processingType)?h:""])?u:"var(--colorAccent)":null!=(y=G[null!=(f=e.executionType)?f:""])?y:"var(--colorWarning)";return(0,r.jsxs)(d.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:8},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,flex:1},children:[(0,r.jsx)("span",{style:{color:v,fontSize:16,flexShrink:0,lineHeight:1},children:b}),(0,r.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"20px"},children:e.name})]}),(0,r.jsx)("div",{style:{display:"flex",gap:4,flexShrink:0},children:e.builtIn?(0,r.jsx)(t.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"内置示例"}):(0,r.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的角色"})})]}),e.description&&(0,r.jsx)(P,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,r.jsxs)("div",{style:{marginBottom:8,display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,r.jsx)(t.A,{color:"file"===e.type?"blue":"purple",style:{margin:0},children:function(e,l){var i,r,n;let s="file"===e.type?L[null!=(i=e.processingType)?i:""]:Q[null!=(r=e.executionType)?r:""];return s?l(s):null!=(n="file"===e.type?e.processingType:e.executionType)?n:""}(e,l)}),g.length>0&&(0,r.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",g.length," 个资源"]})]}),j.length>0&&(0,r.jsx)("div",{style:{marginBottom:10},children:(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[j.map(e=>(0,r.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"},children:e},e)),A>0&&(0,r.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",A]})]})}),(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:6,paddingTop:4,borderTop:"1px solid var(--colorBorderSecondary)"},children:[(0,r.jsx)(p.Ay,{size:"small",icon:(0,r.jsx)(C.A,{}),onClick:()=>eA(e),children:e.builtIn?"复制":"编辑"}),(0,r.jsx)(x.A,{title:i("common.confirm"),disabled:e.builtIn,onConfirm:()=>{eg(e)},children:(0,r.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,r.jsx)(B.A,{}),disabled:e.builtIn})})]})]},e.id)})}))}),(0,r.jsx)(f.A,{title:i("roles.roleEditor"),open:U,onClose:()=>J(!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,r.jsx)(p.Ay,{type:"primary",onClick:()=>{ef()},children:i("common.save")}),children:(0,r.jsxs)(a.A,{form:b,layout:"vertical",children:[(0,r.jsx)(a.A.Item,{name:"id",hidden:!0,children:(0,r.jsx)(y.A,{})}),(0,r.jsxs)(g.A,{gutter:16,children:[(0,r.jsx)(j.A,{span:12,children:(0,r.jsx)(a.A.Item,{name:"type",label:i("roles.roleType"),rules:[{required:!0}],children:(0,r.jsx)(h.A,{options:[{label:i("roles.fileRole"),value:"file"},{label:i("roles.promptRole"),value:"prompt"}]})})}),(0,r.jsx)(j.A,{span:12,children:(0,r.jsx)(a.A.Item,{name:"name",label:i("roles.roleName"),rules:[{required:!0}],children:(0,r.jsx)(y.A,{})})})]}),(0,r.jsx)(a.A.Item,{name:"description",label:i("roles.roleDescription"),children:(0,r.jsx)(y.A.TextArea,{rows:2})}),(0,r.jsx)(a.A.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.type!==l.type,children:e=>{let{getFieldValue:l}=e,n="prompt"===l("type");return(0,r.jsx)(d.A,{size:"small",title:n?"提示词角色配置":"文件角色配置",style:{border:"1px solid var(--colorBorderSecondary)"},children:n?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.A.Item,{name:"executionType",label:i("roles.executionType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,r.jsx)(h.A,{options:[{label:i("roles.factExtraction"),value:"fact_extraction"},{label:i("roles.chapterGeneration"),value:"chapter_generation"},{label:i("roles.validation"),value:"validation"},{label:i("roles.formatting"),value:"formatting"},{label:i("roles.reference"),value:"reference"}]})}),(0,r.jsx)(a.A.Item,{name:"resourceIds",label:i("roles.bindPrompt"),style:{marginBottom:0},help:(0,r.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:i("roles.multiBindPromptHelp")}),children:(0,r.jsx)(h.A,{mode:"multiple",showSearch:!0,tagRender:X,placeholder:"选择提示词",options:_.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.A.Item,{name:"processingType",label:i("roles.processingType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,r.jsx)(h.A,{options:[{label:i("roles.ruleFile"),value:"rule"},{label:i("roles.projectFactFile"),value:"project_fact"},{label:i("roles.tableFile"),value:"table"},{label:i("roles.drawingFile"),value:"drawing"},{label:i("roles.specificationFile"),value:"specification"},{label:i("roles.reference"),value:"reference"}]})}),(0,r.jsx)(a.A.Item,{name:"resourceIds",label:i("roles.bindFile"),style:{marginBottom:0},help:(0,r.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:i("roles.multiBindFileHelp")}),children:(0,r.jsx)(h.A,{mode:"multiple",showSearch:!0,tagRender:X,placeholder:"选择知识库文件",options:k.map(e=>({label:e.relativePath,value:e.relativePath}))})})]})})}})]})}),(0,r.jsx)(f.A,{title:i("roles.configEditor"),open:M,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,r.jsx)(p.Ay,{type:"primary",onClick:()=>{ey()},children:i("common.save")}),children:(0,r.jsxs)(a.A,{form:v,layout:"vertical",children:[(0,r.jsx)(a.A.Item,{name:"id",hidden:!0,children:(0,r.jsx)(y.A,{})}),(0,r.jsxs)(g.A,{gutter:16,children:[(0,r.jsx)(j.A,{span:12,children:(0,r.jsx)(a.A.Item,{name:"name",label:i("roles.configName"),rules:[{required:!0}],children:(0,r.jsx)(y.A,{})})}),(0,r.jsx)(j.A,{span:12,children:(0,r.jsx)(a.A.Item,{name:"description",label:i("roles.configDescription"),children:(0,r.jsx)(y.A,{})})})]}),(0,r.jsx)(A.A,{destroyInactiveTabPane:!1,items:[{key:"file",label:"文件角色 (".concat(ex.length,")"),children:(0,r.jsx)(a.A.List,{name:"fileRoles",children:(e,l)=>{let{add:n,remove:s}=l;return(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0===e.length&&(0,r.jsx)(c.A,{description:"暂未添加文件角色"}),e.map((e,l)=>(0,r.jsxs)(d.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,r.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,r.jsx)(p.Ay,{danger:!0,size:"small",icon:(0,r.jsx)(B.A,{}),onClick:()=>s(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,r.jsxs)(g.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,r.jsx)(j.A,{flex:"auto",children:(0,r.jsx)(a.A.Item,{name:[e.name,"roleId"],label:"文件角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,r.jsx)(h.A,{placeholder:"选择文件角色",size:"small",options:eh.map(e=>{var l;return{label:"".concat(e.name," (").concat(i(L[null!=(l=e.processingType)?l:""]||"roles.reference"),")"),value:e.id}})})})}),(0,r.jsx)(j.A,{style:{width:90},children:(0,r.jsx)(a.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,r.jsx)(y.A,{type:"number",size:"small"})})})]})]},e.key)),(0,r.jsx)(p.Ay,{icon:(0,r.jsx)(H.A,{}),onClick:()=>n({order:e.length}),children:i("roles.addRole")})]})}})},{key:"prompt",label:"提示词角色 (".concat(eu.length,")"),children:(0,r.jsx)(a.A.List,{name:"promptRoles",children:(e,l)=>{let{add:n,remove:s}=l;return(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0===e.length&&(0,r.jsx)(c.A,{description:"暂未添加提示词角色"}),e.map((e,l)=>(0,r.jsxs)(d.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,r.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,r.jsx)(p.Ay,{danger:!0,size:"small",icon:(0,r.jsx)(B.A,{}),onClick:()=>s(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,r.jsxs)(g.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,r.jsx)(j.A,{flex:"auto",children:(0,r.jsx)(a.A.Item,{name:[e.name,"roleId"],label:"提示词角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,r.jsx)(h.A,{placeholder:"选择提示词角色",size:"small",options:eu.map(e=>{var l;return{label:"".concat(e.name," (").concat(i(Q[null!=(l=e.executionType)?l:""]||"roles.reference"),")"),value:e.id}})})})}),(0,r.jsx)(j.A,{style:{width:90},children:(0,r.jsx)(a.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,r.jsx)(y.A,{type:"number",size:"small"})})})]})]},e.key)),(0,r.jsx)(p.Ay,{icon:(0,r.jsx)(H.A,{}),onClick:()=>n({order:e.length}),children:i("roles.addRole")})]})}})}]})]})})]})}}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,9144,3455,5292,4052,8676,6578,636,6593,8792],()=>e(e.s=23507)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7580],{2256:(e,l,n)=>{"use strict";n.d(l,{A:()=>i});let i=n(25341).A},38770:(e,l,n)=>{"use strict";n.d(l,{A:()=>i});let i=n(51916).A},51533:(e,l,n)=>{"use strict";n.r(l),n.d(l,{default:()=>el});var i=n(65321),a=n(97109),t=n(11702),s=n(17807),r=n(63455),o=n(33442),c=n(57271),d=n(85114),m=n(85493),u=n(68787),h=n(58569),x=n(84253),p=n(38332),g=n(26171),j=n(34052),A=n(2256),b=n(7576),y=n(38770),v=n(83914),I=n(3638),f=n(32565),S=n(99452);function $(){return($=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var n=arguments[l];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}let k=a.forwardRef(({prefixCls:e="rc-switch",className:l,checked:n,defaultChecked:i,disabled:t,loadingIcon:s,checkedChildren:r,unCheckedChildren:o,onClick:c,onChange:d,onKeyDown:m,styles:u,classNames:h,...x},p)=>{let[g,j]=(0,f.A)(i??!1,n);function A(e,l){let n=g;return t||(j(n=e),d?.(n,l)),n}let b=(0,I.$)(e,l,{[`${e}-checked`]:g,[`${e}-disabled`]:t});return a.createElement("button",$({},x,{type:"button",role:"switch","aria-checked":g,disabled:t,className:b,ref:p,onKeyDown:function(e){e.which===S.A.LEFT?A(!1,e):e.which===S.A.RIGHT&&A(!0,e),m?.(e)},onClick:function(e){let l=A(!g,e);c?.(l,e)}}),s,a.createElement("span",{className:`${e}-inner`},a.createElement("span",{className:(0,I.$)(`${e}-inner-checked`,h?.content),style:u?.content},r),a.createElement("span",{className:(0,I.$)(`${e}-inner-unchecked`,h?.content),style:u?.content},o)))});k.displayName="Switch";var w=n(82813),z=n(92162),q=n(38862),C=n(74567),E=n(6831),T=n(27273),B=n(15561),R=n(47252),F=n(7961),_=n(16666),N=n(10540),H=n(28403);let D=(0,N.OF)("Switch",e=>{let l=(0,H.oX)(e,{switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchLoadingIconSize:e.calc(e.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[(e=>{let{componentCls:l,trackHeight:n,trackMinWidth:i}=e;return{[l]:{...(0,F.dF)(e),position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:i,height:n,lineHeight:(0,B.zA)(n),verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",...(0,_.V)(),[`&:hover:not(${l}-disabled)`]:{background:e.colorTextTertiary},...(0,F.K8)(e),[`&${l}-checked`]:{background:e.switchColor,[`&:hover:not(${l}-disabled)`]:{background:e.colorPrimaryHover}},[`&${l}-loading, &${l}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${l}-rtl`]:{direction:"rtl"}}}})(l),(e=>{let{componentCls:l,trackHeight:n,trackPadding:i,innerMinMargin:a,innerMaxMargin:t,handleSize:s,switchDuration:r,calc:o}=e,c=`${l}-inner`,d=(0,B.zA)(o(s).add(o(i).mul(2)).equal()),m=(0,B.zA)(o(t).mul(2).equal());return{[l]:{[c]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:t,paddingInlineEnd:a,transition:["padding-inline-start","padding-inline-end"].map(e=>`${e} ${r} ease-in-out`).join(", "),...(0,_.V)(),[`${c}-checked, ${c}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,pointerEvents:"none",minHeight:n,transition:["margin-inline-start","margin-inline-end"].map(e=>`${e} ${r} ease-in-out`).join(", "),...(0,_.V)()},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${m})`,marginInlineEnd:`calc(100% - ${d} + ${m})`},[`${c}-unchecked`]:{marginTop:o(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${l}-checked ${c}`]:{paddingInlineStart:a,paddingInlineEnd:t,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${m})`,marginInlineEnd:`calc(-100% + ${d} - ${m})`}},[`&:not(${l}-disabled):active`]:{[`&:not(${l}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:o(i).mul(2).equal(),marginInlineEnd:o(i).mul(-1).mul(2).equal()}},[`&${l}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:o(i).mul(-1).mul(2).equal(),marginInlineEnd:o(i).mul(2).equal()}}}}}})(l),(e=>{let{componentCls:l,trackPadding:n,handleBg:i,handleShadow:a,handleSize:t,calc:s}=e,r=`${l}-handle`;return{[l]:{[r]:{position:"absolute",top:n,insetInlineStart:n,width:t,height:t,transition:`all ${e.switchDuration} ease-in-out`,...(0,_.V)(),"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:i,borderRadius:s(t).div(2).equal(),boxShadow:a,transition:`all ${e.switchDuration} ease-in-out`,content:'""',...(0,_.V)()}},[`&${l}-checked ${r}`]:{insetInlineStart:`calc(100% - ${(0,B.zA)(s(t).add(n).equal())})`},[`&:not(${l}-disabled):active`]:{[`${r}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${l}-checked ${r}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}})(l),(e=>{let{componentCls:l,handleSize:n,calc:i}=e;return{[l]:{[`${l}-loading-icon${e.iconCls}`]:{position:"relative",top:i(i(n).sub(e.fontSize)).div(2).equal(),color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${l}-checked ${l}-loading-icon`]:{color:e.switchColor}}}})(l),(e=>{let{componentCls:l,trackHeightSM:n,trackPadding:i,trackMinWidthSM:a,innerMinMarginSM:t,innerMaxMarginSM:s,handleSizeSM:r,calc:o}=e,c=`${l}-inner`,d=(0,B.zA)(o(r).add(o(i).mul(2)).equal()),m=(0,B.zA)(o(s).mul(2).equal());return{[l]:{[`&${l}-small`]:{minWidth:a,height:n,lineHeight:(0,B.zA)(n),[`${l}-inner`]:{paddingInlineStart:s,paddingInlineEnd:t,[`${c}-checked, ${c}-unchecked`]:{minHeight:n},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${m})`,marginInlineEnd:`calc(100% - ${d} + ${m})`},[`${c}-unchecked`]:{marginTop:o(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${l}-handle`]:{width:r,height:r},[`${l}-loading-icon`]:{top:o(o(r).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${l}-checked`]:{[`${l}-inner`]:{paddingInlineStart:t,paddingInlineEnd:s,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${m})`,marginInlineEnd:`calc(-100% + ${d} - ${m})`}},[`${l}-handle`]:{insetInlineStart:`calc(100% - ${(0,B.zA)(o(r).add(i).equal())})`}},[`&:not(${l}-disabled):active`]:{[`&:not(${l}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:o(e.marginXXS).div(2).equal(),marginInlineEnd:o(e.marginXXS).mul(-1).div(2).equal()}},[`&${l}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:o(e.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:o(e.marginXXS).div(2).equal()}}}}}}})(l)]},e=>{let{fontSize:l,lineHeight:n,controlHeight:i,colorWhite:a}=e,t=l*n,s=i/2,r=t-4,o=s-4;return{trackHeight:t,trackHeightSM:s,trackMinWidth:2*r+8,trackMinWidthSM:2*o+4,trackPadding:2,handleBg:a,handleSize:r,handleSizeSM:o,handleShadow:`0 2px 4px 0 ${new R.Y("#00230b").setA(.2).toRgbString()}`,innerMinMargin:r/2,innerMaxMargin:r+2+4,innerMinMarginSM:o/2,innerMaxMarginSM:o+2+4}}),W=a.forwardRef((e,l)=>{let{prefixCls:n,size:i,disabled:t,loading:s,className:r,rootClassName:o,style:c,checked:d,value:m,defaultChecked:u,defaultValue:h,onChange:x,styles:p,classNames:g,...j}=e,[A,b]=(0,w.PW)(u??h??!1,d??m),{getPrefixCls:y,direction:f,className:S,style:$,classNames:B,styles:R}=(0,C.TP)("switch"),F=a.useContext(E.A),_=(t??F)||s,N=y("switch",n),[H,W]=D(N),M=(0,T.A)(i),V={...e,size:M,disabled:_},P=(0,z.XT)($),L=(0,z.XT)(c),[X,O]=(0,z.AV)([B,g],[R,P,p,L],{props:V}),G=a.createElement("div",{className:(0,I.$)(`${N}-handle`,X.indicator),style:O.indicator},s&&a.createElement(v.A,{className:`${N}-loading-icon`})),K=(0,I.$)(S,{[`${N}-small`]:"small"===M,[`${N}-loading`]:s,[`${N}-rtl`]:"rtl"===f},r,o,X.root,H,W);return a.createElement(q.A,{component:"Switch",disabled:_},a.createElement(k,{...j,classNames:X,styles:O,checked:A,onChange:(...e)=>{b(e[0]),x?.(...e)},prefixCls:N,className:K,style:O.root,disabled:_,ref:l,loadingIcon:G}))});W.__ANT_SWITCH=!0;var M=n(48318),V=n(25258),P=n(54746),L=n(96651),X=n(60470),O=n(99650),G=n(58209),K=n(6578),Q=n(32620);let Y=[{label:"文本",value:"text"},{label:"数字",value:"number"},{label:"日期",value:"date"},{label:"表格",value:"table"},{label:"列表",value:"list"}],J=[{label:"错误(阻断)",value:"error"},{label:"警告(提醒)",value:"warning"},{label:"信息(提示)",value:"info"}],U=[{label:"全文",value:"document"},{label:"章节",value:"chapter"},{label:"事实字段",value:"fact"},{label:"文件角色",value:"file_role"},{label:"提示词角色",value:"prompt_role"},{label:"表格",value:"table"},{label:"图片",value:"image"},{label:"来源",value:"source"}],Z=[{label:"必须存在",value:"exists"},{label:"必须包含",value:"contains"},{label:"禁止包含",value:"not_contains"},{label:"正则必须匹配",value:"regex_match"},{label:"正则禁止匹配",value:"regex_not_match"},{label:"数量至少为 N",value:"min_count"},{label:"字数至少为 N",value:"min_length"},{label:"全部必须有来源",value:"all_have_source"},{label:"图片必须有说明",value:"image_caption_required"},{label:"表格必须有说明",value:"table_explanation_required"}],ee=e=>{let{label:l,closable:n,onClose:a}=e;return(0,i.jsx)(t.A,{closable:n,onClose:a,color:"blue",style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:l})};function el(){var e,l,n,v;let I=(0,Q.Vr)(),{message:f}=s.A.useApp(),[S]=r.A.useForm(),[$]=r.A.useForm(),[k,w]=(0,a.useState)([]),[z,q]=(0,a.useState)([]),[C,E]=(0,a.useState)([]),[T,B]=(0,a.useState)(!1),[R,F]=(0,a.useState)(!1),[_,N]=(0,a.useState)(null),[H,D]=(0,a.useState)(!1),[el,en]=(0,a.useState)("custom"),[ei,ea]=(0,a.useState)("specs"),et=async()=>{let[e,l]=await Promise.all([(0,K.mx)(),(0,K.lv)()]);w(e.specs),q(e.gateTypes),E(l.roles)};(0,a.useEffect)(()=>{et().catch(()=>f.error(I("common.error")))},[f,I]);let es=C.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),er=C.filter(e=>"prompt"===e.type).map(e=>({label:e.name,value:e.id})),eo=k.filter(e=>!e.builtIn),ec=k.filter(e=>e.builtIn),ed="all"===el?k:"builtIn"===el?ec:eo,em=z.filter(e=>!e.builtIn),eu=z.filter(e=>e.builtIn),eh="all"===el?z:"builtIn"===el?eu:em,ex=[{label:"系统门禁类型",options:z.filter(e=>e.builtIn).map(e=>({label:e.name,value:e.id}))},{label:"我的门禁类型",options:z.filter(e=>!e.builtIn).map(e=>({label:e.name,value:e.id}))}],[ep,eg]=(0,a.useState)(0),[ej,eA]=(0,a.useState)(0),[eb,ey]=(0,a.useState)(0),ev=()=>{var e,l,n;eg((null!=(e=S.getFieldValue("factFields"))?e:[]).length),eA((null!=(l=S.getFieldValue("chapterRules"))?l:[]).length),ey((null!=(n=S.getFieldValue("gateRules"))?n:[]).length)},eI=(null!=(v=r.A.useWatch("factFields",S))?v:[]).filter(e=>e.id&&e.name).map(e=>({label:"".concat(e.name,"(").concat(e.id,")"),value:e.id})),ef=e=>{let l=(null==e?void 0:e.builtIn)?{...e,id:"".concat(e.id,"-copy-").concat(Date.now()),name:"".concat(e.name," Copy"),builtIn:!1}:e;(null==e?void 0:e.builtIn)&&f.info("内置规范包不可直接编辑,已为你创建副本"),S.setFieldsValue(null!=l?l:{id:"spec-".concat(Date.now()),name:"",description:"",factFields:[{id:"document-goal",name:"文档目标",type:"text",required:!0},{id:"target-audience",name:"目标读者",type:"text",required:!1},{id:"key-conclusion",name:"关键结论",type:"list",required:!0}],chapterRules:[],gateRules:[]}),B(!0),window.setTimeout(()=>ev(),50)},eS=async()=>{try{let e=await S.validateFields(),l=await (0,K.EK)(e);w(l.specs),q(l.gateTypes),B(!1),f.success(I("common.success"))}catch(e){e instanceof Error&&f.error(e.message)}},e$=async e=>{let l=await (0,K.ER)(e);w(l.specs),q(l.gateTypes)},ek=e=>{var l;if(null==e?void 0:e.builtIn){$.setFieldsValue(e),N(e.id),F(!0);return}N(null!=(l=null==e?void 0:e.id)?l:null),$.setFieldsValue(null!=e?e:{id:"gate-type-".concat(Date.now()),name:"",defaultLevel:"error",evaluator:{subject:"document",operator:"contains"}}),F(!0)},ew=async()=>{try{var e;let l=await $.validateFields();if(null==(e=z.find(e=>e.id===l.id))?void 0:e.builtIn)return;let n=await (0,K.uD)(l);q(n.gateTypes),F(!1),N(null),$.resetFields(),f.success(I("common.success"))}catch(e){e instanceof Error&&f.error(e.message)}},ez=async e=>{q((await (0,K.ug)(e)).gateTypes)};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:I("specs.title")}),(0,i.jsx)("p",{className:"pageDesc",children:I("specs.description")})]}),(0,i.jsxs)(o.A,{wrap:!0,children:[(0,i.jsx)(c.A,{value:el,onChange:en,style:{width:160},options:[{label:"我的 (".concat(eo.length+em.length,")"),value:"custom"},{label:"内置示例 (".concat(ec.length+eu.length,")"),value:"builtIn"},{label:"全部来源 (".concat(k.length+z.length,")"),value:"all"}]}),"gateTypes"===ei&&(0,i.jsx)(d.Ay,{onClick:()=>ek(),children:"新建门禁类型"}),"specs"===ei&&(0,i.jsx)(d.Ay,{type:"primary",icon:(0,i.jsx)(P.A,{}),onClick:()=>ef(),children:I("specs.newSpec")})]})]}),(0,i.jsx)(m.A,{type:"info",showIcon:!0,message:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)("span",{children:I("specs.plainGuideTitle")}),(0,i.jsx)(d.Ay,{type:"link",size:"small",icon:H?(0,i.jsx)(L.A,{}):(0,i.jsx)(X.A,{}),onClick:()=>D(!H),style:{padding:"0 4px"},children:H?"收起说明":"展开说明"})]}),description:H?I("specs.plainGuideDesc"):void 0}),(0,i.jsx)(u.A,{size:"small",children:(0,i.jsx)(h.A,{activeKey:ei,onChange:e=>ea(e),items:[{key:"specs",label:"规范包列表 (".concat(ed.length,")"),children:0===ed.length?(0,i.jsx)(x.A,{description:I("common.noData")}):(0,i.jsx)(p.A,{dataSource:ed,renderItem:(e,l)=>(0,i.jsx)(p.A.Item,{style:{padding:"10px 0"},actions:[(0,i.jsx)(d.Ay,{size:"small",icon:(0,i.jsx)(O.A,{}),onClick:()=>ef(e),children:e.builtIn?"复制":"编辑"},"edit"),(0,i.jsx)(g.A,{title:I("common.confirm"),disabled:e.builtIn,onConfirm:()=>{e$(e.id)},children:(0,i.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(G.A,{}),disabled:e.builtIn})},"del")],children:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[(0,i.jsx)("div",{style:{width:28,height:28,borderRadius:8,background:"var(--colorFillSecondary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:700,color:"var(--colorTextSecondary)",flexShrink:0},children:l+1}),(0,i.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),e.builtIn?(0,i.jsx)(t.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"内置示例"}):(0,i.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"我的规范包"})]}),(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.description&&(0,i.jsx)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:e.description}),(0,i.jsxs)(o.A,{size:4,children:[(0,i.jsxs)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:["事实 ",e.factFields.length]}),(0,i.jsxs)(t.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:["章节 ",e.chapterRules.length]}),(0,i.jsxs)(t.A,{color:"orange",style:{margin:0,fontSize:10,lineHeight:"16px"},children:["门禁 ",e.gateRules.length]})]})]})]})]})})})},{key:"gateTypes",label:"门禁类型列表 (".concat(eh.length,")"),children:0===eh.length?(0,i.jsx)(x.A,{description:I("common.noData")}):(0,i.jsx)(p.A,{dataSource:eh,renderItem:(e,l)=>{var n,a;return(0,i.jsx)(p.A.Item,{style:{padding:"10px 0"},actions:[(0,i.jsx)(d.Ay,{size:"small",icon:(0,i.jsx)(O.A,{}),onClick:()=>ek(e),children:e.builtIn?"查看":"编辑"},"edit"),(0,i.jsx)(g.A,{title:I("common.confirm"),disabled:e.builtIn,onConfirm:()=>{ez(e.id)},children:(0,i.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(G.A,{}),disabled:e.builtIn})},"del")],children:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[(0,i.jsx)("div",{style:{width:28,height:28,borderRadius:8,background:"var(--colorFillSecondary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:700,color:"var(--colorTextSecondary)",flexShrink:0},children:l+1}),(0,i.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,i.jsx)("span",{style:{fontWeight:600},children:e.name}),e.builtIn?(0,i.jsx)(t.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"系统门禁"}):(0,i.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的门禁"})]}),(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.description&&(0,i.jsx)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:e.description}),(0,i.jsxs)(o.A,{size:4,children:[(0,i.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:null==(n=U.find(l=>l.value===e.evaluator.subject))?void 0:n.label}),(0,i.jsx)(t.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:null==(a=Z.find(l=>l.value===e.evaluator.operator))?void 0:a.label})]})]})]})]})})}})}]})}),(0,i.jsx)(j.A,{title:I("specs.editor"),open:T,onClose:()=>B(!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)(d.Ay,{type:"primary",onClick:()=>{eS()},children:I("common.save")}),children:(0,i.jsxs)(r.A,{form:S,layout:"vertical",onValuesChange:()=>ev(),children:[(0,i.jsxs)(A.A,{gutter:12,children:[(0,i.jsx)(r.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(b.A,{})}),(0,i.jsx)(y.A,{xs:24,md:12,children:(0,i.jsx)(r.A.Item,{name:"name",label:I("specs.name"),rules:[{required:!0}],children:(0,i.jsx)(b.A,{})})}),(0,i.jsx)(y.A,{xs:24,md:12,children:(0,i.jsx)(r.A.Item,{name:"description",label:I("specs.specDescription"),children:(0,i.jsx)(b.A,{})})})]}),(0,i.jsx)(h.A,{destroyInactiveTabPane:!1,items:[{key:"facts",label:"".concat(I("specs.facts")," (").concat(ep,")"),children:(0,i.jsx)(r.A.List,{name:"factFields",children:(e,l)=>{let{add:n,remove:a}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.map((e,l)=>(0,i.jsxs)(u.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsx)(d.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(G.A,{}),onClick:()=>a(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsx)(r.A.Item,{name:[e.name,"id"],hidden:!0,children:(0,i.jsx)(b.A,{})}),(0,i.jsxs)(A.A,{gutter:[14,8],children:[(0,i.jsx)(y.A,{xs:24,sm:7,children:(0,i.jsx)(r.A.Item,{name:[e.name,"name"],label:I("specs.factName"),rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(b.A,{size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:5,children:(0,i.jsx)(r.A.Item,{name:[e.name,"type"],label:I("specs.factType"),style:{marginBottom:0},children:(0,i.jsx)(c.A,{options:Y,size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:4,children:(0,i.jsx)(r.A.Item,{name:[e.name,"required"],label:I("specs.required"),valuePropName:"checked",style:{marginBottom:0},children:(0,i.jsx)(W,{})})}),(0,i.jsx)(y.A,{xs:24,sm:8,children:(0,i.jsx)(r.A.Item,{name:[e.name,"sourceRoleIds"],label:I("specs.sourceRoles"),style:{marginBottom:0},children:(0,i.jsx)(c.A,{mode:"multiple",showSearch:!0,options:es,tagRender:ee,placeholder:"选择文件角色",size:"small"})})}),(0,i.jsx)(y.A,{xs:24,sm:12,children:(0,i.jsx)(r.A.Item,{name:[e.name,"extractionHint"],label:I("specs.extractionHint"),style:{marginBottom:0},children:(0,i.jsx)(b.A,{size:"small"})})}),(0,i.jsx)(y.A,{xs:24,sm:12,children:(0,i.jsx)(r.A.Item,{name:[e.name,"validationHint"],label:I("specs.validationHint"),style:{marginBottom:0},children:(0,i.jsx)(b.A,{size:"small"})})})]})]},e.key)),(0,i.jsx)(d.Ay,{icon:(0,i.jsx)(P.A,{}),onClick:()=>n({id:"fact-".concat(Date.now()),type:"text",required:!0}),children:I("specs.addFact")})]})}})},{key:"chapters",label:"".concat(I("specs.chapters")," (").concat(ej,")"),children:(0,i.jsx)(r.A.List,{name:"chapterRules",children:(e,l)=>{let{add:n,remove:a}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.map((e,l)=>(0,i.jsxs)(u.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsx)(d.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(G.A,{}),onClick:()=>a(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsx)(r.A.Item,{name:[e.name,"id"],hidden:!0,children:(0,i.jsx)(b.A,{})}),(0,i.jsxs)(A.A,{gutter:[14,8],children:[(0,i.jsx)(y.A,{xs:24,sm:7,children:(0,i.jsx)(r.A.Item,{name:[e.name,"title"],label:I("specs.chapterTitle"),rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(b.A,{size:"small"})})}),(0,i.jsx)(y.A,{xs:8,sm:3,children:(0,i.jsx)(r.A.Item,{name:[e.name,"order"],label:I("specs.order"),initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(M.A,{size:"small",style:{width:"100%"}})})}),(0,i.jsx)(y.A,{xs:8,sm:3,children:(0,i.jsx)(r.A.Item,{name:[e.name,"minWords"],label:I("specs.minWords"),style:{marginBottom:0},children:(0,i.jsx)(M.A,{size:"small",style:{width:"100%"}})})}),(0,i.jsx)(y.A,{xs:8,sm:3,children:(0,i.jsx)(r.A.Item,{name:[e.name,"required"],label:I("specs.required"),valuePropName:"checked",style:{marginBottom:0},children:(0,i.jsx)(W,{})})}),(0,i.jsx)(y.A,{xs:24,sm:8,children:(0,i.jsx)(r.A.Item,{name:[e.name,"requiredFactIds"],label:I("specs.requiredFacts"),style:{marginBottom:0},children:(0,i.jsx)(c.A,{mode:"multiple",showSearch:!0,optionFilterProp:"label",placeholder:"选择事实字段",options:eI,tagRender:ee,size:"small"})})}),(0,i.jsx)(y.A,{xs:24,sm:12,children:(0,i.jsx)(r.A.Item,{name:[e.name,"requiredFileRoleIds"],label:I("specs.requiredFileRoles"),style:{marginBottom:0},children:(0,i.jsx)(c.A,{mode:"multiple",showSearch:!0,options:es,tagRender:ee,placeholder:"选择文件角色",size:"small"})})}),(0,i.jsx)(y.A,{xs:24,sm:12,children:(0,i.jsx)(r.A.Item,{name:[e.name,"requiredPromptRoleIds"],label:I("specs.requiredPromptRoles"),style:{marginBottom:0},children:(0,i.jsx)(c.A,{mode:"multiple",showSearch:!0,options:er,tagRender:ee,placeholder:"选择提示词角色",size:"small"})})}),(0,i.jsx)(y.A,{xs:24,children:(0,i.jsx)(r.A.Item,{name:[e.name,"generationHint"],label:I("specs.generationHint"),style:{marginBottom:0},children:(0,i.jsx)(b.A,{size:"small"})})})]})]},e.key)),(0,i.jsx)(d.Ay,{icon:(0,i.jsx)(P.A,{}),onClick:()=>n({id:"chapter-".concat(Date.now()),order:e.length,required:!0}),children:I("specs.addChapter")})]})}})},{key:"gates",label:"".concat(I("specs.gates")," (").concat(eb,")"),children:(0,i.jsx)(r.A.List,{name:"gateRules",children:(e,l)=>{let{add:n,remove:a}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.map((e,l)=>(0,i.jsxs)(u.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsx)(d.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(G.A,{}),onClick:()=>a(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsx)(r.A.Item,{name:[e.name,"id"],hidden:!0,children:(0,i.jsx)(b.A,{})}),(0,i.jsxs)(A.A,{gutter:[12,8],align:"middle",children:[(0,i.jsx)(y.A,{xs:24,sm:6,children:(0,i.jsx)(r.A.Item,{name:[e.name,"name"],label:"名称",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(b.A,{placeholder:I("specs.gateName"),size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:6,children:(0,i.jsx)(r.A.Item,{name:[e.name,"type"],label:"类型",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(c.A,{options:ex,size:"small",onChange:e=>((e,l)=>{var n,i,a,t,s;let r=z.find(e=>e.id===l);if(!r)return;let o=[...null!=(s=S.getFieldValue("gateRules"))?s:[]];o[e]={...o[e],type:r.id,level:(null==(n=o[e])?void 0:n.level)||r.defaultLevel,name:(null==(i=o[e])?void 0:i.name)||r.name,evaluator:{...r.evaluator},target:(null==(a=o[e])?void 0:a.target)||r.evaluator.target||"",value:(null==(t=o[e])?void 0:t.value)||r.evaluator.value||""},S.setFieldValue("gateRules",o)})(l,e)})})}),(0,i.jsx)(y.A,{xs:12,sm:3,children:(0,i.jsx)(r.A.Item,{name:[e.name,"level"],label:"级别",style:{marginBottom:0},children:(0,i.jsx)(c.A,{options:J,size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:4,children:(0,i.jsx)(r.A.Item,{name:[e.name,"target"],label:"目标",style:{marginBottom:0},children:(0,i.jsx)(b.A,{placeholder:"章节/事实/角色",size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:5,children:(0,i.jsx)(r.A.Item,{name:[e.name,"value"],label:"值",style:{marginBottom:0},children:(0,i.jsx)(b.A,{placeholder:"关键词/正则/数值",size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:5,children:(0,i.jsx)(r.A.Item,{name:[e.name,"evaluator","subject"],label:"校验对象",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(c.A,{options:U,size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:6,children:(0,i.jsx)(r.A.Item,{name:[e.name,"evaluator","operator"],label:"校验方式",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(c.A,{options:Z,size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:5,children:(0,i.jsx)(r.A.Item,{name:[e.name,"evaluator","target"],label:"执行目标",style:{marginBottom:0},children:(0,i.jsx)(b.A,{placeholder:"默认取目标",size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:5,children:(0,i.jsx)(r.A.Item,{name:[e.name,"evaluator","value"],label:"执行值",style:{marginBottom:0},children:(0,i.jsx)(b.A,{placeholder:"默认取值",size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:3,children:(0,i.jsx)(r.A.Item,{name:[e.name,"evaluator","min"],label:"N",style:{marginBottom:0},children:(0,i.jsx)(M.A,{min:1,size:"small",style:{width:"100%"}})})})]})]},e.key)),(0,i.jsx)(d.Ay,{icon:(0,i.jsx)(P.A,{}),onClick:()=>n({id:"gate-".concat(Date.now()),type:"required_fact",level:"error",evaluator:{subject:"fact",operator:"exists"}}),children:I("specs.addGate")})]})}})}]})]})}),(0,i.jsx)(V.A,{title:(null==(e=z.find(e=>e.id===_))?void 0:e.builtIn)?"查看系统门禁类型":_?"编辑门禁类型":"新建门禁类型",open:R,onOk:()=>{ew()},onCancel:()=>{F(!1),N(null)},okText:I("common.save"),cancelText:I("common.cancel"),okButtonProps:{disabled:!!(null==(l=z.find(e=>e.id===_))?void 0:l.builtIn)},children:(0,i.jsx)(r.A,{form:$,layout:"vertical",disabled:!!(null==(n=z.find(e=>e.id===_))?void 0:n.builtIn),children:(0,i.jsxs)(A.A,{gutter:12,children:[(0,i.jsx)(r.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(b.A,{})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:"name",label:"类型名称",rules:[{required:!0}],children:(0,i.jsx)(b.A,{placeholder:"必须包含风险提示"})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:"description",label:"说明",children:(0,i.jsx)(b.A,{placeholder:"告诉用户这类门禁检查什么"})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:"defaultLevel",label:"默认级别",rules:[{required:!0}],children:(0,i.jsx)(c.A,{options:J})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:["evaluator","subject"],label:"校验对象",rules:[{required:!0}],children:(0,i.jsx)(c.A,{options:U})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:["evaluator","operator"],label:"校验方式",rules:[{required:!0}],children:(0,i.jsx)(c.A,{options:Z})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:["evaluator","target"],label:"默认目标",children:(0,i.jsx)(b.A,{placeholder:"章节/事实/角色,可为空"})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:["evaluator","value"],label:"默认值",children:(0,i.jsx)(b.A,{placeholder:"关键词/正则,可为空"})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:["evaluator","min"],label:"默认 N",children:(0,i.jsx)(M.A,{min:1,style:{width:"100%"}})})})]})})})]})}},94773:(e,l,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-specs",function(){return n(51533)}])}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,2884,9144,9189,3455,4052,5938,3057,6578,636,6593,8792],()=>e(e.s=94773)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4298],{16403:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return s(19562)}])},19562:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>ei});var r=s(65321),n=s(97109),i=s(7576),l=s(35292),a=s(17807),o=s(63455),c=s(88762),d=s(85114),u=s(68787),p=s(84253),m=s(38332),h=s(26171),x=s(11702),g=s(33442),f=s(85493),v=s(34052),w=s(9730),j=s(42700),y=s(58569),A=s(76506),k=s(25258),S=s(2256),I=s(38770),b=s(57271),T=s(23216),z=s(26619),C=s(8263),_=s(16285),D=s(8579),M=s(75548),F=s(7851),L=s(84742),B=s(29071),E=s(63552),R=s(26631),P=s(76830),q=s(83914),W=s(58209),G=s(54746),H=s(71330),O=s(64068),N=s(93051),K=s(38762),U=s(64629),X=s(67547),V=s(99811),Q=s(6578),J=s(32620);let{TextArea:Y}=i.A,{Paragraph:Z,Text:$}=l.A,ee=null;function et(){null==ee||ee.listeners.forEach(e=>e())}let es={role_binding:(0,r.jsx)(T.A,{}),knowledge_retrieval:(0,r.jsx)(z.A,{}),file_understanding:(0,r.jsx)(C.A,{}),fact_extraction:(0,r.jsx)(_.A,{}),chapter_generation:(0,r.jsx)(D.A,{}),asset_generation:(0,r.jsx)(M.A,{}),validation:(0,r.jsx)(F.A,{}),formatting:(0,r.jsx)(L.A,{}),llm_review:(0,r.jsx)(B.A,{}),export_ready:(0,r.jsx)(E.A,{}),reference:(0,r.jsx)(M.A,{})},er={施工组织设计:(0,r.jsx)(F.A,{}),投标文件:(0,r.jsx)(E.A,{}),技术方案:(0,r.jsx)(_.A,{}),报告:(0,r.jsx)(R.A,{}),自定义:(0,r.jsx)(D.A,{})},en={role_binding:"角色配置绑定",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",asset_generation:"多模态资源生成",validation:"规则校验",formatting:"格式化排版",llm_review:"LLM 审查优化",export_ready:"导出就绪",reference:"参考资源处理"};function ei(){let e=(0,J.Vr)(),{message:t}=a.A.useApp(),[s]=o.A.useForm(),l=(0,n.useRef)(null),[Z,ei]=(0,n.useState)([]),[el,ea]=(0,n.useState)("construction-organization-design"),[eo,ec]=(0,n.useState)([]),[ed,eu]=(0,n.useState)([]),[ep,em]=(0,n.useState)([]),[eh,ex]=(0,n.useState)(!0),[eg,ef]=(0,n.useState)(!1),[ev,ew]=(0,n.useState)(null),[ej,ey]=(0,n.useState)(""),[eA,ek]=(0,n.useState)([]),[eS,eI]=(0,n.useState)(null),[eb,eT]=(0,n.useState)(!1),[ez,eC]=(0,n.useState)(null),[e_,eD]=(0,n.useState)(!1),[eM,eF]=(0,n.useState)({}),[eL,eB]=(0,n.useState)([]),[eE,eR]=(0,n.useState)(null),[eP,eq]=(0,n.useState)("templates"),[eW,eG]=(0,n.useState)(!1),[eH,eO]=(0,n.useState)("workflow"),eN=(0,n.useRef)(null),eK=async()=>{try{ek((await (0,Q.cQ)()).documents)}catch(e){ek([])}};(0,n.useEffect)(()=>{let e=()=>{ee&&(eB(ee.flowSteps),eR(ee.activeFlowKey),ef(ee.loading),ee.documentId&&eI(ee.documentId),ee.draft&&ew(ee.draft),void 0!==ee.content&&ey(ee.content))},t=ee;return null==t||t.listeners.add(e),e(),()=>{null==t||t.listeners.delete(e)}},[]),(0,n.useEffect)(()=>{ex(!0),Promise.all([(0,Q.Dl)().then(e=>{var t,s;ei(e.templates),ea(null!=(s=null==(t=e.templates[0])?void 0:t.id)?s:"construction-organization-design")}),(0,Q.lv)().then(e=>{ec(e.roles),eu(e.configs)}),(0,Q.mx)().then(e=>em(e.specs)),eK()]).catch(()=>t.error(e("common.error"))).finally(()=>ex(!1))},[t,e]),(0,n.useEffect)(()=>{if(0===eA.length)return;let e=localStorage.getItem("activeGenDocId");if(!e)return;if(!eA.find(t=>t.id===e&&"generating"===t.status))return void localStorage.removeItem("activeGenDocId");let t=setInterval(()=>{(async()=>{try{let{document:s}=await (0,Q.v7)(e);await eK(),"generating"!==s.status&&(localStorage.removeItem("activeGenDocId"),clearInterval(t))}catch(e){clearInterval(t)}})()},3e3);return()=>clearInterval(t)},[eA]);let eU=(0,n.useMemo)(()=>Z.find(e=>e.id===el),[Z,el]),eX=ed.map(e=>({label:e.name,value:e.id})),eV=ep.map(e=>({label:e.name,value:e.id})),eQ=Math.max(0,eL.findIndex(e=>e.key===eE)),eJ=e=>{ea(e),eI(null),ew(null),ey(""),eO("workflow"),eG(!0),eq("drafts")},eY=async s=>{eI(s.id),ea(s.templateId);let r=e0(s.status);if(r||"failed"===s.status){ti.current=!0,ew(null),ey(""),ef(r),eO("workflow"),eG(!0);try{let{document:e}=await (0,Q.v7)(s.id);e6(e),e0(e.status)?e8(e.id):await eK()}catch(e){e6(s)}return}eO("editor"),eB([]),eR(null);try{let{document:e}=await (0,Q.v7)(s.id);ew(e.draft||null),ey(e.editedMarkdown||e.markdown)}catch(s){t.error(e("common.error"))}eG(!0)},eZ=e=>e.map((e,t)=>({key:"sub-".concat(t),title:e,status:"wait"})),e$=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eU,s=ep.find(e=>e.id===(null==t?void 0:t.documentSpecId)),n=ed.find(e=>e.id===(null==t?void 0:t.projectRoleConfigId)),i=((null==n?void 0:n.fileRoles)||[]).map(e=>{var t;return(null==(t=eo.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),l=((null==n?void 0:n.promptRoles)||[]).map(e=>{var t;return(null==(t=eo.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),a=(null==s?void 0:s.factFields.map(e=>e.name))||(null==t?void 0:t.chapters.flatMap(e=>e.requiredFacts))||[],o=(null==t?void 0:t.chapters.map(e=>e.title))||[],c=l.some(e=>/封面|图片|资源|cover|image/iu.test(e));return[{key:"prepare",title:e("documents.flowPrepare"),description:'读取"'.concat((null==t?void 0:t.name)||"当前模板",'"并创建后台生成任务'),status:"process",icon:(0,r.jsx)(R.A,{}),subSteps:eZ(["读取模板参数",(null==t?void 0:t.documentSpecId)?"加载规范包:".concat((null==s?void 0:s.name)||t.documentSpecId):"未绑定规范包,使用模板章节要求","创建后台生成任务"])},{key:"role_binding",title:"动态角色配置绑定",description:"绑定 ".concat(i.length," 个文件角色、").concat(l.length," 个提示词角色"),status:"wait",icon:(0,r.jsx)(T.A,{}),subSteps:eZ([...i.length?i.map(e=>"文件角色:".concat(e)):["没有文件角色,使用模板绑定文件"],...l.length?l.map(e=>"提示词角色:".concat(e)):["没有提示词角色,使用默认生成策略"]].slice(0,10))},{key:"knowledge_retrieval",title:"知识库证据检索",description:"按 ".concat(o.length," 个章节检索文本、文档、表格、图片、图纸和附件"),status:"wait",icon:(0,r.jsx)(z.A,{}),subSteps:eZ(o.length?o.slice(0,10).map(e=>"检索章节:".concat(e)):["按模板标题检索证据"])},{key:"file_understanding",title:"多类型文件理解",description:"按文件角色处理文本、PDF/Word、表格、图片、图纸和附件",status:"wait",icon:(0,r.jsx)(C.A,{}),subSteps:eZ(["识别文件类型和角色","构建结构化资源证据包","必要时调用多模态文件理解"])},{key:"fact_extraction",title:"动态 schema 事实抽取",description:"按 ".concat(a.length," 个规范/章节事实字段抽取并检测冲突"),status:"wait",icon:(0,r.jsx)(_.A,{}),subSteps:eZ(a.length?a.slice(0,10).map(e=>"抽取事实:".concat(e)):["抽取模板要求的事实","合并来源和角色","检测事实冲突"])},{key:"chapter_generation",title:"章节生成",description:"按 ".concat(o.length," 个模板章节逐章生成"),status:"wait",icon:(0,r.jsx)(D.A,{}),subSteps:eZ(o.length?o.slice(0,10).map(e=>"生成:".concat(e)):["构造章节提示词","等待 LLM 生成","整理章节证据"])},...c?[{key:"asset_generation",title:"生成资源处理",description:"根据资源/图片提示词生成或登记本地资源",status:"wait",icon:(0,r.jsx)(M.A,{}),subSteps:eZ(["生成资源提示词","保存到 generatedDocuments/assets","登记资源元数据"])}]:[],{key:"validation",title:"规范包与门禁校验",description:s?"执行 ".concat(s.gateRules.length," 条门禁规则"):"执行模板基础校验",status:"wait",icon:(0,r.jsx)(F.A,{}),subSteps:eZ([...(null==s?void 0:s.factFields.filter(e=>e.required).map(e=>"必填事实:".concat(e.name)))||[],...(null==s?void 0:s.gateRules.map(e=>"门禁:".concat(e.name)))||["检查章节证据","检查缺失项","检查导出门禁"]].slice(0,10))},{key:"formatting",title:e("documents.flowFormatting"),description:"整理标题、表格、图片、附件引用和正式 Markdown",status:"wait",icon:(0,r.jsx)(L.A,{}),subSteps:eZ(["整理标题层级","整理多类型资源引用","生成正式 Markdown"])},{key:"llm_review",title:"LLM 审查优化",description:"再次使用动态 schema、角色和结构化证据审查优化初稿",status:"wait",icon:(0,r.jsx)(B.A,{}),subSteps:eZ(["构造审查提示词","检查事实来源和冲突","回填优化后的 Markdown"])},{key:"export_ready",title:"导出就绪",description:"确认 Markdown/HTML/DOCX/PDF 可导出",status:"wait",icon:(0,r.jsx)(E.A,{}),subSteps:eZ(["生成导出检查清单","确认阻断项","准备导出格式"])},{key:"done",title:e("documents.flowDone"),description:e("documents.flowDoneDesc"),status:"wait",icon:(0,r.jsx)(P.A,{}),subSteps:eZ(["展示生成结果","允许编辑正文","允许导出文件"])}]},e0=e=>"completed"!==e&&"warning"!==e&&"failed"!==e,e1=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:eg;(null==ee?void 0:ee.loading)&&(ee.flowSteps=e,ee.activeFlowKey=t,ee.loading=s,et())},e2=(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 s=e.subSteps.findIndex(e=>"wait"===e.status);return e.subSteps.map((e,t)=>t<s||-1===s?{...e,status:"finish"}:t===s?{...e,status:"process"}:e)},e6=e=>{let{steps:t,activeKey:s}=(e=>{var t,s,r;let n,i=Z.find(t=>t.id===e.templateId)||eU,l=e.executionStages||(null==(t=e.draft)?void 0:t.executionStages)||[],a=new Map(l.map(e=>[e.type,e])),o=e$(i).map(t=>{let s;if("prepare"===t.key){let s=l.length>0?"finish":"generating"===e.status?"process":"finish";return{...t,status:s,subSteps:e2(t,s)}}if("done"===t.key){let s="completed"===e.status?"finish":"warning"===e.status?"warning":"wait";return{...t,status:s,subSteps:e2(t,s)}}let r=a.get(t.key);if(!r)return t;let n="failed"===(s=r.status)?"error":"fallback"===s?"warning":"finish";return{...t,status:n,description:r.message||t.description,subSteps:e2(t,n)}});if("generating"===e.status){let e=Math.max(-1,...l.map(e=>o.findIndex(t=>t.key===e.type)).filter(e=>e>=0)),t=o.slice(e+1).find(e=>"done"!==e.key&&"wait"===e.status)||o.find(e=>"process"===e.status)||o.find(e=>"done"===e.key);for(let e of(n=(null==t?void 0:t.key)||"prepare",o))e.key===n&&"wait"===e.status&&(e.status="process",e.subSteps=e2(e,"process"))}else n="failed"===e.status?(null==(s=o.find(e=>"error"===e.status))?void 0:s.key)||(null==(r=l.at(-1))?void 0:r.type)||"prepare":"done";return{steps:o,activeKey:n}})(e);eB(t),eR(s),ef(e0(e.status)),"failed"===e.status&&eO("workflow"),("completed"===e.status||"warning"===e.status)&&e.draft&&(ew(e.draft),ey(e.editedMarkdown||e.markdown),eO("editor"),eB([]),eR(null))},e8=e=>{eN.current&&clearInterval(eN.current),eN.current=setInterval(()=>{(async()=>{try{let{document:t}=await (0,Q.v7)(e);e6(t),await eK(),e0(t.status)||(eN.current&&clearInterval(eN.current),eN.current=null,localStorage.removeItem("activeGenDocId"))}catch(e){}})()},2e3)},e7=(e,t,s)=>{eR(e),eB(r=>{let n=r.map(r=>r.key===e?{...r,status:t,description:s||r.description,subSteps:e2(r,t)}:r);return e1(n,e),n})};(0,n.useEffect)(()=>{if(!eg||!eE)return;let e=window.setInterval(()=>eB(e=>{let t=e.map(e=>{if(e.key!==eE||"process"!==e.status)return e;let t=e.subSteps.findIndex(e=>"process"===e.status),s=t<0?0:Math.min(t+1,e.subSteps.length-1);return{...e,subSteps:e.subSteps.map((e,t)=>t<s?{...e,status:"finish"}:t===s?{...e,status:"process"}:{...e,status:"wait"})}});return e1(t,eE),t}),1400);return()=>window.clearInterval(e)},[eE,eg]);let e3=e=>{eB(t=>{let s=t.findIndex(t=>t.key===e),r=t.map((e,t)=>t<s&&"error"!==e.status?{...e,status:"finish",subSteps:e2(e,"finish")}:e);return e1(r,e),r})},e5=e=>{let t=null!=e?e:{id:"tpl-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,documentSpecId:void 0,chapters:[]};s.setFieldsValue({...t,chapters:t.chapters.map(e=>({...e,queriesText:e.queries.join("\n"),requiredFactsText:e.requiredFacts.join("\n")}))}),eD(!0)},e4=async()=>{try{let r=await s.validateFields(),n={...r,chapters:(r.chapters||[]).map(e=>({...e,queries:String(e.queriesText||"").split(/\r?\n/u).map(e=>e.trim()).filter(Boolean),requiredFacts:String(e.requiredFactsText||"").split(/\r?\n/u).map(e=>e.trim()).filter(Boolean),queriesText:void 0,requiredFactsText:void 0}))},i=await (0,Q.l2)(n);ei(i.templates),ea(i.template.id),eD(!1),await eK(),t.success(e("common.success"))}catch(e){e instanceof Error&&t.error(e.message)}},e9=async s=>{try{let r=await (0,Q.bV)(s);ei(r.templates),ea(r.template.id),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}},te=async s=>{try{var r,n;let i=await (0,Q.h0)(s);ei(i.templates),ea(null!=(n=null==(r=i.templates[0])?void 0:r.id)?n:""),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}},tt=async e=>{try{let{validation:s}=await (0,Q.SM)(e);eF(t=>({...t,[e]:s}));let r=s.issues.filter(e=>"error"===e.level);if(ea(e),r.length>0)return void t.warning("模板运行前检查未通过,请先处理阻断项");if(s.issues.length>0)return void t.warning("模板存在警告,可在检查面板确认后继续运行");eJ(e)}catch(e){t.error(e instanceof Error?e.message:"模板运行前检查失败")}},ts=async s=>{try{await (0,Q.QG)(s),eS===s&&(eI(null),ew(null),ey("")),await eK(),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}},tr=async e=>{let t=[{k:"chapter_generation",m:"后台任务已创建,正在轮询等待 LLM 章节生成完成…"},{k:"asset_generation",m:"正在轮询等待封面和生成资源写入本地记录…"},{k:"validation",m:"正在轮询等待校验、导出门禁和格式化完成…"},{k:"llm_review",m:"正在轮询等待 LLM 审查优化完成…"}],s=0;for(;;){var r;let{document:n}=await (0,Q.v7)(e);if(e6(n),("completed"===n.status||"warning"===n.status)&&n.draft)return n;if("failed"===n.status)throw Error(n.error||"生成失败");if(0===(n.executionStages||(null==(r=n.draft)?void 0:r.executionStages)||[]).length){let e=t[Math.min(s,t.length-1)];e3(e.k),e7(e.k,"process",e.m)}s++,await new Promise(e=>window.setTimeout(e,1500))}},tn=async()=>{if(!el)return;if(null==ee?void 0:ee.loading){eB(ee.flowSteps),eR(ee.activeFlowKey),ef(!0);return}ef(!0);let s=e$(Z.find(e=>e.id===el)||eU),r=(0,Q.OX)({templateId:el});ee={id:Date.now(),templateId:el,loading:!0,flowSteps:s,activeFlowKey:"prepare",promise:r,listeners:new Set},eB(s),eR("prepare");let n=[{k:"role_binding",m:"正在读取模板、文件角色、提示词角色和文档规范包…"},{k:"knowledge_retrieval",m:"正在从知识库检索章节证据、表格、图片和附件…"},{k:"file_understanding",m:"正在准备多模态文件理解…"},{k:"fact_extraction",m:"正在等待 LLM 事实抽取和后续章节生成结果…"}].map((e,t)=>window.setTimeout(()=>{e3(e.k),e7(e.k,"process",e.m)},600+900*t));try{let s=await r;s.documentId&&(localStorage.setItem("activeGenDocId",s.documentId),eI(s.documentId),(null==ee?void 0:ee.promise)===r&&(ee.documentId=s.documentId)),await eK();let i=s.documentId?await tr(s.documentId):void 0,a=s.draft||(null==i?void 0:i.draft);if(!a)throw Error("生成结果为空");(s.documentId||(null==i?void 0:i.id))&&eI(s.documentId||i.id),n.forEach(e=>window.clearTimeout(e)),e3("done"),ew(a),ey((null==i?void 0:i.editedMarkdown)||(null==i?void 0:i.markdown)||a.markdown),(null==ee?void 0:ee.promise)===r&&(ee.draft=a,ee.content=(null==i?void 0:i.editedMarkdown)||(null==i?void 0:i.markdown)||a.markdown),eB(t=>{let s=t.map(t=>{let s=a.executionStages.find(e=>e.type===t.key);if("prepare"===t.key)return{...t,status:"finish",description:e("documents.flowPrepareDone"),subSteps:e2(t,"finish")};if("done"===t.key){var r;let s=a.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!a.exportGate.passed,n=s?"warning":"finish",i=null==(r=a.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:r.message;return{...t,status:n,description:s?"生成完成,但需复核:".concat(i||e("documents.flowGateFailed")):e("documents.flowDoneDesc"),subSteps:e2(t,n)}}if(!s)return"process"===t.status?{...t,status:"finish",subSteps:e2(t,"finish")}:t;let n="failed"===s.status?"error":"finish";return{...t,status:n,description:"".concat(s.status.toUpperCase(),":").concat(s.message||t.description),subSteps:e2(t,n)}});return e1(s,"done",!1),s}),eR("done"),(null==ee?void 0:ee.promise)===r&&(ee.activeFlowKey="done",ee.loading=!1,et()),localStorage.removeItem("activeGenDocId"),await eK(),t.success(e("common.success")),window.setTimeout(()=>{var e;return null==(e=l.current)?void 0:e.scrollIntoView({behavior:"smooth",block:"start"})},200)}catch(n){localStorage.removeItem("activeGenDocId");let s=n instanceof Error?n.message:e("common.error");eB(e=>{let t=e.map(e=>"process"===e.status?{...e,status:"error",description:s,subSteps:e2(e,"error")}:e);return e1(t,eE,!1),t}),(null==ee?void 0:ee.promise)===r&&(ee.loading=!1,ee.error=s,et()),t.error(s)}finally{n.forEach(e=>window.clearTimeout(e)),ef(!1),(null==ee?void 0:ee.promise)===r&&(ee.loading=!1,et())}},ti=(0,n.useRef)(!1),tl=async s=>{(null==ee?void 0:ee.loading)&&(ee.loading=!1,ee.error="用户中止",et(),ee=null,ef(!1)),localStorage.removeItem("activeGenDocId"),eN.current&&(clearInterval(eN.current),eN.current=null);try{await (0,Q.r)(s.id),await eK(),eS===s.id&&(eI(null),ew(null),ey("")),t.success("已中止生成任务")}catch(s){t.error(e("common.error"))}};(0,n.useEffect)(()=>{eW&&"workflow"===eH&&!ti.current&&!(null==ee?void 0:ee.loading)&&(null==eU?void 0:eU.projectRoleConfigId)&&(ti.current=!0,window.setTimeout(()=>{tn()},300)),eW||(ti.current=!1)},[eW,eH]);let ta=async s=>{if(ev){eT(!0);try{var r;let e="markdown"===s?"md":s,t=null==(r=ep.find(e=>e.id===(null==eU?void 0:eU.documentSpecId)))?void 0:r.wordTemplatePath,n=await (0,Q.UE)({documentId:eS||void 0,title:ev.title,markdown:ej,format:s,enforceGate:!1,exportGate:ev.exportGate,wordTemplatePath:t});((e,t,s)=>{let r=new Blob([e],{type:s}),n=URL.createObjectURL(r),i=document.createElement("a");i.href=n,i.download=t,i.target="_self",i.rel="noopener",i.style.display="none",document.body.appendChild(i),i.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),i.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)})(n,"".concat(ev.title,".").concat(e),{markdown:"text/markdown;charset=utf-8",html:"text/html;charset=utf-8",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}[s])}catch(s){t.error(s instanceof Error?s.message:e("common.error"))}finally{eT(!1)}}},to=async()=>{if(ev)try{if(eS)await (0,Q.a6)(eS,{editedMarkdown:ej,markdown:ej});else{let e=await (0,Q.Af)({...ev,markdown:ej});ew(e.draft)}await eK(),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}},tc=async s=>{if(ev){eC(s.id);try{var r,n;let i=await (0,Q.R1)({templateId:ev.templateId,chapterId:s.id,documentId:eS||void 0,currentMarkdown:ej,existingFacts:null==(r=ev.structuredFacts)?void 0:r.map(e=>e.value)});ew({...ev,chapters:ev.chapters.map(e=>e.id===s.id?i.chapter:e)}),n=i.chapter,ey(e=>e.includes(s.content)?e.replace(s.content,n.content):"".concat(e,"\n\n").concat(n.content)),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}finally{eC(null)}}};if(eh)return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsx)(c.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,r.jsx)(c.A,{active:!0,paragraph:{rows:2}}),(0,r.jsx)(c.A,{active:!0,paragraph:{rows:8}})]});let td="workflow"===eH?"工作流:".concat((null==eU?void 0:eU.name)||"选择模板"):"编辑:".concat((null==ev?void 0:ev.title)||(null==eU?void 0:eU.outputTitle)||"文档");return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"pageTitle",children:e("documents.title")}),(0,r.jsx)("p",{className:"pageDesc",children:e("documents.description")})]}),(0,r.jsx)(d.Ay,{type:"primary",icon:(0,r.jsx)(G.A,{}),onClick:()=>e5(),children:e("documents.newTemplate")})]}),(0,r.jsx)(u.A,{size:"small",tabList:[{key:"templates",label:"模板库 (".concat(Z.length,")")},{key:"drafts",label:"生成记录 (".concat(eA.length,")")}],activeTabKey:eP,onTabChange:eq,children:"templates"===eP?0===Z.length?(0,r.jsx)(p.A,{description:e("common.noData")}):(0,r.jsx)(m.A,{dataSource:Z,renderItem:(t,s)=>(0,r.jsx)(m.A.Item,{style:{cursor:"pointer",padding:"10px 0"},actions:[(0,r.jsx)(d.Ay,{size:"small",icon:(0,r.jsx)(H.A,{}),onClick:e=>{e.stopPropagation(),e5(t)},children:"配置"},"cfg"),(0,r.jsx)(d.Ay,{size:"small",type:"primary",icon:(0,r.jsx)(O.A,{}),onClick:e=>{e.stopPropagation(),tt(t.id)},children:"运行"},"run"),(0,r.jsx)(d.Ay,{size:"small",icon:(0,r.jsx)(N.A,{}),onClick:e=>{e.stopPropagation(),e9(t.id)}},"copy"),(0,r.jsx)(h.A,{title:e("documents.deleteTemplateConfirm"),disabled:t.builtIn,onConfirm:e=>{null==e||e.stopPropagation(),te(t.id)},children:(0,r.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,r.jsx)(W.A,{}),disabled:t.builtIn,onClick:e=>e.stopPropagation()})},"del")],onClick:()=>ea(t.id),children:(0,r.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[function(e,t){let s=er[e]||(0,r.jsx)(R.A,{});return(0,r.jsx)("span",{style:{color:t?"var(--colorAccent)":"var(--colorTextSecondary)",fontSize:16,marginTop:2,flexShrink:0},children:s})}(t.category,el===t.id),(0,r.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,r.jsx)("span",{style:{fontWeight:el===t.id?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),t.builtIn&&(0,r.jsx)(x.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"内置"}),el===t.id&&(0,r.jsx)(x.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"当前"}),(0,r.jsx)(x.A,{style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:t.category}),eM[t.id]&&(0,r.jsxs)(x.A,{color:eM[t.id].issues.some(e=>"error"===e.level)?"error":eM[t.id].issues.length?"warning":"success",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:["检查 ",eM[t.id].fileDiagnostics.length," 文件 / ",eM[t.id].promptDiagnostics.length," 提示词"]})]}),t.description&&(0,r.jsx)($,{type:"secondary",style:{fontSize:12,lineHeight:"18px"},children:t.description}),eM[t.id]&&(0,r.jsx)("div",{onClick:e=>e.stopPropagation(),style:{marginTop:8,padding:10,border:"1px solid ".concat(eM[t.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBorder)":eM[t.id].issues.length?"var(--colorWarningBorder)":"var(--colorSuccessBorder)"),borderRadius:10,background:eM[t.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBg)":eM[t.id].issues.length?"var(--colorWarningBg)":"var(--colorSuccessBg)"},children:(0,r.jsxs)(g.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,r.jsxs)(g.A,{wrap:!0,children:[(0,r.jsx)($,{strong:!0,children:eM[t.id].issues.some(e=>"error"===e.level)?"运行前检查未通过":eM[t.id].issues.length?"运行前检查存在警告":"运行前检查通过"}),(0,r.jsxs)(x.A,{color:"blue",children:["文件角色 ",eM[t.id].fileDiagnostics.length]}),(0,r.jsxs)(x.A,{color:"purple",children:["提示词角色 ",eM[t.id].promptDiagnostics.length]}),eM[t.id].spec&&(0,r.jsxs)(x.A,{color:"cyan",children:["规范包 ",eM[t.id].spec.name]})]}),eM[t.id].issues.length>0?eM[t.id].issues.map(e=>(0,r.jsx)(f.A,{type:"error"===e.level?"error":"warning",message:e.message,showIcon:!0},e.message)):(0,r.jsx)(f.A,{type:"success",message:"文件角色、提示词角色和规范包检查通过,可以运行。",showIcon:!0}),!eM[t.id].issues.some(e=>"error"===e.level)&&eM[t.id].issues.length>0&&(0,r.jsx)("div",{children:(0,r.jsx)(d.Ay,{size:"small",type:"primary",icon:(0,r.jsx)(O.A,{}),onClick:()=>eJ(t.id),children:"忽略警告并继续运行"})})]})})]})]})})}):0===eA.length?(0,r.jsx)(p.A,{description:e("common.noData")}):(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:eA.slice(0,15).map((e,t)=>{var s,n,i;let l,a;return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,padding:"10px 12px",border:"1px solid var(--colorBorderSecondary)",borderRadius:10,cursor:"pointer",background:eS===e.id?"var(--colorFillAlter)":void 0,minWidth:0},onClick:()=>{eY(e)},children:["completed"===e.status?(0,r.jsx)(L.A,{style:{fontSize:18,color:"var(--colorOk)",flexShrink:0,marginTop:2}}):"failed"===e.status?(0,r.jsx)(K.A,{style:{fontSize:18,color:"var(--colorDanger)",flexShrink:0,marginTop:2}}):"warning"===e.status?(0,r.jsx)(F.A,{style:{fontSize:18,color:"var(--colorWarning)",flexShrink:0,marginTop:2}}):(0,r.jsx)(U.A,{spin:!0,style:{fontSize:18,color:"#1677ff",flexShrink:0,marginTop:2}}),(0,r.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,r.jsx)("div",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:3},children:e.title}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px 10px",color:"var(--colorTextSecondary)",fontSize:11},children:[(0,r.jsx)("span",{children:new Date(e.updatedAt).toLocaleString()}),(0,r.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 s=Math.floor(t/60),r=t%60;if(s<60)return r?"".concat(s," 分 ").concat(r," 秒"):"".concat(s," 分");let n=Math.floor(s/60),i=s%60;return i?"".concat(n," 小时 ").concat(i," 分"):"".concat(n," 小时")})(e)]})]}),("warning"===e.status||"failed"===e.status)&&(0,r.jsx)("div",{style:{marginTop:3,color:"failed"===e.status?"var(--colorError)":"var(--colorWarning)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(null==(s=e.warningIssues)?void 0:s[0])||(null==(i=e.draft)||null==(n=i.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message)||"需复核"})]}),(0,r.jsxs)(g.A,{size:4,align:"center",children:[(0,r.jsx)(x.A,{color:"completed"===(l=e.status)?"success":"warning"===l?"warning":"failed"===l?"error":"processing",style:{margin:0,fontSize:10,lineHeight:"18px"},children:"completed"===(a=e.status)?"已完成":"warning"===a?"需复核":"failed"===a?"失败":"生成中"}),(0,r.jsxs)(x.A,{style:{margin:0,fontSize:10,lineHeight:"18px"},children:["#",t+1]}),(0,r.jsx)(h.A,{title:"确认删除?",onConfirm:t=>{null==t||t.stopPropagation(),ts(e.id)},children:(0,r.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,r.jsx)(W.A,{}),onClick:e=>e.stopPropagation()})}),e0(e.status)&&(0,r.jsx)(h.A,{title:"确定中止此生成任务?",onConfirm:t=>{null==t||t.stopPropagation(),tl(e)},children:(0,r.jsx)(d.Ay,{size:"small",danger:!0,onClick:e=>e.stopPropagation(),children:"中止"})}),(0,r.jsx)(d.Ay,{size:"small",type:"primary",icon:e0(e.status)?(0,r.jsx)(U.A,{spin:!0}):(0,r.jsx)(O.A,{}),onClick:t=>{t.stopPropagation(),eY(e)},children:"打开"})]})]},e.id)})})}),(0,r.jsx)(v.A,{title:td,open:eW,onClose:()=>{eG(!1),eN.current&&(clearInterval(eN.current),eN.current=null)},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:ev?(0,r.jsxs)(g.A,{wrap:!0,children:[(0,r.jsx)(d.Ay,{icon:(0,r.jsx)(X.A,{}),onClick:()=>{to()},children:e("documents.saveDraft")}),(0,r.jsx)(d.Ay,{icon:(0,r.jsx)(P.A,{}),loading:eb,onClick:()=>{ta("markdown")},children:"MD"}),(0,r.jsx)(d.Ay,{loading:eb,onClick:()=>{ta("html")},children:"HTML"}),(0,r.jsx)(d.Ay,{loading:eb,onClick:()=>{ta("docx")},children:"DOCX"}),(0,r.jsx)(d.Ay,{type:"primary",loading:eb,onClick:()=>{ta("pdf")},children:"PDF"})]}):eg&&"workflow"===eH?(0,r.jsx)(d.Ay,{danger:!0,onClick:()=>{(async()=>{eS&&await (0,Q.r)(eS).catch(()=>void 0),ee&&(ee.loading=!1,ee.error="用户中止",et(),ee=null),localStorage.removeItem("activeGenDocId"),eN.current&&(clearInterval(eN.current),eN.current=null),ef(!1),eB([]),eR(null),eG(!1),await eK(),t.info("已中止生成任务")})()},children:"中止任务"}):void 0,children:(0,r.jsxs)(g.A,{direction:"vertical",style:{width:"100%"},size:"middle",children:["workflow"===eH&&eL.length>0&&(0,r.jsx)(u.A,{size:"small",type:"inner",title:e("documents.executionStatus"),style:{maxHeight:360,overflow:"auto"},children:(0,r.jsx)(w.A,{direction:"vertical",size:"small",current:eQ,items:eL.map(e=>{let t;return{title:e.title,description:(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{children:e.description}),(0,r.jsx)("div",{style:{marginTop:4},children:e.subSteps.map(e=>{var t;return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:12,color:"var(--colorTextSecondary)"},children:["process"===(t=e.status)?(0,r.jsx)(q.A,{}):"finish"===t?(0,r.jsx)(L.A,{}):"warning"===t?(0,r.jsx)(F.A,{style:{color:"var(--colorWarning)"}}):"error"===t?(0,r.jsx)(W.A,{}):(0,r.jsx)("span",{style:{display:"inline-block",height:6,width:6,borderRadius:"50%",background:"var(--colorTextTertiary)"}}),(0,r.jsx)("span",{children:e.title})]},e.key)})})]}),status:"warning"===(t=e.status)?"finish":t,icon:"process"===e.status?(0,r.jsx)(q.A,{}):"warning"===e.status?(0,r.jsx)(F.A,{style:{color:"var(--colorWarning)"}}):e.icon}})})}),"workflow"===eH&&eg&&0===eL.length&&(0,r.jsx)("div",{style:{textAlign:"center",padding:40},children:(0,r.jsx)(j.A,{tip:"正在准备生成…"})}),ev&&(0,r.jsx)("div",{ref:l,children:(0,r.jsx)(u.A,{size:"small",title:"编辑器",children:(0,r.jsx)(y.A,{items:[{key:"edit",label:e("documents.edit"),children:(0,r.jsx)(Y,{rows:22,value:ej,onChange:e=>ey(e.target.value)})},{key:"chapters-facts",label:"章节与事实",children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16,maxHeight:500,overflow:"auto"},children:[ev.chapters.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["章节 (",ev.chapters.length,")"]}),(0,r.jsx)(m.A,{size:"small",dataSource:ev.chapters,renderItem:e=>(0,r.jsx)(m.A.Item,{actions:[(0,r.jsx)(d.Ay,{size:"small",icon:(0,r.jsx)(V.A,{}),loading:ez===e.id,onClick:()=>{tc(e)},children:"重新生成"},"regen")],children:(0,r.jsx)(m.A.Item.Meta,{title:e.title,description:"证据: ".concat(e.evidence.length," \xb7 缺失: ").concat(e.missingFacts.length)})})})]}),ev.structuredFacts.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["结构化事实 (",ev.structuredFacts.length,")"]}),(0,r.jsx)(A.A,{size:"small",column:1,bordered:!0,children:ev.structuredFacts.map((e,t)=>(0,r.jsxs)(A.A.Item,{label:e.key,children:[(0,r.jsx)("span",{children:e.value}),(0,r.jsx)(x.A,{style:{marginLeft:8},children:e.confidence.toFixed(2)}),(0,r.jsx)($,{type:"secondary",style:{fontSize:11,marginLeft:8},children:e.sourceFile})]},t))})]})]})},{key:"sources-missing",label:"来源与缺失",children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["引用来源 (",ev.sources.length,")"]}),0===ev.sources.length?(0,r.jsx)(p.A,{description:"暂无"}):(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:ev.sources.map(e=>(0,r.jsxs)(x.A,{color:"blue",children:[e.filePath," (",e.count,")"]},e.filePath))})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["缺失项 (",ev.missingItems.length,")"]}),0===ev.missingItems.length?(0,r.jsx)(p.A,{description:"无缺失"}):(0,r.jsx)(m.A,{size:"small",dataSource:ev.missingItems,renderItem:e=>(0,r.jsx)(m.A.Item,{children:e})})]})]})},{key:"validation",label:"校验 (".concat(ev.validationIssues.length,")"),children:0===ev.validationIssues.length?(0,r.jsx)(p.A,{description:"校验通过"}):(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8,maxHeight:500,overflow:"auto"},children:[ev.validationIssues.map(e=>(0,r.jsxs)("div",{style:{border:"1px solid var(--colorBorderSecondary)",borderRadius:8,padding:12},children:[(0,r.jsx)(x.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:e.level}),(0,r.jsx)("div",{style:{marginTop:6,whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.message}),e.suggestion&&(0,r.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))),ev.exportGate.checklist.length>0&&(0,r.jsxs)("div",{style:{marginTop:8},children:[(0,r.jsx)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:"导出门禁"}),(0,r.jsx)(m.A,{size:"small",dataSource:ev.exportGate.checklist,renderItem:e=>(0,r.jsxs)(m.A.Item,{children:[(0,r.jsx)($,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.label}),(0,r.jsx)(x.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})]})]})},{key:"stages",label:"执行阶段 (".concat(ev.executionStages.length,")"),children:(0,r.jsx)(m.A,{size:"small",dataSource:ev.executionStages,renderItem:e=>(0,r.jsxs)(m.A.Item,{children:[(0,r.jsx)(m.A.Item.Meta,{avatar:es[e.type]||(0,r.jsx)(R.A,{}),title:(0,r.jsx)($,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:"".concat(en[e.type]||e.type," \xb7 ").concat(e.roleId)}),description:(0,r.jsx)($,{type:"secondary",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})}),(0,r.jsx)(x.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})})}]})})})]})}),(0,r.jsx)(k.A,{maskClosable:!1,title:e("documents.templateEditor"),open:e_,onOk:()=>{e4()},onCancel:()=>eD(!1),width:760,centered:!0,okText:e("common.save"),cancelText:e("common.cancel"),children:(0,r.jsxs)(o.A,{form:s,layout:"vertical",requiredMark:"optional",children:[(0,r.jsxs)(S.A,{gutter:12,children:[(0,r.jsx)(o.A.Item,{name:"id",hidden:!0,children:(0,r.jsx)(i.A,{})}),(0,r.jsx)(I.A,{xs:24,md:8,children:(0,r.jsx)(o.A.Item,{name:"name",label:e("documents.templateName"),rules:[{required:!0}],children:(0,r.jsx)(i.A,{})})}),(0,r.jsx)(I.A,{xs:24,md:8,children:(0,r.jsx)(o.A.Item,{name:"category",label:e("documents.templateCategory"),children:(0,r.jsx)(i.A,{})})}),(0,r.jsx)(I.A,{xs:24,md:8,children:(0,r.jsx)(o.A.Item,{name:"outputTitle",label:e("documents.outputTitle"),children:(0,r.jsx)(i.A,{})})}),(0,r.jsx)(I.A,{xs:24,md:12,children:(0,r.jsx)(o.A.Item,{name:"description",label:e("documents.templateDescription"),children:(0,r.jsx)(i.A,{})})})]}),(0,r.jsx)(o.A.Item,{name:"projectRoleConfigId",label:e("documents.projectRoleConfig"),rules:[{required:!0,message:e("documents.projectRoleConfigRequired")}],children:(0,r.jsx)(b.A,{showSearch:!0,placeholder:e("documents.projectRoleConfigRequired"),options:eX})}),(0,r.jsx)(o.A.Item,{name:"documentSpecId",label:e("documents.documentSpec"),children:(0,r.jsx)(b.A,{allowClear:!0,showSearch:!0,placeholder:e("documents.documentSpecPlaceholder"),options:eV})}),(0,r.jsx)(o.A.List,{name:"chapters",children:(e,t)=>{let{add:s,remove:n}=t;return(0,r.jsxs)("div",{children:[(0,r.jsxs)(g.A,{style:{marginBottom:8},children:[(0,r.jsx)($,{strong:!0,children:"章节结构"}),(0,r.jsx)(d.Ay,{size:"small",icon:(0,r.jsx)(G.A,{}),onClick:()=>s({id:"chapter-".concat(Date.now()),title:"",purpose:"",queries:[],requiredFacts:[]}),children:"添加章节"})]}),e.map(e=>(0,r.jsx)(u.A,{size:"small",style:{marginBottom:8},children:(0,r.jsxs)(S.A,{gutter:8,children:[(0,r.jsx)(I.A,{span:6,children:(0,r.jsx)(o.A.Item,{name:[e.name,"id"],label:"章节 ID",rules:[{required:!0}],children:(0,r.jsx)(i.A,{})})}),(0,r.jsx)(I.A,{span:8,children:(0,r.jsx)(o.A.Item,{name:[e.name,"title"],label:"标题",rules:[{required:!0}],children:(0,r.jsx)(i.A,{})})}),(0,r.jsx)(I.A,{span:8,children:(0,r.jsx)(o.A.Item,{name:[e.name,"purpose"],label:"目的",children:(0,r.jsx)(i.A,{})})}),(0,r.jsx)(I.A,{span:2,children:(0,r.jsx)(d.Ay,{danger:!0,size:"small",onClick:()=>n(e.name),children:"删除"})}),(0,r.jsx)(I.A,{span:12,children:(0,r.jsx)(o.A.Item,{name:[e.name,"queriesText"],label:"查询词(每行一个)",children:(0,r.jsx)(Y,{rows:3})})}),(0,r.jsx)(I.A,{span:12,children:(0,r.jsx)(o.A.Item,{name:[e.name,"requiredFactsText"],label:"必需事实(每行一个)",children:(0,r.jsx)(Y,{rows:3})})})]})},e.key))]})}})]})})]})}}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,2884,9144,9189,3455,5292,4052,6506,4427,3057,2225,6578,636,6593,8792],()=>e(e.s=16403)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6920],{2548:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>D});var i=l(65321),c=l(35292),r=l(68787),n=l(2256),d=l(38770),t=l(11702),x=l(9730),h=l(13399),a=l(55122),j=l(15622),o=l(71330),m=l(8579),g=l(66926),p=l(7851),A=l(84742),u=l(32620);let{Paragraph:k,Title:N,Text:w}=c.A,y=[{icon:(0,i.jsx)(o.A,{}),title:"准备阶段",color:"blue",items:["配置模型","上传知识库资料","创建提示词"]},{icon:(0,i.jsx)(m.A,{}),title:"编排阶段",color:"purple",items:["创建文件角色","创建提示词角色","创建项目角色配置并排序"]},{icon:(0,i.jsx)(g.A,{}),title:"生成阶段",color:"geekblue",items:["创建模板","后台生成轮询","动态执行状态"]},{icon:(0,i.jsx)(p.A,{}),title:"交付阶段",color:"green",items:["审查事实和来源","检查导出门禁","导出正式文件"]}],z=[{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 会阻断 PDF/DOCX 导出,普通 warning 不阻断。","在草稿历史中确认生成状态、warning 原因、整体生成耗时,并可删除不需要的记录。","可以先导出 HTML 预览排版,再导出 DOCX/PDF。"],checks:["无真实阻断问题","关键事实有来源","章节有证据","warning 原因已复核","导出文件可打开"],tips:"导出不是简单放行:真实阻断仍会拦截;生成完成但存在可复核问题时显示 warning,用户可以继续导出并按原因优化资料。"}];function D(){let e=(0,u.Vr)();return(0,i.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,i.jsxs)(r.A,{className:"cardGlass",styles:{body:{padding:24}},children:[(0,i.jsx)(N,{level:2,className:"mb-2",children:e("guide.title")}),(0,i.jsx)(k,{className:"pageDesc mb-0",children:e("guide.description")})]}),(0,i.jsx)(n.A,{gutter:[16,16],children:y.map(e=>(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.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)(r.A,{title:e("guide.fullFlow"),children:(0,i.jsx)(x.A,{direction:"vertical",items:z.map(e=>({title:e.title,description:"".concat(e.goal,"(入口:").concat(e.path,")")}))})}),(0,i.jsx)(r.A,{title:"详细步骤说明:照着做即可跑通",children:(0,i.jsx)(h.A,{mode:"left",items:z.map(e=>({dot:(0,i.jsx)(A.A,{}),children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(N,{level:4,className:"mb-0",children:e.title}),(0,i.jsxs)(k,{children:[(0,i.jsx)(w,{strong:!0,children:"目标:"}),e.goal]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(w,{strong:!0,children:"入口:"}),e.path]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(w,{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)(w,{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)(k,{children:[(0,i.jsx)(w,{strong:!0,children:"提示:"}),e.tips]}),(0,i.jsx)(a.A,{})]})}))})}),(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(r.A,{title:e("guide.roleDesign"),children:[(0,i.jsx)(k,{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)(w,{strong:!0,children:e("guide.fileRole")}),(0,i.jsx)(k,{children:e("guide.fileRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(t.A,{color:"purple",children:"prompt"}),(0,i.jsx)(w,{strong:!0,children:e("guide.promptRole")}),(0,i.jsx)(k,{children:e("guide.promptRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(t.A,{color:"geekblue",children:"config"}),(0,i.jsx)(w,{strong:!0,children:e("guide.projectConfig")}),(0,i.jsx)(k,{children:e("guide.projectConfigDesc")})]})]})]})}),(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(r.A,{title:e("guide.generationEngine"),children:[(0,i.jsx)(k,{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:e("roles.validation")}),(0,i.jsx)(t.A,{children:e("roles.formatting")}),(0,i.jsx)(t.A,{children:e("documents.exportGate")})]})]})})]}),(0,i.jsx)(r.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)(r.A,{size:"small",title:"默认优先看我的数据",children:(0,i.jsx)(k,{children:"文件、提示词、角色配置和规范包默认优先展示用户自己创建的内容。内置示例只用于学习,不能直接覆盖或删除,需要使用时请先复制。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.A,{size:"small",title:"自定义门禁类型会执行",children:(0,i.jsx)(k,{children:"用户在文档规范包中创建的门禁类型,需要选择校验对象和校验方式。保存后它会和系统门禁类型一样参与生成校验,不只是备注说明。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.A,{size:"small",title:"上传后关注索引状态",children:(0,i.jsx)(k,{children:"文件上传完成后,知识库索引会继续在后台写入。请在文件管理页查看状态,如果失败,页面会展示原因,方便重新配置模型或重试。"})})})]})}),(0,i.jsx)(r.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)(r.A,{size:"small",title:"动态事实 schema",children:(0,i.jsx)(k,{children:"系统不会写死工程字段。文档规范包的事实字段、模板章节 requiredFacts、字段 sourceRoleIds 和 extractionHint 会共同组成抽取 schema,并驱动事实抽取、冲突检测和导出门禁。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.A,{size:"small",title:"结构化资源证据",children:(0,i.jsx)(k,{children:"文本、PDF/Word、Excel/CSV、图片、地图图纸和其他附件都会被整理成资源证据,包含文件角色、处理类型、正文用途、关联事实和证据片段,模型据此理解资料关系。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.A,{size:"small",title:"动态执行状态",children:(0,i.jsx)(k,{children:"生成编辑页的执行节点会随模板、规范包、文件角色、提示词角色、章节和门禁规则变化;用户生成不同项目文件时看到的是对应项目的流程,而不是固定示例流程。"})})})]})}),(0,i.jsx)(r.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)(r.A,{size:"small",title:"草稿历史记录",children:[(0,i.jsxs)(k,{children:["每次后台生成都会写入全局项目目录 ",(0,i.jsxs)(w,{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)(r.A,{size:"small",title:"warning 不是失败",children:[(0,i.jsx)(k,{children:"warning 用于提醒用户“文档已经生成,但建议复核”。例如必需事实没有在最佳来源角色中抽到、部分来源需要人工确认、格式或内容有优化建议。warning 会显示在草稿历史和校验详情中,并保留导出能力。"}),(0,i.jsx)(k,{children:"如果是明确阻断问题,例如正文包含临时图片生成 URL、出现“资料未提供”占位、真实 blockingIssues 未解决,则导出门禁仍会阻断 DOCX/PDF。"})]})}),(0,i.jsx)(d.A,{xs:24,lg:8,children:(0,i.jsxs)(r.A,{size:"small",title:"导出门禁规则",children:[(0,i.jsx)(k,{children:"门禁分为“真实阻断”和“复核建议”。系统不会因为普通 warning 简单禁止导出,但会在出现阻断级问题时保护交付质量。"}),(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)(r.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)(r.A,{size:"small",title:"生成资源自动回流知识库",children:[(0,i.jsx)(k,{children:"模型生成的图片、封面或后处理资源会登记到生成资源管理页,并自动回流到 knowledgeBase/生成资源 下完成索引。"}),(0,i.jsx)(k,{children:"后续文档可以继续检索和复用这些已生成资源,资源管理页也会展示入库状态。"})]})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsxs)(r.A,{size:"small",title:"资源预览和坏图处理",children:[(0,i.jsx)(k,{children:"资源预览会从全局 generatedDocuments 目录解析文件,不依赖当前页面临时路径。图片下载会识别“image is generating”等占位响应,并校验 PNG/JPEG/WebP 字节,避免把占位文本当成图片保存。"}),(0,i.jsx)(k,{children:"如果预览失败,优先查看资源管理页中的文件路径、资源状态和原始生成记录。"})]})})]})}),(0,i.jsx)(r.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)(r.A,{size:"small",title:"规则文件",children:(0,i.jsx)(k,{children:"用来告诉系统“必须怎么写、不能怎么写、按什么标准判断”。适合放评分办法、甲方编制要求、攻略写作要求、输出格式要求。生成时会优先作为约束使用。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"项目事实文件",children:(0,i.jsx)(k,{children:"用来告诉系统“真实情况是什么”。适合放项目概况、合同摘要、招标文件关键信息、游戏角色资料、产品资料。事实字段通常从这里抽取。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"表格数据",children:(0,i.jsx)(k,{children:"用来解析结构化数据。适合放 Excel、CSV、清单、计划表、评分表、推荐指数表。系统会读取 Sheet、表头、行列和来源范围。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"图纸文件",children:(0,i.jsx)(k,{children:"用来表达空间关系、路线、结构、站位或设计说明。可以是图纸目录、设计说明、路线示意、阵型图说明。没有 CAD 时也可以用文字图纸说明。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"规范文件",children:(0,i.jsx)(k,{children:"用来作为专业依据。适合放国家规范、行业标准、企业标准、攻略结构规范、质量标准。校验和生成时会把它当成依据。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"参考资料",children:(0,i.jsx)(k,{children:"只作为辅助阅读材料,不建议放关键事实。适合放图片来源、公开网页链接、背景资料、案例资料。系统可以参考,但不应把它当成强事实。"})})})]})}),(0,i.jsx)(r.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)(r.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)(r.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)(r.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)(r.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)(r.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)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.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)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.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)(r.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)(r.A,{title:"常见问题和处理建议",children:(0,i.jsx)(j.A,{items:[{key:"warning-export",label:"为什么生成完成后显示 warning,但仍然可以导出?",children:(0,i.jsx)(k,{children:"warning 表示文档已生成,但存在建议复核的问题,例如来源角色不完全匹配、某些事实需要人工确认或格式可优化。它不是失败,也不是导出阻断。只有真实 blockingIssues 或 error 级门禁问题才会阻断 DOCX/PDF 导出。"})},{key:"missing-facts",label:"为什么提示必需事实缺失?",children:(0,i.jsx)(k,{children:"优先检查文档规范包中的 factFields、sourceRoleIds、模板章节 requiredFacts 和文件角色绑定。很多情况下不是模型失败,而是资料没有被绑定到正确角色,或字段要求比资料实际内容更严格。"})},{key:"draft-duration",label:"草稿历史里的耗时怎么计算?",children:(0,i.jsx)(k,{children:"耗时使用生成记录的 createdAt 到 completedAt 计算;旧记录或未完成记录会使用 updatedAt 兜底。它用于判断本次生成链路整体成本,包括知识库检索、事实抽取、章节生成、资源处理、校验和格式化。"})},{key:"asset-index",label:"生成资源会如何进入知识库?",children:(0,i.jsx)(k,{children:"生成资源完成后会自动回流到 knowledgeBase/生成资源 并建立索引,便于后续模板继续复用。资源管理页会展示入库状态,错误资源可以删除后重新生成。"})}]})}),(0,i.jsx)(j.A,{items:[{key:"prepare",label:e("guide.prepareTitle"),children:(0,i.jsx)(k,{children:e("guide.prepareContent")})},{key:"roles",label:e("guide.rolesTitle"),children:(0,i.jsx)(k,{children:e("guide.rolesContent")})},{key:"template",label:e("guide.templateTitle"),children:(0,i.jsx)(k,{children:e("guide.templateContent")})},{key:"generate",label:e("guide.generateTitle"),children:(0,i.jsx)(k,{children:e("guide.generateContent")})},{key:"qa",label:e("guide.qaTitle"),children:(0,i.jsx)(k,{children:e("guide.qaContent")})}]})]})}},34899:(e,s,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/guide",function(){return l(2548)}])}},e=>{e.O(0,[347,8787,4277,4833,5292,4427,8326,636,6593,8792],()=>e(e.s=34899)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3309],{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(48200)}])},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 a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let l=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(l/60),a=Math.floor(n/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):n>0?"".concat(n,"h ago"):l>0?"".concat(l,"m ago"):"Just now":a>0?"".concat(a," 天前"):n>0?"".concat(n," 小时前"):l>0?"".concat(l," 分钟前"):"刚刚"}l.d(t,{Jm:()=>s,fw:()=>a,z3:()=>n});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},i={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===l?i:r)[e])?t:e}},48200:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>L});var n=l(65321),a=l(97109),r=l(1873),i=l.n(r),s=l(86109),o=l(35292),c=l(76506),d=l(33442),u=l(11702),h=l(9137),m=l(21289),p=l(68787),g=l(56985),x=l(49604),y=l(88762),_=l(85493),f=l(84253),w=l(85114),j=l(58569),A=l(7576),k=l(47210),v=l(6578),C=l(32620),S=l(45551),b=l(14569),I=l.n(b);let{Paragraph:P}=o.A;function N(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}function R(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).slice(0,30):[]}function z(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 a=RegExp("(".concat(l.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(a).map((e,t)=>l.some(t=>t.toLowerCase()===e.toLowerCase())?(0,n.jsx)("mark",{children:e},t):e)}function M(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 O(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 L(){var e,t,l,r,o;let b=(0,C.Vr)(),L=(0,s.useRouter)(),T="string"==typeof L.query.relativePath?L.query.relativePath:"",[D,E]=(0,a.useState)(),[F,B]=(0,a.useState)(!1),[J,K]=(0,a.useState)(""),[V,H]=(0,a.useState)(!1),[U,W]=(0,a.useState)(""),[X,G]=(0,a.useState)([]);(0,a.useEffect)(()=>{T&&(B(!0),K(""),(0,v.xC)(T).then(E).catch(e=>{E(void 0),K(e instanceof Error?e.message:"文件详情加载失败")}).finally(()=>B(!1)))},[T]);let $=(0,a.useMemo)(()=>(function(e){let t=N(null==e?void 0:e.file.metadataJson);return"object"==typeof t.extraction&&t.extraction?t.extraction:t})(D),[D]),q=R($.layerNames);(0,a.useEffect)(()=>{G(q)},[null==D?void 0:D.file.relativePath,q.join("|")]);let Z=U.trim().toLowerCase(),Q=(0,a.useMemo)(()=>{var e;return D&&Z?D.chunks.filter(e=>{let t=N(e.metadataJson);return[e.content,e.sectionTitle,t.rowRange,t.chunkKind,t.parentId,JSON.stringify(t)].some(e=>String(null!=e?e:"").toLowerCase().includes(Z))}):null!=(e=null==D?void 0:D.chunks)?e:[]},[D,Z]),Y=(0,a.useMemo)(()=>{var e;return D&&Z?D.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(Z))):null!=(e=null==D?void 0:D.parents)?e:[]},[D,Z]),ee=async()=>{if(T){H(!0);try{let e=await (0,v.HC)(T);e.detail&&E(e.detail),h.Ay.success("文件索引已重建")}finally{H(!1)}}},et=async e=>{e&&(await navigator.clipboard.writeText(e),h.Ay.success("已复制"))},el=async e=>{T&&(await (0,v.tn)(T,e),h.Ay.success("file"===e?"已请求打开文件":"已请求打开目录"))},en=(0,a.useMemo)(()=>{var e,t,l,a,r;let s=[],o=R($.sheetNames),h=R($.columnNames),y=R($.layerNames),_=R($.blockNames),f=R($.entityTypes),w=R($.productNames),j=R($.materialNames),A=R($.entityNames),k=R($.dataPaths),v=o.length>0||h.length>0||null!=$.rowCount||null!=$.columnCount||null!=$.formulaCount||null!=$.mergeCount,C=O(h,"column"),S=(null!=(e=null==D?void 0:D.chunks)?e:[]).map(e=>N(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,t)=>({key:"row-".concat(t),name:e})),b=(null!=(t=null==D?void 0:D.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)}));(v||C.length>0||S.length>0||b.length>0)&&s.push({key:"table",label:"表格",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[v&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[M("Sheet",o,W),M("表头",h,W),M("行数",$.rowCount),M("列数",$.columnCount),M("公式数",$.formulaCount),M("合并单元格",$.mergeCount)]}),C.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:C,columns:[{title:"列名",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})}]}),S.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:S,columns:[{title:"行范围",dataIndex:"name",render:e=>(0,n.jsxs)(u.A,{color:"gold",className:"cursor-pointer",onClick:()=>W(String(e)),children:["行 ",String(e)]})}]}),b.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:b,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 z=y.length>0||_.length>0||f.length>0||w.length>0||j.length>0||A.length>0,L=[...O(y,"layer").map(e=>({...e,type:"图层"})),...O(f,"entity").map(e=>({...e,type:"实体类型"})),...O(_,"block").map(e=>({...e,type:"块/符号"}))];(z||y.length>0||L.length>0)&&s.push({key:"drawing",label:"图纸",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[z&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[M("图层",y,W),M("块/符号",_,W),M("实体类型",f,W),M("产品/零件",w,W),M("材料",j,W),M("实体名称",A,W)]}),y.length>0&&(0,n.jsxs)(p.A,{size:"small",title:"图层开关 / 图纸预览",children:[(0,n.jsx)(g.A.Group,{value:X,options:y.map(e=>({label:e,value:e})),onChange:e=>G(e.map(String))}),(0,n.jsx)("div",{className:I().drawingPreview,children:X.map(e=>(0,n.jsx)(u.A,{color:"blue",children:e},e))})]}),L.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:L,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 T=(null!=(l=null==D?void 0:D.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,a,r;let i=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(t),path:null!=(a=null==i||null==(l=i[1])?void 0:l.trim())?a:e,value:null!=(r=null==i||null==(n=i[2])?void 0:n.trim())?r:""}});(k.length>0||T.length>0)&&s.push({key:"data",label:"数据路径",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[k.length>0&&(0,n.jsx)(x.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,a]=e;return{title:n,key:t?"".concat(t,".").concat(n):n,children:l(a,t?"".concat(t,".").concat(n):n)}})};return l(t)}(k),onSelect:e=>{var t;return W(String(null!=(t=e[0])?t:""))}}),T.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:T,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 E=null!=$.ocrRecommended||null!=$.ocrReason||null!=$.ocrProvider||null!=$.ocrLanguages||null!=$.ocrTextLength||null!=$.pdfPageOcrSupported||null!=$.ocrPageCount||null!=$.pdfOcrPageLimit||null!=$.pdfRenderer,F=(null!=(a=null==D?void 0:D.chunks)?a:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,t,l,n)=>{var a,r,i;return l%2==0&&e.push({key:"page-".concat(t),page:t,text:null!=(i=null==(r=n[l+1])||null==(a=r.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:a.trim())?i:""}),e},[]),B=(null==D?void 0:D.file.format)==="pdf";return(E||B||F.length>0)&&s.push({key:"ocr",label:"OCR/PDF",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[E&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[M("OCR 建议",$.ocrRecommended),M("OCR 原因",$.ocrReason),M("OCR 引擎",$.ocrProvider),M("OCR 语言",$.ocrLanguages),M("OCR 文本长度",$.ocrTextLength),M("PDF 页面 OCR 支持",$.pdfPageOcrSupported),M("PDF OCR 页数",$.ocrPageCount),M("PDF OCR 页数上限",$.pdfOcrPageLimit),M("PDF 渲染器",$.pdfRenderer)]}),B&&(0,n.jsx)("div",{className:I().pdfPreviewStrip,children:Array.from({length:Math.min(Number(null!=(r=$.ocrPageCount)?r:1)||1,6)},(e,t)=>(0,n.jsx)(i(),{width:220,height:320,src:"/api/kb/files/preview-pdf-page?relativePath=".concat(encodeURIComponent(D.file.relativePath),"&page=").concat(t+1),alt:"PDF 第 ".concat(t+1," 页"),unoptimized:!0},t))}),F.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:F,pagination:{pageSize:10},columns:[{title:"页码",dataIndex:"page",width:90},{title:"OCR 文本",dataIndex:"text",render:e=>(0,n.jsx)(P,{ellipsis:{rows:4,expandable:!0,symbol:"展开"},children:String(e)})}]})]})}),s},[$,D,X]),ea=[{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=N(t.metadataJson).chunkKind)?l:t.category)})}},{title:b("knowledge.sectionOrRange"),width:220,render:(e,t)=>{let l=N(t.metadataJson),a="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,a?(0,n.jsxs)(u.A,{color:"gold",children:["行 ",a]}):null]})}},{title:"Token",dataIndex:"tokenCount",width:90},{title:b("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(P,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:I().searchContent,children:z(t.content,U)})}],er=[{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)(P,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:I().searchContent,children:z(t.content,U)})}];return F?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(y.A,{active:!0,paragraph:{rows:1}}),(0,n.jsx)(p.A,{size:"small",children:(0,n.jsx)(y.A,{active:!0,paragraph:{rows:6}})}),(0,n.jsx)(p.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}):D?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(w.Ay,{icon:(0,n.jsx)(k.A,{}),href:"/knowledge/files",size:"small",style:{marginBottom:12},children:"返回文件列表"}),(0,n.jsxs)("div",{className:I().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==D?void 0:D.absolutePath)},children:"复制原文件路径"}),(0,n.jsx)(w.Ay,{onClick:()=>{et(null==D?void 0:D.directory)},children:"复制所在目录"}),(0,n.jsx)(w.Ay,{onClick:()=>{el("file")},children:"打开文件"}),(0,n.jsx)(w.Ay,{onClick:()=>{el("directory")},children:"打开目录"}),"pdf"===D.file.format?(0,n.jsx)(w.Ay,{loading:V,onClick:()=>{ee()},children:"重新 OCR"}):null,(0,n.jsx)(w.Ay,{type:"primary",loading:V,onClick:()=>{ee()},children:"重建该文件索引"})]})]})]}),(0,n.jsx)(p.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:D.file.relativePath}),(0,n.jsx)(c.A.Item,{label:"原文件",children:null!=(e=D.absolutePath)?e:"-"}),(0,n.jsx)(c.A.Item,{label:"所在目录",children:null!=(t=D.directory)?t:"-"}),(0,n.jsxs)(c.A.Item,{label:"分类",children:[(0,n.jsx)(u.A,{children:(0,S.Jm)(D.file.category)})," ",(0,n.jsx)(u.A,{children:D.file.format})]}),(0,n.jsx)(c.A.Item,{label:"大小",children:(0,S.z3)(D.file.fileSize)}),(0,n.jsx)(c.A.Item,{label:"切片数",children:D.file.chunkCount}),(0,n.jsx)(c.A.Item,{label:"状态",children:D.file.status}),(0,n.jsx)(c.A.Item,{label:"解析模式",children:String(null!=(l=$.extractionMode)?l:"-")}),(0,n.jsx)(c.A.Item,{label:"覆盖范围",children:String(null!=(r=$.contentCoverage)?r:"-")}),(0,n.jsx)(c.A.Item,{label:"正文长度",children:String(null!=(o=$.textLength)?o:"-")})]})}),en.length>0&&(0,n.jsx)(p.A,{size:"small",title:"结构化信息",children:(0,n.jsx)(j.A,{items:en})}),(0,n.jsx)(p.A,{size:"small",title:"详情筛选",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[(0,n.jsx)(A.A,{allowClear:!0,value:U,onChange:e=>W(e.target.value),placeholder:"筛选 rowRange、图层、实体、data path、section、chunk 内容"}),U?(0,n.jsxs)(d.A,{wrap:!0,children:[(0,n.jsxs)(u.A,{color:"blue",children:[b("knowledge.parentMatches")," ",Y.length]}),(0,n.jsxs)(u.A,{color:"green",children:[b("knowledge.childMatches")," ",Q.length]}),(0,n.jsxs)(u.A,{color:"purple",children:[b("knowledge.filterTerm")," ",U]})]}):null]})}),(0,n.jsxs)(p.A,{size:"small",title:"".concat(b("knowledge.parentChunks")," (").concat(Y.length,"/").concat(D.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:er,dataSource:Y,pagination:{pageSize:10},size:"small"})]}),(0,n.jsx)(p.A,{size:"small",title:"".concat(b("knowledge.childChunks")," (").concat(Q.length,"/").concat(D.chunks.length,")"),children:(0,n.jsx)(m.A,{rowKey:"id",columns:ea,dataSource:Q,pagination:{pageSize:20},size:"small"})})]}):(0,n.jsx)(f.A,{description:"请选择文件"})}}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,2884,9189,6985,7150,5292,1289,6506,861,1515,6578,636,6593,8792],()=>e(e.s=37690)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9028],{1611:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"database",theme:"outlined"}},13067:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0010.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 00-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"}}]},name:"file-excel",theme:"outlined"}},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},21349:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 01755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 01512.1 856a342.24 342.24 0 01-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 00-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 00-8-8.2z"}}]},name:"sync",theme:"outlined"}},23793:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"}},25258:(e,t,l)=>{"use strict";l.d(t,{A:()=>j});var r=l(51541),a=l(61848),s=l(5669),n=l(97109),i=l(72658),c=l(3638),o=l(92162),u=l(82725),d=l(74567),h=l(632),f=l(49517),m=l(79412),p=l(19527);let g=(0,u.U)(e=>{let{prefixCls:t,className:l,closeIcon:r,closable:a,type:s,title:u,children:g,footer:y,classNames:v,styles:x,...j}=e,{getPrefixCls:w}=n.useContext(d.QO),{className:_,style:A,classNames:b,styles:C}=(0,d.TP)("modal"),z=w(),k=t||w("modal"),S=(0,h.A)(z),[P,M]=(0,p.Ay)(k,S),[N,I]=(0,o.AV)([b,v],[C,x],{props:e}),E=`${k}-confirm`,O={};return O=s?{closable:a??!1,title:"",footer:"",children:n.createElement(f.k,{...e,prefixCls:k,confirmPrefixCls:E,rootPrefixCls:z,content:g})}:{closable:a??!0,title:u,footer:null!==y&&n.createElement(m.w,{...e}),children:g},n.createElement(i.Z,{prefixCls:k,className:(0,c.$)(P,`${k}-pure-panel`,s&&E,s&&`${E}-${s}`,l,_,M,S,N.root),style:{...A,...I.root},...j,closeIcon:(0,m.O)(k,r),closable:a,classNames:N,styles:I,...O})});var y=l(99739);function v(e){return(0,r.Ay)((0,r.fp)(e))}let x=s.A;x.useModal=y.A,x.info=function(e){return(0,r.Ay)((0,r.$D)(e))},x.success=function(e){return(0,r.Ay)((0,r.Ej)(e))},x.error=function(e){return(0,r.Ay)((0,r.jT)(e))},x.warning=v,x.warn=v,x.confirm=function(e){return(0,r.Ay)((0,r.lr)(e))},x.destroyAll=function(){for(;a.A.length;){let e=a.A.pop();e&&e()}},x.config=r.FB,x._InternalPanelDoNotUseOrYouWillBeFired=g;let j=x},26619:(e,t,l)=>{"use strict";l.d(t,{A:()=>i});var r=l(97109),a=l(1611),s=l(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(s.A,n({},e,{ref:t,icon:a.A})))},30289:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"}},45551:(e,t,l)=>{"use strict";function r(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),l=e/Math.pow(1024,t);return"".concat(l.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let l=Math.floor(Math.floor((Date.now()-e)/1e3)/60),r=Math.floor(l/60),a=Math.floor(r/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):r>0?"".concat(r,"h ago"):l>0?"".concat(l,"m ago"):"Just now":a>0?"".concat(a," 天前"):r>0?"".concat(r," 小时前"):l>0?"".concat(l," 分钟前"):"刚刚"}l.d(t,{Jm:()=>i,fw:()=>a,z3:()=>r});let s={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},n={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function i(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===l?n:s)[e])?t:e}},48893:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M553.1 509.1l-77.8 99.2-41.1-52.4a8 8 0 00-12.6 0l-99.8 127.2a7.98 7.98 0 006.3 12.9H696c6.7 0 10.4-7.7 6.3-12.9l-136.5-174a8.1 8.1 0 00-12.7 0zM360 442a40 40 0 1080 0 40 40 0 10-80 0zm494.6-153.4L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file-image",theme:"outlined"}},58209:(e,t,l)=>{"use strict";l.d(t,{A:()=>i});var r=l(97109),a=l(23793),s=l(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(s.A,n({},e,{ref:t,icon:a.A})))},58520:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 00-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 00-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z"}}]},name:"file-word",theme:"outlined"}},61825:(e,t,l)=>{"use strict";l.d(t,{A:()=>i});var r=l(97109),a=l(30289),s=l(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(s.A,n({},e,{ref:t,icon:a.A})))},64629:(e,t,l)=>{"use strict";l.d(t,{A:()=>i});var r=l(97109),a=l(21349),s=l(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(s.A,n({},e,{ref:t,icon:a.A})))},82738:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>ee});var r=l(65321),a=l(97109),s=l(32620),n=l(43220),i=l.n(n),c=l(86109),o=l(17807),u=l(25258),d=l(11702),h=l(85114),f=l(7576),m=l(57271),p=l(68787),g=l(33442),y=l(99605),v=l(14932),x=l(21289),j=l(56768),w=l(48893),_=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 r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let b=a.forwardRef((e,t)=>a.createElement(_.A,A({},e,{ref:t,icon:w.A})));var C=l(13067);function z(){return(z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let k=a.forwardRef((e,t)=>a.createElement(_.A,z({},e,{ref:t,icon:C.A})));var S=l(58520);function P(){return(P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let M=a.forwardRef((e,t)=>a.createElement(_.A,P({},e,{ref:t,icon:S.A})));var N=l(90939);function I(){return(I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let E=a.forwardRef((e,t)=>a.createElement(_.A,I({},e,{ref:t,icon:N.A})));var O=l(93314),H=l(61825),F=l(26619),V=l(29606),T=l(26631),B=l(64254),L=l(58209),R=l(30486),D=l(92803);function U(){return(U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let J=a.forwardRef((e,t)=>a.createElement(_.A,U({},e,{ref:t,icon:D.A})));var Q=l(64629),W=l(84742),q=l(38762),X=l(6578),$=l(45551),G=l(14569),K=l.n(G);let Z=["document","spreadsheet","image","cad","code","data","web","diagram","other"],Y=/\.(zip|jar|war|apk|tar|gz|tgz|bz2|rar|7z)$/iu;function ee(){let e=(0,s.Vr)("knowledge"),{locale:t}=(0,s.x_)(),{message:l}=o.A.useApp(),n=(0,c.useRouter)(),w="string"==typeof n.query.category?n.query.category:"",[_,A]=(0,a.useState)([]),[C,z]=(0,a.useState)(!1),[S,P]=(0,a.useState)(""),[N,I]=(0,a.useState)(""),[D,U]=(0,a.useState)(w),[G,ee]=(0,a.useState)(!1),[et,el]=(0,a.useState)(!1),[er,ea]=(0,a.useState)([]),[es,en]=(0,a.useState)([]),[ei,ec]=(0,a.useState)(new Set),[eo,eu]=(0,a.useState)("all"),[ed,eh]=(0,a.useState)("user"),[ef,em]=(0,a.useState)(!0),[ep,eg]=(0,a.useState)([]),ey=(0,a.useRef)(D);(0,a.useEffect)(()=>{ey.current=D},[D]),(0,a.useEffect)(()=>{U("string"==typeof n.query.category?n.query.category:"")},[n.query.category]);let ev=(0,a.useCallback)(async e=>{let t=null!=e?e:ey.current;z(!0),P("");try{let e=await (0,X.HT)({category:t||void 0,limit:200});A(e.files||[]),e.initializing&&window.setTimeout(()=>{ev(t)},1500)}catch(e){A([]),P(e instanceof Error?e.message:"文件列表加载失败")}finally{z(!1)}},[]);(0,a.useEffect)(()=>{ev(D)},[D,ev]);let ex=e=>({id:e.id,type:e.type,title:e.title,description:e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,textLength:e.textLength,extractionMode:e.extractionMode,error:e.error,createdAt:e.createdAt}),ej=(0,a.useCallback)(async()=>{try{let e=(await (0,X.Qx)()).operations.map(ex);ea(t=>{let l=new Set(e.map(e=>e.id).filter(Boolean)),r=t.filter(e=>e.id&&!l.has(e.id)&&"processing"===e.status);return[...e,...r].slice(0,50)})}catch(e){}},[]),ew=(0,a.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];ea(l=>{let r=l.findIndex(l=>e.id&&l.id===e.id||t.includes(l.title));if(r>=0){var a;let t=[...l];return t[r]={...l[r],...e,createdAt:null!=(a=l[r].createdAt)?a:e.createdAt},t}return[e,...l].slice(0,50)})},[]);(0,a.useEffect)(()=>{ej()},[ej]);let e_=async()=>{try{await (0,X.H7)(),ea([]),l.success("任务状态已清空")}catch(e){l.error("清空任务状态失败")}},eA=async(e,t)=>{if(t.stopPropagation(),e.id)try{await (0,X.CU)(e.id)}catch(e){}ea(t=>t.filter(t=>t!==e))},eb=(0,a.useMemo)(()=>{let e=0,t=0,l=0;for(let r of er)"processing"===r.status?e++:"success"===r.status?t++:("error"===r.status||"warning"===r.status)&&l++;return{processing:e,success:t,error:l}},[er]);(0,a.useEffect)(()=>{eb.processing>0&&em(!1)},[eb.processing]),(0,a.useEffect)(()=>{if(0===eb.processing)return;let e=window.setInterval(()=>{ej()},1e3);return()=>window.clearInterval(e)},[ej,eb.processing]);let eC="all"===eo?er:er.filter(e=>"processing"===eo?"processing"===e.status:"success"===eo?"success"===e.status:"error"!==eo||"error"===e.status||"warning"===e.status),ez=async e=>{let t=e.filter(e=>!Y.test(e.name)),r=e.length-t.length;if(r>0&&l.warning("已跳过 ".concat(r," 个压缩包,请解压后上传内部文件")),0===t.length)return;let a=1===t.length?t[0].name:"".concat(t.length," 个文件");ee(!0);let s="".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2));ew({id:s,type:"upload",title:"上传 ".concat(a),description:"等待上传、解析、切片和入库",status:"processing",percent:5});let n=!1,i=0,c=async()=>{let e=await (0,X.QT)(s);i=0;let t="error"===e.stage?"error":"done"===e.stage?"success":"processing";return ew({id:s,type:"error"===t?"error":"upload",title:"success"===t?"上传完成 ".concat(a):"上传 ".concat(a),description:"".concat(e.message).concat(e.chunkCount?",".concat(e.chunkCount," 个切片"):""),status:t,percent:e.percent}),("done"===e.stage||"error"===e.stage)&&(n=!0),e},o=e=>{if((i+=1)>=5){n=!0;let t=e instanceof Error?e.message:"进度查询失败";ew({id:s,type:"error",title:"上传失败 ".concat(a),description:t,status:"error",percent:100})}},u=setInterval(()=>{c().catch(o)},700);try{await (0,X.c1)(t,void 0,s),l.info("文件已上传,正在后台解析、切片和入库");for(let e=0;e<240&&!n;e++)await new Promise(e=>setTimeout(e,500)),await c().catch(o);I(""),U(""),en([]),ey.current="",await ev(),await ej(),n&&l.success("上传索引流程已完成")}catch(t){let e=t instanceof Error?t.message:"请重试或检查文件格式";l.error(e||"上传失败"),ew({id:s,type:"error",title:"上传失败 ".concat(a),description:e,status:"error",percent:100})}finally{clearInterval(u),ee(!1)}},ek=async()=>{el(!0);let e="reindex-ui-".concat(Date.now());ew({id:e,type:"reindex",title:"重新解析入库",description:"已提交全量重新解析、切片和入库任务",status:"processing",percent:10});try{let t=await (0,X.H1)(),r=t.operationId||e;l.success("已提交重新解析入库任务"),ew({id:r,type:"reindex",title:"重新解析入库",description:"后台将重新扫描文件、解析、切片并重建索引",status:"processing",percent:20},["重新解析入库"]);for(let e=0;e<180;e++){let e=(await (0,X.Qx)()).operations.find(e=>e.id===t.operationId);if(e&&(ew({id:r,type:"error"===e.status?"error":"reindex",title:"success"===e.status?"重新解析入库完成":"error"===e.status?"重新解析入库失败":"重新解析入库",description:e.message,status:e.status,percent:e.percent}),"success"===e.status||"error"===e.status))break;await new Promise(e=>setTimeout(e,1e3))}await ev(),await ej()}catch(r){let t=r instanceof Error?r.message:"重新解析入库失败";l.error(t),ew({id:e,type:"error",title:"重新解析入库失败",description:t,status:"error",percent:100},["重新解析入库","重新解析入库完成","重新解析入库失败"])}finally{el(!1)}},eS=t=>{let r="selected"===t?eR:"filtered"===t?eM.filter(e=>!e.builtIn).map(e=>e.relativePath):[],a=_.filter(e=>!e.builtIn).length;if("all"!==t&&0===r.length||"all"===t&&0===a)return void l.info("没有可删除的用户文件");let s="all"===t?"删除全部用户文件 ".concat(a," 个?"):"filtered"===t?"删除当前筛选结果中的用户文件 ".concat(r.length," 个?"):"删除已选用户文件 ".concat(r.length," 个?");u.A.confirm({title:s,content:"将同时删除文件、切片、索引和向量记录。此操作不可撤销。",okText:e("common.delete"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{ea(e=>[{type:"delete",title:s,description:"正在批量删除文件和索引",status:"processing",percent:10},...e].slice(0,50));try{var e;let s=null!=(e=("all"===t?await (0,X.X8)():"selected"===t?await (0,X.tZ)(eL,eB):await (0,X.SJ)(r)).deleted)?e:"all"===t?a:r.length;l.success("已删除 ".concat(s," 个文件")),en([]),ea(e=>[{type:"delete",title:"批量删除完成",description:"已删除 ".concat(s," 个文件、切片和索引"),status:"success"},...e].slice(0,50)),await ev(),await ej()}catch(e){l.error("批量删除失败"),ea(e=>[{type:"error",title:"批量删除失败",description:"请重试",status:"error"},...e].slice(0,50))}}})},eP=(0,a.useMemo)(()=>"all"===ed?_:_.filter(e=>"builtIn"===ed?e.builtIn:!e.builtIn),[_,ed]),eM=(0,a.useMemo)(()=>N?eP.filter(e=>e.relativePath.toLowerCase().includes(N.toLowerCase())):eP,[N,eP]),eN=(0,a.useMemo)(()=>_.filter(e=>!e.builtIn),[_]),eI=(0,a.useMemo)(()=>_.filter(e=>e.builtIn),[_]),eE=(0,a.useMemo)(()=>eM.filter(e=>!e.builtIn),[eM]),eO=(0,a.useMemo)(()=>eM.filter(e=>e.builtIn),[eM]),eH=(0,a.useMemo)(()=>new Set(eM.map(e=>e.relativePath)),[eM]),eF=(0,a.useMemo)(()=>{let e={};for(let l of[...eM].sort((e,t)=>e.relativePath.localeCompare(t.relativePath))){let r=l.relativePath.split("/"),a="";for(let s=0;s<r.length;s++){let n=r[s],i=a;a=a?"".concat(a,"/").concat(n):n;let c=s===r.length-1;if(e[a])c||e[a].isFolder?c&&(e[a].isFolder=!1,e[a].file=l,e[a].fileCount=1,e[a].userFileCount=+!l.builtIn,e[a].totalSize=l.fileSize,e[a].totalChunks=l.chunkCount):(e[a].isFolder=!0,e[a].children=[],e[a].fileCount=0,e[a].userFileCount=0,e[a].totalSize=0,e[a].totalChunks=0);else{var t;e[a]={key:a,name:n,isFolder:!c,...c?{file:l,fileCount:1,userFileCount:+!l.builtIn,totalSize:l.fileSize,totalChunks:l.chunkCount}:{children:[],fileCount:0,userFileCount:0,totalSize:0,totalChunks:0}},i&&(null==(t=e[i])?void 0:t.children)&&e[i].children.push(e[a])}}}let l=e=>{for(let n of e)if(n.children){l(n.children);let e=0,i=0,c=0,o=0;for(let l of n.children){var t,r,a,s;e+=null!=(t=l.fileCount)?t:0,i+=null!=(r=l.userFileCount)?r:0,c+=null!=(a=l.totalSize)?a:0,o+=null!=(s=l.totalChunks)?s:0}n.fileCount=e,n.userFileCount=i,n.totalSize=c,n.totalChunks=o}},r=e=>e.map(e=>e.children?{...e,children:r(e.children)}:e).filter(e=>{var t,l,r;return!e.isFolder||(null!=(l=e.fileCount)?l:0)>0&&(null!=(r=null==(t=e.children)?void 0:t.length)?r:0)>0}),a=Object.values(e).filter(e=>!e.key.includes("/"));return l(a),r(a)},[eM]),eV=(0,a.useMemo)(()=>{let e=[],t=l=>{for(let r of l)e.push(r.key),r.children&&t(r.children)};return t(eF),e},[eF]),eT=(0,a.useMemo)(()=>new Set([...eH,...eV]),[eV,eH]),eB=(0,a.useMemo)(()=>es.map(String).filter(e=>!eH.has(e)&&eV.includes(e)),[eV,es,eH]),eL=(0,a.useMemo)(()=>es.map(String).filter(e=>eH.has(e)),[es,eH]),eR=(0,a.useMemo)(()=>{let e=new Set;for(let t of eL){let l=_.find(e=>e.relativePath===t);l&&!l.builtIn&&e.add(l.relativePath)}for(let t of eB){let l="".concat(t,"/");for(let t of _)!t.builtIn&&t.relativePath.startsWith(l)&&e.add(t.relativePath)}return Array.from(e)},[_,eL,eB]),eD=eR.length;(0,a.useEffect)(()=>{en(e=>e.filter(e=>eT.has(String(e))))},[eT]);let eU=(0,a.useMemo)(()=>N?eV:eF.map(e=>e.key),[N,eV,eF]);(0,a.useEffect)(()=>{eg(eU)},[eU]);let eJ=(e,t)=>{eg(l=>e?[...l,t.key]:l.filter(e=>e!==t.key))},eQ=[{title:e("fileName"),dataIndex:"name",key:"name",render:(e,t)=>{var l;return(0,r.jsxs)("span",{className:K().fileNameCell,children:[t.isFolder?(0,r.jsx)("span",{style:{cursor:"pointer"},onClick:e=>{e.stopPropagation(),eJ(!ep.includes(t.key),t)},children:(e=>{let t=e.children;return t&&0!==t.length?(0,r.jsx)(B.A,{style:{color:"#fa8c16",fontSize:15}}):(0,r.jsx)(V.A,{style:{color:"#fa8c16",fontSize:15}})})(t)}):(e=>{if(!e)return(0,r.jsx)(j.A,{style:{fontSize:15}});let t=e.category;return"image"===t?(0,r.jsx)(b,{style:{color:"#eb2f96",fontSize:15}}):"spreadsheet"===t?(0,r.jsx)(k,{style:{color:"#52c41a",fontSize:15}}):"document"===t?(0,r.jsx)(M,{style:{color:"#1677ff",fontSize:15}}):"code"===t?(0,r.jsx)(E,{style:{color:"#fa8c16",fontSize:15}}):"archive"===t?(0,r.jsx)(O.A,{style:{color:"#8c8c8c",fontSize:15}}):"web"===t?(0,r.jsx)(H.A,{style:{color:"#13c2c2",fontSize:15}}):"data"===t?(0,r.jsx)(F.A,{style:{color:"#722ed1",fontSize:15}}):"cad"===t?(0,r.jsx)(V.A,{style:{color:"#fa541c",fontSize:15}}):"diagram"===t?(0,r.jsx)(b,{style:{color:"#a0d911",fontSize:15}}):(0,r.jsx)(T.A,{style:{fontSize:15}})})(t.file),t.isFolder?(0,r.jsx)("span",{className:K().folderName,onClick:e=>{e.stopPropagation(),eJ(!ep.includes(t.key),t)},children:t.name}):(0,r.jsxs)(r.Fragment,{children:[(null==(l=t.file)?void 0:l.builtIn)&&(0,r.jsx)(d.A,{color:"gold",style:{fontSize:11,lineHeight:"18px"},children:"内置"}),(0,r.jsx)(i(),{className:"truncate max-w-[380px] inline-block",href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(t.key)),children:t.name})]})]})}},{title:e("fileCategory"),dataIndex:"category",key:"cat",width:110,render:(e,l)=>{var a,s;return l.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,r.jsx)(d.A,{children:(0,$.Jm)(null!=(s=null==(a=l.file)?void 0:a.category)?s:"",t)})}},{title:e("fileSize"),dataIndex:"fileSize",key:"size",width:90,render:(e,t)=>{var l,r,a;return(0,$.z3)(t.isFolder?null!=(r=t.totalSize)?r:0:null!=(a=null==(l=t.file)?void 0:l.fileSize)?a:0)}},{title:"切片",dataIndex:"chunkCount",key:"chunks",width:80,render:(e,t)=>{var l,a,s;let n=t.isFolder?null!=(a=t.totalChunks)?a:0:null!=(s=null==(l=t.file)?void 0:l.chunkCount)?s:0;return(0,r.jsx)(d.A,{color:n>1?"green":"orange",children:n})}},{title:"解析状态",dataIndex:"status",key:"status",width:100,render:(e,t)=>{var l,a,s;return t.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,r.jsx)(d.A,{color:(null==(l=t.file)?void 0:l.status)==="active"?"green":"red",children:(null==(a=t.file)?void 0:a.errorMessage)||(null==(s=t.file)?void 0:s.status)||"—"})}},{title:e("fileDate"),dataIndex:"mtime",key:"date",width:130,render:(e,l)=>{var a;return l.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(null==(a=l.file)?void 0:a.mtime)?new Date(l.file.mtime).toLocaleDateString(t):"—"}},{title:"来源",key:"source",width:100,render:(e,t)=>{var l;return t.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(null==(l=t.file)?void 0:l.builtIn)?(0,r.jsx)(d.A,{color:"gold",children:"内置示例"}):(0,r.jsx)(d.A,{color:"cyan",children:"我的文件"})}},{title:"",key:"act",width:50,render:(t,a)=>{var s;return a.isFolder?null:(0,r.jsx)(h.Ay,{type:"text",danger:!0,size:"small",disabled:null==(s=a.file)?void 0:s.builtIn,icon:(0,r.jsx)(L.A,{}),onClick:()=>(t=>{if(t.builtIn)return void l.info("内置示例资料不可删除");u.A.confirm({title:e("delete"),content:e("deleteConfirm"),okText:e("common.confirm"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{ea(e=>[{type:"delete",title:"删除 ".concat(t.relativePath),description:"正在删除文件记录",status:"processing"},...e].slice(0,50));try{await (0,X.xq)(t.relativePath),l.success("已删除"),ea(e=>[{type:"delete",title:"删除完成 ".concat(t.relativePath),description:"文件和索引记录已移除",status:"success"},...e].slice(0,50)),en(e=>e.filter(e=>e!==t.relativePath)),await ev(),await ej()}catch(e){l.error("删除失败"),ea(e=>[{type:"error",title:"删除失败 ".concat(t.relativePath),description:"请重试",status:"error"},...e].slice(0,50))}}})})(a.file)})}}];return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsx)("h2",{className:"pageTitle",children:e("files")}),(0,r.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,r.jsx)(f.A,{placeholder:e("searchPlaceholder"),prefix:(0,r.jsx)(R.A,{}),value:N,onChange:e=>{I(e.target.value)},allowClear:!0,className:K().filterInput}),(0,r.jsx)(m.A,{value:D||void 0,onChange:e=>{U(e||"")},placeholder:e("filterCategory"),allowClear:!0,className:K().filterSelect,options:[{label:e("allCategories"),value:""},...Z.map(e=>({label:(0,$.Jm)(e,t),value:e}))]}),(0,r.jsx)(m.A,{value:ed,onChange:eh,className:K().filterSelect,options:[{label:"全部来源 (".concat(_.length,")"),value:"all"},{label:"我的文件 (".concat(eN.length,")"),value:"user"},{label:"内置示例 (".concat(eI.length,")"),value:"builtIn"}]}),(0,r.jsx)(h.Ay,{type:"primary",icon:(0,r.jsx)(J,{}),loading:G,onClick:()=>{var e;return null==(e=document.getElementById("kb-file-upload-input"))?void 0:e.click()},children:G?e("uploading"):e("upload")}),(0,r.jsx)(h.Ay,{icon:(0,r.jsx)(J,{}),loading:G,onClick:()=>{var e;return null==(e=document.getElementById("kb-folder-upload-input"))?void 0:e.click()},children:"上传文件夹"}),(0,r.jsx)(h.Ay,{icon:(0,r.jsx)(Q.A,{}),loading:et,onClick:()=>{ek()},children:"重新解析入库"}),(0,r.jsx)("input",{id:"kb-file-upload-input",type:"file",multiple:!0,hidden:!0,accept:".pdf,.doc,.docx,.txt,.md,.csv,.tsv,.xls,.xlsx,.png,.jpg,.jpeg,.webp,.svg,.dwg,.dxf,.step,.stp,.iges,.igs,.js,.ts,.tsx,.jsx,.py,.go,.java,.cs,.cpp,.c,.h,.json,.jsonl,.yaml,.yml,.xml,.html,.htm,.drawio,.dio,.vsdx,.vdx,.puml,.plantuml,.mmd,.mermaid,.excalidraw",onChange:e=>{var t;let l=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",ez(l)}}),(0,r.jsx)("input",{id:"kb-folder-upload-input",type:"file",multiple:!0,hidden:!0,webkitdirectory:"",onChange:e=>{var t;let l=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",ez(l)}})]}),(0,r.jsxs)(p.A,{size:"small",className:K().statusCard,styles:{body:{padding:0}},children:[(0,r.jsxs)("div",{className:K().statusSummary,onClick:()=>em(!ef),children:[(0,r.jsx)("span",{className:K().statusSummaryText,children:0===er.length?"暂无文件任务":(0,r.jsxs)(g.A,{size:6,children:[eb.processing>0&&(0,r.jsxs)(d.A,{color:"processing",style:{margin:0},icon:(0,r.jsx)(Q.A,{spin:!0}),children:["处理中 ",eb.processing]}),(0,r.jsxs)(d.A,{color:"success",style:{margin:0},icon:(0,r.jsx)(W.A,{}),children:["已完成 ",eb.success]}),(0,r.jsxs)(d.A,{color:"error",style:{margin:0},icon:(0,r.jsx)(q.A,{}),children:["失败 ",eb.error]})]})}),er.length>0&&(0,r.jsxs)(g.A,{size:6,children:[(0,r.jsx)(h.Ay,{size:"small",className:K().statusClearBtn,onClick:e=>{e.stopPropagation(),e_()},children:"清空"}),(0,r.jsx)(h.Ay,{size:"small",className:K().statusExpandBtn,onClick:e=>{e.stopPropagation(),em(!ef)},children:ef?"展开":"收起"})]})]}),!ef&&er.length>0&&(0,r.jsxs)("div",{className:K().statusPanel,children:[(0,r.jsxs)("div",{className:K().statusFilters,children:[(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("all"===eo?K().filterPillActive:""),style:"all"===eo?{color:"#1677ff"}:void 0,onClick:()=>eu("all"),children:["全部 ",(0,r.jsx)("b",{children:er.length})]}),(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("processing"===eo?K().filterPillActive:""),style:"processing"===eo?{color:"#1677ff"}:void 0,onClick:()=>eu("processing"),children:[(0,r.jsx)(Q.A,{spin:eb.processing>0})," 处理中 ",(0,r.jsx)("b",{children:eb.processing})]}),(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("success"===eo?K().filterPillActive:""),style:"success"===eo?{color:"#52c41a"}:void 0,onClick:()=>eu("success"),children:[(0,r.jsx)(W.A,{})," 已完成 ",(0,r.jsx)("b",{children:eb.success})]}),(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("error"===eo?K().filterPillActive:""),style:"error"===eo?{color:"#ff4d4f"}:void 0,onClick:()=>eu("error"),children:[(0,r.jsx)(q.A,{})," 失败 ",(0,r.jsx)("b",{children:eb.error})]})]}),(0,r.jsx)("div",{className:K().timelineList,children:0===eC.length?(0,r.jsx)("div",{className:K().statusEmpty,children:"没有匹配的任务"}):eC.map((e,l)=>{var a;let s=e.id||"".concat(e.type,"-").concat(null!=(a=e.createdAt)?a:e.title,"-").concat(l),n=ei.has(s);return(0,r.jsxs)("div",{className:K().timelineItem,children:[(0,r.jsxs)("div",{className:K().timelineRow,onClick:()=>{ec(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},children:[(0,r.jsx)("span",{className:K().timelineStatusIcon,children:"success"===e.status?(0,r.jsx)(W.A,{style:{color:"#52c41a"}}):"processing"===e.status?(0,r.jsx)(Q.A,{spin:!0,style:{color:"#1677ff"}}):"error"===e.status?(0,r.jsx)(q.A,{style:{color:"#ff4d4f"}}):(0,r.jsx)("span",{style:{color:"#fa8c16",fontWeight:700},children:"!"})}),(0,r.jsx)("span",{className:K().timelineTitle,children:e.title}),"number"==typeof e.percent&&"processing"===e.status&&(0,r.jsxs)("span",{className:K().timelinePercent,children:[e.percent,"%"]}),(0,r.jsx)(h.Ay,{type:"text",size:"small",danger:!0,icon:(0,r.jsx)(L.A,{}),style:{width:22,height:22,padding:0,fontSize:12},onClick:t=>{eA(e,t)}})]}),n&&(0,r.jsxs)("div",{className:K().timelineDetail,children:["number"==typeof e.percent&&"processing"===e.status&&(0,r.jsx)(y.A,{percent:e.percent,size:"small",strokeColor:"#1677ff"}),e.description&&(0,r.jsx)("div",{className:K().timelineDesc,children:e.description}),e.error&&(0,r.jsx)("div",{style:{color:"var(--colorError)",fontSize:12,wordBreak:"break-word"},children:e.error}),e.filePath&&(0,r.jsx)(v.A,{title:e.filePath,children:(0,r.jsx)("div",{className:K().timelinePath,children:e.filePath})}),(0,r.jsxs)("div",{className:K().timelineMeta,children:["number"==typeof e.chunkCount&&(0,r.jsxs)("span",{className:K().timelineMetaTag,children:["切片 ",(0,r.jsx)("b",{children:e.chunkCount})]}),"number"==typeof e.textLength&&(0,r.jsxs)("span",{className:K().timelineMetaTag,children:["正文 ",(0,r.jsx)("b",{children:e.textLength.toLocaleString(t)})," 字符"]}),e.extractionMode&&(0,r.jsxs)("span",{className:K().timelineMetaTag,children:["解析 ",(0,r.jsx)("b",{children:e.extractionMode})]})]}),"error"===e.status&&(0,r.jsx)("div",{style:{color:"var(--colorError)",fontSize:12},children:"此任务失败,请重新上传文件或重试操作"})]})]},s)})})]})]}),(0,r.jsxs)(p.A,{title:"文件列表",extra:(0,r.jsxs)(g.A,{size:8,children:[(0,r.jsxs)(h.Ay,{danger:!0,size:"small",disabled:0===eD,icon:(0,r.jsx)(L.A,{}),onClick:()=>eS("selected"),children:["删除已选 ",eD||""]}),(0,r.jsx)(h.Ay,{danger:!0,size:"small",disabled:0===eN.length,onClick:()=>eS("all"),children:"删除全部用户文件"})]}),children:[S&&(0,r.jsxs)("div",{className:K().statusEmpty,children:["文件列表加载失败:",S]}),(0,r.jsx)(x.A,{rowKey:"key",columns:eQ,dataSource:eF,loading:C,size:"middle",expandable:{expandedRowKeys:ep,onExpand:eJ,childrenColumnName:"children"},locale:{emptyText:C?"正在加载文件列表...":N?e("emptySearch"):e("noFiles")},pagination:!1,rowClassName:e=>e.isFolder?K().folderRow:"",rowSelection:{selectedRowKeys:es,onChange:en,checkStrictly:!1,getCheckboxProps:e=>{var t,l;return{disabled:e.isFolder?(null!=(l=e.userFileCount)?l:0)===0:!!(null==(t=e.file)?void 0:t.builtIn)}}},footer:()=>(0,r.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["当前展示 ",eM.length," 个文件,其中我的文件 ",eE.length," 个、内置示例 ",eO.length," 个;全部我的文件 ",eN.length," 个、内置示例 ",eI.length," 个;",eF.length," 个顶层目录"]})})]})]})}},90426:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/files",function(){return l(82738)}])},90939:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"}},92803:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"}}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,2884,9189,6985,7150,1289,8732,6578,636,6593,8792],()=>e(e.s=90426)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3414],{45551:(e,l,t)=>{"use strict";function n(e){if(0===e)return"0 B";let l=Math.floor(Math.log(e)/Math.log(1024)),t=e/Math.pow(1024,l);return"".concat(t.toFixed(+(0!==l))," ").concat(["B","KB","MB","GB","TB"][l])}function a(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===l?"Never":"从未";let t=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(t/60),a=Math.floor(n/24);return a>30?new Date(e).toLocaleDateString(l):"en-US"===l?a>0?"".concat(a,"d ago"):n>0?"".concat(n,"h ago"):t>0?"".concat(t,"m ago"):"Just now":a>0?"".concat(a," 天前"):n>0?"".concat(n," 小时前"):t>0?"".concat(t," 分钟前"):"刚刚"}t.d(l,{Jm:()=>o,fw:()=>a,z3:()=>n});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},s={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function o(e){var l;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(l=("en-US"===t?s:r)[e])?l:e}},50423:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>E});var n=t(65321),a=t(97109),r=t(34986),s=t(32620),o=t(17807),c=t(33442),i=t(85114),d=t(2256),u=t(38770),h=t(68787),x=t(54849),g=t(57271),m=t(76506),j=t(11702),A=t(29606),f=t(30486),w=t(99811),v=t(56768),k=t(26619),p=t(93314),y=t(58740),b=t(35459),C=t(23216),S=t(63663),z=t(49484),D=t(6578),N=t(45551);let _=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function E(){var e,l,t,E;let I=(0,s.Vr)(),{locale:T}=(0,s.x_)(),M=(0,r.useRouter)(),{stats:B,loading:F,reload:R}=function(){let[e,l]=(0,a.useState)(null),[t,n]=(0,a.useState)(!1),r=(0,a.useCallback)(async()=>{n(!0);try{l(await (0,D.hc)())}catch(e){}finally{n(!1)}},[]);return(0,a.useEffect)(()=>{r()},[r]),{stats:e,loading:t,reload:r}}(),O=function(){let[e,l]=(0,a.useState)(null);return(0,a.useEffect)(()=>{(0,D.VW)().then(l).catch(()=>{})},[]),e}(),{reindexing:P,reindex:J}=function(){let[e,l]=(0,a.useState)(!1);return{reindexing:e,reindex:(0,a.useCallback)(async()=>{l(!0);try{return await (0,D.H1)(),!0}catch(e){return!1}finally{l(!1)}},[])}}(),[U,V]=(0,a.useState)("document"),[W,H]=(0,a.useState)({count:0,totalSize:0,totalChunks:0}),{message:X}=o.A.useApp(),G=(0,a.useCallback)(async e=>{try{let l=await (0,D.HT)({category:e,limit:1e4}),t=0,n=0;if(Array.isArray(l.files))for(let e of l.files)t+=e.fileSize||0,n+=e.chunkCount||0;H({count:l.total||0,totalSize:t,totalChunks:n})}catch(e){H({count:0,totalSize:0,totalChunks:0})}},[]);(0,a.useEffect)(()=>{G(U)},[U,G]);let K=async()=>{await J()?await Promise.all([R(),G(U)]):X.error(I("common.error"))};return(0,n.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:I("knowledge.manageTitle")}),(0,n.jsx)("p",{className:"pageDesc",children:I("knowledge.manageDesc")})]}),(0,n.jsxs)(c.A,{children:[(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(A.A,{}),onClick:()=>M.push("/knowledge/files"),children:I("knowledge.files")}),(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(f.A,{}),onClick:()=>M.push("/knowledge/search"),children:I("knowledge.search")}),(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(w.A,{}),loading:P,onClick:()=>{K()},children:I("knowledge.reindex")})]})]}),(0,n.jsx)(d.A,{gutter:[16,16],children:[{icon:(0,n.jsx)(v.A,{}),label:I("knowledge.totalFiles"),value:null!=(l=null==B?void 0:B.fileCount)?l:0},{icon:(0,n.jsx)(k.A,{}),label:I("knowledge.totalChunks"),value:null!=(t=null==B?void 0:B.chunkCount)?t:0},{icon:(0,n.jsx)(p.A,{}),label:I("knowledge.totalSize"),value:(0,N.z3)(null!=(E=null==B?void 0:B.totalSizeBytes)?E:0)},{icon:(0,n.jsx)(y.A,{}),label:I("knowledge.lastIndexed"),value:(null==B?void 0:B.lastIndexedAt)?(0,N.fw)(B.lastIndexedAt,T):I("common.never")}].map((e,l)=>(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(h.A,{size:"small",loading:F&&!B,children:(0,n.jsx)(x.A,{title:e.label,value:e.value,prefix:e.icon})})},l))}),(0,n.jsxs)(h.A,{title:I("knowledge.categories"),size:"small",children:[(0,n.jsx)(g.A,{value:U,onChange:e=>V(e),options:_.map(e=>({label:(0,N.Jm)(e,T),value:e})),style:{width:160,marginBottom:16}}),(0,n.jsxs)(d.A,{gutter:[16,16],children:[(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.fileCount"),value:W.count,prefix:(0,n.jsx)(v.A,{style:{color:"var(--colorAccent)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.totalSize"),value:(0,N.z3)(W.totalSize),prefix:(0,n.jsx)(p.A,{style:{color:"var(--colorWarning)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:"切片数",value:W.totalChunks,prefix:(0,n.jsx)(b.A,{style:{color:"var(--colorOk)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:"平均大小",value:W.count>0?(0,N.z3)(W.totalSize/W.count):"—",prefix:(0,n.jsx)(k.A,{style:{color:"var(--colorDanger)"}})})})]})]}),O&&(0,n.jsx)(h.A,{title:I("knowledge.features"),size:"small",children:(0,n.jsxs)(m.A,{size:"small",column:{xs:1,sm:2},bordered:!0,children:[(0,n.jsx)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(C.A,{style:{marginRight:4}}),"Vector Store"]}),children:(0,n.jsx)(j.A,{color:"blue",children:O.vectorStore})}),(0,n.jsx)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b.A,{style:{marginRight:4}}),"Embedding"]}),children:(0,n.jsx)(j.A,{color:"purple",children:O.embeddingProvider})}),(0,n.jsxs)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(S.A,{style:{marginRight:4}}),I("knowledge.featureDedup")]}),children:[(0,n.jsx)(j.A,{color:"green",children:O.dedupEngine}),(0,n.jsx)("div",{className:"text-xs",style:{color:"var(--colorTextSecondary)",marginTop:2},children:I("knowledge.featureDedupDesc")})]}),(0,n.jsxs)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z.A,{style:{marginRight:4}}),I("knowledge.featureChunker")]}),children:[(0,n.jsx)(j.A,{color:"orange",children:O.chunker}),(0,n.jsx)("div",{className:"text-xs",style:{color:"var(--colorTextSecondary)",marginTop:2},children:I("knowledge.featureChunkerDesc")})]}),(null==(e=O.externalExtractors)?void 0:e.length)>0&&(0,n.jsx)(m.A.Item,{label:"外部提取器",span:2,children:(0,n.jsx)(c.A,{wrap:!0,children:O.externalExtractors.map(e=>(0,n.jsx)(j.A,{color:"cyan",children:e},e))})})]})})]})}},54178:(e,l,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/manage",function(){return t(50423)}])}},e=>{e.O(0,[347,8787,7889,7271,6506,7223,6578,636,6593,8792],()=>e(e.s=54178)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5207],{838:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"}},4184:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>g});var l=s(65321),r=s(43220),n=s.n(r),i=s(97109),a=s(35292),c=s(68787),o=s(33442),d=s(7576),u=s(85114),h=s(48318),_=s(76506),m=s(11702),p=s(85493),x=s(42700),j=s(84253),y=s(30486),f=s(6578),b=s(14569),w=s.n(b);let{Paragraph:v}=a.A;function A(e){return"number"==typeof e?e.toFixed(2):"-"}function g(){var e,t,s;let[r,a]=(0,i.useState)(""),[b,g]=(0,i.useState)(!1),[C,k]=(0,i.useState)([]),[S,E]=(0,i.useState)(),[P,N]=(0,i.useState)(),[I,R]=(0,i.useState)(""),[L,O]=(0,i.useState)({keyword:1,vector:.9,rewrite:.72,hybridBonus:.35}),B=async()=>{let e=r.trim();if(e){g(!0),R("");try{let t=await (0,f.W2)(e,{limit:10,weights:L});k(t.results),E(t.queryTimeMs),N(t.debug)}catch(e){k([]),R(e instanceof Error?e.message:"搜索失败")}finally{g(!1)}}};return(0,l.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"pageTitle",children:"知识库搜索"}),(0,l.jsx)("p",{className:"pageDesc",children:"查看 hybrid 检索、parent 回填、分块来源和评分明细。"})]}),(0,l.jsx)(c.A,{size:"small",children:(0,l.jsxs)(o.A.Compact,{className:"w-full",children:[(0,l.jsx)(d.A,{value:r,onChange:e=>a(e.target.value),onPressEnter:()=>{B()},placeholder:"输入要搜索的知识库内容"}),(0,l.jsx)(u.Ay,{type:"primary",icon:(0,l.jsx)(y.A,{}),loading:b,onClick:()=>{B()},children:"搜索"})]})}),(0,l.jsx)(c.A,{size:"small",title:"召回权重调节",children:(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsxs)("span",{children:["Keyword ",(0,l.jsx)(h.A,{min:0,max:5,step:.1,value:L.keyword,onChange:e=>O(t=>({...t,keyword:Number(null!=e?e:1)}))})]}),(0,l.jsxs)("span",{children:["Vector ",(0,l.jsx)(h.A,{min:0,max:5,step:.1,value:L.vector,onChange:e=>O(t=>({...t,vector:Number(null!=e?e:.9)}))})]}),(0,l.jsxs)("span",{children:["Rewrite ",(0,l.jsx)(h.A,{min:0,max:5,step:.1,value:L.rewrite,onChange:e=>O(t=>({...t,rewrite:Number(null!=e?e:.72)}))})]}),(0,l.jsxs)("span",{children:["Hybrid Bonus ",(0,l.jsx)(h.A,{min:0,max:2,step:.05,value:L.hybridBonus,onChange:e=>O(t=>({...t,hybridBonus:Number(null!=e?e:.35)}))})]})]})}),P&&(0,l.jsx)(c.A,{size:"small",title:"检索调试面板",children:(0,l.jsxs)(_.A,{size:"small",column:2,bordered:!0,children:[(0,l.jsx)(_.A.Item,{label:"原始查询",children:P.originalQuery}),(0,l.jsx)(_.A.Item,{label:"Reranker",children:P.reranker}),(0,l.jsx)(_.A.Item,{label:"查询改写",span:2,children:(0,l.jsx)(o.A,{wrap:!0,children:null==(e=P.rewrittenQueries)?void 0:e.map(e=>(0,l.jsx)(m.A,{children:e},e))})}),(0,l.jsx)(_.A.Item,{label:"召回数量",span:2,children:(0,l.jsx)(o.A,{wrap:!0,children:Object.entries(null!=(t=P.recallCounts)?t:{}).map(e=>{let[t,s]=e;return(0,l.jsxs)(m.A,{children:[t,": ",s]},t)})})}),(0,l.jsx)(_.A.Item,{label:"召回权重",span:2,children:(0,l.jsx)(o.A,{wrap:!0,children:Object.entries(null!=(s=P.weights)?s:{}).map(e=>{let[t,s]=e;return(0,l.jsxs)(m.A,{children:[t,": ",s]},t)})})})]})}),(0,l.jsxs)(c.A,{size:"small",title:"搜索结果",extra:"number"==typeof S?"".concat(S," ms"):void 0,children:[I?(0,l.jsx)(p.A,{type:"error",showIcon:!0,message:"搜索失败",description:I,className:"mb-4"}):null,b?(0,l.jsx)(x.A,{}):0===C.length?(0,l.jsx)(j.A,{description:"暂无结果"}):(0,l.jsx)("div",{className:w().searchResultList,children:C.map((e,t)=>{var s,i,a,c,d,u;return(0,l.jsxs)("div",{className:w().searchResultItem,children:[(0,l.jsxs)("div",{className:w().searchResultHeader,children:[(0,l.jsxs)(o.A,{size:8,wrap:!0,children:[(0,l.jsxs)(m.A,{children:["序号 ",t+1]}),(0,l.jsx)(m.A,{color:"hybrid"===e.source?"purple":"vector"===e.source?"blue":"green",children:null!=(u=e.source)?u:"keyword"}),(0,l.jsx)(m.A,{children:e.scope}),e.chunkKind&&(0,l.jsx)(m.A,{color:"geekblue",children:e.chunkKind}),e.rowRange&&(0,l.jsxs)(m.A,{color:"gold",children:["行 ",e.rowRange]}),e.sectionTitle&&(0,l.jsx)(m.A,{color:"cyan",children:e.sectionTitle})]}),(0,l.jsx)("strong",{children:A(e.score)})]}),(0,l.jsxs)("div",{className:w().statusPath,children:[(0,l.jsx)(n(),{href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(e.filePath)),children:e.filePath}),"number"==typeof e.chunkIndex?" #".concat(e.chunkIndex):""]}),(0,l.jsx)(v,{ellipsis:{rows:6,expandable:!0,symbol:"展开"},className:w().searchContent,children:function(e,t){let s=[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length);if(0===s.length)return e;let r=RegExp("(".concat(s.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(r).map((e,t)=>s.some(t=>t.toLowerCase()===e.toLowerCase())?(0,l.jsx)("mark",{children:e},t):e)}(e.content,r)}),e.facets&&Object.keys(e.facets).length>0&&(0,l.jsx)("div",{className:w().statusMeta,children:Object.entries(e.facets).slice(0,8).map(e=>{let[t,s]=e;return(0,l.jsxs)("span",{children:[t," ",(0,l.jsx)("b",{children:Array.isArray(s)?s.join(", "):String(s)})]},t)})}),(0,l.jsxs)("div",{className:w().statusMeta,children:[(0,l.jsxs)("span",{children:["keyword ",(0,l.jsx)("b",{children:A(null==(s=e.scoreDetails)?void 0:s.keywordScore)})]}),(0,l.jsxs)("span",{children:["bm25 ",(0,l.jsx)("b",{children:A(null==(i=e.scoreDetails)?void 0:i.bm25Score)})]}),(0,l.jsxs)("span",{children:["vector ",(0,l.jsx)("b",{children:A(null==(a=e.scoreDetails)?void 0:a.vectorScore)})]}),(0,l.jsxs)("span",{children:["rerank ",(0,l.jsx)("b",{children:A(null==(c=e.scoreDetails)?void 0:c.rerankBoost)})]}),(0,l.jsxs)("span",{children:["hybrid ",(0,l.jsx)("b",{children:A(null==(d=e.scoreDetails)?void 0:d.hybridScore)})]})]})]},e.id)})})]})]})}},9208:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/search",function(){return s(4184)}])},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},30486:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});var l=s(97109),r=s(58758),n=s(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(e[l]=s[l])}return e}).apply(this,arguments)}let a=l.forwardRef((e,t)=>l.createElement(n.A,i({},e,{ref:t,icon:r.A})))},58758:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"}},60470:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});var l=s(97109),r=s(838),n=s(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(e[l]=s[l])}return e}).apply(this,arguments)}let a=l.forwardRef((e,t)=>l.createElement(n.A,i({},e,{ref:t,icon:r.A})))},73458:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"}}]},name:"edit",theme:"outlined"}},99650:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});var l=s(97109),r=s(73458),n=s(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(e[l]=s[l])}return e}).apply(this,arguments)}let a=l.forwardRef((e,t)=>l.createElement(n.A,i({},e,{ref:t,icon:r.A})))}},e=>{e.O(0,[347,8787,4277,7889,4833,7576,2884,5292,6506,5938,6578,636,6593,8792],()=>e(e.s=9208)),_N_E=e.O()}]);
|