@customize-agent/server 4.0.5 → 4.0.7
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 +176 -271
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +8 -0
- package/.next/server/chunks/1936.js +385 -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/config/models.js +1 -1
- package/.next/server/pages/api/jobs/[id].js +2 -0
- package/.next/server/pages/api/jobs/[id].js.nft.json +1 -0
- package/.next/server/pages/api/jobs.js +2 -0
- package/.next/server/pages/api/jobs.js.nft.json +1 -0
- package/.next/server/pages/api/kb/files/open.js +1 -1
- package/.next/server/pages/api/kb/files.js +2 -2
- package/.next/server/pages/api/kb/operations.js +2 -2
- package/.next/server/pages/api/kb/reindex.js +2 -2
- package/.next/server/pages/api/kb/reindex.js.nft.json +1 -1
- package/.next/server/pages/api/kb/upload.js +2 -2
- package/.next/server/pages/api/kb/upload.js.nft.json +1 -1
- 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 +27 -25
- package/.next/static/2m64hom9a1sJPcvcwOlZ5/_buildManifest.js +1 -0
- package/.next/static/chunks/131-ad10d55ed64e627e.js +1 -0
- package/.next/static/chunks/{7150-123ff059dd0e2eb9.js → 150-57173312c2b70e98.js} +4 -4
- package/.next/static/chunks/195-9f2e4c67a9deff05.js +1 -0
- package/.next/static/chunks/20-23d24b40b69faf0f.js +8 -0
- package/.next/static/chunks/265-c3a46cef96364aac.js +1 -0
- package/.next/static/chunks/{1289-c788c44e65e9dc64.js → 289-36c210992d5009d5.js} +1 -1
- package/.next/static/chunks/412-03a4cc00655c0ec0.js +1 -0
- package/.next/static/chunks/433-ef3d7675b81826a9.js +1 -0
- package/.next/static/chunks/447-772df02993a8609b.js +1 -0
- package/.next/static/chunks/455-9e1e1c7e96845347.js +6 -0
- package/.next/static/chunks/506-b97aadd3e451b379.js +1 -0
- package/.next/static/chunks/512-e2813c7e9454d53c.js +1 -0
- package/.next/static/chunks/576-679ab6348b33b960.js +1 -0
- package/.next/static/chunks/698-0599729ce14a2e49.js +1 -0
- package/.next/static/chunks/749-dcb0cd85d1455f34.js +1 -0
- package/.next/static/chunks/{8787-c8bea0f25cbd3cf0.js → 787-196a2bed7b11745a.js} +1 -1
- package/.next/static/chunks/788-7de94bb44b70fb19.js +1 -0
- package/.next/static/chunks/932-823e1ae10dd43b8b.js +1 -0
- package/.next/static/chunks/938-0063785681203bb5.js +1 -0
- package/.next/static/chunks/985-da0b1f68e59d1e76.js +4 -0
- package/.next/static/chunks/framework-161be364fd69a7ce.js +1 -0
- package/.next/static/chunks/main-91fb767ebd74c9c1.js +1 -0
- package/.next/static/chunks/pages/_app-15da9e1394f6eaca.js +212 -0
- package/.next/static/chunks/pages/_error-282257fbdcc167b4.js +1 -0
- package/.next/static/chunks/pages/asset-library-e9ddfe1cbaac42d9.js +1 -0
- package/.next/static/chunks/pages/context/{long-term-820cba5f1ae3a6cd.js → long-term-2e6a30a8f879df47.js} +1 -1
- package/.next/static/chunks/pages/context/short-term-730211234fa3add6.js +1 -0
- package/.next/static/chunks/pages/{document-roles-ab6dfead3fd99a2c.js → document-roles-fb9e3ce4719fda9b.js} +1 -1
- package/.next/static/chunks/pages/document-specs-033d848b03b54df3.js +1 -0
- package/.next/static/chunks/pages/{documents-471786ecea050f17.js → documents-a21e4c98480b1a95.js} +1 -1
- package/.next/static/chunks/pages/{guide-2a3ec07403e02e1f.js → guide-6c680688d15f6200.js} +1 -1
- package/.next/static/chunks/pages/index-c5e0758e6b31deee.js +1 -0
- package/.next/static/chunks/pages/knowledge/file-detail-0a5e267f77f4e8b3.js +1 -0
- package/.next/static/chunks/pages/knowledge/files-4d2754cc303c2a70.js +1 -0
- package/.next/static/chunks/pages/knowledge/manage-25eb1a993b155450.js +1 -0
- package/.next/static/chunks/pages/knowledge/search-2cee4e8b8792170c.js +1 -0
- package/.next/static/chunks/pages/knowledge-905248d8dcb15453.js +1 -0
- package/.next/static/chunks/pages/models-b5f68c4c70257495.js +1 -0
- package/.next/static/chunks/pages/{overview-5235c02260509635.js → overview-37f93a823b4750f3.js} +1 -1
- package/.next/static/chunks/pages/prompt-4cf07545f8388d85.js +1 -0
- package/.next/static/chunks/pages/settings-fa9d6a56898ba678.js +1 -0
- package/.next/static/chunks/pages/system/logs-f4e222140dc7b30c.js +1 -0
- package/.next/static/chunks/{webpack-689755a4ff6d1f93.js → webpack-77d10b4726f13aa5.js} +1 -1
- package/package.json +3 -3
- package/scripts/kb-index-worker.cjs +128 -0
- package/.next/server/chunks/1547.js +0 -385
- package/.next/server/chunks/550.js +0 -1
- package/.next/server/chunks/9270.js +0 -1
- package/.next/static/IWuWLSb2ffDzvKo6MD3cy/_buildManifest.js +0 -1
- package/.next/static/chunks/1515-051d4383493143c9.js +0 -1
- package/.next/static/chunks/2073-244191fe7cc6e330.js +0 -4
- package/.next/static/chunks/2225-a90b5cc9338c63fa.js +0 -1
- package/.next/static/chunks/261-8a5ce39d74fc746e.js +0 -1
- package/.next/static/chunks/2884-b2944538a4a0d9b2.js +0 -1
- package/.next/static/chunks/3057-9eda004e07594513.js +0 -1
- package/.next/static/chunks/3455-c73ce4738620db20.js +0 -6
- package/.next/static/chunks/347-62c74776c299477d.js +0 -4
- package/.next/static/chunks/4052-9caaaa494d67a7e0.js +0 -1
- package/.next/static/chunks/4277-ba039fcf8f4e9cdc.js +0 -1
- package/.next/static/chunks/4427-302c5267a1f8493e.js +0 -1
- package/.next/static/chunks/4833-bf56f1203e2daffa.js +0 -28
- package/.next/static/chunks/5292-e65eab4f54b9f7ff.js +0 -16
- package/.next/static/chunks/5938-da5d441b981ec422.js +0 -1
- package/.next/static/chunks/6506-9d3cdc1ea816d7c4.js +0 -1
- package/.next/static/chunks/6578-6422ce4e29eb07d4.js +0 -1
- package/.next/static/chunks/6985-29200efa04920cb3.js +0 -4
- package/.next/static/chunks/7223-58376fd8a1d62df4.js +0 -1
- package/.next/static/chunks/7271-587c30b66ea4e619.js +0 -16
- package/.next/static/chunks/7576-b34ccf53f6efc388.js +0 -1
- package/.next/static/chunks/7889-8531b79751a71e39.js +0 -1
- package/.next/static/chunks/8326-b79c7555af5866e7.js +0 -8
- package/.next/static/chunks/861-dd60ef688592115e.js +0 -1
- package/.next/static/chunks/8676-5982391f15ea1190.js +0 -1
- package/.next/static/chunks/8732-69ffc27ed6c68f6f.js +0 -4
- package/.next/static/chunks/8932-e1bb3137986c259a.js +0 -1
- package/.next/static/chunks/9144-51689069a3d341e5.js +0 -1
- package/.next/static/chunks/9189-03f286defdb92816.js +0 -10
- package/.next/static/chunks/9773-53116cd0bf4b961a.js +0 -1
- package/.next/static/chunks/framework-fbc6f575b16f07d7.js +0 -1
- package/.next/static/chunks/main-105db6ecf7f64ff3.js +0 -1
- package/.next/static/chunks/pages/_app-03f3204a695aa8bc.js +0 -140
- package/.next/static/chunks/pages/_error-c01b6fb772028676.js +0 -1
- package/.next/static/chunks/pages/asset-library-634d18652eb7507d.js +0 -1
- package/.next/static/chunks/pages/context/short-term-3332ffb90b3b58a9.js +0 -1
- package/.next/static/chunks/pages/document-specs-565cf77237fce3d5.js +0 -1
- package/.next/static/chunks/pages/index-cc55686ed0309a22.js +0 -1
- package/.next/static/chunks/pages/knowledge/file-detail-f5e8f9bc35ebb92d.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-88aba3534bd722f9.js +0 -1
- package/.next/static/chunks/pages/knowledge/manage-5629ccce14402b99.js +0 -1
- package/.next/static/chunks/pages/knowledge/search-ad678d4bc8137cb5.js +0 -1
- package/.next/static/chunks/pages/knowledge-55e4c53985e79449.js +0 -1
- package/.next/static/chunks/pages/models-1788b9741155e3ce.js +0 -1
- package/.next/static/chunks/pages/prompt-0184d79af09db7e1.js +0 -1
- package/.next/static/chunks/pages/settings-fd31c9ef833cf0af.js +0 -1
- package/.next/static/chunks/pages/system/logs-8040fb1e0c814a0c.js +0 -1
- /package/.next/static/{IWuWLSb2ffDzvKo6MD3cy → 2m64hom9a1sJPcvcwOlZ5}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[731],{5122:(_,n,e)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_error",function(){return e(75599)}])}},_=>{_.O(0,[636,593,792],()=>_(_.s=5122)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[958],{63806:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>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(79059),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,[433,787,150,749,636,593,792],()=>e(e.s=85015)),_N_E=e.O()}]);
|
|
@@ -1 +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(
|
|
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(79059),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,[433,787,576,195,985,150,455,289,932,636,593,792],()=>e(e.s=36382)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[409],{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(79059),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,[433,787,576,195,985,150,455,289,932,636,593,792],()=>e(e.s=19164)),_N_E=e.O()}]);
|
|
@@ -1 +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()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[623],{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(30960),B=i(58209),H=i(54746),W=i(96651),N=i(60470),D=i(6578),E=i(79059);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,[433,787,576,195,455,698,636,593,792],()=>e(e.s=23507)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[580],{16734:(e,l,s)=>{"use strict";s.r(l),s.d(l,{default:()=>N});var a=s(65321),n=s(97109),t=s(11702),i=s(17807),r=s(63455),o=s(33442),c=s(57271),d=s(85114),m=s(85493),x=s(68787),u=s(58569),h=s(84253),p=s(38332),j=s(26171),A=s(34052),g=s(2256),y=s(7576),b=s(38770),v=s(44534),f=s(48318),I=s(25258),z=s(54746),S=s(96651),w=s(60470),k=s(99650),B=s(58209),C=s(6578),q=s(79059);let F=[{label:"文本",value:"text"},{label:"数字",value:"number"},{label:"日期",value:"date"},{label:"表格",value:"table"},{label:"列表",value:"list"}],_=[{label:"错误(阻断)",value:"error"},{label:"警告(提醒)",value:"warning"},{label:"信息(提示)",value:"info"}],R=[{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"}],T=[{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"}],H=e=>{let{label:l,closable:s,onClose:n}=e;return(0,a.jsx)(t.A,{closable:s,onClose:n,color:"blue",style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:l})};function N(){var e,l,s,N;let D=(0,q.Vr)(),{message:W}=i.A.useApp(),[V]=r.A.useForm(),[E]=r.A.useForm(),[P,L]=(0,n.useState)([]),[O,G]=(0,n.useState)([]),[K,X]=(0,n.useState)([]),[J,M]=(0,n.useState)(!1),[Q,U]=(0,n.useState)(!1),[Y,Z]=(0,n.useState)(null),[$,ee]=(0,n.useState)(!1),[el,es]=(0,n.useState)("custom"),[ea,en]=(0,n.useState)("specs"),et=async()=>{let[e,l]=await Promise.all([(0,C.mx)(),(0,C.lv)()]);L(e.specs),G(e.gateTypes),X(l.roles)};(0,n.useEffect)(()=>{et().catch(()=>W.error(D("common.error")))},[W,D]);let ei=K.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),er=K.filter(e=>"prompt"===e.type).map(e=>({label:e.name,value:e.id})),eo=P.filter(e=>!e.builtIn),ec=P.filter(e=>e.builtIn),ed="all"===el?P:"builtIn"===el?ec:eo,em=O.filter(e=>!e.builtIn),ex=O.filter(e=>e.builtIn),eu="all"===el?O:"builtIn"===el?ex:em,eh=[{label:"系统门禁类型",options:O.filter(e=>e.builtIn).map(e=>({label:e.name,value:e.id}))},{label:"我的门禁类型",options:O.filter(e=>!e.builtIn).map(e=>({label:e.name,value:e.id}))}],[ep,ej]=(0,n.useState)(0),[eA,eg]=(0,n.useState)(0),[ey,eb]=(0,n.useState)(0),ev=()=>{var e,l,s;ej((null!=(e=V.getFieldValue("factFields"))?e:[]).length),eg((null!=(l=V.getFieldValue("chapterRules"))?l:[]).length),eb((null!=(s=V.getFieldValue("gateRules"))?s:[]).length)},ef=(null!=(N=r.A.useWatch("factFields",V))?N:[]).filter(e=>e.id&&e.name).map(e=>({label:"".concat(e.name,"(").concat(e.id,")"),value:e.id})),eI=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)&&W.info("内置规范包不可直接编辑,已为你创建副本"),V.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:[]}),M(!0),window.setTimeout(()=>ev(),50)},ez=async()=>{try{let e=await V.validateFields(),l=await (0,C.EK)(e);L(l.specs),G(l.gateTypes),M(!1),W.success(D("common.success"))}catch(e){e instanceof Error&&W.error(e.message)}},eS=async e=>{let l=await (0,C.ER)(e);L(l.specs),G(l.gateTypes)},ew=e=>{var l;if(null==e?void 0:e.builtIn){E.setFieldsValue(e),Z(e.id),U(!0);return}Z(null!=(l=null==e?void 0:e.id)?l:null),E.setFieldsValue(null!=e?e:{id:"gate-type-".concat(Date.now()),name:"",defaultLevel:"error",evaluator:{subject:"document",operator:"contains"}}),U(!0)},ek=async()=>{try{var e;let l=await E.validateFields();if(null==(e=O.find(e=>e.id===l.id))?void 0:e.builtIn)return;let s=await (0,C.uD)(l);G(s.gateTypes),U(!1),Z(null),E.resetFields(),W.success(D("common.success"))}catch(e){e instanceof Error&&W.error(e.message)}},eB=async e=>{G((await (0,C.ug)(e)).gateTypes)};return(0,a.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle",children:D("specs.title")}),(0,a.jsx)("p",{className:"pageDesc",children:D("specs.description")})]}),(0,a.jsxs)(o.A,{wrap:!0,children:[(0,a.jsx)(c.A,{value:el,onChange:es,style:{width:160},options:[{label:"我的 (".concat(eo.length+em.length,")"),value:"custom"},{label:"内置示例 (".concat(ec.length+ex.length,")"),value:"builtIn"},{label:"全部来源 (".concat(P.length+O.length,")"),value:"all"}]}),"gateTypes"===ea&&(0,a.jsx)(d.Ay,{onClick:()=>ew(),children:"新建门禁类型"}),"specs"===ea&&(0,a.jsx)(d.Ay,{type:"primary",icon:(0,a.jsx)(z.A,{}),onClick:()=>eI(),children:D("specs.newSpec")})]})]}),(0,a.jsx)(m.A,{type:"info",showIcon:!0,message:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,a.jsx)("span",{children:D("specs.plainGuideTitle")}),(0,a.jsx)(d.Ay,{type:"link",size:"small",icon:$?(0,a.jsx)(S.A,{}):(0,a.jsx)(w.A,{}),onClick:()=>ee(!$),style:{padding:"0 4px"},children:$?"收起说明":"展开说明"})]}),description:$?D("specs.plainGuideDesc"):void 0}),(0,a.jsx)(x.A,{size:"small",children:(0,a.jsx)(u.A,{activeKey:ea,onChange:e=>en(e),items:[{key:"specs",label:"规范包列表 (".concat(ed.length,")"),children:0===ed.length?(0,a.jsx)(h.A,{description:D("common.noData")}):(0,a.jsx)(p.A,{dataSource:ed,renderItem:(e,l)=>(0,a.jsx)(p.A.Item,{style:{padding:"10px 0"},actions:[(0,a.jsx)(d.Ay,{size:"small",icon:(0,a.jsx)(k.A,{}),onClick:()=>eI(e),children:e.builtIn?"复制":"编辑"},"edit"),(0,a.jsx)(j.A,{title:D("common.confirm"),disabled:e.builtIn,onConfirm:()=>{eS(e.id)},children:(0,a.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,a.jsx)(B.A,{}),disabled:e.builtIn})},"del")],children:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[(0,a.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,a.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,a.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),e.builtIn?(0,a.jsx)(t.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"内置示例"}):(0,a.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"我的规范包"})]}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.description&&(0,a.jsx)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:e.description}),(0,a.jsxs)(o.A,{size:4,children:[(0,a.jsxs)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:["事实 ",e.factFields.length]}),(0,a.jsxs)(t.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:["章节 ",e.chapterRules.length]}),(0,a.jsxs)(t.A,{color:"orange",style:{margin:0,fontSize:10,lineHeight:"16px"},children:["门禁 ",e.gateRules.length]})]})]})]})]})})})},{key:"gateTypes",label:"门禁类型列表 (".concat(eu.length,")"),children:0===eu.length?(0,a.jsx)(h.A,{description:D("common.noData")}):(0,a.jsx)(p.A,{dataSource:eu,renderItem:(e,l)=>{var s,n;return(0,a.jsx)(p.A.Item,{style:{padding:"10px 0"},actions:[(0,a.jsx)(d.Ay,{size:"small",icon:(0,a.jsx)(k.A,{}),onClick:()=>ew(e),children:e.builtIn?"查看":"编辑"},"edit"),(0,a.jsx)(j.A,{title:D("common.confirm"),disabled:e.builtIn,onConfirm:()=>{eB(e.id)},children:(0,a.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,a.jsx)(B.A,{}),disabled:e.builtIn})},"del")],children:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[(0,a.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,a.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,a.jsx)("span",{style:{fontWeight:600},children:e.name}),e.builtIn?(0,a.jsx)(t.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"系统门禁"}):(0,a.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的门禁"})]}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.description&&(0,a.jsx)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:e.description}),(0,a.jsxs)(o.A,{size:4,children:[(0,a.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:null==(s=R.find(l=>l.value===e.evaluator.subject))?void 0:s.label}),(0,a.jsx)(t.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:null==(n=T.find(l=>l.value===e.evaluator.operator))?void 0:n.label})]})]})]})]})})}})}]})}),(0,a.jsx)(A.A,{title:D("specs.editor"),open:J,onClose:()=>M(!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,a.jsx)(d.Ay,{type:"primary",onClick:()=>{ez()},children:D("common.save")}),children:(0,a.jsxs)(r.A,{form:V,layout:"vertical",onValuesChange:()=>ev(),children:[(0,a.jsxs)(g.A,{gutter:12,children:[(0,a.jsx)(r.A.Item,{name:"id",hidden:!0,children:(0,a.jsx)(y.A,{})}),(0,a.jsx)(b.A,{xs:24,md:12,children:(0,a.jsx)(r.A.Item,{name:"name",label:D("specs.name"),rules:[{required:!0}],children:(0,a.jsx)(y.A,{})})}),(0,a.jsx)(b.A,{xs:24,md:12,children:(0,a.jsx)(r.A.Item,{name:"description",label:D("specs.specDescription"),children:(0,a.jsx)(y.A,{})})})]}),(0,a.jsx)(u.A,{destroyInactiveTabPane:!1,items:[{key:"facts",label:"".concat(D("specs.facts")," (").concat(ep,")"),children:(0,a.jsx)(r.A.List,{name:"factFields",children:(e,l)=>{let{add:s,remove:n}=l;return(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.map((e,l)=>(0,a.jsxs)(x.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,a.jsx)(d.Ay,{danger:!0,size:"small",icon:(0,a.jsx)(B.A,{}),onClick:()=>n(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,a.jsx)(r.A.Item,{name:[e.name,"id"],hidden:!0,children:(0,a.jsx)(y.A,{})}),(0,a.jsxs)(g.A,{gutter:[14,8],children:[(0,a.jsx)(b.A,{xs:24,sm:7,children:(0,a.jsx)(r.A.Item,{name:[e.name,"name"],label:D("specs.factName"),rules:[{required:!0}],style:{marginBottom:0},children:(0,a.jsx)(y.A,{size:"small"})})}),(0,a.jsx)(b.A,{xs:12,sm:5,children:(0,a.jsx)(r.A.Item,{name:[e.name,"type"],label:D("specs.factType"),style:{marginBottom:0},children:(0,a.jsx)(c.A,{options:F,size:"small"})})}),(0,a.jsx)(b.A,{xs:12,sm:4,children:(0,a.jsx)(r.A.Item,{name:[e.name,"required"],label:D("specs.required"),valuePropName:"checked",style:{marginBottom:0},children:(0,a.jsx)(v.A,{})})}),(0,a.jsx)(b.A,{xs:24,sm:8,children:(0,a.jsx)(r.A.Item,{name:[e.name,"sourceRoleIds"],label:D("specs.sourceRoles"),style:{marginBottom:0},children:(0,a.jsx)(c.A,{mode:"multiple",showSearch:!0,options:ei,tagRender:H,placeholder:"选择文件角色",size:"small"})})}),(0,a.jsx)(b.A,{xs:24,sm:12,children:(0,a.jsx)(r.A.Item,{name:[e.name,"extractionHint"],label:D("specs.extractionHint"),style:{marginBottom:0},children:(0,a.jsx)(y.A,{size:"small"})})}),(0,a.jsx)(b.A,{xs:24,sm:12,children:(0,a.jsx)(r.A.Item,{name:[e.name,"validationHint"],label:D("specs.validationHint"),style:{marginBottom:0},children:(0,a.jsx)(y.A,{size:"small"})})})]})]},e.key)),(0,a.jsx)(d.Ay,{icon:(0,a.jsx)(z.A,{}),onClick:()=>s({id:"fact-".concat(Date.now()),type:"text",required:!0}),children:D("specs.addFact")})]})}})},{key:"chapters",label:"".concat(D("specs.chapters")," (").concat(eA,")"),children:(0,a.jsx)(r.A.List,{name:"chapterRules",children:(e,l)=>{let{add:s,remove:n}=l;return(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.map((e,l)=>(0,a.jsxs)(x.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,a.jsx)(d.Ay,{danger:!0,size:"small",icon:(0,a.jsx)(B.A,{}),onClick:()=>n(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,a.jsx)(r.A.Item,{name:[e.name,"id"],hidden:!0,children:(0,a.jsx)(y.A,{})}),(0,a.jsxs)(g.A,{gutter:[14,8],children:[(0,a.jsx)(b.A,{xs:24,sm:7,children:(0,a.jsx)(r.A.Item,{name:[e.name,"title"],label:D("specs.chapterTitle"),rules:[{required:!0}],style:{marginBottom:0},children:(0,a.jsx)(y.A,{size:"small"})})}),(0,a.jsx)(b.A,{xs:8,sm:3,children:(0,a.jsx)(r.A.Item,{name:[e.name,"order"],label:D("specs.order"),initialValue:l,style:{marginBottom:0},children:(0,a.jsx)(f.A,{size:"small",style:{width:"100%"}})})}),(0,a.jsx)(b.A,{xs:8,sm:3,children:(0,a.jsx)(r.A.Item,{name:[e.name,"minWords"],label:D("specs.minWords"),style:{marginBottom:0},children:(0,a.jsx)(f.A,{size:"small",style:{width:"100%"}})})}),(0,a.jsx)(b.A,{xs:8,sm:3,children:(0,a.jsx)(r.A.Item,{name:[e.name,"required"],label:D("specs.required"),valuePropName:"checked",style:{marginBottom:0},children:(0,a.jsx)(v.A,{})})}),(0,a.jsx)(b.A,{xs:24,sm:8,children:(0,a.jsx)(r.A.Item,{name:[e.name,"requiredFactIds"],label:D("specs.requiredFacts"),style:{marginBottom:0},children:(0,a.jsx)(c.A,{mode:"multiple",showSearch:!0,optionFilterProp:"label",placeholder:"选择事实字段",options:ef,tagRender:H,size:"small"})})}),(0,a.jsx)(b.A,{xs:24,sm:12,children:(0,a.jsx)(r.A.Item,{name:[e.name,"requiredFileRoleIds"],label:D("specs.requiredFileRoles"),style:{marginBottom:0},children:(0,a.jsx)(c.A,{mode:"multiple",showSearch:!0,options:ei,tagRender:H,placeholder:"选择文件角色",size:"small"})})}),(0,a.jsx)(b.A,{xs:24,sm:12,children:(0,a.jsx)(r.A.Item,{name:[e.name,"requiredPromptRoleIds"],label:D("specs.requiredPromptRoles"),style:{marginBottom:0},children:(0,a.jsx)(c.A,{mode:"multiple",showSearch:!0,options:er,tagRender:H,placeholder:"选择提示词角色",size:"small"})})}),(0,a.jsx)(b.A,{xs:24,children:(0,a.jsx)(r.A.Item,{name:[e.name,"generationHint"],label:D("specs.generationHint"),style:{marginBottom:0},children:(0,a.jsx)(y.A,{size:"small"})})})]})]},e.key)),(0,a.jsx)(d.Ay,{icon:(0,a.jsx)(z.A,{}),onClick:()=>s({id:"chapter-".concat(Date.now()),order:e.length,required:!0}),children:D("specs.addChapter")})]})}})},{key:"gates",label:"".concat(D("specs.gates")," (").concat(ey,")"),children:(0,a.jsx)(r.A.List,{name:"gateRules",children:(e,l)=>{let{add:s,remove:n}=l;return(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.map((e,l)=>(0,a.jsxs)(x.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,a.jsx)(d.Ay,{danger:!0,size:"small",icon:(0,a.jsx)(B.A,{}),onClick:()=>n(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,a.jsx)(r.A.Item,{name:[e.name,"id"],hidden:!0,children:(0,a.jsx)(y.A,{})}),(0,a.jsxs)(g.A,{gutter:[12,8],align:"middle",children:[(0,a.jsx)(b.A,{xs:24,sm:6,children:(0,a.jsx)(r.A.Item,{name:[e.name,"name"],label:"名称",rules:[{required:!0}],style:{marginBottom:0},children:(0,a.jsx)(y.A,{placeholder:D("specs.gateName"),size:"small"})})}),(0,a.jsx)(b.A,{xs:12,sm:6,children:(0,a.jsx)(r.A.Item,{name:[e.name,"type"],label:"类型",rules:[{required:!0}],style:{marginBottom:0},children:(0,a.jsx)(c.A,{options:eh,size:"small",onChange:e=>((e,l)=>{var s,a,n,t,i;let r=O.find(e=>e.id===l);if(!r)return;let o=[...null!=(i=V.getFieldValue("gateRules"))?i:[]];o[e]={...o[e],type:r.id,level:(null==(s=o[e])?void 0:s.level)||r.defaultLevel,name:(null==(a=o[e])?void 0:a.name)||r.name,evaluator:{...r.evaluator},target:(null==(n=o[e])?void 0:n.target)||r.evaluator.target||"",value:(null==(t=o[e])?void 0:t.value)||r.evaluator.value||""},V.setFieldValue("gateRules",o)})(l,e)})})}),(0,a.jsx)(b.A,{xs:12,sm:3,children:(0,a.jsx)(r.A.Item,{name:[e.name,"level"],label:"级别",style:{marginBottom:0},children:(0,a.jsx)(c.A,{options:_,size:"small"})})}),(0,a.jsx)(b.A,{xs:12,sm:4,children:(0,a.jsx)(r.A.Item,{name:[e.name,"target"],label:"目标",style:{marginBottom:0},children:(0,a.jsx)(y.A,{placeholder:"章节/事实/角色",size:"small"})})}),(0,a.jsx)(b.A,{xs:12,sm:5,children:(0,a.jsx)(r.A.Item,{name:[e.name,"value"],label:"值",style:{marginBottom:0},children:(0,a.jsx)(y.A,{placeholder:"关键词/正则/数值",size:"small"})})}),(0,a.jsx)(b.A,{xs:12,sm:5,children:(0,a.jsx)(r.A.Item,{name:[e.name,"evaluator","subject"],label:"校验对象",rules:[{required:!0}],style:{marginBottom:0},children:(0,a.jsx)(c.A,{options:R,size:"small"})})}),(0,a.jsx)(b.A,{xs:12,sm:6,children:(0,a.jsx)(r.A.Item,{name:[e.name,"evaluator","operator"],label:"校验方式",rules:[{required:!0}],style:{marginBottom:0},children:(0,a.jsx)(c.A,{options:T,size:"small"})})}),(0,a.jsx)(b.A,{xs:12,sm:5,children:(0,a.jsx)(r.A.Item,{name:[e.name,"evaluator","target"],label:"执行目标",style:{marginBottom:0},children:(0,a.jsx)(y.A,{placeholder:"默认取目标",size:"small"})})}),(0,a.jsx)(b.A,{xs:12,sm:5,children:(0,a.jsx)(r.A.Item,{name:[e.name,"evaluator","value"],label:"执行值",style:{marginBottom:0},children:(0,a.jsx)(y.A,{placeholder:"默认取值",size:"small"})})}),(0,a.jsx)(b.A,{xs:12,sm:3,children:(0,a.jsx)(r.A.Item,{name:[e.name,"evaluator","min"],label:"N",style:{marginBottom:0},children:(0,a.jsx)(f.A,{min:1,size:"small",style:{width:"100%"}})})})]})]},e.key)),(0,a.jsx)(d.Ay,{icon:(0,a.jsx)(z.A,{}),onClick:()=>s({id:"gate-".concat(Date.now()),type:"required_fact",level:"error",evaluator:{subject:"fact",operator:"exists"}}),children:D("specs.addGate")})]})}})}]})]})}),(0,a.jsx)(I.A,{title:(null==(e=O.find(e=>e.id===Y))?void 0:e.builtIn)?"查看系统门禁类型":Y?"编辑门禁类型":"新建门禁类型",open:Q,onOk:()=>{ek()},onCancel:()=>{U(!1),Z(null)},okText:D("common.save"),cancelText:D("common.cancel"),okButtonProps:{disabled:!!(null==(l=O.find(e=>e.id===Y))?void 0:l.builtIn)},children:(0,a.jsx)(r.A,{form:E,layout:"vertical",disabled:!!(null==(s=O.find(e=>e.id===Y))?void 0:s.builtIn),children:(0,a.jsxs)(g.A,{gutter:12,children:[(0,a.jsx)(r.A.Item,{name:"id",hidden:!0,children:(0,a.jsx)(y.A,{})}),(0,a.jsx)(b.A,{span:12,children:(0,a.jsx)(r.A.Item,{name:"name",label:"类型名称",rules:[{required:!0}],children:(0,a.jsx)(y.A,{placeholder:"必须包含风险提示"})})}),(0,a.jsx)(b.A,{span:12,children:(0,a.jsx)(r.A.Item,{name:"description",label:"说明",children:(0,a.jsx)(y.A,{placeholder:"告诉用户这类门禁检查什么"})})}),(0,a.jsx)(b.A,{span:12,children:(0,a.jsx)(r.A.Item,{name:"defaultLevel",label:"默认级别",rules:[{required:!0}],children:(0,a.jsx)(c.A,{options:_})})}),(0,a.jsx)(b.A,{span:12,children:(0,a.jsx)(r.A.Item,{name:["evaluator","subject"],label:"校验对象",rules:[{required:!0}],children:(0,a.jsx)(c.A,{options:R})})}),(0,a.jsx)(b.A,{span:12,children:(0,a.jsx)(r.A.Item,{name:["evaluator","operator"],label:"校验方式",rules:[{required:!0}],children:(0,a.jsx)(c.A,{options:T})})}),(0,a.jsx)(b.A,{span:12,children:(0,a.jsx)(r.A.Item,{name:["evaluator","target"],label:"默认目标",children:(0,a.jsx)(y.A,{placeholder:"章节/事实/角色,可为空"})})}),(0,a.jsx)(b.A,{span:12,children:(0,a.jsx)(r.A.Item,{name:["evaluator","value"],label:"默认值",children:(0,a.jsx)(y.A,{placeholder:"关键词/正则,可为空"})})}),(0,a.jsx)(b.A,{span:12,children:(0,a.jsx)(r.A.Item,{name:["evaluator","min"],label:"默认 N",children:(0,a.jsx)(f.A,{min:1,style:{width:"100%"}})})})]})})})]})}},94773:(e,l,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-specs",function(){return s(16734)}])}},e=>{e.O(0,[433,787,576,195,455,938,265,636,593,792],()=>e(e.s=94773)),_N_E=e.O()}]);
|
package/.next/static/chunks/pages/{documents-471786ecea050f17.js → documents-a21e4c98480b1a95.js}
RENAMED
|
@@ -1 +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 n=s(65321),r=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),C=s(16285),_=s(26619),z=s(8263),D=s(8579),F=s(75548),M=s(7851),E=s(84742),B=s(29071),L=s(63552),P=s(26631),R=s(76830),q=s(83914),W=s(58209),G=s(54746),O=s(71330),H=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,n.jsx)(T.A,{}),context_recall:(0,n.jsx)(C.A,{}),knowledge_retrieval:(0,n.jsx)(_.A,{}),file_understanding:(0,n.jsx)(z.A,{}),fact_extraction:(0,n.jsx)(C.A,{}),chapter_generation:(0,n.jsx)(D.A,{}),asset_generation:(0,n.jsx)(F.A,{}),validation:(0,n.jsx)(M.A,{}),formatting:(0,n.jsx)(E.A,{}),llm_review:(0,n.jsx)(B.A,{}),export_ready:(0,n.jsx)(L.A,{}),reference:(0,n.jsx)(F.A,{})},en={施工组织设计:(0,n.jsx)(M.A,{}),投标文件:(0,n.jsx)(L.A,{}),技术方案:(0,n.jsx)(C.A,{}),报告:(0,n.jsx)(P.A,{}),自定义:(0,n.jsx)(D.A,{})},er={role_binding:"角色配置绑定",context_recall:"上下文召回",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,r.useRef)(null),[Z,ei]=(0,r.useState)([]),[el,ea]=(0,r.useState)("construction-organization-design"),[eo,ec]=(0,r.useState)([]),[ed,eu]=(0,r.useState)([]),[ep,em]=(0,r.useState)([]),[eh,ex]=(0,r.useState)(!0),[eg,ef]=(0,r.useState)(!1),[ev,ew]=(0,r.useState)(null),[ej,ey]=(0,r.useState)(""),[eA,ek]=(0,r.useState)([]),[eS,eI]=(0,r.useState)(null),[eb,eT]=(0,r.useState)(null),[eC,e_]=(0,r.useState)(null),[ez,eD]=(0,r.useState)(!1),[eF,eM]=(0,r.useState)({}),[eE,eB]=(0,r.useState)([]),[eL,eP]=(0,r.useState)(null),[eR,eq]=(0,r.useState)("templates"),[eW,eG]=(0,r.useState)(!1),[eO,eH]=(0,r.useState)("workflow"),eN=(0,r.useRef)(null),eK=async()=>{try{ek((await (0,Q.cQ)()).documents)}catch(e){ek([])}};(0,r.useEffect)(()=>{let e=()=>{ee&&(eB(ee.flowSteps),eP(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,r.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,r.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,r.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,eE.findIndex(e=>e.key===eL)),eJ=e=>{ea(e),eI(null),ew(null),ey(""),eH("workflow"),eG(!0),eq("drafts")},eY=async s=>{eI(s.id),ea(s.templateId);let n=e0(s.status);if(n||"failed"===s.status){ti.current=!0,ew(null),ey(""),ef(n),eH("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}eH("editor"),eB([]),eP(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)),r=ed.find(e=>e.id===(null==t?void 0:t.projectRoleConfigId)),i=((null==r?void 0:r.fileRoles)||[]).map(e=>{var t;return(null==(t=eo.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),l=((null==r?void 0:r.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,n.jsx)(P.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,n.jsx)(T.A,{}),subSteps:eZ([...i.length?i.map(e=>"文件角色:".concat(e)):["没有文件角色,使用模板绑定文件"],...l.length?l.map(e=>"提示词角色:".concat(e)):["没有提示词角色,使用默认生成策略"]].slice(0,10))},{key:"context_recall",title:"短期/长期上下文召回",description:"从项目记忆中召回用户偏好、历史纠偏和已生成文档摘要,并注入生成提示词",status:"wait",icon:(0,n.jsx)(C.A,{}),subSteps:eZ(["召回相关项目记忆","注入章节生成提示词","生成完成后沉淀新记忆"])},{key:"knowledge_retrieval",title:"知识库证据检索",description:"按 ".concat(o.length," 个章节检索文本、文档、表格、图片、图纸和附件"),status:"wait",icon:(0,n.jsx)(_.A,{}),subSteps:eZ(o.length?o.slice(0,10).map(e=>"检索章节:".concat(e)):["按模板标题检索证据"])},{key:"file_understanding",title:"多类型文件理解",description:"按文件角色处理文本、PDF/Word、表格、图片、图纸和附件",status:"wait",icon:(0,n.jsx)(z.A,{}),subSteps:eZ(["识别文件类型和角色","构建结构化资源证据包","必要时调用多模态文件理解"])},{key:"fact_extraction",title:"动态 schema 事实抽取",description:"按 ".concat(a.length," 个规范/章节事实字段抽取并检测冲突"),status:"wait",icon:(0,n.jsx)(C.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,n.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,n.jsx)(F.A,{}),subSteps:eZ(["生成资源提示词","保存到 generatedDocuments/assets","登记资源元数据"])}]:[],{key:"validation",title:"规范包与门禁校验",description:s?"执行 ".concat(s.gateRules.length," 条门禁规则"):"执行模板基础校验",status:"wait",icon:(0,n.jsx)(M.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,n.jsx)(E.A,{}),subSteps:eZ(["整理标题层级","整理多类型资源引用","生成正式 Markdown"])},{key:"llm_review",title:"LLM 审查优化",description:"再次使用动态 schema、角色和结构化证据审查优化初稿",status:"wait",icon:(0,n.jsx)(B.A,{}),subSteps:eZ(["构造审查提示词","检查事实来源和冲突","回填优化后的 Markdown"])},{key:"export_ready",title:"导出就绪",description:"确认 Markdown/HTML/DOCX/PDF 可导出",status:"wait",icon:(0,n.jsx)(L.A,{}),subSteps:eZ(["生成导出检查清单","确认阻断项","准备导出格式"])},{key:"done",title:e("documents.flowDone"),description:e("documents.flowDoneDesc"),status:"wait",icon:(0,n.jsx)(R.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,n;let r,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 n=a.get(t.key);if(!n)return t;let r="failed"===(s=n.status)?"error":"fallback"===s?"warning":"finish";return{...t,status:r,description:n.message||t.description,subSteps:e2(t,r)}});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(r=(null==t?void 0:t.key)||"prepare",o))e.key===r&&"wait"===e.status&&(e.status="process",e.subSteps=e2(e,"process"))}else r="failed"===e.status?(null==(s=o.find(e=>"error"===e.status))?void 0:s.key)||(null==(n=l.at(-1))?void 0:n.type)||"prepare":"done";return{steps:o,activeKey:r}})(e);eB(t),eP(s),ef(e0(e.status)),"failed"===e.status&&eH("workflow"),("completed"===e.status||"warning"===e.status)&&e.draft&&(ew(e.draft),ey(e.editedMarkdown||e.markdown),eH("editor"),eB([]),eP(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)=>{eP(e),eB(n=>{let r=n.map(n=>n.key===e?{...n,status:t,description:s||n.description,subSteps:e2(n,t)}:n);return e1(r,e),r})};(0,r.useEffect)(()=>{if(!eg||!eL)return;let e=window.setInterval(()=>eB(e=>{let t=e.map(e=>{if(e.key!==eL||"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,eL),t}),1400);return()=>window.clearInterval(e)},[eL,eg]);let e3=e=>{eB(t=>{let s=t.findIndex(t=>t.key===e),n=t.map((e,t)=>t<s&&"error"!==e.status?{...e,status:"finish",subSteps:e2(e,"finish")}:e);return e1(n,e),n})},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"),pinnedEvidenceText:(e.pinnedEvidenceFilePaths||[]).join("\n")}))}),eD(!0)},e4=async()=>{try{let n=await s.validateFields(),r={...n,chapters:(n.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),pinnedEvidenceFilePaths:String(e.pinnedEvidenceText||"").split(/\r?\n/u).map(e=>e.trim()).filter(Boolean),queriesText:void 0,requiredFactsText:void 0,pinnedEvidenceText:void 0}))},i=await (0,Q.l2)(r);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 n=await (0,Q.bV)(s);ei(n.templates),ea(n.template.id),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}},te=async s=>{try{var n,r;let i=await (0,Q.h0)(s);ei(i.templates),ea(null!=(r=null==(n=i.templates[0])?void 0:n.id)?r:""),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}},tt=async e=>{try{let{validation:s}=await (0,Q.SM)(e);eM(t=>({...t,[e]:s}));let n=s.issues.filter(e=>"error"===e.level);if(ea(e),n.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"))}},tn=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 n;let{document:r}=await (0,Q.v7)(e);if(e6(r),("completed"===r.status||"warning"===r.status)&&r.draft)return r;if("failed"===r.status)throw Error(r.error||"生成失败");if(0===(r.executionStages||(null==(n=r.draft)?void 0:n.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))}},tr=async()=>{if(!el)return;if(null==ee?void 0:ee.loading){eB(ee.flowSteps),eP(ee.activeFlowKey),ef(!0);return}ef(!0);let s=e$(Z.find(e=>e.id===el)||eU),n=(0,Q.OX)({templateId:el});ee={id:Date.now(),templateId:el,loading:!0,flowSteps:s,activeFlowKey:"prepare",promise:n,listeners:new Set},eB(s),eP("prepare");let r=[{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 n;s.documentId&&(localStorage.setItem("activeGenDocId",s.documentId),eI(s.documentId),(null==ee?void 0:ee.promise)===n&&(ee.documentId=s.documentId)),await eK();let i=s.documentId?await tn(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),r.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)===n&&(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 n;let s=a.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!a.exportGate.passed,r=s?"warning":"finish",i=null==(n=a.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message;return{...t,status:r,description:s?"生成完成,但需复核:".concat(i||e("documents.flowGateFailed")):e("documents.flowDoneDesc"),subSteps:e2(t,r)}}if(!s)return"process"===t.status?{...t,status:"finish",subSteps:e2(t,"finish")}:t;let r="failed"===s.status?"error":"finish";return{...t,status:r,description:"".concat(s.status.toUpperCase(),":").concat(s.message||t.description),subSteps:e2(t,r)}});return e1(s,"done",!1),s}),eP("done"),(null==ee?void 0:ee.promise)===n&&(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(r){localStorage.removeItem("activeGenDocId");let s=r instanceof Error?r.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,eL,!1),t}),(null==ee?void 0:ee.promise)===n&&(ee.loading=!1,ee.error=s,et()),t.error(s)}finally{r.forEach(e=>window.clearTimeout(e)),ef(!1),(null==ee?void 0:ee.promise)===n&&(ee.loading=!1,et())}},ti=(0,r.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,r.useEffect)(()=>{eW&&"workflow"===eO&&!ti.current&&!(null==ee?void 0:ee.loading)&&(null==eU?void 0:eU.projectRoleConfigId)&&(ti.current=!0,window.setTimeout(()=>{tr()},300)),eW||(ti.current=!1)},[eW,eO]);let ta=async s=>{if(ev){eT(s);try{var n;let e="markdown"===s?"md":s,t=null==(n=ep.find(e=>e.id===(null==eU?void 0:eU.documentSpecId)))?void 0:n.wordTemplatePath,r=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 n=new Blob([e],{type:s}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,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(r),1e3)})(r,"".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(null)}}},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){e_(s.id);try{var n,r;let i=await (0,Q.R1)({templateId:ev.templateId,chapterId:s.id,documentId:eS||void 0,currentMarkdown:ej,existingFacts:null==(n=ev.structuredFacts)?void 0:n.map(e=>e.value)});ew({...ev,chapters:ev.chapters.map(e=>e.id===s.id?i.chapter:e)}),r=i.chapter,ey(e=>e.includes(s.content)?e.replace(s.content,r.content):"".concat(e,"\n\n").concat(r.content)),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}finally{e_(null)}}};if(eh)return(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(c.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,n.jsx)(c.A,{active:!0,paragraph:{rows:2}}),(0,n.jsx)(c.A,{active:!0,paragraph:{rows:8}})]});let td="workflow"===eO?"工作流:".concat((null==eU?void 0:eU.name)||"选择模板"):"编辑:".concat((null==ev?void 0:ev.title)||(null==eU?void 0:eU.outputTitle)||"文档");return(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("documents.title")}),(0,n.jsx)("p",{className:"pageDesc",children:e("documents.description")})]}),(0,n.jsx)(d.Ay,{type:"primary",icon:(0,n.jsx)(G.A,{}),onClick:()=>e5(),children:e("documents.newTemplate")})]}),(0,n.jsx)(u.A,{size:"small",tabList:[{key:"templates",label:"模板库 (".concat(Z.length,")")},{key:"drafts",label:"生成记录 (".concat(eA.length,")")}],activeTabKey:eR,onTabChange:eq,children:"templates"===eR?0===Z.length?(0,n.jsx)(p.A,{description:e("common.noData")}):(0,n.jsx)(m.A,{dataSource:Z,renderItem:(t,s)=>(0,n.jsx)(m.A.Item,{style:{cursor:"pointer",padding:"10px 0"},actions:[(0,n.jsx)(d.Ay,{size:"small",icon:(0,n.jsx)(O.A,{}),onClick:e=>{e.stopPropagation(),e5(t)},children:"配置"},"cfg"),(0,n.jsx)(d.Ay,{size:"small",type:"primary",icon:(0,n.jsx)(H.A,{}),onClick:e=>{e.stopPropagation(),tt(t.id)},children:"运行"},"run"),(0,n.jsx)(d.Ay,{size:"small",icon:(0,n.jsx)(N.A,{}),onClick:e=>{e.stopPropagation(),e9(t.id)}},"copy"),(0,n.jsx)(h.A,{title:e("documents.deleteTemplateConfirm"),disabled:t.builtIn,onConfirm:e=>{null==e||e.stopPropagation(),te(t.id)},children:(0,n.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,n.jsx)(W.A,{}),disabled:t.builtIn,onClick:e=>e.stopPropagation()})},"del")],onClick:()=>ea(t.id),children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[function(e,t){let s=en[e]||(0,n.jsx)(P.A,{});return(0,n.jsx)("span",{style:{color:t?"var(--colorAccent)":"var(--colorTextSecondary)",fontSize:16,marginTop:2,flexShrink:0},children:s})}(t.category,el===t.id),(0,n.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,n.jsx)("span",{style:{fontWeight:el===t.id?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),t.builtIn&&(0,n.jsx)(x.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"内置"}),el===t.id&&(0,n.jsx)(x.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"当前"}),(0,n.jsx)(x.A,{style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:t.category}),eF[t.id]&&(0,n.jsxs)(x.A,{color:eF[t.id].issues.some(e=>"error"===e.level)?"error":eF[t.id].issues.length?"warning":"success",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:["检查 ",eF[t.id].fileDiagnostics.length," 文件 / ",eF[t.id].promptDiagnostics.length," 提示词"]})]}),t.description&&(0,n.jsx)($,{type:"secondary",style:{fontSize:12,lineHeight:"18px"},children:t.description}),eF[t.id]&&(0,n.jsx)("div",{onClick:e=>e.stopPropagation(),style:{marginTop:8,padding:10,border:"1px solid ".concat(eF[t.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBorder)":eF[t.id].issues.length?"var(--colorWarningBorder)":"var(--colorSuccessBorder)"),borderRadius:10,background:eF[t.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBg)":eF[t.id].issues.length?"var(--colorWarningBg)":"var(--colorSuccessBg)"},children:(0,n.jsxs)(g.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,n.jsxs)(g.A,{wrap:!0,children:[(0,n.jsx)($,{strong:!0,children:eF[t.id].issues.some(e=>"error"===e.level)?"运行前检查未通过":eF[t.id].issues.length?"运行前检查存在警告":"运行前检查通过"}),(0,n.jsxs)(x.A,{color:"blue",children:["文件角色 ",eF[t.id].fileDiagnostics.length]}),(0,n.jsxs)(x.A,{color:"purple",children:["提示词角色 ",eF[t.id].promptDiagnostics.length]}),eF[t.id].spec&&(0,n.jsxs)(x.A,{color:"cyan",children:["规范包 ",eF[t.id].spec.name]})]}),eF[t.id].issues.length>0?eF[t.id].issues.map(e=>(0,n.jsx)(f.A,{type:"error"===e.level?"error":"warning",message:e.message,showIcon:!0},e.message)):(0,n.jsx)(f.A,{type:"success",message:"文件角色、提示词角色和规范包检查通过,可以运行。",showIcon:!0}),!eF[t.id].issues.some(e=>"error"===e.level)&&eF[t.id].issues.length>0&&(0,n.jsx)("div",{children:(0,n.jsx)(d.Ay,{size:"small",type:"primary",icon:(0,n.jsx)(H.A,{}),onClick:()=>eJ(t.id),children:"忽略警告并继续运行"})})]})})]})]})})}):0===eA.length?(0,n.jsx)(p.A,{description:e("common.noData")}):(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:eA.slice(0,15).map((e,t)=>{var s,r,i;let l,a;return(0,n.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,n.jsx)(E.A,{style:{fontSize:18,color:"var(--colorOk)",flexShrink:0,marginTop:2}}):"failed"===e.status?(0,n.jsx)(K.A,{style:{fontSize:18,color:"var(--colorDanger)",flexShrink:0,marginTop:2}}):"warning"===e.status?(0,n.jsx)(M.A,{style:{fontSize:18,color:"var(--colorWarning)",flexShrink:0,marginTop:2}}):(0,n.jsx)(U.A,{spin:!0,style:{fontSize:18,color:"#1677ff",flexShrink:0,marginTop:2}}),(0,n.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,n.jsx)("div",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:3},children:e.title}),(0,n.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px 10px",color:"var(--colorTextSecondary)",fontSize:11},children:[(0,n.jsx)("span",{children:new Date(e.updatedAt).toLocaleString()}),(0,n.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),n=t%60;if(s<60)return n?"".concat(s," 分 ").concat(n," 秒"):"".concat(s," 分");let r=Math.floor(s/60),i=s%60;return i?"".concat(r," 小时 ").concat(i," 分"):"".concat(r," 小时")})(e)]})]}),("warning"===e.status||"failed"===e.status)&&(0,n.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==(r=i.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:r.message)||"需复核"})]}),(0,n.jsxs)(g.A,{size:4,align:"center",children:[(0,n.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,n.jsxs)(x.A,{style:{margin:0,fontSize:10,lineHeight:"18px"},children:["#",t+1]}),(0,n.jsx)(h.A,{title:"确认删除?",onConfirm:t=>{null==t||t.stopPropagation(),ts(e.id)},children:(0,n.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,n.jsx)(W.A,{}),onClick:e=>e.stopPropagation()})}),e0(e.status)&&(0,n.jsx)(h.A,{title:"确定中止此生成任务?",onConfirm:t=>{null==t||t.stopPropagation(),tl(e)},children:(0,n.jsx)(d.Ay,{size:"small",danger:!0,onClick:e=>e.stopPropagation(),children:"中止"})}),(0,n.jsx)(d.Ay,{size:"small",type:"primary",icon:e0(e.status)?(0,n.jsx)(U.A,{spin:!0}):(0,n.jsx)(H.A,{}),onClick:t=>{t.stopPropagation(),eY(e)},children:"打开"})]})]},e.id)})})}),(0,n.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,n.jsxs)(g.A,{wrap:!0,children:[(0,n.jsx)(d.Ay,{icon:(0,n.jsx)(X.A,{}),onClick:()=>{to()},children:e("documents.saveDraft")}),(0,n.jsx)(d.Ay,{icon:(0,n.jsx)(R.A,{}),loading:"markdown"===eb,onClick:()=>{ta("markdown")},children:"MD"}),(0,n.jsx)(d.Ay,{loading:"html"===eb,onClick:()=>{ta("html")},children:"HTML"}),(0,n.jsx)(d.Ay,{loading:"docx"===eb,onClick:()=>{ta("docx")},children:"DOCX"}),(0,n.jsx)(d.Ay,{type:"primary",loading:"pdf"===eb,onClick:()=>{ta("pdf")},children:"PDF"})]}):eg&&"workflow"===eO?(0,n.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([]),eP(null),eG(!1),await eK(),t.info("已中止生成任务")})()},children:"中止任务"}):void 0,children:(0,n.jsxs)(g.A,{direction:"vertical",style:{width:"100%"},size:"middle",children:["workflow"===eO&&eE.length>0&&(0,n.jsx)(w.A,{direction:"vertical",size:"small",current:eQ,items:eE.map(e=>{let t;return{title:e.title,description:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:e.description}),(0,n.jsx)("div",{style:{marginTop:4},children:e.subSteps.map(e=>{var t;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:12,color:"var(--colorTextSecondary)"},children:["process"===(t=e.status)?(0,n.jsx)(q.A,{}):"finish"===t?(0,n.jsx)(E.A,{}):"warning"===t?(0,n.jsx)(M.A,{style:{color:"var(--colorWarning)"}}):"error"===t?(0,n.jsx)(W.A,{}):(0,n.jsx)("span",{style:{display:"inline-block",height:6,width:6,borderRadius:"50%",background:"var(--colorTextTertiary)"}}),(0,n.jsx)("span",{children:e.title})]},e.key)})})]}),status:"warning"===(t=e.status)?"finish":t,icon:"process"===e.status?(0,n.jsx)(q.A,{}):"warning"===e.status?(0,n.jsx)(M.A,{style:{color:"var(--colorWarning)"}}):e.icon}})}),"workflow"===eO&&eg&&0===eE.length&&(0,n.jsx)("div",{style:{textAlign:"center",padding:40},children:(0,n.jsx)(j.A,{tip:"正在准备生成…"})}),ev&&(0,n.jsx)("div",{ref:l,children:(0,n.jsx)(y.A,{items:[{key:"edit",label:e("documents.edit"),children:(0,n.jsx)(Y,{rows:35,value:ej,onChange:e=>ey(e.target.value)})},{key:"chapters-facts",label:"章节与事实",children:(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[ev.chapters.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["章节 (",ev.chapters.length,")"]}),(0,n.jsx)(m.A,{size:"small",dataSource:ev.chapters,renderItem:e=>(0,n.jsx)(m.A.Item,{actions:[(0,n.jsx)(d.Ay,{size:"small",icon:(0,n.jsx)(V.A,{}),loading:eC===e.id,onClick:()=>{tc(e)},children:"重新生成"},"regen")],children:(0,n.jsx)(m.A.Item.Meta,{title:e.title,description:"证据: ".concat(e.evidence.length," \xb7 缺失: ").concat(e.missingFacts.length)})})})]}),ev.structuredFacts.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["结构化事实 (",ev.structuredFacts.length,")"]}),(0,n.jsx)(A.A,{size:"small",column:1,bordered:!0,children:ev.structuredFacts.map((e,t)=>(0,n.jsxs)(A.A.Item,{label:e.key,children:[(0,n.jsx)("span",{children:e.value}),(0,n.jsx)(x.A,{style:{marginLeft:8},children:e.confidence.toFixed(2)}),(0,n.jsx)($,{type:"secondary",style:{fontSize:11,marginLeft:8},children:e.sourceFile})]},t))})]})]})},{key:"sources-missing",label:"来源与缺失",children:(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["引用来源 (",ev.sources.length,")"]}),0===ev.sources.length?(0,n.jsx)(p.A,{description:"暂无"}):(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:ev.sources.map(e=>(0,n.jsxs)(x.A,{color:"blue",children:[e.filePath," (",e.count,")"]},e.filePath))})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["缺失项 (",ev.missingItems.length,")"]}),0===ev.missingItems.length?(0,n.jsx)(p.A,{description:"无缺失"}):(0,n.jsx)(m.A,{size:"small",dataSource:ev.missingItems,renderItem:e=>(0,n.jsx)(m.A.Item,{children:e})})]})]})},{key:"validation",label:"校验 (".concat(ev.validationIssues.length,")"),children:0===ev.validationIssues.length?(0,n.jsx)(p.A,{description:"校验通过"}):(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[ev.validationIssues.map(e=>(0,n.jsxs)("div",{style:{border:"1px solid var(--colorBorderSecondary)",borderRadius:8,padding:12},children:[(0,n.jsx)(x.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:e.level}),(0,n.jsx)("div",{style:{marginTop:6,whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.message}),e.suggestion&&(0,n.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,n.jsxs)("div",{style:{marginTop:8},children:[(0,n.jsx)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:"导出门禁"}),(0,n.jsx)(m.A,{size:"small",dataSource:ev.exportGate.checklist,renderItem:e=>(0,n.jsxs)(m.A.Item,{children:[(0,n.jsx)($,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.label}),(0,n.jsx)(x.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})]})]})},{key:"stages",label:"执行阶段 (".concat(ev.executionStages.length,")"),children:(0,n.jsx)(m.A,{size:"small",dataSource:ev.executionStages,renderItem:e=>(0,n.jsxs)(m.A.Item,{children:[(0,n.jsx)(m.A.Item.Meta,{avatar:es[e.type]||(0,n.jsx)(P.A,{}),title:(0,n.jsx)($,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:"".concat(er[e.type]||e.type," \xb7 ").concat(e.roleId)}),description:(0,n.jsx)($,{type:"secondary",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})}),(0,n.jsx)(x.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})})}]})})]})}),(0,n.jsx)(k.A,{maskClosable:!1,title:e("documents.templateEditor"),open:ez,onOk:()=>{e4()},onCancel:()=>eD(!1),width:760,centered:!0,okText:e("common.save"),cancelText:e("common.cancel"),children:(0,n.jsxs)(o.A,{form:s,layout:"vertical",requiredMark:"optional",children:[(0,n.jsxs)(S.A,{gutter:12,children:[(0,n.jsx)(o.A.Item,{name:"id",hidden:!0,children:(0,n.jsx)(i.A,{})}),(0,n.jsx)(I.A,{xs:24,md:8,children:(0,n.jsx)(o.A.Item,{name:"name",label:e("documents.templateName"),rules:[{required:!0}],children:(0,n.jsx)(i.A,{})})}),(0,n.jsx)(I.A,{xs:24,md:8,children:(0,n.jsx)(o.A.Item,{name:"category",label:e("documents.templateCategory"),children:(0,n.jsx)(i.A,{})})}),(0,n.jsx)(I.A,{xs:24,md:8,children:(0,n.jsx)(o.A.Item,{name:"outputTitle",label:e("documents.outputTitle"),children:(0,n.jsx)(i.A,{})})}),(0,n.jsx)(I.A,{xs:24,md:12,children:(0,n.jsx)(o.A.Item,{name:"description",label:e("documents.templateDescription"),children:(0,n.jsx)(i.A,{})})})]}),(0,n.jsx)(o.A.Item,{name:"projectRoleConfigId",label:e("documents.projectRoleConfig"),rules:[{required:!0,message:e("documents.projectRoleConfigRequired")}],children:(0,n.jsx)(b.A,{showSearch:!0,placeholder:e("documents.projectRoleConfigRequired"),options:eX})}),(0,n.jsx)(o.A.Item,{name:"documentSpecId",label:e("documents.documentSpec"),children:(0,n.jsx)(b.A,{allowClear:!0,showSearch:!0,placeholder:e("documents.documentSpecPlaceholder"),options:eV})}),(0,n.jsx)(o.A.List,{name:"chapters",children:(e,t)=>{let{add:s,remove:r}=t;return(0,n.jsxs)("div",{children:[(0,n.jsxs)(g.A,{style:{marginBottom:8},children:[(0,n.jsx)($,{strong:!0,children:"章节结构"}),(0,n.jsx)(d.Ay,{size:"small",icon:(0,n.jsx)(G.A,{}),onClick:()=>s({id:"chapter-".concat(Date.now()),title:"",purpose:"",queries:[],requiredFacts:[]}),children:"添加章节"})]}),e.map(e=>(0,n.jsx)(u.A,{size:"small",style:{marginBottom:8},children:(0,n.jsxs)(S.A,{gutter:8,children:[(0,n.jsx)(I.A,{span:6,children:(0,n.jsx)(o.A.Item,{name:[e.name,"id"],label:"章节 ID",rules:[{required:!0}],children:(0,n.jsx)(i.A,{})})}),(0,n.jsx)(I.A,{span:8,children:(0,n.jsx)(o.A.Item,{name:[e.name,"title"],label:"标题",rules:[{required:!0}],children:(0,n.jsx)(i.A,{})})}),(0,n.jsx)(I.A,{span:8,children:(0,n.jsx)(o.A.Item,{name:[e.name,"purpose"],label:"目的",children:(0,n.jsx)(i.A,{})})}),(0,n.jsx)(I.A,{span:2,children:(0,n.jsx)(d.Ay,{danger:!0,size:"small",onClick:()=>r(e.name),children:"删除"})}),(0,n.jsx)(I.A,{span:12,children:(0,n.jsx)(o.A.Item,{name:[e.name,"queriesText"],label:"查询词(每行一个)",children:(0,n.jsx)(Y,{rows:3})})}),(0,n.jsx)(I.A,{span:12,children:(0,n.jsx)(o.A.Item,{name:[e.name,"requiredFactsText"],label:"必需事实(每行一个)",children:(0,n.jsx)(Y,{rows:3})})}),(0,n.jsx)(I.A,{span:24,children:(0,n.jsx)(o.A.Item,{name:[e.name,"pinnedEvidenceText"],label:"高级可选:人工确认优先证据",children:(0,n.jsx)(Y,{rows:2,placeholder:"通常无需手动填写。仅当系统自动检索不稳定或必须指定官方资料时,每行填写一个 knowledgeBase 相对路径"})})})]})},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()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{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 n=s(65321),r=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),C=s(16285),_=s(26619),z=s(8263),D=s(30960),F=s(75548),M=s(7851),E=s(84742),B=s(29071),L=s(63552),P=s(26631),R=s(76830),q=s(83914),W=s(58209),G=s(54746),O=s(71330),H=s(64068),N=s(93051),K=s(38762),U=s(64629),X=s(67547),V=s(99811),Q=s(6578),J=s(79059);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,n.jsx)(T.A,{}),context_recall:(0,n.jsx)(C.A,{}),knowledge_retrieval:(0,n.jsx)(_.A,{}),file_understanding:(0,n.jsx)(z.A,{}),fact_extraction:(0,n.jsx)(C.A,{}),chapter_generation:(0,n.jsx)(D.A,{}),asset_generation:(0,n.jsx)(F.A,{}),validation:(0,n.jsx)(M.A,{}),formatting:(0,n.jsx)(E.A,{}),llm_review:(0,n.jsx)(B.A,{}),export_ready:(0,n.jsx)(L.A,{}),reference:(0,n.jsx)(F.A,{})},en={施工组织设计:(0,n.jsx)(M.A,{}),投标文件:(0,n.jsx)(L.A,{}),技术方案:(0,n.jsx)(C.A,{}),报告:(0,n.jsx)(P.A,{}),自定义:(0,n.jsx)(D.A,{})},er={role_binding:"角色配置绑定",context_recall:"上下文召回",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,r.useRef)(null),[Z,ei]=(0,r.useState)([]),[el,ea]=(0,r.useState)("construction-organization-design"),[eo,ec]=(0,r.useState)([]),[ed,eu]=(0,r.useState)([]),[ep,em]=(0,r.useState)([]),[eh,ex]=(0,r.useState)(!0),[eg,ef]=(0,r.useState)(!1),[ev,ew]=(0,r.useState)(null),[ej,ey]=(0,r.useState)(""),[eA,ek]=(0,r.useState)([]),[eS,eI]=(0,r.useState)(null),[eb,eT]=(0,r.useState)(null),[eC,e_]=(0,r.useState)(null),[ez,eD]=(0,r.useState)(!1),[eF,eM]=(0,r.useState)({}),[eE,eB]=(0,r.useState)([]),[eL,eP]=(0,r.useState)(null),[eR,eq]=(0,r.useState)("templates"),[eW,eG]=(0,r.useState)(!1),[eO,eH]=(0,r.useState)("workflow"),eN=(0,r.useRef)(null),eK=async()=>{try{ek((await (0,Q.cQ)()).documents)}catch(e){ek([])}};(0,r.useEffect)(()=>{let e=()=>{ee&&(eB(ee.flowSteps),eP(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,r.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,r.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,r.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,eE.findIndex(e=>e.key===eL)),eJ=e=>{ea(e),eI(null),ew(null),ey(""),eH("workflow"),eG(!0),eq("drafts")},eY=async s=>{eI(s.id),ea(s.templateId);let n=e0(s.status);if(n||"failed"===s.status){ti.current=!0,ew(null),ey(""),ef(n),eH("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}eH("editor"),eB([]),eP(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)),r=ed.find(e=>e.id===(null==t?void 0:t.projectRoleConfigId)),i=((null==r?void 0:r.fileRoles)||[]).map(e=>{var t;return(null==(t=eo.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),l=((null==r?void 0:r.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,n.jsx)(P.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,n.jsx)(T.A,{}),subSteps:eZ([...i.length?i.map(e=>"文件角色:".concat(e)):["没有文件角色,使用模板绑定文件"],...l.length?l.map(e=>"提示词角色:".concat(e)):["没有提示词角色,使用默认生成策略"]].slice(0,10))},{key:"context_recall",title:"短期/长期上下文召回",description:"从项目记忆中召回用户偏好、历史纠偏和已生成文档摘要,并注入生成提示词",status:"wait",icon:(0,n.jsx)(C.A,{}),subSteps:eZ(["召回相关项目记忆","注入章节生成提示词","生成完成后沉淀新记忆"])},{key:"knowledge_retrieval",title:"知识库证据检索",description:"按 ".concat(o.length," 个章节检索文本、文档、表格、图片、图纸和附件"),status:"wait",icon:(0,n.jsx)(_.A,{}),subSteps:eZ(o.length?o.slice(0,10).map(e=>"检索章节:".concat(e)):["按模板标题检索证据"])},{key:"file_understanding",title:"多类型文件理解",description:"按文件角色处理文本、PDF/Word、表格、图片、图纸和附件",status:"wait",icon:(0,n.jsx)(z.A,{}),subSteps:eZ(["识别文件类型和角色","构建结构化资源证据包","必要时调用多模态文件理解"])},{key:"fact_extraction",title:"动态 schema 事实抽取",description:"按 ".concat(a.length," 个规范/章节事实字段抽取并检测冲突"),status:"wait",icon:(0,n.jsx)(C.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,n.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,n.jsx)(F.A,{}),subSteps:eZ(["生成资源提示词","保存到 generatedDocuments/assets","登记资源元数据"])}]:[],{key:"validation",title:"规范包与门禁校验",description:s?"执行 ".concat(s.gateRules.length," 条门禁规则"):"执行模板基础校验",status:"wait",icon:(0,n.jsx)(M.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,n.jsx)(E.A,{}),subSteps:eZ(["整理标题层级","整理多类型资源引用","生成正式 Markdown"])},{key:"llm_review",title:"LLM 审查优化",description:"再次使用动态 schema、角色和结构化证据审查优化初稿",status:"wait",icon:(0,n.jsx)(B.A,{}),subSteps:eZ(["构造审查提示词","检查事实来源和冲突","回填优化后的 Markdown"])},{key:"export_ready",title:"导出就绪",description:"确认 Markdown/HTML/DOCX/PDF 可导出",status:"wait",icon:(0,n.jsx)(L.A,{}),subSteps:eZ(["生成导出检查清单","确认阻断项","准备导出格式"])},{key:"done",title:e("documents.flowDone"),description:e("documents.flowDoneDesc"),status:"wait",icon:(0,n.jsx)(R.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,n;let r,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 n=a.get(t.key);if(!n)return t;let r="failed"===(s=n.status)?"error":"fallback"===s?"warning":"finish";return{...t,status:r,description:n.message||t.description,subSteps:e2(t,r)}});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(r=(null==t?void 0:t.key)||"prepare",o))e.key===r&&"wait"===e.status&&(e.status="process",e.subSteps=e2(e,"process"))}else r="failed"===e.status?(null==(s=o.find(e=>"error"===e.status))?void 0:s.key)||(null==(n=l.at(-1))?void 0:n.type)||"prepare":"done";return{steps:o,activeKey:r}})(e);eB(t),eP(s),ef(e0(e.status)),"failed"===e.status&&eH("workflow"),("completed"===e.status||"warning"===e.status)&&e.draft&&(ew(e.draft),ey(e.editedMarkdown||e.markdown),eH("editor"),eB([]),eP(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)},e3=(e,t,s)=>{eP(e),eB(n=>{let r=n.map(n=>n.key===e?{...n,status:t,description:s||n.description,subSteps:e2(n,t)}:n);return e1(r,e),r})};(0,r.useEffect)(()=>{if(!eg||!eL)return;let e=window.setInterval(()=>eB(e=>{let t=e.map(e=>{if(e.key!==eL||"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,eL),t}),1400);return()=>window.clearInterval(e)},[eL,eg]);let e5=e=>{eB(t=>{let s=t.findIndex(t=>t.key===e),n=t.map((e,t)=>t<s&&"error"!==e.status?{...e,status:"finish",subSteps:e2(e,"finish")}:e);return e1(n,e),n})},e7=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"),pinnedEvidenceText:(e.pinnedEvidenceFilePaths||[]).join("\n")}))}),eD(!0)},e4=async()=>{try{let n=await s.validateFields(),r={...n,chapters:(n.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),pinnedEvidenceFilePaths:String(e.pinnedEvidenceText||"").split(/\r?\n/u).map(e=>e.trim()).filter(Boolean),queriesText:void 0,requiredFactsText:void 0,pinnedEvidenceText:void 0}))},i=await (0,Q.l2)(r);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 n=await (0,Q.bV)(s);ei(n.templates),ea(n.template.id),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}},te=async s=>{try{var n,r;let i=await (0,Q.h0)(s);ei(i.templates),ea(null!=(r=null==(n=i.templates[0])?void 0:n.id)?r:""),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}},tt=async e=>{try{let{validation:s}=await (0,Q.SM)(e);eM(t=>({...t,[e]:s}));let n=s.issues.filter(e=>"error"===e.level);if(ea(e),n.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"))}},tn=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 n;let{document:r}=await (0,Q.v7)(e);if(e6(r),("completed"===r.status||"warning"===r.status)&&r.draft)return r;if("failed"===r.status)throw Error(r.error||"生成失败");if(0===(r.executionStages||(null==(n=r.draft)?void 0:n.executionStages)||[]).length){let e=t[Math.min(s,t.length-1)];e5(e.k),e3(e.k,"process",e.m)}s++,await new Promise(e=>window.setTimeout(e,1500))}},tr=async()=>{if(!el)return;if(null==ee?void 0:ee.loading){eB(ee.flowSteps),eP(ee.activeFlowKey),ef(!0);return}ef(!0);let s=e$(Z.find(e=>e.id===el)||eU),n=(0,Q.OX)({templateId:el});ee={id:Date.now(),templateId:el,loading:!0,flowSteps:s,activeFlowKey:"prepare",promise:n,listeners:new Set},eB(s),eP("prepare");let r=[{k:"role_binding",m:"正在读取模板、文件角色、提示词角色和文档规范包…"},{k:"knowledge_retrieval",m:"正在从知识库检索章节证据、表格、图片和附件…"},{k:"file_understanding",m:"正在准备多模态文件理解…"},{k:"fact_extraction",m:"正在等待 LLM 事实抽取和后续章节生成结果…"}].map((e,t)=>window.setTimeout(()=>{e5(e.k),e3(e.k,"process",e.m)},600+900*t));try{let s=await n;s.documentId&&(localStorage.setItem("activeGenDocId",s.documentId),eI(s.documentId),(null==ee?void 0:ee.promise)===n&&(ee.documentId=s.documentId)),await eK();let i=s.documentId?await tn(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),r.forEach(e=>window.clearTimeout(e)),e5("done"),ew(a),ey((null==i?void 0:i.editedMarkdown)||(null==i?void 0:i.markdown)||a.markdown),(null==ee?void 0:ee.promise)===n&&(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 n;let s=a.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!a.exportGate.passed,r=s?"warning":"finish",i=null==(n=a.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message;return{...t,status:r,description:s?"生成完成,但需复核:".concat(i||e("documents.flowGateFailed")):e("documents.flowDoneDesc"),subSteps:e2(t,r)}}if(!s)return"process"===t.status?{...t,status:"finish",subSteps:e2(t,"finish")}:t;let r="failed"===s.status?"error":"finish";return{...t,status:r,description:"".concat(s.status.toUpperCase(),":").concat(s.message||t.description),subSteps:e2(t,r)}});return e1(s,"done",!1),s}),eP("done"),(null==ee?void 0:ee.promise)===n&&(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(r){localStorage.removeItem("activeGenDocId");let s=r instanceof Error?r.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,eL,!1),t}),(null==ee?void 0:ee.promise)===n&&(ee.loading=!1,ee.error=s,et()),t.error(s)}finally{r.forEach(e=>window.clearTimeout(e)),ef(!1),(null==ee?void 0:ee.promise)===n&&(ee.loading=!1,et())}},ti=(0,r.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,r.useEffect)(()=>{eW&&"workflow"===eO&&!ti.current&&!(null==ee?void 0:ee.loading)&&(null==eU?void 0:eU.projectRoleConfigId)&&(ti.current=!0,window.setTimeout(()=>{tr()},300)),eW||(ti.current=!1)},[eW,eO]);let ta=async s=>{if(ev){eT(s);try{var n;let e="markdown"===s?"md":s,t=null==(n=ep.find(e=>e.id===(null==eU?void 0:eU.documentSpecId)))?void 0:n.wordTemplatePath,r=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 n=new Blob([e],{type:s}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,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(r),1e3)})(r,"".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(null)}}},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){e_(s.id);try{var n,r;let i=await (0,Q.R1)({templateId:ev.templateId,chapterId:s.id,documentId:eS||void 0,currentMarkdown:ej,existingFacts:null==(n=ev.structuredFacts)?void 0:n.map(e=>e.value)});ew({...ev,chapters:ev.chapters.map(e=>e.id===s.id?i.chapter:e)}),r=i.chapter,ey(e=>e.includes(s.content)?e.replace(s.content,r.content):"".concat(e,"\n\n").concat(r.content)),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}finally{e_(null)}}};if(eh)return(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(c.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,n.jsx)(c.A,{active:!0,paragraph:{rows:2}}),(0,n.jsx)(c.A,{active:!0,paragraph:{rows:8}})]});let td="workflow"===eO?"工作流:".concat((null==eU?void 0:eU.name)||"选择模板"):"编辑:".concat((null==ev?void 0:ev.title)||(null==eU?void 0:eU.outputTitle)||"文档");return(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("documents.title")}),(0,n.jsx)("p",{className:"pageDesc",children:e("documents.description")})]}),(0,n.jsx)(d.Ay,{type:"primary",icon:(0,n.jsx)(G.A,{}),onClick:()=>e7(),children:e("documents.newTemplate")})]}),(0,n.jsx)(u.A,{size:"small",tabList:[{key:"templates",label:"模板库 (".concat(Z.length,")")},{key:"drafts",label:"生成记录 (".concat(eA.length,")")}],activeTabKey:eR,onTabChange:eq,children:"templates"===eR?0===Z.length?(0,n.jsx)(p.A,{description:e("common.noData")}):(0,n.jsx)(m.A,{dataSource:Z,renderItem:(t,s)=>(0,n.jsx)(m.A.Item,{style:{cursor:"pointer",padding:"10px 0"},actions:[(0,n.jsx)(d.Ay,{size:"small",icon:(0,n.jsx)(O.A,{}),onClick:e=>{e.stopPropagation(),e7(t)},children:"配置"},"cfg"),(0,n.jsx)(d.Ay,{size:"small",type:"primary",icon:(0,n.jsx)(H.A,{}),onClick:e=>{e.stopPropagation(),tt(t.id)},children:"运行"},"run"),(0,n.jsx)(d.Ay,{size:"small",icon:(0,n.jsx)(N.A,{}),onClick:e=>{e.stopPropagation(),e9(t.id)}},"copy"),(0,n.jsx)(h.A,{title:e("documents.deleteTemplateConfirm"),disabled:t.builtIn,onConfirm:e=>{null==e||e.stopPropagation(),te(t.id)},children:(0,n.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,n.jsx)(W.A,{}),disabled:t.builtIn,onClick:e=>e.stopPropagation()})},"del")],onClick:()=>ea(t.id),children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[function(e,t){let s=en[e]||(0,n.jsx)(P.A,{});return(0,n.jsx)("span",{style:{color:t?"var(--colorAccent)":"var(--colorTextSecondary)",fontSize:16,marginTop:2,flexShrink:0},children:s})}(t.category,el===t.id),(0,n.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,n.jsx)("span",{style:{fontWeight:el===t.id?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),t.builtIn&&(0,n.jsx)(x.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"内置"}),el===t.id&&(0,n.jsx)(x.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"当前"}),(0,n.jsx)(x.A,{style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:t.category}),eF[t.id]&&(0,n.jsxs)(x.A,{color:eF[t.id].issues.some(e=>"error"===e.level)?"error":eF[t.id].issues.length?"warning":"success",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:["检查 ",eF[t.id].fileDiagnostics.length," 文件 / ",eF[t.id].promptDiagnostics.length," 提示词"]})]}),t.description&&(0,n.jsx)($,{type:"secondary",style:{fontSize:12,lineHeight:"18px"},children:t.description}),eF[t.id]&&(0,n.jsx)("div",{onClick:e=>e.stopPropagation(),style:{marginTop:8,padding:10,border:"1px solid ".concat(eF[t.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBorder)":eF[t.id].issues.length?"var(--colorWarningBorder)":"var(--colorSuccessBorder)"),borderRadius:10,background:eF[t.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBg)":eF[t.id].issues.length?"var(--colorWarningBg)":"var(--colorSuccessBg)"},children:(0,n.jsxs)(g.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,n.jsxs)(g.A,{wrap:!0,children:[(0,n.jsx)($,{strong:!0,children:eF[t.id].issues.some(e=>"error"===e.level)?"运行前检查未通过":eF[t.id].issues.length?"运行前检查存在警告":"运行前检查通过"}),(0,n.jsxs)(x.A,{color:"blue",children:["文件角色 ",eF[t.id].fileDiagnostics.length]}),(0,n.jsxs)(x.A,{color:"purple",children:["提示词角色 ",eF[t.id].promptDiagnostics.length]}),eF[t.id].spec&&(0,n.jsxs)(x.A,{color:"cyan",children:["规范包 ",eF[t.id].spec.name]})]}),eF[t.id].issues.length>0?eF[t.id].issues.map(e=>(0,n.jsx)(f.A,{type:"error"===e.level?"error":"warning",message:e.message,showIcon:!0},e.message)):(0,n.jsx)(f.A,{type:"success",message:"文件角色、提示词角色和规范包检查通过,可以运行。",showIcon:!0}),!eF[t.id].issues.some(e=>"error"===e.level)&&eF[t.id].issues.length>0&&(0,n.jsx)("div",{children:(0,n.jsx)(d.Ay,{size:"small",type:"primary",icon:(0,n.jsx)(H.A,{}),onClick:()=>eJ(t.id),children:"忽略警告并继续运行"})})]})})]})]})})}):0===eA.length?(0,n.jsx)(p.A,{description:e("common.noData")}):(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:eA.slice(0,15).map((e,t)=>{var s,r,i;let l,a;return(0,n.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,n.jsx)(E.A,{style:{fontSize:18,color:"var(--colorOk)",flexShrink:0,marginTop:2}}):"failed"===e.status?(0,n.jsx)(K.A,{style:{fontSize:18,color:"var(--colorDanger)",flexShrink:0,marginTop:2}}):"warning"===e.status?(0,n.jsx)(M.A,{style:{fontSize:18,color:"var(--colorWarning)",flexShrink:0,marginTop:2}}):(0,n.jsx)(U.A,{spin:!0,style:{fontSize:18,color:"#1677ff",flexShrink:0,marginTop:2}}),(0,n.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,n.jsx)("div",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:3},children:e.title}),(0,n.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px 10px",color:"var(--colorTextSecondary)",fontSize:11},children:[(0,n.jsx)("span",{children:new Date(e.updatedAt).toLocaleString()}),(0,n.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),n=t%60;if(s<60)return n?"".concat(s," 分 ").concat(n," 秒"):"".concat(s," 分");let r=Math.floor(s/60),i=s%60;return i?"".concat(r," 小时 ").concat(i," 分"):"".concat(r," 小时")})(e)]})]}),("warning"===e.status||"failed"===e.status)&&(0,n.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==(r=i.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:r.message)||"需复核"})]}),(0,n.jsxs)(g.A,{size:4,align:"center",children:[(0,n.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,n.jsxs)(x.A,{style:{margin:0,fontSize:10,lineHeight:"18px"},children:["#",t+1]}),(0,n.jsx)(h.A,{title:"确认删除?",onConfirm:t=>{null==t||t.stopPropagation(),ts(e.id)},children:(0,n.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,n.jsx)(W.A,{}),onClick:e=>e.stopPropagation()})}),e0(e.status)&&(0,n.jsx)(h.A,{title:"确定中止此生成任务?",onConfirm:t=>{null==t||t.stopPropagation(),tl(e)},children:(0,n.jsx)(d.Ay,{size:"small",danger:!0,onClick:e=>e.stopPropagation(),children:"中止"})}),(0,n.jsx)(d.Ay,{size:"small",type:"primary",icon:e0(e.status)?(0,n.jsx)(U.A,{spin:!0}):(0,n.jsx)(H.A,{}),onClick:t=>{t.stopPropagation(),eY(e)},children:"打开"})]})]},e.id)})})}),(0,n.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,n.jsxs)(g.A,{wrap:!0,children:[(0,n.jsx)(d.Ay,{icon:(0,n.jsx)(X.A,{}),onClick:()=>{to()},children:e("documents.saveDraft")}),(0,n.jsx)(d.Ay,{icon:(0,n.jsx)(R.A,{}),loading:"markdown"===eb,onClick:()=>{ta("markdown")},children:"MD"}),(0,n.jsx)(d.Ay,{loading:"html"===eb,onClick:()=>{ta("html")},children:"HTML"}),(0,n.jsx)(d.Ay,{loading:"docx"===eb,onClick:()=>{ta("docx")},children:"DOCX"}),(0,n.jsx)(d.Ay,{type:"primary",loading:"pdf"===eb,onClick:()=>{ta("pdf")},children:"PDF"})]}):eg&&"workflow"===eO?(0,n.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([]),eP(null),eG(!1),await eK(),t.info("已中止生成任务")})()},children:"中止任务"}):void 0,children:(0,n.jsxs)(g.A,{direction:"vertical",style:{width:"100%"},size:"middle",children:["workflow"===eO&&eE.length>0&&(0,n.jsx)(w.A,{direction:"vertical",size:"small",current:eQ,items:eE.map(e=>{let t;return{title:e.title,description:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:e.description}),(0,n.jsx)("div",{style:{marginTop:4},children:e.subSteps.map(e=>{var t;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:12,color:"var(--colorTextSecondary)"},children:["process"===(t=e.status)?(0,n.jsx)(q.A,{}):"finish"===t?(0,n.jsx)(E.A,{}):"warning"===t?(0,n.jsx)(M.A,{style:{color:"var(--colorWarning)"}}):"error"===t?(0,n.jsx)(W.A,{}):(0,n.jsx)("span",{style:{display:"inline-block",height:6,width:6,borderRadius:"50%",background:"var(--colorTextTertiary)"}}),(0,n.jsx)("span",{children:e.title})]},e.key)})})]}),status:"warning"===(t=e.status)?"finish":t,icon:"process"===e.status?(0,n.jsx)(q.A,{}):"warning"===e.status?(0,n.jsx)(M.A,{style:{color:"var(--colorWarning)"}}):e.icon}})}),"workflow"===eO&&eg&&0===eE.length&&(0,n.jsx)("div",{style:{textAlign:"center",padding:40},children:(0,n.jsx)(j.A,{tip:"正在准备生成…"})}),ev&&(0,n.jsx)("div",{ref:l,children:(0,n.jsx)(y.A,{items:[{key:"edit",label:e("documents.edit"),children:(0,n.jsx)(Y,{rows:35,value:ej,onChange:e=>ey(e.target.value)})},{key:"chapters-facts",label:"章节与事实",children:(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[ev.chapters.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["章节 (",ev.chapters.length,")"]}),(0,n.jsx)(m.A,{size:"small",dataSource:ev.chapters,renderItem:e=>(0,n.jsx)(m.A.Item,{actions:[(0,n.jsx)(d.Ay,{size:"small",icon:(0,n.jsx)(V.A,{}),loading:eC===e.id,onClick:()=>{tc(e)},children:"重新生成"},"regen")],children:(0,n.jsx)(m.A.Item.Meta,{title:e.title,description:"证据: ".concat(e.evidence.length," \xb7 缺失: ").concat(e.missingFacts.length)})})})]}),ev.structuredFacts.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["结构化事实 (",ev.structuredFacts.length,")"]}),(0,n.jsx)(A.A,{size:"small",column:1,bordered:!0,children:ev.structuredFacts.map((e,t)=>(0,n.jsxs)(A.A.Item,{label:e.key,children:[(0,n.jsx)("span",{children:e.value}),(0,n.jsx)(x.A,{style:{marginLeft:8},children:e.confidence.toFixed(2)}),(0,n.jsx)($,{type:"secondary",style:{fontSize:11,marginLeft:8},children:e.sourceFile})]},t))})]})]})},{key:"sources-missing",label:"来源与缺失",children:(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["引用来源 (",ev.sources.length,")"]}),0===ev.sources.length?(0,n.jsx)(p.A,{description:"暂无"}):(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:ev.sources.map(e=>(0,n.jsxs)(x.A,{color:"blue",children:[e.filePath," (",e.count,")"]},e.filePath))})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["缺失项 (",ev.missingItems.length,")"]}),0===ev.missingItems.length?(0,n.jsx)(p.A,{description:"无缺失"}):(0,n.jsx)(m.A,{size:"small",dataSource:ev.missingItems,renderItem:e=>(0,n.jsx)(m.A.Item,{children:e})})]})]})},{key:"validation",label:"校验 (".concat(ev.validationIssues.length,")"),children:0===ev.validationIssues.length?(0,n.jsx)(p.A,{description:"校验通过"}):(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[ev.validationIssues.map(e=>(0,n.jsxs)("div",{style:{border:"1px solid var(--colorBorderSecondary)",borderRadius:8,padding:12},children:[(0,n.jsx)(x.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:e.level}),(0,n.jsx)("div",{style:{marginTop:6,whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.message}),e.suggestion&&(0,n.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,n.jsxs)("div",{style:{marginTop:8},children:[(0,n.jsx)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:"导出门禁"}),(0,n.jsx)(m.A,{size:"small",dataSource:ev.exportGate.checklist,renderItem:e=>(0,n.jsxs)(m.A.Item,{children:[(0,n.jsx)($,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.label}),(0,n.jsx)(x.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})]})]})},{key:"stages",label:"执行阶段 (".concat(ev.executionStages.length,")"),children:(0,n.jsx)(m.A,{size:"small",dataSource:ev.executionStages,renderItem:e=>(0,n.jsxs)(m.A.Item,{children:[(0,n.jsx)(m.A.Item.Meta,{avatar:es[e.type]||(0,n.jsx)(P.A,{}),title:(0,n.jsx)($,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:"".concat(er[e.type]||e.type," \xb7 ").concat(e.roleId)}),description:(0,n.jsx)($,{type:"secondary",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})}),(0,n.jsx)(x.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})})}]})})]})}),(0,n.jsx)(k.A,{maskClosable:!1,title:e("documents.templateEditor"),open:ez,onOk:()=>{e4()},onCancel:()=>eD(!1),width:760,centered:!0,okText:e("common.save"),cancelText:e("common.cancel"),children:(0,n.jsxs)(o.A,{form:s,layout:"vertical",requiredMark:"optional",children:[(0,n.jsxs)(S.A,{gutter:12,children:[(0,n.jsx)(o.A.Item,{name:"id",hidden:!0,children:(0,n.jsx)(i.A,{})}),(0,n.jsx)(I.A,{xs:24,md:8,children:(0,n.jsx)(o.A.Item,{name:"name",label:e("documents.templateName"),rules:[{required:!0}],children:(0,n.jsx)(i.A,{})})}),(0,n.jsx)(I.A,{xs:24,md:8,children:(0,n.jsx)(o.A.Item,{name:"category",label:e("documents.templateCategory"),children:(0,n.jsx)(i.A,{})})}),(0,n.jsx)(I.A,{xs:24,md:8,children:(0,n.jsx)(o.A.Item,{name:"outputTitle",label:e("documents.outputTitle"),children:(0,n.jsx)(i.A,{})})}),(0,n.jsx)(I.A,{xs:24,md:12,children:(0,n.jsx)(o.A.Item,{name:"description",label:e("documents.templateDescription"),children:(0,n.jsx)(i.A,{})})})]}),(0,n.jsx)(o.A.Item,{name:"projectRoleConfigId",label:e("documents.projectRoleConfig"),rules:[{required:!0,message:e("documents.projectRoleConfigRequired")}],children:(0,n.jsx)(b.A,{showSearch:!0,placeholder:e("documents.projectRoleConfigRequired"),options:eX})}),(0,n.jsx)(o.A.Item,{name:"documentSpecId",label:e("documents.documentSpec"),children:(0,n.jsx)(b.A,{allowClear:!0,showSearch:!0,placeholder:e("documents.documentSpecPlaceholder"),options:eV})}),(0,n.jsx)(o.A.List,{name:"chapters",children:(e,t)=>{let{add:s,remove:r}=t;return(0,n.jsxs)("div",{children:[(0,n.jsxs)(g.A,{style:{marginBottom:8},children:[(0,n.jsx)($,{strong:!0,children:"章节结构"}),(0,n.jsx)(d.Ay,{size:"small",icon:(0,n.jsx)(G.A,{}),onClick:()=>s({id:"chapter-".concat(Date.now()),title:"",purpose:"",queries:[],requiredFacts:[]}),children:"添加章节"})]}),e.map(e=>(0,n.jsx)(u.A,{size:"small",style:{marginBottom:8},children:(0,n.jsxs)(S.A,{gutter:8,children:[(0,n.jsx)(I.A,{span:6,children:(0,n.jsx)(o.A.Item,{name:[e.name,"id"],label:"章节 ID",rules:[{required:!0}],children:(0,n.jsx)(i.A,{})})}),(0,n.jsx)(I.A,{span:8,children:(0,n.jsx)(o.A.Item,{name:[e.name,"title"],label:"标题",rules:[{required:!0}],children:(0,n.jsx)(i.A,{})})}),(0,n.jsx)(I.A,{span:8,children:(0,n.jsx)(o.A.Item,{name:[e.name,"purpose"],label:"目的",children:(0,n.jsx)(i.A,{})})}),(0,n.jsx)(I.A,{span:2,children:(0,n.jsx)(d.Ay,{danger:!0,size:"small",onClick:()=>r(e.name),children:"删除"})}),(0,n.jsx)(I.A,{span:12,children:(0,n.jsx)(o.A.Item,{name:[e.name,"queriesText"],label:"查询词(每行一个)",children:(0,n.jsx)(Y,{rows:3})})}),(0,n.jsx)(I.A,{span:12,children:(0,n.jsx)(o.A.Item,{name:[e.name,"requiredFactsText"],label:"必需事实(每行一个)",children:(0,n.jsx)(Y,{rows:3})})}),(0,n.jsx)(I.A,{span:24,children:(0,n.jsx)(o.A.Item,{name:[e.name,"pinnedEvidenceText"],label:"高级可选:人工确认优先证据",children:(0,n.jsx)(Y,{rows:2,placeholder:"通常无需手动填写。仅当系统自动检索不稳定或必须指定官方资料时,每行填写一个 knowledgeBase 相对路径"})})})]})},e.key))]})}})]})})]})}}},e=>{e.O(0,[433,787,576,195,455,506,412,447,636,593,792],()=>e(e.s=16403)),_N_E=e.O()}]);
|