@customize-agent/server 4.0.67 → 4.0.68
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 +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/chunks/6697.js +5 -5
- 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/asset-library.html +1 -1
- package/.next/server/pages/context/long-term.html +1 -1
- package/.next/server/pages/context/short-term.html +1 -1
- package/.next/server/pages/document-roles.html +1 -1
- package/.next/server/pages/documents.html +1 -1
- package/.next/server/pages/guide.html +1 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/search.html +1 -1
- package/.next/server/pages/knowledge.html +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages/prompt.html +1 -1
- package/.next/server/pages/settings.html +1 -1
- package/.next/server/pages/system/logs.html +1 -1
- package/.next/server/pages-manifest.json +26 -26
- package/.next/static/chunks/pages/documents-141b9ab2dba47ae7.js +1 -0
- package/.next/static/{gvUbtNR4QcuhHNBdOq2dZ → ubuSYahPe0ZJo6zT6KdSg}/_buildManifest.js +1 -1
- package/package.json +4 -4
- package/.next/static/chunks/pages/documents-8d5b7f1515d9149b.js +0 -1
- /package/.next/static/{gvUbtNR4QcuhHNBdOq2dZ → ubuSYahPe0ZJo6zT6KdSg}/_ssgManifest.js +0 -0
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
{
|
|
2
2
|
"/_app": "pages/_app.js",
|
|
3
|
+
"/_error": "pages/_error.js",
|
|
3
4
|
"/api/assets/generated": "pages/api/assets/generated.js",
|
|
4
|
-
"/api/assets/generated/preview": "pages/api/assets/generated/preview.js",
|
|
5
5
|
"/api/config/embedding/healthCheck": "pages/api/config/embedding/healthCheck.js",
|
|
6
|
+
"/api/assets/generated/preview": "pages/api/assets/generated/preview.js",
|
|
6
7
|
"/api/config/models": "pages/api/config/models.js",
|
|
7
|
-
"/api/context": "pages/api/context.js",
|
|
8
8
|
"/api/documents/chapter/regenerate": "pages/api/documents/chapter/regenerate.js",
|
|
9
|
-
"/api/documents/drafts": "pages/api/documents/drafts.js",
|
|
10
9
|
"/api/documents/generate": "pages/api/documents/generate.js",
|
|
11
|
-
"/api/
|
|
10
|
+
"/api/context": "pages/api/context.js",
|
|
11
|
+
"/api/documents/drafts": "pages/api/documents/drafts.js",
|
|
12
12
|
"/api/documents/roles": "pages/api/documents/roles.js",
|
|
13
|
+
"/api/documents/generated": "pages/api/documents/generated.js",
|
|
13
14
|
"/api/documents/templates": "pages/api/documents/templates.js",
|
|
14
15
|
"/api/health": "pages/api/health.js",
|
|
15
16
|
"/api/jobs/[id]": "pages/api/jobs/[id].js",
|
|
16
|
-
"/api/jobs": "pages/api/jobs.js",
|
|
17
17
|
"/api/kb/categories": "pages/api/kb/categories.js",
|
|
18
|
-
"/api/kb/duplicates": "pages/api/kb/duplicates.js",
|
|
19
|
-
"/api/kb/features": "pages/api/kb/features.js",
|
|
20
|
-
"/_error": "pages/_error.js",
|
|
21
18
|
"/api/kb/files/detail": "pages/api/kb/files/detail.js",
|
|
22
|
-
"/api/kb/
|
|
23
|
-
"/api/
|
|
19
|
+
"/api/kb/features": "pages/api/kb/features.js",
|
|
20
|
+
"/api/jobs": "pages/api/jobs.js",
|
|
21
|
+
"/api/kb/duplicates": "pages/api/kb/duplicates.js",
|
|
24
22
|
"/api/kb/files/reindex": "pages/api/kb/files/reindex.js",
|
|
25
|
-
"/api/kb/files/
|
|
23
|
+
"/api/kb/files/open": "pages/api/kb/files/open.js",
|
|
26
24
|
"/api/kb/ignore": "pages/api/kb/ignore.js",
|
|
27
|
-
"/api/kb/operations": "pages/api/kb/operations.js",
|
|
28
|
-
"/api/kb/reindex": "pages/api/kb/reindex.js",
|
|
29
25
|
"/api/kb/search": "pages/api/kb/search.js",
|
|
30
|
-
"/api/kb/
|
|
26
|
+
"/api/kb/files/search": "pages/api/kb/files/search.js",
|
|
27
|
+
"/api/kb/operations": "pages/api/kb/operations.js",
|
|
28
|
+
"/api/kb/files": "pages/api/kb/files.js",
|
|
31
29
|
"/api/kb/tags": "pages/api/kb/tags.js",
|
|
32
|
-
"/api/kb/
|
|
30
|
+
"/api/kb/stats": "pages/api/kb/stats.js",
|
|
31
|
+
"/api/kb/reindex": "pages/api/kb/reindex.js",
|
|
33
32
|
"/api/prompt": "pages/api/prompt.js",
|
|
34
|
-
"/api/system/logs": "pages/api/system/logs.js",
|
|
35
|
-
"/api/system/stats": "pages/api/system/stats.js",
|
|
36
|
-
"/asset-library": "pages/asset-library.html",
|
|
37
33
|
"/context/long-term": "pages/context/long-term.html",
|
|
38
|
-
"/
|
|
34
|
+
"/api/kb/upload/progress": "pages/api/kb/upload/progress.js",
|
|
35
|
+
"/asset-library": "pages/asset-library.html",
|
|
36
|
+
"/api/system/logs": "pages/api/system/logs.js",
|
|
39
37
|
"/document-roles": "pages/document-roles.html",
|
|
40
|
-
"/
|
|
38
|
+
"/context/short-term": "pages/context/short-term.html",
|
|
39
|
+
"/api/system/stats": "pages/api/system/stats.js",
|
|
41
40
|
"/guide": "pages/guide.html",
|
|
41
|
+
"/documents": "pages/documents.html",
|
|
42
42
|
"/": "pages/index.html",
|
|
43
43
|
"/knowledge/file-detail": "pages/knowledge/file-detail.html",
|
|
44
|
-
"/knowledge/files": "pages/knowledge/files.html",
|
|
45
|
-
"/knowledge": "pages/knowledge.html",
|
|
46
|
-
"/knowledge/manage": "pages/knowledge/manage.html",
|
|
47
44
|
"/knowledge/search": "pages/knowledge/search.html",
|
|
45
|
+
"/knowledge/manage": "pages/knowledge/manage.html",
|
|
48
46
|
"/models": "pages/models.html",
|
|
47
|
+
"/knowledge/files": "pages/knowledge/files.html",
|
|
49
48
|
"/overview": "pages/overview.html",
|
|
50
|
-
"/
|
|
51
|
-
"/system/logs": "pages/system/logs.html",
|
|
49
|
+
"/knowledge": "pages/knowledge.html",
|
|
52
50
|
"/settings": "pages/settings.html",
|
|
51
|
+
"/prompt": "pages/prompt.html",
|
|
53
52
|
"/api/config/healthCheck": "pages/api/config/healthCheck.js",
|
|
54
53
|
"/api/config/providers/[provider]": "pages/api/config/providers/[provider].js",
|
|
55
54
|
"/api/config/embedding": "pages/api/config/embedding.js",
|
|
56
55
|
"/api/config/providers": "pages/api/config/providers.js",
|
|
57
56
|
"/api/documents/generated/[id]": "pages/api/documents/generated/[id].js",
|
|
57
|
+
"/system/logs": "pages/system/logs.html",
|
|
58
58
|
"/api/kb/files/preview-pdf-page": "pages/api/kb/files/preview-pdf-page.js",
|
|
59
|
-
"/api/kb/upload": "pages/api/kb/upload.js",
|
|
60
59
|
"/api/prompt/chat": "pages/api/prompt/chat.js",
|
|
61
60
|
"/api/documents/refine": "pages/api/documents/refine.js",
|
|
61
|
+
"/api/kb/upload": "pages/api/kb/upload.js",
|
|
62
62
|
"/api/documents/export": "pages/api/documents/export.js",
|
|
63
63
|
"/_document": "pages/_document.js",
|
|
64
64
|
"/404": "pages/404.html"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{16403:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return r(19562)}])},19562:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>ec});var l=r(65321),n=r(97109),s=r(7576),i=r(35292),o=r(33442),a=r(11702),c=r(17807),d=r(63455),u=r(88762),p=r(85114),m=r(68787),h=r(84253),x=r(38332),g=r(26171),f=r(85493),j=r(34052),y=r(9730),v=r(42700),w=r(58569),A=r(2256),S=r(38770),k=r(76506),b=r(57271),I=r(49604),C=r(23216),z=r(16285),T=r(26619),E=r(8263),B=r(8579),R=r(75548),_=r(7851),M=r(84742),D=r(29071),F=r(63552),P=r(26631),L=r(29606),G=r(83914),W=r(58209),N=r(54746),O=r(71330),H=r(64068),K=r(93051),q=r(38762),V=r(64629),U=r(67547),X=r(76830),Q=r(1310),J=r(6578),Y=r(79059);let{TextArea:Z}=s.A,{Text:$}=i.A,ee=null;function et(){null==ee||ee.listeners.forEach(e=>e())}let er={role_binding:(0,l.jsx)(C.A,{}),context_recall:(0,l.jsx)(z.A,{}),knowledge_retrieval:(0,l.jsx)(T.A,{}),file_understanding:(0,l.jsx)(E.A,{}),fact_extraction:(0,l.jsx)(z.A,{}),chapter_generation:(0,l.jsx)(B.A,{}),asset_generation:(0,l.jsx)(R.A,{}),validation:(0,l.jsx)(_.A,{}),formatting:(0,l.jsx)(M.A,{}),llm_review:(0,l.jsx)(D.A,{}),export_ready:(0,l.jsx)(F.A,{}),reference:(0,l.jsx)(R.A,{})},el={施工组织设计:(0,l.jsx)(_.A,{}),投标文件:(0,l.jsx)(F.A,{}),技术方案:(0,l.jsx)(z.A,{}),报告:(0,l.jsx)(P.A,{}),自定义:(0,l.jsx)(B.A,{})};function en(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function es(e){return e?e.split(/[\\/]/u).pop()||e:""}function ei(e){let t=[],r=e=>{for(let l of e)l.isFolder?l.children&&r(l.children):t.push(l.key)};return r(e),t}let eo={role_binding:"角色配置绑定",context_recall:"上下文召回",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",asset_generation:"多模态资源生成",validation:"规则校验",formatting:"格式化排版",llm_review:"LLM 审查优化",export_ready:"导出就绪",reference:"参考资源处理"},ea={"knowledge-base":"知识库","document-readiness":"生成准备度检查","quality-repair":"质量补写","export-gate":"导出门禁","context-memory":"项目上下文","final-format":"正式排版","multimodal-files":"多模态文件理解",tender_announcement:"招标公告"};function ec(){let e=(0,Y.Vr)(),{message:t}=c.A.useApp(),[r]=d.A.useForm(),i=(0,n.useRef)(null),[R,ec]=(0,n.useState)([]),[ed,eu]=(0,n.useState)("construction-organization-design"),[ep,em]=(0,n.useState)([]),[eh,ex]=(0,n.useState)([]),[eg,ef]=(0,n.useState)([]),[ej,ey]=(0,n.useState)([]),[ev,ew]=(0,n.useState)(!1),[eA,eS]=(0,n.useState)(""),[ek,eb]=(0,n.useState)([]),[eI,eC]=(0,n.useState)(!0),[ez,eT]=(0,n.useState)(!1),[eE,eB]=(0,n.useState)(null),[eR,e_]=(0,n.useState)(""),[eM,eD]=(0,n.useState)([]),[eF,eP]=(0,n.useState)(null),[eL,eG]=(0,n.useState)(null),[eW,eN]=(0,n.useState)(""),[eO,eH]=(0,n.useState)(!1),[eK,eq]=(0,n.useState)("idle"),[eV,eU]=(0,n.useState)(null),[eX,eQ]=(0,n.useState)(null),[eJ,eY]=(0,n.useState)({start:0,end:0}),[eZ,e$]=(0,n.useState)([]),[e0,e1]=(0,n.useState)(!1),[e2,e6]=(0,n.useState)(!1),[e8,e3]=(0,n.useState)({}),e4=ep.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),e5=d.A.useWatch("fileBindingGroups",r)||{},e7=(0,n.useMemo)(()=>(function(e){let t={};for(let n of[...e].sort((e,t)=>e.relativePath.localeCompare(t.relativePath,"zh-CN"))){let e=n.relativePath.split("/").filter(Boolean),s="";for(let i=0;i<e.length;i++){let a=e[i],c=s;s=s?"".concat(s,"/").concat(a):a;let d=i===e.length-1;if(!t[s]){var r;t[s]={key:s,rawTitle:a,title:d?(0,l.jsx)("span",{title:n.relativePath,children:a}):(0,l.jsxs)(o.A,{size:4,children:[(0,l.jsx)(L.A,{style:{color:"#faad14"}}),(0,l.jsx)("span",{children:a})]}),isFolder:!d,fileCount:+!!d,...d?{}:{children:[]}},c&&(null==(r=t[c])?void 0:r.children)&&t[c].children.push(t[s])}d&&(t[s].fileCount=1)}}let n=e=>{for(let r of e){var t;(null==(t=r.children)?void 0:t.length)&&(n(r.children),r.fileCount=r.children.reduce((e,t)=>e+t.fileCount,0),r.title=(0,l.jsxs)(o.A,{size:4,children:[(0,l.jsx)(L.A,{style:{color:"#faad14"}}),(0,l.jsx)("span",{children:r.rawTitle}),(0,l.jsx)(a.A,{style:{margin:0},children:r.fileCount})]}))}},s=Object.values(t).filter(e=>!e.key.includes("/"));return n(s),s.filter(e=>!e.isFolder||e.fileCount>0)})(ej),[ej]),e9=(0,n.useMemo)(()=>(function e(t,r){let l=r.trim().toLowerCase();return l?t.flatMap(t=>{let r=t.children?e(t.children,l):void 0;return t.key.toLowerCase().includes(l)||t.rawTitle.toLowerCase().includes(l)||(null==r?void 0:r.length)?[{...t,children:r}]:[]}):t})(e7,eA),[e7,eA]),te=(0,n.useMemo)(()=>ei(e7),[e7]),tt=(0,n.useMemo)(()=>{var e,t,r;return(null==(e=eg.find(e=>e.selected))?void 0:e.projectRoot)||(null==(t=eg.find(e=>e.isCurrent))?void 0:t.projectRoot)||(null==(r=eg[0])?void 0:r.projectRoot)||""},[eg]),tr=(0,n.useMemo)(()=>{let e=[],t=r=>{for(let l of r)e.push(l.key),l.children&&t(l.children)};return t(e7),e},[e7]),[tl,tn]=(0,n.useState)([]),[ts,ti]=(0,n.useState)(null),[to,ta]=(0,n.useState)("templates"),[tc,td]=(0,n.useState)(!1),[tu,tp]=(0,n.useState)("workflow"),tm=(0,n.useRef)(null),th=(0,n.useRef)(null),tx=(0,n.useRef)(0),tg=(0,n.useMemo)(()=>"activeGenDocId:".concat(tt||"default"),[tt]),tf=async()=>{try{eD((await (0,J.cQ)(tt||void 0)).documents)}catch(e){eD([])}};(0,n.useEffect)(()=>{let e=()=>{ee&&(tn(ee.flowSteps),ti(ee.activeFlowKey),eT(ee.loading),ee.documentId&&eP(ee.documentId),ee.draft&&eB(ee.draft),void 0!==ee.content&&e_(ee.content))},t=ee;return null==t||t.listeners.add(e),e(),()=>{null==t||t.listeners.delete(e)}},[]),(0,n.useEffect)(()=>{eC(!0),Promise.all([(0,J.Dl)().then(e=>{var t,r;ec(e.templates),eu(null!=(r=null==(t=e.templates[0])?void 0:t.id)?r:"construction-organization-design")}),(0,J.lv)().then(e=>{em(e.roles),ex(e.configs)}),(0,J.dx)().then(e=>ef(e))]).catch(()=>t.error(e("common.error"))).finally(()=>eC(!1))},[t,e]),(0,n.useEffect)(()=>{tt&&(localStorage.removeItem("activeGenDocId"),tf())},[tt]),(0,n.useEffect)(()=>{if(0===eM.length)return;let e=localStorage.getItem(tg);if(!e)return;if(!eM.find(t=>t.id===e&&"generating"===t.status))return void localStorage.removeItem(tg);let t=setInterval(()=>{(async()=>{try{let{document:r}=await (0,J.v7)(e,!1,tt||void 0);await tf(),"generating"!==r.status&&(localStorage.removeItem(tg),clearInterval(t))}catch(e){clearInterval(t)}})()},3e3);return()=>clearInterval(t)},[eM]);let tj=(0,n.useMemo)(()=>R.find(e=>e.id===ed),[R,ed]),ty=eh.map(e=>({label:e.name,value:e.id})),tv=Math.max(0,tl.findIndex(e=>e.key===ts)),tw=e=>{var t;return e?(null==(t=ep.find(t=>t.id===e))?void 0:t.name)||ea[e]||"未知角色":""},tA=e=>e.subtitle||e.roleName||tw(e.roleId)||eo[e.type]||e.type,tS=e=>{var t,r,l;return e.promptName||((t=e.promptId)?(null==(r=eg.find(e=>e.id===t))?void 0:r.projectName)||(null==(l=ep.find(e=>e.id===t))?void 0:l.name)||ea[t]||"未知提示词":"")},tk=()=>{tx.current+=1,eN(""),eU(null),eQ(null),e$([]),e1(!1),eH(!1),eq("idle")},tb=e=>{eu(e),eP(null),eB(null),e_(""),tk(),tp("workflow"),td(!0),ta("drafts")},tI=async r=>{eP(r.id),eu(r.templateId);let l=tC(r.status);if(l||"failed"===r.status||"aborted"===r.status){tk(),eB(null),e_(""),eT(l),tp("workflow"),td(!0);try{let{document:e}=await (0,J.v7)(r.id,!1,r.projectRoot||tt||void 0);tE(e),tC(e.status)?tB(e.id,e.projectRoot||r.projectRoot||tt||void 0):await tf()}catch(e){tE(r)}return}tp("editor"),tn([]),ti(null),tk();try{let{document:e}=await (0,J.v7)(r.id,!1,r.projectRoot||tt||void 0);eB(e.draft||null),e_(e.editedMarkdown||e.markdown)}catch(r){t.error(e("common.error"))}td(!0)},tC=e=>"completed"!==e&&"warning"!==e&&"failed"!==e&&"aborted"!==e,tz=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ez;(null==ee?void 0:ee.loading)&&(ee.flowSteps=e,ee.activeFlowKey=t,ee.loading=r,et())},tT=e=>{var t,r,n,s,i;let o=e.executionStages||(null==(t=e.draft)?void 0:t.executionStages)||[];if(o.length>0){let t=o.map((t,r)=>{var n;let s,i=("failed"===e.status||"aborted"===e.status)&&"running"===t.status||"failed"===(s=t.status)?"error":"running"===s?"process":"fallback"===s?"warning":"finish";return{key:"".concat(t.type,"-").concat(r),title:t.title||eo[t.type]||t.type,subtitle:tA(t),description:t.message||"",status:i,icon:"role_binding"===(n=t.type)?(0,l.jsx)(C.A,{}):"knowledge_retrieval"===n?(0,l.jsx)(T.A,{}):"context_recall"===n?(0,l.jsx)(z.A,{}):"file_understanding"===n?(0,l.jsx)(E.A,{}):"fact_extraction"===n?(0,l.jsx)(z.A,{}):"chapter_generation"===n?(0,l.jsx)(B.A,{}):"llm_review"===n?(0,l.jsx)(D.A,{}):"validation"===n?(0,l.jsx)(_.A,{}):"formatting"===n?(0,l.jsx)(M.A,{}):"export_ready"===n?(0,l.jsx)(F.A,{}):(0,l.jsx)(P.A,{}),subSteps:[{key:"stage-".concat(r),title:tS(t)?"提示词:".concat(tS(t)):tA(t),status:i}]}});"generating"===e.status&&t.length>0&&(null==(r=t.at(-1))?void 0:r.status)==="finish"&&(t[t.length-1]={...t[t.length-1],status:"process"});let a="generating"===e.status?(null==(n=t.at(-1))?void 0:n.key)||"prepare":"failed"===e.status||"aborted"===e.status?(null==(s=t.find(e=>"error"===e.status))?void 0:s.key)||(null==(i=t.at(-1))?void 0:i.key)||"prepare":"done";return{steps:t,activeKey:a}}return{steps:[],activeKey:null}},tE=e=>{let{steps:t,activeKey:r}=tT(e);tn(t),ti(r),eT(tC(e.status)),tz(t,r,tC(e.status)),("failed"===e.status||"aborted"===e.status)&&tp("workflow"),("completed"===e.status||"warning"===e.status)&&e.draft&&(eB(e.draft),e_(e.editedMarkdown||e.markdown),tp("editor"),tn([]),ti(null))},tB=(e,t)=>{tm.current&&clearInterval(tm.current),tm.current=setInterval(()=>{(async()=>{try{let{document:r}=await (0,J.v7)(e,!0,t||tt||void 0);tE(r),await tf(),tC(r.status)||(tm.current&&clearInterval(tm.current),tm.current=null,localStorage.removeItem(tg))}catch(e){}})()},2e3)};(0,n.useEffect)(()=>()=>{tm.current&&(clearInterval(tm.current),tm.current=null),th.current&&(clearTimeout(th.current),th.current=null)},[]),(0,n.useEffect)(()=>{if(!ez||!ts)return;let e=window.setInterval(()=>tn(e=>{let t=e.map(e=>{if(e.key!==ts||"process"!==e.status)return e;let t=e.subSteps.findIndex(e=>"process"===e.status),r=t<0?0:Math.min(t+1,e.subSteps.length-1);return{...e,subSteps:e.subSteps.map((e,t)=>t<r?{...e,status:"finish"}:t===r?{...e,status:"process"}:{...e,status:"wait"})}});return tz(t,ts),t}),1400);return()=>window.clearInterval(e)},[ts,ez]);let tR=async()=>{ew(!0);try{let e=await (0,J.HT)({limit:5e3,projectRoot:tt||void 0});ey(e.files)}catch(e){t.error("知识库文件加载失败")}finally{ew(!1)}},t_=e=>{let t=null!=e?e:{id:"tpl-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,chapters:[],fileBindings:[]};r.resetFields(),r.setFieldsValue({...t,fileBindingGroups:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.reduce((e,t)=>(t.roleId&&t.filePath&&(e[t.roleId]=en([...e[t.roleId]||[],t.filePath])),e),{})}(t.fileBindings)}),eS(""),tR(),e6(!0)},tM=(e,t)=>{let l=r.getFieldValue("fileBindingGroups")||{};r.setFieldValue("fileBindingGroups",{...l,[e]:en(t)})},tD=async()=>{try{await r.validateFields();let l=r.getFieldsValue(!0),n=l.fileBindingGroups||{},s=Object.entries(n).flatMap(e=>{let[t,r]=e;return en(r||[]).map(e=>({roleId:t,filePath:e}))}),{fileBindingGroups:i,...o}=l,a={...o,chapters:[],fileBindings:s},c=await (0,J.l2)(a);ec(c.templates),eu(c.template.id),e6(!1),await tf(),t.success(e("common.success"))}catch(e){e instanceof Error&&t.error(e.message)}},tF=async r=>{try{let l=await (0,J.bV)(r);ec(l.templates),eu(l.template.id),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},tP=async r=>{try{var l,n;let s=await (0,J.h0)(r);ec(s.templates),eu(null!=(n=null==(l=s.templates[0])?void 0:l.id)?n:""),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},tL=async e=>{try{let{validation:r}=await (0,J.SM)(e,tt||void 0);e3(t=>({...t,[e]:r}));let l=r.issues.filter(e=>"error"===e.level);if(eu(e),l.length>0)return void t.warning("模板运行前检查未通过,请先处理阻断项");if(r.issues.length>0)return void t.warning("模板存在警告,可在检查面板确认后继续运行");tb(e)}catch(e){t.error(e instanceof Error?e.message:"模板运行前检查失败")}},tG=async r=>{try{await (0,J.QG)(r.id,r.projectRoot||tt||void 0),eF===r.id&&(eP(null),eB(null),e_("")),await tf(),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},tW=async e=>{for(;;){let{document:t}=await (0,J.v7)(e,!0,tt||void 0);if(tE(t),("completed"===t.status||"warning"===t.status)&&t.draft)return t;if("failed"===t.status||"aborted"===t.status)throw Error(t.error||("aborted"===t.status?"生成已中止":"生成失败"));await new Promise(e=>window.setTimeout(e,1500))}},tN=async()=>{if(!ed)return;if(null==ee?void 0:ee.loading){tn(ee.flowSteps),ti(ee.activeFlowKey),eT(!0);return}if(!tt)return void t.error("未识别当前项目,请先选择或打开项目后再生成文件");eT(!0);let r=(0,J.OX)({templateId:ed,projectRoot:tt});ee={id:Date.now(),templateId:ed,loading:!0,flowSteps:[],activeFlowKey:null,promise:r,listeners:new Set},tn([]),ti(null);let l=[];try{let n=await r;n.documentId&&(localStorage.setItem(tg,n.documentId),eP(n.documentId),(null==ee?void 0:ee.promise)===r&&(ee.documentId=n.documentId)),await tf();let s=n.documentId?await tW(n.documentId):void 0,o=n.draft||(null==s?void 0:s.draft);if(!o)throw Error("生成结果为空");(n.documentId||(null==s?void 0:s.id))&&eP(n.documentId||s.id),l.forEach(e=>window.clearTimeout(e)),eB(o),e_((null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown),(null==ee?void 0:ee.promise)===r&&(ee.draft=o,ee.content=(null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown);let a=s||{id:n.documentId||"draft-".concat(Date.now()),templateId:ed,title:o.title,requirement:o.requirement,projectRoot:o.projectRoot||tt,projectId:o.projectId,markdown:o.markdown,status:o.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!o.exportGate.passed?"warning":"completed",draft:o,executionStages:o.executionStages,assets:o.assets||[],createdAt:o.generatedAt,updatedAt:Date.now()},{steps:c}=tT(a);tn(c),tz(c,"done",!1),ti("done"),(null==ee?void 0:ee.promise)===r&&(ee.activeFlowKey="done",ee.loading=!1,et(),ee=null),localStorage.removeItem(tg),await tf(),t.success(e("common.success")),window.setTimeout(()=>{var e;return null==(e=i.current)?void 0:e.scrollIntoView({behavior:"smooth",block:"start"})},200)}catch(n){localStorage.removeItem(tg);let l=n instanceof Error?n.message:e("common.error");tn(e=>{let t=e.map(e=>"process"===e.status?{...e,status:"error",description:l,subSteps:((e,t)=>{if("wait"===t)return e.subSteps.map(e=>({...e,status:"wait"}));if("finish"===t)return e.subSteps.map(e=>({...e,status:"finish"}));if("error"===t)return e.subSteps.map((e,t)=>({...e,status:0===t?"error":e.status}));let r=e.subSteps.findIndex(e=>"wait"===e.status);return e.subSteps.map((e,t)=>t<r||-1===r?{...e,status:"finish"}:t===r?{...e,status:"process"}:e)})(e,"error")}:e);return tz(t,ts,!1),t}),(null==ee?void 0:ee.promise)===r&&(ee.loading=!1,ee.error=l,et(),ee=null),await tf().catch(()=>void 0),t.error(l)}finally{l.forEach(e=>window.clearTimeout(e)),eT(!1),(null==ee?void 0:ee.promise)===r&&(ee.loading=!1,et())}},tO=(0,n.useRef)(!1);(0,n.useEffect)(()=>(th.current&&(clearTimeout(th.current),th.current=null),!tc||"workflow"!==tu||eF||tO.current||(null==ee?void 0:ee.loading)||null==tj||!tj.projectRoleConfigId||(tO.current=!0,th.current=setTimeout(()=>{th.current=null,tc&&"workflow"===tu&&!eF&&ed==ed&&tN()},300)),tc||(tO.current=!1),()=>{th.current&&(clearTimeout(th.current),th.current=null)}),[tc,tu,eF,tj,ed]);let tH=async e=>{(null==ee?void 0:ee.loading)&&ee.documentId===e.id&&(ee.loading=!1,ee.error="用户中止",et(),ee=null,eT(!1)),localStorage.removeItem(tg),tm.current&&(clearInterval(tm.current),tm.current=null);try{await (0,J.r)(e.id,e.projectRoot||tt||void 0),t.success("已中止生成任务")}catch(e){t.info("任务已不在运行,已刷新状态")}finally{await tf(),eF===e.id&&(eP(null),eB(null),e_(""))}},tK=async r=>{if(eE){eG(r);try{eE.exportGate.passed||t.warning("导出门禁存在风险项,已允许导出,请下载后人工复核。");let e={documentId:eF||void 0,title:eE.title,markdown:eR,format:r,enforceGate:!1,exportGate:eE.exportGate,useClientMarkdown:!0},l=await (0,J.UE)(e);((e,t,r)=>{let l=new Blob([e],{type:r}),n=URL.createObjectURL(l),s=document.createElement("a");s.href=n,s.download=t,s.target="_self",s.rel="noopener",s.style.display="none",document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),s.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)})(l,"".concat(eE.title,".").concat("markdown"===r?"md":r),{markdown:"text/markdown;charset=utf-8",html:"text/html;charset=utf-8",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}[r])}catch(r){t.error(r instanceof Error?r.message:e("common.error"))}finally{eG(null)}}},tq=async()=>{if(eE)try{if(eF)await (0,J.a6)(eF,{editedMarkdown:eR,markdown:eR},eE.projectRoot||tt||void 0);else{let e=await (0,J.Af)({...eE,markdown:eR});eB(e.draft)}await tf(),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},tV=(e,t)=>{e$(r=>[{id:"".concat(Date.now()),content:e,prompt:t,createdAt:Date.now()},...r].slice(0,12))},tU=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&eN(""),eU(null),eQ(null),eY({start:0,end:0})},tX=(e,t)=>{var r,l;return{title:(null==eE?void 0:eE.title)||"未命名文档",markdown:t,instruction:e,facts:null==eE||null==(r=eE.structuredFacts)?void 0:r.map(e=>"".concat(e.key,": ").concat(e.value)),chapters:null==eE||null==(l=eE.chapters)?void 0:l.map(e=>e.title),...(()=>{let e=eJ.start,t=eJ.end;return t>e?{selection:{start:e,end:t,text:eR.slice(e,t)},cursorOffset:e}:{cursorOffset:e}})()}},tQ=async()=>{let r=eW.trim();if(!eE||!r||eO)return;let l=tx.current+1;tx.current=l,eH(!0),eq("planning"),eQ(null);try{let e=await (0,J.Gi)({mode:"plan",...tX(r,eR)});if(tx.current!==l||eF!=eF)return;if(!e.plan)throw Error("AI 未返回修改计划");eU(e.plan)}catch(r){tx.current===l&&t.error(r instanceof Error?r.message:e("common.error"))}finally{tx.current===l&&(eH(!1),eq("idle"))}},tJ=async r=>{let l=eW.trim();if(!eE||!l||eO)return;let n=tx.current+1;tx.current=n,eH(!0),eq("applying");try{let e=await (0,J.Gi)({mode:"apply",...tX(l,eR),plan:r});if(tx.current!==n||eF!=eF)return;if(!e.markdown)throw Error("AI 未返回修改结果");eQ({plan:e.plan||r,markdown:e.markdown,beforeSnippet:e.beforeSnippet,afterSnippet:e.afterSnippet,summary:e.summary,changedChars:e.changedChars,prompt:l,before:eR})}catch(r){tx.current===n&&t.error(r instanceof Error?r.message:e("common.error"))}finally{tx.current===n&&(eH(!1),eq("idle"))}};if(eI)return(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsx)(u.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,l.jsx)(u.A,{active:!0,paragraph:{rows:2}}),(0,l.jsx)(u.A,{active:!0,paragraph:{rows:8}})]});let tY="workflow"===tu?"工作流:".concat((null==tj?void 0:tj.name)||"选择模板"):"编辑:".concat((null==eE?void 0:eE.title)||(null==tj?void 0:tj.outputTitle)||"文档");return(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"pageTitle",children:e("documents.title")}),(0,l.jsx)("p",{className:"pageDesc",children:e("documents.description")})]}),(0,l.jsx)(p.Ay,{type:"primary",icon:(0,l.jsx)(N.A,{}),onClick:()=>t_(),children:e("documents.newTemplate")})]}),(0,l.jsx)(m.A,{size:"small",tabList:[{key:"templates",label:"模板库 (".concat(R.length,")")},{key:"drafts",label:"生成记录 (".concat(eM.length,")")}],activeTabKey:to,onTabChange:ta,children:"templates"===to?0===R.length?(0,l.jsx)(h.A,{description:e("common.noData")}):(0,l.jsx)(x.A,{dataSource:R,renderItem:t=>(0,l.jsx)(x.A.Item,{style:{cursor:"pointer",padding:"10px 0"},actions:[(0,l.jsx)(p.Ay,{size:"small",icon:(0,l.jsx)(O.A,{}),onClick:e=>{e.stopPropagation(),t_(t)},children:"配置"},"cfg"),(0,l.jsx)(p.Ay,{size:"small",type:"primary",icon:(0,l.jsx)(H.A,{}),onClick:e=>{e.stopPropagation(),tL(t.id)},children:"运行"},"run"),(0,l.jsx)(p.Ay,{size:"small",icon:(0,l.jsx)(K.A,{}),onClick:e=>{e.stopPropagation(),tF(t.id)}},"copy"),(0,l.jsx)(g.A,{title:e("documents.deleteTemplateConfirm"),onConfirm:e=>{null==e||e.stopPropagation(),tP(t.id)},children:(0,l.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,l.jsx)(W.A,{}),onClick:e=>e.stopPropagation()})},"del")],onClick:()=>eu(t.id),children:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[function(e,t){let r=el[e]||(0,l.jsx)(P.A,{});return(0,l.jsx)("span",{style:{color:t?"var(--colorAccent)":"var(--colorTextSecondary)",fontSize:16,marginTop:2,flexShrink:0},children:r})}(t.category,ed===t.id),(0,l.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,l.jsx)("span",{style:{fontWeight:ed===t.id?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),ed===t.id&&(0,l.jsx)(a.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"当前"}),(0,l.jsx)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:t.category}),e8[t.id]&&(0,l.jsxs)(a.A,{color:e8[t.id].issues.some(e=>"error"===e.level)?"error":e8[t.id].issues.length?"warning":"success",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:["检查 ",e8[t.id].fileDiagnostics.length," 文件 / ",e8[t.id].promptDiagnostics.length," 提示词"]})]}),t.description&&(0,l.jsx)($,{type:"secondary",style:{fontSize:12,lineHeight:"18px"},children:t.description}),e8[t.id]&&(0,l.jsx)("div",{onClick:e=>e.stopPropagation(),style:{marginTop:8,padding:10,border:"1px solid ".concat(e8[t.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBorder)":e8[t.id].issues.length?"var(--colorWarningBorder)":"var(--colorSuccessBorder)"),borderRadius:10,background:e8[t.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBg)":e8[t.id].issues.length?"var(--colorWarningBg)":"var(--colorSuccessBg)"},children:(0,l.jsxs)(o.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)($,{strong:!0,children:e8[t.id].issues.some(e=>"error"===e.level)?"运行前检查未通过":e8[t.id].issues.length?"运行前检查存在警告":"运行前检查通过"}),(0,l.jsxs)(a.A,{color:"blue",children:["文件角色 ",e8[t.id].fileDiagnostics.length]}),(0,l.jsxs)(a.A,{color:"purple",children:["提示词角色 ",e8[t.id].promptDiagnostics.length]})]}),e8[t.id].issues.length>0?e8[t.id].issues.map(e=>(0,l.jsx)(f.A,{type:"error"===e.level?"error":"warning",message:e.message,showIcon:!0},e.message)):(0,l.jsx)(f.A,{type:"success",message:"文件角色、提示词角色和后台自动规范检查通过,可以运行。",showIcon:!0}),!e8[t.id].issues.some(e=>"error"===e.level)&&e8[t.id].issues.length>0&&(0,l.jsx)("div",{children:(0,l.jsx)(p.Ay,{size:"small",type:"primary",icon:(0,l.jsx)(H.A,{}),onClick:()=>tb(t.id),children:"忽略警告并继续运行"})})]})})]})]})})}):0===eM.length?(0,l.jsx)(h.A,{description:e("common.noData")}):(0,l.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:eM.slice(0,15).map((e,t)=>{var r,n,s;let i,c;return(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,padding:"10px 12px",border:"1px solid var(--colorBorderSecondary)",borderRadius:10,cursor:"pointer",background:eF===e.id?"var(--colorFillAlter)":void 0,minWidth:0},onClick:()=>{tI(e)},children:["completed"===e.status?(0,l.jsx)(M.A,{style:{fontSize:18,color:"var(--colorOk)",flexShrink:0,marginTop:2}}):"failed"===e.status||"aborted"===e.status?(0,l.jsx)(q.A,{style:{fontSize:18,color:"var(--colorDanger)",flexShrink:0,marginTop:2}}):"warning"===e.status?(0,l.jsx)(_.A,{style:{fontSize:18,color:"var(--colorWarning)",flexShrink:0,marginTop:2}}):(0,l.jsx)(V.A,{spin:!0,style:{fontSize:18,color:"#1677ff",flexShrink:0,marginTop:2}}),(0,l.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,l.jsx)("div",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:3},children:e.title}),(0,l.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px 10px",color:"var(--colorTextSecondary)",fontSize:11},children:[(0,l.jsx)("span",{children:new Date(e.updatedAt).toLocaleString()}),(0,l.jsxs)("span",{children:["耗时 ",(e=>{let t=Math.max(0,Math.round(((e.completedAt||e.updatedAt)-e.createdAt)/1e3));if(t<60)return"".concat(t," 秒");let r=Math.floor(t/60),l=t%60;if(r<60)return l?"".concat(r," 分 ").concat(l," 秒"):"".concat(r," 分");let n=Math.floor(r/60),s=r%60;return s?"".concat(n," 小时 ").concat(s," 分"):"".concat(n," 小时")})(e)]})]}),("warning"===e.status||"failed"===e.status||"aborted"===e.status)&&(0,l.jsx)("div",{style:{marginTop:3,color:"failed"===e.status||"aborted"===e.status?"var(--colorError)":"var(--colorWarning)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.error||(null==(r=e.warningIssues)?void 0:r[0])||(null==(s=e.draft)||null==(n=s.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message)||"需复核"})]}),(0,l.jsxs)(o.A,{size:4,align:"center",children:[(0,l.jsx)(a.A,{color:"completed"===(i=e.status)?"success":"warning"===i?"warning":"failed"===i?"error":"aborted"===i?"default":"processing",style:{margin:0,fontSize:10,lineHeight:"18px"},children:"completed"===(c=e.status)?"已完成":"warning"===c?"需复核":"failed"===c?"失败":"aborted"===c?"已中止":"生成中"}),(0,l.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"18px"},children:["#",t+1]}),(0,l.jsx)(g.A,{title:"确认删除?",onConfirm:t=>{null==t||t.stopPropagation(),tG(e)},children:(0,l.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,l.jsx)(W.A,{}),onClick:e=>e.stopPropagation()})}),tC(e.status)&&(0,l.jsx)(g.A,{title:"确定中止此生成任务?",onConfirm:t=>{null==t||t.stopPropagation(),tH(e)},children:(0,l.jsx)(p.Ay,{size:"small",danger:!0,onClick:e=>e.stopPropagation(),children:"中止"})}),(0,l.jsx)(p.Ay,{size:"small",type:"primary",icon:tC(e.status)?(0,l.jsx)(V.A,{spin:!0}):(0,l.jsx)(H.A,{}),onClick:t=>{t.stopPropagation(),tI(e)},children:"打开"})]})]},e.id)})})}),(0,l.jsx)(j.A,{title:tY,open:tc,onClose:()=>{td(!1),tm.current&&(clearInterval(tm.current),tm.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:eE?(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)(p.Ay,{icon:(0,l.jsx)(U.A,{}),disabled:eO,onClick:()=>{tq()},children:e("documents.saveDraft")}),(0,l.jsx)(p.Ay,{icon:(0,l.jsx)(X.A,{}),disabled:eO,loading:"markdown"===eL,onClick:()=>{tK("markdown")},children:"MD"}),(0,l.jsx)(p.Ay,{disabled:eO,loading:"html"===eL,onClick:()=>{tK("html")},children:"HTML"}),(0,l.jsx)(p.Ay,{disabled:eO,loading:"docx"===eL,onClick:()=>{tK("docx")},children:"DOCX"}),(0,l.jsx)(p.Ay,{type:"primary",disabled:eO,loading:"pdf"===eL,onClick:()=>{tK("pdf")},children:"PDF"})]}):ez&&"workflow"===tu?(0,l.jsx)(p.Ay,{danger:!0,onClick:()=>{(async()=>{eF&&await (0,J.r)(eF,tt||void 0).catch(()=>void 0),ee&&(ee.loading=!1,ee.error="用户中止",et(),ee=null),localStorage.removeItem(tg),tm.current&&(clearInterval(tm.current),tm.current=null),eT(!1),tn([]),ti(null),td(!1),await tf(),t.info("已中止生成任务")})()},children:"中止任务"}):void 0,children:(0,l.jsxs)(o.A,{direction:"vertical",style:{width:"100%"},size:"middle",children:["workflow"===tu&&tl.length>0&&(0,l.jsx)(y.A,{direction:"vertical",size:"small",current:tv,items:tl.map(e=>{let t;return{title:e.title,description:(0,l.jsxs)("div",{children:[e.subtitle&&(0,l.jsx)("div",{style:{marginBottom:4},children:(0,l.jsx)(a.A,{children:e.subtitle})}),(0,l.jsx)("div",{children:e.description}),(0,l.jsx)("div",{style:{marginTop:4},children:e.subSteps.map(e=>{var t;return(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:12,color:"var(--colorTextSecondary)"},children:["process"===(t=e.status)?(0,l.jsx)(G.A,{}):"finish"===t?(0,l.jsx)(M.A,{}):"warning"===t?(0,l.jsx)(_.A,{style:{color:"var(--colorWarning)"}}):"error"===t?(0,l.jsx)(W.A,{}):(0,l.jsx)("span",{style:{display:"inline-block",height:6,width:6,borderRadius:"50%",background:"var(--colorTextTertiary)"}}),(0,l.jsx)("span",{children:e.title})]},e.key)})})]}),status:"warning"===(t=e.status)?"finish":t,icon:"process"===e.status?(0,l.jsx)(G.A,{}):"warning"===e.status?(0,l.jsx)(_.A,{style:{color:"var(--colorWarning)"}}):e.icon}})}),"workflow"===tu&&ez&&0===tl.length&&(0,l.jsx)("div",{style:{textAlign:"center",padding:40},children:(0,l.jsx)(v.A,{tip:"正在准备生成…"})}),eE&&(0,l.jsx)("div",{ref:i,children:(0,l.jsx)(w.A,{items:[{key:"edit",label:e("documents.edit"),children:(0,l.jsxs)(o.A,{direction:"vertical",size:"middle",style:{width:"100%"},children:[(0,l.jsx)(Z,{rows:28,value:eR,disabled:eO,onSelect:e=>{var t,r,l;return eY({start:null!=(t=e.currentTarget.selectionStart)?t:0,end:null!=(l=null!=(r=e.currentTarget.selectionEnd)?r:e.currentTarget.selectionStart)?l:0})},onChange:e=>{var t,r,l;e_(e.target.value),eU(null),eQ(null),eY({start:null!=(t=e.target.selectionStart)?t:0,end:null!=(l=null!=(r=e.target.selectionEnd)?r:e.target.selectionStart)?l:0})}}),(0,l.jsx)(m.A,{size:"small",style:{borderRadius:12,background:"linear-gradient(135deg, var(--colorFillAlter), var(--colorBgContainer))"},children:(0,l.jsxs)(o.A,{direction:"vertical",size:"middle",style:{width:"100%"},children:[(0,l.jsxs)(o.A,{align:"start",style:{width:"100%",justifyContent:"space-between"},children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)(o.A,{size:6,children:[(0,l.jsx)(D.A,{style:{color:"var(--colorAccent)"}}),(0,l.jsx)($,{strong:!0,children:"精准修改"}),(0,l.jsx)(a.A,{color:"blue",children:"AI 辅助"})]}),(0,l.jsx)("div",{style:{marginTop:4,color:"var(--colorTextSecondary)",fontSize:12},children:"针对当前编辑内容补充更具体的要求,AI 会保留文档结构并按你的提示细化修改。"})]}),(0,l.jsxs)(p.Ay,{size:"small",icon:(0,l.jsx)(Q.A,{}),onClick:()=>e1(e=>!e),disabled:0===eZ.length,children:["历史版本 ",eZ.length>0?eZ.length:""]})]}),(0,l.jsx)(f.A,{type:"info",showIcon:!0,message:"系统只负责识别修改范围,不改写你的提示词;选中文字后优先只改选区,没有选区时按光标所在小节/章节定位。"}),(0,l.jsx)(Z,{rows:4,value:eW,disabled:eO,onChange:e=>{eN(e.target.value),eU(null),eQ(null)},placeholder:"例如:写细一点;润色这段;第七章补充高处作业和临电安全措施;把安全检查频次改成每周一次。"}),(0,l.jsxs)(o.A,{wrap:!0,style:{width:"100%",justifyContent:"space-between"},children:[(0,l.jsx)(o.A,{wrap:!0,children:["写细一点","更专业","只润色选区","补充可执行措施"].map(e=>(0,l.jsx)(p.Ay,{size:"small",disabled:eO,onClick:()=>eN(t=>t?"".concat(t,";").concat(e):e),children:e},e))}),(0,l.jsx)(p.Ay,{type:"primary",icon:(0,l.jsx)(D.A,{}),loading:eO&&"planning"===eK,disabled:!eW.trim()||eO,onClick:()=>{tQ()},children:"识别修改范围"})]}),eV&&!eX&&(0,l.jsx)(m.A,{size:"small",style:{borderRadius:10,borderColor:"var(--colorAccent)"},children:(0,l.jsxs)(o.A,{direction:"vertical",size:"small",style:{width:"100%"},children:[(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)(a.A,{color:"purple",children:eV.scope}),(0,l.jsx)(a.A,{color:"blue",children:eV.action}),(0,l.jsxs)(a.A,{color:eV.confidence>=.8?"green":"orange",children:["置信度 ",Math.round(100*eV.confidence),"%"]}),eV.targetTitle&&(0,l.jsx)($,{strong:!0,children:eV.targetTitle})]}),(0,l.jsx)($,{children:eV.summary}),(0,l.jsx)($,{type:"secondary",style:{fontSize:12},children:"将按你的原始提示词执行,不添加额外编辑任务。"}),(0,l.jsxs)(o.A,{children:[(0,l.jsx)(p.Ay,{type:"primary",loading:eO&&"applying"===eK,onClick:()=>{tJ(eV)},children:"执行并预览"}),(0,l.jsx)(p.Ay,{disabled:eO,onClick:()=>eU(null),children:"取消"})]})]})}),eX&&(0,l.jsx)(m.A,{size:"small",style:{borderRadius:10,borderColor:"var(--colorSuccess)"},children:(0,l.jsxs)(o.A,{direction:"vertical",size:"small",style:{width:"100%"},children:[(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)(a.A,{color:"green",children:"修改预览"}),(0,l.jsx)($,{children:eX.summary||eX.plan.summary}),(0,l.jsxs)(a.A,{children:[eX.changedChars&&eX.changedChars>0?"+".concat(eX.changedChars):eX.changedChars," 字符"]})]}),(0,l.jsxs)(A.A,{gutter:12,children:[(0,l.jsxs)(S.A,{span:12,children:[(0,l.jsx)($,{strong:!0,children:"修改前"}),(0,l.jsx)("div",{style:{marginTop:6,maxHeight:180,overflow:"auto",padding:10,borderRadius:8,background:"var(--colorFillAlter)",whiteSpace:"pre-wrap",fontSize:12},children:eX.beforeSnippet||"无片段预览"})]}),(0,l.jsxs)(S.A,{span:12,children:[(0,l.jsx)($,{strong:!0,children:"修改后"}),(0,l.jsx)("div",{style:{marginTop:6,maxHeight:180,overflow:"auto",padding:10,borderRadius:8,background:"var(--colorFillAlter)",whiteSpace:"pre-wrap",fontSize:12},children:eX.afterSnippet||"无片段预览"})]})]}),(0,l.jsxs)(o.A,{children:[(0,l.jsx)(p.Ay,{type:"primary",onClick:()=>{eX&&(tV(eX.before,eX.prompt),e_(eX.markdown),tU(!0),t.success("已应用精准修改"))},children:"应用到文档"}),(0,l.jsx)(p.Ay,{onClick:()=>eQ(null),children:"返回计划"}),(0,l.jsx)(p.Ay,{danger:!0,onClick:()=>{eU(null),eQ(null)},children:"放弃"})]})]})}),e0&&(0,l.jsx)("div",{style:{borderTop:"1px solid var(--colorBorderSecondary)",paddingTop:12},children:(0,l.jsx)(x.A,{size:"small",dataSource:eZ,locale:{emptyText:"暂无历史版本"},renderItem:e=>(0,l.jsx)(x.A.Item,{actions:[(0,l.jsx)(p.Ay,{size:"small",disabled:eO,onClick:()=>{tV(eR,"恢复前版本"),e_(e.content),tU(!0),t.success("已恢复历史版本")},children:"恢复"},"restore")],children:(0,l.jsx)(x.A.Item.Meta,{title:(0,l.jsxs)(o.A,{children:[(0,l.jsx)($,{children:new Date(e.createdAt).toLocaleString()}),(0,l.jsx)(a.A,{children:e.prompt})]}),description:(0,l.jsx)($,{type:"secondary",ellipsis:!0,children:e.content.replace(/\s+/gu," ").slice(0,120)})})})})})]})})]})},{key:"chapters-facts",label:"章节与事实",children:(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[eE.chapters.length>0&&(0,l.jsxs)("div",{children:[(0,l.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["章节 (",eE.chapters.length,")"]}),(0,l.jsx)(x.A,{size:"small",dataSource:eE.chapters,renderItem:e=>(0,l.jsx)(x.A.Item,{children:(0,l.jsx)(x.A.Item.Meta,{title:e.title,description:"证据: ".concat(e.evidence.length," \xb7 缺失: ").concat(e.missingFacts.length)})})})]}),eE.structuredFacts.length>0&&(0,l.jsxs)("div",{children:[(0,l.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["结构化事实 (",eE.structuredFacts.length,")"]}),(0,l.jsx)(k.A,{size:"small",column:1,bordered:!0,children:eE.structuredFacts.map((e,t)=>(0,l.jsxs)(k.A.Item,{label:e.key,children:[(0,l.jsx)("span",{children:e.value}),(0,l.jsx)(a.A,{style:{marginLeft:8},children:e.confidence.toFixed(2)}),(0,l.jsx)($,{type:"secondary",style:{fontSize:11,marginLeft:8},children:e.sourceFile})]},t))})]})]})},{key:"sources-missing",label:"来源与缺失",children:(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["引用来源 (",eE.sources.length,")"]}),0===eE.sources.length?(0,l.jsx)(h.A,{description:"暂无"}):(0,l.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:eE.sources.map(e=>(0,l.jsxs)(a.A,{color:"blue",children:[e.filePath," (",e.count,")"]},e.filePath))})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["缺失项 (",eE.missingItems.length,")"]}),0===eE.missingItems.length?(0,l.jsx)(h.A,{description:"无缺失"}):(0,l.jsx)(x.A,{size:"small",dataSource:eE.missingItems,renderItem:e=>(0,l.jsx)(x.A.Item,{children:e})})]})]})},{key:"validation",label:"校验 (".concat(eE.validationIssues.length,")"),children:0===eE.validationIssues.length?(0,l.jsx)(h.A,{description:"校验通过"}):(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[eE.validationIssues.map(e=>(0,l.jsxs)("div",{style:{border:"1px solid var(--colorBorderSecondary)",borderRadius:8,padding:12},children:[(0,l.jsx)(a.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:e.level}),(0,l.jsx)("div",{style:{marginTop:6,whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.message}),e.suggestion&&(0,l.jsx)("div",{style:{marginTop:6,color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all"},children:e.suggestion})]},"".concat(e.level,"-").concat(e.message))),eE.exportGate.checklist.length>0&&(0,l.jsxs)("div",{style:{marginTop:8},children:[(0,l.jsx)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:"导出门禁"}),(0,l.jsx)(x.A,{size:"small",dataSource:eE.exportGate.checklist,renderItem:e=>(0,l.jsxs)(x.A.Item,{children:[(0,l.jsx)($,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.label}),(0,l.jsx)(a.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})]})]})},{key:"stages",label:"执行阶段 (".concat(eE.executionStages.length,")"),children:(0,l.jsx)(x.A,{size:"small",dataSource:eE.executionStages,renderItem:e=>(0,l.jsxs)(x.A.Item,{children:[(0,l.jsx)(x.A.Item.Meta,{avatar:er[e.type]||(0,l.jsx)(P.A,{}),title:(0,l.jsx)($,{title:e.roleId,style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:"".concat(eo[e.type]||e.type," \xb7 ").concat(e.roleName||tw(e.roleId))}),description:(0,l.jsx)($,{type:"secondary",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})}),(0,l.jsx)(a.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})})}]})})]})}),(0,l.jsx)(j.A,{title:e("documents.templateEditor"),open:e2,onClose:()=>e6(!1),width:860,maskClosable:!1,styles:{body:{padding:20,overflow:"auto"},header:{borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,l.jsxs)(o.A,{children:[(0,l.jsx)(p.Ay,{onClick:()=>e6(!1),children:e("common.cancel")}),(0,l.jsx)(p.Ay,{type:"primary",onClick:()=>{tD()},children:e("common.save")})]}),children:(0,l.jsxs)(d.A,{form:r,layout:"vertical",requiredMark:"optional",children:[(0,l.jsxs)(A.A,{gutter:12,children:[(0,l.jsx)(d.A.Item,{name:"id",hidden:!0,children:(0,l.jsx)(s.A,{})}),(0,l.jsx)(S.A,{xs:24,md:8,children:(0,l.jsx)(d.A.Item,{name:"name",label:e("documents.templateName"),rules:[{required:!0}],children:(0,l.jsx)(s.A,{})})}),(0,l.jsx)(S.A,{xs:24,md:8,children:(0,l.jsx)(d.A.Item,{name:"category",label:e("documents.templateCategory"),children:(0,l.jsx)(s.A,{})})}),(0,l.jsx)(S.A,{xs:24,md:8,children:(0,l.jsx)(d.A.Item,{name:"outputTitle",label:e("documents.outputTitle"),children:(0,l.jsx)(s.A,{})})}),(0,l.jsx)(S.A,{xs:24,md:12,children:(0,l.jsx)(d.A.Item,{name:"description",label:e("documents.templateDescription"),children:(0,l.jsx)(s.A,{})})})]}),(0,l.jsx)(d.A.Item,{name:"projectRoleConfigId",label:e("documents.projectRoleConfig"),rules:[{required:!0,message:e("documents.projectRoleConfigRequired")}],children:(0,l.jsx)(b.A,{showSearch:!0,placeholder:e("documents.projectRoleConfigRequired"),options:ty})}),(0,l.jsxs)("div",{style:{marginBottom:16},children:[(0,l.jsxs)(o.A,{style:{width:"100%",justifyContent:"space-between",marginBottom:8},children:[(0,l.jsx)($,{strong:!0,children:"项目文件绑定"}),(0,l.jsx)(a.A,{color:"blue",children:"按文件角色多选"})]}),(0,l.jsx)(f.A,{type:"info",showIcon:!0,style:{marginBottom:12},message:"每个文件角色可直接勾选文件或文件夹;勾选文件夹会自动绑定该文件夹下所有文件。保存时仍按具体文件路径绑定,兼容现有模板和生成流程。"}),(0,l.jsx)(s.A.Search,{allowClear:!0,placeholder:"搜索文件或文件夹",value:eA,onChange:e=>eS(e.target.value),style:{marginBottom:12}}),ev?(0,l.jsx)("div",{style:{textAlign:"center",padding:24},children:(0,l.jsx)(v.A,{tip:"正在加载知识库文件…"})}):0===e4.length?(0,l.jsx)(h.A,{image:h.A.PRESENTED_IMAGE_SIMPLE,description:"暂无可用文件角色"}):0===e7.length?(0,l.jsx)(h.A,{image:h.A.PRESENTED_IMAGE_SIMPLE,description:"暂无知识库文件"}):e4.map(e=>{let t=en(e5[e.value]||[]).filter(e=>te.includes(e)),r=new Set(ei(e9));return(0,l.jsxs)(m.A,{size:"small",style:{marginBottom:12},title:(0,l.jsxs)(o.A,{children:[(0,l.jsx)($,{children:e.label}),(0,l.jsxs)(a.A,{color:"blue",children:["已选 ",t.length]})]}),extra:(0,l.jsx)(p.Ay,{size:"small",disabled:0===t.length,onClick:()=>tM(e.value,[]),children:"清空"}),children:[(0,l.jsx)(d.A.Item,{name:["fileBindingGroups",e.value],hidden:!0,children:(0,l.jsx)(s.A,{})}),(0,l.jsx)("div",{style:{marginBottom:8,color:"var(--colorTextSecondary)",fontSize:12},children:t.length>0?t.slice(0,3).map(es).join("、")+(t.length>3?" 等 ".concat(t.length," 个文件"):""):"未选择文件"}),(0,l.jsx)(I.A,{checkable:!0,blockNode:!0,height:320,treeData:e9,checkedKeys:t,expandedKeys:eA.trim()?tr:ek,onExpand:e=>eb(e),onCheck:(l,n)=>{let s=new Set(t.filter(e=>!r.has(e)));for(let e of n.checkedNodes)e.isFolder?ei([e]).forEach(e=>s.add(e)):s.add(e.key);tM(e.value,Array.from(s))}})]},e.value)})]}),(0,l.jsx)(f.A,{type:"info",showIcon:!0,message:"文档规范由后台根据模板、提示词和角色绑定自动生成,无需手动维护规范包。"})]})})]})}}},e=>{e.O(0,[433,787,576,195,375,455,506,940,499,636,593,792],()=>e(e.s=16403)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,e,t,c,a,n,d,i,u,r,o,k,f,g,h,l,b,j,m,p){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:g,bitArray:[]},__routerFilterDynamic:{numItems:r,errorRate:1e-4,numBits:r,numHashes:g,bitArray:[]},"/":[s,e,h,l,"static/chunks/pages/index-a2a24e9602e7ea52.js"],"/_error":["static/chunks/pages/_error-282257fbdcc167b4.js"],"/asset-library":[s,e,n,"static/chunks/317-18aac52df5551e76.js","static/chunks/pages/asset-library-1dc916735fd12e11.js"],"/context/long-term":[s,e,t,c,a,d,n,i,u,b,"static/chunks/pages/context/long-term-994425812e118c6c.js"],"/context/short-term":[s,e,t,c,a,d,n,i,u,b,"static/chunks/pages/context/short-term-fcae99e1744d998a.js"],"/document-roles":[s,e,t,c,u,"static/chunks/496-4fb9a063790e65ff.js","static/chunks/pages/document-roles-fd02980db151650c.js"],"/documents":[s,e,t,c,d,u,o,j,"static/chunks/499-d6bcc76195b28550.js","static/chunks/pages/documents-
|
|
1
|
+
self.__BUILD_MANIFEST=function(s,e,t,c,a,n,d,i,u,r,o,k,f,g,h,l,b,j,m,p){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:g,bitArray:[]},__routerFilterDynamic:{numItems:r,errorRate:1e-4,numBits:r,numHashes:g,bitArray:[]},"/":[s,e,h,l,"static/chunks/pages/index-a2a24e9602e7ea52.js"],"/_error":["static/chunks/pages/_error-282257fbdcc167b4.js"],"/asset-library":[s,e,n,"static/chunks/317-18aac52df5551e76.js","static/chunks/pages/asset-library-1dc916735fd12e11.js"],"/context/long-term":[s,e,t,c,a,d,n,i,u,b,"static/chunks/pages/context/long-term-994425812e118c6c.js"],"/context/short-term":[s,e,t,c,a,d,n,i,u,b,"static/chunks/pages/context/short-term-fcae99e1744d998a.js"],"/document-roles":[s,e,t,c,u,"static/chunks/496-4fb9a063790e65ff.js","static/chunks/pages/document-roles-fd02980db151650c.js"],"/documents":[s,e,t,c,d,u,o,j,"static/chunks/499-d6bcc76195b28550.js","static/chunks/pages/documents-141b9ab2dba47ae7.js"],"/guide":[s,e,j,"static/chunks/20-86ac6910225cce4e.js","static/chunks/pages/guide-295174493709ecbb.js"],"/knowledge":["static/chunks/pages/knowledge-905248d8dcb15453.js"],"/knowledge/file-detail":[s,e,t,a,d,n,i,o,m,k,"static/chunks/pages/knowledge/file-detail-87669392540614e4.js"],"/knowledge/files":[s,e,t,a,d,n,i,k,"static/chunks/pages/knowledge/files-14ef1012fd201e47.js"],"/knowledge/manage":[s,e,o,"static/chunks/788-7f7359a830e3f4fd.js","static/chunks/pages/knowledge/manage-ed99a6cb254ddbb7.js"],"/knowledge/search":[s,e,t,o,p,k,"static/chunks/pages/knowledge/search-afb423fc22eb623b.js"],"/models":[s,e,t,c,a,u,p,"static/chunks/647-d5e08fda405f7059.js","static/chunks/pages/models-d5e80645dc4a61b1.js"],"/overview":[s,e,h,l,"static/chunks/pages/overview-1260176045ed5f7a.js"],"/prompt":[s,e,t,c,a,"static/chunks/525-5d947137d894f5fe.js","static/chunks/pages/prompt-9b869fbe3463020d.js"],"/settings":[s,e,"static/chunks/pages/settings-fa9d6a56898ba678.js"],"/system/logs":[s,t,c,a,d,n,i,m,"static/chunks/pages/system/logs-cbeeb77dc70086ae.js"],sortedPages:["/","/_app","/_error","/asset-library","/context/long-term","/context/short-term","/document-roles","/documents","/guide","/knowledge","/knowledge/file-detail","/knowledge/files","/knowledge/manage","/knowledge/search","/models","/overview","/prompt","/settings","/system/logs"]}}("static/chunks/433-233659be69169c19.js","static/chunks/787-c18af810af3433f6.js","static/chunks/576-6699fed6c88502fe.js","static/chunks/195-2c0168eacab722d2.js","static/chunks/985-4b4a3ed36ada16eb.js","static/chunks/102-881dcc464f983c89.js","static/chunks/375-4a1c73eb22d653d2.js","static/chunks/289-0031e62ca424247b.js","static/chunks/455-97ad88d6604f54b7.js",0,"static/chunks/506-93f730bc149d0dce.js","static/css/09be1fdeab8595ab.css",1e-4,NaN,"static/chunks/694-2d545cfbb9779f2c.js","static/chunks/795-d8fb7a0420512701.js","static/chunks/932-2f195f4200ce9378.js","static/chunks/940-7cb66111eee2f9fb.js","static/chunks/861-91cbdd34b8e23151.js","static/chunks/938-45efd516bb130bd5.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@customize-agent/server",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.68",
|
|
4
4
|
"description": "Customize Agent Web 管理控制台",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json"
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"tesseract.js": "^7.0.0",
|
|
51
51
|
"typescript": "^6.0.3",
|
|
52
52
|
"xlsx": "^0.18.5",
|
|
53
|
-
"@customize-agent/knowledge": "^4.0.
|
|
54
|
-
"@customize-agent/
|
|
55
|
-
"@customize-agent/
|
|
53
|
+
"@customize-agent/knowledge": "^4.0.28",
|
|
54
|
+
"@customize-agent/runtime": "^3.0.9",
|
|
55
|
+
"@customize-agent/llm": "^3.0.9"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@tailwindcss/postcss": "^4.3.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{16403:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return r(19562)}])},19562:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>ec});var l=r(65321),n=r(97109),s=r(7576),i=r(35292),o=r(33442),a=r(11702),c=r(17807),d=r(63455),u=r(88762),p=r(85114),m=r(68787),h=r(84253),x=r(38332),g=r(26171),f=r(85493),j=r(34052),y=r(9730),v=r(42700),w=r(58569),A=r(2256),S=r(38770),k=r(76506),b=r(57271),I=r(49604),C=r(23216),z=r(16285),T=r(26619),E=r(8263),B=r(8579),_=r(75548),R=r(7851),D=r(84742),M=r(29071),F=r(63552),P=r(26631),G=r(29606),L=r(83914),W=r(58209),N=r(54746),O=r(71330),H=r(64068),K=r(93051),q=r(38762),V=r(64629),U=r(67547),X=r(76830),Q=r(1310),J=r(6578),Y=r(79059);let{TextArea:Z}=s.A,{Text:$}=i.A,ee=null;function et(){null==ee||ee.listeners.forEach(e=>e())}let er={role_binding:(0,l.jsx)(C.A,{}),context_recall:(0,l.jsx)(z.A,{}),knowledge_retrieval:(0,l.jsx)(T.A,{}),file_understanding:(0,l.jsx)(E.A,{}),fact_extraction:(0,l.jsx)(z.A,{}),chapter_generation:(0,l.jsx)(B.A,{}),asset_generation:(0,l.jsx)(_.A,{}),validation:(0,l.jsx)(R.A,{}),formatting:(0,l.jsx)(D.A,{}),llm_review:(0,l.jsx)(M.A,{}),export_ready:(0,l.jsx)(F.A,{}),reference:(0,l.jsx)(_.A,{})},el={施工组织设计:(0,l.jsx)(R.A,{}),投标文件:(0,l.jsx)(F.A,{}),技术方案:(0,l.jsx)(z.A,{}),报告:(0,l.jsx)(P.A,{}),自定义:(0,l.jsx)(B.A,{})};function en(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function es(e){return e?e.split(/[\\/]/u).pop()||e:""}function ei(e){let t=[],r=e=>{for(let l of e)l.isFolder?l.children&&r(l.children):t.push(l.key)};return r(e),t}let eo={role_binding:"角色配置绑定",context_recall:"上下文召回",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",asset_generation:"多模态资源生成",validation:"规则校验",formatting:"格式化排版",llm_review:"LLM 审查优化",export_ready:"导出就绪",reference:"参考资源处理"},ea={"knowledge-base":"知识库","document-readiness":"生成准备度检查","quality-repair":"质量补写","export-gate":"导出门禁","context-memory":"项目上下文","final-format":"正式排版","multimodal-files":"多模态文件理解",tender_announcement:"招标公告"};function ec(){let e=(0,Y.Vr)(),{message:t}=c.A.useApp(),[r]=d.A.useForm(),i=(0,n.useRef)(null),[_,ec]=(0,n.useState)([]),[ed,eu]=(0,n.useState)("construction-organization-design"),[ep,em]=(0,n.useState)([]),[eh,ex]=(0,n.useState)([]),[eg,ef]=(0,n.useState)([]),[ej,ey]=(0,n.useState)([]),[ev,ew]=(0,n.useState)(!1),[eA,eS]=(0,n.useState)(""),[ek,eb]=(0,n.useState)([]),[eI,eC]=(0,n.useState)(!0),[ez,eT]=(0,n.useState)(!1),[eE,eB]=(0,n.useState)(null),[e_,eR]=(0,n.useState)(""),[eD,eM]=(0,n.useState)([]),[eF,eP]=(0,n.useState)(null),[eG,eL]=(0,n.useState)(null),[eW,eN]=(0,n.useState)(""),[eO,eH]=(0,n.useState)(!1),[eK,eq]=(0,n.useState)("idle"),[eV,eU]=(0,n.useState)(null),[eX,eQ]=(0,n.useState)(null),[eJ,eY]=(0,n.useState)({start:0,end:0}),[eZ,e$]=(0,n.useState)([]),[e0,e1]=(0,n.useState)(!1),[e2,e6]=(0,n.useState)(!1),[e8,e3]=(0,n.useState)({}),e4=ep.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),e5=d.A.useWatch("fileBindingGroups",r)||{},e7=(0,n.useMemo)(()=>(function(e){let t={};for(let n of[...e].sort((e,t)=>e.relativePath.localeCompare(t.relativePath,"zh-CN"))){let e=n.relativePath.split("/").filter(Boolean),s="";for(let i=0;i<e.length;i++){let a=e[i],c=s;s=s?"".concat(s,"/").concat(a):a;let d=i===e.length-1;if(!t[s]){var r;t[s]={key:s,rawTitle:a,title:d?(0,l.jsx)("span",{title:n.relativePath,children:a}):(0,l.jsxs)(o.A,{size:4,children:[(0,l.jsx)(G.A,{style:{color:"#faad14"}}),(0,l.jsx)("span",{children:a})]}),isFolder:!d,fileCount:+!!d,...d?{}:{children:[]}},c&&(null==(r=t[c])?void 0:r.children)&&t[c].children.push(t[s])}d&&(t[s].fileCount=1)}}let n=e=>{for(let r of e){var t;(null==(t=r.children)?void 0:t.length)&&(n(r.children),r.fileCount=r.children.reduce((e,t)=>e+t.fileCount,0),r.title=(0,l.jsxs)(o.A,{size:4,children:[(0,l.jsx)(G.A,{style:{color:"#faad14"}}),(0,l.jsx)("span",{children:r.rawTitle}),(0,l.jsx)(a.A,{style:{margin:0},children:r.fileCount})]}))}},s=Object.values(t).filter(e=>!e.key.includes("/"));return n(s),s.filter(e=>!e.isFolder||e.fileCount>0)})(ej),[ej]),e9=(0,n.useMemo)(()=>(function e(t,r){let l=r.trim().toLowerCase();return l?t.flatMap(t=>{let r=t.children?e(t.children,l):void 0;return t.key.toLowerCase().includes(l)||t.rawTitle.toLowerCase().includes(l)||(null==r?void 0:r.length)?[{...t,children:r}]:[]}):t})(e7,eA),[e7,eA]),te=(0,n.useMemo)(()=>ei(e7),[e7]),tt=(0,n.useMemo)(()=>{var e,t,r;return(null==(e=eg.find(e=>e.selected))?void 0:e.projectRoot)||(null==(t=eg.find(e=>e.isCurrent))?void 0:t.projectRoot)||(null==(r=eg[0])?void 0:r.projectRoot)||""},[eg]),tr=(0,n.useMemo)(()=>{let e=[],t=r=>{for(let l of r)e.push(l.key),l.children&&t(l.children)};return t(e7),e},[e7]),[tl,tn]=(0,n.useState)([]),[ts,ti]=(0,n.useState)(null),[to,ta]=(0,n.useState)("templates"),[tc,td]=(0,n.useState)(!1),[tu,tp]=(0,n.useState)("workflow"),tm=(0,n.useRef)(null),th=(0,n.useRef)(0),tx=async()=>{try{eM((await (0,J.cQ)(tt||void 0)).documents)}catch(e){eM([])}};(0,n.useEffect)(()=>{let e=()=>{ee&&(tn(ee.flowSteps),ti(ee.activeFlowKey),eT(ee.loading),ee.documentId&&eP(ee.documentId),ee.draft&&eB(ee.draft),void 0!==ee.content&&eR(ee.content))},t=ee;return null==t||t.listeners.add(e),e(),()=>{null==t||t.listeners.delete(e)}},[]),(0,n.useEffect)(()=>{eC(!0),Promise.all([(0,J.Dl)().then(e=>{var t,r;ec(e.templates),eu(null!=(r=null==(t=e.templates[0])?void 0:t.id)?r:"construction-organization-design")}),(0,J.lv)().then(e=>{em(e.roles),ex(e.configs)}),(0,J.dx)().then(e=>ef(e))]).catch(()=>t.error(e("common.error"))).finally(()=>eC(!1))},[t,e]),(0,n.useEffect)(()=>{tt&&tx()},[tt]),(0,n.useEffect)(()=>{if(0===eD.length)return;let e=localStorage.getItem("activeGenDocId");if(!e)return;if(!eD.find(t=>t.id===e&&"generating"===t.status))return void localStorage.removeItem("activeGenDocId");let t=setInterval(()=>{(async()=>{try{let{document:r}=await (0,J.v7)(e,!1,tt||void 0);await tx(),"generating"!==r.status&&(localStorage.removeItem("activeGenDocId"),clearInterval(t))}catch(e){clearInterval(t)}})()},3e3);return()=>clearInterval(t)},[eD]);let tg=(0,n.useMemo)(()=>_.find(e=>e.id===ed),[_,ed]),tf=eh.map(e=>({label:e.name,value:e.id})),tj=Math.max(0,tl.findIndex(e=>e.key===ts)),ty=e=>{var t;return e?(null==(t=ep.find(t=>t.id===e))?void 0:t.name)||ea[e]||"未知角色":""},tv=e=>e.subtitle||e.roleName||ty(e.roleId)||eo[e.type]||e.type,tw=e=>{var t,r,l;return e.promptName||((t=e.promptId)?(null==(r=eg.find(e=>e.id===t))?void 0:r.projectName)||(null==(l=ep.find(e=>e.id===t))?void 0:l.name)||ea[t]||"未知提示词":"")},tA=()=>{th.current+=1,eN(""),eU(null),eQ(null),e$([]),e1(!1),eH(!1),eq("idle")},tS=e=>{eu(e),eP(null),eB(null),eR(""),tA(),tp("workflow"),td(!0),ta("drafts")},tk=async r=>{eP(r.id),eu(r.templateId);let l=tb(r.status);if(l||"failed"===r.status||"aborted"===r.status){tA(),eB(null),eR(""),eT(l),tp("workflow"),td(!0);try{let{document:e}=await (0,J.v7)(r.id,!1,r.projectRoot||tt||void 0);tz(e),tb(e.status)?tT(e.id,e.projectRoot||r.projectRoot||tt||void 0):await tx()}catch(e){tz(r)}return}tp("editor"),tn([]),ti(null),tA();try{let{document:e}=await (0,J.v7)(r.id,!1,r.projectRoot||tt||void 0);eB(e.draft||null),eR(e.editedMarkdown||e.markdown)}catch(r){t.error(e("common.error"))}td(!0)},tb=e=>"completed"!==e&&"warning"!==e&&"failed"!==e&&"aborted"!==e,tI=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ez;(null==ee?void 0:ee.loading)&&(ee.flowSteps=e,ee.activeFlowKey=t,ee.loading=r,et())},tC=e=>{var t,r,n,s,i;let o=e.executionStages||(null==(t=e.draft)?void 0:t.executionStages)||[];if(o.length>0){let t=o.map((t,r)=>{var n;let s,i=("failed"===e.status||"aborted"===e.status)&&"running"===t.status||"failed"===(s=t.status)?"error":"running"===s?"process":"fallback"===s?"warning":"finish";return{key:"".concat(t.type,"-").concat(r),title:t.title||eo[t.type]||t.type,subtitle:tv(t),description:t.message||"",status:i,icon:"role_binding"===(n=t.type)?(0,l.jsx)(C.A,{}):"knowledge_retrieval"===n?(0,l.jsx)(T.A,{}):"context_recall"===n?(0,l.jsx)(z.A,{}):"file_understanding"===n?(0,l.jsx)(E.A,{}):"fact_extraction"===n?(0,l.jsx)(z.A,{}):"chapter_generation"===n?(0,l.jsx)(B.A,{}):"llm_review"===n?(0,l.jsx)(M.A,{}):"validation"===n?(0,l.jsx)(R.A,{}):"formatting"===n?(0,l.jsx)(D.A,{}):"export_ready"===n?(0,l.jsx)(F.A,{}):(0,l.jsx)(P.A,{}),subSteps:[{key:"stage-".concat(r),title:tw(t)?"提示词:".concat(tw(t)):tv(t),status:i}]}});"generating"===e.status&&t.length>0&&(null==(r=t.at(-1))?void 0:r.status)==="finish"&&(t[t.length-1]={...t[t.length-1],status:"process"});let a="generating"===e.status?(null==(n=t.at(-1))?void 0:n.key)||"prepare":"failed"===e.status||"aborted"===e.status?(null==(s=t.find(e=>"error"===e.status))?void 0:s.key)||(null==(i=t.at(-1))?void 0:i.key)||"prepare":"done";return{steps:t,activeKey:a}}return{steps:[],activeKey:null}},tz=e=>{let{steps:t,activeKey:r}=tC(e);tn(t),ti(r),eT(tb(e.status)),tI(t,r,tb(e.status)),("failed"===e.status||"aborted"===e.status)&&tp("workflow"),("completed"===e.status||"warning"===e.status)&&e.draft&&(eB(e.draft),eR(e.editedMarkdown||e.markdown),tp("editor"),tn([]),ti(null))},tT=(e,t)=>{tm.current&&clearInterval(tm.current),tm.current=setInterval(()=>{(async()=>{try{let{document:r}=await (0,J.v7)(e,!0,t||tt||void 0);tz(r),await tx(),tb(r.status)||(tm.current&&clearInterval(tm.current),tm.current=null,localStorage.removeItem("activeGenDocId"))}catch(e){}})()},2e3)};(0,n.useEffect)(()=>{if(!ez||!ts)return;let e=window.setInterval(()=>tn(e=>{let t=e.map(e=>{if(e.key!==ts||"process"!==e.status)return e;let t=e.subSteps.findIndex(e=>"process"===e.status),r=t<0?0:Math.min(t+1,e.subSteps.length-1);return{...e,subSteps:e.subSteps.map((e,t)=>t<r?{...e,status:"finish"}:t===r?{...e,status:"process"}:{...e,status:"wait"})}});return tI(t,ts),t}),1400);return()=>window.clearInterval(e)},[ts,ez]);let tE=async()=>{ew(!0);try{let e=await (0,J.HT)({limit:5e3,projectRoot:tt||void 0});ey(e.files)}catch(e){t.error("知识库文件加载失败")}finally{ew(!1)}},tB=e=>{let t=null!=e?e:{id:"tpl-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,chapters:[],fileBindings:[]};r.resetFields(),r.setFieldsValue({...t,fileBindingGroups:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.reduce((e,t)=>(t.roleId&&t.filePath&&(e[t.roleId]=en([...e[t.roleId]||[],t.filePath])),e),{})}(t.fileBindings)}),eS(""),tE(),e6(!0)},t_=(e,t)=>{let l=r.getFieldValue("fileBindingGroups")||{};r.setFieldValue("fileBindingGroups",{...l,[e]:en(t)})},tR=async()=>{try{await r.validateFields();let l=r.getFieldsValue(!0),n=l.fileBindingGroups||{},s=Object.entries(n).flatMap(e=>{let[t,r]=e;return en(r||[]).map(e=>({roleId:t,filePath:e}))}),{fileBindingGroups:i,...o}=l,a={...o,chapters:[],fileBindings:s},c=await (0,J.l2)(a);ec(c.templates),eu(c.template.id),e6(!1),await tx(),t.success(e("common.success"))}catch(e){e instanceof Error&&t.error(e.message)}},tD=async r=>{try{let l=await (0,J.bV)(r);ec(l.templates),eu(l.template.id),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},tM=async r=>{try{var l,n;let s=await (0,J.h0)(r);ec(s.templates),eu(null!=(n=null==(l=s.templates[0])?void 0:l.id)?n:""),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},tF=async e=>{try{let{validation:r}=await (0,J.SM)(e,tt||void 0);e3(t=>({...t,[e]:r}));let l=r.issues.filter(e=>"error"===e.level);if(eu(e),l.length>0)return void t.warning("模板运行前检查未通过,请先处理阻断项");if(r.issues.length>0)return void t.warning("模板存在警告,可在检查面板确认后继续运行");tS(e)}catch(e){t.error(e instanceof Error?e.message:"模板运行前检查失败")}},tP=async r=>{try{await (0,J.QG)(r.id,r.projectRoot||tt||void 0),eF===r.id&&(eP(null),eB(null),eR("")),await tx(),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},tG=async e=>{for(;;){let{document:t}=await (0,J.v7)(e,!0,tt||void 0);if(tz(t),("completed"===t.status||"warning"===t.status)&&t.draft)return t;if("failed"===t.status||"aborted"===t.status)throw Error(t.error||("aborted"===t.status?"生成已中止":"生成失败"));await new Promise(e=>window.setTimeout(e,1500))}},tL=async()=>{if(!ed)return;if(null==ee?void 0:ee.loading){tn(ee.flowSteps),ti(ee.activeFlowKey),eT(!0);return}if(!tt)return void t.error("未识别当前项目,请先选择或打开项目后再生成文件");eT(!0);let r=(0,J.OX)({templateId:ed,projectRoot:tt});ee={id:Date.now(),templateId:ed,loading:!0,flowSteps:[],activeFlowKey:null,promise:r,listeners:new Set},tn([]),ti(null);let l=[];try{let n=await r;n.documentId&&(localStorage.setItem("activeGenDocId",n.documentId),eP(n.documentId),(null==ee?void 0:ee.promise)===r&&(ee.documentId=n.documentId)),await tx();let s=n.documentId?await tG(n.documentId):void 0,o=n.draft||(null==s?void 0:s.draft);if(!o)throw Error("生成结果为空");(n.documentId||(null==s?void 0:s.id))&&eP(n.documentId||s.id),l.forEach(e=>window.clearTimeout(e)),eB(o),eR((null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown),(null==ee?void 0:ee.promise)===r&&(ee.draft=o,ee.content=(null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown);let a=s||{id:n.documentId||"draft-".concat(Date.now()),templateId:ed,title:o.title,requirement:o.requirement,projectRoot:o.projectRoot||tt,projectId:o.projectId,markdown:o.markdown,status:o.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!o.exportGate.passed?"warning":"completed",draft:o,executionStages:o.executionStages,assets:o.assets||[],createdAt:o.generatedAt,updatedAt:Date.now()},{steps:c}=tC(a);tn(c),tI(c,"done",!1),ti("done"),(null==ee?void 0:ee.promise)===r&&(ee.activeFlowKey="done",ee.loading=!1,et()),localStorage.removeItem("activeGenDocId"),await tx(),t.success(e("common.success")),window.setTimeout(()=>{var e;return null==(e=i.current)?void 0:e.scrollIntoView({behavior:"smooth",block:"start"})},200)}catch(n){localStorage.removeItem("activeGenDocId");let l=n instanceof Error?n.message:e("common.error");tn(e=>{let t=e.map(e=>"process"===e.status?{...e,status:"error",description:l,subSteps:((e,t)=>{if("wait"===t)return e.subSteps.map(e=>({...e,status:"wait"}));if("finish"===t)return e.subSteps.map(e=>({...e,status:"finish"}));if("error"===t)return e.subSteps.map((e,t)=>({...e,status:0===t?"error":e.status}));let r=e.subSteps.findIndex(e=>"wait"===e.status);return e.subSteps.map((e,t)=>t<r||-1===r?{...e,status:"finish"}:t===r?{...e,status:"process"}:e)})(e,"error")}:e);return tI(t,ts,!1),t}),(null==ee?void 0:ee.promise)===r&&(ee.loading=!1,ee.error=l,et(),ee=null),await tx().catch(()=>void 0),t.error(l)}finally{l.forEach(e=>window.clearTimeout(e)),eT(!1),(null==ee?void 0:ee.promise)===r&&(ee.loading=!1,et())}},tW=(0,n.useRef)(!1);(0,n.useEffect)(()=>{!tc||"workflow"!==tu||eF||tW.current||(null==ee?void 0:ee.loading)||null==tg||!tg.projectRoleConfigId||(tW.current=!0,window.setTimeout(()=>{tL()},300)),tc||(tW.current=!1)},[tc,tu,eF,tg]);let tN=async e=>{(null==ee?void 0:ee.loading)&&(ee.loading=!1,ee.error="用户中止",et(),ee=null,eT(!1)),localStorage.removeItem("activeGenDocId"),tm.current&&(clearInterval(tm.current),tm.current=null);try{await (0,J.r)(e.id,e.projectRoot||tt||void 0),t.success("已中止生成任务")}catch(e){t.info("任务已不在运行,已刷新状态")}finally{await tx(),eF===e.id&&(eP(null),eB(null),eR(""))}},tO=async r=>{if(eE){eL(r);try{eE.exportGate.passed||t.warning("导出门禁存在风险项,已允许导出,请下载后人工复核。");let e={documentId:eF||void 0,title:eE.title,markdown:e_,format:r,enforceGate:!1,exportGate:eE.exportGate,useClientMarkdown:!0},l=await (0,J.UE)(e);((e,t,r)=>{let l=new Blob([e],{type:r}),n=URL.createObjectURL(l),s=document.createElement("a");s.href=n,s.download=t,s.target="_self",s.rel="noopener",s.style.display="none",document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),s.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)})(l,"".concat(eE.title,".").concat("markdown"===r?"md":r),{markdown:"text/markdown;charset=utf-8",html:"text/html;charset=utf-8",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}[r])}catch(r){t.error(r instanceof Error?r.message:e("common.error"))}finally{eL(null)}}},tH=async()=>{if(eE)try{if(eF)await (0,J.a6)(eF,{editedMarkdown:e_,markdown:e_},eE.projectRoot||tt||void 0);else{let e=await (0,J.Af)({...eE,markdown:e_});eB(e.draft)}await tx(),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},tK=(e,t)=>{e$(r=>[{id:"".concat(Date.now()),content:e,prompt:t,createdAt:Date.now()},...r].slice(0,12))},tq=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&eN(""),eU(null),eQ(null),eY({start:0,end:0})},tV=(e,t)=>{var r,l;return{title:(null==eE?void 0:eE.title)||"未命名文档",markdown:t,instruction:e,facts:null==eE||null==(r=eE.structuredFacts)?void 0:r.map(e=>"".concat(e.key,": ").concat(e.value)),chapters:null==eE||null==(l=eE.chapters)?void 0:l.map(e=>e.title),...(()=>{let e=eJ.start,t=eJ.end;return t>e?{selection:{start:e,end:t,text:e_.slice(e,t)},cursorOffset:e}:{cursorOffset:e}})()}},tU=async()=>{let r=eW.trim();if(!eE||!r||eO)return;let l=th.current+1;th.current=l,eH(!0),eq("planning"),eQ(null);try{let e=await (0,J.Gi)({mode:"plan",...tV(r,e_)});if(th.current!==l||eF!=eF)return;if(!e.plan)throw Error("AI 未返回修改计划");eU(e.plan)}catch(r){th.current===l&&t.error(r instanceof Error?r.message:e("common.error"))}finally{th.current===l&&(eH(!1),eq("idle"))}},tX=async r=>{let l=eW.trim();if(!eE||!l||eO)return;let n=th.current+1;th.current=n,eH(!0),eq("applying");try{let e=await (0,J.Gi)({mode:"apply",...tV(l,e_),plan:r});if(th.current!==n||eF!=eF)return;if(!e.markdown)throw Error("AI 未返回修改结果");eQ({plan:e.plan||r,markdown:e.markdown,beforeSnippet:e.beforeSnippet,afterSnippet:e.afterSnippet,summary:e.summary,changedChars:e.changedChars,prompt:l,before:e_})}catch(r){th.current===n&&t.error(r instanceof Error?r.message:e("common.error"))}finally{th.current===n&&(eH(!1),eq("idle"))}};if(eI)return(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsx)(u.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,l.jsx)(u.A,{active:!0,paragraph:{rows:2}}),(0,l.jsx)(u.A,{active:!0,paragraph:{rows:8}})]});let tQ="workflow"===tu?"工作流:".concat((null==tg?void 0:tg.name)||"选择模板"):"编辑:".concat((null==eE?void 0:eE.title)||(null==tg?void 0:tg.outputTitle)||"文档");return(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"pageTitle",children:e("documents.title")}),(0,l.jsx)("p",{className:"pageDesc",children:e("documents.description")})]}),(0,l.jsx)(p.Ay,{type:"primary",icon:(0,l.jsx)(N.A,{}),onClick:()=>tB(),children:e("documents.newTemplate")})]}),(0,l.jsx)(m.A,{size:"small",tabList:[{key:"templates",label:"模板库 (".concat(_.length,")")},{key:"drafts",label:"生成记录 (".concat(eD.length,")")}],activeTabKey:to,onTabChange:ta,children:"templates"===to?0===_.length?(0,l.jsx)(h.A,{description:e("common.noData")}):(0,l.jsx)(x.A,{dataSource:_,renderItem:t=>(0,l.jsx)(x.A.Item,{style:{cursor:"pointer",padding:"10px 0"},actions:[(0,l.jsx)(p.Ay,{size:"small",icon:(0,l.jsx)(O.A,{}),onClick:e=>{e.stopPropagation(),tB(t)},children:"配置"},"cfg"),(0,l.jsx)(p.Ay,{size:"small",type:"primary",icon:(0,l.jsx)(H.A,{}),onClick:e=>{e.stopPropagation(),tF(t.id)},children:"运行"},"run"),(0,l.jsx)(p.Ay,{size:"small",icon:(0,l.jsx)(K.A,{}),onClick:e=>{e.stopPropagation(),tD(t.id)}},"copy"),(0,l.jsx)(g.A,{title:e("documents.deleteTemplateConfirm"),onConfirm:e=>{null==e||e.stopPropagation(),tM(t.id)},children:(0,l.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,l.jsx)(W.A,{}),onClick:e=>e.stopPropagation()})},"del")],onClick:()=>eu(t.id),children:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[function(e,t){let r=el[e]||(0,l.jsx)(P.A,{});return(0,l.jsx)("span",{style:{color:t?"var(--colorAccent)":"var(--colorTextSecondary)",fontSize:16,marginTop:2,flexShrink:0},children:r})}(t.category,ed===t.id),(0,l.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,l.jsx)("span",{style:{fontWeight:ed===t.id?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),ed===t.id&&(0,l.jsx)(a.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"当前"}),(0,l.jsx)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:t.category}),e8[t.id]&&(0,l.jsxs)(a.A,{color:e8[t.id].issues.some(e=>"error"===e.level)?"error":e8[t.id].issues.length?"warning":"success",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:["检查 ",e8[t.id].fileDiagnostics.length," 文件 / ",e8[t.id].promptDiagnostics.length," 提示词"]})]}),t.description&&(0,l.jsx)($,{type:"secondary",style:{fontSize:12,lineHeight:"18px"},children:t.description}),e8[t.id]&&(0,l.jsx)("div",{onClick:e=>e.stopPropagation(),style:{marginTop:8,padding:10,border:"1px solid ".concat(e8[t.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBorder)":e8[t.id].issues.length?"var(--colorWarningBorder)":"var(--colorSuccessBorder)"),borderRadius:10,background:e8[t.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBg)":e8[t.id].issues.length?"var(--colorWarningBg)":"var(--colorSuccessBg)"},children:(0,l.jsxs)(o.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)($,{strong:!0,children:e8[t.id].issues.some(e=>"error"===e.level)?"运行前检查未通过":e8[t.id].issues.length?"运行前检查存在警告":"运行前检查通过"}),(0,l.jsxs)(a.A,{color:"blue",children:["文件角色 ",e8[t.id].fileDiagnostics.length]}),(0,l.jsxs)(a.A,{color:"purple",children:["提示词角色 ",e8[t.id].promptDiagnostics.length]})]}),e8[t.id].issues.length>0?e8[t.id].issues.map(e=>(0,l.jsx)(f.A,{type:"error"===e.level?"error":"warning",message:e.message,showIcon:!0},e.message)):(0,l.jsx)(f.A,{type:"success",message:"文件角色、提示词角色和后台自动规范检查通过,可以运行。",showIcon:!0}),!e8[t.id].issues.some(e=>"error"===e.level)&&e8[t.id].issues.length>0&&(0,l.jsx)("div",{children:(0,l.jsx)(p.Ay,{size:"small",type:"primary",icon:(0,l.jsx)(H.A,{}),onClick:()=>tS(t.id),children:"忽略警告并继续运行"})})]})})]})]})})}):0===eD.length?(0,l.jsx)(h.A,{description:e("common.noData")}):(0,l.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:eD.slice(0,15).map((e,t)=>{var r,n,s;let i,c;return(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,padding:"10px 12px",border:"1px solid var(--colorBorderSecondary)",borderRadius:10,cursor:"pointer",background:eF===e.id?"var(--colorFillAlter)":void 0,minWidth:0},onClick:()=>{tk(e)},children:["completed"===e.status?(0,l.jsx)(D.A,{style:{fontSize:18,color:"var(--colorOk)",flexShrink:0,marginTop:2}}):"failed"===e.status||"aborted"===e.status?(0,l.jsx)(q.A,{style:{fontSize:18,color:"var(--colorDanger)",flexShrink:0,marginTop:2}}):"warning"===e.status?(0,l.jsx)(R.A,{style:{fontSize:18,color:"var(--colorWarning)",flexShrink:0,marginTop:2}}):(0,l.jsx)(V.A,{spin:!0,style:{fontSize:18,color:"#1677ff",flexShrink:0,marginTop:2}}),(0,l.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,l.jsx)("div",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:3},children:e.title}),(0,l.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px 10px",color:"var(--colorTextSecondary)",fontSize:11},children:[(0,l.jsx)("span",{children:new Date(e.updatedAt).toLocaleString()}),(0,l.jsxs)("span",{children:["耗时 ",(e=>{let t=Math.max(0,Math.round(((e.completedAt||e.updatedAt)-e.createdAt)/1e3));if(t<60)return"".concat(t," 秒");let r=Math.floor(t/60),l=t%60;if(r<60)return l?"".concat(r," 分 ").concat(l," 秒"):"".concat(r," 分");let n=Math.floor(r/60),s=r%60;return s?"".concat(n," 小时 ").concat(s," 分"):"".concat(n," 小时")})(e)]})]}),("warning"===e.status||"failed"===e.status||"aborted"===e.status)&&(0,l.jsx)("div",{style:{marginTop:3,color:"failed"===e.status||"aborted"===e.status?"var(--colorError)":"var(--colorWarning)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.error||(null==(r=e.warningIssues)?void 0:r[0])||(null==(s=e.draft)||null==(n=s.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message)||"需复核"})]}),(0,l.jsxs)(o.A,{size:4,align:"center",children:[(0,l.jsx)(a.A,{color:"completed"===(i=e.status)?"success":"warning"===i?"warning":"failed"===i?"error":"aborted"===i?"default":"processing",style:{margin:0,fontSize:10,lineHeight:"18px"},children:"completed"===(c=e.status)?"已完成":"warning"===c?"需复核":"failed"===c?"失败":"aborted"===c?"已中止":"生成中"}),(0,l.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"18px"},children:["#",t+1]}),(0,l.jsx)(g.A,{title:"确认删除?",onConfirm:t=>{null==t||t.stopPropagation(),tP(e)},children:(0,l.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,l.jsx)(W.A,{}),onClick:e=>e.stopPropagation()})}),tb(e.status)&&(0,l.jsx)(g.A,{title:"确定中止此生成任务?",onConfirm:t=>{null==t||t.stopPropagation(),tN(e)},children:(0,l.jsx)(p.Ay,{size:"small",danger:!0,onClick:e=>e.stopPropagation(),children:"中止"})}),(0,l.jsx)(p.Ay,{size:"small",type:"primary",icon:tb(e.status)?(0,l.jsx)(V.A,{spin:!0}):(0,l.jsx)(H.A,{}),onClick:t=>{t.stopPropagation(),tk(e)},children:"打开"})]})]},e.id)})})}),(0,l.jsx)(j.A,{title:tQ,open:tc,onClose:()=>{td(!1),tm.current&&(clearInterval(tm.current),tm.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:eE?(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)(p.Ay,{icon:(0,l.jsx)(U.A,{}),disabled:eO,onClick:()=>{tH()},children:e("documents.saveDraft")}),(0,l.jsx)(p.Ay,{icon:(0,l.jsx)(X.A,{}),disabled:eO,loading:"markdown"===eG,onClick:()=>{tO("markdown")},children:"MD"}),(0,l.jsx)(p.Ay,{disabled:eO,loading:"html"===eG,onClick:()=>{tO("html")},children:"HTML"}),(0,l.jsx)(p.Ay,{disabled:eO,loading:"docx"===eG,onClick:()=>{tO("docx")},children:"DOCX"}),(0,l.jsx)(p.Ay,{type:"primary",disabled:eO,loading:"pdf"===eG,onClick:()=>{tO("pdf")},children:"PDF"})]}):ez&&"workflow"===tu?(0,l.jsx)(p.Ay,{danger:!0,onClick:()=>{(async()=>{eF&&await (0,J.r)(eF,tt||void 0).catch(()=>void 0),ee&&(ee.loading=!1,ee.error="用户中止",et(),ee=null),localStorage.removeItem("activeGenDocId"),tm.current&&(clearInterval(tm.current),tm.current=null),eT(!1),tn([]),ti(null),td(!1),await tx(),t.info("已中止生成任务")})()},children:"中止任务"}):void 0,children:(0,l.jsxs)(o.A,{direction:"vertical",style:{width:"100%"},size:"middle",children:["workflow"===tu&&tl.length>0&&(0,l.jsx)(y.A,{direction:"vertical",size:"small",current:tj,items:tl.map(e=>{let t;return{title:e.title,description:(0,l.jsxs)("div",{children:[e.subtitle&&(0,l.jsx)("div",{style:{marginBottom:4},children:(0,l.jsx)(a.A,{children:e.subtitle})}),(0,l.jsx)("div",{children:e.description}),(0,l.jsx)("div",{style:{marginTop:4},children:e.subSteps.map(e=>{var t;return(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:12,color:"var(--colorTextSecondary)"},children:["process"===(t=e.status)?(0,l.jsx)(L.A,{}):"finish"===t?(0,l.jsx)(D.A,{}):"warning"===t?(0,l.jsx)(R.A,{style:{color:"var(--colorWarning)"}}):"error"===t?(0,l.jsx)(W.A,{}):(0,l.jsx)("span",{style:{display:"inline-block",height:6,width:6,borderRadius:"50%",background:"var(--colorTextTertiary)"}}),(0,l.jsx)("span",{children:e.title})]},e.key)})})]}),status:"warning"===(t=e.status)?"finish":t,icon:"process"===e.status?(0,l.jsx)(L.A,{}):"warning"===e.status?(0,l.jsx)(R.A,{style:{color:"var(--colorWarning)"}}):e.icon}})}),"workflow"===tu&&ez&&0===tl.length&&(0,l.jsx)("div",{style:{textAlign:"center",padding:40},children:(0,l.jsx)(v.A,{tip:"正在准备生成…"})}),eE&&(0,l.jsx)("div",{ref:i,children:(0,l.jsx)(w.A,{items:[{key:"edit",label:e("documents.edit"),children:(0,l.jsxs)(o.A,{direction:"vertical",size:"middle",style:{width:"100%"},children:[(0,l.jsx)(Z,{rows:28,value:e_,disabled:eO,onSelect:e=>{var t,r,l;return eY({start:null!=(t=e.currentTarget.selectionStart)?t:0,end:null!=(l=null!=(r=e.currentTarget.selectionEnd)?r:e.currentTarget.selectionStart)?l:0})},onChange:e=>{var t,r,l;eR(e.target.value),eU(null),eQ(null),eY({start:null!=(t=e.target.selectionStart)?t:0,end:null!=(l=null!=(r=e.target.selectionEnd)?r:e.target.selectionStart)?l:0})}}),(0,l.jsx)(m.A,{size:"small",style:{borderRadius:12,background:"linear-gradient(135deg, var(--colorFillAlter), var(--colorBgContainer))"},children:(0,l.jsxs)(o.A,{direction:"vertical",size:"middle",style:{width:"100%"},children:[(0,l.jsxs)(o.A,{align:"start",style:{width:"100%",justifyContent:"space-between"},children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)(o.A,{size:6,children:[(0,l.jsx)(M.A,{style:{color:"var(--colorAccent)"}}),(0,l.jsx)($,{strong:!0,children:"精准修改"}),(0,l.jsx)(a.A,{color:"blue",children:"AI 辅助"})]}),(0,l.jsx)("div",{style:{marginTop:4,color:"var(--colorTextSecondary)",fontSize:12},children:"针对当前编辑内容补充更具体的要求,AI 会保留文档结构并按你的提示细化修改。"})]}),(0,l.jsxs)(p.Ay,{size:"small",icon:(0,l.jsx)(Q.A,{}),onClick:()=>e1(e=>!e),disabled:0===eZ.length,children:["历史版本 ",eZ.length>0?eZ.length:""]})]}),(0,l.jsx)(f.A,{type:"info",showIcon:!0,message:"系统只负责识别修改范围,不改写你的提示词;选中文字后优先只改选区,没有选区时按光标所在小节/章节定位。"}),(0,l.jsx)(Z,{rows:4,value:eW,disabled:eO,onChange:e=>{eN(e.target.value),eU(null),eQ(null)},placeholder:"例如:写细一点;润色这段;第七章补充高处作业和临电安全措施;把安全检查频次改成每周一次。"}),(0,l.jsxs)(o.A,{wrap:!0,style:{width:"100%",justifyContent:"space-between"},children:[(0,l.jsx)(o.A,{wrap:!0,children:["写细一点","更专业","只润色选区","补充可执行措施"].map(e=>(0,l.jsx)(p.Ay,{size:"small",disabled:eO,onClick:()=>eN(t=>t?"".concat(t,";").concat(e):e),children:e},e))}),(0,l.jsx)(p.Ay,{type:"primary",icon:(0,l.jsx)(M.A,{}),loading:eO&&"planning"===eK,disabled:!eW.trim()||eO,onClick:()=>{tU()},children:"识别修改范围"})]}),eV&&!eX&&(0,l.jsx)(m.A,{size:"small",style:{borderRadius:10,borderColor:"var(--colorAccent)"},children:(0,l.jsxs)(o.A,{direction:"vertical",size:"small",style:{width:"100%"},children:[(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)(a.A,{color:"purple",children:eV.scope}),(0,l.jsx)(a.A,{color:"blue",children:eV.action}),(0,l.jsxs)(a.A,{color:eV.confidence>=.8?"green":"orange",children:["置信度 ",Math.round(100*eV.confidence),"%"]}),eV.targetTitle&&(0,l.jsx)($,{strong:!0,children:eV.targetTitle})]}),(0,l.jsx)($,{children:eV.summary}),(0,l.jsx)($,{type:"secondary",style:{fontSize:12},children:"将按你的原始提示词执行,不添加额外编辑任务。"}),(0,l.jsxs)(o.A,{children:[(0,l.jsx)(p.Ay,{type:"primary",loading:eO&&"applying"===eK,onClick:()=>{tX(eV)},children:"执行并预览"}),(0,l.jsx)(p.Ay,{disabled:eO,onClick:()=>eU(null),children:"取消"})]})]})}),eX&&(0,l.jsx)(m.A,{size:"small",style:{borderRadius:10,borderColor:"var(--colorSuccess)"},children:(0,l.jsxs)(o.A,{direction:"vertical",size:"small",style:{width:"100%"},children:[(0,l.jsxs)(o.A,{wrap:!0,children:[(0,l.jsx)(a.A,{color:"green",children:"修改预览"}),(0,l.jsx)($,{children:eX.summary||eX.plan.summary}),(0,l.jsxs)(a.A,{children:[eX.changedChars&&eX.changedChars>0?"+".concat(eX.changedChars):eX.changedChars," 字符"]})]}),(0,l.jsxs)(A.A,{gutter:12,children:[(0,l.jsxs)(S.A,{span:12,children:[(0,l.jsx)($,{strong:!0,children:"修改前"}),(0,l.jsx)("div",{style:{marginTop:6,maxHeight:180,overflow:"auto",padding:10,borderRadius:8,background:"var(--colorFillAlter)",whiteSpace:"pre-wrap",fontSize:12},children:eX.beforeSnippet||"无片段预览"})]}),(0,l.jsxs)(S.A,{span:12,children:[(0,l.jsx)($,{strong:!0,children:"修改后"}),(0,l.jsx)("div",{style:{marginTop:6,maxHeight:180,overflow:"auto",padding:10,borderRadius:8,background:"var(--colorFillAlter)",whiteSpace:"pre-wrap",fontSize:12},children:eX.afterSnippet||"无片段预览"})]})]}),(0,l.jsxs)(o.A,{children:[(0,l.jsx)(p.Ay,{type:"primary",onClick:()=>{eX&&(tK(eX.before,eX.prompt),eR(eX.markdown),tq(!0),t.success("已应用精准修改"))},children:"应用到文档"}),(0,l.jsx)(p.Ay,{onClick:()=>eQ(null),children:"返回计划"}),(0,l.jsx)(p.Ay,{danger:!0,onClick:()=>{eU(null),eQ(null)},children:"放弃"})]})]})}),e0&&(0,l.jsx)("div",{style:{borderTop:"1px solid var(--colorBorderSecondary)",paddingTop:12},children:(0,l.jsx)(x.A,{size:"small",dataSource:eZ,locale:{emptyText:"暂无历史版本"},renderItem:e=>(0,l.jsx)(x.A.Item,{actions:[(0,l.jsx)(p.Ay,{size:"small",disabled:eO,onClick:()=>{tK(e_,"恢复前版本"),eR(e.content),tq(!0),t.success("已恢复历史版本")},children:"恢复"},"restore")],children:(0,l.jsx)(x.A.Item.Meta,{title:(0,l.jsxs)(o.A,{children:[(0,l.jsx)($,{children:new Date(e.createdAt).toLocaleString()}),(0,l.jsx)(a.A,{children:e.prompt})]}),description:(0,l.jsx)($,{type:"secondary",ellipsis:!0,children:e.content.replace(/\s+/gu," ").slice(0,120)})})})})})]})})]})},{key:"chapters-facts",label:"章节与事实",children:(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[eE.chapters.length>0&&(0,l.jsxs)("div",{children:[(0,l.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["章节 (",eE.chapters.length,")"]}),(0,l.jsx)(x.A,{size:"small",dataSource:eE.chapters,renderItem:e=>(0,l.jsx)(x.A.Item,{children:(0,l.jsx)(x.A.Item.Meta,{title:e.title,description:"证据: ".concat(e.evidence.length," \xb7 缺失: ").concat(e.missingFacts.length)})})})]}),eE.structuredFacts.length>0&&(0,l.jsxs)("div",{children:[(0,l.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["结构化事实 (",eE.structuredFacts.length,")"]}),(0,l.jsx)(k.A,{size:"small",column:1,bordered:!0,children:eE.structuredFacts.map((e,t)=>(0,l.jsxs)(k.A.Item,{label:e.key,children:[(0,l.jsx)("span",{children:e.value}),(0,l.jsx)(a.A,{style:{marginLeft:8},children:e.confidence.toFixed(2)}),(0,l.jsx)($,{type:"secondary",style:{fontSize:11,marginLeft:8},children:e.sourceFile})]},t))})]})]})},{key:"sources-missing",label:"来源与缺失",children:(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["引用来源 (",eE.sources.length,")"]}),0===eE.sources.length?(0,l.jsx)(h.A,{description:"暂无"}):(0,l.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:eE.sources.map(e=>(0,l.jsxs)(a.A,{color:"blue",children:[e.filePath," (",e.count,")"]},e.filePath))})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["缺失项 (",eE.missingItems.length,")"]}),0===eE.missingItems.length?(0,l.jsx)(h.A,{description:"无缺失"}):(0,l.jsx)(x.A,{size:"small",dataSource:eE.missingItems,renderItem:e=>(0,l.jsx)(x.A.Item,{children:e})})]})]})},{key:"validation",label:"校验 (".concat(eE.validationIssues.length,")"),children:0===eE.validationIssues.length?(0,l.jsx)(h.A,{description:"校验通过"}):(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[eE.validationIssues.map(e=>(0,l.jsxs)("div",{style:{border:"1px solid var(--colorBorderSecondary)",borderRadius:8,padding:12},children:[(0,l.jsx)(a.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:e.level}),(0,l.jsx)("div",{style:{marginTop:6,whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.message}),e.suggestion&&(0,l.jsx)("div",{style:{marginTop:6,color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all"},children:e.suggestion})]},"".concat(e.level,"-").concat(e.message))),eE.exportGate.checklist.length>0&&(0,l.jsxs)("div",{style:{marginTop:8},children:[(0,l.jsx)($,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:"导出门禁"}),(0,l.jsx)(x.A,{size:"small",dataSource:eE.exportGate.checklist,renderItem:e=>(0,l.jsxs)(x.A.Item,{children:[(0,l.jsx)($,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.label}),(0,l.jsx)(a.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})]})]})},{key:"stages",label:"执行阶段 (".concat(eE.executionStages.length,")"),children:(0,l.jsx)(x.A,{size:"small",dataSource:eE.executionStages,renderItem:e=>(0,l.jsxs)(x.A.Item,{children:[(0,l.jsx)(x.A.Item.Meta,{avatar:er[e.type]||(0,l.jsx)(P.A,{}),title:(0,l.jsx)($,{title:e.roleId,style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:"".concat(eo[e.type]||e.type," \xb7 ").concat(e.roleName||ty(e.roleId))}),description:(0,l.jsx)($,{type:"secondary",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})}),(0,l.jsx)(a.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})})}]})})]})}),(0,l.jsx)(j.A,{title:e("documents.templateEditor"),open:e2,onClose:()=>e6(!1),width:860,maskClosable:!1,styles:{body:{padding:20,overflow:"auto"},header:{borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,l.jsxs)(o.A,{children:[(0,l.jsx)(p.Ay,{onClick:()=>e6(!1),children:e("common.cancel")}),(0,l.jsx)(p.Ay,{type:"primary",onClick:()=>{tR()},children:e("common.save")})]}),children:(0,l.jsxs)(d.A,{form:r,layout:"vertical",requiredMark:"optional",children:[(0,l.jsxs)(A.A,{gutter:12,children:[(0,l.jsx)(d.A.Item,{name:"id",hidden:!0,children:(0,l.jsx)(s.A,{})}),(0,l.jsx)(S.A,{xs:24,md:8,children:(0,l.jsx)(d.A.Item,{name:"name",label:e("documents.templateName"),rules:[{required:!0}],children:(0,l.jsx)(s.A,{})})}),(0,l.jsx)(S.A,{xs:24,md:8,children:(0,l.jsx)(d.A.Item,{name:"category",label:e("documents.templateCategory"),children:(0,l.jsx)(s.A,{})})}),(0,l.jsx)(S.A,{xs:24,md:8,children:(0,l.jsx)(d.A.Item,{name:"outputTitle",label:e("documents.outputTitle"),children:(0,l.jsx)(s.A,{})})}),(0,l.jsx)(S.A,{xs:24,md:12,children:(0,l.jsx)(d.A.Item,{name:"description",label:e("documents.templateDescription"),children:(0,l.jsx)(s.A,{})})})]}),(0,l.jsx)(d.A.Item,{name:"projectRoleConfigId",label:e("documents.projectRoleConfig"),rules:[{required:!0,message:e("documents.projectRoleConfigRequired")}],children:(0,l.jsx)(b.A,{showSearch:!0,placeholder:e("documents.projectRoleConfigRequired"),options:tf})}),(0,l.jsxs)("div",{style:{marginBottom:16},children:[(0,l.jsxs)(o.A,{style:{width:"100%",justifyContent:"space-between",marginBottom:8},children:[(0,l.jsx)($,{strong:!0,children:"项目文件绑定"}),(0,l.jsx)(a.A,{color:"blue",children:"按文件角色多选"})]}),(0,l.jsx)(f.A,{type:"info",showIcon:!0,style:{marginBottom:12},message:"每个文件角色可直接勾选文件或文件夹;勾选文件夹会自动绑定该文件夹下所有文件。保存时仍按具体文件路径绑定,兼容现有模板和生成流程。"}),(0,l.jsx)(s.A.Search,{allowClear:!0,placeholder:"搜索文件或文件夹",value:eA,onChange:e=>eS(e.target.value),style:{marginBottom:12}}),ev?(0,l.jsx)("div",{style:{textAlign:"center",padding:24},children:(0,l.jsx)(v.A,{tip:"正在加载知识库文件…"})}):0===e4.length?(0,l.jsx)(h.A,{image:h.A.PRESENTED_IMAGE_SIMPLE,description:"暂无可用文件角色"}):0===e7.length?(0,l.jsx)(h.A,{image:h.A.PRESENTED_IMAGE_SIMPLE,description:"暂无知识库文件"}):e4.map(e=>{let t=en(e5[e.value]||[]).filter(e=>te.includes(e)),r=new Set(ei(e9));return(0,l.jsxs)(m.A,{size:"small",style:{marginBottom:12},title:(0,l.jsxs)(o.A,{children:[(0,l.jsx)($,{children:e.label}),(0,l.jsxs)(a.A,{color:"blue",children:["已选 ",t.length]})]}),extra:(0,l.jsx)(p.Ay,{size:"small",disabled:0===t.length,onClick:()=>t_(e.value,[]),children:"清空"}),children:[(0,l.jsx)(d.A.Item,{name:["fileBindingGroups",e.value],hidden:!0,children:(0,l.jsx)(s.A,{})}),(0,l.jsx)("div",{style:{marginBottom:8,color:"var(--colorTextSecondary)",fontSize:12},children:t.length>0?t.slice(0,3).map(es).join("、")+(t.length>3?" 等 ".concat(t.length," 个文件"):""):"未选择文件"}),(0,l.jsx)(I.A,{checkable:!0,blockNode:!0,height:320,treeData:e9,checkedKeys:t,expandedKeys:eA.trim()?tr:ek,onExpand:e=>eb(e),onCheck:(l,n)=>{let s=new Set(t.filter(e=>!r.has(e)));for(let e of n.checkedNodes)e.isFolder?ei([e]).forEach(e=>s.add(e)):s.add(e.key);t_(e.value,Array.from(s))}})]},e.value)})]}),(0,l.jsx)(f.A,{type:"info",showIcon:!0,message:"文档规范由后台根据模板、提示词和角色绑定自动生成,无需手动维护规范包。"})]})})]})}}},e=>{e.O(0,[433,787,576,195,375,455,506,940,499,636,593,792],()=>e(e.s=16403)),_N_E=e.O()}]);
|
|
File without changes
|