@customize-agent/server 3.0.17 → 3.0.19
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-manifest.json +1 -1
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/chunks/3445.js +2 -2
- package/.next/server/chunks/9270.js +1 -1
- package/.next/server/chunks/9301.js +2 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/api/assets/generated/preview.js +1 -1
- package/.next/server/pages/api/assets/generated.js +1 -1
- package/.next/server/pages/api/documents/export.js +1 -1
- package/.next/server/pages/api/documents/generate.js +1 -1
- package/.next/server/pages/api/documents/generated/[id].js +1 -1
- package/.next/server/pages/api/documents/generated.js +1 -1
- package/.next/server/pages/api/documents/specs.js +1 -1
- package/.next/server/pages/api/prompt.js +97 -1
- package/.next/server/pages/documents.html +1 -1
- package/.next/server/pages-manifest.json +24 -24
- package/.next/static/chunks/pages/documents-12e1d81f932ae062.js +1 -0
- package/.next/static/customize-agent-dashboard/_buildManifest.js +1 -1
- package/package.json +1 -1
- package/.next/static/chunks/pages/documents-c1a01ae631b42488.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{6578:(e,t,n)=>{"use strict";async function s(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function o(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return s("/api/kb/stats".concat(t))}async function i(e){var t,n;let o=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&o.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&o.set("category",e.category),(null==e?void 0:e.page)&&o.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&o.set("limit",String(null!=(n=e.limit)?n:50)),s("/api/kb/files?".concat(o))}async function a(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),s("/api/kb/files/detail?".concat(n))}async function r(e,t){return s("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function c(e,t,n){return s("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let s=new FileReader;s.onload=()=>{let e=s.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},s.onerror=n,s.readAsDataURL(e)})}async function d(e,t,n){return s("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return s("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return s("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return s("/api/kb/features")}async function j(e,t){var n,o,i,a,r;let c=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&c.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&c.set("category",t.category),(null==t?void 0:t.limit)&&c.set("limit",String(null!=(r=t.limit)?r:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(o=t.weights)?void 0:o.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(i=t.weights)?void 0:i.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(a=t.weights)?void 0:a.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),s("/api/kb/search?".concat(c))}async function w(){return s("/api/prompt")}async function v(e){return s("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function A(e){return s("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function b(e,t){return s("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function S(e){return s("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return s("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function I(){return s("/api/documents/specs")}async function C(e){return s("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return s("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return s("/api/documents/templates")}async function R(e){return s("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(e){return s("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function N(e){return s("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function O(e){return s("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(){return s("/api/documents/generated")}async function L(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,t){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function U(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function J(){return s("/api/assets/generated")}async function M(e){return s("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function F(e){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function z(e,t){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function q(e){return s("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function G(e,t){return s("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function H(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function W(){return s("/api/config/providers")}async function K(e,t){return s("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function Q(e){return s("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function V(){return s("/api/config/models")}async function X(e){return s("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function B(){return s("/api/config/embedding")}async function Z(e){return s("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(){return s("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return s("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function ee(){return s("/api/system/stats")}async function et(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return s("/api/context".concat(n))}async function en(e){return s("/api/context?type=".concat(e,"&stats=1"))}async function es(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function eo(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ei(e){return s("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ea(e,t){return s("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function er(e){return s("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>G,Bh:()=>er,Dl:()=>E,E:()=>eo,EK:()=>C,ER:()=>T,FC:()=>ee,FV:()=>b,H1:()=>g,H7:()=>m,HC:()=>r,HT:()=>i,II:()=>B,JU:()=>M,NR:()=>S,OX:()=>O,PH:()=>es,QG:()=>U,QT:()=>u,Qx:()=>p,R1:()=>q,SJ:()=>y,UE:()=>H,VW:()=>x,W2:()=>j,X8:()=>f,Z3:()=>W,_m:()=>K,a6:()=>D,aP:()=>X,bV:()=>N,bZ:()=>Y,c1:()=>d,cQ:()=>_,dd:()=>Z,dg:()=>A,dw:()=>k,dx:()=>w,f$:()=>J,h0:()=>P,h1:()=>Q,hc:()=>o,hn:()=>et,l2:()=>R,lv:()=>v,mx:()=>I,oS:()=>z,p:()=>en,tn:()=>c,u6:()=>$,uc:()=>F,v7:()=>L,xC:()=>a,xq:()=>h,xw:()=>ei,zo:()=>ea,zr:()=>V})},16403:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return n(19562)}])},19562:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>V});var s=n(65321),o=n(97109),i=n(7576),a=n(35292),r=n(17807),c=n(63455),l=n(68787),d=n(85114),u=n(2256),p=n(38770),m=n(38332),h=n(84253),y=n(26171),f=n(33442),g=n(11702),x=n(57271),j=n(9730),w=n(58569),v=n(25258),A=n(26631),b=n(23216),S=n(26619),k=n(8263),I=n(16285),C=n(8579),T=n(75548),E=n(7851),R=n(84742),P=n(29071),N=n(63552),O=n(76830),_=n(83914),L=n(58209),D=n(54746),U=n(93051),J=n(99650),M=n(67547),F=n(99811),z=n(6578),q=n(13014);let{TextArea:G}=i.A,{Paragraph:H,Text:W}=a.A,K=null;function Q(){null==K||K.listeners.forEach(e=>e())}function V(){var e,t,n;let a=(0,q.Vr)(),{message:V}=r.A.useApp(),[X]=c.A.useForm(),[B,Z]=(0,o.useState)([]),[$,Y]=(0,o.useState)("construction-organization-design"),[ee,et]=(0,o.useState)([]),[en,es]=(0,o.useState)([]),[eo,ei]=(0,o.useState)([]),[ea,er]=(0,o.useState)(!1),[ec,el]=(0,o.useState)(null),[ed,eu]=(0,o.useState)(""),[ep,em]=(0,o.useState)([]),[eh,ey]=(0,o.useState)(null),[ef,eg]=(0,o.useState)(!1),[ex,ej]=(0,o.useState)(null),[ew,ev]=(0,o.useState)(!1),[eA,eb]=(0,o.useState)([]),[eS,ek]=(0,o.useState)(null),eI=async()=>{try{em((await (0,z.cQ)()).documents)}catch(e){em([])}};(0,o.useEffect)(()=>{let e=()=>{K&&(eb(K.flowSteps),ek(K.activeFlowKey),er(K.loading),K.draft&&el(K.draft),void 0!==K.content&&eu(K.content))};return null==K||K.listeners.add(e),e(),()=>{null==K||K.listeners.delete(e)}},[]),(0,o.useEffect)(()=>{(0,z.Dl)().then(e=>{var t,n;Z(e.templates),Y(null!=(n=null==(t=e.templates[0])?void 0:t.id)?n:"construction-organization-design")}).catch(()=>V.error(a("common.error"))),(0,z.lv)().then(e=>{et(e.roles),es(e.configs)}).catch(()=>{et([]),es([])}),(0,z.mx)().then(e=>ei(e.specs)).catch(()=>ei([])),eI()},[V,a]);let eC=(0,o.useMemo)(()=>B.find(e=>e.id===$),[B,$]),eT=en.map(e=>({label:e.name,value:e.id})),eE=eo.map(e=>({label:e.name,value:e.id})),eR=Math.max(0,eA.findIndex(e=>e.key===eS)),eP=e=>e.map((e,t)=>({key:"sub-".concat(t),title:e,status:"wait"})),eN=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eC,t=eo.find(t=>t.id===(null==e?void 0:e.documentSpecId)),n=en.find(t=>t.id===(null==e?void 0:e.projectRoleConfigId)),o=((null==n?void 0:n.fileRoles)||[]).map(e=>{var t;return(null==(t=ee.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),i=((null==n?void 0:n.promptRoles)||[]).map(e=>{var t;return(null==(t=ee.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),r=(null==t?void 0:t.factFields.map(e=>e.name))||(null==e?void 0:e.chapters.flatMap(e=>e.requiredFacts))||[],c=(null==e?void 0:e.chapters.map(e=>e.title))||[],l=i.some(e=>/封面|图片|资源|cover|image/iu.test(e));return[{key:"prepare",title:a("documents.flowPrepare"),description:"读取“".concat((null==e?void 0:e.name)||"当前模板","”并创建后台生成任务"),status:"process",icon:(0,s.jsx)(A.A,{}),subSteps:eP(["读取模板参数",(null==e?void 0:e.documentSpecId)?"加载规范包:".concat((null==t?void 0:t.name)||e.documentSpecId):"未绑定规范包,使用模板章节要求","创建后台生成任务"])},{key:"role_binding",title:"动态角色配置绑定",description:"绑定 ".concat(o.length," 个文件角色、").concat(i.length," 个提示词角色"),status:"wait",icon:(0,s.jsx)(b.A,{}),subSteps:eP([...o.length?o.map(e=>"文件角色:".concat(e)):["没有文件角色,使用模板绑定文件"],...i.length?i.map(e=>"提示词角色:".concat(e)):["没有提示词角色,使用默认生成策略"]].slice(0,10))},{key:"knowledge_retrieval",title:"知识库证据检索",description:"按 ".concat(c.length," 个章节检索文本、文档、表格、图片、图纸和附件"),status:"wait",icon:(0,s.jsx)(S.A,{}),subSteps:eP(c.length?c.slice(0,10).map(e=>"检索章节:".concat(e)):["按模板标题检索证据"])},{key:"file_understanding",title:"多类型文件理解",description:"按文件角色处理文本、PDF/Word、表格、图片、图纸和附件",status:"wait",icon:(0,s.jsx)(k.A,{}),subSteps:eP(["识别文件类型和角色","构建结构化资源证据包","必要时调用多模态文件理解"])},{key:"fact_extraction",title:"动态 schema 事实抽取",description:"按 ".concat(r.length," 个规范/章节事实字段抽取并检测冲突"),status:"wait",icon:(0,s.jsx)(I.A,{}),subSteps:eP(r.length?r.slice(0,10).map(e=>"抽取事实:".concat(e)):["抽取模板要求的事实","合并来源和角色","检测事实冲突"])},{key:"chapter_generation",title:"章节生成",description:"按 ".concat(c.length," 个模板章节逐章生成"),status:"wait",icon:(0,s.jsx)(C.A,{}),subSteps:eP(c.length?c.slice(0,10).map(e=>"生成:".concat(e)):["构造章节提示词","等待 LLM 生成","整理章节证据"])},...l?[{key:"asset_generation",title:"生成资源处理",description:"根据资源/图片提示词生成或登记本地资源",status:"wait",icon:(0,s.jsx)(T.A,{}),subSteps:eP(["生成资源提示词","保存到 generatedDocuments/assets","登记资源元数据"])}]:[],{key:"validation",title:"规范包与门禁校验",description:t?"执行 ".concat(t.gateRules.length," 条门禁规则"):"执行模板基础校验",status:"wait",icon:(0,s.jsx)(E.A,{}),subSteps:eP([...(null==t?void 0:t.factFields.filter(e=>e.required).map(e=>"必填事实:".concat(e.name)))||[],...(null==t?void 0:t.gateRules.map(e=>"门禁:".concat(e.name)))||["检查章节证据","检查缺失项","检查导出门禁"]].slice(0,10))},{key:"formatting",title:a("documents.flowFormatting"),description:"整理标题、表格、图片、附件引用和正式 Markdown",status:"wait",icon:(0,s.jsx)(R.A,{}),subSteps:eP(["整理标题层级","整理多类型资源引用","生成正式 Markdown"])},{key:"llm_review",title:"LLM 审查优化",description:"再次使用动态 schema、角色和结构化证据审查优化初稿",status:"wait",icon:(0,s.jsx)(P.A,{}),subSteps:eP(["构造审查提示词","检查事实来源和冲突","回填优化后的 Markdown"])},{key:"export_ready",title:"导出就绪",description:"确认 Markdown/HTML/DOCX/PDF 可导出",status:"wait",icon:(0,s.jsx)(N.A,{}),subSteps:eP(["生成导出检查清单","确认阻断项","准备导出格式"])},{key:"done",title:a("documents.flowDone"),description:a("documents.flowDoneDesc"),status:"wait",icon:(0,s.jsx)(O.A,{}),subSteps:eP(["展示生成结果","允许编辑正文","允许导出文件"])}]},eO=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ea;(null==K?void 0:K.loading)&&(K.flowSteps=e,K.activeFlowKey=t,K.loading=n,Q())},e_=(e,t)=>{if("wait"===t)return e.subSteps.map(e=>({...e,status:"wait"}));if("finish"===t)return e.subSteps.map(e=>({...e,status:"finish"}));if("error"===t)return e.subSteps.map((e,t)=>({...e,status:0===t?"error":e.status}));let n=e.subSteps.findIndex(e=>"wait"===e.status);return e.subSteps.map((e,t)=>t<n||-1===n?{...e,status:"finish"}:t===n?{...e,status:"process"}:e)},eL=(e,t,n)=>{ek(e),eb(s=>{let o=s.map(s=>s.key===e?{...s,status:t,description:n||s.description,subSteps:e_(s,t)}:s);return eO(o,e),o})};(0,o.useEffect)(()=>{if(!ea||!eS)return;let e=window.setInterval(()=>{eb(e=>{let t=e.map(e=>{if(e.key!==eS||"process"!==e.status)return e;let t=e.subSteps.findIndex(e=>"process"===e.status),n=t<0?0:Math.min(t+1,e.subSteps.length-1);return{...e,subSteps:e.subSteps.map((e,t)=>t<n?{...e,status:"finish"}:t===n?{...e,status:"process"}:{...e,status:"wait"})}});return eO(t,eS),t})},1400);return()=>window.clearInterval(e)},[eS,ea]);let eD=e=>{eb(t=>{let n=t.findIndex(t=>t.key===e),s=t.map((e,t)=>t<n&&"error"!==e.status?{...e,status:"finish",subSteps:e_(e,"finish")}:e);return eO(s,e),s})},eU=e=>{X.setFieldsValue(null!=e?e:{id:"custom-template-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,documentSpecId:void 0,chapters:[]}),ev(!0)},eJ=async()=>{try{let e=await X.validateFields(),t=await (0,z.l2)(e);Z(t.templates),Y(t.template.id),ev(!1),await eI(),V.success(a("common.success"))}catch(e){e instanceof Error&&V.error(e.message)}},eM=async e=>{try{let t=await (0,z.bV)(e);Z(t.templates),Y(t.template.id),V.success(a("common.success"))}catch(e){V.error(a("common.error"))}},eF=async e=>{try{var t,n;let s=await (0,z.h0)(e);Z(s.templates),Y(null!=(n=null==(t=s.templates[0])?void 0:t.id)?n:""),V.success(a("common.success"))}catch(e){V.error(a("common.error"))}},ez=async e=>{try{await (0,z.QG)(e),eh===e&&(ey(null),el(null),eu("")),await eI(),V.success(a("common.success"))}catch(e){V.error(a("common.error"))}},eq=async e=>{let t=[{key:"chapter_generation",message:"后台任务已创建,正在轮询等待 LLM 章节生成完成…"},{key:"asset_generation",message:"正在轮询等待封面和生成资源写入本地记录…"},{key:"validation",message:"正在轮询等待校验、导出门禁和格式化完成…"},{key:"llm_review",message:"正在轮询等待 LLM 审查优化完成…"}],n=0;for(;;){let{document:s}=await (0,z.v7)(e);if(("completed"===s.status||"warning"===s.status)&&s.draft)return s;if("failed"===s.status)throw Error(s.error||"生成失败");let o=t[Math.min(n,t.length-1)];eD(o.key),eL(o.key,"process",o.message),n+=1,await new Promise(e=>window.setTimeout(e,1500))}},eG=async()=>{if(!$)return;if(null==K?void 0:K.loading){eb(K.flowSteps),ek(K.activeFlowKey),er(!0);return}er(!0);let e=eN(B.find(e=>e.id===$)||eC),t=(0,z.OX)({templateId:$});K={id:Date.now(),templateId:$,loading:!0,flowSteps:e,activeFlowKey:"prepare",promise:t,listeners:new Set},eb(e),ek("prepare");let n=[{key:"role_binding",message:"正在读取模板、文件角色、提示词角色和文档规范包…"},{key:"knowledge_retrieval",message:"正在从知识库检索章节证据、表格、图片和附件…"},{key:"file_understanding",message:"正在准备多模态文件理解;如果模型支持图片/文件理解,会等待模型返回…"},{key:"fact_extraction",message:"正在等待 LLM 事实抽取和后续章节生成结果,请不要关闭页面…"}].map((e,t)=>window.setTimeout(()=>{eD(e.key),eL(e.key,"process",e.message)},600+900*t));try{let e=await t,s=e.documentId?await eq(e.documentId):void 0,o=e.draft||(null==s?void 0:s.draft);if(!o)throw Error("生成结果为空");(e.documentId||(null==s?void 0:s.id))&&ey(e.documentId||s.id),n.forEach(e=>window.clearTimeout(e)),eD("done"),el(o),eu((null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown),(null==K?void 0:K.promise)===t&&(K.draft=o,K.content=(null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown),eb(e=>{let t=e.map(e=>{let t=o.executionStages.find(t=>t.type===e.key);if("prepare"===e.key)return{...e,status:"finish",description:a("documents.flowPrepareDone"),subSteps:e_(e,"finish")};if("done"===e.key){var n;let t=o.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!o.exportGate.passed,s=t?"warning":"finish",i=null==(n=o.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message;return{...e,status:s,description:t?"生成完成,但需要复核:".concat(i||a("documents.flowGateFailed")):a("documents.flowDoneDesc"),subSteps:e_(e,s)}}if(!t)return"process"===e.status?{...e,status:"finish",subSteps:e_(e,"finish")}:e;let s="failed"===t.status?"error":"finish";return{...e,status:s,description:"".concat(t.status.toUpperCase(),":").concat(t.message||e.description),subSteps:e_(e,s)}});return eO(t,"done",!1),t}),ek("done"),(null==K?void 0:K.promise)===t&&(K.activeFlowKey="done",K.loading=!1,Q()),await eI(),V.success(a("common.success"))}catch(n){let e=n instanceof Error?n.message:a("common.error");eb(t=>{let n=t.map(t=>"process"===t.status?{...t,status:"error",description:e,subSteps:e_(t,"error")}:t);return eO(n,eS,!1),n}),(null==K?void 0:K.promise)===t&&(K.loading=!1,K.error=e,Q()),V.error(e)}finally{n.forEach(e=>window.clearTimeout(e)),er(!1),(null==K?void 0:K.promise)===t&&(K.loading=!1,Q())}},eH=async e=>{if(ec){eg(!0);try{let o=null==(t=eo.find(e=>e.id===(null==eC?void 0:eC.documentSpecId)))?void 0:t.wordTemplatePath;var t,n=await (0,z.UE)({documentId:eh||void 0,title:ec.title,markdown:ed,format:e,enforceGate:"pdf"===e||"docx"===e,exportGate:ec.exportGate,wordTemplatePath:o}),s="".concat(ec.title,".").concat("markdown"===e?"md":e);let i=URL.createObjectURL(n),a=document.createElement("a");a.href=i,a.download=s,a.click(),URL.revokeObjectURL(i)}catch(e){V.error(a("common.error"))}finally{eg(!1)}}},eW=async()=>{if(ec)try{if(eh)await (0,z.a6)(eh,{editedMarkdown:ed,markdown:ed});else{let e=await (0,z.Af)({...ec,markdown:ed});el(e.draft)}await eI(),V.success(a("common.success"))}catch(e){V.error(a("common.error"))}},eK=async e=>{if(ec){ej(e.id);try{var t;let n=await (0,z.R1)({templateId:ec.templateId,chapterId:e.id}),s=ec.chapters.map(t=>t.id===e.id?n.chapter:t);el({...ec,chapters:s}),t=n.chapter,eu(n=>n.includes(e.content)?n.replace(e.content,t.content):"".concat(n,"\n\n").concat(t.content)),V.success(a("common.success"))}catch(e){V.error(a("common.error"))}finally{ej(null)}}};return(0,s.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,s.jsx)(l.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"pageTitle mb-1",children:a("documents.title")}),(0,s.jsx)("p",{className:"pageDesc mb-0",children:a("documents.description")})]}),(0,s.jsx)(d.Ay,{type:"primary",size:"large",icon:(0,s.jsx)(D.A,{}),onClick:()=>eU(),children:a("documents.newTemplate")})]})}),(0,s.jsxs)(u.A,{gutter:[16,16],align:"top",children:[(0,s.jsxs)(p.A,{xs:24,lg:8,children:[(0,s.jsx)(l.A,{size:"small",title:a("documents.templateLibrary"),children:(0,s.jsx)(m.A,{dataSource:B,locale:{emptyText:(0,s.jsx)(h.A,{description:a("common.noData")})},renderItem:e=>(0,s.jsx)(m.A.Item,{onClick:()=>Y(e.id),className:"cursor-pointer",actions:[(0,s.jsx)(d.Ay,{size:"small",type:"text",icon:(0,s.jsx)(U.A,{}),onClick:t=>{t.stopPropagation(),eM(e.id)}},"copy"),(0,s.jsx)(d.Ay,{size:"small",type:"text",icon:(0,s.jsx)(J.A,{}),disabled:e.builtIn,onClick:t=>{t.stopPropagation(),eU(e)}},"edit"),(0,s.jsx)(y.A,{title:a("documents.deleteTemplateConfirm"),disabled:e.builtIn,onConfirm:t=>{null==t||t.stopPropagation(),eF(e.id)},children:(0,s.jsx)(d.Ay,{size:"small",type:"text",danger:!0,icon:(0,s.jsx)(L.A,{}),disabled:e.builtIn,onClick:e=>e.stopPropagation()})},"delete")],children:(0,s.jsx)(m.A.Item.Meta,{avatar:(0,s.jsx)(A.A,{}),title:(0,s.jsxs)(f.A,{children:[(0,s.jsx)("span",{children:e.name}),e.builtIn&&(0,s.jsx)(g.A,{children:a("documents.builtIn")}),$===e.id&&(0,s.jsx)(g.A,{color:"blue",children:a("documents.selected")})]}),description:(0,s.jsxs)(f.A,{direction:"vertical",size:2,children:[(0,s.jsx)("span",{children:e.description}),(0,s.jsx)(g.A,{children:e.category})]})})})})}),(0,s.jsx)(l.A,{className:"mt-4",size:"small",title:a("documents.draftHistory"),children:(0,s.jsx)(m.A,{size:"small",dataSource:ep.slice(0,8),locale:{emptyText:(0,s.jsx)(h.A,{description:a("common.noData")})},renderItem:e=>{var t,n,o;return(0,s.jsx)(m.A.Item,{onClick:()=>{(async()=>{ey(e.id),Y(e.templateId);let{document:t}=await (0,z.v7)(e.id);el(t.draft||null),eu(t.editedMarkdown||t.markdown)})()},className:"cursor-pointer",actions:[(0,s.jsx)(y.A,{title:"确认删除这条生成记录?",onConfirm:t=>{null==t||t.stopPropagation(),ez(e.id)},children:(0,s.jsx)(d.Ay,{size:"small",type:"text",danger:!0,icon:(0,s.jsx)(L.A,{}),onClick:e=>e.stopPropagation()})},"delete")],children:(0,s.jsx)(m.A.Item.Meta,{title:(0,s.jsxs)(f.A,{children:[(0,s.jsx)("span",{children:e.title}),(0,s.jsx)(g.A,{color:"completed"===e.status?"success":"warning"===e.status?"warning":"failed"===e.status?"error":"processing",children:"warning"===e.status?"warning":e.status})]}),description:(0,s.jsxs)(f.A,{direction:"vertical",size:0,children:[(0,s.jsx)("span",{children:new Date(e.updatedAt).toLocaleString()}),"warning"===e.status&&(0,s.jsx)(W,{type:"warning",ellipsis:!0,children:(null==(t=e.warningIssues)?void 0:t[0])||(null==(o=e.draft)||null==(n=o.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message)||"生成完成,但存在需要复核的问题"})]})})})}})})]}),(0,s.jsx)(p.A,{xs:24,lg:16,children:(0,s.jsx)(l.A,{size:"small",title:a("documents.workflow"),children:(0,s.jsxs)(f.A,{direction:"vertical",className:"w-full",size:"middle",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block mb-1",children:a("documents.template")}),(0,s.jsx)(x.A,{className:"w-full",value:$,onChange:Y,options:B.map(e=>({label:e.name,value:e.id}))})]}),eC&&(0,s.jsxs)(l.A,{size:"small",type:"inner",title:eC.outputTitle,children:[(0,s.jsx)(H,{children:eC.description}),(0,s.jsxs)(f.A,{wrap:!0,children:[eC.projectRoleConfigId?(0,s.jsx)(g.A,{color:"geekblue",children:(null==(e=en.find(e=>e.id===eC.projectRoleConfigId))?void 0:e.name)||eC.projectRoleConfigId}):(0,s.jsx)(g.A,{color:"warning",children:a("documents.noRoleConfig")}),eC.documentSpecId?(0,s.jsx)(g.A,{color:"cyan",children:(null==(t=eo.find(e=>e.id===eC.documentSpecId))?void 0:t.name)||eC.documentSpecId}):null]})]}),eC&&(0,s.jsx)(f.A,{direction:"vertical",size:4,children:(0,s.jsxs)("span",{children:[a("documents.projectRoleConfig"),": ",(null==(n=en.find(e=>e.id===eC.projectRoleConfigId))?void 0:n.name)||a("documents.noRoleConfig")]})}),(0,s.jsx)(d.Ay,{type:"primary",size:"large",block:!0,icon:(0,s.jsx)(P.A,{}),loading:ea,disabled:!(null==eC?void 0:eC.projectRoleConfigId),onClick:()=>{eG()},children:a("documents.generate")}),eA.length>0&&(0,s.jsx)(l.A,{size:"small",type:"inner",title:a("documents.executionStatus"),children:(0,s.jsx)(j.A,{direction:"vertical",size:"small",current:eR,items:eA.map(e=>{let t;return{title:e.title,description:(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{children:e.description}),(0,s.jsx)("div",{className:"space-y-0.5",children:e.subSteps.map(e=>{var t;return(0,s.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--colorTextSecondary)]",children:["process"===(t=e.status)?(0,s.jsx)(_.A,{}):"finish"===t?(0,s.jsx)(R.A,{}):"warning"===t?(0,s.jsx)(E.A,{className:"text-[var(--colorWarning)]"}):"error"===t?(0,s.jsx)(L.A,{}):(0,s.jsx)("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-[var(--colorTextTertiary)]"}),(0,s.jsx)("span",{children:e.title})]},e.key)})})]}),status:"warning"===(t=e.status)?"finish":t,icon:"process"===e.status?(0,s.jsx)(_.A,{}):"warning"===e.status?(0,s.jsx)(E.A,{className:"text-[var(--colorWarning)]"}):e.icon}})})})]})})})]}),(0,s.jsx)(l.A,{size:"small",title:a("documents.editor"),extra:(0,s.jsx)(f.A,{wrap:!0,children:ec&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Ay,{icon:(0,s.jsx)(M.A,{}),onClick:()=>{eW()},children:a("documents.saveDraft")}),(0,s.jsx)(d.Ay,{icon:(0,s.jsx)(O.A,{}),loading:ef,onClick:()=>{eH("markdown")},children:a("documents.downloadMarkdown")}),(0,s.jsx)(d.Ay,{loading:ef,onClick:()=>{eH("html")},children:a("documents.exportHtml")}),(0,s.jsx)(d.Ay,{loading:ef,onClick:()=>{eH("docx")},children:a("documents.exportDocx")}),(0,s.jsx)(d.Ay,{type:"primary",loading:ef,onClick:()=>{eH("pdf")},children:a("documents.exportPdf")})]})}),children:ec?(0,s.jsx)(w.A,{items:[{key:"edit",label:a("documents.edit"),children:(0,s.jsx)(G,{rows:26,value:ed,onChange:e=>eu(e.target.value)})},{key:"chapters",label:a("documents.chapters"),children:(0,s.jsx)(m.A,{dataSource:ec.chapters,renderItem:e=>(0,s.jsx)(m.A.Item,{actions:[(0,s.jsx)(d.Ay,{size:"small",icon:(0,s.jsx)(F.A,{}),loading:ex===e.id,onClick:()=>{eK(e)},children:a("documents.regenerateChapter")},"regen")],children:(0,s.jsx)(m.A.Item.Meta,{title:e.title,description:(0,s.jsxs)(f.A,{direction:"vertical",children:[(0,s.jsxs)("span",{children:[a("documents.evidenceCount"),": ",e.evidence.length]}),(0,s.jsxs)("span",{children:[a("documents.missingCount"),": ",e.missingFacts.length]})]})})})})},{key:"facts",label:a("documents.structuredFacts"),children:(0,s.jsx)(m.A,{dataSource:ec.structuredFacts,renderItem:e=>{var t;return(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)(m.A.Item.Meta,{title:"".concat(e.key,": ").concat(e.value),description:"".concat(e.sourceFile," \xb7 ").concat((null==(t=ee.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId)}),(0,s.jsx)(g.A,{children:e.confidence.toFixed(2)})]})}})},{key:"sources",label:a("documents.sources"),children:(0,s.jsx)(m.A,{dataSource:ec.sources,renderItem:e=>(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)("span",{children:e.filePath}),(0,s.jsx)(g.A,{children:e.count})]})})},{key:"missing",label:a("documents.missingItems"),children:0===ec.missingItems.length?(0,s.jsx)(h.A,{description:a("common.noData")}):(0,s.jsx)(m.A,{dataSource:ec.missingItems,renderItem:e=>(0,s.jsx)(m.A.Item,{children:e})})},{key:"validation",label:a("documents.validation"),children:(0,s.jsx)(f.A,{direction:"vertical",className:"w-full",children:ec.validationIssues.map(e=>(0,s.jsxs)(g.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:[e.message,e.suggestion?":".concat(e.suggestion):""]},e.message))})},{key:"gate",label:a("documents.exportGate"),children:(0,s.jsx)(m.A,{dataSource:ec.exportGate.checklist,renderItem:e=>(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)("span",{children:e.label}),(0,s.jsx)(g.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})},{key:"stages",label:a("documents.executionStages"),children:(0,s.jsx)(m.A,{dataSource:ec.executionStages,renderItem:e=>{var t,n;return(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)(m.A.Item.Meta,{avatar:(t=e.type,({role_binding:(0,s.jsx)(b.A,{}),knowledge_retrieval:(0,s.jsx)(S.A,{}),file_understanding:(0,s.jsx)(k.A,{}),fact_extraction:(0,s.jsx)(I.A,{}),chapter_generation:(0,s.jsx)(C.A,{}),asset_generation:(0,s.jsx)(T.A,{}),validation:(0,s.jsx)(E.A,{}),formatting:(0,s.jsx)(R.A,{}),llm_review:(0,s.jsx)(P.A,{}),export_ready:(0,s.jsx)(N.A,{}),reference:(0,s.jsx)(T.A,{})})[t]||(0,s.jsx)(A.A,{})),title:"".concat({role_binding:"角色配置绑定",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",asset_generation:"多模态资源生成",validation:"规则校验",formatting:"格式化排版",llm_review:"LLM 审查优化",export_ready:"导出就绪",reference:"参考资源处理"}[n=e.type]||n," \xb7 ").concat(e.roleId),description:e.message}),(0,s.jsx)(g.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})}})}]}):(0,s.jsx)(h.A,{description:a("documents.noDraft")})}),(0,s.jsx)(v.A,{maskClosable:!1,title:a("documents.templateEditor"),open:ew,onOk:()=>{eJ()},onCancel:()=>ev(!1),width:760,centered:!0,okText:a("common.save"),children:(0,s.jsxs)(c.A,{form:X,layout:"vertical",requiredMark:"optional",children:[(0,s.jsxs)(u.A,{gutter:12,children:[(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,s.jsx)(i.A,{disabled:!0})})}),(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"name",label:a("documents.templateName"),rules:[{required:!0}],children:(0,s.jsx)(i.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"category",label:a("documents.templateCategory"),children:(0,s.jsx)(i.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:12,children:(0,s.jsx)(c.A.Item,{name:"outputTitle",label:a("documents.outputTitle"),children:(0,s.jsx)(i.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:12,children:(0,s.jsx)(c.A.Item,{name:"description",label:a("documents.templateDescription"),children:(0,s.jsx)(i.A,{})})})]}),(0,s.jsx)(c.A.Item,{name:"projectRoleConfigId",label:a("documents.projectRoleConfig"),rules:[{required:!0,message:a("documents.projectRoleConfigRequired")}],children:(0,s.jsx)(x.A,{showSearch:!0,placeholder:a("documents.projectRoleConfigRequired"),options:eT})}),(0,s.jsx)(c.A.Item,{name:"documentSpecId",label:a("documents.documentSpec"),children:(0,s.jsx)(x.A,{allowClear:!0,showSearch:!0,placeholder:a("documents.documentSpecPlaceholder"),options:eE})})]})})]})}}},e=>{e.O(0,[260,167,382,628,271,576,700,174,183,232,292,951,858,617,636,593,792],()=>e(e.s=16403)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,e,t,c,a,d,
|
|
1
|
+
self.__BUILD_MANIFEST=function(s,e,t,c,a,n,d,i,u,o,b,r,k,f,h,g,l,j,m,p,_,w,x,I,v){return{__rewrites:{afterFiles:[],beforeFiles:[{has:j,source:"/_next/static/:buildId/_buildManifest.js",destination:"/_next/static/customize-agent-dashboard/_buildManifest.js"},{has:j,source:"/_next/static/:buildId/_ssgManifest.js",destination:"/_next/static/customize-agent-dashboard/_ssgManifest.js"}],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:p,bitArray:[]},__routerFilterDynamic:{numItems:f,errorRate:1e-4,numBits:f,numHashes:p,bitArray:[]},"/":["static/chunks/pages/index-c5e0758e6b31deee.js"],"/_error":["static/chunks/pages/_error-282257fbdcc167b4.js"],"/asset-library":[s,e,t,c,a,n,i,u,r,h,"static/chunks/881-a1eb917222b66f09.js","static/chunks/pages/asset-library-82606363f9142bad.js"],"/context/long-term":[s,e,t,c,a,d,n,i,u,o,b,k,_,"static/chunks/pages/context/long-term-f2a550bc848ec1a3.js"],"/context/short-term":[s,e,t,c,a,d,n,i,u,o,b,k,_,"static/chunks/pages/context/short-term-1de28da82d2b6276.js"],"/document-roles":[s,e,t,c,a,d,n,i,u,b,h,"static/chunks/pages/document-roles-54a1cc04116e8c18.js"],"/document-specs":[s,e,t,c,a,d,n,i,u,b,h,g,"static/chunks/pages/document-specs-723dee6883949a17.js"],"/documents":[s,e,t,c,a,d,n,i,u,b,r,h,w,"static/chunks/617-68a9e848c380f9c3.js","static/chunks/pages/documents-12e1d81f932ae062.js"],"/guide":[s,e,t,r,w,"static/chunks/969-5d5ff5a3ed74f52b.js","static/chunks/pages/guide-acf32d66a6df6e5a.js"],"/knowledge":["static/chunks/pages/knowledge-905248d8dcb15453.js"],"/knowledge/file-detail":[s,e,t,c,a,d,n,i,o,k,r,x,"static/chunks/80-96429163e5c103a8.js",l,"static/chunks/pages/knowledge/file-detail-7a1a3d4352ecfa0a.js"],"/knowledge/files":[s,e,t,c,a,d,n,i,o,k,I,l,"static/chunks/pages/knowledge/files-f0e05583bf7c57d9.js"],"/knowledge/manage":[s,e,t,c,a,n,i,o,k,v,"static/chunks/935-daa0026982d7fa8d.js","static/chunks/pages/knowledge/manage-8acff53019eb6cc1.js"],"/knowledge/search":[s,e,t,c,d,n,r,g,x,l,"static/chunks/pages/knowledge/search-1f3bd8fcb7af3e4d.js"],"/models":[s,e,t,c,a,d,u,o,b,g,"static/css/0e153583d22cc52e.css","static/chunks/pages/models-11533caad3723009.js"],"/overview":[s,e,I,v,"static/chunks/224-9a7074031493793b.js","static/chunks/pages/overview-f80672c242d9aa32.js"],"/prompt":[s,e,t,c,d,u,o,"static/chunks/pages/prompt-c9bc7884a44d3767.js"],"/settings":[s,"static/css/82b6ddff0ef364fe.css","static/chunks/pages/settings-68f0d05bf95d12da.js"],sortedPages:["/","/_app","/_error","/asset-library","/context/long-term","/context/short-term","/document-roles","/document-specs","/documents","/guide","/knowledge","/knowledge/file-detail","/knowledge/files","/knowledge/manage","/knowledge/search","/models","/overview","/prompt","/settings"]}}("static/chunks/260-cec84dc6c353e104.js","static/chunks/167-d4f384b289ecb70c.js","static/chunks/382-6ab5f41cd91edad0.js","static/chunks/628-27424ba8ca9ca8ce.js","static/chunks/271-39045be4cdbd6af1.js","static/chunks/700-5d29b0475311f590.js","static/chunks/576-fd55b302cb0c9a48.js","static/chunks/174-51b6d64f21e9b976.js","static/chunks/183-8da0232dd30cdc81.js","static/chunks/985-4b4a3ed36ada16eb.js","static/chunks/232-813af4932a145fdc.js","static/chunks/292-f0a2c92861c304e6.js","static/chunks/400-1fa1899b7c3f0bb4.js",0,"static/chunks/951-8ecf8af33ab36369.js","static/chunks/20-8968ee2d4013a5b8.js","static/css/d284a7454d6f6b06.css",void 0,1e-4,NaN,"static/chunks/257-e4ebae17a8ee8412.js","static/chunks/858-5e6982e2b239d4b7.js","static/chunks/350-8c5e13c0577a38c3.js","static/chunks/15-4683808cb8db7005.js","static/chunks/577-5b2691f0c8f17187.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{6578:(e,t,n)=>{"use strict";async function s(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function o(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return s("/api/kb/stats".concat(t))}async function i(e){var t,n;let o=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&o.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&o.set("category",e.category),(null==e?void 0:e.page)&&o.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&o.set("limit",String(null!=(n=e.limit)?n:50)),s("/api/kb/files?".concat(o))}async function a(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),s("/api/kb/files/detail?".concat(n))}async function r(e,t){return s("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function c(e,t,n){return s("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let s=new FileReader;s.onload=()=>{let e=s.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},s.onerror=n,s.readAsDataURL(e)})}async function d(e,t,n){return s("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return s("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return s("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return s("/api/kb/features")}async function j(e,t){var n,o,i,a,r;let c=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&c.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&c.set("category",t.category),(null==t?void 0:t.limit)&&c.set("limit",String(null!=(r=t.limit)?r:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(o=t.weights)?void 0:o.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(i=t.weights)?void 0:i.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(a=t.weights)?void 0:a.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),s("/api/kb/search?".concat(c))}async function w(){return s("/api/prompt")}async function A(e){return s("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function v(e){return s("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function b(e,t){return s("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function S(e){return s("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return s("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function I(){return s("/api/documents/specs")}async function C(e){return s("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return s("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return s("/api/documents/templates")}async function R(e){return s("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(e){return s("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function N(e){return s("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function O(e){return s("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(){return s("/api/documents/generated")}async function L(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,t){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function U(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function J(){return s("/api/assets/generated")}async function M(e){return s("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function F(e){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function z(e,t){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function G(e){return s("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(e,t){return s("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function H(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function K(){return s("/api/config/providers")}async function Q(e,t){return s("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function V(e){return s("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function W(){return s("/api/config/models")}async function X(e){return s("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function B(){return s("/api/config/embedding")}async function Z(e){return s("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(){return s("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return s("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function ee(){return s("/api/system/stats")}async function et(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return s("/api/context".concat(n))}async function en(e){return s("/api/context?type=".concat(e,"&stats=1"))}async function es(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function eo(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ei(e){return s("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ea(e,t){return s("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function er(e){return s("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>q,Bh:()=>er,Dl:()=>E,E:()=>eo,EK:()=>C,ER:()=>T,FC:()=>ee,FV:()=>b,H1:()=>g,H7:()=>m,HC:()=>r,HT:()=>i,II:()=>B,JU:()=>M,NR:()=>S,OX:()=>O,PH:()=>es,QG:()=>U,QT:()=>u,Qx:()=>p,R1:()=>G,SJ:()=>y,UE:()=>H,VW:()=>x,W2:()=>j,X8:()=>f,Z3:()=>K,_m:()=>Q,a6:()=>D,aP:()=>X,bV:()=>N,bZ:()=>Y,c1:()=>d,cQ:()=>_,dd:()=>Z,dg:()=>v,dw:()=>k,dx:()=>w,f$:()=>J,h0:()=>P,h1:()=>V,hc:()=>o,hn:()=>et,l2:()=>R,lv:()=>A,mx:()=>I,oS:()=>z,p:()=>en,tn:()=>c,u6:()=>$,uc:()=>F,v7:()=>L,xC:()=>a,xq:()=>h,xw:()=>ei,zo:()=>ea,zr:()=>W})},16403:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return n(19562)}])},19562:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>V});var s=n(65321),o=n(97109),i=n(7576),a=n(35292),r=n(17807),c=n(63455),l=n(68787),d=n(85114),u=n(2256),p=n(38770),m=n(38332),h=n(84253),y=n(26171),f=n(33442),g=n(11702),x=n(57271),j=n(9730),w=n(58569),A=n(25258),v=n(26631),b=n(23216),S=n(26619),k=n(8263),I=n(16285),C=n(8579),T=n(75548),E=n(7851),R=n(84742),P=n(29071),N=n(63552),O=n(76830),_=n(83914),L=n(58209),D=n(54746),U=n(93051),J=n(99650),M=n(67547),F=n(99811),z=n(6578),G=n(13014);let{TextArea:q}=i.A,{Paragraph:H}=a.A,K=null;function Q(){null==K||K.listeners.forEach(e=>e())}function V(){var e,t,n;let a=(0,G.Vr)(),{message:V}=r.A.useApp(),[W]=c.A.useForm(),[X,B]=(0,o.useState)([]),[Z,$]=(0,o.useState)("construction-organization-design"),[Y,ee]=(0,o.useState)([]),[et,en]=(0,o.useState)([]),[es,eo]=(0,o.useState)([]),[ei,ea]=(0,o.useState)(!1),[er,ec]=(0,o.useState)(null),[el,ed]=(0,o.useState)(""),[eu,ep]=(0,o.useState)([]),[em,eh]=(0,o.useState)(null),[ey,ef]=(0,o.useState)(!1),[eg,ex]=(0,o.useState)(null),[ej,ew]=(0,o.useState)(!1),[eA,ev]=(0,o.useState)([]),[eb,eS]=(0,o.useState)(null),ek=async()=>{try{ep((await (0,z.cQ)()).documents)}catch(e){ep([])}};(0,o.useEffect)(()=>{let e=()=>{K&&(ev(K.flowSteps),eS(K.activeFlowKey),ea(K.loading),K.draft&&ec(K.draft),void 0!==K.content&&ed(K.content))};return null==K||K.listeners.add(e),e(),()=>{null==K||K.listeners.delete(e)}},[]),(0,o.useEffect)(()=>{(0,z.Dl)().then(e=>{var t,n;B(e.templates),$(null!=(n=null==(t=e.templates[0])?void 0:t.id)?n:"construction-organization-design")}).catch(()=>V.error(a("common.error"))),(0,z.lv)().then(e=>{ee(e.roles),en(e.configs)}).catch(()=>{ee([]),en([])}),(0,z.mx)().then(e=>eo(e.specs)).catch(()=>eo([])),ek()},[V,a]);let eI=(0,o.useMemo)(()=>X.find(e=>e.id===Z),[X,Z]),eC=et.map(e=>({label:e.name,value:e.id})),eT=es.map(e=>({label:e.name,value:e.id})),eE=Math.max(0,eA.findIndex(e=>e.key===eb)),eR=e=>e.map((e,t)=>({key:"sub-".concat(t),title:e,status:"wait"})),eP=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eI,t=es.find(t=>t.id===(null==e?void 0:e.documentSpecId)),n=et.find(t=>t.id===(null==e?void 0:e.projectRoleConfigId)),o=((null==n?void 0:n.fileRoles)||[]).map(e=>{var t;return(null==(t=Y.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),i=((null==n?void 0:n.promptRoles)||[]).map(e=>{var t;return(null==(t=Y.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),r=(null==t?void 0:t.factFields.map(e=>e.name))||(null==e?void 0:e.chapters.flatMap(e=>e.requiredFacts))||[],c=(null==e?void 0:e.chapters.map(e=>e.title))||[],l=i.some(e=>/封面|图片|资源|cover|image/iu.test(e));return[{key:"prepare",title:a("documents.flowPrepare"),description:"读取“".concat((null==e?void 0:e.name)||"当前模板","”并创建后台生成任务"),status:"process",icon:(0,s.jsx)(v.A,{}),subSteps:eR(["读取模板参数",(null==e?void 0:e.documentSpecId)?"加载规范包:".concat((null==t?void 0:t.name)||e.documentSpecId):"未绑定规范包,使用模板章节要求","创建后台生成任务"])},{key:"role_binding",title:"动态角色配置绑定",description:"绑定 ".concat(o.length," 个文件角色、").concat(i.length," 个提示词角色"),status:"wait",icon:(0,s.jsx)(b.A,{}),subSteps:eR([...o.length?o.map(e=>"文件角色:".concat(e)):["没有文件角色,使用模板绑定文件"],...i.length?i.map(e=>"提示词角色:".concat(e)):["没有提示词角色,使用默认生成策略"]].slice(0,10))},{key:"knowledge_retrieval",title:"知识库证据检索",description:"按 ".concat(c.length," 个章节检索文本、文档、表格、图片、图纸和附件"),status:"wait",icon:(0,s.jsx)(S.A,{}),subSteps:eR(c.length?c.slice(0,10).map(e=>"检索章节:".concat(e)):["按模板标题检索证据"])},{key:"file_understanding",title:"多类型文件理解",description:"按文件角色处理文本、PDF/Word、表格、图片、图纸和附件",status:"wait",icon:(0,s.jsx)(k.A,{}),subSteps:eR(["识别文件类型和角色","构建结构化资源证据包","必要时调用多模态文件理解"])},{key:"fact_extraction",title:"动态 schema 事实抽取",description:"按 ".concat(r.length," 个规范/章节事实字段抽取并检测冲突"),status:"wait",icon:(0,s.jsx)(I.A,{}),subSteps:eR(r.length?r.slice(0,10).map(e=>"抽取事实:".concat(e)):["抽取模板要求的事实","合并来源和角色","检测事实冲突"])},{key:"chapter_generation",title:"章节生成",description:"按 ".concat(c.length," 个模板章节逐章生成"),status:"wait",icon:(0,s.jsx)(C.A,{}),subSteps:eR(c.length?c.slice(0,10).map(e=>"生成:".concat(e)):["构造章节提示词","等待 LLM 生成","整理章节证据"])},...l?[{key:"asset_generation",title:"生成资源处理",description:"根据资源/图片提示词生成或登记本地资源",status:"wait",icon:(0,s.jsx)(T.A,{}),subSteps:eR(["生成资源提示词","保存到 generatedDocuments/assets","登记资源元数据"])}]:[],{key:"validation",title:"规范包与门禁校验",description:t?"执行 ".concat(t.gateRules.length," 条门禁规则"):"执行模板基础校验",status:"wait",icon:(0,s.jsx)(E.A,{}),subSteps:eR([...(null==t?void 0:t.factFields.filter(e=>e.required).map(e=>"必填事实:".concat(e.name)))||[],...(null==t?void 0:t.gateRules.map(e=>"门禁:".concat(e.name)))||["检查章节证据","检查缺失项","检查导出门禁"]].slice(0,10))},{key:"formatting",title:a("documents.flowFormatting"),description:"整理标题、表格、图片、附件引用和正式 Markdown",status:"wait",icon:(0,s.jsx)(R.A,{}),subSteps:eR(["整理标题层级","整理多类型资源引用","生成正式 Markdown"])},{key:"llm_review",title:"LLM 审查优化",description:"再次使用动态 schema、角色和结构化证据审查优化初稿",status:"wait",icon:(0,s.jsx)(P.A,{}),subSteps:eR(["构造审查提示词","检查事实来源和冲突","回填优化后的 Markdown"])},{key:"export_ready",title:"导出就绪",description:"确认 Markdown/HTML/DOCX/PDF 可导出",status:"wait",icon:(0,s.jsx)(N.A,{}),subSteps:eR(["生成导出检查清单","确认阻断项","准备导出格式"])},{key:"done",title:a("documents.flowDone"),description:a("documents.flowDoneDesc"),status:"wait",icon:(0,s.jsx)(O.A,{}),subSteps:eR(["展示生成结果","允许编辑正文","允许导出文件"])}]},eN=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ei;(null==K?void 0:K.loading)&&(K.flowSteps=e,K.activeFlowKey=t,K.loading=n,Q())},eO=(e,t)=>{if("wait"===t)return e.subSteps.map(e=>({...e,status:"wait"}));if("finish"===t)return e.subSteps.map(e=>({...e,status:"finish"}));if("error"===t)return e.subSteps.map((e,t)=>({...e,status:0===t?"error":e.status}));let n=e.subSteps.findIndex(e=>"wait"===e.status);return e.subSteps.map((e,t)=>t<n||-1===n?{...e,status:"finish"}:t===n?{...e,status:"process"}:e)},e_=(e,t,n)=>{eS(e),ev(s=>{let o=s.map(s=>s.key===e?{...s,status:t,description:n||s.description,subSteps:eO(s,t)}:s);return eN(o,e),o})};(0,o.useEffect)(()=>{if(!ei||!eb)return;let e=window.setInterval(()=>{ev(e=>{let t=e.map(e=>{if(e.key!==eb||"process"!==e.status)return e;let t=e.subSteps.findIndex(e=>"process"===e.status),n=t<0?0:Math.min(t+1,e.subSteps.length-1);return{...e,subSteps:e.subSteps.map((e,t)=>t<n?{...e,status:"finish"}:t===n?{...e,status:"process"}:{...e,status:"wait"})}});return eN(t,eb),t})},1400);return()=>window.clearInterval(e)},[eb,ei]);let eL=e=>{ev(t=>{let n=t.findIndex(t=>t.key===e),s=t.map((e,t)=>t<n&&"error"!==e.status?{...e,status:"finish",subSteps:eO(e,"finish")}:e);return eN(s,e),s})},eD=e=>{W.setFieldsValue(null!=e?e:{id:"custom-template-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,documentSpecId:void 0,chapters:[]}),ew(!0)},eU=async()=>{try{let e=await W.validateFields(),t=await (0,z.l2)(e);B(t.templates),$(t.template.id),ew(!1),await ek(),V.success(a("common.success"))}catch(e){e instanceof Error&&V.error(e.message)}},eJ=async e=>{try{let t=await (0,z.bV)(e);B(t.templates),$(t.template.id),V.success(a("common.success"))}catch(e){V.error(a("common.error"))}},eM=async e=>{try{var t,n;let s=await (0,z.h0)(e);B(s.templates),$(null!=(n=null==(t=s.templates[0])?void 0:t.id)?n:""),V.success(a("common.success"))}catch(e){V.error(a("common.error"))}},eF=async e=>{try{await (0,z.QG)(e),em===e&&(eh(null),ec(null),ed("")),await ek(),V.success(a("common.success"))}catch(e){V.error(a("common.error"))}},ez=async e=>{let t=[{key:"chapter_generation",message:"后台任务已创建,正在轮询等待 LLM 章节生成完成…"},{key:"asset_generation",message:"正在轮询等待封面和生成资源写入本地记录…"},{key:"validation",message:"正在轮询等待校验、导出门禁和格式化完成…"},{key:"llm_review",message:"正在轮询等待 LLM 审查优化完成…"}],n=0;for(;;){let{document:s}=await (0,z.v7)(e);if("completed"===s.status&&s.draft)return s;if("failed"===s.status)throw Error(s.error||"生成失败");let o=t[Math.min(n,t.length-1)];eL(o.key),e_(o.key,"process",o.message),n+=1,await new Promise(e=>window.setTimeout(e,1500))}},eG=async()=>{if(!Z)return;if(null==K?void 0:K.loading){ev(K.flowSteps),eS(K.activeFlowKey),ea(!0);return}ea(!0);let e=eP(X.find(e=>e.id===Z)||eI),t=(0,z.OX)({templateId:Z});K={id:Date.now(),templateId:Z,loading:!0,flowSteps:e,activeFlowKey:"prepare",promise:t,listeners:new Set},ev(e),eS("prepare");let n=[{key:"role_binding",message:"正在读取模板、文件角色、提示词角色和文档规范包…"},{key:"knowledge_retrieval",message:"正在从知识库检索章节证据、表格、图片和附件…"},{key:"file_understanding",message:"正在准备多模态文件理解;如果模型支持图片/文件理解,会等待模型返回…"},{key:"fact_extraction",message:"正在等待 LLM 事实抽取和后续章节生成结果,请不要关闭页面…"}].map((e,t)=>window.setTimeout(()=>{eL(e.key),e_(e.key,"process",e.message)},600+900*t));try{let e=await t,s=e.documentId?await ez(e.documentId):void 0,o=e.draft||(null==s?void 0:s.draft);if(!o)throw Error("生成结果为空");(e.documentId||(null==s?void 0:s.id))&&eh(e.documentId||s.id),n.forEach(e=>window.clearTimeout(e)),eL("done"),ec(o),ed((null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown),(null==K?void 0:K.promise)===t&&(K.draft=o,K.content=(null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown),ev(e=>{let t=e.map(e=>{let t=o.executionStages.find(t=>t.type===e.key);if("prepare"===e.key)return{...e,status:"finish",description:a("documents.flowPrepareDone"),subSteps:eO(e,"finish")};if("done"===e.key){let t=o.exportGate.passed?"finish":"error";return{...e,status:t,description:o.exportGate.passed?a("documents.flowDoneDesc"):a("documents.flowGateFailed"),subSteps:eO(e,t)}}if(!t)return"process"===e.status?{...e,status:"finish",subSteps:eO(e,"finish")}:e;let n="failed"===t.status?"error":"finish";return{...e,status:n,description:"".concat(t.status.toUpperCase(),":").concat(t.message||e.description),subSteps:eO(e,n)}});return eN(t,"done",!1),t}),eS("done"),(null==K?void 0:K.promise)===t&&(K.activeFlowKey="done",K.loading=!1,Q()),await ek(),V.success(a("common.success"))}catch(n){let e=n instanceof Error?n.message:a("common.error");ev(t=>{let n=t.map(t=>"process"===t.status?{...t,status:"error",description:e,subSteps:eO(t,"error")}:t);return eN(n,eb,!1),n}),(null==K?void 0:K.promise)===t&&(K.loading=!1,K.error=e,Q()),V.error(e)}finally{n.forEach(e=>window.clearTimeout(e)),ea(!1),(null==K?void 0:K.promise)===t&&(K.loading=!1,Q())}},eq=async e=>{if(er){ef(!0);try{let o=null==(t=es.find(e=>e.id===(null==eI?void 0:eI.documentSpecId)))?void 0:t.wordTemplatePath;var t,n=await (0,z.UE)({documentId:em||void 0,title:er.title,markdown:el,format:e,enforceGate:"pdf"===e||"docx"===e,exportGate:er.exportGate,wordTemplatePath:o}),s="".concat(er.title,".").concat("markdown"===e?"md":e);let i=URL.createObjectURL(n),a=document.createElement("a");a.href=i,a.download=s,a.click(),URL.revokeObjectURL(i)}catch(e){V.error(a("common.error"))}finally{ef(!1)}}},eH=async()=>{if(er)try{if(em)await (0,z.a6)(em,{editedMarkdown:el,markdown:el});else{let e=await (0,z.Af)({...er,markdown:el});ec(e.draft)}await ek(),V.success(a("common.success"))}catch(e){V.error(a("common.error"))}},eK=async e=>{if(er){ex(e.id);try{var t;let n=await (0,z.R1)({templateId:er.templateId,chapterId:e.id}),s=er.chapters.map(t=>t.id===e.id?n.chapter:t);ec({...er,chapters:s}),t=n.chapter,ed(n=>n.includes(e.content)?n.replace(e.content,t.content):"".concat(n,"\n\n").concat(t.content)),V.success(a("common.success"))}catch(e){V.error(a("common.error"))}finally{ex(null)}}};return(0,s.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,s.jsx)(l.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"pageTitle mb-1",children:a("documents.title")}),(0,s.jsx)("p",{className:"pageDesc mb-0",children:a("documents.description")})]}),(0,s.jsx)(d.Ay,{type:"primary",size:"large",icon:(0,s.jsx)(D.A,{}),onClick:()=>eD(),children:a("documents.newTemplate")})]})}),(0,s.jsxs)(u.A,{gutter:[16,16],align:"top",children:[(0,s.jsxs)(p.A,{xs:24,lg:8,children:[(0,s.jsx)(l.A,{size:"small",title:a("documents.templateLibrary"),children:(0,s.jsx)(m.A,{dataSource:X,locale:{emptyText:(0,s.jsx)(h.A,{description:a("common.noData")})},renderItem:e=>(0,s.jsx)(m.A.Item,{onClick:()=>$(e.id),className:"cursor-pointer",actions:[(0,s.jsx)(d.Ay,{size:"small",type:"text",icon:(0,s.jsx)(U.A,{}),onClick:t=>{t.stopPropagation(),eJ(e.id)}},"copy"),(0,s.jsx)(d.Ay,{size:"small",type:"text",icon:(0,s.jsx)(J.A,{}),disabled:e.builtIn,onClick:t=>{t.stopPropagation(),eD(e)}},"edit"),(0,s.jsx)(y.A,{title:a("documents.deleteTemplateConfirm"),disabled:e.builtIn,onConfirm:t=>{null==t||t.stopPropagation(),eM(e.id)},children:(0,s.jsx)(d.Ay,{size:"small",type:"text",danger:!0,icon:(0,s.jsx)(L.A,{}),disabled:e.builtIn,onClick:e=>e.stopPropagation()})},"delete")],children:(0,s.jsx)(m.A.Item.Meta,{avatar:(0,s.jsx)(v.A,{}),title:(0,s.jsxs)(f.A,{children:[(0,s.jsx)("span",{children:e.name}),e.builtIn&&(0,s.jsx)(g.A,{children:a("documents.builtIn")}),Z===e.id&&(0,s.jsx)(g.A,{color:"blue",children:a("documents.selected")})]}),description:(0,s.jsxs)(f.A,{direction:"vertical",size:2,children:[(0,s.jsx)("span",{children:e.description}),(0,s.jsx)(g.A,{children:e.category})]})})})})}),(0,s.jsx)(l.A,{className:"mt-4",size:"small",title:a("documents.draftHistory"),children:(0,s.jsx)(m.A,{size:"small",dataSource:eu.slice(0,8),locale:{emptyText:(0,s.jsx)(h.A,{description:a("common.noData")})},renderItem:e=>(0,s.jsx)(m.A.Item,{onClick:()=>{(async()=>{eh(e.id),$(e.templateId);let{document:t}=await (0,z.v7)(e.id);ec(t.draft||null),ed(t.editedMarkdown||t.markdown)})()},className:"cursor-pointer",actions:[(0,s.jsx)(y.A,{title:"确认删除这条生成记录?",onConfirm:t=>{null==t||t.stopPropagation(),eF(e.id)},children:(0,s.jsx)(d.Ay,{size:"small",type:"text",danger:!0,icon:(0,s.jsx)(L.A,{}),onClick:e=>e.stopPropagation()})},"delete")],children:(0,s.jsx)(m.A.Item.Meta,{title:(0,s.jsxs)(f.A,{children:[(0,s.jsx)("span",{children:e.title}),(0,s.jsx)(g.A,{color:"completed"===e.status?"success":"failed"===e.status?"error":"processing",children:e.status})]}),description:new Date(e.updatedAt).toLocaleString()})})})})]}),(0,s.jsx)(p.A,{xs:24,lg:16,children:(0,s.jsx)(l.A,{size:"small",title:a("documents.workflow"),children:(0,s.jsxs)(f.A,{direction:"vertical",className:"w-full",size:"middle",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block mb-1",children:a("documents.template")}),(0,s.jsx)(x.A,{className:"w-full",value:Z,onChange:$,options:X.map(e=>({label:e.name,value:e.id}))})]}),eI&&(0,s.jsxs)(l.A,{size:"small",type:"inner",title:eI.outputTitle,children:[(0,s.jsx)(H,{children:eI.description}),(0,s.jsxs)(f.A,{wrap:!0,children:[eI.projectRoleConfigId?(0,s.jsx)(g.A,{color:"geekblue",children:(null==(e=et.find(e=>e.id===eI.projectRoleConfigId))?void 0:e.name)||eI.projectRoleConfigId}):(0,s.jsx)(g.A,{color:"warning",children:a("documents.noRoleConfig")}),eI.documentSpecId?(0,s.jsx)(g.A,{color:"cyan",children:(null==(t=es.find(e=>e.id===eI.documentSpecId))?void 0:t.name)||eI.documentSpecId}):null]})]}),eI&&(0,s.jsx)(f.A,{direction:"vertical",size:4,children:(0,s.jsxs)("span",{children:[a("documents.projectRoleConfig"),": ",(null==(n=et.find(e=>e.id===eI.projectRoleConfigId))?void 0:n.name)||a("documents.noRoleConfig")]})}),(0,s.jsx)(d.Ay,{type:"primary",size:"large",block:!0,icon:(0,s.jsx)(P.A,{}),loading:ei,disabled:!(null==eI?void 0:eI.projectRoleConfigId),onClick:()=>{eG()},children:a("documents.generate")}),eA.length>0&&(0,s.jsx)(l.A,{size:"small",type:"inner",title:a("documents.executionStatus"),children:(0,s.jsx)(j.A,{direction:"vertical",size:"small",current:eE,items:eA.map(e=>({title:e.title,description:(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{children:e.description}),(0,s.jsx)("div",{className:"space-y-0.5",children:e.subSteps.map(e=>{var t;return(0,s.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--colorTextSecondary)]",children:["process"===(t=e.status)?(0,s.jsx)(_.A,{}):"finish"===t?(0,s.jsx)(R.A,{}):"error"===t?(0,s.jsx)(L.A,{}):(0,s.jsx)("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-[var(--colorTextTertiary)]"}),(0,s.jsx)("span",{children:e.title})]},e.key)})})]}),status:e.status,icon:"process"===e.status?(0,s.jsx)(_.A,{}):e.icon}))})})]})})})]}),(0,s.jsx)(l.A,{size:"small",title:a("documents.editor"),extra:(0,s.jsx)(f.A,{wrap:!0,children:er&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Ay,{icon:(0,s.jsx)(M.A,{}),onClick:()=>{eH()},children:a("documents.saveDraft")}),(0,s.jsx)(d.Ay,{icon:(0,s.jsx)(O.A,{}),loading:ey,onClick:()=>{eq("markdown")},children:a("documents.downloadMarkdown")}),(0,s.jsx)(d.Ay,{loading:ey,onClick:()=>{eq("html")},children:a("documents.exportHtml")}),(0,s.jsx)(d.Ay,{loading:ey,onClick:()=>{eq("docx")},children:a("documents.exportDocx")}),(0,s.jsx)(d.Ay,{type:"primary",loading:ey,onClick:()=>{eq("pdf")},children:a("documents.exportPdf")})]})}),children:er?(0,s.jsx)(w.A,{items:[{key:"edit",label:a("documents.edit"),children:(0,s.jsx)(q,{rows:26,value:el,onChange:e=>ed(e.target.value)})},{key:"chapters",label:a("documents.chapters"),children:(0,s.jsx)(m.A,{dataSource:er.chapters,renderItem:e=>(0,s.jsx)(m.A.Item,{actions:[(0,s.jsx)(d.Ay,{size:"small",icon:(0,s.jsx)(F.A,{}),loading:eg===e.id,onClick:()=>{eK(e)},children:a("documents.regenerateChapter")},"regen")],children:(0,s.jsx)(m.A.Item.Meta,{title:e.title,description:(0,s.jsxs)(f.A,{direction:"vertical",children:[(0,s.jsxs)("span",{children:[a("documents.evidenceCount"),": ",e.evidence.length]}),(0,s.jsxs)("span",{children:[a("documents.missingCount"),": ",e.missingFacts.length]})]})})})})},{key:"facts",label:a("documents.structuredFacts"),children:(0,s.jsx)(m.A,{dataSource:er.structuredFacts,renderItem:e=>{var t;return(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)(m.A.Item.Meta,{title:"".concat(e.key,": ").concat(e.value),description:"".concat(e.sourceFile," \xb7 ").concat((null==(t=Y.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId)}),(0,s.jsx)(g.A,{children:e.confidence.toFixed(2)})]})}})},{key:"sources",label:a("documents.sources"),children:(0,s.jsx)(m.A,{dataSource:er.sources,renderItem:e=>(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)("span",{children:e.filePath}),(0,s.jsx)(g.A,{children:e.count})]})})},{key:"missing",label:a("documents.missingItems"),children:0===er.missingItems.length?(0,s.jsx)(h.A,{description:a("common.noData")}):(0,s.jsx)(m.A,{dataSource:er.missingItems,renderItem:e=>(0,s.jsx)(m.A.Item,{children:e})})},{key:"validation",label:a("documents.validation"),children:(0,s.jsx)(f.A,{direction:"vertical",className:"w-full",children:er.validationIssues.map(e=>(0,s.jsxs)(g.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:[e.message,e.suggestion?":".concat(e.suggestion):""]},e.message))})},{key:"gate",label:a("documents.exportGate"),children:(0,s.jsx)(m.A,{dataSource:er.exportGate.checklist,renderItem:e=>(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)("span",{children:e.label}),(0,s.jsx)(g.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})},{key:"stages",label:a("documents.executionStages"),children:(0,s.jsx)(m.A,{dataSource:er.executionStages,renderItem:e=>{var t,n;return(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)(m.A.Item.Meta,{avatar:(t=e.type,({role_binding:(0,s.jsx)(b.A,{}),knowledge_retrieval:(0,s.jsx)(S.A,{}),file_understanding:(0,s.jsx)(k.A,{}),fact_extraction:(0,s.jsx)(I.A,{}),chapter_generation:(0,s.jsx)(C.A,{}),asset_generation:(0,s.jsx)(T.A,{}),validation:(0,s.jsx)(E.A,{}),formatting:(0,s.jsx)(R.A,{}),llm_review:(0,s.jsx)(P.A,{}),export_ready:(0,s.jsx)(N.A,{}),reference:(0,s.jsx)(T.A,{})})[t]||(0,s.jsx)(v.A,{})),title:"".concat({role_binding:"角色配置绑定",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",asset_generation:"多模态资源生成",validation:"规则校验",formatting:"格式化排版",llm_review:"LLM 审查优化",export_ready:"导出就绪",reference:"参考资源处理"}[n=e.type]||n," \xb7 ").concat(e.roleId),description:e.message}),(0,s.jsx)(g.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})}})}]}):(0,s.jsx)(h.A,{description:a("documents.noDraft")})}),(0,s.jsx)(A.A,{maskClosable:!1,title:a("documents.templateEditor"),open:ej,onOk:()=>{eU()},onCancel:()=>ew(!1),width:760,centered:!0,okText:a("common.save"),children:(0,s.jsxs)(c.A,{form:W,layout:"vertical",requiredMark:"optional",children:[(0,s.jsxs)(u.A,{gutter:12,children:[(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,s.jsx)(i.A,{disabled:!0})})}),(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"name",label:a("documents.templateName"),rules:[{required:!0}],children:(0,s.jsx)(i.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"category",label:a("documents.templateCategory"),children:(0,s.jsx)(i.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:12,children:(0,s.jsx)(c.A.Item,{name:"outputTitle",label:a("documents.outputTitle"),children:(0,s.jsx)(i.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:12,children:(0,s.jsx)(c.A.Item,{name:"description",label:a("documents.templateDescription"),children:(0,s.jsx)(i.A,{})})})]}),(0,s.jsx)(c.A.Item,{name:"projectRoleConfigId",label:a("documents.projectRoleConfig"),rules:[{required:!0,message:a("documents.projectRoleConfigRequired")}],children:(0,s.jsx)(x.A,{showSearch:!0,placeholder:a("documents.projectRoleConfigRequired"),options:eC})}),(0,s.jsx)(c.A.Item,{name:"documentSpecId",label:a("documents.documentSpec"),children:(0,s.jsx)(x.A,{allowClear:!0,showSearch:!0,placeholder:a("documents.documentSpecPlaceholder"),options:eT})})]})})]})}}},e=>{e.O(0,[260,167,382,628,271,576,700,174,183,232,292,951,858,617,636,593,792],()=>e(e.s=16403)),_N_E=e.O()}]);
|