@customize-agent/server 3.0.10 → 3.0.12

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.
Files changed (95) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +56 -37
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/routes-manifest.json +6 -0
  5. package/.next/server/chunks/3445.js +39 -6
  6. package/.next/server/chunks/5076.js +1 -1
  7. package/.next/server/chunks/8204.js +1 -1
  8. package/.next/server/middleware-build-manifest.js +1 -1
  9. package/.next/server/pages/404.html +1 -1
  10. package/.next/server/pages/500.html +1 -1
  11. package/.next/server/pages/api/documents/chapter/regenerate.js +1 -1
  12. package/.next/server/pages/api/documents/chapter/regenerate.js.nft.json +1 -1
  13. package/.next/server/pages/api/documents/export.js +1 -1
  14. package/.next/server/pages/api/documents/export.js.nft.json +1 -1
  15. package/.next/server/pages/api/documents/generate.js +1 -1
  16. package/.next/server/pages/api/documents/generate.js.nft.json +1 -1
  17. package/.next/server/pages/api/documents/roles.js +1 -1
  18. package/.next/server/pages/api/documents/specs.js +1 -0
  19. package/.next/server/pages/api/documents/specs.js.nft.json +1 -0
  20. package/.next/server/pages/api/documents/templates.js +1 -1
  21. package/.next/server/pages/api/documents/templates.js.nft.json +1 -1
  22. package/.next/server/pages/api/kb/categories.js +34 -1
  23. package/.next/server/pages/api/kb/duplicates.js +34 -1
  24. package/.next/server/pages/api/kb/files/detail.js +34 -1
  25. package/.next/server/pages/api/kb/files/open.js +34 -1
  26. package/.next/server/pages/api/kb/files/preview-pdf-page.js +34 -1
  27. package/.next/server/pages/api/kb/files/reindex.js +34 -1
  28. package/.next/server/pages/api/kb/files.js +34 -1
  29. package/.next/server/pages/api/kb/ignore.js +34 -1
  30. package/.next/server/pages/api/kb/operations.js +34 -1
  31. package/.next/server/pages/api/kb/reindex.js +34 -1
  32. package/.next/server/pages/api/kb/search.js +34 -1
  33. package/.next/server/pages/api/kb/stats.js +34 -1
  34. package/.next/server/pages/api/kb/tags.js +34 -1
  35. package/.next/server/pages/api/kb/upload.js +34 -1
  36. package/.next/server/pages/context/long-term.html +1 -1
  37. package/.next/server/pages/context/short-term.html +1 -1
  38. package/.next/server/pages/document-roles.html +1 -1
  39. package/.next/server/pages/document-specs.html +1 -0
  40. package/.next/server/pages/document-specs.js.nft.json +1 -0
  41. package/.next/server/pages/documents.html +1 -1
  42. package/.next/server/pages/guide.html +1 -1
  43. package/.next/server/pages/index.html +1 -1
  44. package/.next/server/pages/knowledge/file-detail.html +1 -1
  45. package/.next/server/pages/knowledge/files.html +1 -1
  46. package/.next/server/pages/knowledge/manage.html +1 -1
  47. package/.next/server/pages/knowledge/search.html +1 -1
  48. package/.next/server/pages/knowledge.html +1 -1
  49. package/.next/server/pages/models.html +1 -1
  50. package/.next/server/pages/overview.html +1 -1
  51. package/.next/server/pages/prompt.html +1 -1
  52. package/.next/server/pages/settings.html +1 -1
  53. package/.next/server/pages-manifest.json +25 -23
  54. package/.next/static/ZG2x_4BgDtQoIcW28iwgH/_buildManifest.js +1 -0
  55. package/.next/static/chunks/400-f06f00619f22421e.js +78 -0
  56. package/.next/static/chunks/730-727fe4b055c78dc2.js +1 -0
  57. package/.next/static/chunks/740-2bcba39d841f2b16.js +16 -0
  58. package/.next/static/chunks/746-120983153bceeea6.js +1 -0
  59. package/.next/static/chunks/804-b11aef99b57308a3.js +11 -0
  60. package/.next/static/chunks/{845-b394c886baabe12f.js → 804-e654a1589d9adc65.js} +3 -3
  61. package/.next/static/chunks/846-fed995f7c83fc6c3.js +1 -0
  62. package/.next/static/chunks/958-66e2dcf301fb3c3f.js +1 -0
  63. package/.next/static/chunks/pages/{_app-15fb8428c7126df0.js → _app-725afbb7d3371a13.js} +9 -9
  64. package/.next/static/chunks/pages/_error-49c333927e615faa.js +1 -0
  65. package/.next/static/chunks/pages/context/long-term-dba1d735f2b5e12b.js +1 -0
  66. package/.next/static/chunks/pages/context/short-term-7cc72881b42b74fb.js +1 -0
  67. package/.next/static/chunks/pages/document-roles-653f01136b58197b.js +1 -0
  68. package/.next/static/chunks/pages/document-specs-120681be3e183b9e.js +1 -0
  69. package/.next/static/chunks/pages/documents-93e638518deec9b5.js +1 -0
  70. package/.next/static/chunks/pages/documents-a72286e23487eaf7.js +1 -0
  71. package/.next/static/chunks/pages/{guide-0aa6938c95fd8152.js → guide-b495954d18d56b33.js} +1 -1
  72. package/.next/static/chunks/pages/guide-f6ad48fc4e564c1c.js +1 -0
  73. package/.next/static/chunks/pages/knowledge/{file-detail-21dbc84d04f969ca.js → file-detail-793d12234ccddac1.js} +1 -1
  74. package/.next/static/chunks/pages/knowledge/{files-369d7ccf6a6e4e43.js → files-a3a4bbc49c980b46.js} +1 -1
  75. package/.next/static/chunks/pages/knowledge/manage-5d501503e54b4424.js +1 -0
  76. package/.next/static/chunks/pages/knowledge/manage-64ad6cdce068edb1.js +1 -0
  77. package/.next/static/chunks/pages/knowledge/{search-5a199ff773f7938b.js → search-fe148477dfe05966.js} +1 -1
  78. package/.next/static/chunks/pages/models-0fb086e70387dde1.js +1 -0
  79. package/.next/static/chunks/pages/overview-9fbf5907184af472.js +1 -0
  80. package/.next/static/chunks/pages/overview-db5df4f0bec2a77c.js +1 -0
  81. package/.next/static/chunks/pages/{prompt-654d82321a383233.js → prompt-d9996cf322de0125.js} +1 -1
  82. package/.next/static/he1VpXuNk12nGqt9mP7Jd/_buildManifest.js +1 -0
  83. package/.next/static/he1VpXuNk12nGqt9mP7Jd/_ssgManifest.js +1 -0
  84. package/package.json +4 -4
  85. package/.next/static/PkdECgLy3eGpkRC2sc90n/_buildManifest.js +0 -1
  86. package/.next/static/chunks/228-7112f995b33b1fd3.js +0 -1
  87. package/.next/static/chunks/951-320008e618be7e4f.js +0 -1
  88. package/.next/static/chunks/pages/context/long-term-9685fc1fd8397807.js +0 -1
  89. package/.next/static/chunks/pages/context/short-term-86f5d204405bb05c.js +0 -1
  90. package/.next/static/chunks/pages/document-roles-1449654aa961426e.js +0 -1
  91. package/.next/static/chunks/pages/documents-dc6582d6886d4fb6.js +0 -1
  92. package/.next/static/chunks/pages/knowledge/manage-447ce42652c203f4.js +0 -1
  93. package/.next/static/chunks/pages/models-fc67c4147d2aa3cb.js +0 -1
  94. package/.next/static/chunks/pages/overview-558db8205a06d058.js +0 -1
  95. /package/.next/static/{PkdECgLy3eGpkRC2sc90n → ZG2x_4BgDtQoIcW28iwgH}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[731],{9884:(_,n,e)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_error",function(){return e(5599)}])}},_=>{_.O(0,[636,593,792],()=>_(_.s=9884)),_N_E=_.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[893],{260:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>N});var o=n(5321),a=n(7109),i=n(3014),c=n(7807),r=n(1702),s=n(5114),l=n(6171),d=n(3442),u=n(4668),p=n(8787),m=n(4849),y=n(9400),h=n(5258),f=n(3455),g=n(9650),x=n(8209),S=n(486),j=n(3374),w=n(8383),T=n(6619),b=n(3998),C=n(6578),v=n(5551);let E={project_fact:"项目知识",user_preference:"用户偏好",feedback:"历史纠偏",pattern:"解决方案"},O={high:"red",medium:"orange",low:"default"};function N(){let e=(0,i.Vr)(),{message:t}=c.A.useApp(),[n,N]=(0,a.useState)(!0),[P,A]=(0,a.useState)([]),[k,R]=(0,a.useState)({count:0,totalBytes:0}),[J,U]=(0,a.useState)(""),[D,I]=(0,a.useState)(!1),[_,L]=(0,a.useState)(null),[z,B]=(0,a.useState)(""),[M,H]=(0,a.useState)(""),[W,F]=(0,a.useState)(!1),V=async n=>{N(!0);try{let[e,t]=await Promise.all([(0,C.hn)("long_term",n),(0,C.p)("long_term")]);A(e),R(t)}catch(n){t.error(e("common.error"))}finally{N(!1)}};(0,a.useEffect)(()=>{V()},[]);let X=async n=>{try{await (0,C.xw)(n),t.success(e("common.success")),await V(J)}catch(n){t.error(e("common.error"))}},q=async()=>{try{await (0,C.PH)("long_term"),t.success(e("common.success")),await V(J)}catch(n){t.error(e("common.error"))}},K=async()=>{try{await (0,C.E)("long_term"),t.success(e("common.success")),await V(J)}catch(n){t.error(e("common.error"))}},Q=async()=>{if(_&&z.trim()){F(!0);try{await (0,C.zo)(_.id,{content:z.trim(),context:M||void 0}),t.success(e("common.success")),I(!1),await V(J)}catch(n){t.error(e("common.error"))}finally{F(!1)}}},Z=[{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:"类型",dataIndex:"type",width:90,render:e=>(0,o.jsx)(r.A,{children:E[e]||e})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,o.jsx)(r.A,{color:O[e]||"default",children:"high"===e?"高":"medium"===e?"中":"低"})},{title:e("context.source"),dataIndex:"source",width:100,ellipsis:!0},{title:e("context.updatedAt"),dataIndex:"updated_at",width:140,render:e=>e?new Date(e).toLocaleString():"-"},{title:e("common.edit"),width:100,render:(t,n)=>(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,o.jsx)(s.Ay,{size:"small",type:"text",icon:(0,o.jsx)(g.A,{}),onClick:()=>{L(n),B(n.content),H(""),I(!0)}}),(0,o.jsx)(l.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{X(n.id)},children:(0,o.jsx)(s.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(x.A,{})})})]})}];return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.longTermContext")}),(0,o.jsx)("p",{className:"pageDesc",children:e("context.longTermDesc")})]}),(0,o.jsxs)(d.A,{wrap:!0,children:[(0,o.jsx)(u.A,{prefix:(0,o.jsx)(S.A,{}),placeholder:e("common.search"),value:J,onChange:e=>U(e.target.value),onPressEnter:()=>{V(J)},allowClear:!0,style:{width:240}}),(0,o.jsx)(s.Ay,{icon:(0,o.jsx)(j.A,{}),onClick:()=>{q()},children:"压缩"}),(0,o.jsx)(l.A,{title:"确定清除长期上下文吗?",onConfirm:()=>{K()},children:(0,o.jsx)(s.Ay,{danger:!0,icon:(0,o.jsx)(w.A,{}),children:"清除"})})]})]}),(0,o.jsx)(p.A,{size:"small",children:(0,o.jsx)(m.A,{title:"总上下文大小",value:(0,v.z3)(k.totalBytes),prefix:(0,o.jsx)(T.A,{}),suffix:" / ".concat(k.count," 条")})}),(0,o.jsxs)(p.A,{size:"small",children:[(0,o.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(b.A,{})," ",e("context.longTermSource")]}),(0,o.jsx)(y.A,{rowKey:"id",columns:Z,dataSource:P,loading:n,size:"small",pagination:{pageSize:15}})]}),(0,o.jsx)(h.A,{maskClosable:!1,title:e("models.editModel"),open:D,onCancel:()=>I(!1),onOk:()=>{Q()},confirmLoading:W,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("context.content"),children:(0,o.jsx)(u.A.TextArea,{rows:6,value:z,onChange:e=>B(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(u.A,{value:M,onChange:e=>H(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}},5551:(e,t,n)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.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 n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(n/60),a=Math.floor(o/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):o>0?"".concat(o,"h ago"):n>0?"".concat(n,"m ago"):"Just now":a>0?"".concat(a," 天前"):o>0?"".concat(o," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>r,fw:()=>a,z3:()=>o});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},c={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function r(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?c:i)[e])?t:e}},6382:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/long-term",function(){return n(260)}])},6578:(e,t,n)=>{"use strict";async function o(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function a(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function i(e){var t,n;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(a))}async function c(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function r(e,t){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function s(e,t,n){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function y(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return o("/api/kb/features")}async function S(e,t){var n,a,i,c,r;let s=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&s.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&s.set("category",t.category),(null==t?void 0:t.limit)&&s.set("limit",String(null!=(r=t.limit)?r:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&s.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(a=t.weights)?void 0:a.vector)!=null&&s.set("vectorWeight",String(t.weights.vector)),(null==t||null==(i=t.weights)?void 0:i.rewrite)!=null&&s.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(c=t.weights)?void 0:c.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function j(){return o("/api/prompt")}async function w(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function T(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function b(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function C(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return o("/api/documents/specs")}async function O(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(){return o("/api/documents/templates")}async function A(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function J(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function U(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function D(){return o("/api/documents/drafts")}async function I(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function _(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function L(){return o("/api/config/providers")}async function z(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function B(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function M(){return o("/api/config/models")}async function H(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function W(){return o("/api/config/embedding")}async function F(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function V(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function X(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function q(){return o("/api/system/stats")}async function K(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function Q(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function Z(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function G(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Y(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ee(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>I,Bh:()=>ee,Dl:()=>P,E:()=>G,EK:()=>O,ER:()=>N,FC:()=>q,FV:()=>b,H1:()=>g,H7:()=>m,HC:()=>r,HT:()=>i,II:()=>W,NR:()=>C,OX:()=>J,PH:()=>Z,QT:()=>u,Qx:()=>p,R1:()=>U,SJ:()=>h,UE:()=>_,VW:()=>x,W2:()=>S,X8:()=>f,Z3:()=>L,_m:()=>z,aP:()=>H,bV:()=>R,bZ:()=>X,c1:()=>d,dd:()=>F,dg:()=>T,dw:()=>v,dx:()=>j,h0:()=>k,h1:()=>B,hc:()=>a,hn:()=>K,l2:()=>A,lv:()=>w,mx:()=>E,p:()=>Q,q7:()=>D,tn:()=>s,u6:()=>V,xC:()=>c,xq:()=>y,xw:()=>Y,zo:()=>$,zr:()=>M})}},e=>{e.O(0,[260,167,382,201,668,227,740,174,492,455,446,400,257,636,593,792],()=>e(e.s=6382)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[409],{1162:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>O});var o=n(5321),a=n(7109),i=n(3014),r=n(7807),c=n(1702),s=n(5114),l=n(6171),d=n(3442),u=n(4668),p=n(8787),m=n(4849),h=n(9400),y=n(5258),f=n(3455),g=n(9650),x=n(8209),S=n(486),w=n(3374),j=n(8383),T=n(6619),b=n(3998),C=n(6578),v=n(5551);let E={high:"red",medium:"orange",low:"default"};function O(){let e=(0,i.Vr)(),{message:t}=r.A.useApp(),[n,O]=(0,a.useState)(!0),[N,P]=(0,a.useState)([]),[A,k]=(0,a.useState)({count:0,totalBytes:0}),[R,J]=(0,a.useState)(""),[U,D]=(0,a.useState)(!1),[I,L]=(0,a.useState)(null),[_,z]=(0,a.useState)(""),[B,M]=(0,a.useState)(""),[H,W]=(0,a.useState)(!1),F=async n=>{O(!0);try{let[e,t]=await Promise.all([(0,C.hn)("short_term",n),(0,C.p)("short_term")]);P(e),k(t)}catch(n){t.error(e("common.error"))}finally{O(!1)}};(0,a.useEffect)(()=>{F()},[]);let V=async n=>{try{await (0,C.xw)(n),t.success(e("common.success")),await F(R)}catch(n){t.error(e("common.error"))}},X=async()=>{try{await (0,C.PH)("short_term"),t.success(e("common.success")),await F(R)}catch(n){t.error(e("common.error"))}},q=async()=>{try{await (0,C.E)("short_term"),t.success(e("common.success")),await F(R)}catch(n){t.error(e("common.error"))}},K=async()=>{if(I&&_.trim()){W(!0);try{await (0,C.zo)(I.id,{content:_.trim(),context:B||void 0}),t.success(e("common.success")),D(!1),await F(R)}catch(n){t.error(e("common.error"))}finally{W(!1)}}},Q=[{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,o.jsx)(c.A,{color:E[e]||"default",children:"high"===e?"高":"medium"===e?"中":"低"})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.source"),dataIndex:"source",width:120,ellipsis:!0},{title:e("context.updatedAt"),dataIndex:"updated_at",width:140,render:e=>e?new Date(e).toLocaleString():"-"},{title:e("common.edit"),width:100,render:(t,n)=>(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,o.jsx)(s.Ay,{size:"small",type:"text",icon:(0,o.jsx)(g.A,{}),onClick:()=>{L(n),z(n.content),M(""),D(!0)}}),(0,o.jsx)(l.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{V(n.id)},children:(0,o.jsx)(s.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(x.A,{})})})]})}];return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.shortTermContext")}),(0,o.jsx)("p",{className:"pageDesc",children:e("context.shortTermDesc")})]}),(0,o.jsxs)(d.A,{wrap:!0,children:[(0,o.jsx)(u.A,{prefix:(0,o.jsx)(S.A,{}),placeholder:e("common.search"),value:R,onChange:e=>J(e.target.value),onPressEnter:()=>{F(R)},allowClear:!0,style:{width:240}}),(0,o.jsx)(s.Ay,{icon:(0,o.jsx)(w.A,{}),onClick:()=>{X()},children:"压缩"}),(0,o.jsx)(l.A,{title:"确定清除短期上下文吗?",onConfirm:()=>{q()},children:(0,o.jsx)(s.Ay,{danger:!0,icon:(0,o.jsx)(j.A,{}),children:"清除"})})]})]}),(0,o.jsx)(p.A,{size:"small",children:(0,o.jsx)(m.A,{title:"总上下文大小",value:(0,v.z3)(A.totalBytes),prefix:(0,o.jsx)(T.A,{}),suffix:" / ".concat(A.count," 条")})}),(0,o.jsxs)(p.A,{size:"small",children:[(0,o.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(b.A,{})," ",e("context.shortTermSource")]}),(0,o.jsx)(h.A,{rowKey:"id",columns:Q,dataSource:N,loading:n,size:"small",pagination:{pageSize:15}})]}),(0,o.jsx)(y.A,{maskClosable:!1,title:e("models.editModel"),open:U,onCancel:()=>D(!1),onOk:()=>{K()},confirmLoading:H,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("context.content"),children:(0,o.jsx)(u.A.TextArea,{rows:6,value:_,onChange:e=>z(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(u.A,{value:B,onChange:e=>M(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}},5551:(e,t,n)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.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 n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(n/60),a=Math.floor(o/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):o>0?"".concat(o,"h ago"):n>0?"".concat(n,"m ago"):"Just now":a>0?"".concat(a," 天前"):o>0?"".concat(o," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>c,fw:()=>a,z3:()=>o});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},r={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function c(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?r:i)[e])?t:e}},6578:(e,t,n)=>{"use strict";async function o(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function a(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function i(e){var t,n;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(a))}async function r(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function c(e,t){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function s(e,t,n){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return o("/api/kb/features")}async function S(e,t){var n,a,i,r,c;let s=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&s.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&s.set("category",t.category),(null==t?void 0:t.limit)&&s.set("limit",String(null!=(c=t.limit)?c:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&s.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(a=t.weights)?void 0:a.vector)!=null&&s.set("vectorWeight",String(t.weights.vector)),(null==t||null==(i=t.weights)?void 0:i.rewrite)!=null&&s.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(r=t.weights)?void 0:r.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function w(){return o("/api/prompt")}async function j(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function T(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function b(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function C(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return o("/api/documents/specs")}async function O(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(){return o("/api/documents/templates")}async function A(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function J(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function U(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function D(){return o("/api/documents/drafts")}async function I(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function L(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function _(){return o("/api/config/providers")}async function z(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function B(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function M(){return o("/api/config/models")}async function H(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function W(){return o("/api/config/embedding")}async function F(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function V(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function X(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function q(){return o("/api/system/stats")}async function K(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function Q(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function Z(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function G(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Y(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ee(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>I,Bh:()=>ee,Dl:()=>P,E:()=>G,EK:()=>O,ER:()=>N,FC:()=>q,FV:()=>b,H1:()=>g,H7:()=>m,HC:()=>c,HT:()=>i,II:()=>W,NR:()=>C,OX:()=>J,PH:()=>Z,QT:()=>u,Qx:()=>p,R1:()=>U,SJ:()=>y,UE:()=>L,VW:()=>x,W2:()=>S,X8:()=>f,Z3:()=>_,_m:()=>z,aP:()=>H,bV:()=>R,bZ:()=>X,c1:()=>d,dd:()=>F,dg:()=>T,dw:()=>v,dx:()=>w,h0:()=>k,h1:()=>B,hc:()=>a,hn:()=>K,l2:()=>A,lv:()=>j,mx:()=>E,p:()=>Q,q7:()=>D,tn:()=>s,u6:()=>V,xC:()=>r,xq:()=>h,xw:()=>Y,zo:()=>$,zr:()=>M})},9164:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/short-term",function(){return n(1162)}])}},e=>{e.O(0,[260,167,382,201,668,227,740,174,492,455,446,400,257,636,593,792],()=>e(e.s=9164)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[623],{3507:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return t(9889)}])},5493:(e,n,t)=>{"use strict";t.d(n,{A:()=>k});var o=t(7109),r=t(9188),i=t(4216),s=t(5042),l=t(7137),a=t(2188),c=t(7189),d=t(2644),p=t(3638),u=t(2162),m=t(6047),y=t(4567),h=t(5561),f=t(7961),x=t(540);let g=(e,n,t)=>({background:e,[`${t}-icon`]:{color:n}}),j=(0,x.OF)("Alert",e=>[(e=>{let{componentCls:n,motionDurationSlow:t,marginXS:o,marginSM:r,fontSize:i,fontSizeLG:s,lineHeight:l,borderRadiusLG:a,motionEaseInOutCirc:c,withDescriptionIconSize:d,colorText:p,colorTextHeading:u,withDescriptionPadding:m,defaultPadding:y,lineWidth:x,lineType:g,colorSuccessBorder:j,colorWarningBorder:b,colorErrorBorder:A,colorInfoBorder:v}=e;return{[n]:{...(0,f.dF)(e),position:"relative",display:"flex",alignItems:"center",padding:y,wordWrap:"break-word",borderRadius:a,borderWidth:(0,h.zA)(x),borderStyle:g,[`&${n}-success`]:{borderColor:j},[`&${n}-info`]:{borderColor:v},[`&${n}-warning`]:{borderColor:b},[`&${n}-error`]:{borderColor:A},[`&${n}-filled`]:{borderColor:"transparent"},[`&${n}-rtl`]:{direction:"rtl"},[`${n}-section`]:{flex:1,minWidth:0},[`${n}-icon`]:{marginInlineEnd:o,lineHeight:0},"&-description":{display:"none",fontSize:i,lineHeight:l},"&-title":{color:u},[`&${n}-motion-leave`]:{overflow:"hidden",opacity:1,transition:["max-height","opacity","padding-top","padding-bottom","margin-bottom"].map(e=>`${e} ${t} ${c}`).join(", ")},[`&${n}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0},[`&${n}-with-description`]:{alignItems:"flex-start",padding:m,[`${n}-icon`]:{marginInlineEnd:r,fontSize:d,lineHeight:0},[`${n}-title`]:{display:"block",marginBottom:o,color:u,fontSize:s},[`${n}-description`]:{display:"block",color:p}},[`&${n}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}}})(e),(e=>{let{componentCls:n,colorSuccess:t,colorSuccessBg:o,colorWarning:r,colorWarningBg:i,colorError:s,colorErrorBg:l,colorInfo:a,colorInfoBg:c}=e;return{[n]:{"&-success":g(o,t,n),"&-info":g(c,a,n),"&-warning":g(i,r,n),"&-error":{...g(l,s,n),[`${n}-description > pre`]:{margin:0,padding:0}}}}})(e),(e=>{let{componentCls:n,iconCls:t,motionDurationMid:o,marginXS:r,fontSizeIcon:i,colorIcon:s,colorIconHover:l}=e;return{[n]:{[`${n}-actions`]:{marginInlineStart:r},[`${n}-close-icon`]:{marginInlineStart:r,padding:0,overflow:"hidden",fontSize:i,lineHeight:(0,h.zA)(i),backgroundColor:"transparent",border:"none",cursor:"pointer",...(0,f.K8)(e),[`${t}-close`]:{color:s,transition:`color ${o}`,"&:hover":{color:l}}},"&-close-text":{color:s,transition:`color ${o}`,"&:hover":{color:l}}}}})(e)],e=>({withDescriptionIconSize:e.fontSizeHeading3,defaultPadding:`${e.paddingContentVerticalSM}px 12px`,withDescriptionPadding:`${e.paddingMD}px ${e.paddingContentHorizontalLG}px`})),b=e=>{let{icon:n,type:t,className:s,style:c,successIcon:d,infoIcon:p,warningIcon:u,errorIcon:m}=e,y={success:d??o.createElement(r.A,null),info:p??o.createElement(a.A,null),error:m??o.createElement(i.A,null),warning:u??o.createElement(l.A,null)};return o.createElement("span",{className:s,style:c},n??y[t])},A=e=>{let{isClosable:n,prefixCls:t,closeIcon:r,handleClose:i,ariaProps:l,className:a,style:c}=e,d=!0===r||void 0===r?o.createElement(s.A,null):r;return n?o.createElement("button",{type:"button",onClick:i,className:(0,p.$)(`${t}-close-icon`,a),tabIndex:0,style:c,...l},d):null},v=o.forwardRef((e,n)=>{let{description:t,prefixCls:r,message:i,title:s,banner:l,className:a,rootClassName:h,style:f,onMouseEnter:x,onMouseLeave:g,onClick:v,afterClose:T,showIcon:w,closable:S,closeText:C,closeIcon:I,action:E,id:R,styles:k,classNames:N,...$}=e,P=s??i,[O,D]=o.useState(!1),F=o.useRef(null);o.useImperativeHandle(n,()=>({nativeElement:F.current}));let{getPrefixCls:J,direction:U,variant:L,closable:H,closeIcon:_,className:q,style:z,classNames:B,styles:V,successIcon:M,infoIcon:W,warningIcon:Q,errorIcon:X}=(0,y.TP)("alert"),G=J("alert",r),[K,Z]=j(G),{onClose:Y,afterClose:ee}=(0,m.Qd)(S)?S:{},en=n=>{D(!0),(Y??e.onClose)?.(n)},et=o.useMemo(()=>void 0!==e.type?e.type:l?"warning":"info",[e.type,l]),eo=e.variant??L??"outlined",er=o.useMemo(()=>!!(0,m.Qd)(S)&&!!S.closeIcon||!!C||("boolean"==typeof S?S:!!(!1!==I&&(0,m.R)(I))||!!H),[C,I,S,H]),ei=!!l&&void 0===w||w,es={...e,prefixCls:G,variant:eo,type:et,showIcon:ei,closable:er},el=(0,u.XT)(z),ea=(0,u.XT)(f),[ec,ed]=(0,u.AV)([B,N],[V,el,k,ea],{props:es}),ep=(0,p.$)(G,`${G}-${et}`,`${G}-${eo}`,{[`${G}-with-description`]:!!t,[`${G}-no-icon`]:!ei,[`${G}-banner`]:!!l,[`${G}-rtl`]:"rtl"===U},q,a,h,ec.root,Z,K),eu=(0,d.KE)($,{aria:!0,data:!0}),em=o.useMemo(()=>(0,m.Qd)(S)&&S.closeIcon?S.closeIcon:C||(void 0!==I?I:(0,m.Qd)(H)&&H.closeIcon?H.closeIcon:_),[I,S,H,C,_]),ey=o.useMemo(()=>{let e=S??H;return(0,m.Qd)(e)?(0,d.KE)(e,{data:!0,aria:!0}):{}},[S,H]);return o.createElement(c.Ay,{visible:!O,motionName:`${G}-motion`,motionAppear:!1,motionEnter:!1,onLeaveStart:e=>({maxHeight:e.offsetHeight}),onLeaveEnd:ee??T},({className:n,style:r},i)=>o.createElement("div",{id:R,ref:(0,d.K4)(F,i),"data-show":!O,className:(0,p.$)(ep,n),style:{...ed.root,...r},onMouseEnter:x,onMouseLeave:g,onClick:v,role:"alert",...eu},ei?o.createElement(b,{className:(0,p.$)(`${G}-icon`,ec.icon),style:ed.icon,description:t,icon:e.icon,prefixCls:G,type:et,successIcon:M,infoIcon:W,warningIcon:Q,errorIcon:X}):null,o.createElement("div",{className:(0,p.$)(`${G}-section`,ec.section),style:ed.section},P?o.createElement("div",{className:(0,p.$)(`${G}-title`,ec.title),style:ed.title},P):null,t?o.createElement("div",{className:(0,p.$)(`${G}-description`,ec.description),style:ed.description},t):null),E?o.createElement("div",{className:(0,p.$)(`${G}-actions`,ec.actions),style:ed.actions},E):null,o.createElement(A,{className:ec.close,style:ed.close,isClosable:er,prefixCls:G,closeIcon:em,handleClose:en,ariaProps:ey})))});var T=t(1113),w=t(9939),S=t(218),C=t(3076),I=t(3784),E=t(5472);let R=function(e){function n(){var e,t,o;return(0,T.A)(this,n),t=n,o=arguments,t=(0,S.A)(t),(e=(0,I.A)(this,(0,C.A)()?Reflect.construct(t,o||[],(0,S.A)(this).constructor):t.apply(this,o))).state={error:void 0,info:{}},e}return(0,E.A)(n,e),(0,w.A)(n,[{key:"componentDidCatch",value:function(e,n){this.setState({error:e,info:n})}},{key:"render",value:function(){let{message:e,title:n,description:t,id:r,children:i}=this.props,{error:s,info:l}=this.state,a=n??e,c=l?.componentStack||null,d=(0,m.R)(a)?a:s?.toString(),p=(0,m.R)(t)?t:c;return s?o.createElement(v,{id:r,type:"error",title:d,description:o.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},p)}):i}}])}(o.PureComponent);v.ErrorBoundary=R;let k=v},6578:(e,n,t)=>{"use strict";async function o(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function r(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(n))}async function i(e){var n,t;let r=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&r.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&r.set("category",e.category),(null==e?void 0:e.page)&&r.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&r.set("limit",String(null!=(t=e.limit)?t:50)),o("/api/kb/files?".concat(r))}async function s(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),o("/api/kb/files/detail?".concat(t))}async function l(e,n){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function a(e,n,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function c(e){return new Promise((n,t)=>{let o=new FileReader;o.onload=()=>{let e=o.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},o.onerror=t,o.readAsDataURL(e)})}async function d(e,n,t){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await c(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function p(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n))}async function m(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function y(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function h(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function x(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function g(){return o("/api/kb/features")}async function j(e,n){var t,r,i,s,l;let a=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&a.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&a.set("category",n.category),(null==n?void 0:n.limit)&&a.set("limit",String(null!=(l=n.limit)?l:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&a.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(r=n.weights)?void 0:r.vector)!=null&&a.set("vectorWeight",String(n.weights.vector)),(null==n||null==(i=n.weights)?void 0:i.rewrite)!=null&&a.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(s=n.weights)?void 0:s.hybridBonus)!=null&&a.set("hybridBonus",String(n.weights.hybridBonus)),o("/api/kb/search?".concat(a))}async function b(){return o("/api/prompt")}async function A(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function v(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function w(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function S(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(){return o("/api/documents/specs")}async function I(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(){return o("/api/documents/templates")}async function k(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function P(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function D(){return o("/api/documents/drafts")}async function F(e,n){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function J(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw Error(await n.text());return n.blob()}async function U(){return o("/api/config/providers")}async function L(e,n){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function H(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function _(){return o("/api/config/models")}async function q(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function z(){return o("/api/config/embedding")}async function B(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function V(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function M(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function W(){return o("/api/system/stats")}async function Q(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function X(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function G(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function K(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Z(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function Y(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ee(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>F,Bh:()=>ee,Dl:()=>R,E:()=>K,EK:()=>I,ER:()=>E,FC:()=>W,FV:()=>T,H1:()=>x,H7:()=>m,HC:()=>l,HT:()=>i,II:()=>z,NR:()=>w,OX:()=>P,PH:()=>G,QT:()=>p,Qx:()=>u,R1:()=>O,SJ:()=>h,UE:()=>J,VW:()=>g,W2:()=>j,X8:()=>f,Z3:()=>U,_m:()=>L,aP:()=>q,bV:()=>$,bZ:()=>M,c1:()=>d,dd:()=>B,dg:()=>v,dw:()=>S,dx:()=>b,h0:()=>N,h1:()=>H,hc:()=>r,hn:()=>Q,l2:()=>k,lv:()=>A,mx:()=>C,p:()=>X,q7:()=>D,tn:()=>a,u6:()=>V,xC:()=>s,xq:()=>y,xw:()=>Z,zo:()=>Y,zr:()=>_})},9889:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>C});var o=t(5321),r=t(7109),i=t(7807),s=t(3455),l=t(8332),a=t(4253),c=t(5114),d=t(6171),p=t(3442),u=t(1702),m=t(8787),y=t(5493),h=t(2256),f=t(8770),x=t(5258),g=t(7271),j=t(4668),b=t(8569),A=t(9650),v=t(8209),T=t(4746),w=t(6578),S=t(3014);function C(){let e=(0,S.Vr)(),{message:n}=i.A.useApp(),[t]=s.A.useForm(),[C]=s.A.useForm(),[I,E]=(0,r.useState)([]),[R,k]=(0,r.useState)([]),[N,$]=(0,r.useState)([]),[P,O]=(0,r.useState)([]),[D,F]=(0,r.useState)(!1),[J,U]=(0,r.useState)(!1),L=async()=>{let[e,n,t]=await Promise.all([(0,w.lv)(),(0,w.HT)(),(0,w.dx)()]);E(e.roles),k(e.configs),$(n.files),O(t)};(0,r.useEffect)(()=>{L().catch(()=>n.error(e("common.error")))},[n,e]);let H=I.filter(e=>"file"===e.type),_=I.filter(e=>"prompt"===e.type),q=async()=>{try{let o=await t.validateFields(),r=await (0,w.dg)(o);E(r.roles),k(r.configs),F(!1),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},z=async()=>{try{let t=await C.validateFields(),o=e=>(null!=e?e:[]).map((e,n)=>{var t;return{roleId:e.roleId,order:Number(null!=(t=e.order)?t:n)}}),r=await (0,w.NR)({...t,fileRoles:o(t.fileRoles),promptRoles:o(t.promptRoles)});E(r.roles),k(r.configs),U(!1),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},B=async e=>{let n=await (0,w.FV)(e.type,e.id);E(n.roles),k(n.configs)},V=async e=>{let n=await (0,w.dw)(e);E(n.roles),k(n.configs)},M=function(e){var n;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";t.setFieldsValue(e?{...e,resourceIds:(null==(n=e.resourceIds)?void 0:n.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]}:{id:"role-".concat(Date.now()),name:"",description:"",type:o,resourceIds:[],executionType:"prompt"===o?"reference":void 0,processingType:"file"===o?"reference":void 0}),F(!0)},W=e=>{C.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[]}),U(!0)},Q=n=>(0,o.jsx)(l.A,{dataSource:I.filter(e=>e.type===n),locale:{emptyText:(0,o.jsx)(a.A,{description:e("common.noData")})},renderItem:n=>{var t;return(0,o.jsx)(l.A.Item,{actions:[(0,o.jsx)(c.Ay,{type:"text",icon:(0,o.jsx)(A.A,{}),onClick:()=>M(n)},"edit"),(0,o.jsx)(d.A,{title:e("common.confirm"),onConfirm:()=>{B(n)},children:(0,o.jsx)(c.Ay,{type:"text",danger:!0,icon:(0,o.jsx)(v.A,{})})},"delete")],children:(0,o.jsx)(l.A.Item.Meta,{title:(0,o.jsxs)(p.A,{children:[n.name,(0,o.jsx)(u.A,{children:n.id})]}),description:(0,o.jsxs)(p.A,{direction:"vertical",children:[(0,o.jsx)("span",{children:n.description}),(0,o.jsx)("span",{children:"prompt"===n.type?n.executionType:n.processingType}),(0,o.jsx)("span",{children:((null==(t=n.resourceIds)?void 0:t.length)?n.resourceIds:n.resourceId?[n.resourceId]:[]).join("、")||"-"})]})})})}});return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsx)(m.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,o.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle mb-1",children:e("roles.title")}),(0,o.jsx)("p",{className:"pageDesc mb-0",children:e("roles.description")})]}),(0,o.jsxs)(p.A,{children:[(0,o.jsx)(c.Ay,{icon:(0,o.jsx)(T.A,{}),onClick:()=>M(void 0,"file"),children:e("roles.newFileRole")}),(0,o.jsx)(c.Ay,{icon:(0,o.jsx)(T.A,{}),onClick:()=>M(void 0,"prompt"),children:e("roles.newPromptRole")}),(0,o.jsx)(c.Ay,{type:"primary",icon:(0,o.jsx)(T.A,{}),onClick:()=>W(),children:e("roles.newConfig")})]})]})}),(0,o.jsx)(y.A,{type:"info",showIcon:!0,message:e("roles.plainGuideTitle"),description:e("roles.plainGuideDesc")}),(0,o.jsxs)(h.A,{gutter:[16,16],children:[(0,o.jsx)(f.A,{xs:24,lg:12,children:(0,o.jsx)(m.A,{title:e("roles.fileRoles"),children:Q("file")})}),(0,o.jsx)(f.A,{xs:24,lg:12,children:(0,o.jsx)(m.A,{title:e("roles.promptRoles"),children:Q("prompt")})}),(0,o.jsx)(f.A,{xs:24,children:(0,o.jsx)(m.A,{title:e("roles.configs"),children:(0,o.jsx)(l.A,{dataSource:R,locale:{emptyText:(0,o.jsx)(a.A,{description:e("common.noData")})},renderItem:n=>(0,o.jsx)(l.A.Item,{actions:[(0,o.jsx)(c.Ay,{type:"text",icon:(0,o.jsx)(A.A,{}),onClick:()=>W(n)},"edit"),(0,o.jsx)(d.A,{title:e("common.confirm"),onConfirm:()=>{V(n.id)},children:(0,o.jsx)(c.Ay,{type:"text",danger:!0,icon:(0,o.jsx)(v.A,{})})},"delete")],children:(0,o.jsx)(l.A.Item.Meta,{title:(0,o.jsxs)(p.A,{children:[n.name,(0,o.jsx)(u.A,{children:n.id})]}),description:"".concat(e("roles.fileRoles"),": ").concat(n.fileRoles.length," \xb7 ").concat(e("roles.promptRoles"),": ").concat(n.promptRoles.length)})})})})})]}),(0,o.jsx)(x.A,{maskClosable:!1,title:e("roles.roleEditor"),open:D,onOk:()=>{q()},onCancel:()=>F(!1),centered:!0,okText:e("common.save"),children:(0,o.jsxs)(s.A,{form:t,layout:"vertical",children:[(0,o.jsx)(s.A.Item,{name:"type",label:e("roles.roleType"),rules:[{required:!0}],children:(0,o.jsx)(g.A,{options:[{label:e("roles.fileRole"),value:"file"},{label:e("roles.promptRole"),value:"prompt"}]})}),(0,o.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(j.A,{disabled:!0})}),(0,o.jsx)(s.A.Item,{name:"name",label:e("roles.roleName"),rules:[{required:!0}],children:(0,o.jsx)(j.A,{})}),(0,o.jsx)(s.A.Item,{name:"description",label:e("roles.roleDescription"),children:(0,o.jsx)(j.A,{})}),(0,o.jsx)(s.A.Item,{noStyle:!0,shouldUpdate:(e,n)=>e.type!==n.type,children:n=>{let{getFieldValue:t}=n;return"prompt"===t("type")?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.A.Item,{name:"executionType",label:e("roles.executionType"),rules:[{required:!0}],extra:e("roles.executionTypeHelp"),children:(0,o.jsx)(g.A,{options:[{label:e("roles.factExtraction"),value:"fact_extraction"},{label:e("roles.chapterGeneration"),value:"chapter_generation"},{label:e("roles.validation"),value:"validation"},{label:e("roles.formatting"),value:"formatting"},{label:e("roles.reference"),value:"reference"}]})}),(0,o.jsx)(s.A.Item,{name:"resourceIds",label:e("roles.bindPrompt"),extra:e("roles.multiBindPromptHelp"),children:(0,o.jsx)(g.A,{mode:"multiple",showSearch:!0,options:P.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.A.Item,{name:"processingType",label:e("roles.processingType"),rules:[{required:!0}],extra:e("roles.processingTypeHelp"),children:(0,o.jsx)(g.A,{options:[{label:e("roles.ruleFile"),value:"rule"},{label:e("roles.projectFactFile"),value:"project_fact"},{label:e("roles.tableFile"),value:"table"},{label:e("roles.drawingFile"),value:"drawing"},{label:e("roles.specificationFile"),value:"specification"},{label:e("roles.reference"),value:"reference"}]})}),(0,o.jsx)(s.A.Item,{name:"resourceIds",label:e("roles.bindFile"),extra:e("roles.multiBindFileHelp"),children:(0,o.jsx)(g.A,{mode:"multiple",showSearch:!0,options:N.map(e=>({label:e.relativePath,value:e.relativePath}))})})]})}})]})}),(0,o.jsx)(x.A,{maskClosable:!1,title:e("roles.configEditor"),open:J,onOk:()=>{z()},onCancel:()=>U(!1),width:820,centered:!0,okText:e("common.save"),children:(0,o.jsxs)(s.A,{form:C,layout:"vertical",children:[(0,o.jsxs)(h.A,{gutter:12,children:[(0,o.jsx)(f.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(j.A,{disabled:!0})})}),(0,o.jsx)(f.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"name",label:e("roles.configName"),rules:[{required:!0}],children:(0,o.jsx)(j.A,{})})}),(0,o.jsx)(f.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"description",label:e("roles.configDescription"),children:(0,o.jsx)(j.A,{})})})]}),(0,o.jsx)(b.A,{items:[{key:"file",label:e("roles.fileRoles"),children:(0,o.jsx)(s.A.List,{name:"fileRoles",children:(n,t)=>{let{add:r,remove:i}=t;return(0,o.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[n.map((e,n)=>(0,o.jsxs)(h.A,{gutter:8,children:[(0,o.jsx)(f.A,{span:16,children:(0,o.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],children:(0,o.jsx)(g.A,{options:H.map(e=>({label:e.name,value:e.id}))})})}),(0,o.jsx)(f.A,{span:6,children:(0,o.jsx)(s.A.Item,{name:[e.name,"order"],initialValue:n,children:(0,o.jsx)(j.A,{type:"number"})})}),(0,o.jsx)(f.A,{span:2,children:(0,o.jsx)(c.Ay,{danger:!0,onClick:()=>i(e.name),children:"-"})})]},e.key)),(0,o.jsx)(c.Ay,{onClick:()=>r({order:n.length}),children:e("roles.addRole")})]})}})},{key:"prompt",label:e("roles.promptRoles"),children:(0,o.jsx)(s.A.List,{name:"promptRoles",children:(n,t)=>{let{add:r,remove:i}=t;return(0,o.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[n.map((e,n)=>(0,o.jsxs)(h.A,{gutter:8,children:[(0,o.jsx)(f.A,{span:16,children:(0,o.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],children:(0,o.jsx)(g.A,{options:_.map(e=>({label:e.name,value:e.id}))})})}),(0,o.jsx)(f.A,{span:6,children:(0,o.jsx)(s.A.Item,{name:[e.name,"order"],initialValue:n,children:(0,o.jsx)(j.A,{type:"number"})})}),(0,o.jsx)(f.A,{span:2,children:(0,o.jsx)(c.Ay,{danger:!0,onClick:()=>i(e.name),children:"-"})})]},e.key)),(0,o.jsx)(c.Ay,{onClick:()=>r({order:n.length}),children:e("roles.addRole")})]})}})}]})]})})]})}}},e=>{e.O(0,[260,167,382,201,668,227,740,174,492,455,846,636,593,792],()=>e(e.s=3507)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[580],{4773:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-specs",function(){return t(6734)}])},6578:(e,n,t)=>{"use strict";async function a(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function s(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(n))}async function i(e){var n,t;let s=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&s.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&s.set("category",e.category),(null==e?void 0:e.page)&&s.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&s.set("limit",String(null!=(t=e.limit)?t:50)),a("/api/kb/files?".concat(s))}async function c(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),a("/api/kb/files/detail?".concat(t))}async function r(e,n){return a("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function o(e,n,t){return a("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function l(e){return new Promise((n,t)=>{let a=new FileReader;a.onload=()=>{let e=a.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},a.onerror=t,a.readAsDataURL(e)})}async function d(e,n,t){return a("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function p(e){return a("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function m(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),a("/api/kb/operations?".concat(n))}async function u(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),a("/api/kb/operations?".concat(n),{method:"DELETE"})}async function h(e,n){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function y(e,n){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function j(e){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function x(e){return a("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function f(){return a("/api/kb/features")}async function A(e,n){var t,s,i,c,r;let o=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&o.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&o.set("category",n.category),(null==n?void 0:n.limit)&&o.set("limit",String(null!=(r=n.limit)?r:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&o.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(s=n.weights)?void 0:s.vector)!=null&&o.set("vectorWeight",String(n.weights.vector)),(null==n||null==(i=n.weights)?void 0:i.rewrite)!=null&&o.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(c=n.weights)?void 0:c.hybridBonus)!=null&&o.set("hybridBonus",String(n.weights.hybridBonus)),a("/api/kb/search?".concat(o))}async function g(){return a("/api/prompt")}async function b(e){return a("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function T(e){return a("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e,n){return a("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function S(e){return a("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e){return a("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function I(){return a("/api/documents/specs")}async function v(e){return a("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return a("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return a("/api/documents/templates")}async function N(e){return a("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function R(e){return a("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(e){return a("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function P(e){return a("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(e){return a("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function D(){return a("/api/documents/drafts")}async function _(e,n){return a("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function J(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw Error(await n.text());return n.blob()}async function U(){return a("/api/config/providers")}async function L(e,n){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function F(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function H(){return a("/api/config/models")}async function V(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function W(){return a("/api/config/embedding")}async function z(e){return a("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function B(){return a("/api/config/embedding/healthCheck",{method:"POST"})}async function G(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function X(){return a("/api/system/stats")}async function K(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return a("/api/context".concat(t))}async function Q(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function Z(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function M(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Y(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(e,n){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ee(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>_,Bh:()=>ee,Dl:()=>E,E:()=>M,EK:()=>v,ER:()=>k,FC:()=>X,FV:()=>w,H1:()=>x,H7:()=>u,HC:()=>r,HT:()=>i,II:()=>W,NR:()=>S,OX:()=>P,PH:()=>Z,QT:()=>p,Qx:()=>m,R1:()=>q,SJ:()=>y,UE:()=>J,VW:()=>f,W2:()=>A,X8:()=>j,Z3:()=>U,_m:()=>L,aP:()=>V,bV:()=>O,bZ:()=>G,c1:()=>d,dd:()=>z,dg:()=>T,dw:()=>C,dx:()=>g,h0:()=>R,h1:()=>F,hc:()=>s,hn:()=>K,l2:()=>N,lv:()=>b,mx:()=>I,p:()=>Q,q7:()=>D,tn:()=>o,u6:()=>B,xC:()=>c,xq:()=>h,xw:()=>Y,zo:()=>$,zr:()=>H})},6734:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>R});var a=t(5321),s=t(7109),i=t(7807),c=t(3455),r=t(8787),o=t(5114),l=t(5493),d=t(8332),p=t(4253),m=t(6171),u=t(3442),h=t(1702),y=t(5258),j=t(2256),x=t(8770),f=t(4668),A=t(8569),g=t(7271),b=t(4534),T=t(4992),w=t(4746),S=t(9650),C=t(8209),I=t(6578),v=t(3014);let k=["text","number","date","table","list"].map(e=>({label:e,value:e})),E=["required_fact","required_chapter","required_file_role","required_prompt_role","source_required","forbidden_text","min_chapter_length","table_required"].map(e=>({label:e,value:e})),N=["error","warning","info"].map(e=>({label:e,value:e}));function R(){var e,n;let t=(0,v.Vr)(),{message:R}=i.A.useApp(),[O]=c.A.useForm(),[P,q]=(0,s.useState)([]),[D,_]=(0,s.useState)([]),[J,U]=(0,s.useState)(!1),L=async()=>{let[e,n]=await Promise.all([(0,I.mx)(),(0,I.lv)()]);q(e.specs),_(n.roles)};(0,s.useEffect)(()=>{L().catch(()=>R.error(t("common.error")))},[R,t]);let F=D.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),H=D.filter(e=>"prompt"===e.type).map(e=>({label:e.name,value:e.id})),V=null!=(n=null==(e=c.A.useWatch("factFields",O))?void 0:e.map(e=>({label:e.name||e.id,value:e.id})))?n:[],W=e=>{O.setFieldsValue(null!=e?e:{id:"spec-".concat(Date.now()),name:"",description:"",factFields:[],chapterRules:[],gateRules:[]}),U(!0)},z=async()=>{try{let e=await O.validateFields(),n=await (0,I.EK)(e);q(n.specs),U(!1),R.success(t("common.success"))}catch(e){e instanceof Error&&R.error(e.message)}},B=async e=>{q((await (0,I.ER)(e)).specs)};return(0,a.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,a.jsx)(r.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle mb-1",children:t("specs.title")}),(0,a.jsx)("p",{className:"pageDesc mb-0",children:t("specs.description")})]}),(0,a.jsx)(o.Ay,{type:"primary",icon:(0,a.jsx)(w.A,{}),onClick:()=>W(),children:t("specs.newSpec")})]})}),(0,a.jsx)(l.A,{type:"info",showIcon:!0,message:t("specs.plainGuideTitle"),description:t("specs.plainGuideDesc")}),(0,a.jsx)(r.A,{title:t("specs.list"),children:(0,a.jsx)(d.A,{dataSource:P,locale:{emptyText:(0,a.jsx)(p.A,{description:t("common.noData")})},renderItem:e=>(0,a.jsx)(d.A.Item,{actions:[(0,a.jsx)(o.Ay,{type:"text",icon:(0,a.jsx)(S.A,{}),onClick:()=>W(e)},"edit"),(0,a.jsx)(m.A,{title:t("common.confirm"),onConfirm:()=>{B(e.id)},children:(0,a.jsx)(o.Ay,{type:"text",danger:!0,icon:(0,a.jsx)(C.A,{})})},"delete")],children:(0,a.jsx)(d.A.Item.Meta,{title:(0,a.jsxs)(u.A,{children:[e.name,(0,a.jsx)(h.A,{children:e.id})]}),description:"".concat(e.description||"-"," \xb7 ").concat(t("specs.facts"),": ").concat(e.factFields.length," \xb7 ").concat(t("specs.chapters"),": ").concat(e.chapterRules.length," \xb7 ").concat(t("specs.gates"),": ").concat(e.gateRules.length)})})})}),(0,a.jsx)(y.A,{maskClosable:!1,title:t("specs.editor"),open:J,onOk:()=>{z()},onCancel:()=>U(!1),width:980,centered:!0,okText:t("common.save"),children:(0,a.jsxs)(c.A,{form:O,layout:"vertical",children:[(0,a.jsxs)(j.A,{gutter:12,children:[(0,a.jsx)(x.A,{span:8,children:(0,a.jsx)(c.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,a.jsx)(f.A,{disabled:!0})})}),(0,a.jsx)(x.A,{span:8,children:(0,a.jsx)(c.A.Item,{name:"name",label:t("specs.name"),rules:[{required:!0}],children:(0,a.jsx)(f.A,{})})}),(0,a.jsx)(x.A,{span:8,children:(0,a.jsx)(c.A.Item,{name:"wordTemplatePath",label:t("specs.wordTemplatePath"),children:(0,a.jsx)(f.A,{placeholder:"/path/to/template.docx"})})})]}),(0,a.jsx)(c.A.Item,{name:"description",label:t("specs.specDescription"),children:(0,a.jsx)(f.A,{})}),(0,a.jsx)(A.A,{items:[{key:"facts",label:t("specs.facts"),children:(0,a.jsx)(c.A.List,{name:"factFields",children:(e,n)=>{let{add:s,remove:i}=n;return(0,a.jsxs)(u.A,{direction:"vertical",className:"w-full",children:[e.map(e=>(0,a.jsxs)(r.A,{size:"small",children:[(0,a.jsxs)(j.A,{gutter:8,children:[(0,a.jsx)(x.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"id"],label:"ID",initialValue:"fact-".concat(Date.now()),children:(0,a.jsx)(f.A,{disabled:!0})})}),(0,a.jsx)(x.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"name"],label:t("specs.factName"),rules:[{required:!0}],children:(0,a.jsx)(f.A,{})})}),(0,a.jsx)(x.A,{span:4,children:(0,a.jsx)(c.A.Item,{name:[e.name,"type"],label:t("specs.factType"),initialValue:"text",children:(0,a.jsx)(g.A,{options:k})})}),(0,a.jsx)(x.A,{span:4,children:(0,a.jsx)(c.A.Item,{name:[e.name,"required"],label:t("specs.required"),valuePropName:"checked",children:(0,a.jsx)(b.A,{})})}),(0,a.jsx)(x.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"sourceRoleIds"],label:t("specs.sourceRoles"),children:(0,a.jsx)(g.A,{mode:"multiple",options:F})})}),(0,a.jsx)(x.A,{span:1,children:(0,a.jsx)(o.Ay,{danger:!0,onClick:()=>i(e.name),children:"-"})})]}),(0,a.jsx)(c.A.Item,{name:[e.name,"extractionHint"],label:t("specs.extractionHint"),children:(0,a.jsx)(f.A,{})}),(0,a.jsx)(c.A.Item,{name:[e.name,"validationHint"],label:t("specs.validationHint"),children:(0,a.jsx)(f.A,{})})]},e.key)),(0,a.jsx)(o.Ay,{onClick:()=>s({id:"fact-".concat(Date.now()),type:"text",required:!0}),children:t("specs.addFact")})]})}})},{key:"chapters",label:t("specs.chapters"),children:(0,a.jsx)(c.A.List,{name:"chapterRules",children:(e,n)=>{let{add:s,remove:i}=n;return(0,a.jsxs)(u.A,{direction:"vertical",className:"w-full",children:[e.map((e,n)=>(0,a.jsxs)(r.A,{size:"small",children:[(0,a.jsxs)(j.A,{gutter:8,children:[(0,a.jsx)(x.A,{span:4,children:(0,a.jsx)(c.A.Item,{name:[e.name,"id"],label:"ID",initialValue:"chapter-".concat(Date.now()),children:(0,a.jsx)(f.A,{disabled:!0})})}),(0,a.jsx)(x.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"title"],label:t("specs.chapterTitle"),rules:[{required:!0}],children:(0,a.jsx)(f.A,{})})}),(0,a.jsx)(x.A,{span:3,children:(0,a.jsx)(c.A.Item,{name:[e.name,"order"],label:t("specs.order"),initialValue:n,children:(0,a.jsx)(T.A,{className:"w-full"})})}),(0,a.jsx)(x.A,{span:3,children:(0,a.jsx)(c.A.Item,{name:[e.name,"minWords"],label:t("specs.minWords"),children:(0,a.jsx)(T.A,{className:"w-full"})})}),(0,a.jsx)(x.A,{span:3,children:(0,a.jsx)(c.A.Item,{name:[e.name,"required"],label:t("specs.required"),valuePropName:"checked",children:(0,a.jsx)(b.A,{})})}),(0,a.jsx)(x.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"requiredFactIds"],label:t("specs.requiredFacts"),children:(0,a.jsx)(g.A,{mode:"multiple",options:V})})}),(0,a.jsx)(x.A,{span:1,children:(0,a.jsx)(o.Ay,{danger:!0,onClick:()=>i(e.name),children:"-"})})]}),(0,a.jsxs)(j.A,{gutter:8,children:[(0,a.jsx)(x.A,{span:12,children:(0,a.jsx)(c.A.Item,{name:[e.name,"requiredFileRoleIds"],label:t("specs.requiredFileRoles"),children:(0,a.jsx)(g.A,{mode:"multiple",options:F})})}),(0,a.jsx)(x.A,{span:12,children:(0,a.jsx)(c.A.Item,{name:[e.name,"requiredPromptRoleIds"],label:t("specs.requiredPromptRoles"),children:(0,a.jsx)(g.A,{mode:"multiple",options:H})})})]}),(0,a.jsx)(c.A.Item,{name:[e.name,"generationHint"],label:t("specs.generationHint"),children:(0,a.jsx)(f.A,{})})]},e.key)),(0,a.jsx)(o.Ay,{onClick:()=>s({id:"chapter-".concat(Date.now()),order:e.length,required:!0}),children:t("specs.addChapter")})]})}})},{key:"gates",label:t("specs.gates"),children:(0,a.jsx)(c.A.List,{name:"gateRules",children:(e,n)=>{let{add:s,remove:i}=n;return(0,a.jsxs)(u.A,{direction:"vertical",className:"w-full",children:[e.map(e=>(0,a.jsxs)(j.A,{gutter:8,children:[(0,a.jsx)(x.A,{span:4,children:(0,a.jsx)(c.A.Item,{name:[e.name,"id"],initialValue:"gate-".concat(Date.now()),children:(0,a.jsx)(f.A,{disabled:!0})})}),(0,a.jsx)(x.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"name"],rules:[{required:!0}],children:(0,a.jsx)(f.A,{placeholder:t("specs.gateName")})})}),(0,a.jsx)(x.A,{span:5,children:(0,a.jsx)(c.A.Item,{name:[e.name,"type"],initialValue:"required_fact",children:(0,a.jsx)(g.A,{options:E})})}),(0,a.jsx)(x.A,{span:4,children:(0,a.jsx)(c.A.Item,{name:[e.name,"level"],initialValue:"error",children:(0,a.jsx)(g.A,{options:N})})}),(0,a.jsx)(x.A,{span:3,children:(0,a.jsx)(c.A.Item,{name:[e.name,"target"],children:(0,a.jsx)(f.A,{placeholder:"target"})})}),(0,a.jsx)(x.A,{span:2,children:(0,a.jsx)(c.A.Item,{name:[e.name,"value"],children:(0,a.jsx)(f.A,{placeholder:"value"})})}),(0,a.jsx)(x.A,{span:1,children:(0,a.jsx)(o.Ay,{danger:!0,onClick:()=>i(e.name),children:"-"})})]},e.key)),(0,a.jsx)(o.Ay,{onClick:()=>s({id:"gate-".concat(Date.now()),type:"required_fact",level:"error"}),children:t("specs.addGate")})]})}})}]})]})})]})}}},e=>{e.O(0,[260,167,382,201,668,227,740,174,492,455,992,846,746,636,593,792],()=>e(e.s=4773)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{1307:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"}},1699:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>M});var o=n(5321),s=n(7109),c=n(4668),i=n(5292),a=n(7807),r=n(3455),l=n(8787),d=n(5114),u=n(2256),p=n(8770),m=n(8332),h=n(4253),f=n(6171),y=n(3442),g=n(1702),x=n(7271),j=n(9730),A=n(8569),w=n(5258),b=n(4746),v=n(3051),S=n(9650),C=n(8209),k=n(6631),I=n(9071),T=n(1307),O=n(8483);function E(){return(E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let R=s.forwardRef((e,t)=>s.createElement(O.A,E({},e,{ref:t,icon:T.A})));var P=n(6398);function N(){return(N=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let z=s.forwardRef((e,t)=>s.createElement(O.A,N({},e,{ref:t,icon:P.A})));var D=n(9811),L=n(6578),U=n(3014);let{TextArea:J}=c.A,{Paragraph:H}=i.A;function M(){var e,t,n;let i=(0,U.Vr)(),{message:T}=a.A.useApp(),[O]=r.A.useForm(),[E,P]=(0,s.useState)([]),[N,M]=(0,s.useState)("construction-organization-design"),[V,F]=(0,s.useState)([]),[_,G]=(0,s.useState)([]),[q,B]=(0,s.useState)([]),[W,X]=(0,s.useState)(!1),[Q,Z]=(0,s.useState)(null),[K,Y]=(0,s.useState)(""),[$,ee]=(0,s.useState)([]),[et,en]=(0,s.useState)(!1),[eo,es]=(0,s.useState)(null),[ec,ei]=(0,s.useState)(!1),[ea,er]=(0,s.useState)([]),[el,ed]=(0,s.useState)(null),eu=async()=>{try{ee((await (0,L.q7)()).drafts)}catch(e){ee([])}};(0,s.useEffect)(()=>{(0,L.Dl)().then(e=>{var t,n;P(e.templates),M(null!=(n=null==(t=e.templates[0])?void 0:t.id)?n:"construction-organization-design")}).catch(()=>T.error(i("common.error"))),(0,L.lv)().then(e=>{F(e.roles),G(e.configs)}).catch(()=>{F([]),G([])}),(0,L.mx)().then(e=>B(e.specs)).catch(()=>B([])),eu()},[T,i]);let ep=(0,s.useMemo)(()=>E.find(e=>e.id===N),[E,N]),em=_.map(e=>({label:e.name,value:e.id})),eh=q.map(e=>({label:e.name,value:e.id})),ef=Math.max(0,ea.findIndex(e=>e.key===el)),ey=(e,t,n)=>{ed(e),er(o=>o.map(o=>o.key===e?{...o,status:t,description:n||o.description}:o))},eg=e=>{er(t=>{let n=t.findIndex(t=>t.key===e);return t.map((e,t)=>t<n&&"error"!==e.status?{...e,status:"finish"}:e)})},ex=e=>{O.setFieldsValue(null!=e?e:{id:"custom-template-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,documentSpecId:void 0,chapters:[]}),ei(!0)},ej=async()=>{try{let e=await O.validateFields(),t=await (0,L.l2)(e);P(t.templates),M(t.template.id),ei(!1),T.success(i("common.success"))}catch(e){e instanceof Error&&T.error(e.message)}},eA=async e=>{try{let t=await (0,L.bV)(e);P(t.templates),M(t.template.id),T.success(i("common.success"))}catch(e){T.error(i("common.error"))}},ew=async e=>{try{var t,n;let o=await (0,L.h0)(e);P(o.templates),M(null!=(n=null==(t=o.templates[0])?void 0:t.id)?n:""),T.success(i("common.success"))}catch(e){T.error(i("common.error"))}},eb=async()=>{if(!N)return;X(!0),er([{key:"prepare",title:i("documents.flowPrepare"),description:i("documents.flowPrepareDesc"),status:"process"},{key:"fact_extraction",title:i("documents.flowFactExtraction"),description:i("documents.flowFactExtractionDesc"),status:"wait"},{key:"chapter_generation",title:i("documents.flowChapterGeneration"),description:i("documents.flowChapterGenerationDesc"),status:"wait"},{key:"validation",title:i("documents.flowValidation"),description:i("documents.flowValidationDesc"),status:"wait"},{key:"formatting",title:i("documents.flowFormatting"),description:i("documents.flowFormattingDesc"),status:"wait"},{key:"done",title:i("documents.flowDone"),description:i("documents.flowDoneDesc"),status:"wait"}]),ed("prepare");let e=[window.setTimeout(()=>{eg("fact_extraction"),ey("fact_extraction","process")},600),window.setTimeout(()=>{eg("chapter_generation"),ey("chapter_generation","process")},1800),window.setTimeout(()=>{eg("validation"),ey("validation","process")},3200),window.setTimeout(()=>{eg("formatting"),ey("formatting","process")},4600)];try{let e=await (0,L.OX)({templateId:N});Z(e.draft),Y(e.draft.markdown),er(t=>t.map(t=>{let n=e.draft.executionStages.find(e=>e.type===t.key);return"prepare"===t.key?{...t,status:"finish",description:i("documents.flowPrepareDone")}:"done"===t.key?{...t,status:e.draft.exportGate.passed?"finish":"error",description:e.draft.exportGate.passed?i("documents.flowDoneDesc"):i("documents.flowGateFailed")}:n?{...t,status:"failed"===n.status?"error":"finish",description:n.message||t.description}:"process"===t.status?{...t,status:"finish"}:t})),ed("done"),T.success(i("common.success"))}catch(e){er(t=>t.map(t=>"process"===t.status?{...t,status:"error",description:e instanceof Error?e.message:i("common.error")}:t)),T.error(e instanceof Error?e.message:i("common.error"))}finally{e.forEach(e=>window.clearTimeout(e)),X(!1)}},ev=async e=>{if(Q){en(!0);try{let s=null==(t=q.find(e=>e.id===(null==ep?void 0:ep.documentSpecId)))?void 0:t.wordTemplatePath;var t,n=await (0,L.UE)({title:Q.title,markdown:K,format:e,enforceGate:"pdf"===e||"docx"===e,exportGate:Q.exportGate,wordTemplatePath:s}),o="".concat(Q.title,".").concat("markdown"===e?"md":e);let c=URL.createObjectURL(n),i=document.createElement("a");i.href=c,i.download=o,i.click(),URL.revokeObjectURL(c)}catch(e){T.error(i("common.error"))}finally{en(!1)}}},eS=async()=>{if(Q)try{let e=await (0,L.Af)({...Q,markdown:K});Z(e.draft),await eu(),T.success(i("common.success"))}catch(e){T.error(i("common.error"))}},eC=async e=>{if(Q){es(e.id);try{var t;let n=await (0,L.R1)({templateId:Q.templateId,chapterId:e.id}),o=Q.chapters.map(t=>t.id===e.id?n.chapter:t);Z({...Q,chapters:o}),t=n.chapter,Y(n=>n.includes(e.content)?n.replace(e.content,t.content):"".concat(n,"\n\n").concat(t.content)),T.success(i("common.success"))}catch(e){T.error(i("common.error"))}finally{es(null)}}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsx)(l.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,o.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle mb-1",children:i("documents.title")}),(0,o.jsx)("p",{className:"pageDesc mb-0",children:i("documents.description")})]}),(0,o.jsx)(d.Ay,{type:"primary",size:"large",icon:(0,o.jsx)(b.A,{}),onClick:()=>ex(),children:i("documents.newTemplate")})]})}),(0,o.jsxs)(u.A,{gutter:[16,16],align:"top",children:[(0,o.jsxs)(p.A,{xs:24,lg:8,children:[(0,o.jsx)(l.A,{size:"small",title:i("documents.templateLibrary"),children:(0,o.jsx)(m.A,{dataSource:E,locale:{emptyText:(0,o.jsx)(h.A,{description:i("common.noData")})},renderItem:e=>(0,o.jsx)(m.A.Item,{onClick:()=>M(e.id),className:"cursor-pointer",actions:[(0,o.jsx)(d.Ay,{size:"small",type:"text",icon:(0,o.jsx)(v.A,{}),onClick:t=>{t.stopPropagation(),eA(e.id)}},"copy"),(0,o.jsx)(d.Ay,{size:"small",type:"text",icon:(0,o.jsx)(S.A,{}),disabled:e.builtIn,onClick:t=>{t.stopPropagation(),ex(e)}},"edit"),(0,o.jsx)(f.A,{title:i("documents.deleteTemplateConfirm"),disabled:e.builtIn,onConfirm:t=>{null==t||t.stopPropagation(),ew(e.id)},children:(0,o.jsx)(d.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(C.A,{}),disabled:e.builtIn,onClick:e=>e.stopPropagation()})},"delete")],children:(0,o.jsx)(m.A.Item.Meta,{avatar:(0,o.jsx)(k.A,{}),title:(0,o.jsxs)(y.A,{children:[(0,o.jsx)("span",{children:e.name}),e.builtIn&&(0,o.jsx)(g.A,{children:i("documents.builtIn")}),N===e.id&&(0,o.jsx)(g.A,{color:"blue",children:i("documents.selected")})]}),description:(0,o.jsxs)(y.A,{direction:"vertical",size:2,children:[(0,o.jsx)("span",{children:e.description}),(0,o.jsx)(g.A,{children:e.category})]})})})})}),(0,o.jsx)(l.A,{className:"mt-4",size:"small",title:i("documents.draftHistory"),children:(0,o.jsx)(m.A,{size:"small",dataSource:$.slice(0,8),locale:{emptyText:(0,o.jsx)(h.A,{description:i("common.noData")})},renderItem:e=>(0,o.jsx)(m.A.Item,{onClick:()=>{Z(e),Y(e.markdown),M(e.templateId)},className:"cursor-pointer",children:(0,o.jsx)(m.A.Item.Meta,{title:e.title,description:new Date(e.updatedAt).toLocaleString()})})})})]}),(0,o.jsx)(p.A,{xs:24,lg:16,children:(0,o.jsx)(l.A,{size:"small",title:i("documents.workflow"),children:(0,o.jsxs)(y.A,{direction:"vertical",className:"w-full",size:"middle",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"block mb-1",children:i("documents.template")}),(0,o.jsx)(x.A,{className:"w-full",value:N,onChange:M,options:E.map(e=>({label:e.name,value:e.id}))})]}),ep&&(0,o.jsxs)(l.A,{size:"small",type:"inner",title:ep.outputTitle,children:[(0,o.jsx)(H,{children:ep.description}),(0,o.jsxs)(y.A,{wrap:!0,children:[ep.projectRoleConfigId?(0,o.jsx)(g.A,{color:"geekblue",children:(null==(e=_.find(e=>e.id===ep.projectRoleConfigId))?void 0:e.name)||ep.projectRoleConfigId}):(0,o.jsx)(g.A,{color:"warning",children:i("documents.noRoleConfig")}),ep.documentSpecId?(0,o.jsx)(g.A,{color:"cyan",children:(null==(t=q.find(e=>e.id===ep.documentSpecId))?void 0:t.name)||ep.documentSpecId}):null]})]}),ep&&(0,o.jsx)(y.A,{direction:"vertical",size:4,children:(0,o.jsxs)("span",{children:[i("documents.projectRoleConfig"),": ",(null==(n=_.find(e=>e.id===ep.projectRoleConfigId))?void 0:n.name)||i("documents.noRoleConfig")]})}),(0,o.jsx)(d.Ay,{type:"primary",size:"large",block:!0,icon:(0,o.jsx)(I.A,{}),loading:W,disabled:!(null==ep?void 0:ep.projectRoleConfigId),onClick:()=>{eb()},children:i("documents.generate")}),ea.length>0&&(0,o.jsx)(l.A,{size:"small",type:"inner",title:i("documents.executionStatus"),children:(0,o.jsx)(j.A,{direction:"vertical",size:"small",current:ef,items:ea.map(e=>({title:e.title,description:e.description,status:e.status}))})})]})})})]}),(0,o.jsx)(l.A,{size:"small",title:i("documents.editor"),extra:(0,o.jsx)(y.A,{wrap:!0,children:Q&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(R,{}),onClick:()=>{eS()},children:i("documents.saveDraft")}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(z,{}),loading:et,onClick:()=>{ev("markdown")},children:i("documents.downloadMarkdown")}),(0,o.jsx)(d.Ay,{loading:et,onClick:()=>{ev("html")},children:i("documents.exportHtml")}),(0,o.jsx)(d.Ay,{loading:et,onClick:()=>{ev("docx")},children:i("documents.exportDocx")}),(0,o.jsx)(d.Ay,{type:"primary",loading:et,onClick:()=>{ev("pdf")},children:i("documents.exportPdf")})]})}),children:Q?(0,o.jsx)(A.A,{items:[{key:"edit",label:i("documents.edit"),children:(0,o.jsx)(J,{rows:26,value:K,onChange:e=>Y(e.target.value)})},{key:"chapters",label:i("documents.chapters"),children:(0,o.jsx)(m.A,{dataSource:Q.chapters,renderItem:e=>(0,o.jsx)(m.A.Item,{actions:[(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(D.A,{}),loading:eo===e.id,onClick:()=>{eC(e)},children:i("documents.regenerateChapter")},"regen")],children:(0,o.jsx)(m.A.Item.Meta,{title:e.title,description:(0,o.jsxs)(y.A,{direction:"vertical",children:[(0,o.jsxs)("span",{children:[i("documents.evidenceCount"),": ",e.evidence.length]}),(0,o.jsxs)("span",{children:[i("documents.missingCount"),": ",e.missingFacts.length]})]})})})})},{key:"facts",label:i("documents.structuredFacts"),children:(0,o.jsx)(m.A,{dataSource:Q.structuredFacts,renderItem:e=>{var t;return(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)(m.A.Item.Meta,{title:"".concat(e.key,": ").concat(e.value),description:"".concat(e.sourceFile," \xb7 ").concat((null==(t=V.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId)}),(0,o.jsx)(g.A,{children:e.confidence.toFixed(2)})]})}})},{key:"sources",label:i("documents.sources"),children:(0,o.jsx)(m.A,{dataSource:Q.sources,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)("span",{children:e.filePath}),(0,o.jsx)(g.A,{children:e.count})]})})},{key:"missing",label:i("documents.missingItems"),children:0===Q.missingItems.length?(0,o.jsx)(h.A,{description:i("common.noData")}):(0,o.jsx)(m.A,{dataSource:Q.missingItems,renderItem:e=>(0,o.jsx)(m.A.Item,{children:e})})},{key:"validation",label:i("documents.validation"),children:(0,o.jsx)(y.A,{direction:"vertical",className:"w-full",children:Q.validationIssues.map(e=>(0,o.jsxs)(g.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:[e.message,e.suggestion?":".concat(e.suggestion):""]},e.message))})},{key:"gate",label:i("documents.exportGate"),children:(0,o.jsx)(m.A,{dataSource:Q.exportGate.checklist,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)("span",{children:e.label}),(0,o.jsx)(g.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})},{key:"stages",label:i("documents.executionStages"),children:(0,o.jsx)(m.A,{dataSource:Q.executionStages,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)(m.A.Item.Meta,{title:"".concat(e.type," \xb7 ").concat(e.roleId),description:e.message}),(0,o.jsx)(g.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"warning",children:e.status})]})})}]}):(0,o.jsx)(h.A,{description:i("documents.noDraft")})}),(0,o.jsx)(w.A,{maskClosable:!1,title:i("documents.templateEditor"),open:ec,onOk:()=>{ej()},onCancel:()=>ei(!1),width:760,centered:!0,okText:i("common.save"),children:(0,o.jsxs)(r.A,{form:O,layout:"vertical",requiredMark:"optional",children:[(0,o.jsxs)(u.A,{gutter:12,children:[(0,o.jsx)(p.A,{xs:24,md:8,children:(0,o.jsx)(r.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(c.A,{disabled:!0})})}),(0,o.jsx)(p.A,{xs:24,md:8,children:(0,o.jsx)(r.A.Item,{name:"name",label:i("documents.templateName"),rules:[{required:!0}],children:(0,o.jsx)(c.A,{})})}),(0,o.jsx)(p.A,{xs:24,md:8,children:(0,o.jsx)(r.A.Item,{name:"category",label:i("documents.templateCategory"),children:(0,o.jsx)(c.A,{})})}),(0,o.jsx)(p.A,{xs:24,md:12,children:(0,o.jsx)(r.A.Item,{name:"outputTitle",label:i("documents.outputTitle"),children:(0,o.jsx)(c.A,{})})}),(0,o.jsx)(p.A,{xs:24,md:12,children:(0,o.jsx)(r.A.Item,{name:"description",label:i("documents.templateDescription"),children:(0,o.jsx)(c.A,{})})})]}),(0,o.jsx)(r.A.Item,{name:"projectRoleConfigId",label:i("documents.projectRoleConfig"),rules:[{required:!0,message:i("documents.projectRoleConfigRequired")}],children:(0,o.jsx)(x.A,{showSearch:!0,placeholder:i("documents.projectRoleConfigRequired"),options:em})}),(0,o.jsx)(r.A.Item,{name:"documentSpecId",label:i("documents.documentSpec"),children:(0,o.jsx)(x.A,{allowClear:!0,showSearch:!0,placeholder:i("documents.documentSpecPlaceholder"),options:eh})})]})})]})}},2887:(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"}},4995:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"}},6398:(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"}},6403:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return n(1699)}])},6578:(e,t,n)=>{"use strict";async function o(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function s(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function c(e){var t,n;let s=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&s.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&s.set("category",e.category),(null==e?void 0:e.page)&&s.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&s.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(s))}async function i(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function a(e,t){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function r(e,t,n){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function f(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function y(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return o("/api/kb/features")}async function j(e,t){var n,s,c,i,a;let r=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&r.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&r.set("category",t.category),(null==t?void 0:t.limit)&&r.set("limit",String(null!=(a=t.limit)?a:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&r.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(s=t.weights)?void 0:s.vector)!=null&&r.set("vectorWeight",String(t.weights.vector)),(null==t||null==(c=t.weights)?void 0:c.rewrite)!=null&&r.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(i=t.weights)?void 0:i.hybridBonus)!=null&&r.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(r))}async function A(){return o("/api/prompt")}async function w(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function b(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function S(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function k(){return o("/api/documents/specs")}async function I(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(){return o("/api/documents/templates")}async function E(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function R(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function N(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function z(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function D(){return o("/api/documents/drafts")}async function L(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function U(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function J(){return o("/api/config/providers")}async function H(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function M(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function V(){return o("/api/config/models")}async function F(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(){return o("/api/config/embedding")}async function G(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function B(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function W(){return o("/api/system/stats")}async function X(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function Q(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function Z(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function K(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Y(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ee(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>L,Bh:()=>ee,Dl:()=>O,E:()=>K,EK:()=>I,ER:()=>T,FC:()=>W,FV:()=>v,H1:()=>g,H7:()=>m,HC:()=>a,HT:()=>c,II:()=>_,NR:()=>S,OX:()=>N,PH:()=>Z,QT:()=>u,Qx:()=>p,R1:()=>z,SJ:()=>f,UE:()=>U,VW:()=>x,W2:()=>j,X8:()=>y,Z3:()=>J,_m:()=>H,aP:()=>F,bV:()=>P,bZ:()=>B,c1:()=>d,dd:()=>G,dg:()=>b,dw:()=>C,dx:()=>A,h0:()=>R,h1:()=>M,hc:()=>s,hn:()=>X,l2:()=>E,lv:()=>w,mx:()=>k,p:()=>Q,q7:()=>D,tn:()=>r,u6:()=>q,xC:()=>i,xq:()=>h,xw:()=>Y,zo:()=>$,zr:()=>V})},6631:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var o=n(7109),s=n(2887),c=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(c.A,i({},e,{ref:t,icon:s.A})))},8847:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"}},9071:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var o=n(7109),s=n(8847),c=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(c.A,i({},e,{ref:t,icon:s.A})))},9811:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var o=n(7109),s=n(4995),c=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(c.A,i({},e,{ref:t,icon:s.A})))}},e=>{e.O(0,[260,167,382,201,668,227,740,174,492,455,292,846,730,636,593,792],()=>e(e.s=6403)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{1307:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"}},1699:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>M});var o=n(5321),s=n(7109),c=n(4668),i=n(5292),a=n(7807),r=n(3455),l=n(8787),d=n(5114),u=n(2256),p=n(8770),m=n(8332),h=n(4253),f=n(6171),y=n(3442),g=n(1702),x=n(7271),j=n(9730),A=n(8569),w=n(5258),b=n(4746),v=n(3051),S=n(9650),C=n(8209),k=n(6631),I=n(9071),T=n(1307),O=n(8483);function E(){return(E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let R=s.forwardRef((e,t)=>s.createElement(O.A,E({},e,{ref:t,icon:T.A})));var P=n(6398);function N(){return(N=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let z=s.forwardRef((e,t)=>s.createElement(O.A,N({},e,{ref:t,icon:P.A})));var D=n(2192),L=n(6578),U=n(3014);let{TextArea:J}=c.A,{Paragraph:H}=i.A;function M(){var e,t,n;let i=(0,U.Vr)(),{message:T}=a.A.useApp(),[O]=r.A.useForm(),[E,P]=(0,s.useState)([]),[N,M]=(0,s.useState)("construction-organization-design"),[V,F]=(0,s.useState)([]),[_,G]=(0,s.useState)([]),[q,B]=(0,s.useState)([]),[W,X]=(0,s.useState)(!1),[Q,Z]=(0,s.useState)(null),[K,Y]=(0,s.useState)(""),[$,ee]=(0,s.useState)([]),[et,en]=(0,s.useState)(!1),[eo,es]=(0,s.useState)(null),[ec,ei]=(0,s.useState)(!1),[ea,er]=(0,s.useState)([]),[el,ed]=(0,s.useState)(null),eu=async()=>{try{ee((await (0,L.q7)()).drafts)}catch(e){ee([])}};(0,s.useEffect)(()=>{(0,L.Dl)().then(e=>{var t,n;P(e.templates),M(null!=(n=null==(t=e.templates[0])?void 0:t.id)?n:"construction-organization-design")}).catch(()=>T.error(i("common.error"))),(0,L.lv)().then(e=>{F(e.roles),G(e.configs)}).catch(()=>{F([]),G([])}),(0,L.mx)().then(e=>B(e.specs)).catch(()=>B([])),eu()},[T,i]);let ep=(0,s.useMemo)(()=>E.find(e=>e.id===N),[E,N]),em=_.map(e=>({label:e.name,value:e.id})),eh=q.map(e=>({label:e.name,value:e.id})),ef=Math.max(0,ea.findIndex(e=>e.key===el)),ey=(e,t,n)=>{ed(e),er(o=>o.map(o=>o.key===e?{...o,status:t,description:n||o.description}:o))},eg=e=>{er(t=>{let n=t.findIndex(t=>t.key===e);return t.map((e,t)=>t<n&&"error"!==e.status?{...e,status:"finish"}:e)})},ex=e=>{O.setFieldsValue(null!=e?e:{id:"custom-template-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,documentSpecId:void 0,chapters:[]}),ei(!0)},ej=async()=>{try{let e=await O.validateFields(),t=await (0,L.l2)(e);P(t.templates),M(t.template.id),ei(!1),T.success(i("common.success"))}catch(e){e instanceof Error&&T.error(e.message)}},eA=async e=>{try{let t=await (0,L.bV)(e);P(t.templates),M(t.template.id),T.success(i("common.success"))}catch(e){T.error(i("common.error"))}},ew=async e=>{try{var t,n;let o=await (0,L.h0)(e);P(o.templates),M(null!=(n=null==(t=o.templates[0])?void 0:t.id)?n:""),T.success(i("common.success"))}catch(e){T.error(i("common.error"))}},eb=async()=>{if(!N)return;X(!0),er([{key:"prepare",title:i("documents.flowPrepare"),description:i("documents.flowPrepareDesc"),status:"process"},{key:"fact_extraction",title:i("documents.flowFactExtraction"),description:i("documents.flowFactExtractionDesc"),status:"wait"},{key:"chapter_generation",title:i("documents.flowChapterGeneration"),description:i("documents.flowChapterGenerationDesc"),status:"wait"},{key:"validation",title:i("documents.flowValidation"),description:i("documents.flowValidationDesc"),status:"wait"},{key:"formatting",title:i("documents.flowFormatting"),description:i("documents.flowFormattingDesc"),status:"wait"},{key:"done",title:i("documents.flowDone"),description:i("documents.flowDoneDesc"),status:"wait"}]),ed("prepare");let e=[window.setTimeout(()=>{eg("fact_extraction"),ey("fact_extraction","process")},600),window.setTimeout(()=>{eg("chapter_generation"),ey("chapter_generation","process")},1800),window.setTimeout(()=>{eg("validation"),ey("validation","process")},3200),window.setTimeout(()=>{eg("formatting"),ey("formatting","process")},4600)];try{let e=await (0,L.OX)({templateId:N});Z(e.draft),Y(e.draft.markdown),er(t=>t.map(t=>{let n=e.draft.executionStages.find(e=>e.type===t.key);return"prepare"===t.key?{...t,status:"finish",description:i("documents.flowPrepareDone")}:"done"===t.key?{...t,status:e.draft.exportGate.passed?"finish":"error",description:e.draft.exportGate.passed?i("documents.flowDoneDesc"):i("documents.flowGateFailed")}:n?{...t,status:"failed"===n.status?"error":"finish",description:n.message||t.description}:"process"===t.status?{...t,status:"finish"}:t})),ed("done"),T.success(i("common.success"))}catch(e){er(t=>t.map(t=>"process"===t.status?{...t,status:"error",description:e instanceof Error?e.message:i("common.error")}:t)),T.error(e instanceof Error?e.message:i("common.error"))}finally{e.forEach(e=>window.clearTimeout(e)),X(!1)}},ev=async e=>{if(Q){en(!0);try{let s=null==(t=q.find(e=>e.id===(null==ep?void 0:ep.documentSpecId)))?void 0:t.wordTemplatePath;var t,n=await (0,L.UE)({title:Q.title,markdown:K,format:e,enforceGate:"pdf"===e||"docx"===e,exportGate:Q.exportGate,wordTemplatePath:s}),o="".concat(Q.title,".").concat("markdown"===e?"md":e);let c=URL.createObjectURL(n),i=document.createElement("a");i.href=c,i.download=o,i.click(),URL.revokeObjectURL(c)}catch(e){T.error(i("common.error"))}finally{en(!1)}}},eS=async()=>{if(Q)try{let e=await (0,L.Af)({...Q,markdown:K});Z(e.draft),await eu(),T.success(i("common.success"))}catch(e){T.error(i("common.error"))}},eC=async e=>{if(Q){es(e.id);try{var t;let n=await (0,L.R1)({templateId:Q.templateId,chapterId:e.id}),o=Q.chapters.map(t=>t.id===e.id?n.chapter:t);Z({...Q,chapters:o}),t=n.chapter,Y(n=>n.includes(e.content)?n.replace(e.content,t.content):"".concat(n,"\n\n").concat(t.content)),T.success(i("common.success"))}catch(e){T.error(i("common.error"))}finally{es(null)}}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsx)(l.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,o.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle mb-1",children:i("documents.title")}),(0,o.jsx)("p",{className:"pageDesc mb-0",children:i("documents.description")})]}),(0,o.jsx)(d.Ay,{type:"primary",size:"large",icon:(0,o.jsx)(b.A,{}),onClick:()=>ex(),children:i("documents.newTemplate")})]})}),(0,o.jsxs)(u.A,{gutter:[16,16],align:"top",children:[(0,o.jsxs)(p.A,{xs:24,lg:8,children:[(0,o.jsx)(l.A,{size:"small",title:i("documents.templateLibrary"),children:(0,o.jsx)(m.A,{dataSource:E,locale:{emptyText:(0,o.jsx)(h.A,{description:i("common.noData")})},renderItem:e=>(0,o.jsx)(m.A.Item,{onClick:()=>M(e.id),className:"cursor-pointer",actions:[(0,o.jsx)(d.Ay,{size:"small",type:"text",icon:(0,o.jsx)(v.A,{}),onClick:t=>{t.stopPropagation(),eA(e.id)}},"copy"),(0,o.jsx)(d.Ay,{size:"small",type:"text",icon:(0,o.jsx)(S.A,{}),disabled:e.builtIn,onClick:t=>{t.stopPropagation(),ex(e)}},"edit"),(0,o.jsx)(f.A,{title:i("documents.deleteTemplateConfirm"),disabled:e.builtIn,onConfirm:t=>{null==t||t.stopPropagation(),ew(e.id)},children:(0,o.jsx)(d.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(C.A,{}),disabled:e.builtIn,onClick:e=>e.stopPropagation()})},"delete")],children:(0,o.jsx)(m.A.Item.Meta,{avatar:(0,o.jsx)(k.A,{}),title:(0,o.jsxs)(y.A,{children:[(0,o.jsx)("span",{children:e.name}),e.builtIn&&(0,o.jsx)(g.A,{children:i("documents.builtIn")}),N===e.id&&(0,o.jsx)(g.A,{color:"blue",children:i("documents.selected")})]}),description:(0,o.jsxs)(y.A,{direction:"vertical",size:2,children:[(0,o.jsx)("span",{children:e.description}),(0,o.jsx)(g.A,{children:e.category})]})})})})}),(0,o.jsx)(l.A,{className:"mt-4",size:"small",title:i("documents.draftHistory"),children:(0,o.jsx)(m.A,{size:"small",dataSource:$.slice(0,8),locale:{emptyText:(0,o.jsx)(h.A,{description:i("common.noData")})},renderItem:e=>(0,o.jsx)(m.A.Item,{onClick:()=>{Z(e),Y(e.markdown),M(e.templateId)},className:"cursor-pointer",children:(0,o.jsx)(m.A.Item.Meta,{title:e.title,description:new Date(e.updatedAt).toLocaleString()})})})})]}),(0,o.jsx)(p.A,{xs:24,lg:16,children:(0,o.jsx)(l.A,{size:"small",title:i("documents.workflow"),children:(0,o.jsxs)(y.A,{direction:"vertical",className:"w-full",size:"middle",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"block mb-1",children:i("documents.template")}),(0,o.jsx)(x.A,{className:"w-full",value:N,onChange:M,options:E.map(e=>({label:e.name,value:e.id}))})]}),ep&&(0,o.jsxs)(l.A,{size:"small",type:"inner",title:ep.outputTitle,children:[(0,o.jsx)(H,{children:ep.description}),(0,o.jsxs)(y.A,{wrap:!0,children:[ep.projectRoleConfigId?(0,o.jsx)(g.A,{color:"geekblue",children:(null==(e=_.find(e=>e.id===ep.projectRoleConfigId))?void 0:e.name)||ep.projectRoleConfigId}):(0,o.jsx)(g.A,{color:"warning",children:i("documents.noRoleConfig")}),ep.documentSpecId?(0,o.jsx)(g.A,{color:"cyan",children:(null==(t=q.find(e=>e.id===ep.documentSpecId))?void 0:t.name)||ep.documentSpecId}):null]})]}),ep&&(0,o.jsx)(y.A,{direction:"vertical",size:4,children:(0,o.jsxs)("span",{children:[i("documents.projectRoleConfig"),": ",(null==(n=_.find(e=>e.id===ep.projectRoleConfigId))?void 0:n.name)||i("documents.noRoleConfig")]})}),(0,o.jsx)(d.Ay,{type:"primary",size:"large",block:!0,icon:(0,o.jsx)(I.A,{}),loading:W,disabled:!(null==ep?void 0:ep.projectRoleConfigId),onClick:()=>{eb()},children:i("documents.generate")}),ea.length>0&&(0,o.jsx)(l.A,{size:"small",type:"inner",title:i("documents.executionStatus"),children:(0,o.jsx)(j.A,{direction:"vertical",size:"small",current:ef,items:ea.map(e=>({title:e.title,description:e.description,status:e.status}))})})]})})})]}),(0,o.jsx)(l.A,{size:"small",title:i("documents.editor"),extra:(0,o.jsx)(y.A,{wrap:!0,children:Q&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(R,{}),onClick:()=>{eS()},children:i("documents.saveDraft")}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(z,{}),loading:et,onClick:()=>{ev("markdown")},children:i("documents.downloadMarkdown")}),(0,o.jsx)(d.Ay,{loading:et,onClick:()=>{ev("html")},children:i("documents.exportHtml")}),(0,o.jsx)(d.Ay,{loading:et,onClick:()=>{ev("docx")},children:i("documents.exportDocx")}),(0,o.jsx)(d.Ay,{type:"primary",loading:et,onClick:()=>{ev("pdf")},children:i("documents.exportPdf")})]})}),children:Q?(0,o.jsx)(A.A,{items:[{key:"edit",label:i("documents.edit"),children:(0,o.jsx)(J,{rows:26,value:K,onChange:e=>Y(e.target.value)})},{key:"chapters",label:i("documents.chapters"),children:(0,o.jsx)(m.A,{dataSource:Q.chapters,renderItem:e=>(0,o.jsx)(m.A.Item,{actions:[(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(D.A,{}),loading:eo===e.id,onClick:()=>{eC(e)},children:i("documents.regenerateChapter")},"regen")],children:(0,o.jsx)(m.A.Item.Meta,{title:e.title,description:(0,o.jsxs)(y.A,{direction:"vertical",children:[(0,o.jsxs)("span",{children:[i("documents.evidenceCount"),": ",e.evidence.length]}),(0,o.jsxs)("span",{children:[i("documents.missingCount"),": ",e.missingFacts.length]})]})})})})},{key:"facts",label:i("documents.structuredFacts"),children:(0,o.jsx)(m.A,{dataSource:Q.structuredFacts,renderItem:e=>{var t;return(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)(m.A.Item.Meta,{title:"".concat(e.key,": ").concat(e.value),description:"".concat(e.sourceFile," \xb7 ").concat((null==(t=V.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId)}),(0,o.jsx)(g.A,{children:e.confidence.toFixed(2)})]})}})},{key:"sources",label:i("documents.sources"),children:(0,o.jsx)(m.A,{dataSource:Q.sources,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)("span",{children:e.filePath}),(0,o.jsx)(g.A,{children:e.count})]})})},{key:"missing",label:i("documents.missingItems"),children:0===Q.missingItems.length?(0,o.jsx)(h.A,{description:i("common.noData")}):(0,o.jsx)(m.A,{dataSource:Q.missingItems,renderItem:e=>(0,o.jsx)(m.A.Item,{children:e})})},{key:"validation",label:i("documents.validation"),children:(0,o.jsx)(y.A,{direction:"vertical",className:"w-full",children:Q.validationIssues.map(e=>(0,o.jsxs)(g.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:[e.message,e.suggestion?":".concat(e.suggestion):""]},e.message))})},{key:"gate",label:i("documents.exportGate"),children:(0,o.jsx)(m.A,{dataSource:Q.exportGate.checklist,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)("span",{children:e.label}),(0,o.jsx)(g.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})},{key:"stages",label:i("documents.executionStages"),children:(0,o.jsx)(m.A,{dataSource:Q.executionStages,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)(m.A.Item.Meta,{title:"".concat(e.type," \xb7 ").concat(e.roleId),description:e.message}),(0,o.jsx)(g.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"warning",children:e.status})]})})}]}):(0,o.jsx)(h.A,{description:i("documents.noDraft")})}),(0,o.jsx)(w.A,{maskClosable:!1,title:i("documents.templateEditor"),open:ec,onOk:()=>{ej()},onCancel:()=>ei(!1),width:760,centered:!0,okText:i("common.save"),children:(0,o.jsxs)(r.A,{form:O,layout:"vertical",requiredMark:"optional",children:[(0,o.jsxs)(u.A,{gutter:12,children:[(0,o.jsx)(p.A,{xs:24,md:8,children:(0,o.jsx)(r.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(c.A,{disabled:!0})})}),(0,o.jsx)(p.A,{xs:24,md:8,children:(0,o.jsx)(r.A.Item,{name:"name",label:i("documents.templateName"),rules:[{required:!0}],children:(0,o.jsx)(c.A,{})})}),(0,o.jsx)(p.A,{xs:24,md:8,children:(0,o.jsx)(r.A.Item,{name:"category",label:i("documents.templateCategory"),children:(0,o.jsx)(c.A,{})})}),(0,o.jsx)(p.A,{xs:24,md:12,children:(0,o.jsx)(r.A.Item,{name:"outputTitle",label:i("documents.outputTitle"),children:(0,o.jsx)(c.A,{})})}),(0,o.jsx)(p.A,{xs:24,md:12,children:(0,o.jsx)(r.A.Item,{name:"description",label:i("documents.templateDescription"),children:(0,o.jsx)(c.A,{})})})]}),(0,o.jsx)(r.A.Item,{name:"projectRoleConfigId",label:i("documents.projectRoleConfig"),rules:[{required:!0,message:i("documents.projectRoleConfigRequired")}],children:(0,o.jsx)(x.A,{showSearch:!0,placeholder:i("documents.projectRoleConfigRequired"),options:em})}),(0,o.jsx)(r.A.Item,{name:"documentSpecId",label:i("documents.documentSpec"),children:(0,o.jsx)(x.A,{allowClear:!0,showSearch:!0,placeholder:i("documents.documentSpecPlaceholder"),options:eh})})]})})]})}},2192:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var o=n(7109),s=n(4995),c=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(c.A,i({},e,{ref:t,icon:s.A})))},2887:(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"}},4995:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"}},6398:(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"}},6403:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return n(1699)}])},6578:(e,t,n)=>{"use strict";async function o(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function s(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function c(e){var t,n;let s=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&s.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&s.set("category",e.category),(null==e?void 0:e.page)&&s.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&s.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(s))}async function i(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function a(e,t){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function r(e,t,n){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function f(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function y(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return o("/api/kb/features")}async function j(e,t){var n,s,c,i,a;let r=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&r.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&r.set("category",t.category),(null==t?void 0:t.limit)&&r.set("limit",String(null!=(a=t.limit)?a:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&r.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(s=t.weights)?void 0:s.vector)!=null&&r.set("vectorWeight",String(t.weights.vector)),(null==t||null==(c=t.weights)?void 0:c.rewrite)!=null&&r.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(i=t.weights)?void 0:i.hybridBonus)!=null&&r.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(r))}async function A(){return o("/api/prompt")}async function w(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function b(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function S(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function k(){return o("/api/documents/specs")}async function I(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(){return o("/api/documents/templates")}async function E(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function R(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function N(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function z(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function D(){return o("/api/documents/drafts")}async function L(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function U(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function J(){return o("/api/config/providers")}async function H(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function M(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function V(){return o("/api/config/models")}async function F(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(){return o("/api/config/embedding")}async function G(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function B(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function W(){return o("/api/system/stats")}async function X(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function Q(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function Z(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function K(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Y(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ee(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>L,Bh:()=>ee,Dl:()=>O,E:()=>K,EK:()=>I,ER:()=>T,FC:()=>W,FV:()=>v,H1:()=>g,H7:()=>m,HC:()=>a,HT:()=>c,II:()=>_,NR:()=>S,OX:()=>N,PH:()=>Z,QT:()=>u,Qx:()=>p,R1:()=>z,SJ:()=>f,UE:()=>U,VW:()=>x,W2:()=>j,X8:()=>y,Z3:()=>J,_m:()=>H,aP:()=>F,bV:()=>P,bZ:()=>B,c1:()=>d,dd:()=>G,dg:()=>b,dw:()=>C,dx:()=>A,h0:()=>R,h1:()=>M,hc:()=>s,hn:()=>X,l2:()=>E,lv:()=>w,mx:()=>k,p:()=>Q,q7:()=>D,tn:()=>r,u6:()=>q,xC:()=>i,xq:()=>h,xw:()=>Y,zo:()=>$,zr:()=>V})},6631:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var o=n(7109),s=n(2887),c=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(c.A,i({},e,{ref:t,icon:s.A})))},8847:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"}},9071:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var o=n(7109),s=n(8847),c=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(c.A,i({},e,{ref:t,icon:s.A})))}},e=>{e.O(0,[260,167,382,201,668,227,740,174,492,455,292,846,730,636,593,792],()=>e(e.s=6403)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[920],{2548:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>y});var i=l(5321),t=l(5292),c=l(8787),r=l(2256),n=l(8770),d=l(1702),a=l(9730),h=l(3399),x=l(9884),o=l(3241),j=l(1330),p=l(8579),g=l(6926),m=l(7851),u=l(4742),A=l(3014);let{Paragraph:N,Title:k,Text:f}=t.A,v=[{icon:(0,i.jsx)(j.A,{}),title:"准备阶段",color:"blue",items:["配置模型","上传知识库资料","创建提示词"]},{icon:(0,i.jsx)(p.A,{}),title:"编排阶段",color:"purple",items:["创建文件角色","创建提示词角色","创建项目角色配置并排序"]},{icon:(0,i.jsx)(g.A,{}),title:"生成阶段",color:"geekblue",items:["创建模板","执行生成","查看执行状态"]},{icon:(0,i.jsx)(m.A,{}),title:"交付阶段",color:"green",items:["审查事实和来源","检查导出门禁","导出正式文件"]}],b=[{title:"第一步:配置模型",goal:"让系统具备 LLM JSON 事实抽取、章节生成和校验能力。",path:"左侧菜单 → 模型配置",steps:["点击新增供应商,选择 OpenAI、DeepSeek、OpenRouter、Ollama 或其他兼容 OpenAI 协议的服务。","填写 Base URL、API Key、供应商名称并保存。","添加模型名称,建议至少准备一个用于生成和推理的模型。","把模型设置为当前启用模型。","执行健康检查,确认模型可调用。"],checks:["模型健康检查通过","至少有一个启用模型","API Key 和 Base URL 正确"],tips:"如果模型不可用,系统会回退到本地确定性抽取,但事实抽取质量会下降。"},{title:"第二步:上传知识库资料",goal:"把项目资料放入系统,让后续文件角色可以绑定。",path:"左侧菜单 → 知识库 → 文件管理 / 管理",steps:["上传招标文件、工程概况、合同条件、技术要求等项目事实资料。","上传工程量清单、劳动力计划、机械设备计划、材料计划等表格资料。","上传图纸目录、图纸说明、设计说明等图纸类资料。","上传规范、规程、企业标准、评分办法、编制要求等规则类资料。","等待索引完成,并在知识库文件列表中确认文件可见。"],checks:["文件上传成功","索引完成","文件能在文件角色绑定下拉框中看到"],tips:"表格资料最好有清晰表头;图纸资料最好附带目录或文字说明。"},{title:"第三步:创建提示词",goal:"定义每个执行阶段的模型行为。",path:"左侧菜单 → 提示词管理",steps:["创建事实抽取提示词:要求只抽取资料中明确出现的事实,返回结构化 JSON,不允许编造。","创建章节生成提示词:定义文档类型、专业语气、章节风格、引用事实和禁止事项。","创建校验提示词:检查工程名称、工期、质量目标、数字、表格引用、章节完整性。","创建格式化提示词:定义封面、目录、编号、表格、分页和正式输出样式。","保存后确认提示词能在提示词角色绑定下拉框中看到。"],checks:["事实抽取提示词已创建","章节生成提示词已创建","校验或格式化提示词已创建"],tips:"提示词越明确,生成结果越稳定。建议明确写上“没有来源的数据不要写”。"},{title:"第四步:创建文件角色",goal:"告诉系统每个文件在生成流程中的用途。",path:"左侧菜单 → 角色配置 → 新建文件角色",steps:["填写角色名称,例如“招标文件事实源”“工程量清单表格”“图纸说明文件”。","选择处理类型:规则文件、项目事实文件、表格数据、图纸文件、规范文件或参考资料。","绑定对应知识库文件。","保存角色。","按文件用途创建多个文件角色,不建议把不同用途资料混在一个角色里。"],checks:["文件角色有名称","已选择处理类型","已绑定知识库文件"],tips:"处理类型很重要:系统会根据它决定是否进行表格解析、事实抽取、规则引用或来源追踪。"},{title:"第五步:创建提示词角色",goal:"告诉系统每条提示词在哪个执行阶段使用。",path:"左侧菜单 → 角色配置 → 新建提示词角色",steps:["填写角色名称,例如“施工组织设计事实抽取”“章节生成规则”“导出前校验规则”。","选择执行类型:事实抽取、章节生成、校验、格式化或参考。","绑定对应提示词。","保存角色。","一个执行阶段可以有多个提示词角色,后续在项目角色配置中排序。"],checks:["提示词角色有名称","已选择执行类型","已绑定提示词"],tips:"角色名称可以完全自定义,但执行类型必须选对。系统依赖执行类型驱动多阶段流程。"},{title:"第六步:创建项目角色配置并排序",goal:"把文件角色和提示词角色组合成一个可复用的项目生成方案。",path:"左侧菜单 → 角色配置 → 新建项目配置",steps:["填写配置名称,例如“某项目施工组织设计配置”。","添加文件角色,并设置顺序。推荐:规则文件 → 项目事实文件 → 表格数据 → 图纸文件 → 规范文件 → 参考资料。","添加提示词角色,并设置顺序。推荐:事实抽取 → 章节生成 → 校验 → 格式化 → 参考。","保存项目角色配置。","后续模板只绑定项目角色配置,不再重复绑定文件和提示词。"],checks:["至少包含一个文件角色","至少包含一个提示词角色","顺序符合业务流程"],tips:"排序决定系统读取资料和应用提示词的优先级,是生产级生成稳定性的关键。"},{title:"第七步:创建模板并绑定项目配置",goal:"定义要生成哪种文档,以及使用哪套项目角色配置。",path:"左侧菜单 → 生成编辑 → 新建模板",steps:["填写模板 ID。ID 由系统生成或保持唯一,不建议手动频繁修改。","填写模板名称,例如“施工组织设计”“技术标文件”“专项施工方案”。","填写分类、输出标题和模板说明。","选择第六步创建的项目角色配置。","保存模板。"],checks:["模板名称清晰","输出标题正确","已绑定项目角色配置"],tips:"模板负责文档入口;项目角色配置负责资料、提示词和顺序。两者分离后更容易复用。"},{title:"第八步:执行生成并查看状态",goal:"让用户明确知道生成流程进行到哪一步。",path:"左侧菜单 → 生成编辑 → 选择模板 → 点击生成",steps:["点击生成按钮后,页面会出现“执行状态”卡片。","执行状态按顺序展示:准备配置、事实抽取、章节生成、严格校验、正式排版、生成完成。","当前执行节点会高亮显示。","生成完成后,系统会用后端真实 executionStages 回填最终状态。","如果导出门禁未通过,生成完成节点会提示需要检查校验结果。"],checks:["执行状态 Card 出现","当前节点有高亮","生成完成后有执行阶段结果"],tips:"如果长时间停留在某一步,优先检查模型配置、知识库索引和文件角色绑定。"},{title:"第九步:审查结果并导出",goal:"确保文档可追溯、可校验、可交付。",path:"生成编辑 → 编辑器下方 Tabs → 导出按钮",steps:["查看“结构化事实”,确认工程名称、工期、质量目标、施工范围等是否正确。","查看“来源”,确认事实来自绑定资料。","查看“缺失项”,补齐缺失资料或调整角色配置。","查看“严格校验”,处理 error 级问题。","查看“导出门禁”,全部通过后再导出 PDF。","可以先导出 HTML 预览排版,再导出 PDF。"],checks:["无阻断错误","关键事实有来源","章节有证据","导出门禁通过"],tips:"PDF 导出会强制门禁。门禁未通过时,系统会阻止导出,避免问题文档流出。"}];function y(){let e=(0,A.Vr)();return(0,i.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,i.jsxs)(c.A,{className:"cardGlass",styles:{body:{padding:24}},children:[(0,i.jsx)(k,{level:2,className:"mb-2",children:e("guide.title")}),(0,i.jsx)(N,{className:"pageDesc mb-0",children:e("guide.description")})]}),(0,i.jsx)(r.A,{gutter:[16,16],children:v.map(e=>(0,i.jsx)(n.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(c.A,{className:"h-full",title:(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon,e.title]}),children:(0,i.jsx)("div",{className:"space-y-2",children:e.items.map(s=>(0,i.jsx)("div",{children:(0,i.jsx)(d.A,{color:e.color,children:s})},s))})})},e.title))}),(0,i.jsx)(c.A,{title:e("guide.fullFlow"),children:(0,i.jsx)(a.A,{direction:"vertical",items:b.map(e=>({title:e.title,description:"".concat(e.goal,"(入口:").concat(e.path,")")}))})}),(0,i.jsx)(c.A,{title:"详细步骤说明:照着做即可跑通",children:(0,i.jsx)(h.A,{mode:"left",items:b.map(e=>({dot:(0,i.jsx)(u.A,{}),children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(k,{level:4,className:"mb-0",children:e.title}),(0,i.jsxs)(N,{children:[(0,i.jsx)(f,{strong:!0,children:"目标:"}),e.goal]}),(0,i.jsxs)(N,{children:[(0,i.jsx)(f,{strong:!0,children:"入口:"}),e.path]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f,{strong:!0,children:"操作步骤:"}),(0,i.jsx)("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:e.steps.map(e=>(0,i.jsx)("li",{children:e},e))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f,{strong:!0,children:"完成检查:"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:e.checks.map(e=>(0,i.jsx)(d.A,{color:"success",children:e},e))})]}),(0,i.jsxs)(N,{children:[(0,i.jsx)(f,{strong:!0,children:"提示:"}),e.tips]}),(0,i.jsx)(x.A,{})]})}))})}),(0,i.jsxs)(r.A,{gutter:[16,16],children:[(0,i.jsx)(n.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{title:e("guide.roleDesign"),children:[(0,i.jsx)(N,{children:e("guide.roleDesignDesc")}),(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(d.A,{color:"blue",children:"file"}),(0,i.jsx)(f,{strong:!0,children:e("guide.fileRole")}),(0,i.jsx)(N,{children:e("guide.fileRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(d.A,{color:"purple",children:"prompt"}),(0,i.jsx)(f,{strong:!0,children:e("guide.promptRole")}),(0,i.jsx)(N,{children:e("guide.promptRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(d.A,{color:"geekblue",children:"config"}),(0,i.jsx)(f,{strong:!0,children:e("guide.projectConfig")}),(0,i.jsx)(N,{children:e("guide.projectConfigDesc")})]})]})]})}),(0,i.jsx)(n.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{title:e("guide.generationEngine"),children:[(0,i.jsx)(N,{children:e("guide.generationEngineDesc")}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(d.A,{children:e("roles.factExtraction")}),(0,i.jsx)(d.A,{children:e("roles.chapterGeneration")}),(0,i.jsx)(d.A,{children:e("roles.validation")}),(0,i.jsx)(d.A,{children:e("roles.formatting")}),(0,i.jsx)(d.A,{children:e("documents.exportGate")})]})]})})]}),(0,i.jsx)(c.A,{title:"推荐资料清单",children:(0,i.jsxs)(r.A,{gutter:[16,16],children:[(0,i.jsx)(n.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"必备资料",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"项目事实文件"}),(0,i.jsx)("li",{children:"招标或编制规则"}),(0,i.jsx)("li",{children:"章节生成提示词"})]})})}),(0,i.jsx)(n.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"强烈建议",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"表格数据"}),(0,i.jsx)("li",{children:"图纸说明"}),(0,i.jsx)("li",{children:"规范或企业标准"})]})})}),(0,i.jsx)(n.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"导出前确认",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"无 error 校验"}),(0,i.jsx)("li",{children:"事实有来源"}),(0,i.jsx)("li",{children:"导出门禁通过"})]})})})]})}),(0,i.jsx)(o.A,{items:[{key:"prepare",label:e("guide.prepareTitle"),children:(0,i.jsx)(N,{children:e("guide.prepareContent")})},{key:"roles",label:e("guide.rolesTitle"),children:(0,i.jsx)(N,{children:e("guide.rolesContent")})},{key:"template",label:e("guide.templateTitle"),children:(0,i.jsx)(N,{children:e("guide.templateContent")})},{key:"generate",label:e("guide.generateTitle"),children:(0,i.jsx)(N,{children:e("guide.generateContent")})},{key:"qa",label:e("guide.qaTitle"),children:(0,i.jsx)(N,{children:e("guide.qaContent")})}]})]})}},4899:(e,s,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/guide",function(){return l(2548)}])}},e=>{e.O(0,[260,167,382,292,228,845,636,593,792],()=>e(e.s=4899)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[920],{2548:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>y});var i=l(5321),t=l(5292),c=l(8787),r=l(2256),n=l(8770),d=l(1702),a=l(9730),h=l(3399),x=l(9884),o=l(3241),j=l(1330),p=l(8579),g=l(6926),m=l(7851),u=l(4742),A=l(3014);let{Paragraph:N,Title:k,Text:f}=t.A,v=[{icon:(0,i.jsx)(j.A,{}),title:"准备阶段",color:"blue",items:["配置模型","上传知识库资料","创建提示词"]},{icon:(0,i.jsx)(p.A,{}),title:"编排阶段",color:"purple",items:["创建文件角色","创建提示词角色","创建项目角色配置并排序"]},{icon:(0,i.jsx)(g.A,{}),title:"生成阶段",color:"geekblue",items:["创建模板","执行生成","查看执行状态"]},{icon:(0,i.jsx)(m.A,{}),title:"交付阶段",color:"green",items:["审查事实和来源","检查导出门禁","导出正式文件"]}],b=[{title:"第一步:配置模型",goal:"让系统具备 LLM JSON 事实抽取、章节生成和校验能力。",path:"左侧菜单 → 模型配置",steps:["点击新增供应商,选择 OpenAI、DeepSeek、OpenRouter、Ollama 或其他兼容 OpenAI 协议的服务。","填写 Base URL、API Key、供应商名称并保存。","添加模型名称,建议至少准备一个用于生成和推理的模型。","把模型设置为当前启用模型。","执行健康检查,确认模型可调用。"],checks:["模型健康检查通过","至少有一个启用模型","API Key 和 Base URL 正确"],tips:"如果模型不可用,系统会回退到本地确定性抽取,但事实抽取质量会下降。"},{title:"第二步:上传知识库资料",goal:"把项目资料放入系统,让后续文件角色可以绑定。",path:"左侧菜单 → 知识库 → 文件管理 / 管理",steps:["上传招标文件、工程概况、合同条件、技术要求等项目事实资料。","上传工程量清单、劳动力计划、机械设备计划、材料计划等表格资料。","上传图纸目录、图纸说明、设计说明等图纸类资料。","上传规范、规程、企业标准、评分办法、编制要求等规则类资料。","等待索引完成,并在知识库文件列表中确认文件可见。"],checks:["文件上传成功","索引完成","文件能在文件角色绑定下拉框中看到"],tips:"表格资料最好有清晰表头;图纸资料最好附带目录或文字说明。"},{title:"第三步:创建提示词",goal:"定义每个执行阶段的模型行为。",path:"左侧菜单 → 提示词管理",steps:["创建事实抽取提示词:要求只抽取资料中明确出现的事实,返回结构化 JSON,不允许编造。","创建章节生成提示词:定义文档类型、专业语气、章节风格、引用事实和禁止事项。","创建校验提示词:检查工程名称、工期、质量目标、数字、表格引用、章节完整性。","创建格式化提示词:定义封面、目录、编号、表格、分页和正式输出样式。","保存后确认提示词能在提示词角色绑定下拉框中看到。"],checks:["事实抽取提示词已创建","章节生成提示词已创建","校验或格式化提示词已创建"],tips:"提示词越明确,生成结果越稳定。建议明确写上“没有来源的数据不要写”。"},{title:"第四步:创建文件角色",goal:"告诉系统每个文件在生成流程中的用途。",path:"左侧菜单 → 角色配置 → 新建文件角色",steps:["填写角色名称,例如“招标文件事实源”“工程量清单表格”“图纸说明文件”。","选择处理类型:规则文件、项目事实文件、表格数据、图纸文件、规范文件或参考资料。","绑定对应知识库文件。","保存角色。","按文件用途创建多个文件角色,不建议把不同用途资料混在一个角色里。"],checks:["文件角色有名称","已选择处理类型","已绑定知识库文件"],tips:"处理类型很重要:系统会根据它决定是否进行表格解析、事实抽取、规则引用或来源追踪。"},{title:"第五步:创建提示词角色",goal:"告诉系统每条提示词在哪个执行阶段使用。",path:"左侧菜单 → 角色配置 → 新建提示词角色",steps:["填写角色名称,例如“施工组织设计事实抽取”“章节生成规则”“导出前校验规则”。","选择执行类型:事实抽取、章节生成、校验、格式化或参考。","绑定对应提示词。","保存角色。","一个执行阶段可以有多个提示词角色,后续在项目角色配置中排序。"],checks:["提示词角色有名称","已选择执行类型","已绑定提示词"],tips:"角色名称可以完全自定义,但执行类型必须选对。系统依赖执行类型驱动多阶段流程。"},{title:"第六步:创建项目角色配置并排序",goal:"把文件角色和提示词角色组合成一个可复用的项目生成方案。",path:"左侧菜单 → 角色配置 → 新建项目配置",steps:["填写配置名称,例如“某项目施工组织设计配置”。","添加文件角色,并设置顺序。推荐:规则文件 → 项目事实文件 → 表格数据 → 图纸文件 → 规范文件 → 参考资料。","添加提示词角色,并设置顺序。推荐:事实抽取 → 章节生成 → 校验 → 格式化 → 参考。","保存项目角色配置。","后续模板只绑定项目角色配置,不再重复绑定文件和提示词。"],checks:["至少包含一个文件角色","至少包含一个提示词角色","顺序符合业务流程"],tips:"排序决定系统读取资料和应用提示词的优先级,是生产级生成稳定性的关键。"},{title:"第七步:创建模板并绑定项目配置",goal:"定义要生成哪种文档,以及使用哪套项目角色配置。",path:"左侧菜单 → 生成编辑 → 新建模板",steps:["填写模板 ID。ID 由系统生成或保持唯一,不建议手动频繁修改。","填写模板名称,例如“施工组织设计”“技术标文件”“专项施工方案”。","填写分类、输出标题和模板说明。","选择第六步创建的项目角色配置。","保存模板。"],checks:["模板名称清晰","输出标题正确","已绑定项目角色配置"],tips:"模板负责文档入口;项目角色配置负责资料、提示词和顺序。两者分离后更容易复用。"},{title:"第八步:执行生成并查看状态",goal:"让用户明确知道生成流程进行到哪一步。",path:"左侧菜单 → 生成编辑 → 选择模板 → 点击生成",steps:["点击生成按钮后,页面会出现“执行状态”卡片。","执行状态按顺序展示:准备配置、事实抽取、章节生成、严格校验、正式排版、生成完成。","当前执行节点会高亮显示。","生成完成后,系统会用后端真实 executionStages 回填最终状态。","如果导出门禁未通过,生成完成节点会提示需要检查校验结果。"],checks:["执行状态 Card 出现","当前节点有高亮","生成完成后有执行阶段结果"],tips:"如果长时间停留在某一步,优先检查模型配置、知识库索引和文件角色绑定。"},{title:"第九步:审查结果并导出",goal:"确保文档可追溯、可校验、可交付。",path:"生成编辑 → 编辑器下方 Tabs → 导出按钮",steps:["查看“结构化事实”,确认工程名称、工期、质量目标、施工范围等是否正确。","查看“来源”,确认事实来自绑定资料。","查看“缺失项”,补齐缺失资料或调整角色配置。","查看“严格校验”,处理 error 级问题。","查看“导出门禁”,全部通过后再导出 PDF。","可以先导出 HTML 预览排版,再导出 PDF。"],checks:["无阻断错误","关键事实有来源","章节有证据","导出门禁通过"],tips:"PDF 导出会强制门禁。门禁未通过时,系统会阻止导出,避免问题文档流出。"}];function y(){let e=(0,A.Vr)();return(0,i.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,i.jsxs)(c.A,{className:"cardGlass",styles:{body:{padding:24}},children:[(0,i.jsx)(k,{level:2,className:"mb-2",children:e("guide.title")}),(0,i.jsx)(N,{className:"pageDesc mb-0",children:e("guide.description")})]}),(0,i.jsx)(r.A,{gutter:[16,16],children:v.map(e=>(0,i.jsx)(n.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(c.A,{className:"h-full",title:(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon,e.title]}),children:(0,i.jsx)("div",{className:"space-y-2",children:e.items.map(s=>(0,i.jsx)("div",{children:(0,i.jsx)(d.A,{color:e.color,children:s})},s))})})},e.title))}),(0,i.jsx)(c.A,{title:e("guide.fullFlow"),children:(0,i.jsx)(a.A,{direction:"vertical",items:b.map(e=>({title:e.title,description:"".concat(e.goal,"(入口:").concat(e.path,")")}))})}),(0,i.jsx)(c.A,{title:"详细步骤说明:照着做即可跑通",children:(0,i.jsx)(h.A,{mode:"left",items:b.map(e=>({dot:(0,i.jsx)(u.A,{}),children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(k,{level:4,className:"mb-0",children:e.title}),(0,i.jsxs)(N,{children:[(0,i.jsx)(f,{strong:!0,children:"目标:"}),e.goal]}),(0,i.jsxs)(N,{children:[(0,i.jsx)(f,{strong:!0,children:"入口:"}),e.path]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f,{strong:!0,children:"操作步骤:"}),(0,i.jsx)("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:e.steps.map(e=>(0,i.jsx)("li",{children:e},e))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f,{strong:!0,children:"完成检查:"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:e.checks.map(e=>(0,i.jsx)(d.A,{color:"success",children:e},e))})]}),(0,i.jsxs)(N,{children:[(0,i.jsx)(f,{strong:!0,children:"提示:"}),e.tips]}),(0,i.jsx)(x.A,{})]})}))})}),(0,i.jsxs)(r.A,{gutter:[16,16],children:[(0,i.jsx)(n.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{title:e("guide.roleDesign"),children:[(0,i.jsx)(N,{children:e("guide.roleDesignDesc")}),(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(d.A,{color:"blue",children:"file"}),(0,i.jsx)(f,{strong:!0,children:e("guide.fileRole")}),(0,i.jsx)(N,{children:e("guide.fileRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(d.A,{color:"purple",children:"prompt"}),(0,i.jsx)(f,{strong:!0,children:e("guide.promptRole")}),(0,i.jsx)(N,{children:e("guide.promptRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(d.A,{color:"geekblue",children:"config"}),(0,i.jsx)(f,{strong:!0,children:e("guide.projectConfig")}),(0,i.jsx)(N,{children:e("guide.projectConfigDesc")})]})]})]})}),(0,i.jsx)(n.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{title:e("guide.generationEngine"),children:[(0,i.jsx)(N,{children:e("guide.generationEngineDesc")}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(d.A,{children:e("roles.factExtraction")}),(0,i.jsx)(d.A,{children:e("roles.chapterGeneration")}),(0,i.jsx)(d.A,{children:e("roles.validation")}),(0,i.jsx)(d.A,{children:e("roles.formatting")}),(0,i.jsx)(d.A,{children:e("documents.exportGate")})]})]})})]}),(0,i.jsx)(c.A,{title:"推荐资料清单",children:(0,i.jsxs)(r.A,{gutter:[16,16],children:[(0,i.jsx)(n.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"必备资料",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"项目事实文件"}),(0,i.jsx)("li",{children:"招标或编制规则"}),(0,i.jsx)("li",{children:"章节生成提示词"})]})})}),(0,i.jsx)(n.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"强烈建议",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"表格数据"}),(0,i.jsx)("li",{children:"图纸说明"}),(0,i.jsx)("li",{children:"规范或企业标准"})]})})}),(0,i.jsx)(n.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"导出前确认",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"无 error 校验"}),(0,i.jsx)("li",{children:"事实有来源"}),(0,i.jsx)("li",{children:"导出门禁通过"})]})})})]})}),(0,i.jsx)(o.A,{items:[{key:"prepare",label:e("guide.prepareTitle"),children:(0,i.jsx)(N,{children:e("guide.prepareContent")})},{key:"roles",label:e("guide.rolesTitle"),children:(0,i.jsx)(N,{children:e("guide.rolesContent")})},{key:"template",label:e("guide.templateTitle"),children:(0,i.jsx)(N,{children:e("guide.templateContent")})},{key:"generate",label:e("guide.generateTitle"),children:(0,i.jsx)(N,{children:e("guide.generateContent")})},{key:"qa",label:e("guide.qaTitle"),children:(0,i.jsx)(N,{children:e("guide.qaContent")})}]})]})}},4899:(e,s,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/guide",function(){return l(2548)}])}},e=>{e.O(0,[260,167,382,292,730,804,636,593,792],()=>e(e.s=4899)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[920],{2548:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>y});var i=l(5321),t=l(5292),c=l(8787),r=l(2256),n=l(8770),d=l(1702),a=l(9730),h=l(3399),x=l(5122),o=l(3241),j=l(1330),p=l(8579),g=l(6926),m=l(7851),u=l(4742),A=l(3014);let{Paragraph:N,Title:k,Text:f}=t.A,v=[{icon:(0,i.jsx)(j.A,{}),title:"准备阶段",color:"blue",items:["配置模型","上传知识库资料","创建提示词"]},{icon:(0,i.jsx)(p.A,{}),title:"编排阶段",color:"purple",items:["创建文件角色","创建提示词角色","创建项目角色配置并排序"]},{icon:(0,i.jsx)(g.A,{}),title:"生成阶段",color:"geekblue",items:["创建模板","执行生成","查看执行状态"]},{icon:(0,i.jsx)(m.A,{}),title:"交付阶段",color:"green",items:["审查事实和来源","检查导出门禁","导出正式文件"]}],b=[{title:"第一步:配置模型",goal:"让系统具备 LLM JSON 事实抽取、章节生成和校验能力。",path:"左侧菜单 → 模型配置",steps:["点击新增供应商,选择 OpenAI、DeepSeek、OpenRouter、Ollama 或其他兼容 OpenAI 协议的服务。","填写 Base URL、API Key、供应商名称并保存。","添加模型名称,建议至少准备一个用于生成和推理的模型。","把模型设置为当前启用模型。","执行健康检查,确认模型可调用。"],checks:["模型健康检查通过","至少有一个启用模型","API Key 和 Base URL 正确"],tips:"如果模型不可用,系统会回退到本地确定性抽取,但事实抽取质量会下降。"},{title:"第二步:上传知识库资料",goal:"把项目资料放入系统,让后续文件角色可以绑定。",path:"左侧菜单 → 知识库 → 文件管理 / 管理",steps:["上传招标文件、工程概况、合同条件、技术要求等项目事实资料。","上传工程量清单、劳动力计划、机械设备计划、材料计划等表格资料。","上传图纸目录、图纸说明、设计说明等图纸类资料。","上传规范、规程、企业标准、评分办法、编制要求等规则类资料。","等待索引完成,并在知识库文件列表中确认文件可见。"],checks:["文件上传成功","索引完成","文件能在文件角色绑定下拉框中看到"],tips:"表格资料最好有清晰表头;图纸资料最好附带目录或文字说明。"},{title:"第三步:创建提示词",goal:"定义每个执行阶段的模型行为。",path:"左侧菜单 → 提示词管理",steps:["创建事实抽取提示词:要求只抽取资料中明确出现的事实,返回结构化 JSON,不允许编造。","创建章节生成提示词:定义文档类型、专业语气、章节风格、引用事实和禁止事项。","创建校验提示词:检查工程名称、工期、质量目标、数字、表格引用、章节完整性。","创建格式化提示词:定义封面、目录、编号、表格、分页和正式输出样式。","保存后确认提示词能在提示词角色绑定下拉框中看到。"],checks:["事实抽取提示词已创建","章节生成提示词已创建","校验或格式化提示词已创建"],tips:"提示词越明确,生成结果越稳定。建议明确写上“没有来源的数据不要写”。"},{title:"第四步:创建文件角色",goal:"告诉系统每个文件在生成流程中的用途。",path:"左侧菜单 → 角色配置 → 新建文件角色",steps:["填写角色名称,例如“招标文件事实源”“工程量清单表格”“图纸说明文件”。","选择处理类型:规则文件、项目事实文件、表格数据、图纸文件、规范文件或参考资料。","绑定对应知识库文件。","保存角色。","按文件用途创建多个文件角色,不建议把不同用途资料混在一个角色里。"],checks:["文件角色有名称","已选择处理类型","已绑定知识库文件"],tips:"处理类型很重要:系统会根据它决定是否进行表格解析、事实抽取、规则引用或来源追踪。"},{title:"第五步:创建提示词角色",goal:"告诉系统每条提示词在哪个执行阶段使用。",path:"左侧菜单 → 角色配置 → 新建提示词角色",steps:["填写角色名称,例如“施工组织设计事实抽取”“章节生成规则”“导出前校验规则”。","选择执行类型:事实抽取、章节生成、校验、格式化或参考。","绑定对应提示词。","保存角色。","一个执行阶段可以有多个提示词角色,后续在项目角色配置中排序。"],checks:["提示词角色有名称","已选择执行类型","已绑定提示词"],tips:"角色名称可以完全自定义,但执行类型必须选对。系统依赖执行类型驱动多阶段流程。"},{title:"第六步:创建项目角色配置并排序",goal:"把文件角色和提示词角色组合成一个可复用的项目生成方案。",path:"左侧菜单 → 角色配置 → 新建项目配置",steps:["填写配置名称,例如“某项目施工组织设计配置”。","添加文件角色,并设置顺序。推荐:规则文件 → 项目事实文件 → 表格数据 → 图纸文件 → 规范文件 → 参考资料。","添加提示词角色,并设置顺序。推荐:事实抽取 → 章节生成 → 校验 → 格式化 → 参考。","保存项目角色配置。","后续模板只绑定项目角色配置,不再重复绑定文件和提示词。"],checks:["至少包含一个文件角色","至少包含一个提示词角色","顺序符合业务流程"],tips:"排序决定系统读取资料和应用提示词的优先级,是生产级生成稳定性的关键。"},{title:"第七步:创建模板并绑定项目配置",goal:"定义要生成哪种文档,以及使用哪套项目角色配置。",path:"左侧菜单 → 生成编辑 → 新建模板",steps:["填写模板 ID。ID 由系统生成或保持唯一,不建议手动频繁修改。","填写模板名称,例如“施工组织设计”“技术标文件”“专项施工方案”。","填写分类、输出标题和模板说明。","选择第六步创建的项目角色配置。","保存模板。"],checks:["模板名称清晰","输出标题正确","已绑定项目角色配置"],tips:"模板负责文档入口;项目角色配置负责资料、提示词和顺序。两者分离后更容易复用。"},{title:"第八步:执行生成并查看状态",goal:"让用户明确知道生成流程进行到哪一步。",path:"左侧菜单 → 生成编辑 → 选择模板 → 点击生成",steps:["点击生成按钮后,页面会出现“执行状态”卡片。","执行状态按顺序展示:准备配置、事实抽取、章节生成、严格校验、正式排版、生成完成。","当前执行节点会高亮显示。","生成完成后,系统会用后端真实 executionStages 回填最终状态。","如果导出门禁未通过,生成完成节点会提示需要检查校验结果。"],checks:["执行状态 Card 出现","当前节点有高亮","生成完成后有执行阶段结果"],tips:"如果长时间停留在某一步,优先检查模型配置、知识库索引和文件角色绑定。"},{title:"第九步:审查结果并导出",goal:"确保文档可追溯、可校验、可交付。",path:"生成编辑 → 编辑器下方 Tabs → 导出按钮",steps:["查看“结构化事实”,确认工程名称、工期、质量目标、施工范围等是否正确。","查看“来源”,确认事实来自绑定资料。","查看“缺失项”,补齐缺失资料或调整角色配置。","查看“严格校验”,处理 error 级问题。","查看“导出门禁”,全部通过后再导出 PDF。","可以先导出 HTML 预览排版,再导出 PDF。"],checks:["无阻断错误","关键事实有来源","章节有证据","导出门禁通过"],tips:"PDF 导出会强制门禁。门禁未通过时,系统会阻止导出,避免问题文档流出。"}];function y(){let e=(0,A.Vr)();return(0,i.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,i.jsxs)(c.A,{className:"cardGlass",styles:{body:{padding:24}},children:[(0,i.jsx)(k,{level:2,className:"mb-2",children:e("guide.title")}),(0,i.jsx)(N,{className:"pageDesc mb-0",children:e("guide.description")})]}),(0,i.jsx)(r.A,{gutter:[16,16],children:v.map(e=>(0,i.jsx)(n.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(c.A,{className:"h-full",title:(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon,e.title]}),children:(0,i.jsx)("div",{className:"space-y-2",children:e.items.map(s=>(0,i.jsx)("div",{children:(0,i.jsx)(d.A,{color:e.color,children:s})},s))})})},e.title))}),(0,i.jsx)(c.A,{title:e("guide.fullFlow"),children:(0,i.jsx)(a.A,{direction:"vertical",items:b.map(e=>({title:e.title,description:"".concat(e.goal,"(入口:").concat(e.path,")")}))})}),(0,i.jsx)(c.A,{title:"详细步骤说明:照着做即可跑通",children:(0,i.jsx)(h.A,{mode:"left",items:b.map(e=>({dot:(0,i.jsx)(u.A,{}),children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(k,{level:4,className:"mb-0",children:e.title}),(0,i.jsxs)(N,{children:[(0,i.jsx)(f,{strong:!0,children:"目标:"}),e.goal]}),(0,i.jsxs)(N,{children:[(0,i.jsx)(f,{strong:!0,children:"入口:"}),e.path]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f,{strong:!0,children:"操作步骤:"}),(0,i.jsx)("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:e.steps.map(e=>(0,i.jsx)("li",{children:e},e))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f,{strong:!0,children:"完成检查:"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:e.checks.map(e=>(0,i.jsx)(d.A,{color:"success",children:e},e))})]}),(0,i.jsxs)(N,{children:[(0,i.jsx)(f,{strong:!0,children:"提示:"}),e.tips]}),(0,i.jsx)(x.A,{})]})}))})}),(0,i.jsxs)(r.A,{gutter:[16,16],children:[(0,i.jsx)(n.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{title:e("guide.roleDesign"),children:[(0,i.jsx)(N,{children:e("guide.roleDesignDesc")}),(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(d.A,{color:"blue",children:"file"}),(0,i.jsx)(f,{strong:!0,children:e("guide.fileRole")}),(0,i.jsx)(N,{children:e("guide.fileRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(d.A,{color:"purple",children:"prompt"}),(0,i.jsx)(f,{strong:!0,children:e("guide.promptRole")}),(0,i.jsx)(N,{children:e("guide.promptRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(d.A,{color:"geekblue",children:"config"}),(0,i.jsx)(f,{strong:!0,children:e("guide.projectConfig")}),(0,i.jsx)(N,{children:e("guide.projectConfigDesc")})]})]})]})}),(0,i.jsx)(n.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{title:e("guide.generationEngine"),children:[(0,i.jsx)(N,{children:e("guide.generationEngineDesc")}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(d.A,{children:e("roles.factExtraction")}),(0,i.jsx)(d.A,{children:e("roles.chapterGeneration")}),(0,i.jsx)(d.A,{children:e("roles.validation")}),(0,i.jsx)(d.A,{children:e("roles.formatting")}),(0,i.jsx)(d.A,{children:e("documents.exportGate")})]})]})})]}),(0,i.jsx)(c.A,{title:"推荐资料清单",children:(0,i.jsxs)(r.A,{gutter:[16,16],children:[(0,i.jsx)(n.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"必备资料",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"项目事实文件"}),(0,i.jsx)("li",{children:"招标或编制规则"}),(0,i.jsx)("li",{children:"章节生成提示词"})]})})}),(0,i.jsx)(n.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"强烈建议",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"表格数据"}),(0,i.jsx)("li",{children:"图纸说明"}),(0,i.jsx)("li",{children:"规范或企业标准"})]})})}),(0,i.jsx)(n.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"导出前确认",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"无 error 校验"}),(0,i.jsx)("li",{children:"事实有来源"}),(0,i.jsx)("li",{children:"导出门禁通过"})]})})})]})}),(0,i.jsx)(o.A,{items:[{key:"prepare",label:e("guide.prepareTitle"),children:(0,i.jsx)(N,{children:e("guide.prepareContent")})},{key:"roles",label:e("guide.rolesTitle"),children:(0,i.jsx)(N,{children:e("guide.rolesContent")})},{key:"template",label:e("guide.templateTitle"),children:(0,i.jsx)(N,{children:e("guide.templateContent")})},{key:"generate",label:e("guide.generateTitle"),children:(0,i.jsx)(N,{children:e("guide.generateContent")})},{key:"qa",label:e("guide.qaTitle"),children:(0,i.jsx)(N,{children:e("guide.qaContent")})}]})]})}},4899:(e,s,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/guide",function(){return l(2548)}])}},e=>{e.O(0,[260,167,382,292,730,804,636,593,792],()=>e(e.s=4899)),_N_E=e.O()}]);