@customize-agent/server 4.23.7 → 4.23.9
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 +8 -8
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/chunks/2581.js +48 -48
- package/.next/server/chunks/8204.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/asset-library.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.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/template-references.html +1 -1
- package/.next/server/pages-manifest.json +28 -28
- package/.next/static/chunks/pages/{_app-24bef62eef01afe6.js → _app-e452fe4f864ec1de.js} +1 -1
- package/.next/static/chunks/pages/documents-489eb42fe7fa85b1.js +1 -0
- package/.next/static/chunks/pages/knowledge/file-detail-67235dd65f708569.js +1 -0
- package/.next/static/chunks/pages/knowledge/files-540ef329ffa92174.js +1 -0
- package/.next/static/chunks/pages/knowledge/manage-70718ded7ea5840a.js +1 -0
- package/.next/static/chunks/pages/prompt-8bd884495c67ce6f.js +1 -0
- package/.next/static/{BepudSW4c8roP0wr3rmvW → oyqlmOc4z7s7Z9TIXPQU1}/_buildManifest.js +1 -1
- package/messages/en-US.json +26 -1
- package/messages/zh-CN.json +26 -1
- package/package.json +1 -1
- package/.next/static/chunks/pages/documents-96aba8e9ca0fa12c.js +0 -1
- package/.next/static/chunks/pages/knowledge/file-detail-3a04722f7720abf5.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-33782c4b41f33750.js +0 -1
- package/.next/static/chunks/pages/knowledge/manage-5b1b4d3804752f8b.js +0 -1
- package/.next/static/chunks/pages/prompt-edc2dfea09aaedc1.js +0 -1
- /package/.next/static/{BepudSW4c8roP0wr3rmvW → oyqlmOc4z7s7Z9TIXPQU1}/_ssgManifest.js +0 -0
package/messages/zh-CN.json
CHANGED
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"fileRoles": "文件角色",
|
|
58
58
|
"promptRoles": "提示词角色",
|
|
59
59
|
"templateCount": "模板数量",
|
|
60
|
+
"materialUnderstanding": "资料理解",
|
|
60
61
|
"semanticModel": "语义模型",
|
|
61
62
|
"external": "外部",
|
|
62
63
|
"local": "本地",
|
|
@@ -400,6 +401,16 @@
|
|
|
400
401
|
"diskFile": "磁盘文件",
|
|
401
402
|
"fileMatch": "文件匹配",
|
|
402
403
|
"mentionRecallPlaceholder": "输入 @ 召回知识库文件,再描述优化目标...",
|
|
404
|
+
"rulePreviewTitle": "规则识别预览",
|
|
405
|
+
"rulePreviewAnalyzing": "正在识别规则…",
|
|
406
|
+
"rulePreviewHint": "输入提示词内容后将自动识别规则",
|
|
407
|
+
"rulePreviewNone": "未识别到规则",
|
|
408
|
+
"paradigmTitle": "参考范式",
|
|
409
|
+
"paradigmTypePlaceholder": "选择工程类型",
|
|
410
|
+
"paradigmInsert": "插入范式",
|
|
411
|
+
"paradigmEmpty": "未找到参考范式",
|
|
412
|
+
"paradigmInserted": "参考范式已插入",
|
|
413
|
+
"paradigmFailed": "参考范式获取失败",
|
|
403
414
|
"send": "发送"
|
|
404
415
|
},
|
|
405
416
|
"assets": {
|
|
@@ -702,7 +713,21 @@
|
|
|
702
713
|
"mb": "MB",
|
|
703
714
|
"gb": "GB",
|
|
704
715
|
"unknown": "未知",
|
|
705
|
-
"never": "从未"
|
|
716
|
+
"never": "从未",
|
|
717
|
+
"statusWaiting": "等待",
|
|
718
|
+
"statusRunning": "进行中",
|
|
719
|
+
"statusCompleted": "完成",
|
|
720
|
+
"statusSkipped": "已跳过",
|
|
721
|
+
"statusFailed": "失败",
|
|
722
|
+
"statusReview": "需复核",
|
|
723
|
+
"statusAbnormal": "异常",
|
|
724
|
+
"statusIndexed": "已索引",
|
|
725
|
+
"statusOutdated": "待更新",
|
|
726
|
+
"statusDeleted": "已删除",
|
|
727
|
+
"statusNotIndexed": "未索引",
|
|
728
|
+
"levelError": "错误",
|
|
729
|
+
"levelWarning": "警告",
|
|
730
|
+
"levelInfo": "提示"
|
|
706
731
|
},
|
|
707
732
|
"refs": {
|
|
708
733
|
"title": "模板参考库",
|
package/package.json
CHANGED
|
@@ -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(81865)}])},81865:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>eg});var s=r(65321),l=r(97109),a=r(26171),n=r(7576),o=r(35292),i=r(33442),c=r(17807),d=r(63455),u=r(11702),p=r(85114),x=r(88762),m=r(58569),h=r(84253),g=r(34052),v=r(68787),f=r(55122),j=r(99605),y=r(42700),w=r(2256),b=r(38770),A=r(38332),S=r(76506),k=r(50883),C=r(23718),N=r(23216),I=r(26619),T=r(8263),z=r(16285),R=r(8579),M=r(7851),E=r(29071),F=r(75548),_=r(63552),B=r(26631),D=r(7225),P=r(83914),L=r(84742),W=r(58209),G=r(38762),q=r(8470),H=r(92783),O=r(54746),K=r(93051),U=r(82930),V=r(64068),Q=r(64629),X=r(1310),J=r(67547),Y=r(76830),Z=r(14568),$=r(37799),ee=r(6578),et=r(47085);let er={"fact-landing-round":"未覆盖重要事实落地","table-repair-round":"表格缺失或格式错误","semantic-choice-conflict":"语义矛盾数值冲突","deterministic-stage5":"确定性缺陷(来源罗列/内部术语/编造日期)","formal-source-clean":"资料来源罗列话术","qingtian-full-review":"全维度评审缺陷","planned-section-final":"规划小节内容缺失","commercial-strip":"商务数据泄漏","table-deterministic-repair":"表格数据不一致","post-review-surface":"评审后兜底缺陷","terminology-strip":"内部术语泄漏","toc-consistency":"目录与正文不一致"},{TextArea:es}=n.A,{Text:el}=o.A,ea=a.A;function en(e){let{type:t="info",title:r,children:l,style:a}=e,n="error"===t?"var(--colorError)":"warning"===t?"var(--colorWarning)":"success"===t?"var(--colorSuccess)":"var(--colorInfo)";return(0,s.jsxs)("div",{style:{border:"1px solid ".concat(n),background:"error"===t?"var(--colorErrorBg)":"warning"===t?"var(--colorWarningBg)":"success"===t?"var(--colorSuccessBg)":"var(--colorInfoBg)",borderRadius:8,padding:"9px 12px",...a},children:[(0,s.jsx)(el,{strong:!0,style:{color:n},children:r}),l&&(0,s.jsx)("div",{style:{marginTop:4,color:"var(--colorTextSecondary)",fontSize:12},children:l})]})}function eo(e){let{children:t,gap:r=12,style:l}=e;return(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:r,...l},children:t})}let ei=null;function ec(){null==ei||ei.listeners.forEach(e=>e())}let ed={role_binding:(0,s.jsx)(N.A,{}),knowledge_retrieval:(0,s.jsx)(I.A,{}),file_understanding:(0,s.jsx)(T.A,{}),fact_extraction:(0,s.jsx)(z.A,{}),chapter_generation:(0,s.jsx)(R.A,{}),validation:(0,s.jsx)(M.A,{}),llm_review:(0,s.jsx)(E.A,{}),reference:(0,s.jsx)(F.A,{})},eu={施工组织设计:(0,s.jsx)(M.A,{}),投标文件:(0,s.jsx)(_.A,{}),技术方案:(0,s.jsx)(z.A,{}),报告:(0,s.jsx)(B.A,{}),自定义:(0,s.jsx)(R.A,{})};function ep(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function ex(e){return e.map(e=>({key:e.key,value:e.key,rawTitle:e.title,title:e.isFolder?(0,s.jsxs)("div",{className:"flex items-center justify-between w-full pr-4",children:[(0,s.jsxs)(i.A,{size:4,children:[(0,s.jsx)(D.A,{style:{color:"#faad14"}}),(0,s.jsx)("span",{children:e.title})]}),(0,s.jsxs)("span",{className:"text-xs text-[var(--colorTextTertiary)]",children:[e.fileCount||0," 项"]})]}):(0,s.jsx)("span",{title:e.key,children:e.title}),isFolder:e.isFolder,fileCount:e.fileCount||+!e.isFolder,isLeaf:e.isLeaf}))}let em={role_binding:"角色配置绑定",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",validation:"规则校验",llm_review:"LLM 审查优化",reference:"参考资源处理"},eh={"knowledge-base":"知识库","document-readiness":"生成准备度检查"};function eg(){var e,t,r,a,o,F,_,D,eg,ev,ef;let ej=(0,et.Vr)(),{message:ey}=c.A.useApp(),[ew]=d.A.useForm(),eb=(0,l.useRef)(null),[eA,eS]=(0,l.useState)([]),[ek,eC]=(0,l.useState)("construction-organization-design"),[eN,eI]=(0,l.useState)([]),[eT,ez]=(0,l.useState)([]),[eR,eM]=(0,l.useState)([]),[eE,eF]=(0,l.useState)([]),[e_,eB]=(0,l.useState)(!1),[eD,eP]=(0,l.useState)(!0),[eL,eW]=(0,l.useState)(!1),[eG,eq]=(0,l.useState)(null),[eH,eO]=(0,l.useState)(""),[eK,eU]=(0,l.useState)([]),[eV,eQ]=(0,l.useState)(null),[eX,eJ]=(0,l.useState)(null),[eY,eZ]=(0,l.useState)(""),[e$,e0]=(0,l.useState)(!1),[e1,e2]=(0,l.useState)("idle"),[e6,e5]=(0,l.useState)(null),[e8,e4]=(0,l.useState)(null),[e3,e7]=(0,l.useState)({start:0,end:0}),[e9,te]=(0,l.useState)([]),[tt,tr]=(0,l.useState)(!1),[ts,tl]=(0,l.useState)(!1),[ta,tn]=(0,l.useState)({}),[to,ti]=(0,l.useState)(null),tc=(0,l.useRef)({}),td=(0,l.useRef)(new Map),[tu,tp]=(0,l.useState)(0),[tx,tm]=(0,l.useState)([]),th=(0,l.useMemo)(()=>{var e,t,r;return(null==(e=eR.find(e=>e.selected))?void 0:e.projectRoot)||(null==(t=eR.find(e=>e.isCurrent))?void 0:t.projectRoot)||(null==(r=eR[0])?void 0:r.projectRoot)||""},[eR]),[tg,tv]=(0,l.useState)([]),[tf,tj]=(0,l.useState)(null),[ty,tw]=(0,l.useState)(null),[tb,tA]=(0,l.useState)("templates"),[tS,tk]=(0,l.useState)(!1),[tC,tN]=(0,l.useState)("workflow"),[tI,tT]=(0,l.useState)(new Set),[tz,tR]=(0,l.useState)(!1),[tM,tE]=(0,l.useState)(!1),[tF,t_]=(0,l.useState)(null),tB=(0,l.useRef)(new Map),tD=(0,l.useRef)(""),tP=(0,l.useRef)(null),tL=(0,l.useRef)(0),tW=(0,l.useMemo)(()=>"activeGenDocId:".concat(th||"default"),[th]),tG=async()=>{try{eU((await (0,ee.cQ)(th||void 0)).documents)}catch(e){eU([])}};(0,l.useEffect)(()=>{let e=()=>{ei&&(tv(ei.flowSteps),tj(ei.activeFlowKey),eW(ei.loading),ei.documentId&&eQ(ei.documentId),ei.draft&&eq(ei.draft),void 0!==ei.content&&eO(ei.content))},t=ei;return null==t||t.listeners.add(e),e(),()=>{null==t||t.listeners.delete(e)}},[]),(0,l.useEffect)(()=>{eP(!0),Promise.all([(0,ee.Dl)().then(e=>{var t,r;eS(e.templates),eC(null!=(r=null==(t=e.templates[0])?void 0:t.id)?r:"construction-organization-design")}),(0,ee.lv)().then(e=>{eI(e.roles),ez(e.configs)}),(0,ee.dx)().then(e=>eM(e))]).catch(()=>ey.error(ej("common.error"))).finally(()=>eP(!1))},[ey,ej]),(0,l.useEffect)(()=>{if(0===eA.length||!th)return;let e=!1;return(async()=>{let t=await Promise.all(eA.map(async e=>{try{let{validation:t}=await (0,ee.SM)(e.id,th);return[e.id,t]}catch(e){return null}}));if(e)return;let r={};for(let e of t)e&&(r[e[0]]=e[1]);tn(r)})(),()=>{e=!0}},[eA,th]),(0,l.useEffect)(()=>{th&&(localStorage.removeItem("activeGenDocId"),tG())},[th]),(0,l.useEffect)(()=>{if(0===eK.length)return;let e=localStorage.getItem(tW);if(!e)return;if(!eK.find(t=>t.id===e&&"generating"===t.status))return void localStorage.removeItem(tW);let t=setInterval(()=>{(async()=>{try{let{document:r}=await (0,ee.v7)(e,!1,th||void 0);if(!r)return;await tG(),"generating"!==r.status&&(localStorage.removeItem(tW),clearInterval(t))}catch(e){clearInterval(t)}})()},3e3);return()=>clearInterval(t)},[eK]);let tq=(0,l.useMemo)(()=>eA.find(e=>e.id===ek),[eA,ek]),tH=eT.map(e=>({label:e.name,value:e.id})),tO=Math.max(0,tg.findIndex(e=>e.key===tf)),tK=e=>{var t;return e?(null==(t=eN.find(t=>t.id===e))?void 0:t.name)||eh[e]||"未知角色":""},tU=e=>e.subtitle||e.roleName||tK(e.roleId)||em[e.type]||e.type,tV=e=>{var t,r,s;return e.promptName||((t=e.promptId)?(null==(r=eR.find(e=>e.id===t))?void 0:r.projectName)||(null==(s=eN.find(e=>e.id===t))?void 0:s.name)||eh[t]||"未知提示词":"")},tQ=()=>{tL.current+=1,eZ(""),e5(null),e4(null),te([]),tr(!1),e0(!1),e2("idle")},tX=async e=>{eQ(e.id),eC(e.templateId);let t=tJ(e.status);if(t||"failed"===e.status||"aborted"===e.status){tQ(),tw(e),eq(null),eO(""),eW(t),tN("workflow"),tk(!0);try{let{document:t}=await (0,ee.v7)(e.id,!1,e.projectRoot||th||void 0);if(!t)throw Error("文档记录不存在");t0(t),tJ(t.status)?t8(t.id,t.projectRoot||e.projectRoot||th||void 0):await tG()}catch(t){t0(e)}return}tN("editor"),tv([]),tj(null),tQ();try{let{document:t}=await (0,ee.v7)(e.id,!1,e.projectRoot||th||void 0);if(!t)throw Error("文档记录不存在");eq(t.draft||null),eO(t.editedMarkdown||t.markdown),tm(t.exportReports||[])}catch(e){ey.error(ej("common.error"))}tk(!0)},tJ=e=>"completed"!==e&&"completed_with_issues"!==e&&"warning"!==e&&"failed"!==e&&"aborted"!==e,tY=e=>{var t,r,s,l,a,n;return!!e&&("failed"===e.status||"aborted"===e.status||"completed_with_issues"===e.status||"warning"===e.status&&!!(null==(t=e.checkpointChapters)?void 0:t.length)&&/继续生成|重新生成|中断|卡住|未完成|门禁|阻断/u.test(e.error||(null==(r=e.warningIssues)?void 0:r.join(";"))||(null==(a=e.draft)||null==(l=a.exportGate)||null==(s=l.blockingIssues)?void 0:s.map(e=>e.message).join(";"))||"")||!!((null==(n=e.draft)?void 0:n.exportGate)&&!1===e.draft.exportGate.passed))},tZ=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:eL;(null==ei?void 0:ei.loading)&&(ei.flowSteps=e,ei.activeFlowKey=t,ei.loading=r,ec())},t$=e=>{var t,r,l,a;let n=e.executionStages||(null==(t=e.draft)?void 0:t.executionStages)||[];if(n.length>0){let t=n.map((t,r)=>{var l;let a,n=("failed"===e.status||"aborted"===e.status)&&"running"===t.status||"failed"===(a=t.status)?"error":"running"===a?"process":"finish";return{key:"".concat(t.type,"-").concat(r),title:t.title||em[t.type]||t.type,subtitle:tU(t),description:t.message||"",status:n,icon:"role_binding"===(l=t.type)?(0,s.jsx)(N.A,{}):"knowledge_retrieval"===l?(0,s.jsx)(I.A,{}):"file_understanding"===l?(0,s.jsx)(T.A,{}):"fact_extraction"===l?(0,s.jsx)(z.A,{}):"chapter_generation"===l?(0,s.jsx)(R.A,{}):"llm_review"===l?(0,s.jsx)(E.A,{}):"validation"===l?(0,s.jsx)(M.A,{}):(0,s.jsx)(B.A,{}),subSteps:((e,t,r)=>{let s=Array.isArray(e.details)?e.details.filter(Boolean):[],l=e.progress?"".concat(e.progress.label||"进度",":").concat(e.progress.current,"/").concat(e.progress.total):"",a=[...l?[l]:[],...s];return 0===a.length?[{key:"stage-".concat(r),title:tV(e)?"提示词:".concat(tV(e)):tU(e),status:t}]:a.map((e,s)=>({key:"stage-".concat(r,"-").concat(s),title:e,status:"process"===t&&0===s?"process":"error"===t&&0===s?"error":"warning"===t?"warning":"process"===t?"finish":t}))})(t,n,r)}});"generating"===e.status&&t.length>0&&t.every(e=>"process"!==e.status)&&t.push({key:"finishing-".concat(t.length),title:"生成收尾中",subtitle:"",description:"章节已全部生成,正在执行全局一致性审查与质量校验。",status:"process",icon:(0,s.jsx)(P.A,{}),subSteps:[]});let o="generating"===e.status?(null==(r=t.at(-1))?void 0:r.key)||"prepare":"failed"===e.status||"aborted"===e.status?(null==(l=t.find(e=>"error"===e.status))?void 0:l.key)||(null==(a=t.at(-1))?void 0:a.key)||"prepare":"done";return{steps:t,activeKey:o}}return{steps:[],activeKey:null}},t0=e=>{let t=e.executionStages||[],r="".concat(e.id,"|").concat(e.updatedAt,"|").concat(e.status,"|").concat(e.error||"","|").concat(t.length,"|").concat(t.map(e=>{var t,r,s,l;return"".concat(e.status,":").concat(null!=(s=null==(t=e.progress)?void 0:t.current)?s:0,"/").concat(null!=(l=null==(r=e.progress)?void 0:r.total)?l:0)}).join(","));if(tD.current===r)return;tD.current=r,tw(e);let{steps:s,activeKey:l}=t$(e);t1(s),tv(s),tj(l),eW(tJ(e.status)),tZ(s,l,tJ(e.status)),("failed"===e.status||"aborted"===e.status)&&tN("workflow"),("completed"===e.status||"completed_with_issues"===e.status||"warning"===e.status)&&e.draft&&(eq(e.draft),eO(e.editedMarkdown||e.markdown),tN("editor"),tv([]),tj(null),tm(e.exportReports||[]))},t1=e=>{let t=Date.now();for(let r of e){let e=td.current.get(r.key);"process"!==r.status||e?("finish"===r.status||"error"===r.status||"warning"===r.status)&&e&&!e.endedAt&&td.current.set(r.key,{...e,endedAt:t}):td.current.set(r.key,{startedAt:t})}},t2=e=>{let t=Math.max(0,Math.round(e/1e3));if(t<60)return"".concat(t," 秒");let r=Math.floor(t/60);return r<60?"".concat(r," 分 ").concat(t%60," 秒"):"".concat(Math.floor(r/60)," 小时 ").concat(r%60," 分")},t6=(e,t)=>"percent"===t?"".concat((100*e).toFixed(1),"%"):"perKChars"===t?"".concat(e.toFixed(1),"/千字"):String(Math.round(e)),t5=e=>{let t=tB.current.get(e);t&&(clearInterval(t),tB.current.delete(e))},t8=(e,t)=>{t5(e);let r=setInterval(()=>{(async()=>{try{let{document:r}=await (0,ee.v7)(e,!0,t||th||void 0);if(!r)return;t0(r),await tG(),tJ(r.status)||(t5(e),localStorage.removeItem(tW))}catch(e){}})()},2e3);tB.current.set(e,r)};(0,l.useEffect)(()=>()=>{for(let e of tB.current.values())clearInterval(e);tB.current.clear(),tP.current&&(clearTimeout(tP.current),tP.current=null)},[]),(0,l.useEffect)(()=>{if(!eL||!tf)return;let e=window.setInterval(()=>tv(e=>{let t=e.map(e=>{if(e.key!==tf||"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,tf),t}),1400);return()=>window.clearInterval(e)},[tf,eL]),(0,l.useEffect)(()=>{if(!eL)return;let e=window.setInterval(()=>tp(e=>e+1),1e3);return()=>window.clearInterval(e)},[eL]);let t4=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";eB(!0);try{let t=await (0,ee.Fi)(e,th||void 0);eF(ex(t.nodes))}catch(e){ey.error("知识库文件加载失败")}finally{eB(!1)}},t3=async e=>{var t;let r=String(null!=(t=e.key)?t:"");if(r)try{let e=await (0,ee.Fi)(r,th||void 0),t=ex(e.nodes),s=e=>e.map(e=>e.key===r?{...e,children:t}:e.children?{...e,children:s(e.children)}:e);eF(e=>s(e))}catch(e){ey.error("加载子文件夹失败")}},t7=e=>{let t=null!=e?e:{id:"tpl-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,chapters:[],projectBindings:[]};ew.resetFields(),ew.setFieldsValue({...t,projectMaterialRoots:ep((t.projectBindings||[]).map(e=>e.materialRootPath).filter(Boolean))}),t4(),tl(!0)},t9=async()=>{try{await ew.validateFields();let e=ew.getFieldsValue(!0),t=ep(e.projectMaterialRoots||[]).map(e=>({materialRootPath:e})),{projectMaterialRoots:r,...s}=e,l={...s,chapters:[],projectBindings:t},a=await (0,ee.l2)(l);eS(a.templates),eC(a.template.id),tl(!1),await tG(),ey.success(ej("common.success"))}catch(e){e instanceof Error&&ey.error(e.message)}},re=async e=>{try{let t=await (0,ee.bV)(e);eS(t.templates),eC(t.template.id),ey.success(ej("common.success"))}catch(e){ey.error(ej("common.error"))}},rt=async e=>{try{var t,r;let s=await (0,ee.h0)(e);eS(s.templates),eC(null!=(r=null==(t=s.templates[0])?void 0:t.id)?r:""),ey.success(ej("common.success"))}catch(e){ey.error(ej("common.error"))}},rr=async e=>{t_(e),eC(e),eQ(null),eq(null),eO(""),tQ(),tN("workflow"),tk(!0),tA("drafts"),eW(!0),tj("prepare"),tv([{key:"prepare",title:"正在准备运行模板",description:"正在校验模板绑定的项目资料包、提示词配置和资料索引,校验通过后会自动开始生成。",status:"process",icon:(0,s.jsx)(P.A,{}),subSteps:[{key:"validate",title:"模板运行前检查",status:"process"},{key:"start",title:"准备生成任务",status:"wait"}]}]);try{let{validation:t}=await (0,ee.SM)(e,th||void 0);tn(r=>({...r,[e]:t}));let r=t.issues.filter(e=>"error"===e.level);if(r.length>0){ro.current=!0,eW(!1),tj("prepare"),tv([{key:"prepare",title:"模板运行前检查未通过",description:r.map(e=>e.message).join("\n"),status:"error",icon:(0,s.jsx)(G.A,{}),subSteps:[{key:"validate",title:"模板运行前检查",status:"error"},{key:"start",title:"准备生成任务",status:"wait"}]}]),ey.warning("模板运行前检查未通过,请先处理阻断项");return}t.issues.length>0&&ey.warning("模板存在非阻断警告,已继续运行"),tv([{key:"prepare",title:"模板检查通过,正在创建生成任务",description:"已确认模板绑定资源可用,正在启动后台生成任务。",status:"process",icon:(0,s.jsx)(P.A,{}),subSteps:[{key:"validate",title:"模板运行前检查",status:"finish"},{key:"start",title:"准备生成任务",status:"process"}]}]),await rn(e)}catch(t){ro.current=!0;let e=t instanceof Error?t.message:"模板运行前检查失败";eW(!1),tv([{key:"prepare",title:"模板运行准备失败",description:e,status:"error",icon:(0,s.jsx)(G.A,{}),subSteps:[{key:"validate",title:"模板运行前检查",status:"error"},{key:"start",title:"准备生成任务",status:"wait"}]}]),ey.error(e)}finally{t_(t=>t===e?null:t)}},rs=async e=>{try{await (0,ee.QG)(e.id,e.projectRoot||th||void 0),eV===e.id&&(eQ(null),eq(null),eO("")),await tG(),ey.success(ej("common.success"))}catch(e){ey.error(ej("common.error"))}},rl=async(e,t)=>{try{let r=new Set(e.chapters.map(e=>e.title.trim())),s=t.missingHeadings.filter(e=>!r.has(e.title.trim()));if(0===s.length)return void ey.info("建议章节已全部存在");let l=[...e.chapters,...s.map(t=>({id:"ch-ref-".concat(Date.now(),"-").concat(e.chapters.length),title:t.title,purpose:"",queries:[],requiredFacts:[]}))],a=await (0,ee.l2)({...e,chapters:l});eS(a.templates),tn(t=>{let r={...t};return delete r[e.id],r}),ey.success(ej("common.success"))}catch(e){e instanceof Error&&ey.error(e.message)}},ra=async(e,t)=>{let r=Date.now(),s=0,l=Date.now(),a=0;for(;;){let n;if(null==t?void 0:t.aborted)throw Error("用户中止");let o=new AbortController;t&&(t.pollController=o);try{({document:n}=await (0,ee.v7)(e,!0,th||void 0,o.signal,s||void 0)),a=0}catch(e){if((null==t?void 0:t.aborted)||e instanceof DOMException&&"AbortError"===e.name)throw Error("用户中止",{cause:e});if((a+=1)>=3)throw e instanceof Error?e:Error("生成进度获取失败");await new Promise(e=>window.setTimeout(e,2e3*a));continue}finally{(null==t?void 0:t.pollController)===o&&(t.pollController=void 0)}if(!n){if(Date.now()-r>75e5||Date.now()-l>96e4)throw Error("生成任务疑似卡住,请点击继续生成或重新生成");await new Promise(e=>window.setTimeout(e,1500));continue}if(t0(n),n.updatedAt!==s&&(s=n.updatedAt,l=Date.now()),("completed"===n.status||"completed_with_issues"===n.status||"warning"===n.status)&&n.draft)return n;if("failed"===n.status||"aborted"===n.status)throw Error(n.error||("aborted"===n.status?"生成已中止":"生成失败"));if(Date.now()-r>75e5||Date.now()-l>96e4)throw Error("生成任务疑似卡住,请点击继续生成或重新生成");await new Promise(e=>window.setTimeout(e,1500))}},rn=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ek;if(!e)return;if((null==ei?void 0:ei.aborted)&&(ei=null),null==ei?void 0:ei.loading){tv(ei.flowSteps),tj(ei.activeFlowKey),eW(!0);return}if(!th)return void ey.error("未识别当前项目,请先选择或打开项目后再生成文件");eW(!0);let t=tg.length>0?tg:[{key:"prepare",title:"正在创建生成任务",description:"系统正在创建后台生成任务,请稍候。",status:"process",icon:(0,s.jsx)(P.A,{}),subSteps:[{key:"start",title:"准备生成任务",status:"process"}]}],r=tf||"prepare";tv(t),tj(r);let l=(0,ee.OX)({templateId:e,projectRoot:th});ei={id:Date.now(),templateId:e,loading:!0,flowSteps:t,activeFlowKey:r,promise:l,listeners:new Set};let a=[];try{let e=await l;e.documentId&&(localStorage.setItem(tW,e.documentId),eQ(e.documentId),(null==ei?void 0:ei.promise)===l&&(ei.documentId=e.documentId)),await tG();let t=e.documentId?await ra(e.documentId,(null==ei?void 0:ei.promise)===l?ei:void 0):void 0,r=e.draft||(null==t?void 0:t.draft);if(!r)throw Error("生成结果为空");(e.documentId||(null==t?void 0:t.id))&&eQ(e.documentId||t.id),a.forEach(e=>window.clearTimeout(e)),eq(r),eO((null==t?void 0:t.editedMarkdown)||(null==t?void 0:t.markdown)||r.markdown),(null==ei?void 0:ei.promise)===l&&(ei.draft=r,ei.content=(null==t?void 0:t.editedMarkdown)||(null==t?void 0:t.markdown)||r.markdown);let s=t||{id:e.documentId||"draft-".concat(Date.now()),templateId:ek,title:r.title,requirement:r.requirement,projectRoot:r.projectRoot||th,projectId:r.projectId,markdown:r.markdown,status:r.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!r.exportGate.passed?"warning":"completed",draft:r,executionStages:r.executionStages,assets:r.assets||[],createdAt:r.generatedAt,updatedAt:Date.now()},{steps:n}=t$(s);tv(n),tZ(n,"done",!1),tj("done"),(null==ei?void 0:ei.promise)===l&&(ei.activeFlowKey="done",ei.loading=!1,ec(),ei=null),localStorage.removeItem(tW),await tG(),ey.success(ej("common.success")),window.setTimeout(()=>{var e;return null==(e=eb.current)?void 0:e.scrollIntoView({behavior:"smooth",block:"start"})},200)}catch(r){localStorage.removeItem(tW);let e=r instanceof Error?r.message:ej("common.error"),t=/用户中止|abort|aborted/i.test(e);t||tv(t=>{let r=t.map(t=>"process"===t.status?{...t,status:"error",description:e,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)})(t,"error")}:t);return tZ(r,tf,!1),r}),(null==ei?void 0:ei.promise)===l&&(ei.loading=!1,ei.error=e,ec(),ei=null),await tG().catch(()=>void 0),t||ey.error(e)}finally{a.forEach(e=>window.clearTimeout(e)),eW(!1),(null==ei?void 0:ei.promise)===l&&(ei.loading=!1,ec())}},ro=(0,l.useRef)(!1);(0,l.useEffect)(()=>(tP.current&&(clearTimeout(tP.current),tP.current=null),!tS||"workflow"!==tC||tF||eV||ro.current||(null==ei?void 0:ei.loading)||null==tq||!tq.projectRoleConfigId||(ro.current=!0,tP.current=setTimeout(()=>{tP.current=null,tS&&"workflow"===tC&&!eV&&ek==ek&&rn()},300)),tS||(ro.current=!1),()=>{tP.current&&(clearTimeout(tP.current),tP.current=null)}),[tS,tC,tF,eV,tq,ek]);let ri=async e=>{try{eQ(e.id),eC(e.templateId),tN("workflow"),tk(!0),eW(!0);let t=await (0,ee.UQ)(e.id,e.projectRoot||th||void 0);localStorage.setItem(tW,t.documentId),await tG();let r=await ra(t.documentId);r.draft&&(eq(r.draft),eO(r.editedMarkdown||r.markdown||r.draft.markdown),tN("editor")),localStorage.removeItem(tW),await tG(),ey.success("已继续生成并完成")}catch(e){ey.error(e instanceof Error?e.message:"继续生成失败")}finally{eW(!1)}},rc=async e=>{if((null==ei?void 0:ei.loading)&&ei.documentId===e.id){var t;ei.aborted=!0,null==(t=ei.pollController)||t.abort(),ei.loading=!1,ei.error="用户中止",ec(),ei=null,eW(!1)}localStorage.removeItem(tW),t5(e.id);try{await (0,ee.r)(e.id,e.projectRoot||th||void 0),ey.success("已中止生成任务")}catch(e){ey.info("任务已不在运行,已刷新状态")}finally{await tG(),eV===e.id&&(eQ(null),tw(null),eq(null),eO(""))}},rd=async e=>{if(eG){eJ(e);try{eG.exportGate.passed||ey.warning("导出门禁存在风险项,已允许导出,请下载后人工复核。");let t={documentId:eV||void 0,title:eG.title,markdown:eH,format:e,enforceGate:!1,exportGate:eG.exportGate,useClientMarkdown:!0,projectRoot:eG.projectRoot||th||void 0},r=await (0,ee.UE)(t);if(((e,t,r)=>{let s=new Blob([e],{type:r}),l=URL.createObjectURL(s),a=document.createElement("a");a.href=l,a.download=t,a.target="_self",a.rel="noopener",a.style.display="none",document.body.appendChild(a),a.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),a.remove(),window.setTimeout(()=>URL.revokeObjectURL(l),1e3)})(r,"".concat(eG.title,".").concat("markdown"===e?"md":e),{markdown:"text/markdown;charset=utf-8",html:"text/html;charset=utf-8",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}[e]),eV)try{let{document:e}=await (0,ee.v7)(eV,!1,eG.projectRoot||th||void 0);e&&tm(e.exportReports||[])}catch(e){}}catch(e){ey.error(e instanceof Error?e.message:ej("common.error"))}finally{eJ(null)}}},ru=async()=>{if(eG)try{if(eV)await (0,ee.a6)(eV,{editedMarkdown:eH,markdown:eH},eG.projectRoot||th||void 0);else{let e=await (0,ee.Af)({...eG,markdown:eH});eq(e.draft)}await tG(),ey.success(ej("common.success"))}catch(e){ey.error(ej("common.error"))}},rp=(e,t)=>{te(r=>[{id:"".concat(Date.now()),content:e,prompt:t,createdAt:Date.now()},...r].slice(0,12))},rx=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&eZ(""),e5(null),e4(null),e7({start:0,end:0})},rm=(e,t)=>{var r,s;return{title:(null==eG?void 0:eG.title)||"未命名文档",markdown:t,instruction:e,facts:null==eG||null==(r=eG.structuredFacts)?void 0:r.map(e=>"".concat(e.key,": ").concat(e.value)),chapters:null==eG||null==(s=eG.chapters)?void 0:s.map(e=>e.title),...(()=>{let e=e3.start,t=e3.end;return t>e?{selection:{start:e,end:t,text:eH.slice(e,t)},cursorOffset:e}:{cursorOffset:e}})()}},rh=async()=>{let e=eY.trim();if(!eG||!e||e$)return;let t=tL.current+1;tL.current=t,e0(!0),e2("planning"),e4(null);try{let r=await (0,ee.Gi)({mode:"plan",...rm(e,eH)});if(tL.current!==t||eV!=eV)return;if(!r.plan)throw Error("AI 未返回修改计划");e5(r.plan)}catch(e){tL.current===t&&ey.error(e instanceof Error?e.message:ej("common.error"))}finally{tL.current===t&&(e0(!1),e2("idle"))}},rg=async e=>{let t=eY.trim();if(!eG||!t||e$)return;let r=tL.current+1;tL.current=r,e0(!0),e2("applying");try{let s=await (0,ee.Gi)({mode:"apply",...rm(t,eH),plan:e});if(tL.current!==r||eV!=eV)return;if(!s.markdown)throw Error("AI 未返回修改结果");e4({plan:s.plan||e,markdown:s.markdown,beforeSnippet:s.beforeSnippet,afterSnippet:s.afterSnippet,summary:s.summary,changedChars:s.changedChars,prompt:t,before:eH})}catch(e){tL.current===r&&ey.error(e instanceof Error?e.message:ej("common.error"))}finally{tL.current===r&&(e0(!1),e2("idle"))}};if(eD)return(0,s.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,s.jsx)(x.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,s.jsx)(x.A,{active:!0,paragraph:{rows:2}}),(0,s.jsx)(x.A,{active:!0,paragraph:{rows:8}})]});let rv="workflow"===tC?"工作流:".concat((null==tq?void 0:tq.name)||"选择模板"):"编辑:".concat((null==eG?void 0:eG.title)||(null==tq?void 0:tq.outputTitle)||"文档");return(0,s.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4 pb-6 mb-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("h1",{className:"text-3xl font-extrabold tracking-tight text-[var(--colorText)] mb-2.5 flex items-center gap-2",children:[(0,s.jsx)(N.A,{className:"text-[var(--colorAccent)]"}),ej("documents.title")]}),(0,s.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)]",children:ej("documents.description")})]}),(0,s.jsx)(p.Ay,{type:"primary",icon:(0,s.jsx)(O.A,{}),onClick:()=>t7(),className:"shadow-none rounded-lg",children:ej("documents.newTemplate")})]}),(0,s.jsxs)("div",{className:"bg-[var(--colorBgContainer)] rounded-2xl shadow-sm overflow-hidden",children:[(0,s.jsx)(m.A,{items:[{key:"templates",label:(0,s.jsxs)("span",{className:"px-4",children:["模板库 ",(0,s.jsx)(u.A,{className:"ml-2 border-0 bg-[var(--colorFillAlter)]",children:eA.length})]})},{key:"drafts",label:(0,s.jsxs)("span",{className:"px-4",children:["生成记录 ",(0,s.jsx)(u.A,{className:"ml-2 border-0 bg-[var(--colorFillAlter)]",children:eK.length})]})}],activeKey:tb,onChange:tA,className:"documents-tabs",size:"large",tabBarStyle:{margin:0,padding:"0 16px",background:"var(--colorBgHover)",borderBottom:"1px solid var(--borderColor)"}}),(0,s.jsx)("div",{className:"p-4 bg-[var(--colorFillAlter)] min-h-[500px]",children:"templates"===tb?0===eA.length?(0,s.jsx)("div",{className:"py-32 text-center border border-dashed border-[var(--borderColor)] rounded-2xl bg-[var(--colorBgContainer)]",children:(0,s.jsx)(h.A,{description:(0,s.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:ej("common.noData")})})}):(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:eA.map(e=>(0,s.jsxs)("div",{ref:t=>{tc.current[e.id]=t},className:"group flex items-center p-4 rounded-2xl transition-all cursor-pointer ".concat(ek===e.id?"bg-[var(--colorBgSelected)] shadow-md":"bg-[var(--colorBgContainer)] hover:bg-[var(--colorBgHover)] shadow-sm hover:shadow-md"),onClick:()=>eC(e.id),children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0 pr-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-2 min-w-0",children:[function(e,t){let r=eu[e]||(0,s.jsx)(B.A,{});return(0,s.jsx)("span",{style:{color:t?"var(--colorAccent)":"var(--colorTextSecondary)",fontSize:16,marginTop:2,flexShrink:0},children:r})}(e.category,ek===e.id),(0,s.jsx)("span",{className:"font-bold text-base text-[var(--colorText)] truncate",children:e.name}),ek===e.id&&(0,s.jsx)(u.A,{color:"blue",className:"border-0 m-0 shrink-0",children:"当前选中"}),(0,s.jsx)(u.A,{className:"border-0 bg-[var(--colorFillSecondary)] m-0 shrink-0",children:e.category})]}),e.description&&(0,s.jsx)("div",{className:"text-sm text-[var(--colorTextSecondary)] line-clamp-2 leading-relaxed mb-3",children:e.description}),(e=>{let t=ta[e.id];if(!t)return null;let r=t.issues.filter(e=>"error"===e.level),l=t.issues.filter(e=>"warning"===e.level),a=to===e.id,n=t.roleDiagnostics||[],o=new Map;for(let e of t.promptDiagnostics){let t=o.get(e.roleId)||[];t.push(e),o.set(e.roleId,t)}let i=t.strategyPreview,c=(null==i?void 0:i.mode)==="strict"?"error":(null==i?void 0:i.mode)==="fast"?"blue":(null==i?void 0:i.mode)==="longform"?"purple":"green";return(0,s.jsxs)("div",{onClick:e=>e.stopPropagation(),className:"flex flex-col items-start gap-2 w-full",children:[(0,s.jsxs)("div",{className:"inline-flex items-center gap-2 p-1.5 px-3 rounded-lg border text-xs ".concat(r.length?"border-red-200 bg-red-50/50":l.length?"border-yellow-200 bg-yellow-50/50":"border-green-200 bg-green-50/50"),children:[(0,s.jsx)("span",{className:"font-medium",children:r.length?"检查未通过(".concat(r.length," 项阻断)"):l.length?"存在警告(".concat(l.length," 项)"):"检查通过"}),(0,s.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:"|"}),(0,s.jsxs)("span",{children:["项目资料 ",t.fileDiagnostics.length]}),(0,s.jsxs)("span",{children:["提示词 ",t.promptDiagnostics.length]}),(0,s.jsxs)("span",{children:["角色链路 ",n.length]}),i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:"|"}),(0,s.jsxs)(u.A,{color:c,className:"border-0 m-0",children:[i.mode," 策略预估"]})]}),!r.length&&l.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:"|"}),(0,s.jsx)("span",{className:"text-blue-500 cursor-pointer hover:underline",onClick:()=>{rr(e.id)},children:"忽略警告并运行"})]}),(0,s.jsxs)("span",{className:"text-blue-500 cursor-pointer hover:underline",onClick:()=>ti(a?null:e.id),children:[a?(0,s.jsx)(q.A,{}):(0,s.jsx)(H.A,{}),a?"收起体检":"体检报告"]})]}),a&&(0,s.jsxs)("div",{className:"w-full flex flex-col gap-3 rounded-xl border border-[var(--borderColor)] bg-[var(--colorBgContainer)] p-3",children:[r.length>0&&(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsxs)("span",{className:"text-xs font-bold text-[var(--colorError)]",children:["阻断项(",r.length,")— 必须修复后才能运行"]}),r.map(t=>{var r;let l=(r=t.message,/资料包|项目资料|知识库|索引/u.test(r)?{label:"配置模板",onClick:()=>t7(e)}:/提示词|绑定/u.test(r)?{label:"提示词库",href:"/prompt"}:/项目角色配置/u.test(r)?{label:"角色配置",href:"/document-roles"}:void 0);return(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2 rounded-lg border border-red-200 bg-red-50/40 px-2.5 py-1.5 text-xs",children:[(0,s.jsx)("span",{className:"text-[var(--colorText)]",children:t.message}),l&&(l.href?(0,s.jsxs)("a",{className:"shrink-0 text-red-500 hover:underline",href:l.href,children:[l.label," ›"]}):(0,s.jsxs)("span",{className:"shrink-0 text-red-500 cursor-pointer hover:underline",onClick:l.onClick,children:[l.label," ›"]}))]},t.message)})]}),l.length>0&&(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsxs)("span",{className:"text-xs font-bold text-[var(--colorWarning)]",children:["警告项(",l.length,")— 可忽略并继续运行"]}),l.map(e=>(0,s.jsx)("div",{className:"rounded-lg border border-yellow-200 bg-yellow-50/40 px-2.5 py-1.5 text-xs text-[var(--colorTextSecondary)]",children:e.message},e.message))]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsxs)("span",{className:"text-xs font-bold text-[var(--colorText)]",children:["绑定链路(",t.configName||"未绑定角色配置",")"]}),0===n.length?(0,s.jsx)("span",{className:"text-xs text-[var(--colorTextTertiary)]",children:"未配置提示词角色链路"}):(0,s.jsx)("div",{className:"flex flex-col gap-1.5",children:n.map(r=>{let l=o.get(r.roleId)||[];return(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-xs flex-wrap rounded-lg border border-[var(--borderColor)] bg-[var(--colorFillQuaternary)] px-2 py-1",children:[(0,s.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:e.name}),(0,s.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:"→"}),(0,s.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:t.configName||"角色配置"}),(0,s.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:"→"}),(0,s.jsx)("span",{className:"ok"===r.status?"text-[var(--colorText)]":"text-[var(--colorError)] font-medium",children:r.roleName||r.roleId}),(0,s.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:"→"}),0===l.length?(0,s.jsx)(u.A,{color:"error",className:"border-0 m-0",children:"missing_resource"===r.status?"角色未绑定资源":"role_missing"===r.status?"角色不存在":"未绑定提示词"}):(0,s.jsx)("span",{className:"flex items-center gap-1 flex-wrap",children:l.map(e=>(0,s.jsx)(u.A,{color:e.exists&&e.contentLength>0?"success":e.exists?"warning":"error",className:"border-0 m-0",title:e.contentPreview||e.promptId,children:e.exists?"".concat(e.promptTitle||e.promptId," ").concat(e.contentLength,"字符"):"".concat(e.promptId," 已删除")},e.promptId))})]},r.roleId)})})]}),i&&(0,s.jsxs)("div",{className:"flex flex-col gap-1 rounded-lg border border-blue-200 bg-blue-50/40 px-2.5 py-2 text-xs",children:[(0,s.jsx)("span",{className:"font-bold text-[var(--colorText)]",children:"生成策略预估(生成前体检)"}),(0,s.jsxs)("span",{className:"text-[var(--colorTextSecondary)]",children:["约 ",i.chapterCount," 章 / 目标 ",i.targetWords>=1e4?"".concat((i.targetWords/1e4).toFixed(1)," 万字"):"".concat(i.targetWords," 字"),";全章节并行(",i.chapterConcurrency," 章同批);审查流水线 ",i.reviewConcurrency," 路;每章证据预算 ",Math.round(i.evidenceFloorChars/1e3),"k-",Math.round(i.evidenceCeilingChars/1e3),"k 字符;修复轮次预算 ",i.repairRoundBudget," 轮",i.globalReviewSamplingRate<1?";全局审查抽检 ".concat(Math.round(100*i.globalReviewSamplingRate),"%"):""]}),i.triggers.map(e=>(0,s.jsxs)("span",{className:"text-[var(--colorTextTertiary)]",children:["\xb7 ",e]},e))]}),(()=>{let r=t.referenceStructureSuggestion;return r&&0!==r.missingHeadings.length?(0,s.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-lg border border-purple-200 bg-purple-50/40 px-2.5 py-2 text-xs",children:[(0,s.jsxs)("span",{className:"font-bold text-[var(--colorText)]",children:["参考库大纲建议(",r.projectType," \xb7 ",r.sourceCount," 份同类工程画像)"]}),(0,s.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:"以下章节出现于半数以上同类工程但当前模板缺失,仅建议、不影响运行:"}),(0,s.jsx)("span",{className:"flex items-center gap-1 flex-wrap",children:r.missingHeadings.map(e=>(0,s.jsxs)(u.A,{className:"border-0 m-0 bg-white",children:[e.title," \xb7 ",Math.round(100*e.ratio),"% 样本"]},e.title))}),(0,s.jsx)("span",{children:(0,s.jsx)(p.Ay,{size:"small",type:"primary",ghost:!0,icon:(0,s.jsx)(O.A,{}),onClick:()=>void rl(e,r),className:"rounded-md",children:"一键添加到模板"})})]}):null})()]})]})})(e)]}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-nowrap items-center gap-2 whitespace-nowrap transition-opacity ".concat(ek===e.id?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(p.Ay,{size:"small",onClick:t=>{t.stopPropagation(),t7(e)},className:"rounded-md",children:"配置"}),(0,s.jsx)(p.Ay,{size:"small",icon:(0,s.jsx)(K.A,{}),onClick:t=>{t.stopPropagation(),re(e.id)},className:"rounded-md"}),(0,s.jsx)(ea,{title:ej("documents.deleteTemplateConfirm"),onConfirm:t=>{null==t||t.stopPropagation(),rt(e.id)},children:(0,s.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,s.jsx)(W.A,{}),onClick:e=>e.stopPropagation(),className:"rounded-md"})}),(()=>{var t;let r=ta[e.id],l=null!=(t=null==r?void 0:r.issues.filter(e=>"error"===e.level).length)?t:0;return l>0?(0,s.jsxs)(p.Ay,{size:"small",danger:!0,icon:(0,s.jsx)(U.A,{}),disabled:!!tF&&tF!==e.id,onClick:t=>{var r;t.stopPropagation(),eC(r=e.id),ti(r),window.setTimeout(()=>{var e;return null==(e=tc.current[r])?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})},50)},className:"min-w-[108px] rounded-md justify-center",children:["先修复 ",l," 个问题"]}):(0,s.jsx)(p.Ay,{size:"small",type:"primary",icon:tF===e.id?(0,s.jsx)(P.A,{}):(0,s.jsx)(V.A,{}),loading:tF===e.id,disabled:!!tF&&tF!==e.id,onClick:t=>{t.stopPropagation(),rr(e.id)},className:"min-w-[72px] rounded-md justify-center",children:tF===e.id?"准备中":"运行"})})()]})]},e.id))}):0===eK.length?(0,s.jsx)("div",{className:"py-32 text-center border border-dashed border-[var(--borderColor)] rounded-2xl bg-[var(--colorBgContainer)]",children:(0,s.jsx)(h.A,{description:(0,s.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:ej("common.noData")})})}):(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:eK.slice(0,15).map((e,t)=>{var r,l,a,n,o,i,c,d,x,m;let h,g;return(0,s.jsxs)("div",{className:"group flex items-center gap-4 p-4 rounded-2xl transition-all cursor-pointer ".concat(eV===e.id?"bg-[var(--colorBgSelected)] shadow-md":"bg-[var(--colorBgContainer)] hover:bg-[var(--colorBgHover)] shadow-sm hover:shadow-md"),onClick:()=>{tX(e)},children:[(0,s.jsx)("div",{className:"mt-1",children:"completed"===e.status?(0,s.jsx)(L.A,{className:"text-xl text-[var(--colorOk)]"}):"failed"===e.status||"aborted"===e.status?(0,s.jsx)(G.A,{className:"text-xl text-[var(--colorDanger)]"}):"warning"===e.status||"completed_with_issues"===e.status?(0,s.jsx)(M.A,{className:"text-xl text-[var(--colorWarning)]"}):(0,s.jsx)(Q.A,{spin:!0,className:"text-xl text-blue-500"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0 pr-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,s.jsx)("span",{className:"font-bold text-base text-[var(--colorText)] truncate",children:e.title}),(0,s.jsxs)(u.A,{className:"border-0 bg-[var(--colorFillSecondary)] m-0 shrink-0",children:["#",t+1]}),(0,s.jsx)(u.A,{color:"completed"===(h=e.status)?"success":"completed_with_issues"===h||"warning"===h?"warning":"failed"===h?"error":"aborted"===h?"default":"processing",className:"border-0 m-0 shrink-0",children:"completed"===(g=e.status)?"已完成":"completed_with_issues"===g?"已完成(待复核)":"warning"===g?"需复核":"failed"===g?"失败":"aborted"===g?"已中止":"生成中"})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-2 text-xs text-[var(--colorTextSecondary)] mb-3",children:[(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,s.jsx)(X.A,{})," ",new Date(e.updatedAt).toLocaleString()]}),(0,s.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:"|"}),(0,s.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),s=t%60;if(r<60)return s?"".concat(r," 分 ").concat(s," 秒"):"".concat(r," 分");let l=Math.floor(r/60),a=r%60;return a?"".concat(l," 小时 ").concat(a," 分"):"".concat(l," 小时")})(e)]}),e.partialChapters&&e.partialChapters.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:"|"}),(0,s.jsxs)("span",{children:["进度 ",e.partialChapters.filter(e=>"completed"===e.status).length,"/",e.partialChapters.length," 章"]}),(0,s.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:"|"}),(0,s.jsxs)("span",{children:["共 ",e.partialChapters.reduce((e,t)=>e+t.chars,0).toLocaleString()," 字"]})]})]}),("warning"===e.status||"failed"===e.status||"aborted"===e.status)&&(0,s.jsxs)("div",{className:"inline-flex items-center gap-2 p-1.5 px-3 rounded-lg border text-xs ".concat("failed"===e.status||"aborted"===e.status?"border-red-200 bg-red-50/50":"border-yellow-200 bg-yellow-50/50"),children:[(0,s.jsx)("span",{className:"font-medium",children:"failed"===e.status?(null==(l=e.draft)||null==(r=l.exportGate)?void 0:r.passed)===!1?"门禁未通过":"生成失败":"aborted"===e.status?"已中止":"需复核"}),(0,s.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:"|"}),(0,s.jsx)("span",{className:"truncate max-w-[400px]",children:e.error||(null==(a=e.warningIssues)?void 0:a[0])||(null==(o=e.draft)||null==(n=o.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message)||(null==(d=e.draft)||null==(c=d.exportGate)||null==(i=c.checklist.find(e=>!e.passed))?void 0:i.label)||"需复核"})]})]}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-nowrap items-center gap-2 whitespace-nowrap transition-opacity ".concat(eV===e.id?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(p.Ay,{size:"small",type:"primary",icon:tJ(e.status)?(0,s.jsx)(Q.A,{spin:!0}):(0,s.jsx)(V.A,{}),onClick:t=>{t.stopPropagation(),tX(e)},className:"min-w-[72px] rounded-md justify-center",children:"打开"}),tJ(e.status)&&(0,s.jsx)(ea,{title:"确定中止此生成任务?",onConfirm:t=>{null==t||t.stopPropagation(),rc(e)},children:(0,s.jsx)(p.Ay,{size:"small",danger:!0,onClick:e=>e.stopPropagation(),className:"rounded-md",children:"中止"})}),("failed"===e.status||"aborted"===e.status||"warning"===e.status&&!!(null==(x=e.checkpointChapters)?void 0:x.length)&&/继续生成|重新生成|中断|卡住|未完成/u.test(e.error||(null==(m=e.warningIssues)?void 0:m.join(";"))||""))&&(0,s.jsx)(p.Ay,{size:"small",onClick:t=>{t.stopPropagation(),ri(e)},className:"rounded-md",children:"继续"}),(0,s.jsx)(ea,{title:"确认删除?",onConfirm:t=>{null==t||t.stopPropagation(),rs(e)},children:(0,s.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,s.jsx)(W.A,{}),onClick:e=>e.stopPropagation(),className:"rounded-md"})})]})]},e.id)})})})]}),(0,s.jsx)(g.A,{title:rv,open:tS,onClose:()=>{for(let e of(tk(!1),tB.current.values()))clearInterval(e);tB.current.clear()},size:"large",mask:{closable:!1},style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:eG?(0,s.jsxs)(i.A,{wrap:!0,children:[tY(ty)&&(0,s.jsx)(p.Ay,{icon:(0,s.jsx)(V.A,{}),disabled:e$||eL,onClick:()=>{ty&&ri(ty)},children:"继续生成"}),(0,s.jsx)(p.Ay,{icon:(0,s.jsx)(J.A,{}),disabled:e$,onClick:()=>{ru()},children:ej("documents.saveDraft")}),(0,s.jsx)(p.Ay,{icon:(0,s.jsx)(Y.A,{}),disabled:e$,loading:"markdown"===eX,onClick:()=>{rd("markdown")},children:"MD"}),(0,s.jsx)(p.Ay,{disabled:e$,loading:"html"===eX,onClick:()=>{rd("html")},children:"HTML"}),(0,s.jsx)(p.Ay,{disabled:e$,loading:"docx"===eX,onClick:()=>{rd("docx")},children:"DOCX"}),(0,s.jsx)(p.Ay,{type:"primary",disabled:e$,loading:"pdf"===eX,onClick:()=>{rd("pdf")},children:"PDF"})]}):tY(ty)?(0,s.jsx)(p.Ay,{type:"primary",icon:(0,s.jsx)(V.A,{}),loading:eL,onClick:()=>{ty&&ri(ty)},children:"继续生成"}):eL&&"workflow"===tC?(0,s.jsx)(p.Ay,{danger:!0,onClick:()=>{(async()=>{if(eV&&await (0,ee.r)(eV,th||void 0).catch(()=>void 0),ei){var e;ei.aborted=!0,null==(e=ei.pollController)||e.abort(),ei.loading=!1,ei.error="用户中止",ec(),ei=null}for(let e of(localStorage.removeItem(tW),tB.current.values()))clearInterval(e);tB.current.clear(),eW(!1),tv([]),tj(null),tk(!1),await tG(),ey.info("已中止生成任务")})()},children:"中止任务"}):void 0,children:(0,s.jsxs)(eo,{style:{width:"100%"},gap:16,children:["workflow"===tC&&tg.length>0&&(0,s.jsx)(eo,{gap:10,children:tg.map((e,t)=>{let r,l=tI.has(e.key),a=e.subSteps.length>8||e.description.length>240;return(0,s.jsxs)("div",{style:{display:"flex",gap:10,padding:10,border:"1px solid var(--colorBorderSecondary)",borderRadius:10,background:t===tO?"var(--colorFillAlter)":"var(--colorBgContainer)"},children:[(0,s.jsx)("span",{children:"process"===e.status?(0,s.jsx)(P.A,{}):"warning"===e.status?(0,s.jsx)(M.A,{style:{color:"var(--colorWarning)"}}):e.icon}),(0,s.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,s.jsxs)(i.A,{wrap:!0,children:[(0,s.jsx)(el,{strong:!0,children:e.title}),(0,s.jsx)(u.A,{color:"finish"===e.status?"success":"error"===e.status?"error":"warning"===e.status?"warning":"process"===e.status?"processing":"default",children:"warning"===(r=e.status)?"finish":r}),(e=>{var t;let r=td.current.get(e.key);if(!r)return null;let l=t2((null!=(t=r.endedAt)?t:Date.now())-r.startedAt);return(0,s.jsx)(u.A,{className:"border-0 bg-[var(--colorFillSecondary)] m-0",children:r.endedAt?l:"".concat(l,"(运行中)")})})(e)]}),(0,s.jsx)("div",{style:{marginTop:4,color:"var(--colorTextSecondary)",fontSize:12,whiteSpace:"pre-wrap"},children:((e,t)=>{let r=e.description.length>240,l=t?e.subSteps:e.subSteps.slice(0,8);return(0,s.jsxs)("div",{children:[e.subtitle&&(0,s.jsx)("div",{style:{marginBottom:4},children:(0,s.jsx)(u.A,{children:e.subtitle})}),(0,s.jsx)("div",{style:!t&&r?{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"}:void 0,children:e.description}),(0,s.jsx)("div",{style:{marginTop:4},children:l.map(e=>{var t;return(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:12,color:"process"===e.status?"var(--colorPrimary)":"var(--colorTextSecondary)"},children:["process"===(t=e.status)?(0,s.jsx)(P.A,{}):"finish"===t?(0,s.jsx)(L.A,{}):"warning"===t?(0,s.jsx)(M.A,{style:{color:"var(--colorWarning)"}}):"error"===t?(0,s.jsx)(W.A,{}):(0,s.jsx)("span",{style:{display:"inline-block",height:6,width:6,borderRadius:"50%",background:"var(--colorTextTertiary)"}}),(0,s.jsx)("span",{children:e.title})]},e.key)})})]})})(e,l)}),a&&(0,s.jsx)(p.Ay,{size:"small",type:"link",style:{padding:0,height:"auto",marginTop:6},onClick:()=>{var t;return t=e.key,void tT(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})},children:l?"收起":e.subSteps.length>8?"更多(".concat(e.subSteps.length," 条详情)"):"更多"})]})]},e.key)})}),"workflow"===tC&&(null==ty?void 0:ty.partialChapters)&&ty.partialChapters.length>0&&(0,s.jsx)(v.A,{size:"small",title:"章节进度",extra:(0,s.jsxs)(u.A,{color:"blue",children:[ty.partialChapters.filter(e=>"completed"===e.status).length,"/",ty.partialChapters.length]}),children:(0,s.jsx)(eo,{gap:6,style:{width:"100%"},children:ty.partialChapters.map(e=>(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,fontSize:12},children:[(0,s.jsx)(el,{ellipsis:!0,style:{maxWidth:480},children:e.title}),(0,s.jsxs)(i.A,{size:6,children:[(0,s.jsx)(u.A,{color:"failed"===e.status?"error":"success",children:"failed"===e.status?"失败":"完成"}),(0,s.jsxs)(el,{type:"secondary",children:[e.chars.toLocaleString()," 字"]})]})]},e.id))})}),"workflow"===tC&&(null==ty||null==(t=ty.draft)||null==(e=t.exportGate)?void 0:e.passed)===!1&&(()=>{var e;let t=(null==(e=ty.draft.exportGate.blockingIssues)?void 0:e.map(e=>e.message))||ty.draft.exportGate.checklist.filter(e=>!e.passed).map(e=>e.label)||["存在阻断级校验错误"],r=tz?t:t.slice(0,6);return(0,s.jsx)(en,{type:"error",title:"生成已完成,但导出门禁未通过",children:(0,s.jsxs)(i.A,{direction:"vertical",size:8,style:{width:"100%"},children:[(0,s.jsx)("span",{children:"阻断项:".concat(r.join(";")).concat(t.length>6&&!tz?"…(共 ".concat(t.length," 项)"):"","。可点击继续生成触发自动修复,或在“校验”页查看完整问题。")}),t.length>6&&(0,s.jsx)(p.Ay,{size:"small",type:"link",style:{padding:0,height:"auto",alignSelf:"flex-start"},onClick:()=>tR(e=>!e),children:tz?"收起":"查看全部 ".concat(t.length," 项")}),tY(ty)&&(0,s.jsx)(p.Ay,{type:"primary",size:"small",icon:(0,s.jsx)(V.A,{}),loading:eL,onClick:()=>{ri(ty)},children:"继续生成 / 自动修复"})]})})})(),"workflow"===tC&&(null==ty||null==(r=ty.reviewMetadata)?void 0:r.diagnostics)&&(0,s.jsx)(en,{type:"info",title:"后台自动优化",children:"策略:".concat(ty.reviewMetadata.diagnostics.strategy.mode,";LLM 调用 ").concat(ty.reviewMetadata.diagnostics.llm.calls," 次;噪声过滤 ").concat((null==(a=ty.reviewMetadata.diagnostics.evidence)?void 0:a.filteredNoise)||0," 条;质量门禁 阻断").concat((null==(o=ty.reviewMetadata.diagnostics.quality)?void 0:o.blockingCount)||0,"/重要").concat((null==(F=ty.reviewMetadata.diagnostics.quality)?void 0:F.importantCount)||0,"/轻微").concat((null==(_=ty.reviewMetadata.diagnostics.quality)?void 0:_.minorCount)||0,";自动限流调整 ").concat(ty.reviewMetadata.diagnostics.llm.limitAdjustments," 次。审查与诊断信息仅用于系统修复,不会写入正文或导出文件。")}),"workflow"===tC&&(null==ty||null==(D=ty.draft)?void 0:D.promptRules)&&(()=>{let e=ty.draft.promptRules,t=e.executionSummary||[],r=Object.entries(e.ruleSources||{}).filter(e=>{let[,t]=e;return t.length>0}),l=r.length>0,a=tM?r:r.slice(0,3);return(0,s.jsx)(v.A,{size:"small",title:(0,s.jsxs)(i.A,{size:6,children:[(0,s.jsx)(M.A,{style:{color:"var(--colorAccent)"}}),"提示词规则生效报告",t.length>0&&(0,s.jsxs)(u.A,{style:{margin:0},children:[t.length," 条"]})]}),styles:{body:{padding:12}},children:(0,s.jsxs)(eo,{gap:6,children:[t.length>0&&t.map((e,t)=>(0,s.jsxs)("div",{style:{display:"flex",gap:6,fontSize:12,color:"var(--colorText)",lineHeight:1.6},children:[(0,s.jsx)(L.A,{style:{color:"var(--colorSuccess)",marginTop:4}}),(0,s.jsx)("span",{children:e})]},t)),l&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.A,{style:{margin:"4px 0"}}),(0,s.jsx)(el,{type:"secondary",style:{fontSize:12},children:"规则溯源(自动从以下提示词中抽取):"}),a.map(e=>{let[t,r]=e;return(0,s.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",lineHeight:1.6},children:[(0,s.jsx)(el,{strong:!0,style:{fontSize:12},children:t}),":",r.map(e=>"".concat(e.roleId,"「").concat(e.matchedText.length>24?"".concat(e.matchedText.slice(0,24),"…"):e.matchedText,"」")).join("、")]},t)}),r.length>3&&(0,s.jsx)(p.Ay,{size:"small",type:"link",style:{padding:0,height:"auto",alignSelf:"flex-start"},onClick:()=>tE(e=>!e),children:tM?"收起溯源":"查看全部溯源(".concat(r.length," 类)")})]}),!l&&0===t.length&&(0,s.jsx)(el,{type:"secondary",style:{fontSize:12},children:"未从提示词中识别到额外硬规则,使用系统默认质量规则。"})]})})})(),"workflow"===tC&&(null==ty||null==(ev=ty.draft)||null==(eg=ev.reviewMetadata)?void 0:eg.qualityBenchmark)&&(()=>{let e=ty.draft.reviewMetadata.qualityBenchmark;return(0,s.jsx)(v.A,{size:"small",title:(0,s.jsxs)(i.A,{size:6,children:[(0,s.jsx)(Z.A,{style:{color:"#faad14"}}),"质量对标",(0,s.jsxs)(u.A,{color:"gold",style:{margin:0},children:[e.projectType,"参考"]})]}),extra:(0,s.jsxs)(el,{strong:!0,style:{fontSize:15,color:e.overallScore>=80?"var(--colorSuccess)":"var(--colorWarning)"},children:[e.overallScore," 分"]}),styles:{body:{padding:12}},children:(0,s.jsxs)(eo,{gap:8,children:[(0,s.jsxs)(el,{type:"secondary",style:{fontSize:12},children:["与模板参考库 ",e.referenceSourceCount," 份同类入围文件的质量画像对比:"]}),e.items.map(e=>(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,s.jsx)("div",{style:{width:86,fontSize:12,color:"var(--colorTextSecondary)",flexShrink:0},children:e.label}),(0,s.jsx)(j.A,{percent:Math.min(100,e.score),size:"small",status:e.passed?"normal":"exception",style:{flex:1,margin:0},showInfo:!1}),(0,s.jsxs)("div",{style:{width:96,fontSize:12,textAlign:"right",flexShrink:0,color:e.passed?"var(--colorSuccess)":"var(--colorWarning)"},children:[e.passed?(0,s.jsx)(L.A,{style:{marginRight:4}}):(0,s.jsx)($.A,{style:{marginRight:4}}),t6(e.generated,e.unit)]})]},e.key)),(0,s.jsxs)(el,{type:"secondary",style:{fontSize:12},children:["基准参考值:",e.items.map(e=>"".concat(e.label," ").concat(t6(e.reference,e.unit))).join(";")]})]})})})(),"workflow"===tC&&eL&&0===tg.length&&(0,s.jsxs)("div",{style:{textAlign:"center",padding:40},children:[(0,s.jsx)(y.A,{}),(0,s.jsx)("div",{style:{marginTop:12,color:"var(--colorTextSecondary)"},children:"正在准备生成…"})]}),"editor"===tC&&(null==eG||null==(ef=eG.reviewMetadata)?void 0:ef.qualityBenchmark)&&(()=>{var e;let t=eG.reviewMetadata.qualityBenchmark,r=null==(e=eG.reviewMetadata.diagnostics)?void 0:e.quality,l=(eG.executionStages||[]).filter(e=>"llm_review"===e.type).flatMap(e=>(e.details||[]).filter(e=>/修复|补写|补齐|改进|调整/u.test(e))).slice(0,8);return(0,s.jsx)(v.A,{size:"small",title:(0,s.jsxs)(i.A,{size:6,children:[(0,s.jsx)(Z.A,{style:{color:"#faad14"}}),"运行质量报告",(0,s.jsxs)(u.A,{color:"gold",className:"border-0 m-0",children:[t.projectType,"对标"]})]}),extra:(0,s.jsxs)(el,{strong:!0,style:{fontSize:15,color:t.overallScore>=80?"var(--colorSuccess)":"var(--colorWarning)"},children:[t.overallScore," 分"]}),styles:{body:{padding:12}},children:(0,s.jsxs)(eo,{gap:8,children:[(0,s.jsxs)(i.A,{wrap:!0,size:6,children:[(0,s.jsxs)(u.A,{className:"border-0 bg-[var(--colorFillSecondary)] m-0",children:["对标库 ",t.referenceSourceCount," 份同类文件"]}),r&&(0,s.jsxs)(u.A,{color:r.blockingCount>0?"error":"success",className:"border-0 m-0",children:["审查修复 ",r.repairedCount," 项 / 问题 ",r.blockingCount+r.importantCount+r.minorCount," 项"]}),(0,s.jsxs)(u.A,{className:"border-0 bg-[var(--colorFillSecondary)] m-0",children:[t.items.filter(e=>e.passed).length,"/",t.items.length," 指标达标"]})]}),l.length>0&&(0,s.jsxs)("div",{className:"flex flex-col gap-1 rounded-lg border border-[var(--borderColor)] bg-[var(--colorFillQuaternary)] px-3 py-2",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-[var(--colorText)]",children:"修复记录(审查阶段自动修复的内容)"}),l.map((e,t)=>(0,s.jsxs)("span",{className:"text-xs text-[var(--colorTextSecondary)]",children:["\xb7 ",e]},t))]}),(0,s.jsxs)(el,{type:"secondary",style:{fontSize:12},children:["基准参考值:",t.items.map(e=>"".concat(e.label," ").concat(t6(e.reference,e.unit))).join(";")]})]})})})(),"editor"===tC&&tx.length>0&&(0,s.jsx)(v.A,{size:"small",title:(0,s.jsxs)(i.A,{size:6,children:[(0,s.jsx)(Y.A,{}),"导出闭环报告",(0,s.jsx)(u.A,{className:"border-0 bg-[var(--colorFillSecondary)] m-0",children:tx.length})]}),styles:{body:{padding:12}},children:(0,s.jsxs)(eo,{gap:6,children:[[...tx].reverse().map((e,t)=>(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-[var(--borderColor)] bg-[var(--colorFillQuaternary)] px-3 py-2 text-xs",children:[(0,s.jsx)(el,{strong:!0,children:e.format.toUpperCase()}),(0,s.jsx)(u.A,{color:"blue",className:"border-0 m-0",children:new Date(e.exportedAt).toLocaleString()}),void 0!==e.durationMs&&(0,s.jsxs)("span",{className:"text-[var(--colorTextSecondary)]",children:["总用时 ",t2(e.durationMs)]}),void 0!==e.benchmarkScore&&(0,s.jsxs)("span",{className:"text-[var(--colorTextSecondary)]",children:["质量对标 ",e.benchmarkScore," 分"]}),void 0!==e.repairedCount&&(0,s.jsxs)("span",{className:"text-[var(--colorTextSecondary)]",children:["修复 ",e.repairedCount," 项",void 0!==e.blockingCount?"(阻断 ".concat(e.blockingCount,")"):""]}),e.ruleSummary&&e.ruleSummary.length>0&&(0,s.jsxs)("span",{className:"text-[var(--colorTextSecondary)]",children:["规则 ",e.ruleSummary.length," 条"]}),!1===e.gatePassed&&(0,s.jsx)(u.A,{color:"error",className:"border-0 m-0",children:"门禁未过"}),e.healthAlerts&&e.healthAlerts.length>0&&(0,s.jsxs)(u.A,{color:"warning",className:"border-0 m-0",children:["健康告警 ",e.healthAlerts.length]})]},"".concat(e.exportedAt,"-").concat(t))),(()=>{let e=function(e){let t=[],r=[];if(e.length<3)return{retireCandidates:t,constraintSuggestions:r};let s=[...e].sort((e,t)=>e.exportedAt-t.exportedAt),l=s.slice(-3),a=s.slice(0,-3),n=new Set;for(let e of[...a,...l])for(let t of Object.keys(e.repairHeat||{}))n.add(t);for(let e of n){let s=l.map(t=>{var r;return null==(r=t.repairHeat)?void 0:r[e]});if(a.some(t=>{var r,s,l;return(null!=(l=null==(s=t.repairHeat)||null==(r=s[e])?void 0:r.hits)?l:0)>0})&&s.every(e=>void 0!==e&&0===e.hits)&&t.push(e),s.every(e=>void 0!==e&&e.hits>0&&e.failed/e.hits>=.5)){let t=s.reduce((e,t)=>e+(t?t.failed/t.hits:0),0)/s.length;r.push("".concat(e,"|").concat((100*t).toFixed(0),"%|连续").concat(3,"次"))}}return{retireCandidates:t,constraintSuggestions:r}}(tx);return 0===e.retireCandidates.length&&0===e.constraintSuggestions.length?null:(0,s.jsxs)(en,{type:"info",title:"跨文档缺陷热力图",children:[e.retireCandidates.length>0&&(0,s.jsxs)("div",{children:["候选退役(连续 3 次零命中,可评估停用):",e.retireCandidates.map(e=>{let t=e.split("|")[0];return er[t]?"".concat(er[t],"(").concat(e,")"):e}).join("、")]}),e.constraintSuggestions.length>0&&(0,s.jsxs)("div",{children:["建议加入写作硬约束(高命中且修复失败率高):",e.constraintSuggestions.map(e=>{let t=e.split("|")[0];return er[t]?"".concat(er[t],"(").concat(e,")"):e}).join("、")]})]})})()]})}),eG&&(0,s.jsx)("div",{ref:eb,children:(0,s.jsx)(m.A,{items:[{key:"edit",label:ej("documents.edit"),children:(0,s.jsxs)(eo,{gap:16,style:{width:"100%"},children:[(0,s.jsx)(es,{rows:28,value:eH,disabled:e$,onSelect:e=>{var t,r,s;return e7({start:null!=(t=e.currentTarget.selectionStart)?t:0,end:null!=(s=null!=(r=e.currentTarget.selectionEnd)?r:e.currentTarget.selectionStart)?s:0})},onChange:e=>{var t,r,s;eO(e.target.value),e5(null),e4(null),e7({start:null!=(t=e.target.selectionStart)?t:0,end:null!=(s=null!=(r=e.target.selectionEnd)?r:e.target.selectionStart)?s:0})}}),(0,s.jsx)(v.A,{size:"small",style:{borderRadius:12,background:"linear-gradient(135deg, var(--colorFillAlter), var(--colorBgContainer))"},children:(0,s.jsxs)(eo,{gap:16,style:{width:"100%"},children:[(0,s.jsxs)(i.A,{align:"start",style:{width:"100%",justifyContent:"space-between"},children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(i.A,{size:6,children:[(0,s.jsx)(E.A,{style:{color:"var(--colorAccent)"}}),(0,s.jsx)(el,{strong:!0,children:"精准修改"}),(0,s.jsx)(u.A,{color:"blue",children:"AI 辅助"})]}),(0,s.jsx)("div",{style:{marginTop:4,color:"var(--colorTextSecondary)",fontSize:12},children:"针对当前编辑内容补充更具体的要求,AI 会保留文档结构并按你的提示细化修改。"})]}),(0,s.jsxs)(p.Ay,{size:"small",icon:(0,s.jsx)(X.A,{}),onClick:()=>tr(e=>!e),disabled:0===e9.length,children:["历史版本 ",e9.length>0?e9.length:""]})]}),(0,s.jsx)(en,{type:"info",title:"系统只负责识别修改范围,不改写你的提示词;选中文字后优先只改选区,没有选区时按光标所在小节/章节定位。"}),(0,s.jsx)(es,{rows:4,value:eY,disabled:e$,onChange:e=>{eZ(e.target.value),e5(null),e4(null)},placeholder:"例如:写细一点;润色这段;第七章补充高处作业和临电安全措施;把安全检查频次改成每周一次。"}),(0,s.jsxs)(i.A,{wrap:!0,style:{width:"100%",justifyContent:"space-between"},children:[(0,s.jsx)(i.A,{wrap:!0,children:["写细一点","更专业","只润色选区","补充可执行措施"].map(e=>(0,s.jsx)(p.Ay,{size:"small",disabled:e$,onClick:()=>eZ(t=>t?"".concat(t,";").concat(e):e),children:e},e))}),(0,s.jsx)(p.Ay,{type:"primary",icon:(0,s.jsx)(E.A,{}),loading:e$&&"planning"===e1,disabled:!eY.trim()||e$,onClick:()=>{rh()},children:"识别修改范围"})]}),e6&&!e8&&(0,s.jsx)(v.A,{size:"small",style:{borderRadius:10,borderColor:"var(--colorAccent)"},children:(0,s.jsxs)(eo,{gap:8,style:{width:"100%"},children:[(0,s.jsxs)(i.A,{wrap:!0,children:[(0,s.jsx)(u.A,{color:"purple",children:e6.scope}),(0,s.jsx)(u.A,{color:"blue",children:e6.action}),(0,s.jsxs)(u.A,{color:e6.confidence>=.8?"green":"orange",children:["置信度 ",Math.round(100*e6.confidence),"%"]}),e6.targetTitle&&(0,s.jsx)(el,{strong:!0,children:e6.targetTitle})]}),(0,s.jsx)(el,{children:e6.summary}),(0,s.jsx)(el,{type:"secondary",style:{fontSize:12},children:"将按你的原始提示词执行,不添加额外编辑任务。"}),(0,s.jsxs)(i.A,{children:[(0,s.jsx)(p.Ay,{type:"primary",loading:e$&&"applying"===e1,onClick:()=>{rg(e6)},children:"执行并预览"}),(0,s.jsx)(p.Ay,{disabled:e$,onClick:()=>e5(null),children:"取消"})]})]})}),e8&&(0,s.jsx)(v.A,{size:"small",style:{borderRadius:10,borderColor:"var(--colorSuccess)"},children:(0,s.jsxs)(eo,{gap:8,style:{width:"100%"},children:[(0,s.jsxs)(i.A,{wrap:!0,children:[(0,s.jsx)(u.A,{color:"green",children:"修改预览"}),(0,s.jsx)(el,{children:e8.summary||e8.plan.summary}),(0,s.jsxs)(u.A,{children:[e8.changedChars&&e8.changedChars>0?"+".concat(e8.changedChars):e8.changedChars," 字符"]})]}),(0,s.jsxs)(w.A,{gutter:12,children:[(0,s.jsxs)(b.A,{span:12,children:[(0,s.jsx)(el,{strong:!0,children:"修改前"}),(0,s.jsx)("div",{style:{marginTop:6,maxHeight:180,overflow:"auto",padding:10,borderRadius:8,background:"var(--colorFillAlter)",whiteSpace:"pre-wrap",fontSize:12},children:e8.beforeSnippet||"无片段预览"})]}),(0,s.jsxs)(b.A,{span:12,children:[(0,s.jsx)(el,{strong:!0,children:"修改后"}),(0,s.jsx)("div",{style:{marginTop:6,maxHeight:180,overflow:"auto",padding:10,borderRadius:8,background:"var(--colorFillAlter)",whiteSpace:"pre-wrap",fontSize:12},children:e8.afterSnippet||"无片段预览"})]})]}),(0,s.jsxs)(i.A,{children:[(0,s.jsx)(p.Ay,{type:"primary",onClick:()=>{e8&&(rp(e8.before,e8.prompt),eO(e8.markdown),rx(!0),ey.success("已应用精准修改"))},children:"应用到文档"}),(0,s.jsx)(p.Ay,{onClick:()=>e4(null),children:"返回计划"}),(0,s.jsx)(p.Ay,{danger:!0,onClick:()=>{e5(null),e4(null)},children:"放弃"})]})]})}),tt&&(0,s.jsx)("div",{style:{borderTop:"1px solid var(--colorBorderSecondary)",paddingTop:12},children:(0,s.jsx)(A.A,{size:"small",dataSource:e9,locale:{emptyText:"暂无历史版本"},renderItem:e=>(0,s.jsx)(A.A.Item,{actions:[(0,s.jsx)(p.Ay,{size:"small",disabled:e$,onClick:()=>{rp(eH,"恢复前版本"),eO(e.content),rx(!0),ey.success("已恢复历史版本")},children:"恢复"},"restore")],children:(0,s.jsx)(A.A.Item.Meta,{title:(0,s.jsxs)(i.A,{children:[(0,s.jsx)(el,{children:new Date(e.createdAt).toLocaleString()}),(0,s.jsx)(u.A,{children:e.prompt})]}),description:(0,s.jsx)(el,{type:"secondary",ellipsis:!0,children:e.content.replace(/\s+/gu," ").slice(0,120)})})})})})]})})]})},{key:"chapters-facts",label:"章节与事实",children:(0,s.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[eG.chapters.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsxs)(el,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["章节 (",eG.chapters.length,")"]}),(0,s.jsx)(A.A,{size:"small",dataSource:eG.chapters,renderItem:e=>(0,s.jsx)(A.A.Item,{children:(0,s.jsx)(A.A.Item.Meta,{title:e.title,description:"证据: ".concat(e.evidence.length," \xb7 缺失: ").concat(e.missingFacts.length)})})})]}),eG.structuredFacts.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsxs)(el,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["结构化事实 (",eG.structuredFacts.length,")"]}),(0,s.jsx)(S.A,{size:"small",column:1,bordered:!0,children:eG.structuredFacts.map((e,t)=>(0,s.jsxs)(S.A.Item,{label:e.key,children:[(0,s.jsx)("span",{children:e.value}),(0,s.jsx)(u.A,{style:{marginLeft:8},children:e.confidence.toFixed(2)}),(0,s.jsx)(el,{type:"secondary",style:{fontSize:11,marginLeft:8},children:e.sourceFile})]},t))})]})]})},{key:"sources-missing",label:"来源与缺失",children:(0,s.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(el,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["引用来源 (",eG.sources.length,")"]}),0===eG.sources.length?(0,s.jsx)(h.A,{description:"暂无"}):(0,s.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:eG.sources.map(e=>(0,s.jsxs)(u.A,{color:"blue",children:[e.filePath," (",e.count,")"]},e.filePath))})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(el,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["缺失项 (",eG.missingItems.length,")"]}),0===eG.missingItems.length?(0,s.jsx)(h.A,{description:"无缺失"}):(0,s.jsx)(A.A,{size:"small",dataSource:eG.missingItems,renderItem:e=>(0,s.jsx)(A.A.Item,{children:e})})]})]})},{key:"validation",label:"校验 (".concat(eG.validationIssues.length,")"),children:0===eG.validationIssues.length?(0,s.jsx)(h.A,{description:"校验通过"}):(0,s.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[eG.validationIssues.map(e=>(0,s.jsxs)("div",{style:{border:"1px solid var(--colorBorderSecondary)",borderRadius:8,padding:12},children:[(0,s.jsx)(u.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:e.level}),(0,s.jsx)("div",{style:{marginTop:6,whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.message}),e.suggestion&&(0,s.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))),eG.exportGate.checklist.length>0&&(0,s.jsxs)("div",{style:{marginTop:8},children:[(0,s.jsx)(el,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:"导出门禁"}),(0,s.jsx)(A.A,{size:"small",dataSource:eG.exportGate.checklist,renderItem:e=>(0,s.jsxs)(A.A.Item,{children:[(0,s.jsx)(el,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.label}),(0,s.jsx)(u.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})]})]})},{key:"stages",label:"执行阶段 (".concat(eG.executionStages.length,")"),children:(0,s.jsx)(A.A,{size:"small",dataSource:eG.executionStages,renderItem:e=>(0,s.jsxs)(A.A.Item,{children:[(0,s.jsx)(A.A.Item.Meta,{avatar:ed[e.type]||(0,s.jsx)(B.A,{}),title:(0,s.jsx)(el,{title:e.roleId,style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:"".concat(e.title||em[e.type]||e.type," \xb7 ").concat(e.roleName||e.subtitle||tK(e.roleId))}),description:(0,s.jsx)(el,{type:"secondary",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})}),(0,s.jsx)(u.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})})}]})})]})}),(0,s.jsx)(g.A,{title:ej("documents.templateEditor"),open:ts,onClose:()=>tl(!1),size:"large",mask:{closable:!1},styles:{body:{padding:20,overflow:"auto"},header:{borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,s.jsxs)(i.A,{children:[(0,s.jsx)(p.Ay,{onClick:()=>tl(!1),children:ej("common.cancel")}),(0,s.jsx)(p.Ay,{type:"primary",onClick:()=>{t9()},children:ej("common.save")})]}),children:(0,s.jsxs)(d.A,{form:ew,layout:"vertical",requiredMark:"optional",children:[(0,s.jsxs)(w.A,{gutter:12,children:[(0,s.jsx)(d.A.Item,{name:"id",hidden:!0,children:(0,s.jsx)(n.A,{})}),(0,s.jsx)(b.A,{xs:24,md:8,children:(0,s.jsx)(d.A.Item,{name:"name",label:ej("documents.templateName"),rules:[{required:!0}],children:(0,s.jsx)(n.A,{})})}),(0,s.jsx)(b.A,{xs:24,md:8,children:(0,s.jsx)(d.A.Item,{name:"category",label:ej("documents.templateCategory"),children:(0,s.jsx)(n.A,{})})}),(0,s.jsx)(b.A,{xs:24,md:8,children:(0,s.jsx)(d.A.Item,{name:"outputTitle",label:ej("documents.outputTitle"),children:(0,s.jsx)(n.A,{})})}),(0,s.jsx)(b.A,{xs:24,md:12,children:(0,s.jsx)(d.A.Item,{name:"description",label:ej("documents.templateDescription"),children:(0,s.jsx)(n.A,{})})})]}),(0,s.jsx)(d.A.Item,{name:"projectRoleConfigId",label:ej("documents.projectRoleConfig"),rules:[{required:!0,message:ej("documents.projectRoleConfigRequired")}],children:(0,s.jsx)(k.A,{showSearch:!0,placeholder:ej("documents.projectRoleConfigRequired"),options:tH})}),(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(el,{strong:!0,className:"text-base text-[var(--colorText)] block mb-1",children:"项目资料包绑定"}),(0,s.jsx)("div",{className:"text-xs text-[var(--colorTextSecondary)]",children:"直接选择整个项目文件夹,系统会自动识别招标正文、清单、图纸、补疑等资料类型。"})]}),(0,s.jsx)(u.A,{color:"blue",className:"border-0",children:"按项目资料包"})]}),e_?(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)(y.A,{}),(0,s.jsx)("div",{className:"mt-3 text-[var(--colorTextSecondary)] text-xs",children:"正在加载知识库文件…"})]}):0===eE.length?(0,s.jsx)(h.A,{image:h.A.PRESENTED_IMAGE_SIMPLE,description:"暂无知识库文件"}):(0,s.jsx)(d.A.Item,{name:"projectMaterialRoots",rules:[{required:!0,message:"请选择项目资料包"}],children:(0,s.jsx)(C.A,{treeData:eE,loadData:t3,fieldNames:{label:"rawTitle",value:"value",children:"children"},onChange:e=>{var t;return t=e.map(e=>String(e)),void ew.setFieldValue("projectMaterialRoots",ep(t))},treeCheckable:!0,showCheckedStrategy:C.A.SHOW_PARENT,placeholder:"点击这里选择项目文件夹...",style:{width:"100%"},listHeight:360,showSearch:!0,maxTagCount:"responsive",size:"large"})})]})]})})]})}}},e=>{e.O(0,[717,883,69,700,44,224,787,195,455,506,930,636,593,792],()=>e(e.s=16403)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[309],{14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},37690:(e,l,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return t(48200)}])},45551:(e,l,t)=>{"use strict";function r(e){if(0===e)return"0 B";let l=Math.floor(Math.log(e)/Math.log(1024)),t=e/Math.pow(1024,l);return"".concat(t.toFixed(+(0!==l))," ").concat(["B","KB","MB","GB","TB"][l])}function n(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===l?"Never":"从未";let t=Math.floor(Math.floor((Date.now()-e)/1e3)/60),r=Math.floor(t/60),n=Math.floor(r/24);return n>30?new Date(e).toLocaleDateString(l):"en-US"===l?n>0?"".concat(n,"d ago"):r>0?"".concat(r,"h ago"):t>0?"".concat(t,"m ago"):"Just now":n>0?"".concat(n," 天前"):r>0?"".concat(r," 小时前"):t>0?"".concat(t," 分钟前"):"刚刚"}t.d(l,{Jm:()=>s,fw:()=>n,z3:()=>r});let a={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},o={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var l;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(l=("en-US"===t?o:a)[e])?l:e}},48200:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>L});var r=t(65321),n=t(97109),a=t(1873),o=t.n(a),s=t(86109),i=t(35292),d=t(76506),c=t(33442),u=t(11702),m=t(9137),g=t(21289),h=t(68787),x=t(56985),p=t(54989),w=t(88762),f=t(85493),k=t(84253),y=t(85114),b=t(58569),v=t(7576),_=t(47210),j=t(6578),A=t(47085),C=t(45551),N=t(14569),S=t.n(N);let{Paragraph:P}=i.A;function I(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}function z(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).slice(0,30):[]}function T(e,l){let t=l.trim()?[l.trim(),...l.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,l)=>l.length-e.length):[];if(0===t.length)return e;let n=RegExp("(".concat(t.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(n).map((e,l)=>t.some(l=>l.toLowerCase()===e.toLowerCase())?(0,r.jsx)("mark",{children:e},l):e)}function F(e,l,t){return null==l||""===l||Array.isArray(l)&&0===l.length?null:(0,r.jsx)(d.A.Item,{label:e,children:Array.isArray(l)?(0,r.jsx)(c.A,{wrap:!0,children:l.map(e=>(0,r.jsx)(u.A,{className:"cursor-pointer",onClick:()=>null==t?void 0:t(String(e)),children:String(e)},String(e)))}):String(l)})}function R(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return e.map((e,t)=>({key:"".concat(l,"-").concat(t),name:e}))}function L(){var e,l,t,a,i;let N=(0,A.Vr)(),L=(0,s.useRouter)(),M="string"==typeof L.query.relativePath?L.query.relativePath:"",[E,D]=(0,n.useState)(),[B,O]=(0,n.useState)(!1),[J,K]=(0,n.useState)(""),[H,V]=(0,n.useState)(!1),[U,G]=(0,n.useState)(""),[W,X]=(0,n.useState)([]);(0,n.useEffect)(()=>{M&&(O(!0),K(""),(0,j.xC)(M).then(D).catch(e=>{D(void 0),K(e instanceof Error?e.message:N("knowledge.fileDetailLoadFailed"))}).finally(()=>O(!1)))},[M,N]);let q=(0,n.useMemo)(()=>(function(e){let l=I(null==e?void 0:e.file.metadataJson);return"object"==typeof l.extraction&&l.extraction?l.extraction:l})(E),[E]),$=z(q.layerNames);(0,n.useEffect)(()=>{X($)},[null==E?void 0:E.file.relativePath,$.join("|")]);let Z=U.trim().toLowerCase(),Q=(0,n.useMemo)(()=>{var e;return E&&Z?E.chunks.filter(e=>{let l=I(e.metadataJson);return[e.content,e.sectionTitle,l.rowRange,l.chunkKind,l.parentId,JSON.stringify(l)].some(e=>String(null!=e?e:"").toLowerCase().includes(Z))}):null!=(e=null==E?void 0:E.chunks)?e:[]},[E,Z]),Y=(0,n.useMemo)(()=>{var e;return E&&Z?E.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(Z))):null!=(e=null==E?void 0:E.parents)?e:[]},[E,Z]),ee=async()=>{if(M){V(!0);try{let e=await (0,j.HC)(M);e.detail&&D(e.detail),m.Ay.success(N("knowledge.fileReindexed"))}finally{V(!1)}}},el=async e=>{e&&(await navigator.clipboard.writeText(e),m.Ay.success(N("knowledge.copied")))},et=async e=>{M&&(await (0,j.tn)(M,e),m.Ay.success("file"===e?N("knowledge.openFileRequested"):N("knowledge.openDirectoryRequested")))},er=(0,n.useMemo)(()=>{var e,l,t,n,a,s;let i=[],m=z(q.sheetNames),w=z(q.columnNames),f=z(q.layerNames),k=z(q.blockNames),y=z(q.entityTypes),b=z(q.productNames),v=z(q.materialNames),_=z(q.entityNames),j=z(q.dataPaths),A=m.length>0||w.length>0||null!=q.rowCount||null!=q.columnCount||null!=q.formulaCount||null!=q.mergeCount,C=R(w,"column"),T=(null!=(e=null==E?void 0:E.chunks)?e:[]).map(e=>I(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,l)=>({key:"row-".concat(l),name:e})),L=(null!=(l=null==E?void 0:E.chunks)?l:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>e.includes("|")).slice(0,80).map((e,l)=>({key:"grid-".concat(l),cells:e.split("|").map(e=>e.trim()).filter(Boolean)}));(A||C.length>0||T.length>0||L.length>0)&&i.push({key:"table",label:N("knowledge.table"),children:(0,r.jsxs)("div",{className:"flex flex-col w-full gap-4",children:[A&&(0,r.jsxs)(d.A,{size:"small",column:2,bordered:!0,children:[F(N("knowledge.sheet"),m,G),F(N("knowledge.header"),w,G),F(N("knowledge.rows"),q.rowCount),F(N("knowledge.columns"),q.columnCount),F(N("knowledge.formulaCount"),q.formulaCount),F(N("knowledge.mergeCount"),q.mergeCount)]}),C.length>0&&(0,r.jsx)(g.A,{size:"small",pagination:!1,rowKey:"key",dataSource:C,columns:[{title:N("knowledge.columnName"),dataIndex:"name",render:e=>(0,r.jsx)(u.A,{className:"cursor-pointer m-0 border-0 bg-[var(--colorFillSecondary)] hover:bg-[var(--colorFillAlter)]",onClick:()=>G(String(e)),children:String(e)})}],className:"custom-table border border-[var(--borderColor)] rounded-xl overflow-hidden"}),T.length>0&&(0,r.jsx)(g.A,{size:"small",pagination:!1,rowKey:"key",dataSource:T,columns:[{title:N("knowledge.rowRange"),dataIndex:"name",render:e=>(0,r.jsxs)(u.A,{color:"gold",className:"cursor-pointer m-0 border-0",onClick:()=>G(String(e)),children:[N("knowledge.rowPrefix")," ",String(e)]})}],className:"custom-table border border-[var(--borderColor)] rounded-xl overflow-hidden"}),L.length>0&&(0,r.jsx)(g.A,{size:"small",rowKey:"key",dataSource:L,pagination:{pageSize:10},columns:[{title:N("knowledge.tableGridPreview"),dataIndex:"cells",render:e=>(0,r.jsx)(c.A,{wrap:!0,children:e.map((e,l)=>(0,r.jsx)(u.A,{className:"m-0 border-0 bg-[var(--colorFillSecondary)]",children:e},"".concat(e,"-").concat(l)))})}],className:"custom-table border border-[var(--borderColor)] rounded-xl overflow-hidden"})]})});let M=f.length>0||k.length>0||y.length>0||b.length>0||v.length>0||_.length>0,D=[...R(f,"layer").map(e=>({...e,type:N("knowledge.layer")})),...R(y,"entity").map(e=>({...e,type:N("knowledge.entityType")})),...R(k,"block").map(e=>({...e,type:N("knowledge.blockSymbol")}))];(M||f.length>0||D.length>0)&&i.push({key:"drawing",label:N("knowledge.drawing"),children:(0,r.jsxs)("div",{className:"flex flex-col w-full gap-4",children:[M&&(0,r.jsxs)(d.A,{size:"small",column:2,bordered:!0,children:[F(N("knowledge.layer"),f,G),F(N("knowledge.blockSymbol"),k,G),F(N("knowledge.entityType"),y,G),F(N("knowledge.productPart"),b,G),F(N("knowledge.material"),v,G),F(N("knowledge.entityName"),_,G)]}),f.length>0&&(0,r.jsxs)(h.A,{size:"small",title:N("knowledge.layerTogglePreview"),className:"rounded-xl border-[var(--borderColor)]",children:[(0,r.jsx)(x.A.Group,{value:W,options:f.map(e=>({label:e,value:e})),onChange:e=>X(e.map(String))}),(0,r.jsx)("div",{className:S().drawingPreview,children:W.map(e=>(0,r.jsx)(u.A,{color:"blue",children:e},e))})]}),D.length>0&&(0,r.jsx)(g.A,{size:"small",pagination:!1,rowKey:"key",dataSource:D,columns:[{title:N("knowledge.type"),dataIndex:"type",width:120},{title:N("knowledge.name"),dataIndex:"name",render:e=>(0,r.jsx)(u.A,{className:"cursor-pointer",onClick:()=>G(String(e)),children:String(e)})}],className:"custom-table border border-[var(--borderColor)] rounded-xl overflow-hidden"})]})});let B=(null!=(t=null==E?void 0:E.chunks)?t:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>/^[\w.[\]-]+\s*[:=]/u.test(e)).slice(0,200).map((e,l)=>{var t,r,n,a;let o=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(l),path:null!=(n=null==o||null==(t=o[1])?void 0:t.trim())?n:e,value:null!=(a=null==o||null==(r=o[2])?void 0:r.trim())?a:""}});(j.length>0||B.length>0)&&i.push({key:"data",label:N("knowledge.dataPath"),children:(0,r.jsxs)("div",{className:"flex flex-col w-full gap-4",children:[j.length>0&&(0,r.jsx)("div",{className:"bg-[var(--colorFillAlter)] border border-[var(--colorBorderSecondary)] rounded-xl p-3",children:(0,r.jsx)(p.A,{defaultExpandAll:!0,treeData:function(e){let l=new Map;for(let t of e){let e=l;for(let l of t.replace(/\[(\d+)\]/gu,".$1").split(".").filter(Boolean))e.has(l)||e.set(l,new Map),e=e.get(l)}let t=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return[...e.entries()].map(e=>{let[r,n]=e;return{title:r,key:l?"".concat(l,".").concat(r):r,children:t(n,l?"".concat(l,".").concat(r):r)}})};return t(l)}(j),onSelect:e=>{var l;return G(String(null!=(l=e[0])?l:""))},className:"bg-transparent"})}),B.length>0&&(0,r.jsx)(g.A,{size:"small",rowKey:"key",dataSource:B,pagination:{pageSize:20},columns:[{title:N("knowledge.path"),dataIndex:"path",width:260,render:e=>(0,r.jsx)(u.A,{className:"cursor-pointer",onClick:()=>G(String(e)),children:String(e)})},{title:N("knowledge.value"),dataIndex:"value",render:e=>(0,r.jsx)("span",{className:"break-all",children:String(e)})}],className:"custom-table border border-[var(--borderColor)] rounded-xl overflow-hidden"})]})});let O=[q.ocrRecommended,q.ocrReason,q.ocrProvider,q.ocrLanguages,q.ocrTextLength,q.pdfPageOcrSupported,q.ocrPageCount,q.pdfOcrPageLimit,q.pdfRenderer,q.pdfPageCount,q.textPages,q.ocrAugmented,q.ocrPages,q.failedPages,q.imagePreprocessor].some(e=>null!=e),J=(null!=(n=null==E?void 0:E.chunks)?n:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,l,t,r)=>{var n,a,o;return t%2==0&&e.push({key:"page-".concat(l),page:l,text:null!=(o=null==(a=r[t+1])||null==(n=a.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:n.trim())?o:""}),e},[]),K=(null==E?void 0:E.file.format)==="pdf";return(O||K||J.length>0)&&i.push({key:"ocr",label:N("knowledge.ocrPdf"),children:(0,r.jsxs)("div",{className:"flex flex-col w-full gap-4",children:[O&&(0,r.jsxs)(d.A,{size:"small",column:2,bordered:!0,children:[F(N("knowledge.ocrRecommended"),q.ocrRecommended),F(N("knowledge.ocrReason"),q.ocrReason),F(N("knowledge.ocrProvider"),q.ocrProvider),F(N("knowledge.ocrLanguages"),q.ocrLanguages),F(N("knowledge.ocrTextLength"),q.ocrTextLength),F(N("knowledge.pdfPageCount"),q.pdfPageCount),F(N("knowledge.pdfTextPages"),q.textPages),F(N("knowledge.pdfOcrAugmented"),q.ocrAugmented),F(N("knowledge.pdfOcrPages"),Array.isArray(q.ocrPages)?q.ocrPages.join(", "):q.ocrPages),F(N("knowledge.pdfFailedPages"),Array.isArray(q.failedPages)?q.failedPages.map(e=>JSON.stringify(e)).join("; "):q.failedPages),F(N("knowledge.pdfPageOcrSupported"),q.pdfPageOcrSupported),F(N("knowledge.pdfOcrPageCount"),q.ocrPageCount),F(N("knowledge.pdfOcrPageLimit"),q.pdfOcrPageLimit),F(N("knowledge.pdfRenderer"),q.pdfRenderer),F(N("knowledge.imagePreprocessor"),q.imagePreprocessor)]}),K&&(0,r.jsx)("div",{className:S().pdfPreviewStrip,children:Array.from({length:Math.min(Number(null!=(s=null!=(a=q.pdfPageCount)?a:q.ocrPageCount)?s:1)||1,6)},(e,l)=>(0,r.jsx)(o(),{width:220,height:320,src:"/api/kb/files/preview-pdf-page?relativePath=".concat(encodeURIComponent(E.file.relativePath),"&page=").concat(l+1),alt:"PDF ".concat(N("knowledge.pageNumber")," ").concat(l+1),unoptimized:!0,className:"border border-[var(--borderColor)] rounded object-cover"},l))}),J.length>0&&(0,r.jsx)(g.A,{size:"small",rowKey:"key",dataSource:J,pagination:{pageSize:10},columns:[{title:N("knowledge.pageNumber"),dataIndex:"page",width:90},{title:N("knowledge.ocrText"),dataIndex:"text",render:e=>(0,r.jsx)(P,{ellipsis:{rows:4,expandable:!0,symbol:N("knowledge.openExpand")},children:String(e)})}],className:"custom-table border border-[var(--borderColor)] rounded-xl overflow-hidden"})]})}),i},[q,E,W]),en=[{title:N("knowledge.index"),key:"index",width:70,render:(e,l,t)=>t+1},{title:N("knowledge.chunkIndex"),dataIndex:"chunkIndex",width:90,render:e=>String(e)},{title:N("knowledge.chunkType"),width:110,render:(e,l)=>{var t;return(0,r.jsx)(u.A,{children:String(null!=(t=I(l.metadataJson).chunkKind)?t:l.category)})}},{title:N("knowledge.sectionOrRange"),width:220,render:(e,l)=>{let t=I(l.metadataJson),n="string"==typeof t.rowRange?t.rowRange:void 0;return(0,r.jsxs)(c.A,{wrap:!0,children:[l.sectionTitle?(0,r.jsx)(u.A,{color:"cyan",children:l.sectionTitle}):null,n?(0,r.jsxs)(u.A,{color:"gold",children:[N("knowledge.rowPrefix")," ",n]}):null]})}},{title:N("knowledge.tokens"),dataIndex:"tokenCount",width:90},{title:N("knowledge.chunkContent"),render:(e,l)=>(0,r.jsx)(P,{ellipsis:{rows:3,expandable:!0,symbol:N("knowledge.openExpand")},className:S().searchContent,children:T(l.content,U)})}],ea=[{title:N("knowledge.index"),key:"index",width:70,render:(e,l,t)=>t+1},{title:N("knowledge.parentChunkId"),dataIndex:"parentId",width:260,render:e=>(0,r.jsx)("span",{className:"break-all",children:e})},{title:N("knowledge.chunkCount"),dataIndex:"chunkCount",width:90},{title:N("knowledge.section"),dataIndex:"sectionTitle",width:220},{title:N("knowledge.chunkContent"),render:(e,l)=>(0,r.jsx)(P,{ellipsis:{rows:3,expandable:!0,symbol:N("knowledge.openExpand")},className:S().searchContent,children:T(l.content,U)})}];return B?(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsx)(w.A,{active:!0,paragraph:{rows:1}}),(0,r.jsx)(h.A,{size:"small",children:(0,r.jsx)(w.A,{active:!0,paragraph:{rows:6}})}),(0,r.jsx)(h.A,{size:"small",children:(0,r.jsx)(w.A,{active:!0,paragraph:{rows:4}})})]}):J?(0,r.jsx)(f.A,{type:"error",showIcon:!0,description:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{children:N("knowledge.fileDetailLoadFailed")}),(0,r.jsx)("div",{children:J})]})}):E?(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsx)("div",{className:"bg-[var(--colorBgContainer)] rounded-2xl overflow-hidden border border-[var(--borderColor)] p-6 mb-6",children:(0,r.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-6",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(y.Ay,{icon:(0,r.jsx)(_.A,{}),href:"/knowledge/files",type:"link",className:"p-0 mr-4 text-[var(--colorTextSecondary)] hover:text-[var(--colorText)] flex items-center h-auto",children:N("knowledge.backToFileList")}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-[var(--colorText)] mb-1 flex items-center gap-2",children:N("knowledge.fileDetailTitle")}),(0,r.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)] m-0",children:N("knowledge.fileDetailDesc")})]})]}),(0,r.jsxs)(c.A,{wrap:!0,className:"shrink-0",children:[(0,r.jsx)(y.Ay,{size:"small",onClick:()=>{el(null==E?void 0:E.absolutePath)},children:N("knowledge.copySourcePath")}),(0,r.jsx)(y.Ay,{size:"small",onClick:()=>{el(null==E?void 0:E.directory)},children:N("knowledge.copyDirectory")}),(0,r.jsx)(y.Ay,{size:"small",onClick:()=>{et("file")},children:N("assets.openFile")}),(0,r.jsx)(y.Ay,{size:"small",onClick:()=>{et("directory")},children:N("assets.openDirectory")}),"pdf"===E.file.format?(0,r.jsx)(y.Ay,{size:"small",loading:H,onClick:()=>{ee()},children:N("knowledge.reOcr")}):null,(0,r.jsx)(y.Ay,{size:"small",type:"primary",loading:H,onClick:()=>{ee()},children:N("knowledge.reindexFile")})]})]})}),(0,r.jsx)(h.A,{size:"small",className:"rounded-2xl border-[var(--borderColor)]",title:(0,r.jsx)("span",{className:"font-semibold",children:N("knowledge.basicInfo")}),children:(0,r.jsxs)(d.A,{size:"small",column:{xxl:3,xl:2,lg:2,md:1,sm:1,xs:1},bordered:!0,styles:{label:{width:"120px",background:"var(--colorFillAlter)",color:"var(--colorTextSecondary)"}},children:[(0,r.jsx)(d.A.Item,{label:N("knowledge.path"),span:3,children:(0,r.jsx)("span",{className:"break-all",children:E.file.relativePath})}),(0,r.jsx)(d.A.Item,{label:N("knowledge.originalFile"),span:3,children:(0,r.jsx)("span",{className:"break-all",children:null!=(e=E.absolutePath)?e:"-"})}),(0,r.jsx)(d.A.Item,{label:N("knowledge.directory"),span:3,children:(0,r.jsx)("span",{className:"break-all",children:null!=(l=E.directory)?l:"-"})}),(0,r.jsx)(d.A.Item,{label:N("knowledge.fileCategory"),children:(0,r.jsxs)(c.A,{size:4,children:[(0,r.jsx)(u.A,{className:"m-0 border-0 bg-[var(--colorFillSecondary)]",children:(0,C.Jm)(E.file.category)})," ",(0,r.jsx)(u.A,{className:"m-0 border-0 bg-[var(--colorFillSecondary)]",children:E.file.format})]})}),(0,r.jsx)(d.A.Item,{label:N("knowledge.fileSize"),children:(0,C.z3)(E.file.fileSize)}),(0,r.jsx)(d.A.Item,{label:N("knowledge.chunkCount"),children:E.file.chunkCount}),(0,r.jsx)(d.A.Item,{label:N("knowledge.status"),children:(0,r.jsx)(u.A,{color:"completed"===E.file.status?"success":"failed"===E.file.status?"error":"processing",className:"m-0",children:E.file.status})}),(0,r.jsx)(d.A.Item,{label:N("knowledge.extractionMode"),children:String(null!=(t=q.extractionMode)?t:"-")}),(0,r.jsx)(d.A.Item,{label:N("knowledge.contentCoverage"),children:String(null!=(a=q.contentCoverage)?a:"-")}),(0,r.jsx)(d.A.Item,{label:N("knowledge.textLength"),children:String(null!=(i=q.textLength)?i:"-")})]})}),er.length>0&&(0,r.jsx)(h.A,{size:"small",className:"rounded-2xl border-[var(--borderColor)]",title:(0,r.jsx)("span",{className:"font-semibold",children:N("knowledge.structuredInfo")}),children:(0,r.jsx)(b.A,{items:er,className:"documents-tabs"})}),(0,r.jsx)(h.A,{size:"small",className:"rounded-2xl border-[var(--borderColor)]",title:(0,r.jsx)("span",{className:"font-semibold",children:N("knowledge.detailFilter")}),children:(0,r.jsxs)("div",{className:"flex flex-col w-full gap-4",children:[(0,r.jsx)(v.A,{allowClear:!0,size:"large",value:U,onChange:e=>G(e.target.value),placeholder:N("knowledge.detailFilterPlaceholder"),className:"rounded-xl bg-[var(--colorBgHover)] border-[var(--borderColor)] focus:bg-[var(--colorBgContainer)] hover:bg-[var(--colorBgContainer)] w-full"}),U?(0,r.jsxs)("div",{className:"flex flex-wrap gap-2 items-center bg-[var(--colorFillAlter)] p-3 rounded-xl border border-[var(--colorBorderSecondary)]",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-[var(--colorTextSecondary)] mr-2",children:"过滤结果:"}),(0,r.jsxs)(u.A,{color:"blue",className:"m-0 border-0",children:[N("knowledge.parentMatches")," ",Y.length]}),(0,r.jsxs)(u.A,{color:"green",className:"m-0 border-0",children:[N("knowledge.childMatches")," ",Q.length]}),(0,r.jsx)("div",{className:"w-[1px] h-3 bg-[var(--colorBorderSecondary)] mx-1"}),(0,r.jsxs)("span",{className:"text-xs text-[var(--colorTextTertiary)]",children:[N("knowledge.filterTerm")," ",(0,r.jsx)("strong",{className:"text-[var(--colorText)]",children:U})]})]}):null]})}),(0,r.jsxs)(h.A,{size:"small",className:"rounded-2xl border-[var(--borderColor)]",title:(0,r.jsxs)("span",{className:"font-semibold",children:[N("knowledge.parentChunks")," ",(0,r.jsxs)(u.A,{className:"ml-2 border-0 bg-[var(--colorFillSecondary)] text-xs font-normal",children:[Y.length," / ",E.parents.length]})]}),children:[(0,r.jsx)(f.A,{type:"info",showIcon:!0,description:N("knowledge.parentChunkHint"),className:"mb-4 rounded-xl border-blue-200 bg-blue-50/50"}),(0,r.jsx)(g.A,{rowKey:"id",columns:ea,dataSource:Y,pagination:{pageSize:10},size:"small",className:"custom-table"})]}),(0,r.jsx)(h.A,{size:"small",className:"rounded-2xl border-[var(--borderColor)]",title:(0,r.jsxs)("span",{className:"font-semibold",children:[N("knowledge.childChunks")," ",(0,r.jsxs)(u.A,{className:"ml-2 border-0 bg-[var(--colorFillSecondary)] text-xs font-normal",children:[Q.length," / ",E.chunks.length]})]}),children:(0,r.jsx)(g.A,{rowKey:"id",columns:en,dataSource:Q,pagination:{pageSize:20},size:"small",className:"custom-table"})})]}):(0,r.jsx)(k.A,{description:N("knowledge.selectFile")})}}},e=>{e.O(0,[717,883,69,700,44,224,787,102,289,506,850,636,593,792],()=>e(e.s=37690)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28],{1611:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"database",theme:"outlined"}},12887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},13067:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0010.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 00-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"}}]},name:"file-excel",theme:"outlined"}},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},23793:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"}},25258:(e,t,r)=>{"use strict";r.d(t,{A:()=>b});var l=r(51541),a=r(61848),n=r(5669),s=r(97109),i=r(72658),c=r(3638),o=r(92162),d=r(82725),u=r(74567),f=r(632),h=r(49517),m=r(79412),p=r(19527);let v=(0,d.U)(e=>{let{prefixCls:t,className:r,closeIcon:l,closable:a,type:n,title:d,children:v,footer:g,classNames:x,styles:y,...b}=e,{getPrefixCls:w}=s.useContext(u.QO),{className:j,style:_,classNames:A,styles:k}=(0,u.TP)("modal"),z=w(),C=t||w("modal"),S=(0,f.A)(z),[P,M]=(0,p.Ay)(C,S),[N,O]=(0,o.AV)([A,x],[k,y],{props:e}),H=`${C}-confirm`,E={};return E=n?{closable:a??!1,title:"",footer:"",children:s.createElement(h.k,{...e,prefixCls:C,confirmPrefixCls:H,rootPrefixCls:z,content:v})}:{closable:a??!0,title:d,footer:null!==g&&s.createElement(m.w,{...e}),children:v},s.createElement(i.Z,{prefixCls:C,className:(0,c.$)(P,`${C}-pure-panel`,n&&H,n&&`${H}-${n}`,r,j,M,S,N.root),style:{..._,...O.root},...b,closeIcon:(0,m.O)(C,l),closable:a,classNames:N,styles:O,...E})});var g=r(99739);function x(e){return(0,l.Ay)((0,l.fp)(e))}let y=n.A;y.useModal=g.A,y.info=function(e){return(0,l.Ay)((0,l.$D)(e))},y.success=function(e){return(0,l.Ay)((0,l.Ej)(e))},y.error=function(e){return(0,l.Ay)((0,l.jT)(e))},y.warning=x,y.warn=x,y.confirm=function(e){return(0,l.Ay)((0,l.lr)(e))},y.destroyAll=function(){for(;a.A.length;){let e=a.A.pop();e&&e()}},y.config=l.FB,y._InternalPanelDoNotUseOrYouWillBeFired=v;let b=y},26619:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(1611),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))},26631:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(12887),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))},30289:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"}},35311:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M456 231a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"more",theme:"outlined"}},45551:(e,t,r)=>{"use strict";function l(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),r=e/Math.pow(1024,t);return"".concat(r.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let r=Math.floor(Math.floor((Date.now()-e)/1e3)/60),l=Math.floor(r/60),a=Math.floor(l/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):l>0?"".concat(l,"h ago"):r>0?"".concat(r,"m ago"):"Just now":a>0?"".concat(a," 天前"):l>0?"".concat(l," 小时前"):r>0?"".concat(r," 分钟前"):"刚刚"}r.d(t,{Jm:()=>i,fw:()=>a,z3:()=>l});let n={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},s={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function i(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===r?s:n)[e])?t:e}},48893:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M553.1 509.1l-77.8 99.2-41.1-52.4a8 8 0 00-12.6 0l-99.8 127.2a7.98 7.98 0 006.3 12.9H696c6.7 0 10.4-7.7 6.3-12.9l-136.5-174a8.1 8.1 0 00-12.7 0zM360 442a40 40 0 1080 0 40 40 0 10-80 0zm494.6-153.4L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file-image",theme:"outlined"}},53234:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM496 208H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 544h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm328 244a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"hdd",theme:"outlined"}},54746:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(71242),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))},56398:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"}},58209:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(23793),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))},58520:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 00-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 00-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z"}}]},name:"file-word",theme:"outlined"}},61825:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(30289),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))},64207:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>et});var l=r(65321),a=r(97109),n=r(47085),s=r(43220),i=r.n(s),c=r(86109),o=r(17807),d=r(25258),u=r(11702),f=r(71102),h=r(85114),m=r(7576),p=r(50883),v=r(33442),g=r(21289),x=r(56768),y=r(48893),b=r(88483);function w(){return(w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let j=a.forwardRef((e,t)=>a.createElement(b.A,w({},e,{ref:t,icon:y.A})));var _=r(13067);function A(){return(A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let k=a.forwardRef((e,t)=>a.createElement(b.A,A({},e,{ref:t,icon:_.A})));var z=r(58520);function C(){return(C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let S=a.forwardRef((e,t)=>a.createElement(b.A,C({},e,{ref:t,icon:z.A})));var P=r(90939);function M(){return(M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let N=a.forwardRef((e,t)=>a.createElement(b.A,M({},e,{ref:t,icon:P.A})));var O=r(93314),H=r(61825),E=r(26619),T=r(7225),V=r(26631),F=r(64254),B=r(64629),R=r(58209),I=r(85855),L=r(30486),D=r(54746),q=r(84742),U=r(38762),$=r(76830),J=r(39219),Q=r(22931),W=r(6578),X=r(45551),G=r(14569),K=r.n(G);let Z=["document","spreadsheet","image","cad","code","data","web","diagram","other"],Y=/\.(zip|jar|war|apk|tar|gz|tgz|bz2|rar|7z)$/iu,ee=/(^|\/)\.DS_Store$|(^|\/)Thumbs\.db$|(^|\/)__MACOSX\/|\.bak$/iu;function et(){let e=(0,n.Vr)("knowledge"),{locale:t}=(0,n.x_)(),{message:r}=o.A.useApp(),s=(0,c.useRouter)(),y="string"==typeof s.query.category?s.query.category:"",[b,w]=(0,a.useState)([]),[_,A]=(0,a.useState)(!1),[z,C]=(0,a.useState)(""),[P,M]=(0,a.useState)(""),[G,et]=(0,a.useState)(y),[er,el]=(0,a.useState)(!1),[ea,en]=(0,a.useState)(!1),[es,ei]=(0,a.useState)([]),[ec,eo]=(0,a.useState)([]),[ed,eu]=(0,a.useState)([]),ef=(0,a.useRef)(G),eh=(0,a.useRef)(new Set),em=(0,a.useRef)(new Map);(0,a.useEffect)(()=>{ef.current=G},[G]),(0,a.useEffect)(()=>{et("string"==typeof s.query.category?s.query.category:"")},[s.query.category]);let ep=(0,a.useCallback)(async(e,t)=>{let r=null!=e?e:ef.current;(null==t?void 0:t.silent)||(A(!0),C(""));try{let e=await (0,W.HT)({category:r||void 0,limit:5e3});w(e.files||[]),e.initializing&&window.setTimeout(()=>{ep(r,{silent:!0})},3e3)}catch(e){(null==t?void 0:t.silent)||(w([]),C(e instanceof Error?e.message:"文件列表加载失败"))}finally{(null==t?void 0:t.silent)||A(!1)}},[]);(0,a.useEffect)(()=>{ep(G)},[G,ep]);let ev=e=>"document"===e.type?null:{id:e.id,type:e.type,title:e.title,description:e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,textLength:e.textLength,extractionMode:e.extractionMode,error:e.error,createdAt:e.createdAt},eg=(0,a.useCallback)(async()=>{try{let t=await (0,W.Qx)(),r=t.operations.map(ev).filter(e=>!!e);for(let r of[...eh.current]){var e;let l=t.operations.find(e=>e.id===r);if(!l)continue;let a="".concat(l.status,":").concat(l.stage),n=null!=(e=em.current.get(r))?e:"";"success"===l.status||"error"===l.status?(eh.current.delete(r),em.current.delete(r),ep(void 0,{silent:!0})):a!==n&&(em.current.set(r,a),ep(void 0,{silent:!0}))}ei(e=>{let t=new Set(r.map(e=>e.id).filter(Boolean)),l=r.map(t=>{var r;let l=e.find(e=>e.id===t.id);return l?{...l,...t,createdAt:null!=(r=l.createdAt)?r:t.createdAt}:t}),a=e.filter(e=>e.id&&!t.has(e.id)&&"processing"===e.status);return[...l,...a].slice(0,50)})}catch(e){}},[ep]),ex=(0,a.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];ei(r=>{let l=r.findIndex(r=>e.id&&r.id===e.id||t.includes(r.title));if(l>=0){var a;let t=[...r];return t[l]={...r[l],...e,createdAt:null!=(a=r[l].createdAt)?a:e.createdAt},t}return[e,...r].slice(0,50)})},[]);(0,a.useEffect)(()=>{eg()},[eg]);let ey=(0,a.useMemo)(()=>{let e=0,t=0,r=0;for(let l of es)"processing"===l.status?e++:"success"===l.status?t++:("error"===l.status||"warning"===l.status)&&r++;return{processing:e,success:t,error:r}},[es]);(0,a.useEffect)(()=>{if(0===ey.processing)return;let e=window.setInterval(()=>{eg()},2e3),t=window.setInterval(()=>{ep(void 0,{silent:!0})},8e3);return()=>{window.clearInterval(e),window.clearInterval(t)}},[ep,eg,ey.processing]);let eb=async e=>{let t=e.filter(e=>{let t=e.webkitRelativePath||e.name;return e.size>0&&!Y.test(e.name)&&!ee.test(t)}),l=e.length-t.length;if(l>0&&r.warning("已跳过 ".concat(l," 个空文件、系统文件、备份文件或压缩包")),0===t.length)return;let a=1===t.length?t[0].name:"".concat(t.length," 个文件");el(!0);let n="".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2));eh.current.add(n),em.current.set(n,""),ex({id:n,type:"upload",title:"上传 ".concat(a),description:"等待上传、解析、切片和入库;同路径文件会更新,其他已有文件不会清除",status:"processing",percent:5});try{await (0,W.c1)(t,void 0,n,e=>{ex({id:n,type:"upload",title:"上传 ".concat(a),description:"正在上传文件:".concat(e.uploadedFiles,"/").concat(e.totalFiles,",批次 ").concat(e.batchIndex+1,"/").concat(e.totalBatches),status:"processing",percent:Math.min(5,Math.max(1,Math.round(e.uploadedFiles/Math.max(1,e.totalFiles)*5)))})}),r.info("文件已上传,正在后台解析、切片和入库;同路径文件会更新,其他已有文件不会清除,可在顶部“后台任务”查看进度"),M(""),et(""),eo([]),ef.current="",await eg()}catch(e){if(e instanceof W.NH){let t=e.failures.slice(0,3).map(e=>"批次 ".concat(e.batchIndex+1,"(").concat(e.files.join("、")).concat(e.files.length<5?"":" 等","):").concat(e.message)).join(";");r.warning("".concat(e.message,",失败文件可重新选择上传")),ex({id:n,type:"upload",title:"部分文件上传失败 ".concat(a),description:t||e.message,status:"warning",percent:100,error:t||e.message})}else{eh.current.delete(n),em.current.delete(n);let t=e instanceof Error?e.message:"请重试或检查文件格式";r.error(t||"上传失败"),ex({id:n,type:"error",title:"上传失败 ".concat(a),description:t,status:"error",percent:100})}}finally{el(!1)}},ew=async()=>{en(!0);let e="reindex-ui-".concat(Date.now());ex({id:e,type:"reindex",title:"重新解析入库",description:"正在提交后台任务",status:"processing",percent:5});try{var t;let l=await (0,W.H1)(),a=l.operationId||e,n=l.job;r.info(l.alreadyRunning?"已有重新解析任务正在后台执行":"已提交重新解析入库任务,可在顶部“后台任务”查看进度"),ex({id:a,type:"reindex",title:(null==n?void 0:n.title)||"重新解析入库",description:(null==n?void 0:n.message)||"后台将重新扫描文件、解析、切片并重建索引",status:(null==n?void 0:n.status)||"processing",percent:null!=(t=null==n?void 0:n.percent)?t:10,error:null==n?void 0:n.error},["重新解析入库"]);for(let e=0;e<360;e++){let e=await (0,W.ax)(a).then(e=>e.job).catch(async()=>(await (0,W.Qx)()).operations.find(e=>e.id===a));if(e){let t="success"===e.status||"error"===e.status;if(ex({id:a,type:"error"===e.status?"error":"reindex",title:"success"===e.status?"重新解析入库完成":"error"===e.status?"重新解析入库失败":e.title,description:e.error||e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,error:e.error}),t){"success"===e.status?r.success(e.message||"重新解析入库完成"):r.error(e.error||e.message||"重新解析入库失败");break}}await new Promise(e=>setTimeout(e,1e3))}await ep(),await eg()}catch(l){let t=l instanceof Error?l.message:"重新解析入库失败";r.error(t),ex({id:e,type:"error",title:"重新解析入库失败",description:t,status:"error",percent:100},["重新解析入库","重新解析入库完成","重新解析入库失败"])}finally{en(!1)}},ej=async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l="file-reindex-ui-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2));ex({id:l,type:"reindex",title:"".concat(t?"重新解析文件夹":"重新解析"," ").concat(e),description:t?"正在提交文件夹后台任务":"正在提交单文件后台任务",status:"processing",percent:5,filePath:e});try{var a;let t=await (0,W.HC)(e),n=t.operationId||l,s=t.job;r.info(t.alreadyRunning?"已有知识库任务正在后台执行":"已提交单文件重新解析任务"),ex({id:n,type:"reindex",title:(null==s?void 0:s.title)||"重新解析 ".concat(e),description:(null==s?void 0:s.message)||"后台将重新解析、分块并入库该文件",status:(null==s?void 0:s.status)||"processing",percent:null!=(a=null==s?void 0:s.percent)?a:10,filePath:(null==s?void 0:s.filePath)||e,chunkCount:null==s?void 0:s.chunkCount,error:null==s?void 0:s.error},["重新解析 ".concat(e)]);for(let t=0;t<240;t++){let t=await (0,W.ax)(n).then(e=>e.job).catch(async()=>(await (0,W.Qx)()).operations.find(e=>e.id===n));if(t){let l="success"===t.status||"error"===t.status;if(ex({id:n,type:"error"===t.status?"error":"reindex",title:"success"===t.status?"重新解析完成 ".concat(e):"error"===t.status?"重新解析失败 ".concat(e):t.title,description:t.error||t.message,status:t.status,percent:t.percent,filePath:t.filePath||e,chunkCount:t.chunkCount,error:t.error}),await ep(),l){"success"===t.status?r.success(t.message||"单文件重新解析完成"):r.error(t.error||t.message||"单文件重新解析失败");break}}await new Promise(e=>setTimeout(e,1e3))}await ep(),await eg()}catch(a){let t=a instanceof Error?a.message:"单文件重新解析失败";r.error(t),ex({id:l,type:"error",title:"重新解析失败 ".concat(e),description:t,status:"error",percent:100,filePath:e},["重新解析 ".concat(e)])}},e_=t=>{let l="selected"===t?eO:"filtered"===t?ek.map(e=>e.relativePath):[],a=b.length;if("all"!==t&&0===l.length||"all"===t&&0===a)return void r.info("没有可删除的文件");let n="all"===t?"删除全部文件 ".concat(a," 个?"):"filtered"===t?"删除当前筛选结果中的文件 ".concat(l.length," 个?"):"删除已选文件 ".concat(l.length," 个?");d.A.confirm({title:n,content:"将同时删除文件、切片、索引和向量记录。此操作不可撤销。",okText:e("common.delete"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{ei(e=>[{type:"delete",title:n,description:"正在批量删除文件和索引",status:"processing",percent:10},...e].slice(0,50));try{var e;let n=null!=(e=("all"===t?await (0,W.X8)():"selected"===t?await (0,W.tZ)(eN,eM):await (0,W.SJ)(l)).deleted)?e:"all"===t?a:l.length;r.success("已删除 ".concat(n," 个文件")),eo([]),ei(e=>[{type:"delete",title:"批量删除完成",description:"已删除 ".concat(n," 个文件、切片和索引"),status:"success"},...e].slice(0,50)),await ep(),await eg()}catch(e){r.error("批量删除失败"),ei(e=>[{type:"error",title:"批量删除失败",description:"请重试",status:"error"},...e].slice(0,50))}}})},eA=async()=>{if(0===eN.length&&0===eM.length)return;let t=r.loading(e("exporting"),0);try{let{blob:t,fileName:l,exported:a,skipped:n}=await (0,W.G8)({relativePaths:eN,folderPaths:eM}),s=URL.createObjectURL(t),i=document.createElement("a");i.href=s,i.download=l,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(s),n>0?r.warning(e("exportParsedSkipped").replace("{count}",String(n))):r.success(e("exportParsedSuccess").replace("{count}",String(a)))}catch(t){r.error(t instanceof Error&&t.message?t.message:e("exportParsedFailed"))}finally{t()}},ek=(0,a.useMemo)(()=>P?b.filter(e=>e.relativePath.toLowerCase().includes(P.toLowerCase())):b,[P,b]),ez=(0,a.useMemo)(()=>new Set(ek.map(e=>e.relativePath)),[ek]),eC=(0,a.useMemo)(()=>{let e={};for(let r of[...ek].sort((e,t)=>e.relativePath.localeCompare(t.relativePath))){let l=r.relativePath.split("/"),a="";for(let n=0;n<l.length;n++){let s=l[n],i=a;a=a?"".concat(a,"/").concat(s):s;let c=n===l.length-1;if(e[a])c||e[a].isFolder?c&&(e[a].isFolder=!1,e[a].file=r,e[a].fileCount=1,e[a].totalSize=r.fileSize,e[a].totalChunks=r.chunkCount):(e[a].isFolder=!0,e[a].children=[],e[a].fileCount=0,e[a].totalSize=0,e[a].totalChunks=0);else{var t;e[a]={key:a,name:s,isFolder:!c,...c?{file:r,fileCount:1,totalSize:r.fileSize,totalChunks:r.chunkCount}:{children:[],fileCount:0,totalSize:0,totalChunks:0}},i&&(null==(t=e[i])?void 0:t.children)&&e[i].children.push(e[a])}}}let r=e=>{for(let n of e)if(n.children){r(n.children);let e=0,s=0,i=0;for(let r of n.children){var t,l,a;e+=null!=(t=r.fileCount)?t:0,s+=null!=(l=r.totalSize)?l:0,i+=null!=(a=r.totalChunks)?a:0}n.fileCount=e,n.totalSize=s,n.totalChunks=i}},l=e=>e.map(e=>e.children?{...e,children:l(e.children)}:e).filter(e=>{var t,r,l;return!e.isFolder||(null!=(r=e.fileCount)?r:0)>0&&(null!=(l=null==(t=e.children)?void 0:t.length)?l:0)>0}),a=Object.values(e).filter(e=>!e.key.includes("/"));return r(a),l(a)},[ek]),eS=(0,a.useMemo)(()=>{let e=[],t=r=>{for(let l of r)e.push(l.key),l.children&&t(l.children)};return t(eC),e},[eC]),eP=(0,a.useMemo)(()=>new Set([...ez,...eS]),[eS,ez]),eM=(0,a.useMemo)(()=>ec.map(String).filter(e=>!ez.has(e)&&eS.includes(e)),[eS,ec,ez]),eN=(0,a.useMemo)(()=>ec.map(String).filter(e=>ez.has(e)),[ec,ez]),eO=(0,a.useMemo)(()=>{let e=new Set;for(let t of eN){let r=b.find(e=>e.relativePath===t);r&&e.add(r.relativePath)}for(let t of eM){let r="".concat(t,"/");for(let t of b)t.relativePath.startsWith(r)&&e.add(t.relativePath)}return Array.from(e)},[b,eN,eM]),eH=eO.length;(0,a.useEffect)(()=>{eo(e=>e.filter(e=>eP.has(String(e))))},[eP]);let eE=(0,a.useMemo)(()=>P?eS:[],[P,eS]);(0,a.useEffect)(()=>{eu(eE)},[eE]);let eT=(e,t)=>{eu(r=>e?[...r,t.key]:r.filter(e=>e!==t.key))},eV=[{title:e("fileName"),dataIndex:"name",key:"name",render:(e,t)=>(0,l.jsxs)("span",{className:K().fileNameCell,children:[t.isFolder?(0,l.jsx)("span",{style:{cursor:"pointer"},onClick:e=>{e.stopPropagation(),eT(!ed.includes(t.key),t)},children:(e=>{let t=e.children;return t&&0!==t.length?(0,l.jsx)(F.A,{style:{color:"#fa8c16",fontSize:15}}):(0,l.jsx)(T.A,{style:{color:"#fa8c16",fontSize:15}})})(t)}):(e=>{if(!e)return(0,l.jsx)(x.A,{style:{fontSize:15}});let t=e.category;return"image"===t?(0,l.jsx)(j,{style:{color:"#eb2f96",fontSize:15}}):"spreadsheet"===t?(0,l.jsx)(k,{style:{color:"#52c41a",fontSize:15}}):"document"===t?(0,l.jsx)(S,{style:{color:"#1677ff",fontSize:15}}):"code"===t?(0,l.jsx)(N,{style:{color:"#fa8c16",fontSize:15}}):"archive"===t?(0,l.jsx)(O.A,{style:{color:"#8c8c8c",fontSize:15}}):"web"===t?(0,l.jsx)(H.A,{style:{color:"#13c2c2",fontSize:15}}):"data"===t?(0,l.jsx)(E.A,{style:{color:"#722ed1",fontSize:15}}):"cad"===t?(0,l.jsx)(T.A,{style:{color:"#fa541c",fontSize:15}}):"diagram"===t?(0,l.jsx)(j,{style:{color:"#a0d911",fontSize:15}}):(0,l.jsx)(V.A,{style:{fontSize:15}})})(t.file),t.isFolder?(0,l.jsx)("span",{className:K().folderName,onClick:e=>{e.stopPropagation(),eT(!ed.includes(t.key),t)},children:t.name}):(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(i(),{className:"min-w-0 max-w-[520px] whitespace-normal break-words leading-relaxed",href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(t.key)),children:t.name})})]})},{title:e("fileCategory"),dataIndex:"category",key:"cat",width:110,render:(e,r)=>{var a,n;return r.isFolder?(0,l.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,l.jsx)(u.A,{children:(0,X.Jm)(null!=(n=null==(a=r.file)?void 0:a.category)?n:"",t)})}},{title:e("fileSize"),dataIndex:"fileSize",key:"size",width:90,render:(e,t)=>{var r,l,a;return(0,X.z3)(t.isFolder?null!=(l=t.totalSize)?l:0:null!=(a=null==(r=t.file)?void 0:r.fileSize)?a:0)}},{title:e("chunksCount"),dataIndex:"chunkCount",key:"chunks",width:80,render:(e,t)=>{var r,a,n;let s=t.isFolder?null!=(a=t.totalChunks)?a:0:null!=(n=null==(r=t.file)?void 0:r.chunkCount)?n:0;return(0,l.jsx)(u.A,{color:s>1?"green":"orange",children:s})}},{title:e("parsingStatus"),dataIndex:"status",key:"status",width:100,render:(e,t)=>{var r,a,n,s;return t.isFolder?(0,l.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,l.jsx)(u.A,{color:"active"===(s=null==(r=t.file)?void 0:r.status)?"green":"processing"===s||"indexing"===s?"blue":"error"===s?"red":"orange",children:(null==(a=t.file)?void 0:a.errorMessage)||(null==(n=t.file)?void 0:n.status)||"—"})}},{title:e("fileDate"),dataIndex:"mtime",key:"date",width:130,render:(e,r)=>{var a;return r.isFolder?(0,l.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(null==(a=r.file)?void 0:a.mtime)?new Date(r.file.mtime).toLocaleDateString(t):"—"}},{title:e("source"),key:"source",width:100,render:(t,r)=>r.isFolder?(0,l.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,l.jsx)(u.A,{color:"cyan",children:e("fileSource")})},{title:"",key:"act",width:80,align:"center",render:(t,a)=>{var n;return(0,l.jsx)(f.A,{menu:{items:a.isFolder?[{key:"reindex-folder",label:"重新索引文件夹",icon:(0,l.jsx)(B.A,{}),disabled:(null!=(n=a.fileCount)?n:0)===0,onClick:()=>{ej(a.key,!0)}}]:[{key:"reindex",label:e("reindex"),icon:(0,l.jsx)(B.A,{}),onClick:()=>{ej(a.file.relativePath)}},{type:"divider"},{key:"delete",label:e("delete"),icon:(0,l.jsx)(R.A,{}),danger:!0,onClick:()=>{var t;return t=a.file,void d.A.confirm({title:e("delete"),content:e("deleteConfirm"),okText:e("common.confirm"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{ei(e=>[{type:"delete",title:"删除 ".concat(t.relativePath),description:"正在删除文件记录",status:"processing"},...e].slice(0,50));try{await (0,W.xq)(t.relativePath),r.success("已删除"),ei(e=>[{type:"delete",title:"删除完成 ".concat(t.relativePath),description:"文件和索引记录已移除",status:"success"},...e].slice(0,50)),eo(e=>e.filter(e=>e!==t.relativePath)),await ep(),await eg()}catch(e){r.error("删除失败"),ei(e=>[{type:"error",title:"删除失败 ".concat(t.relativePath),description:"请重试",status:"error"},...e].slice(0,50))}}})}}]},trigger:["click"],children:(0,l.jsx)(h.Ay,{type:"text",size:"small",icon:(0,l.jsx)(I.A,{})})})}}],eF=(0,l.jsxs)("div",{className:"flex flex-1 md:flex-none w-full md:w-auto items-center gap-3",children:[(0,l.jsx)(m.A,{placeholder:e("searchPlaceholder"),prefix:(0,l.jsx)(L.A,{className:"text-[var(--colorTextTertiary)]"}),value:P,onChange:e=>{M(e.target.value)},allowClear:!0,variant:"borderless",className:"max-w-[300px] flex-1 bg-transparent hover:bg-transparent focus:bg-transparent",style:{borderBottom:"1px solid var(--borderColor)",borderRadius:0,paddingLeft:0,paddingRight:0}}),(0,l.jsx)(p.A,{value:G||void 0,onChange:e=>{et(e||"")},placeholder:e("filterCategory"),allowClear:!0,style:{width:140},variant:"borderless",options:[{label:e("allCategories"),value:""},...Z.map(e=>({label:(0,X.Jm)(e,t),value:e}))]}),(0,l.jsx)("div",{className:"w-[1px] h-6 bg-[var(--borderColor)] mx-1"}),(0,l.jsx)(f.A,{menu:{items:[{key:"file",label:e("uploadFiles"),icon:(0,l.jsx)(x.A,{}),onClick:()=>{var e;return null==(e=document.getElementById("kb-file-upload-input"))?void 0:e.click()}},{key:"folder",label:e("uploadFolder"),icon:(0,l.jsx)(T.A,{}),onClick:()=>{var e;return null==(e=document.getElementById("kb-folder-upload-input"))?void 0:e.click()}},{type:"divider"},{key:"reindex",label:e("reindexAll"),icon:(0,l.jsx)(B.A,{}),onClick:()=>{ew()},danger:!0}]},trigger:["click"],children:(0,l.jsx)(h.Ay,{type:"primary",icon:(0,l.jsx)(D.A,{}),loading:er||ea,className:"rounded-md px-4",children:e("new")})}),(0,l.jsx)("input",{id:"kb-file-upload-input",type:"file",multiple:!0,hidden:!0,accept:".pdf,.doc,.docx,.txt,.md,.csv,.tsv,.xls,.xlsx,.png,.jpg,.jpeg,.webp,.svg,.dwg,.dxf,.step,.stp,.iges,.igs,.js,.ts,.tsx,.jsx,.py,.go,.java,.cs,.cpp,.c,.h,.json,.jsonl,.yaml,.yml,.xml,.html,.htm,.drawio,.dio,.vsdx,.vdx,.puml,.plantuml,.mmd,.mermaid,.excalidraw",onChange:e=>{var t;let r=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",eb(r)}}),(0,l.jsx)("input",{id:"kb-folder-upload-input",type:"file",multiple:!0,hidden:!0,webkitdirectory:"",onChange:e=>{var t;let r=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",eb(r)}})]});return(0,l.jsxs)("div",{className:"h-[calc(100vh-140px)] flex flex-col",children:[(0,l.jsxs)("div",{className:"bg-[var(--colorBgContainer)] rounded-2xl border border-[var(--borderColor)] p-6 mb-4 shrink-0 animateFadeIn",children:[(0,l.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-6 pb-6 border-b border-[var(--borderColor)]",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("h1",{className:"text-2xl font-bold tracking-tight text-[var(--colorText)] mb-1 flex items-center gap-2",children:[(0,l.jsx)(E.A,{className:"text-[var(--colorAccent)]"}),e("files")]}),(0,l.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)] m-0",children:e("manageRawFiles")})]}),eF]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6 pt-6 stagger-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("div",{className:"w-12 h-12 rounded-xl bg-[var(--colorBgHover)] flex items-center justify-center text-xl text-[var(--colorTextSecondary)]",children:(0,l.jsx)(F.A,{})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-[11px] font-semibold text-[var(--colorTextTertiary)] uppercase tracking-wider mb-1",children:e("totalRootFolders")}),(0,l.jsx)("div",{className:"text-xl font-bold text-[var(--colorText)] leading-none",children:eC.length})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("div",{className:"w-12 h-12 rounded-xl bg-[var(--colorBgHover)] flex items-center justify-center text-xl text-[var(--colorTextSecondary)]",children:(0,l.jsx)(V.A,{})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-[11px] font-semibold text-[var(--colorTextTertiary)] uppercase tracking-wider mb-1",children:e("totalFilesStats")}),(0,l.jsx)("div",{className:"text-xl font-bold text-[var(--colorText)] leading-none",children:b.length})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("div",{className:"w-12 h-12 rounded-xl bg-green-50 dark:bg-green-900/20 flex items-center justify-center text-xl text-green-600 dark:text-green-500",children:(0,l.jsx)(q.A,{})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-[11px] font-semibold text-[var(--colorTextTertiary)] uppercase tracking-wider mb-1",children:e("successfullyParsed")}),(0,l.jsx)("div",{className:"text-xl font-bold text-[var(--colorText)] leading-none",children:b.filter(e=>"success"===e.status).length})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("div",{className:"w-12 h-12 rounded-xl bg-red-50 dark:bg-red-900/20 flex items-center justify-center text-xl text-red-600 dark:text-red-500",children:(0,l.jsx)(U.A,{})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-[11px] font-semibold text-[var(--colorTextTertiary)] uppercase tracking-wider mb-1",children:e("parsingErrors")}),(0,l.jsx)("div",{className:"text-xl font-bold text-[var(--colorText)] leading-none",children:b.filter(e=>"error"===e.status).length})]})]})]})]}),z&&(0,l.jsx)("div",{className:"p-4 mb-4 bg-[var(--colorDanger)]/10 text-[var(--colorDanger)] rounded-xl border border-[var(--colorDanger)]/20",children:z}),(0,l.jsxs)("div",{className:"flex-1 min-h-0 bg-[var(--colorBgContainer)] rounded-2xl border border-[var(--borderColor)] overflow-hidden flex flex-col animateFadeIn stagger-3",style:{opacity:0},children:[(0,l.jsxs)("div",{className:"flex justify-between items-center p-4 bg-[var(--colorBgHover)] border-b border-[var(--borderColor)] shrink-0",children:[(0,l.jsx)("div",{className:"text-xs text-[var(--colorTextSecondary)] font-medium",children:e("showingMatchingFiles").replace("{count}",String(ek.length))}),(0,l.jsxs)(v.A,{size:8,children:[eH>0&&(0,l.jsxs)(h.Ay,{size:"small",icon:(0,l.jsx)($.A,{}),onClick:()=>void eA(),className:"rounded-lg",children:[e("exportParsed")," (",eH,")"]}),eH>0&&(0,l.jsxs)(h.Ay,{danger:!0,size:"small",icon:(0,l.jsx)(R.A,{}),onClick:()=>e_("selected"),className:"rounded-lg",children:[e("deleteSelected")," (",eH,")"]}),(0,l.jsx)(h.Ay,{danger:!0,size:"small",disabled:0===b.length,onClick:()=>e_("all"),className:"rounded-lg",children:e("deleteAll")})]})]}),(0,l.jsx)(g.A,{rowKey:"key",columns:eV,dataSource:eC,loading:_&&!er&&!ea,size:"middle",className:"flex-1 custom-table border-0",scroll:{y:"calc(100vh - 460px)"},expandable:{expandedRowKeys:ed,onExpand:eT,expandIcon:e=>{let{expanded:t,onExpand:r,record:a}=e;return a.isFolder?(0,l.jsx)("button",{type:"button",onClick:e=>r(a,e),className:"w-6 h-6 mr-1 inline-flex items-center justify-center align-middle text-[var(--colorTextTertiary)] hover:text-[var(--colorText)] transition-colors bg-transparent border-0 p-0 leading-none",children:t?(0,l.jsx)(J.A,{size:16}):(0,l.jsx)(Q.A,{size:16})}):(0,l.jsx)("span",{className:"w-6 h-6 inline-flex"})}},locale:{emptyText:_?e("common.loading"):P?e("emptySearch"):e("noFiles")},pagination:!1,rowClassName:e=>"hover:bg-[var(--colorBgHover)] transition-colors ".concat(e.isFolder?"font-medium bg-[var(--colorBgSecondary)]/30":""),rowSelection:{selectedRowKeys:ec,onChange:eo,checkStrictly:!1,getCheckboxProps:e=>{var t;return{disabled:!!e.isFolder&&(null!=(t=e.fileCount)?t:0)===0}}}})]})]})}},71242:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"}},76830:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(56398),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))},85855:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(35311),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))},90426:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/files",function(){return r(64207)}])},90939:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"}},93314:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(97109),a=r(53234),n=r(88483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(this,arguments)}let i=l.forwardRef((e,t)=>l.createElement(n.A,s({},e,{ref:t,icon:a.A})))}},e=>{e.O(0,[717,883,69,700,44,224,102,289,636,593,792],()=>e(e.s=90426)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[414],{45551:(e,l,t)=>{"use strict";function n(e){if(0===e)return"0 B";let l=Math.floor(Math.log(e)/Math.log(1024)),t=e/Math.pow(1024,l);return"".concat(t.toFixed(+(0!==l))," ").concat(["B","KB","MB","GB","TB"][l])}function a(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===l?"Never":"从未";let t=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(t/60),a=Math.floor(n/24);return a>30?new Date(e).toLocaleDateString(l):"en-US"===l?a>0?"".concat(a,"d ago"):n>0?"".concat(n,"h ago"):t>0?"".concat(t,"m ago"):"Just now":a>0?"".concat(a," 天前"):n>0?"".concat(n," 小时前"):t>0?"".concat(t," 分钟前"):"刚刚"}t.d(l,{Jm:()=>s,fw:()=>a,z3:()=>n});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},o={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var l;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(l=("en-US"===t?o:r)[e])?l:e}},50423:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>E});var n=t(65321),a=t(97109),r=t(34986),o=t(47085),s=t(17807),c=t(33442),i=t(85114),d=t(2256),u=t(38770),h=t(68787),x=t(54849),g=t(50883),m=t(76506),j=t(11702),A=t(7225),f=t(30486),w=t(99811),k=t(56768),v=t(26619),p=t(93314),y=t(58740),b=t(35459),C=t(23216),S=t(63663),z=t(49484),D=t(6578),N=t(45551);let _=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function E(){var e,l,t,E;let I=(0,o.Vr)(),{locale:T}=(0,o.x_)(),M=(0,r.useRouter)(),{stats:B,loading:F,reload:R}=function(){let[e,l]=(0,a.useState)(null),[t,n]=(0,a.useState)(!1),r=(0,a.useCallback)(async()=>{n(!0);try{l(await (0,D.hc)())}catch(e){}finally{n(!1)}},[]);return(0,a.useEffect)(()=>{r()},[r]),{stats:e,loading:t,reload:r}}(),O=function(){let[e,l]=(0,a.useState)(null);return(0,a.useEffect)(()=>{(0,D.VW)().then(l).catch(()=>{})},[]),e}(),{reindexing:P,reindex:J}=function(){let[e,l]=(0,a.useState)(!1);return{reindexing:e,reindex:(0,a.useCallback)(async()=>{l(!0);try{return await (0,D.H1)(),!0}catch(e){return!1}finally{l(!1)}},[])}}(),[U,W]=(0,a.useState)("document"),[H,V]=(0,a.useState)({count:0,totalSize:0,totalChunks:0}),{message:X}=s.A.useApp(),G=(0,a.useCallback)(async e=>{try{let l=await (0,D.HT)({category:e,limit:1e4}),t=0,n=0;if(Array.isArray(l.files))for(let e of l.files)t+=e.fileSize||0,n+=e.chunkCount||0;V({count:l.total||0,totalSize:t,totalChunks:n})}catch(e){V({count:0,totalSize:0,totalChunks:0})}},[]);(0,a.useEffect)(()=>{G(U)},[U,G]);let K=async()=>{await J()?await Promise.all([R(),G(U)]):X.error(I("common.error"))};return(0,n.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:I("knowledge.manageTitle")}),(0,n.jsx)("p",{className:"pageDesc",children:I("knowledge.manageDesc")})]}),(0,n.jsxs)(c.A,{children:[(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(A.A,{}),onClick:()=>M.push("/knowledge/files"),children:I("knowledge.files")}),(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(f.A,{}),onClick:()=>M.push("/knowledge/search"),children:I("knowledge.search")}),(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(w.A,{}),loading:P,onClick:()=>{K()},children:I("knowledge.reindex")})]})]}),(0,n.jsx)(d.A,{gutter:[16,16],children:[{icon:(0,n.jsx)(k.A,{}),label:I("knowledge.totalFiles"),value:null!=(l=null==B?void 0:B.fileCount)?l:0},{icon:(0,n.jsx)(v.A,{}),label:I("knowledge.totalChunks"),value:null!=(t=null==B?void 0:B.chunkCount)?t:0},{icon:(0,n.jsx)(p.A,{}),label:I("knowledge.totalSize"),value:(0,N.z3)(null!=(E=null==B?void 0:B.totalSizeBytes)?E:0)},{icon:(0,n.jsx)(y.A,{}),label:I("knowledge.lastIndexed"),value:(null==B?void 0:B.lastIndexedAt)?(0,N.fw)(B.lastIndexedAt,T):I("common.never")}].map((e,l)=>(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(h.A,{size:"small",loading:F&&!B,children:(0,n.jsx)(x.A,{title:e.label,value:e.value,prefix:e.icon})})},l))}),(0,n.jsxs)(h.A,{title:I("knowledge.categories"),size:"small",children:[(0,n.jsx)(g.A,{value:U,onChange:e=>W(e),options:_.map(e=>({label:(0,N.Jm)(e,T),value:e})),style:{width:160,marginBottom:16}}),(0,n.jsxs)(d.A,{gutter:[16,16],children:[(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.fileCount"),value:H.count,prefix:(0,n.jsx)(k.A,{style:{color:"var(--colorAccent)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.totalSize"),value:(0,N.z3)(H.totalSize),prefix:(0,n.jsx)(p.A,{style:{color:"var(--colorWarning)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.chunksCount"),value:H.totalChunks,prefix:(0,n.jsx)(b.A,{style:{color:"var(--colorOk)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.averageSize"),value:H.count>0?(0,N.z3)(H.totalSize/H.count):"—",prefix:(0,n.jsx)(v.A,{style:{color:"var(--colorDanger)"}})})})]})]}),O&&(0,n.jsx)(h.A,{title:I("knowledge.features"),size:"small",children:(0,n.jsxs)(m.A,{size:"small",column:{xs:1,sm:2},bordered:!0,children:[(0,n.jsx)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(C.A,{style:{marginRight:4}}),I("knowledge.vectorStore")]}),children:(0,n.jsx)(j.A,{color:"blue",children:O.vectorStore})}),(0,n.jsx)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b.A,{style:{marginRight:4}}),I("knowledge.embedding")]}),children:(0,n.jsx)(j.A,{color:"purple",children:O.embeddingProvider})}),(0,n.jsxs)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(S.A,{style:{marginRight:4}}),I("knowledge.featureDedup")]}),children:[(0,n.jsx)(j.A,{color:"green",children:O.dedupEngine}),(0,n.jsx)("div",{className:"text-xs",style:{color:"var(--colorTextSecondary)",marginTop:2},children:I("knowledge.featureDedupDesc")})]}),(0,n.jsxs)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z.A,{style:{marginRight:4}}),I("knowledge.featureChunker")]}),children:[(0,n.jsx)(j.A,{color:"orange",children:O.chunker}),(0,n.jsx)("div",{className:"text-xs",style:{color:"var(--colorTextSecondary)",marginTop:2},children:I("knowledge.featureChunkerDesc")})]}),(null==(e=O.builtinExtractors)?void 0:e.length)>0&&(0,n.jsx)(m.A.Item,{label:I("knowledge.builtinExtractors"),span:2,children:(0,n.jsx)(c.A,{wrap:!0,children:O.builtinExtractors.map(e=>(0,n.jsx)(j.A,{color:"cyan",children:e},e))})})]})})]})}},54178:(e,l,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/manage",function(){return t(50423)}])}},e=>{e.O(0,[717,883,69,787,506,788,636,593,792],()=>e(e.s=54178)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{27549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(34508)}])},34508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>ee});var o=r(65321),l=r(97109),a=r(47085),n=r(17807),i=r(33442),s=r(11702),c=r(56985),d=r(85114),p=r(26171),m=r(88762),x=r(7576),h=r(50883),u=r(49292),g=r(84253),y=r(34052),f=r(42700),v=r(55122),j=r(54746),w=r(99650),S=r(81668),b=r(58209),A=r(26631),N=r(7225),C=r(96091),T=r(30486),k=r(46082),z=r(42758),P=r(7851),F=r(84742),B=r(33555),E=r(24810),I=r(7492);async function O(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function R(e,t,r){let o=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t,name:r})});if(!o.ok)throw Error("Failed");return o.json()}async function H(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"previewRules",content:e})});return t.ok&&(await t.json()).preview||null}async function D(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function _(e,t){let r=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function J(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"select",selectedIds:e})});if(!t.ok)throw Error("Failed");return t.json()}async function M(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"import",...e&&"object"==typeof e?e:{prompts:[]}})});if(!t.ok)throw Error(await t.text());return t.json()}async function W(){return U("",!1,60)}async function L(e){let t=await fetch("/api/kb/files/detail?relativePath=".concat(encodeURIComponent(e)));if(!t.ok)throw Error("Failed");return((await t.json()).chunks||[]).map(e=>e.content||"").filter(Boolean).join("\n\n").slice(0,12e3)}async function U(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,o=new URLSearchParams({limit:String(r)});e.trim()&&o.set("q",e.trim()),t||o.set("includeContent","0");let l=await fetch("/api/kb/files/search?".concat(o));return l.ok&&(await l.json()).files||[]}async function K(e){let t=await fetch("/api/prompt/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.text();try{let t=JSON.parse(e);throw Error(t.error||t.message||e||"AI 对话失败")}catch(t){throw Error(e||"AI 对话失败")}}return t.json()}function $(e,t){let r=new Blob([JSON.stringify(t,null,2)],{type:"application/json;charset=utf-8"}),o=URL.createObjectURL(r),l=document.createElement("a");l.href=o,l.download=e,l.click(),URL.revokeObjectURL(o)}function G(e){return e.id.startsWith("custom:")}function Y(e){return G(e)?"custom":e.isCurrent?"current":"project"}function X(e,t,r){return e?"customize-agent:prompt-chat:".concat(e.id,":").concat(e.customizePath||e.projectName):"customize-agent:prompt-chat:draft:".concat(r||t||"new")}function q(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:220,r=e.hasFile&&e.content?e.content.replace(/^#.*$/gm,"").replace(/\n{3,}/g,"\n\n").trim():"";return r.length>t?"".concat(r.slice(0,t),"..."):r}function Q(e){let t=Date.parse(e);return Number.isNaN(t)?"-":new Date(t).toLocaleString()}function V(e){return{type:"customize-agent.prompts",version:1,exportedAt:new Date().toISOString(),prompts:e.map(e=>({name:e.projectName,content:e.content||"",selected:e.selected,source:Y(e)}))}}function Z(e){let t=e.match(/(^|\s)@([^\s@]*)$/);return t?t[2]:null}function ee(){let e=(0,a.Vr)(),{message:t}=n.A.useApp(),[r,ee]=(0,l.useState)(!0),[et,er]=(0,l.useState)([]),[eo,el]=(0,l.useState)(!1),[ea,en]=(0,l.useState)(null),[ei,es]=(0,l.useState)(""),[ec,ed]=(0,l.useState)(""),[ep,em]=(0,l.useState)(!1),[ex,eh]=(0,l.useState)(!1),[eu,eg]=(0,l.useState)("custom"),[ey,ef]=(0,l.useState)("all"),[ev,ej]=(0,l.useState)("mtime"),[ew,eS]=(0,l.useState)("list"),[eb,eA]=(0,l.useState)(""),[eN,eC]=(0,l.useState)(null),[eT,ek]=(0,l.useState)([]),[ez,eP]=(0,l.useState)(!1),[eF,eB]=(0,l.useState)([]),[eE,eI]=(0,l.useState)(""),[eO,eR]=(0,l.useState)(""),[eH,eD]=(0,l.useState)(!1),[e_,eJ]=(0,l.useState)([]),[eM,eW]=(0,l.useState)([]),[eL,eU]=(0,l.useState)([]),[eK,e$]=(0,l.useState)(!1),[eG,eY]=(0,l.useState)(!1),[eX,eq]=(0,l.useState)(!1),[eQ,eV]=(0,l.useState)(null),[eZ,e0]=(0,l.useState)(!1),[e1,e2]=(0,l.useState)(void 0),[e4,e3]=(0,l.useState)(!1),e8=async()=>{if(e1){e3(!0);try{let r=await fetch("/api/template-references?action=paradigms&projectType=".concat(encodeURIComponent(e1))),o=await r.json();if(!o.paradigm)return void t.info(e("prompt.paradigmEmpty"));es(e=>e.trim()?"".concat(e.trim(),"\n\n").concat(o.paradigm.text):o.paradigm.text),t.success(e("prompt.paradigmInserted"))}catch(r){t.error(e("prompt.paradigmFailed"))}finally{e3(!1)}}};(0,l.useEffect)(()=>{if(!eo||!ei.trim()){eV(null),e0(!1);return}e0(!0);let e=setTimeout(()=>{H(ei).then(e=>{eV(e),e0(!1)})},500);return()=>clearTimeout(e)},[ei,eo]);let e5=(0,l.useRef)(null),e6=(0,l.useRef)(null),e7=Z(eO),e9=async()=>{ee(!0);try{er(await O())}catch(r){t.error(e("common.error"))}finally{ee(!1)}};(0,l.useEffect)(()=>{e9()},[]),(0,l.useEffect)(()=>{let e=window.localStorage.getItem("customize-agent:prompt-view-mode");("list"===e||"card"===e)&&eS(e)},[]),(0,l.useEffect)(()=>{window.localStorage.setItem("customize-agent:prompt-view-mode",ew)},[ew]),(0,l.useEffect)(()=>{let e=e6.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),eE&&window.localStorage.setItem(eE,JSON.stringify(eF.slice(-30)))},[eF,eH,eE]),(0,l.useEffect)(()=>{!eo||e_.length>0||eK||(e$(!0),W().then(eJ).catch(()=>void 0).finally(()=>e$(!1)))},[eo,e_.length,eK]),(0,l.useEffect)(()=>{let e=null==e7?void 0:e7.trim();if(!eo||!e){eW([]),eY(!1);return}let t=!1;eY(!0);let r=window.setTimeout(()=>{U(e).then(e=>{t||eW(e)}).catch(()=>{t||eW([])}).finally(()=>{t||eY(!1)})},250);return()=>{t=!0,window.clearTimeout(r)}},[eo,e7]);let te=et.find(e=>e.isCurrent),tt=et.filter(G),tr={all:et.length,custom:et.filter(e=>"custom"===Y(e)).length,current:et.filter(e=>"current"===Y(e)).length,project:et.filter(e=>"project"===Y(e)).length,selected:et.filter(e=>e.selected).length,unselected:et.filter(e=>!e.selected).length,hasFile:et.filter(e=>e.hasFile).length,missingFile:et.filter(e=>!e.hasFile).length},to=et.filter(e=>{var t;let r=Y(e);return("all"===eu||r===eu)&&("selected"!==ey||!!e.selected)&&("unselected"!==ey||!e.selected)&&("hasFile"!==ey||!!e.hasFile)&&("missingFile"!==ey||!e.hasFile)&&(!eb.trim()||(t=eb.trim(),!!"".concat(e.projectName,"\n").concat(e.projectRoot||"","\n").concat(e.customizePath||"","\n").concat(e.content||"").toLowerCase().includes(t.toLowerCase())))}).sort((e,t)=>"name"===ev?e.projectName.localeCompare(t.projectName):"source"===ev?["custom","current","project"].indexOf(Y(e))-["custom","current","project"].indexOf(Y(t)):"selected"===ev&&Number(t.selected)-Number(e.selected)||Date.parse(t.mtime||"")-Date.parse(e.mtime||"")),tl=to.find(e=>e.id===eN)||to[0]||null,ta=eT.filter(e=>to.some(t=>t.id===e)),tn=(null==e7?void 0:e7.trim())?eM:e_,ti=(e,t,r)=>{let o=X(e,t,r);eI(o),eB(function(e){try{let t=JSON.parse(window.localStorage.getItem(e)||"[]");return Array.isArray(t)?t.filter(e=>("user"===e.role||"assistant"===e.role)&&"string"==typeof e.content).slice(-30):[]}catch(e){return[]}}(o)),eR(""),eD(!1),eU([]),eq(!1)},ts=r=>{if(null==r?void 0:r.projectRoot)return void D(r.projectRoot).then(()=>{t.success(e("common.success")),e9()}).catch(()=>t.error(e("common.error")));let o="new:".concat(Date.now());en(null),eh(!0),ed(""),es(""),ti(null,"new",o),el(!0)},tc=async()=>{if(!ec.trim())return void t.error("请输入名称");em(!0);try{if(ea)await R(ea.customizePath,ei,G(ea)?ec.trim():void 0),t.success(e("common.success"));else{let r=await _(ec.trim(),ei||"# ".concat(ec.trim(),"\n"));!function(e,t){if(!e||!t||e===t)return;let r=window.localStorage.getItem(e);r&&!window.localStorage.getItem(t)&&window.localStorage.setItem(t,r)}(eE,X({id:r.id,projectId:r.id,projectName:ec.trim(),customizePath:r.id,content:ei,mtime:"",hasFile:!0,isCurrent:!1,selected:!1,source:"custom"},ec.trim())),t.success(e("common.success"))}el(!1),await e9()}catch(r){t.error(e("common.error"))}finally{em(!1)}},td=async e=>{let t=Array.from(new Set([...eL,...e_.filter(t=>e.includes("@".concat(t.relativePath))).map(e=>e.relativePath)])).slice(0,3),r=[];for(let e of t){let t=await L(e);t&&r.push({relativePath:e,content:t})}return r},tp=async()=>{let e=eO.trim();if(!e||eH)return;let r=[...eF,{role:"user",content:e}];eB(r),eR(""),eq(!1),eD(!0);try{let t=await td(e),o=await K({name:ec||(null==ea?void 0:ea.projectName)||"未命名提示词",content:ei,message:e,history:eF,references:t});eB([...r,{role:"assistant",content:o.content||"AI 未返回内容"}])}catch(e){t.error(e instanceof Error?e.message:"AI 对话失败,请检查模型配置"),eB(r)}finally{eD(!1)}},tm=async(r,o)=>{let l=o?Array.from(new Set([...et.filter(e=>e.selected).map(e=>e.id),r.id])):et.filter(e=>e.selected&&e.id!==r.id).map(e=>e.id);try{await J(l),er(e=>e.map(e=>({...e,selected:l.includes(e.id)})))}catch(r){t.error(e("common.error"))}},tx=async r=>{let o=et.filter(e=>e.selected).map(e=>e.id),l=r?Array.from(new Set([...o,...ta])):o.filter(e=>!ta.includes(e));try{await J(l),er(e=>e.map(e=>({...e,selected:l.includes(e.id)}))),ek([]),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},th=async r=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:r.projectId,filePath:r.customizePath})})).ok)throw Error("Failed");t.success(e("common.success")),ek(e=>e.filter(e=>e!==r.id)),await e9()}catch(r){t.error(e("common.error"))}},tu=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"custom",r="checked"===e?et.filter(e=>ta.includes(e.id)):"filtered"===e?to:tt;$("customize-prompts-".concat(new Date().toISOString().slice(0,10),".json"),V(r)),t.success("已导出 ".concat(r.length," 条提示词"))},tg=async e=>{if(e){eP(!0);try{let r=await e.text(),o=JSON.parse(r),l=await M(o);t.success("已导入 ".concat(l.imported," 条提示词")),await e9()}catch(e){t.error("导入失败,请确认 JSON 文件格式正确")}finally{eP(!1),e5.current&&(e5.current.value="")}}},ty=t=>{let r=Y(t);return(0,o.jsxs)(i.A,{size:4,wrap:!0,children:[(0,o.jsx)(s.A,{color:"custom"===r?"cyan":"current"===r?"green":"project"===r?"blue":"default",style:{margin:0},children:e("custom"===r?"prompt.customPrompt":"current"===r?"prompt.currentProject":"project"===r?"prompt.otherProjects":"prompt.allPrompts")}),t.selected&&(0,o.jsx)(s.A,{color:"purple",style:{margin:0},children:e("prompt.selected")}),!t.hasFile&&(0,o.jsx)(s.A,{style:{margin:0},children:e("prompt.missingFileStatus")})]})},tf=r=>(0,o.jsxs)("div",{className:"flex items-center gap-1.5",children:[r.hasFile&&(0,o.jsx)(c.A,{checked:r.selected,onChange:e=>{tm(r,e.target.checked)},className:"mr-1",children:e("prompt.selected")}),!r.hasFile&&r.projectRoot&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(j.A,{}),onClick:()=>ts(r),children:e("common.add")}),r.hasFile&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(w.A,{}),onClick:()=>{en(r),eh(!1),ed(r.projectName),es(r.content||""),ti(r,r.projectName),el(!0)},children:e("common.edit")}),r.hasFile&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(S.A,{}),onClick:()=>{var e;return e=r,void($("customize-prompt-".concat(e.projectName.trim().replace(/[\\/:*?"<>|]/g,"-").slice(0,80)||"untitled","-").concat(new Date().toISOString().slice(0,10),".json"),V([e])),t.success("已导出 1 条提示词"))},children:"导出"}),(0,o.jsx)(p.A,{title:G(r)?"删除自定义提示词?":"删除项目记录及文件?",onConfirm:()=>{th(r)},children:(0,o.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,o.jsx)(b.A,{})})})]});return r?(0,o.jsxs)("div",{className:"space-y-12",children:[(0,o.jsx)(m.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,o.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:Array.from({length:4}).map((e,t)=>(0,o.jsx)("div",{className:"p-4 border border-[var(--borderColor)]",children:(0,o.jsx)(m.A,{active:!0,paragraph:{rows:4}})},t))})]}):(0,o.jsxs)("div",{className:"space-y-8 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4 pb-6 mb-2",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("h1",{className:"text-3xl font-extrabold tracking-tight text-[var(--colorText)] mb-2.5 flex items-center gap-2",children:[(0,o.jsx)(A.A,{className:"text-[var(--colorAccent)]"}),e("nav.promptManagement")]}),(0,o.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)]",children:e("prompt.description")})]}),(0,o.jsxs)(i.A,{wrap:!0,children:[te&&(0,o.jsxs)(s.A,{color:"green",style:{lineHeight:"22px"},className:"border-0",children:[(0,o.jsx)(N.A,{})," ",te.projectRoot]}),(0,o.jsx)("input",{ref:e5,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:e=>{var t;tg(null==(t=e.target.files)?void 0:t[0])}}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(C.A,{}),loading:ez,onClick:()=>{var e;return null==(e=e5.current)?void 0:e.click()},className:"rounded-lg",children:e("prompt.import")}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(S.A,{}),disabled:0===to.length,onClick:()=>tu("filtered"),className:"rounded-lg",children:e("prompt.exportFiltered")}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(j.A,{}),onClick:()=>ts(),className:"shadow-none rounded-lg",children:e("prompt.createPrompt")})]})]}),(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-3 bg-[var(--colorBgContainer)] p-3 rounded-xl shadow-sm mb-6",children:[(0,o.jsx)(x.A,{prefix:(0,o.jsx)(T.A,{className:"text-[var(--colorTextTertiary)]"}),allowClear:!0,placeholder:e("prompt.searchPrompt"),value:eb,onChange:e=>eA(e.target.value),style:{width:280},variant:"borderless",className:"bg-[var(--colorBgHover)] rounded-lg hover:bg-[var(--colorFillAlter)] focus:bg-[var(--colorBgElevated)] transition-colors"}),(0,o.jsx)("div",{className:"h-4 w-[1px] bg-[var(--borderColorStrong)] mx-1"}),(0,o.jsx)(h.A,{value:eu,onChange:eg,style:{width:150},variant:"borderless",options:[{label:"".concat(e("prompt.allPrompts")," (").concat(tr.all,")"),value:"all"},{label:"".concat(e("prompt.customPrompt")," (").concat(tr.custom,")"),value:"custom"},{label:"".concat(e("prompt.currentProject")," (").concat(tr.current,")"),value:"current"},{label:"".concat(e("prompt.otherProjects")," (").concat(tr.project,")"),value:"project"}]}),(0,o.jsx)(h.A,{value:ey,onChange:ef,style:{width:130},variant:"borderless",options:[{label:e("prompt.promptStatus"),value:"all"},{label:"".concat(e("prompt.selected")," (").concat(tr.selected,")"),value:"selected"},{label:"".concat(e("prompt.unselected")," (").concat(tr.unselected,")"),value:"unselected"},{label:"".concat(e("prompt.hasFileStatus")," (").concat(tr.hasFile,")"),value:"hasFile"},{label:"".concat(e("prompt.missingFileStatus")," (").concat(tr.missingFile,")"),value:"missingFile"}]}),(0,o.jsx)(h.A,{value:ev,onChange:ej,style:{width:140},variant:"borderless",options:[{label:e("prompt.sortByMtime"),value:"mtime"},{label:e("prompt.sortByName"),value:"name"},{label:e("prompt.sortBySource"),value:"source"},{label:e("prompt.sortBySelected"),value:"selected"}]}),(0,o.jsx)("div",{className:"flex-1"}),(0,o.jsx)(u.A,{value:ew,onChange:e=>eS(e),options:[{label:(0,o.jsx)(k.A,{}),value:"list"},{label:(0,o.jsx)(z.A,{}),value:"card"}],className:"bg-[var(--colorBgHover)] p-1 rounded-lg"})]}),(0,o.jsx)("div",{className:"grid grid-cols-1 gap-8 items-start",children:(0,o.jsxs)("div",{className:"min-w-0",children:[ta.length>0&&(0,o.jsxs)("div",{className:"flex items-center gap-3 flex-wrap p-4 mb-6 bg-[var(--colorBgHover)] rounded-xl shadow-sm",children:[(0,o.jsxs)("span",{className:"font-semibold text-sm",children:["已选择 ",(0,o.jsx)("span",{className:"text-[var(--colorAccent)]",children:ta.length})," 项"]}),(0,o.jsx)("div",{className:"h-4 w-[1px] bg-[var(--borderColorStrong)] mx-1"}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>{tx(!0)},children:e("prompt.batchSelect")}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>{tx(!1)},children:e("prompt.cancelSelect")}),(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(S.A,{}),onClick:()=>tu("checked"),children:e("prompt.exportSelected")}),(0,o.jsx)(d.Ay,{size:"small",danger:!0,onClick:()=>ek([]),children:e("prompt.clearSelect")})]}),0===to.length?(0,o.jsx)("div",{className:"py-32 text-center border border-dashed border-[var(--borderColor)] rounded-2xl bg-[var(--colorBgHover)]",children:(0,o.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:(0,o.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:eb||"all"!==ey?e("prompt.noMatchDesc"):e("prompt.noPromptInGroup")})})}):"list"===ew?(0,o.jsx)("div",{className:"flex flex-col gap-3",children:to.map(e=>{let t=q(e,180),r=(null==tl?void 0:tl.id)===e.id;return(0,o.jsxs)("div",{onClick:()=>eC(e.id),className:"group grid grid-cols-[28px_1fr_auto] gap-4 items-center p-4 rounded-xl transition-all cursor-pointer ".concat(r?"bg-[var(--colorBgSelected)] shadow-md":"bg-transparent hover:bg-[var(--colorBgHover)] hover:shadow-sm"),children:[(0,o.jsx)(c.A,{checked:eT.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>ek(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,o.jsxs)("div",{className:"min-w-0",children:[(0,o.jsxs)("div",{className:"flex items-center gap-3 mb-1.5",children:[(0,o.jsx)(A.A,{className:e.isCurrent?"text-[var(--colorOk)] text-lg":"text-[var(--colorTextSecondary)] text-lg"}),(0,o.jsx)("span",{className:"font-semibold truncate text-[var(--colorText)] text-base",children:e.projectName}),ty(e)]}),(0,o.jsxs)("div",{className:"text-xs text-[var(--colorTextTertiary)] truncate flex items-center gap-1.5 font-medium",children:[(0,o.jsx)(N.A,{})," ",e.projectRoot||e.customizePath||"本地提示词",(0,o.jsx)("span",{className:"text-[var(--colorBorderSecondary)]",children:"|"}),Q(e.mtime)]}),t&&(0,o.jsx)("div",{className:"mt-2.5 bg-[var(--colorFillAlter)] p-2.5 rounded-lg overflow-hidden",children:(0,o.jsx)("div",{className:"text-sm text-[var(--colorTextSecondary)] line-clamp-2 leading-normal",children:t})})]}),(0,o.jsx)("div",{onClick:e=>e.stopPropagation(),className:"transition-opacity flex items-center ".concat(r?"opacity-100":"opacity-0 group-hover:opacity-100"),children:tf(e)})]},e.id)})}):(0,o.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:to.map(e=>{let t=q(e,180),r=(null==tl?void 0:tl.id)===e.id;return(0,o.jsxs)("div",{onClick:()=>eC(e.id),className:"group flex flex-col p-5 rounded-2xl transition-all cursor-pointer ".concat(r?"bg-[var(--colorBgSelected)] shadow-md":"bg-[var(--colorBgContainer)] hover:bg-[var(--colorBgHover)] shadow-sm hover:shadow-md"),children:[(0,o.jsx)("div",{className:"flex items-start justify-between gap-3 mb-4 min-w-0",children:(0,o.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[(0,o.jsx)(c.A,{checked:eT.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>ek(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,o.jsx)(A.A,{className:e.isCurrent?"text-[var(--colorOk)] text-lg":"text-[var(--colorTextSecondary)] text-lg"}),(0,o.jsx)("span",{className:"font-bold text-base text-[var(--colorText)] truncate mb-1",children:e.projectName})]})}),(0,o.jsx)("div",{className:"mb-3",children:ty(e)}),(0,o.jsxs)("div",{className:"text-xs text-[var(--colorTextTertiary)] truncate flex items-center gap-1.5 mb-4 bg-[var(--colorFillAlter)] p-1.5 rounded inline-flex self-start",children:[(0,o.jsx)(N.A,{}),e.projectRoot||e.customizePath||"本地提示词"]}),(0,o.jsx)("div",{className:"flex-1 bg-[var(--colorFillAlter)] p-3 rounded-xl mb-4 overflow-hidden",children:t?(0,o.jsx)("div",{className:"text-sm text-[var(--colorTextSecondary)] line-clamp-3 leading-normal",children:t}):(0,o.jsx)("div",{className:"text-sm text-[var(--colorTextQuaternary)] italic",children:"暂无内容预览"})}),(0,o.jsxs)("div",{className:"mt-auto pt-4 flex justify-between items-center",onClick:e=>e.stopPropagation(),children:[(0,o.jsx)("span",{className:"text-xs font-medium text-[var(--colorTextTertiary)] bg-[var(--colorFillSecondary)] px-2 py-1 rounded",children:Q(e.mtime)}),(0,o.jsx)("div",{className:"transition-opacity ".concat(r?"opacity-100":"opacity-0 group-hover:opacity-100"),children:tf(e)})]})]},e.id)})})]})}),(0,o.jsxs)(y.A,{title:ex?e("prompt.createPrompt"):ea&&G(ea)?"".concat(e("prompt.customPrompt")," — ").concat(ec||ea.projectName):"".concat(e("prompt.currentProject")," — ").concat((null==ea?void 0:ea.projectName)||""),open:eo,onClose:()=>el(!1),styles:{wrapper:{width:1080},mask:{pointerEvents:"none"},body:{padding:"24px 32px",display:"grid",gridTemplateRows:"minmax(320px, 1fr) 420px",gap:24,height:"100%"},header:{borderBottom:"1px solid var(--colorBorderSecondary)",padding:"16px 32px"}},extra:(0,o.jsxs)(i.A,{children:[(0,o.jsx)(d.Ay,{onClick:()=>el(!1),children:e("common.cancel")}),(0,o.jsx)(d.Ay,{type:"primary",loading:ep,onClick:()=>{tc()},children:e("common.save")})]}),children:[(0,o.jsxs)("div",{style:{minHeight:0,display:"flex",flexDirection:"column"},children:[(0,o.jsx)("div",{style:{marginBottom:16},children:ex||ea&&G(ea)?(0,o.jsx)(x.A,{size:"large",placeholder:e("prompt.promptName"),value:ec,onChange:e=>ed(e.target.value),style:{maxWidth:"100%",fontWeight:500,fontSize:16}}):null}),(0,o.jsx)(x.A.TextArea,{value:ei,onChange:e=>es(e.target.value),style:{flex:1,minHeight:140,fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13,resize:"none"}}),(0,o.jsxs)("div",{style:{marginTop:12,border:"1px solid var(--colorBorderSecondary)",borderRadius:10,background:"var(--colorBgContainer)",padding:"10px 12px",maxHeight:170,overflowY:"auto"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[(0,o.jsxs)(i.A,{size:6,children:[(0,o.jsx)(P.A,{style:{color:"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:600,fontSize:12},children:e("prompt.rulePreviewTitle")})]}),eZ&&(0,o.jsx)(f.A,{size:"small"})]}),eQ?eQ.recognized?(0,o.jsx)(i.A,{direction:"vertical",size:4,style:{width:"100%"},children:eQ.summary.map((e,t)=>(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorText)",display:"flex",gap:6,lineHeight:1.6},children:[(0,o.jsx)(F.A,{style:{color:"var(--colorSuccess)",marginTop:4}}),(0,o.jsx)("span",{children:e})]},t))}):(0,o.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:e("prompt.rulePreviewNone")}):(0,o.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:ei.trim()?e("prompt.rulePreviewAnalyzing"):e("prompt.rulePreviewHint")}),(0,o.jsx)(v.A,{style:{margin:"8px 0"}}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,o.jsx)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)",whiteSpace:"nowrap"},children:e("prompt.paradigmTitle")}),(0,o.jsx)(h.A,{size:"small",allowClear:!0,placeholder:e("prompt.paradigmTypePlaceholder"),style:{minWidth:110},value:e1,onChange:e2,options:["房建","市政","公路","桥梁与隧道","水利水电","电力","机电安装","装饰装修","园林绿化","铁路","港口与航道","矿山冶金","其他"].map(e=>({value:e,label:e}))}),(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(B.A,{}),loading:e4,disabled:!e1,onClick:()=>{e8()},children:e("prompt.paradigmInsert")})]})]})]}),(0,o.jsxs)("div",{style:{minHeight:0,border:"1px solid var(--colorBorderSecondary)",borderRadius:10,background:"var(--colorBgContainer)",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 8px 24px rgba(15, 23, 42, 0.06)"},children:[(0,o.jsxs)("div",{style:{padding:"10px 12px",borderBottom:"1px solid var(--colorBorderSecondary)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,o.jsxs)(i.A,{size:6,children:[(0,o.jsx)(E.A,{style:{color:"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:600},children:e("prompt.aiPromptAssistant")})]}),(0,o.jsxs)(i.A,{size:6,children:[eF.length>0&&(0,o.jsx)(d.Ay,{size:"small",onClick:()=>eB([]),children:e("prompt.clearHistory")}),eH?(0,o.jsx)(s.A,{color:"processing",style:{margin:0},children:e("prompt.generating")}):(0,o.jsx)(s.A,{color:"blue",style:{margin:0},children:e("prompt.canConverse")})]})]}),(0,o.jsx)("div",{ref:e6,style:{flex:1,minHeight:0,overflowY:"auto",padding:14,background:"var(--colorFillAlter)"},children:0!==eF.length||eH?(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12,width:"100%"},children:[eF.map((r,l)=>{let a="user"===r.role;return(0,o.jsx)("div",{style:{display:"flex",justifyContent:a?"flex-end":"flex-start"},children:(0,o.jsxs)("div",{style:{maxWidth:"78%",padding:"10px 12px",borderRadius:12,background:a?"var(--colorFillSecondary)":"var(--colorBgContainer)",color:"var(--colorText)",border:"1px solid var(--colorBorderSecondary)",whiteSpace:"pre-wrap",lineHeight:1.7,fontSize:13,transition:"all .2s ease"},children:[r.content,!a&&(0,o.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:8},children:(0,o.jsx)(d.Ay,{size:"small",type:"primary",onClick:()=>{es(r.content),t.success("已应用到编辑内容,请确认后保存")},children:e("prompt.apply")})})]})},"".concat(r.role,"-").concat(l))}),eH&&(0,o.jsx)("div",{style:{display:"flex",justifyContent:"flex-start"},children:(0,o.jsxs)("div",{style:{padding:"10px 12px",borderRadius:12,background:"var(--colorBgContainer)",border:"1px solid var(--colorBorderSecondary)",color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(f.A,{size:"small",style:{marginRight:8}}),e("prompt.aiAnalyzing")]})})]}):(0,o.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:e("prompt.mentionRecallHint")})}),(0,o.jsx)(v.A,{style:{margin:0}}),(0,o.jsxs)("div",{style:{padding:12},children:[eL.length>0&&(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:eL.map(e=>(0,o.jsxs)(s.A,{closable:!0,onClose:()=>eU(t=>t.filter(t=>t!==e)),style:{margin:0,maxWidth:360,overflow:"hidden",textOverflow:"ellipsis"},children:["@",e]},e))}),eX&&(0,o.jsxs)("div",{style:{maxHeight:260,overflowY:"auto",marginBottom:8,border:"1px solid var(--colorBorderSecondary)",borderRadius:12,background:"var(--colorBgElevated, var(--colorBgContainer))",boxShadow:"0 16px 40px rgba(15, 23, 42, 0.14)"},children:[(0,o.jsxs)("div",{style:{position:"sticky",top:0,zIndex:1,padding:"10px 12px",borderBottom:"1px solid var(--colorBorderSecondary)",background:"var(--colorBgElevated, var(--colorBgContainer))",display:"flex",justifyContent:"space-between",gap:12,alignItems:"center"},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{style:{color:"var(--colorText)",fontSize:13,fontWeight:700},children:e("prompt.recallKbFiles")}),(0,o.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11},children:e("prompt.recallLimitHint")})]}),(0,o.jsx)(s.A,{color:e7?"blue":"default",style:{margin:0,maxWidth:240,overflow:"hidden",textOverflow:"ellipsis"},children:e7?"@".concat(e7):e("prompt.inputAtKeyword")})]}),eK?(0,o.jsxs)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:[(0,o.jsx)(f.A,{size:"small",style:{marginRight:8}}),e("prompt.loadingKbFiles")]}):0===e_.length?(0,o.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:e("prompt.noRecallableKbFiles")}):0===tn.length?(0,o.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:eG?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(f.A,{size:"small",style:{marginRight:8}}),e("prompt.searchingKbContent")]}):e("prompt.noMatchingKbFiles")}):(0,o.jsxs)(o.Fragment,{children:[eG&&(0,o.jsxs)("div",{style:{padding:"8px 12px",color:"var(--colorTextSecondary)",fontSize:12,borderBottom:"1px solid var(--colorBorderSecondary)"},children:[(0,o.jsx)(f.A,{size:"small",style:{marginRight:8}}),e("prompt.continueSearchingKb")]}),tn.slice(0,30).map(t=>(0,o.jsxs)("div",{onMouseDown:e=>{var r;e.preventDefault(),r=t.relativePath,eU(e=>e.includes(r)?e:[...e,r]),eR(e=>e.replace(/(^|\s)@([^\s@]*)$/,"$1@".concat(r," "))),eq(!1)},style:{padding:"10px 12px",cursor:"pointer",borderBottom:"1px solid var(--colorBorderSecondary)",fontSize:12,display:"grid",gridTemplateColumns:"22px minmax(0, 1fr) auto",gap:10,alignItems:"center"},children:[(0,o.jsx)("div",{style:{width:22,height:22,borderRadius:7,background:"var(--colorFillSecondary)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(A.A,{style:{color:"var(--colorAccent)"}})}),(0,o.jsxs)("div",{style:{minWidth:0},children:[(0,o.jsx)("div",{style:{color:"var(--colorText)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:700},children:t.relativePath}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[t.category||e("prompt.unclassified")," \xb7 ",t.format||e("prompt.unknownFormat"),"number"==typeof t.score?" \xb7 score ".concat(t.score.toFixed(2)):""]})]}),(0,o.jsxs)(i.A,{size:4,children:[(0,o.jsx)(s.A,{color:"content"===t.matchedBy?"purple":"disk"===t.matchedBy?"orange":"blue",style:{margin:0},children:"content"===t.matchedBy?e("prompt.contentMatch"):"disk"===t.matchedBy?e("prompt.diskFile"):e("prompt.fileMatch")}),(0,o.jsx)(s.A,{style:{margin:0},children:t.status})]})]},t.relativePath))]})]}),(0,o.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-end"},children:[(0,o.jsx)(x.A.TextArea,{value:eO,onChange:e=>{let t=e.target.value;eR(t),eq(null!==Z(t))},onFocus:()=>eq(null!==Z(eO)),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),tp())},disabled:eH,placeholder:e("prompt.mentionRecallPlaceholder"),autoSize:{minRows:2,maxRows:5},style:{fontSize:13,lineHeight:1.6}}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(I.A,{}),loading:eH,disabled:!eO.trim(),onClick:()=>{tp()},children:e("prompt.send")})]})]})]})]})]})}}},e=>{e.O(0,[717,883,700,44,195,260,636,593,792],()=>e(e.s=27549)),_N_E=e.O()}]);
|
|
File without changes
|