@customize-agent/server 3.0.29 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +186 -188
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/chunks/774.js +1 -1
- package/.next/server/chunks/8204.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/api/kb/files.js +2 -2
- package/.next/server/pages/api/kb/operations.js +2 -2
- package/.next/server/pages/api/kb/upload.js +2 -2
- package/.next/server/pages/asset-library.html +1 -1
- package/.next/server/pages/context/long-term.html +1 -1
- package/.next/server/pages/context/short-term.html +1 -1
- package/.next/server/pages/document-roles.html +1 -1
- package/.next/server/pages/document-specs.html +1 -1
- package/.next/server/pages/documents.html +1 -1
- package/.next/server/pages/guide.html +1 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/file-detail.js.nft.json +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/search.html +1 -1
- package/.next/server/pages/knowledge.html +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages/prompt.html +1 -1
- package/.next/server/pages/settings.html +1 -1
- package/.next/server/pages/system/logs.html +1 -1
- package/.next/server/pages-manifest.json +23 -23
- package/.next/static/Qg6HhehDEGMR0UQnE32Qh/_buildManifest.js +1 -0
- package/.next/static/chunks/{9382-2be85f64a2a04466.js → 1210-248760e61b298769.js} +6 -3
- package/.next/static/chunks/1289-ada402215e8934cc.js +38 -0
- package/.next/static/chunks/1515-051d4383493143c9.js +1 -0
- package/.next/static/chunks/2073-244191fe7cc6e330.js +4 -0
- package/.next/static/chunks/2169-61474562e3e8475e.js +1 -0
- package/.next/static/chunks/2427-1f06499470a4acd3.js +1 -0
- package/.next/static/chunks/{2700-03ae5530fdc95014.js → 2700-1fbf324dcb6a552a.js} +1 -1
- package/.next/static/chunks/4052-9caaaa494d67a7e0.js +1 -0
- package/.next/static/chunks/4123-905de4c001b14351.js +4 -0
- package/.next/static/chunks/{4260-18140c66386111a7.js → 4260-46debd1ad52f4fde.js} +2 -2
- package/.next/static/chunks/4277-ba039fcf8f4e9cdc.js +1 -0
- package/.next/static/chunks/{1054-0bc42843b140e120.js → 4427-302c5267a1f8493e.js} +1 -1
- package/.next/static/chunks/{4696-8675ea601a3cf725.js → 4696-5a425ced63368f89.js} +1 -1
- package/.next/static/chunks/4976-2d6f56260b2ddff9.js +1 -0
- package/.next/static/chunks/{5292-860654c8ecbfa554.js → 5292-e65eab4f54b9f7ff.js} +1 -1
- package/.next/static/chunks/5695-7c19c1352a381c69.js +6 -0
- package/.next/static/chunks/5938-da5d441b981ec422.js +1 -0
- package/.next/static/chunks/6506-9d3cdc1ea816d7c4.js +1 -0
- package/.next/static/chunks/{6985-c62a7a9c8c9ce25d.js → 6985-29200efa04920cb3.js} +1 -1
- package/.next/static/chunks/7150-123ff059dd0e2eb9.js +41 -0
- package/.next/static/chunks/7576-c41e699f2110b989.js +1 -0
- package/.next/static/chunks/7888-7b28d859128998a2.js +1 -0
- package/.next/static/chunks/7889-8531b79751a71e39.js +1 -0
- package/.next/static/chunks/{8332-df14c832a569ee70.js → 8332-b27e9ac89c517608.js} +1 -1
- package/.next/static/chunks/8449-641d34b05c795c85.js +8 -0
- package/.next/static/chunks/{861-91cbdd34b8e23151.js → 861-dd60ef688592115e.js} +1 -1
- package/.next/static/chunks/8932-e1bb3137986c259a.js +1 -0
- package/.next/static/chunks/9189-03f286defdb92816.js +10 -0
- package/.next/static/chunks/9551-0bb7ba56a79b7cd7.js +16 -0
- package/.next/static/chunks/{9958-4f828ecf03e2f16c.js → 9958-af48a40832894bb6.js} +1 -1
- package/.next/static/chunks/9978-3df3ef9c76cee8b8.js +1 -0
- package/.next/static/chunks/pages/{_app-d769a06b2dd2bbe2.js → _app-78551e7d4385884b.js} +13 -13
- package/.next/static/chunks/pages/asset-library-0665e1c9afd893f0.js +1 -0
- package/.next/static/chunks/pages/context/{long-term-3b59c9386df2b218.js → long-term-1f59d30548b89c31.js} +1 -1
- package/.next/static/chunks/pages/context/{short-term-b1ab1b56112896bf.js → short-term-851f8aee7b0abff1.js} +1 -1
- package/.next/static/chunks/pages/document-roles-14631ba08e2f829f.js +1 -0
- package/.next/static/chunks/pages/document-specs-afd35d3937f2cadb.js +1 -0
- package/.next/static/chunks/pages/documents-2b15480b93097015.js +1 -0
- package/.next/static/chunks/pages/{guide-8cee9c05d4b3e9ec.js → guide-34569e4ab4e65192.js} +1 -1
- package/.next/static/chunks/pages/knowledge/file-detail-ae28021746550a37.js +1 -0
- package/.next/static/chunks/pages/knowledge/files-cf84b9b9e834dfc7.js +1 -0
- package/.next/static/chunks/pages/knowledge/manage-0ab6c109beca045d.js +1 -0
- package/.next/static/chunks/pages/knowledge/search-8cb8614a649bb57c.js +1 -0
- package/.next/static/chunks/pages/models-d761e0a64090c564.js +1 -0
- package/.next/static/chunks/pages/overview-4389fb201fd42078.js +1 -0
- package/.next/static/chunks/pages/prompt-69407f71ba27bf48.js +1 -0
- package/.next/static/chunks/pages/system/logs-27588e6d25aee564.js +1 -0
- package/.next/static/css/7938cb5de6aedc8c.css +1 -0
- package/package.json +3 -3
- package/.next/static/HkVDaoZfFU-l0wA8-E_IF/_buildManifest.js +0 -1
- package/.next/static/chunks/1539-4cbefe760ca0ae2c.js +0 -1
- package/.next/static/chunks/1830-cabd00b9e865a498.js +0 -4
- package/.next/static/chunks/224-9a7074031493793b.js +0 -1
- package/.next/static/chunks/257-e4ebae17a8ee8412.js +0 -1
- package/.next/static/chunks/2856-ac8dbcb84c6960e4.js +0 -1
- package/.next/static/chunks/288-304992fa705244a2.js +0 -6
- package/.next/static/chunks/2969-2b1c9dec09863c33.js +0 -11
- package/.next/static/chunks/4020-964ab4dd1c8bc8dc.js +0 -1
- package/.next/static/chunks/5174-963b6343ef5d5628.js +0 -10
- package/.next/static/chunks/6288-afb4a972f5ec0f8c.js +0 -1
- package/.next/static/chunks/6474-e99853dc4b0b4f37.js +0 -1
- package/.next/static/chunks/7167-3194cd6d7b0156e9.js +0 -1
- package/.next/static/chunks/7271-0d4dab9994570a7c.js +0 -16
- package/.next/static/chunks/7576-e1b7b82dcd20a6dc.js +0 -4
- package/.next/static/chunks/8628-3438dc642afd4462.js +0 -1
- package/.next/static/chunks/9015-eb03937bff81f42d.js +0 -4
- package/.next/static/chunks/9400-3f253e755a16dd1a.js +0 -78
- package/.next/static/chunks/9969-01dc77acd9935a57.js +0 -1
- package/.next/static/chunks/9978-ef33e50fc2b65303.js +0 -1
- package/.next/static/chunks/pages/asset-library-764f3ad063f40fff.js +0 -1
- package/.next/static/chunks/pages/document-roles-0288a3e6e00e6e02.js +0 -1
- package/.next/static/chunks/pages/document-specs-e2337e693c352897.js +0 -1
- package/.next/static/chunks/pages/documents-cd370a6de9223124.js +0 -1
- package/.next/static/chunks/pages/knowledge/file-detail-9d493b7de07860dc.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-0de1287c0c3e9663.js +0 -1
- package/.next/static/chunks/pages/knowledge/manage-1e8b62ae3c336814.js +0 -1
- package/.next/static/chunks/pages/knowledge/search-50b40e01b826e035.js +0 -1
- package/.next/static/chunks/pages/models-58d14888232c7212.js +0 -1
- package/.next/static/chunks/pages/overview-5c5f37e743f251c9.js +0 -1
- package/.next/static/chunks/pages/prompt-ecb8772b12e5a7e0.js +0 -1
- package/.next/static/chunks/pages/system/logs-7a90a654d4931f5f.js +0 -1
- package/.next/static/css/d284a7454d6f6b06.css +0 -1
- /package/.next/static/{HkVDaoZfFU-l0wA8-E_IF → Qg6HhehDEGMR0UQnE32Qh}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2958],{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 i(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(n))}async function a(e){var n,t;let i=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&i.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&i.set("category",e.category),(null==e?void 0:e.page)&&i.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&i.set("limit",String(null!=(t=e.limit)?t:50)),o("/api/kb/files?".concat(i))}async function r(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),o("/api/kb/files/detail?".concat(t))}async function s(e,n){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function c(e,n,t){return o("/api/kb/files/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function l(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 l(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 y(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function h(e,n){let t=new URLSearchParams({id:e});return n&&t.set("projectRoot",n),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function f(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function m(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function g(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 b(){return o("/api/kb/features")}async function S(e,n){var t,i,a,r,s;let c=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&c.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&c.set("category",n.category),(null==n?void 0:n.limit)&&c.set("limit",String(null!=(s=n.limit)?s:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&c.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(i=n.weights)?void 0:i.vector)!=null&&c.set("vectorWeight",String(n.weights.vector)),(null==n||null==(a=n.weights)?void 0:a.rewrite)!=null&&c.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(r=n.weights)?void 0:r.hybridBonus)!=null&&c.set("hybridBonus",String(n.weights.hybridBonus)),o("/api/kb/search?".concat(c))}async function j(){return o("/api/prompt")}async function T(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function w(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{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 k(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 P(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(){return o("/api/documents/templates")}async function N(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function U(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function A(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 I(){return o("/api/documents/generated")}async function D(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function L(e,n){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function z(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function _(){return o("/api/assets/generated")}async function H(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function W(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function B(e,n){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function F(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Q(e,n){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function X(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),t=n.headers.get("content-type")||"",o=async()=>{let e=await n.text(),t=e||"导出失败";try{var o;let n=JSON.parse(e),i=null==(o=n.issues)?void 0:o.map(e=>e.message).filter(Boolean).slice(0,3).join(";");t=i?"".concat(n.error||"导出失败",":").concat(i):n.error||t}catch(e){}throw Error(t.length>300?"".concat(t.slice(0,300),"..."):t)};return n.ok||await o(),"pdf"!==e.format||t.includes("application/pdf")||await o(),"docx"!==e.format||t.includes("officedocument.wordprocessingml.document")||await o(),n.blob()}async function V(){return o("/api/config/providers")}async function q(e,n){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function Z(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(){return o("/api/config/models")}async function G(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function K(){return o("/api/config/embedding")}async function M(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Y(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function ee(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function en(){return o("/api/system/stats")}async function et(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return o("/api/system/logs?limit=".concat(e))}async function eo(){return o("/api/system/logs",{method:"DELETE"})}async function ei(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function ea(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function er(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function es(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ec(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function el(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ed(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>Q,Bh:()=>ed,CU:()=>h,Dl:()=>R,E:()=>es,EK:()=>O,ER:()=>P,FC:()=>en,FV:()=>v,H1:()=>x,H7:()=>y,HC:()=>s,HT:()=>a,II:()=>K,JU:()=>H,NR:()=>C,OX:()=>J,PH:()=>er,QG:()=>z,QT:()=>p,Qx:()=>u,R1:()=>F,SJ:()=>m,UE:()=>X,VW:()=>b,W2:()=>S,X8:()=>g,Z3:()=>V,_m:()=>q,a6:()=>L,aP:()=>G,bV:()=>A,bZ:()=>ee,c1:()=>d,cQ:()=>I,dd:()=>M,dg:()=>w,dw:()=>k,dx:()=>j,f$:()=>_,h0:()=>U,h1:()=>Z,hH:()=>eo,hc:()=>i,hn:()=>ei,l2:()=>N,lv:()=>T,mx:()=>E,oH:()=>et,oS:()=>B,p:()=>ea,tn:()=>c,u6:()=>Y,uc:()=>W,v7:()=>D,xC:()=>r,xq:()=>f,xw:()=>ec,zo:()=>el,zr:()=>$})},63806:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>O});var o=t(65321),i=t(97109),a=t(17807),r=t(25258),s=t(42700),c=t(33442),l=t(85114),d=t(84253),p=t(2256),u=t(38770),y=t(68787),h=t(71102),f=t(384),m=t(11702),g=t(58209),x=t(93051),b=t(81668),S=t(64254),j=t(26619),T=t(85855),w=t(75548),v=t(56768),C=t(6578);let k={knowledge_base:"知识库",generated:"AI生成",uploaded:"上传",external_url:"外部URL"},E={cover:"magenta",reference:"blue",generated:"purple",attachment:"cyan",map:"orange",operator:"geekblue"};function O(){let{message:e}=a.A.useApp(),[n,t]=(0,i.useState)([]),[O,P]=(0,i.useState)(new Set),[R,N]=(0,i.useState)(!0),U=async()=>{try{t((await (0,C.f$)()).assets)}catch(e){t([])}};(0,i.useEffect)(()=>{N(!0),U().finally(()=>N(!1))},[]);let A=async n=>{var t;n&&(await (null==(t=navigator.clipboard)?void 0:t.writeText(n)),e.success("已复制路径"))},J=async(n,o)=>{try{"index"===o?(t((await (0,C.uc)(n)).assets),e.success("已加入知识库索引")):"openFile"===o?await (0,C.oS)(n,"file"):"openDirectory"===o?await (0,C.oS)(n,"directory"):"delete"===o&&(t((await (0,C.JU)(n)).assets),P(e=>{let t=new Set(e);return t.delete(n),t}))}catch(n){e.error(n instanceof Error?n.message:"操作失败")}},I=t=>{let o="selected"===t?[...O]:n.map(e=>e.id);0!==o.length&&r.A.confirm({title:"all"===t?"删除全部资源?":"删除已选 ".concat(o.length," 个资源?"),content:"此操作不可撤销。",okText:"确认删除",cancelText:"取消",okButtonProps:{danger:!0},onOk:async()=>{N(!0);try{await Promise.all(o.map(e=>(0,C.JU)(e))),await U(),P(new Set),e.success("已删除 ".concat(o.length," 个资源"))}catch(n){e.error("批量删除失败")}finally{N(!1)}}})},D=e=>{P(n=>{let t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})};return R?(0,o.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:300},children:(0,o.jsx)(s.A,{size:"large"})}):(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:"生成资源"}),(0,o.jsx)("p",{className:"pageDesc",children:"管理文档生成产生的本地资源。生成资源默认不进入知识库,可在后续操作中手动加入知识库。"})]}),(0,o.jsxs)(c.A,{size:8,children:[(0,o.jsxs)("span",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["共 ",n.length," 个资源"]}),(0,o.jsxs)(l.Ay,{danger:!0,size:"small",disabled:0===O.size,icon:(0,o.jsx)(g.A,{}),onClick:()=>I("selected"),children:["删除已选 ",O.size||""]}),(0,o.jsx)(l.Ay,{danger:!0,size:"small",disabled:0===n.length,onClick:()=>I("all"),children:"删除全部"})]})]}),0===n.length?(0,o.jsx)(d.A,{description:"暂无生成资源"}):(0,o.jsx)(p.A,{gutter:[12,12],children:n.map((e,n)=>{var t;let i="image"===e.type&&(null==(t=e.path)?void 0:t.startsWith("generatedDocuments/assets/"))?"/api/assets/generated/preview?id=".concat(encodeURIComponent(e.id)):void 0,a=O.has(e.id),r=[...e.path?[{key:"copy",icon:(0,o.jsx)(x.A,{}),label:"复制路径",onClick:()=>{A(e.path)}}]:[],...e.path?[{key:"open",icon:(0,o.jsx)(b.A,{}),label:"打开文件",onClick:()=>{J(e.id,"openFile")}}]:[],...e.path?[{key:"folder",icon:(0,o.jsx)(S.A,{}),label:"打开目录",onClick:()=>{J(e.id,"openDirectory")}}]:[],...!e.indexed&&e.path?[{key:"index",icon:(0,o.jsx)(j.A,{}),label:"加入知识库",onClick:()=>{J(e.id,"index")}}]:[],{type:"divider"},{key:"delete",icon:(0,o.jsx)(g.A,{}),label:"删除",danger:!0,onClick:()=>{J(e.id,"delete")}}];return(0,o.jsx)(u.A,{xs:24,sm:12,md:8,xl:6,children:(0,o.jsxs)(y.A,{size:"small",hoverable:!0,styles:{body:{padding:12}},style:{border:a?"2px solid #1677ff":void 0,cursor:"pointer",position:"relative"},onClick:()=>D(e.id),children:[(0,o.jsx)("div",{onClick:n=>{n.stopPropagation(),D(e.id)},style:{position:"absolute",top:8,left:8,zIndex:2,width:22,height:22,borderRadius:5,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.15s",background:a?"#1677ff":"rgba(0,0,0,0.6)",color:"#fff",fontSize:12,fontWeight:700},children:a?"✓":""}),(0,o.jsx)(h.A,{menu:{items:r},trigger:["click"],placement:"bottomRight",children:(0,o.jsx)(l.Ay,{type:"text",size:"small",icon:(0,o.jsx)(T.A,{}),style:{position:"absolute",top:6,right:6,zIndex:2,width:24,height:24,padding:0,background:"var(--colorBgContainer)",borderRadius:6,boxShadow:"0 1px 3px rgba(0,0,0,0.08)"},onClick:e=>e.stopPropagation()})}),i&&(0,o.jsx)("div",{style:{margin:"-12px -12px 10px -12px",borderRadius:"10px 10px 0 0",overflow:"hidden",height:140,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--colorFillAlter)"},children:(0,o.jsx)(f.A,{src:i,alt:e.name,style:{width:"100%",height:"100%",objectFit:"cover"},onClick:e=>e.stopPropagation()})}),(0,o.jsx)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,marginBottom:6},children:(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,flex:1},children:[!i&&("image"===e.type?(0,o.jsx)(w.A,{style:{color:"var(--colorWarning)",fontSize:15,flexShrink:0}}):(0,o.jsx)(v.A,{style:{color:"var(--colorAccent)",fontSize:15,flexShrink:0}})),(0,o.jsx)("span",{style:{fontWeight:600,fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name})]})}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:[(0,o.jsx)(m.A,{color:e.indexed?"success":"default",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.indexed?"已入库":"未入库"}),(0,o.jsx)(m.A,{color:E[e.role]||"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role}),(0,o.jsx)(m.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.type})]}),(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",lineHeight:1.5,marginBottom:6},children:[e.path&&(0,o.jsx)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:11},children:e.path}),(0,o.jsxs)("div",{children:[k[e.source]||e.source," \xb7 ",e.usedByDocumentIds.length," 个文档 \xb7 ",new Date(e.updatedAt).toLocaleDateString()]})]})]})},e.id)})})]})}},85015:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/asset-library",function(){return t(63806)}])}},e=>{e.O(0,[4260,4277,7889,2700,7150,2073,636,6593,8792],()=>e(e.s=85015)),_N_E=e.O()}]);
|
|
@@ -1 +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 s=n(65321),a=n(97109),r=n(64209),o=n(17807),c=n(11702),l=n(85114),i=n(26171),d=n(33442),m=n(7576),x=n(68787),u=n(54849),h=n(
|
|
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 s=n(65321),a=n(97109),r=n(64209),o=n(17807),c=n(11702),l=n(85114),i=n(26171),d=n(33442),m=n(7576),x=n(68787),u=n(54849),h=n(21289),j=n(25258),p=n(63455),w=n(99650),y=n(58209),A=n(30486),g=n(83374),f=n(8383),_=n(26619),v=n(53998),S=n(6578),C=n(45551);let k={project_fact:"项目知识",user_preference:"用户偏好",feedback:"历史纠偏",pattern:"解决方案"},z={high:"red",medium:"orange",low:"default"};function N(){let e=(0,r.Vr)(),{message:t}=o.A.useApp(),[n,N]=(0,a.useState)(!0),[I,E]=(0,a.useState)([]),[T,b]=(0,a.useState)({count:0,totalBytes:0}),[P,B]=(0,a.useState)(""),[D,O]=(0,a.useState)(!1),[H,L]=(0,a.useState)(null),[X,F]=(0,a.useState)(""),[K,M]=(0,a.useState)(""),[V,q]=(0,a.useState)(!1),G=async n=>{N(!0);try{let[e,t]=await Promise.all([(0,S.hn)("long_term",n),(0,S.p)("long_term")]);E(e),b(t)}catch(n){t.error(e("common.error"))}finally{N(!1)}};(0,a.useEffect)(()=>{G()},[]);let J=async n=>{try{await (0,S.xw)(n),t.success(e("common.success")),await G(P)}catch(n){t.error(e("common.error"))}},Q=async()=>{try{await (0,S.PH)("long_term"),t.success(e("common.success")),await G(P)}catch(n){t.error(e("common.error"))}},R=async()=>{try{await (0,S.E)("long_term"),t.success(e("common.success")),await G(P)}catch(n){t.error(e("common.error"))}},U=async()=>{if(H&&X.trim()){q(!0);try{await (0,S.zo)(H.id,{content:X.trim(),context:K||void 0}),t.success(e("common.success")),O(!1),await G(P)}catch(n){t.error(e("common.error"))}finally{q(!1)}}},W=[{title:"序号",key:"index",width:70,render:(e,t,n)=>n+1},{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:"类型",dataIndex:"type",width:90,render:e=>(0,s.jsx)(c.A,{children:k[e]||e})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,s.jsx)(c.A,{color:z[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,s.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,s.jsx)(l.Ay,{size:"small",type:"text",icon:(0,s.jsx)(w.A,{}),onClick:()=>{L(n),F(n.content),M(""),O(!0)}}),(0,s.jsx)(i.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{J(n.id)},children:(0,s.jsx)(l.Ay,{size:"small",type:"text",danger:!0,icon:(0,s.jsx)(y.A,{})})})]})}];return(0,s.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"pageTitle",children:e("nav.longTermContext")}),(0,s.jsx)("p",{className:"pageDesc",children:e("context.longTermDesc")})]}),(0,s.jsxs)(d.A,{wrap:!0,children:[(0,s.jsx)(m.A,{prefix:(0,s.jsx)(A.A,{}),placeholder:e("common.search"),value:P,onChange:e=>B(e.target.value),onPressEnter:()=>{G(P)},allowClear:!0,style:{width:240}}),(0,s.jsx)(l.Ay,{icon:(0,s.jsx)(g.A,{}),onClick:()=>{Q()},children:"压缩"}),(0,s.jsx)(i.A,{title:"确定清除长期上下文吗?",onConfirm:()=>{R()},children:(0,s.jsx)(l.Ay,{danger:!0,icon:(0,s.jsx)(f.A,{}),children:"清除"})})]})]}),(0,s.jsx)(x.A,{size:"small",children:(0,s.jsx)(u.A,{title:"总上下文大小",value:(0,C.z3)(T.totalBytes),prefix:(0,s.jsx)(_.A,{}),suffix:" / ".concat(T.count," 条")})}),(0,s.jsxs)(x.A,{size:"small",children:[(0,s.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,s.jsx)(v.A,{})," ",e("context.longTermSource")]}),(0,s.jsx)(h.A,{rowKey:"id",columns:W,dataSource:I,loading:n,size:"small",pagination:{pageSize:15}})]}),(0,s.jsx)(j.A,{maskClosable:!1,title:e("models.editModel"),open:D,onCancel:()=>O(!1),onOk:()=>{U()},confirmLoading:V,children:(0,s.jsxs)(p.A,{layout:"vertical",size:"middle",children:[(0,s.jsx)(p.A.Item,{label:e("context.content"),children:(0,s.jsx)(m.A.TextArea,{rows:6,value:X,onChange:e=>F(e.target.value)})}),(0,s.jsx)(p.A.Item,{label:e("context.source"),children:(0,s.jsx)(m.A,{value:K,onChange:e=>M(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}},36382:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/long-term",function(){return n(260)}])}},e=>{e.O(0,[4260,4277,7889,1210,7576,9551,2700,4696,9189,6985,7150,5695,1289,8932,9978,636,6593,8792],()=>e(e.s=36382)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6409],{19164:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/short-term",function(){return s(51162)}])},51162:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>N});var r=s(65321),a=s(97109),n=s(64209),o=s(17807),c=s(11702),i=s(85114),l=s(26171),d=s(33442),m=s(7576),x=s(68787),h=s(54849),u=s(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6409],{19164:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/short-term",function(){return s(51162)}])},51162:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>N});var r=s(65321),a=s(97109),n=s(64209),o=s(17807),c=s(11702),i=s(85114),l=s(26171),d=s(33442),m=s(7576),x=s(68787),h=s(54849),u=s(21289),j=s(25258),p=s(63455),w=s(99650),y=s(58209),A=s(30486),f=s(83374),g=s(8383),v=s(26619),_=s(53998),S=s(6578),C=s(45551);let z={high:"red",medium:"orange",low:"default"};function N(){let e=(0,n.Vr)(),{message:t}=o.A.useApp(),[s,N]=(0,a.useState)(!0),[k,E]=(0,a.useState)([]),[I,T]=(0,a.useState)({count:0,totalBytes:0}),[b,P]=(0,a.useState)(""),[B,D]=(0,a.useState)(!1),[O,H]=(0,a.useState)(null),[L,X]=(0,a.useState)(""),[F,K]=(0,a.useState)(""),[M,V]=(0,a.useState)(!1),q=async s=>{N(!0);try{let[e,t]=await Promise.all([(0,S.hn)("short_term",s),(0,S.p)("short_term")]);E(e),T(t)}catch(s){t.error(e("common.error"))}finally{N(!1)}};(0,a.useEffect)(()=>{q()},[]);let G=async s=>{try{await (0,S.xw)(s),t.success(e("common.success")),await q(b)}catch(s){t.error(e("common.error"))}},J=async()=>{try{await (0,S.PH)("short_term"),t.success(e("common.success")),await q(b)}catch(s){t.error(e("common.error"))}},Q=async()=>{try{await (0,S.E)("short_term"),t.success(e("common.success")),await q(b)}catch(s){t.error(e("common.error"))}},R=async()=>{if(O&&L.trim()){V(!0);try{await (0,S.zo)(O.id,{content:L.trim(),context:F||void 0}),t.success(e("common.success")),D(!1),await q(b)}catch(s){t.error(e("common.error"))}finally{V(!1)}}},U=[{title:"序号",key:"index",width:70,render:(e,t,s)=>s+1},{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,r.jsx)(c.A,{color:z[e]||"default",children:"high"===e?"高":"medium"===e?"中":"低"})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.source"),dataIndex:"source",width:120,ellipsis:!0},{title:e("context.updatedAt"),dataIndex:"updated_at",width:140,render:e=>e?new Date(e).toLocaleString():"-"},{title:e("common.edit"),width:100,render:(t,s)=>(0,r.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,r.jsx)(i.Ay,{size:"small",type:"text",icon:(0,r.jsx)(w.A,{}),onClick:()=>{H(s),X(s.content),K(""),D(!0)}}),(0,r.jsx)(l.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{G(s.id)},children:(0,r.jsx)(i.Ay,{size:"small",type:"text",danger:!0,icon:(0,r.jsx)(y.A,{})})})]})}];return(0,r.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"pageTitle",children:e("nav.shortTermContext")}),(0,r.jsx)("p",{className:"pageDesc",children:e("context.shortTermDesc")})]}),(0,r.jsxs)(d.A,{wrap:!0,children:[(0,r.jsx)(m.A,{prefix:(0,r.jsx)(A.A,{}),placeholder:e("common.search"),value:b,onChange:e=>P(e.target.value),onPressEnter:()=>{q(b)},allowClear:!0,style:{width:240}}),(0,r.jsx)(i.Ay,{icon:(0,r.jsx)(f.A,{}),onClick:()=>{J()},children:"压缩"}),(0,r.jsx)(l.A,{title:"确定清除短期上下文吗?",onConfirm:()=>{Q()},children:(0,r.jsx)(i.Ay,{danger:!0,icon:(0,r.jsx)(g.A,{}),children:"清除"})})]})]}),(0,r.jsx)(x.A,{size:"small",children:(0,r.jsx)(h.A,{title:"总上下文大小",value:(0,C.z3)(I.totalBytes),prefix:(0,r.jsx)(v.A,{}),suffix:" / ".concat(I.count," 条")})}),(0,r.jsxs)(x.A,{size:"small",children:[(0,r.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,r.jsx)(_.A,{})," ",e("context.shortTermSource")]}),(0,r.jsx)(u.A,{rowKey:"id",columns:U,dataSource:k,loading:s,size:"small",pagination:{pageSize:15}})]}),(0,r.jsx)(j.A,{maskClosable:!1,title:e("models.editModel"),open:B,onCancel:()=>D(!1),onOk:()=>{R()},confirmLoading:M,children:(0,r.jsxs)(p.A,{layout:"vertical",size:"middle",children:[(0,r.jsx)(p.A.Item,{label:e("context.content"),children:(0,r.jsx)(m.A.TextArea,{rows:6,value:L,onChange:e=>X(e.target.value)})}),(0,r.jsx)(p.A.Item,{label:e("context.source"),children:(0,r.jsx)(m.A,{value:F,onChange:e=>K(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}}},e=>{e.O(0,[4260,4277,7889,1210,7576,9551,2700,4696,9189,6985,7150,5695,1289,8932,9978,636,6593,8792],()=>e(e.s=19164)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8623],{6578:(e,n,t)=>{"use strict";async function i(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 o(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return i("/api/kb/stats".concat(n))}async function r(e){var n,t;let o=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&o.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&o.set("category",e.category),(null==e?void 0:e.page)&&o.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&o.set("limit",String(null!=(t=e.limit)?t:50)),i("/api/kb/files?".concat(o))}async function l(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),i("/api/kb/files/detail?".concat(t))}async function s(e,n){return i("/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 i("/api/kb/files/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function c(e){return new Promise((n,t)=>{let i=new FileReader;i.onload=()=>{let e=i.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},i.onerror=t,i.readAsDataURL(e)})}async function d(e,n,t){return i("/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 i("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),i("/api/kb/operations?".concat(n))}async function m(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),i("/api/kb/operations?".concat(n),{method:"DELETE"})}async function y(e,n){let t=new URLSearchParams({id:e});return n&&t.set("projectRoot",n),i("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,n){return i("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function f(e,n){return i("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function x(e){return i("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return i("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function j(){return i("/api/kb/features")}async function b(e,n){var t,o,r,l,s;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!=(s=n.limit)?s:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&a.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(o=n.weights)?void 0:o.vector)!=null&&a.set("vectorWeight",String(n.weights.vector)),(null==n||null==(r=n.weights)?void 0:r.rewrite)!=null&&a.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(l=n.weights)?void 0:l.hybridBonus)!=null&&a.set("hybridBonus",String(n.weights.hybridBonus)),i("/api/kb/search?".concat(a))}async function A(){return i("/api/prompt")}async function v(e){return i("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function T(e){return i("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e,n){return i("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function S(e){return i("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e){return i("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function I(){return i("/api/documents/specs")}async function E(e){return i("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return i("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(){return i("/api/documents/templates")}async function O(e){return i("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return i("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(e){return i("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function U(e){return i("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J(){return i("/api/documents/generated")}async function z(e){return i("/api/documents/generated/".concat(encodeURIComponent(e)))}async function F(e,n){return i("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function _(e){return i("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function D(){return i("/api/assets/generated")}async function H(e){return i("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function L(e){return i("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function B(e,n){return i("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function W(e){return i("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(e,n){return i("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function V(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),t=n.headers.get("content-type")||"",i=async()=>{let e=await n.text(),t=e||"导出失败";try{var i;let n=JSON.parse(e),o=null==(i=n.issues)?void 0:i.map(e=>e.message).filter(Boolean).slice(0,3).join(";");t=o?"".concat(n.error||"导出失败",":").concat(o):n.error||t}catch(e){}throw Error(t.length>300?"".concat(t.slice(0,300),"..."):t)};return n.ok||await i(),"pdf"!==e.format||t.includes("application/pdf")||await i(),"docx"!==e.format||t.includes("officedocument.wordprocessingml.document")||await i(),n.blob()}async function Q(){return i("/api/config/providers")}async function G(e,n){return i("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function X(e){return i("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function K(){return i("/api/config/models")}async function Z(e){return i("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(){return i("/api/config/embedding")}async function M(e){return i("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Y(){return i("/api/config/embedding/healthCheck",{method:"POST"})}async function ee(e){return i("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function en(){return i("/api/system/stats")}async function et(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return i("/api/system/logs?limit=".concat(e))}async function ei(){return i("/api/system/logs",{method:"DELETE"})}async function eo(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return i("/api/context".concat(t))}async function er(e){return i("/api/context?type=".concat(e,"&stats=1"))}async function el(e){return i("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function es(e){return i("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ea(e){return i("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ec(e,n){return i("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ed(e){return i("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>q,Bh:()=>ed,CU:()=>y,Dl:()=>R,E:()=>es,EK:()=>E,ER:()=>k,FC:()=>en,FV:()=>w,H1:()=>g,H7:()=>m,HC:()=>s,HT:()=>r,II:()=>$,JU:()=>H,NR:()=>S,OX:()=>U,PH:()=>el,QG:()=>_,QT:()=>p,Qx:()=>u,R1:()=>W,SJ:()=>f,UE:()=>V,VW:()=>j,W2:()=>b,X8:()=>x,Z3:()=>Q,_m:()=>G,a6:()=>F,aP:()=>Z,bV:()=>P,bZ:()=>ee,c1:()=>d,cQ:()=>J,dd:()=>M,dg:()=>T,dw:()=>C,dx:()=>A,f$:()=>D,h0:()=>N,h1:()=>X,hH:()=>ei,hc:()=>o,hn:()=>eo,l2:()=>O,lv:()=>v,mx:()=>I,oH:()=>et,oS:()=>B,p:()=>er,tn:()=>a,u6:()=>Y,uc:()=>L,v7:()=>z,xC:()=>l,xq:()=>h,xw:()=>ea,zo:()=>ec,zr:()=>K})},23507:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return t(59889)}])},59889:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>G});var i=t(65321),o=t(97109),r=t(35292),l=t(17807),s=t(63455),a=t(84253),c=t(68787),d=t(11702),p=t(85114),u=t(26171),m=t(33442),y=t(85493),h=t(25258),f=t(57271),x=t(7576),g=t(2256),j=t(38770),b=t(58569),A=t(25345),v=t(43979),T=t(80042),w=t(75548),S=t(26631),C=t(84662),I=t(30486),E=t(99650),k=t(8263),R=t(84742),O=t(43094),N=t(8579),P=t(58209),U=t(54746),J=t(96651),z=t(60470),F=t(90588),_=t(6578),D=t(64209);let{Paragraph:H}=r.A,L={rule:(0,i.jsx)(A.A,{}),project_fact:(0,i.jsx)(v.A,{}),table:(0,i.jsx)(T.A,{}),drawing:(0,i.jsx)(w.A,{}),specification:(0,i.jsx)(S.A,{}),reference:(0,i.jsx)(C.A,{})},B={fact_extraction:(0,i.jsx)(I.A,{}),chapter_generation:(0,i.jsx)(E.A,{}),llm_review:(0,i.jsx)(k.A,{}),validation:(0,i.jsx)(R.A,{}),formatting:(0,i.jsx)(O.A,{}),reference:(0,i.jsx)(C.A,{})},W={rule:"#fa8c16",project_fact:"#1677ff",table:"#52c41a",drawing:"#722ed1",specification:"#eb2f96",reference:"#13c2c2"},q={fact_extraction:"#fa8c16",chapter_generation:"#1677ff",llm_review:"#722ed1",validation:"#52c41a",formatting:"#eb2f96",reference:"#13c2c2"},V={rule:"roles.ruleFile",project_fact:"roles.projectFactFile",table:"roles.tableFile",drawing:"roles.drawingFile",specification:"roles.specificationFile",reference:"roles.reference"},Q={fact_extraction:"roles.factExtraction",chapter_generation:"roles.chapterGeneration",llm_review:"roles.llmReview",validation:"roles.validation",formatting:"roles.formatting",reference:"roles.reference"};function G(){let e,n,t=(0,D.Vr)(),{message:r}=l.A.useApp(),[A]=s.A.useForm(),[v]=s.A.useForm(),[T,w]=(0,o.useState)([]),[C,I]=(0,o.useState)([]),[k,R]=(0,o.useState)([]),[O,G]=(0,o.useState)([]),[X,K]=(0,o.useState)(!1),[Z,$]=(0,o.useState)(!1),[M,Y]=(0,o.useState)(!1),[ee,en]=(0,o.useState)("file"),et=async()=>{let[e,n,t]=await Promise.all([(0,_.lv)(),(0,_.HT)(),(0,_.dx)()]);w(e.roles),I(e.configs),R(n.files),G(t)};(0,o.useEffect)(()=>{et().catch(()=>r.error(t("common.error")))},[r,t]);let ei=T.filter(e=>"file"===e.type),eo=T.filter(e=>"prompt"===e.type),er=async()=>{try{let e=await A.validateFields(),n=await (0,_.dg)(e);w(n.roles),I(n.configs),K(!1),r.success(t("common.success"))}catch(e){r.error(t("common.error"))}},el=async()=>{try{let e=await v.validateFields(),n=e=>(null!=e?e:[]).map((e,n)=>{var t;return{roleId:e.roleId,order:Number(null!=(t=e.order)?t:n)}}),i=await (0,_.NR)({...e,fileRoles:n(e.fileRoles),promptRoles:n(e.promptRoles)});w(i.roles),I(i.configs),$(!1),r.success(t("common.success"))}catch(e){r.error(t("common.error"))}},es=async e=>{let n=await (0,_.FV)(e.type,e.id);w(n.roles),I(n.configs)},ea=async e=>{let n=await (0,_.dw)(e);w(n.roles),I(n.configs)},ec=function(e){var n;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";A.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:t,resourceIds:[],executionType:"prompt"===t?"reference":void 0,processingType:"file"===t?"reference":void 0}),K(!0)},ed=e=>{v.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[]}),$(!0)},ep=e=>T.find(n=>n.id===e);return(0,i.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"pageTitle",children:t("roles.title")}),(0,i.jsx)("p",{className:"pageDesc",children:t("roles.description")})]}),(0,i.jsxs)(m.A,{children:[(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(U.A,{}),onClick:()=>ec(void 0,"file"),children:t("roles.newFileRole")}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(U.A,{}),onClick:()=>ec(void 0,"prompt"),children:t("roles.newPromptRole")}),(0,i.jsx)(p.Ay,{type:"primary",icon:(0,i.jsx)(U.A,{}),onClick:()=>ed(),children:t("roles.newConfig")})]})]}),(0,i.jsx)(y.A,{type:"info",showIcon:!0,message:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)("span",{children:t("roles.plainGuideTitle")}),(0,i.jsx)(p.Ay,{type:"link",size:"small",icon:M?(0,i.jsx)(J.A,{}):(0,i.jsx)(z.A,{}),onClick:()=>Y(!M),style:{padding:"0 4px"},children:M?"收起说明":"展开说明"})]}),description:M?t("roles.plainGuideDesc"):void 0}),(0,i.jsx)(c.A,{size:"small",tabList:[{key:"file",label:"文件角色 (".concat(ei.length,")")},{key:"prompt",label:"提示词角色 (".concat(eo.length,")")},{key:"configs",label:"项目角色配置 (".concat(C.length,")")}],activeTabKey:ee,onTabChange:e=>en(e),children:"configs"===ee?0===C.length?(0,i.jsx)(a.A,{description:t("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:C.map((e,n)=>{let o=e.fileRoles.map(e=>({...e,role:ep(e.roleId)})).filter(e=>e.role),r=e.promptRoles.map(e=>({...e,role:ep(e.roleId)})).filter(e=>e.role);return(0,i.jsxs)(c.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:8},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:[(0,i.jsx)(F.A,{style:{color:"var(--colorTextQuaternary)",fontSize:14,flexShrink:0}}),(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),(0,i.jsxs)(d.A,{style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:["#",n+1]})]}),(0,i.jsxs)("div",{style:{display:"flex",gap:4,flexShrink:0},children:[(0,i.jsx)(p.Ay,{size:"small",icon:(0,i.jsx)(E.A,{}),onClick:()=>ed(e),children:"编辑"}),(0,i.jsx)(u.A,{title:t("common.confirm"),onConfirm:()=>{ea(e.id)},children:(0,i.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(P.A,{})})})]})]}),e.description&&(0,i.jsx)(H,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,i.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[o.length>0&&(0,i.jsxs)("div",{style:{marginBottom:4},children:[(0,i.jsxs)("span",{children:["文件角色 (",o.length,"): "]}),(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[o.slice(0,4).map(e=>(0,i.jsx)(d.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),o.length>4&&(0,i.jsxs)(d.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",o.length-4]})]})]}),r.length>0&&(0,i.jsxs)("div",{children:[(0,i.jsxs)("span",{children:["提示词角色 (",r.length,"): "]}),(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[r.slice(0,4).map(e=>(0,i.jsx)(d.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),r.length>4&&(0,i.jsxs)(d.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",r.length-4]})]})]}),0===o.length&&0===r.length&&(0,i.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"暂未绑定角色"})]})]},e.id)})}):(e="file"===ee?ei:eo,n=t,0===e.length?(0,i.jsx)(a.A,{description:t("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(260px, 1fr))",gap:12},children:e.map((e,o)=>{var r,l,s,a,m,y,h,f,x;let g=(null==(r=e.resourceIds)?void 0:r.length)?e.resourceIds:e.resourceId?[e.resourceId]:[],j=g.slice(0,3),b=g.length-j.length,A="file"===e.type?null!=(s=L[null!=(l=e.processingType)?l:""])?s:(0,i.jsx)(S.A,{}):null!=(m=B[null!=(a=e.executionType)?a:""])?m:(0,i.jsx)(N.A,{}),v="file"===e.type?null!=(h=W[null!=(y=e.processingType)?y:""])?h:"var(--colorAccent)":null!=(x=q[null!=(f=e.executionType)?f:""])?x:"var(--colorWarning)";return(0,i.jsxs)(c.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:8},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,flex:1},children:[(0,i.jsx)("span",{style:{color:v,fontSize:16,flexShrink:0,lineHeight:1},children:A}),(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"20px"},children:e.name})]}),(0,i.jsxs)("div",{style:{display:"flex",gap:4,flexShrink:0},children:[e.builtIn&&(0,i.jsx)(d.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"内置"}),(0,i.jsxs)(d.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["#",o+1]})]})]}),e.description&&(0,i.jsx)(H,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,i.jsxs)("div",{style:{marginBottom:8,display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,i.jsx)(d.A,{color:"file"===e.type?"blue":"purple",style:{margin:0},children:function(e,n){var t,i,o;let r="file"===e.type?V[null!=(t=e.processingType)?t:""]:Q[null!=(i=e.executionType)?i:""];return r?n(r):null!=(o="file"===e.type?e.processingType:e.executionType)?o:""}(e,n)}),g.length>0&&(0,i.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",g.length," 个资源"]})]}),j.length>0&&(0,i.jsx)("div",{style:{marginBottom:10},children:(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[j.map(e=>(0,i.jsx)(d.A,{style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"},children:e},e)),b>0&&(0,i.jsxs)(d.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",b]})]})}),(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:6,paddingTop:4,borderTop:"1px solid var(--colorBorderSecondary)"},children:[(0,i.jsx)(p.Ay,{size:"small",icon:(0,i.jsx)(E.A,{}),onClick:()=>ec(e),children:"编辑"}),(0,i.jsx)(u.A,{title:t("common.confirm"),disabled:e.builtIn,onConfirm:()=>{es(e)},children:(0,i.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(P.A,{}),disabled:e.builtIn})})]})]},e.id)})}))}),(0,i.jsx)(h.A,{maskClosable:!1,title:t("roles.roleEditor"),open:X,onOk:()=>{er()},onCancel:()=>K(!1),centered:!0,okText:t("common.save"),children:(0,i.jsxs)(s.A,{form:A,layout:"vertical",children:[(0,i.jsx)(s.A.Item,{name:"type",label:t("roles.roleType"),rules:[{required:!0}],children:(0,i.jsx)(f.A,{options:[{label:t("roles.fileRole"),value:"file"},{label:t("roles.promptRole"),value:"prompt"}]})}),(0,i.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,i.jsx)(x.A,{disabled:!0})}),(0,i.jsx)(s.A.Item,{name:"name",label:t("roles.roleName"),rules:[{required:!0}],children:(0,i.jsx)(x.A,{})}),(0,i.jsx)(s.A.Item,{name:"description",label:t("roles.roleDescription"),children:(0,i.jsx)(x.A,{})}),(0,i.jsx)(s.A.Item,{noStyle:!0,shouldUpdate:(e,n)=>e.type!==n.type,children:e=>{let{getFieldValue:n}=e;return"prompt"===n("type")?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.A.Item,{name:"executionType",label:t("roles.executionType"),rules:[{required:!0}],extra:t("roles.executionTypeHelp"),children:(0,i.jsx)(f.A,{options:[{label:t("roles.factExtraction"),value:"fact_extraction"},{label:t("roles.chapterGeneration"),value:"chapter_generation"},{label:t("roles.validation"),value:"validation"},{label:t("roles.formatting"),value:"formatting"},{label:t("roles.reference"),value:"reference"}]})}),(0,i.jsx)(s.A.Item,{name:"resourceIds",label:t("roles.bindPrompt"),extra:t("roles.multiBindPromptHelp"),children:(0,i.jsx)(f.A,{mode:"multiple",showSearch:!0,options:O.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.A.Item,{name:"processingType",label:t("roles.processingType"),rules:[{required:!0}],extra:t("roles.processingTypeHelp"),children:(0,i.jsx)(f.A,{options:[{label:t("roles.ruleFile"),value:"rule"},{label:t("roles.projectFactFile"),value:"project_fact"},{label:t("roles.tableFile"),value:"table"},{label:t("roles.drawingFile"),value:"drawing"},{label:t("roles.specificationFile"),value:"specification"},{label:t("roles.reference"),value:"reference"}]})}),(0,i.jsx)(s.A.Item,{name:"resourceIds",label:t("roles.bindFile"),extra:t("roles.multiBindFileHelp"),children:(0,i.jsx)(f.A,{mode:"multiple",showSearch:!0,options:k.map(e=>({label:e.relativePath,value:e.relativePath}))})})]})}})]})}),(0,i.jsx)(h.A,{maskClosable:!1,title:t("roles.configEditor"),open:Z,onOk:()=>{el()},onCancel:()=>$(!1),width:820,centered:!0,okText:t("common.save"),children:(0,i.jsxs)(s.A,{form:v,layout:"vertical",children:[(0,i.jsxs)(g.A,{gutter:12,children:[(0,i.jsx)(j.A,{span:8,children:(0,i.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,i.jsx)(x.A,{disabled:!0})})}),(0,i.jsx)(j.A,{span:8,children:(0,i.jsx)(s.A.Item,{name:"name",label:t("roles.configName"),rules:[{required:!0}],children:(0,i.jsx)(x.A,{})})}),(0,i.jsx)(j.A,{span:8,children:(0,i.jsx)(s.A.Item,{name:"description",label:t("roles.configDescription"),children:(0,i.jsx)(x.A,{})})})]}),(0,i.jsx)(b.A,{items:[{key:"file",label:"".concat(t("roles.fileRoles")," (").concat(ei.length,")"),children:(0,i.jsx)(s.A.List,{name:"fileRoles",children:(e,n)=>{let{add:o,remove:r}=n;return(0,i.jsxs)(m.A,{direction:"vertical",className:"w-full",children:[e.map((e,n)=>(0,i.jsxs)(g.A,{gutter:8,align:"middle",children:[(0,i.jsx)(j.A,{flex:"auto",children:(0,i.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(f.A,{placeholder:"选择文件角色",options:ei.map(e=>({label:"".concat(e.name," (").concat(e.processingType,")"),value:e.id}))})})}),(0,i.jsx)(j.A,{style:{width:100},children:(0,i.jsx)(s.A.Item,{name:[e.name,"order"],label:"排序",initialValue:n,style:{marginBottom:0},children:(0,i.jsx)(x.A,{type:"number",size:"small"})})}),(0,i.jsx)(j.A,{style:{width:40},children:(0,i.jsx)(p.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(P.A,{}),onClick:()=>r(e.name)})})]},e.key)),(0,i.jsx)(p.Ay,{onClick:()=>o({order:e.length}),icon:(0,i.jsx)(U.A,{}),children:t("roles.addRole")})]})}})},{key:"prompt",label:"".concat(t("roles.promptRoles")," (").concat(eo.length,")"),children:(0,i.jsx)(s.A.List,{name:"promptRoles",children:(e,n)=>{let{add:o,remove:r}=n;return(0,i.jsxs)(m.A,{direction:"vertical",className:"w-full",children:[e.map((e,n)=>(0,i.jsxs)(g.A,{gutter:8,align:"middle",children:[(0,i.jsx)(j.A,{flex:"auto",children:(0,i.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(f.A,{placeholder:"选择提示词角色",options:eo.map(e=>({label:"".concat(e.name," (").concat(e.executionType,")"),value:e.id}))})})}),(0,i.jsx)(j.A,{style:{width:100},children:(0,i.jsx)(s.A.Item,{name:[e.name,"order"],label:"排序",initialValue:n,style:{marginBottom:0},children:(0,i.jsx)(x.A,{type:"number",size:"small"})})}),(0,i.jsx)(j.A,{style:{width:40},children:(0,i.jsx)(p.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(P.A,{}),onClick:()=>r(e.name)})})]},e.key)),(0,i.jsx)(p.Ay,{onClick:()=>o({order:e.length}),icon:(0,i.jsx)(U.A,{}),children:t("roles.addRole")})]})}})}]})]})})]})}}},e=>{e.O(0,[4260,4277,7889,1210,7576,9551,4696,5695,5292,7888,636,6593,8792],()=>e(e.s=23507)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7580],{2256:(e,n,t)=>{"use strict";t.d(n,{A:()=>i});let i=t(25341).A},6578:(e,n,t)=>{"use strict";async function i(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 a(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return i("/api/kb/stats".concat(n))}async function s(e){var n,t;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!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(t=e.limit)?t:50)),i("/api/kb/files?".concat(a))}async function o(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),i("/api/kb/files/detail?".concat(t))}async function l(e,n){return i("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function r(e,n,t){return i("/api/kb/files/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function c(e){return new Promise((n,t)=>{let i=new FileReader;i.onload=()=>{let e=i.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},i.onerror=t,i.readAsDataURL(e)})}async function d(e,n,t){return i("/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 m(e){return i("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),i("/api/kb/operations?".concat(n))}async function u(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),i("/api/kb/operations?".concat(n),{method:"DELETE"})}async function h(e,n){let t=new URLSearchParams({id:e});return n&&t.set("projectRoot",n),i("/api/kb/operations?".concat(t),{method:"DELETE"})}async function y(e,n){return i("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function g(e,n){return i("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function x(e){return i("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function f(e){return i("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function j(){return i("/api/kb/features")}async function b(e,n){var t,a,s,o,l;let r=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&r.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&r.set("category",n.category),(null==n?void 0:n.limit)&&r.set("limit",String(null!=(l=n.limit)?l:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&r.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(a=n.weights)?void 0:a.vector)!=null&&r.set("vectorWeight",String(n.weights.vector)),(null==n||null==(s=n.weights)?void 0:s.rewrite)!=null&&r.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(o=n.weights)?void 0:o.hybridBonus)!=null&&r.set("hybridBonus",String(n.weights.hybridBonus)),i("/api/kb/search?".concat(r))}async function A(){return i("/api/prompt")}async function S(e){return i("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function v(e){return i("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function I(e,n){return i("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function w(e){return i("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return i("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(){return i("/api/documents/specs")}async function T(e){return i("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return i("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(){return i("/api/documents/templates")}async function R(e){return i("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function z(e){return i("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function N(e){return i("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function O(e){return i("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(){return i("/api/documents/generated")}async function q(e){return i("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,n){return i("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function L(e){return i("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function H(){return i("/api/assets/generated")}async function U(e){return i("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function B(e){return i("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function J(e,n){return i("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function _(e){return i("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function F(e,n){return i("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function W(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),t=n.headers.get("content-type")||"",i=async()=>{let e=await n.text(),t=e||"导出失败";try{var i;let n=JSON.parse(e),a=null==(i=n.issues)?void 0:i.map(e=>e.message).filter(Boolean).slice(0,3).join(";");t=a?"".concat(n.error||"导出失败",":").concat(a):n.error||t}catch(e){}throw Error(t.length>300?"".concat(t.slice(0,300),"..."):t)};return n.ok||await i(),"pdf"!==e.format||t.includes("application/pdf")||await i(),"docx"!==e.format||t.includes("officedocument.wordprocessingml.document")||await i(),n.blob()}async function M(){return i("/api/config/providers")}async function V(e,n){return i("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function X(e){return i("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function G(){return i("/api/config/models")}async function Q(e){return i("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function K(){return i("/api/config/embedding")}async function Z(e){return i("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Y(){return i("/api/config/embedding/healthCheck",{method:"POST"})}async function ee(e){return i("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function en(){return i("/api/system/stats")}async function et(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return i("/api/system/logs?limit=".concat(e))}async function ei(){return i("/api/system/logs",{method:"DELETE"})}async function ea(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return i("/api/context".concat(t))}async function es(e){return i("/api/context?type=".concat(e,"&stats=1"))}async function eo(e){return i("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function el(e){return i("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function er(e){return i("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ec(e,n){return i("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ed(e){return i("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>F,Bh:()=>ed,CU:()=>h,Dl:()=>C,E:()=>el,EK:()=>T,ER:()=>E,FC:()=>en,FV:()=>I,H1:()=>f,H7:()=>u,HC:()=>l,HT:()=>s,II:()=>K,JU:()=>U,NR:()=>w,OX:()=>O,PH:()=>eo,QG:()=>L,QT:()=>m,Qx:()=>p,R1:()=>_,SJ:()=>g,UE:()=>W,VW:()=>j,W2:()=>b,X8:()=>x,Z3:()=>M,_m:()=>V,a6:()=>D,aP:()=>Q,bV:()=>N,bZ:()=>ee,c1:()=>d,cQ:()=>P,dd:()=>Z,dg:()=>v,dw:()=>k,dx:()=>A,f$:()=>H,h0:()=>z,h1:()=>X,hH:()=>ei,hc:()=>a,hn:()=>ea,l2:()=>R,lv:()=>S,mx:()=>$,oH:()=>et,oS:()=>J,p:()=>es,tn:()=>r,u6:()=>Y,uc:()=>B,v7:()=>q,xC:()=>o,xq:()=>y,xw:()=>er,zo:()=>ec,zr:()=>G})},38770:(e,n,t)=>{"use strict";t.d(n,{A:()=>i});let i=t(51916).A},51533:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>Y});var i=t(65321),a=t(97109),s=t(11702),o=t(17807),l=t(63455),r=t(85114),c=t(85493),d=t(68787),m=t(84253),p=t(38332),u=t(26171),h=t(33442),y=t(34052),g=t(2256),x=t(7576),f=t(38770),j=t(58569),b=t(57271),A=t(83914),S=t(3638),v=t(32565),I=t(99452);function w(){return(w=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}let k=a.forwardRef(({prefixCls:e="rc-switch",className:n,checked:t,defaultChecked:i,disabled:s,loadingIcon:o,checkedChildren:l,unCheckedChildren:r,onClick:c,onChange:d,onKeyDown:m,styles:p,classNames:u,...h},y)=>{let[g,x]=(0,v.A)(i??!1,t);function f(e,n){let t=g;return s||(x(t=e),d?.(t,n)),t}let j=(0,S.$)(e,n,{[`${e}-checked`]:g,[`${e}-disabled`]:s});return a.createElement("button",w({},h,{type:"button",role:"switch","aria-checked":g,disabled:s,className:j,ref:y,onKeyDown:function(e){e.which===I.A.LEFT?f(!1,e):e.which===I.A.RIGHT&&f(!0,e),m?.(e)},onClick:function(e){let n=f(!g,e);c?.(n,e)}}),o,a.createElement("span",{className:`${e}-inner`},a.createElement("span",{className:(0,S.$)(`${e}-inner-checked`,u?.content),style:p?.content},l),a.createElement("span",{className:(0,S.$)(`${e}-inner-unchecked`,u?.content),style:p?.content},r)))});k.displayName="Switch";var $=t(82813),T=t(92162),E=t(38862),C=t(74567),R=t(6831),z=t(27273),N=t(15561),O=t(47252),P=t(7961),q=t(16666),D=t(10540),L=t(28403);let H=(0,D.OF)("Switch",e=>{let n=(0,L.oX)(e,{switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchLoadingIconSize:e.calc(e.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[(e=>{let{componentCls:n,trackHeight:t,trackMinWidth:i}=e;return{[n]:{...(0,P.dF)(e),position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:i,height:t,lineHeight:(0,N.zA)(t),verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",...(0,q.V)(),[`&:hover:not(${n}-disabled)`]:{background:e.colorTextTertiary},...(0,P.K8)(e),[`&${n}-checked`]:{background:e.switchColor,[`&:hover:not(${n}-disabled)`]:{background:e.colorPrimaryHover}},[`&${n}-loading, &${n}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${n}-rtl`]:{direction:"rtl"}}}})(n),(e=>{let{componentCls:n,trackHeight:t,trackPadding:i,innerMinMargin:a,innerMaxMargin:s,handleSize:o,switchDuration:l,calc:r}=e,c=`${n}-inner`,d=(0,N.zA)(r(o).add(r(i).mul(2)).equal()),m=(0,N.zA)(r(s).mul(2).equal());return{[n]:{[c]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:s,paddingInlineEnd:a,transition:["padding-inline-start","padding-inline-end"].map(e=>`${e} ${l} ease-in-out`).join(", "),...(0,q.V)(),[`${c}-checked, ${c}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,pointerEvents:"none",minHeight:t,transition:["margin-inline-start","margin-inline-end"].map(e=>`${e} ${l} ease-in-out`).join(", "),...(0,q.V)()},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${m})`,marginInlineEnd:`calc(100% - ${d} + ${m})`},[`${c}-unchecked`]:{marginTop:r(t).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${n}-checked ${c}`]:{paddingInlineStart:a,paddingInlineEnd:s,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${m})`,marginInlineEnd:`calc(-100% + ${d} - ${m})`}},[`&:not(${n}-disabled):active`]:{[`&:not(${n}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:r(i).mul(2).equal(),marginInlineEnd:r(i).mul(-1).mul(2).equal()}},[`&${n}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:r(i).mul(-1).mul(2).equal(),marginInlineEnd:r(i).mul(2).equal()}}}}}})(n),(e=>{let{componentCls:n,trackPadding:t,handleBg:i,handleShadow:a,handleSize:s,calc:o}=e,l=`${n}-handle`;return{[n]:{[l]:{position:"absolute",top:t,insetInlineStart:t,width:s,height:s,transition:`all ${e.switchDuration} ease-in-out`,...(0,q.V)(),"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:i,borderRadius:o(s).div(2).equal(),boxShadow:a,transition:`all ${e.switchDuration} ease-in-out`,content:'""',...(0,q.V)()}},[`&${n}-checked ${l}`]:{insetInlineStart:`calc(100% - ${(0,N.zA)(o(s).add(t).equal())})`},[`&:not(${n}-disabled):active`]:{[`${l}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${n}-checked ${l}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}})(n),(e=>{let{componentCls:n,handleSize:t,calc:i}=e;return{[n]:{[`${n}-loading-icon${e.iconCls}`]:{position:"relative",top:i(i(t).sub(e.fontSize)).div(2).equal(),color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${n}-checked ${n}-loading-icon`]:{color:e.switchColor}}}})(n),(e=>{let{componentCls:n,trackHeightSM:t,trackPadding:i,trackMinWidthSM:a,innerMinMarginSM:s,innerMaxMarginSM:o,handleSizeSM:l,calc:r}=e,c=`${n}-inner`,d=(0,N.zA)(r(l).add(r(i).mul(2)).equal()),m=(0,N.zA)(r(o).mul(2).equal());return{[n]:{[`&${n}-small`]:{minWidth:a,height:t,lineHeight:(0,N.zA)(t),[`${n}-inner`]:{paddingInlineStart:o,paddingInlineEnd:s,[`${c}-checked, ${c}-unchecked`]:{minHeight:t},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${m})`,marginInlineEnd:`calc(100% - ${d} + ${m})`},[`${c}-unchecked`]:{marginTop:r(t).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${n}-handle`]:{width:l,height:l},[`${n}-loading-icon`]:{top:r(r(l).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${n}-checked`]:{[`${n}-inner`]:{paddingInlineStart:s,paddingInlineEnd:o,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${m})`,marginInlineEnd:`calc(-100% + ${d} - ${m})`}},[`${n}-handle`]:{insetInlineStart:`calc(100% - ${(0,N.zA)(r(l).add(i).equal())})`}},[`&:not(${n}-disabled):active`]:{[`&:not(${n}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:r(e.marginXXS).div(2).equal(),marginInlineEnd:r(e.marginXXS).mul(-1).div(2).equal()}},[`&${n}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:r(e.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:r(e.marginXXS).div(2).equal()}}}}}}})(n)]},e=>{let{fontSize:n,lineHeight:t,controlHeight:i,colorWhite:a}=e,s=n*t,o=i/2,l=s-4,r=o-4;return{trackHeight:s,trackHeightSM:o,trackMinWidth:2*l+8,trackMinWidthSM:2*r+4,trackPadding:2,handleBg:a,handleSize:l,handleSizeSM:r,handleShadow:`0 2px 4px 0 ${new O.Y("#00230b").setA(.2).toRgbString()}`,innerMinMargin:l/2,innerMaxMargin:l+2+4,innerMinMarginSM:r/2,innerMaxMarginSM:r+2+4}}),U=a.forwardRef((e,n)=>{let{prefixCls:t,size:i,disabled:s,loading:o,className:l,rootClassName:r,style:c,checked:d,value:m,defaultChecked:p,defaultValue:u,onChange:h,styles:y,classNames:g,...x}=e,[f,j]=(0,$.PW)(p??u??!1,d??m),{getPrefixCls:b,direction:v,className:I,style:w,classNames:N,styles:O}=(0,C.TP)("switch"),P=a.useContext(R.A),q=(s??P)||o,D=b("switch",t),[L,U]=H(D),B=(0,z.A)(i),J={...e,size:B,disabled:q},_=(0,T.XT)(w),F=(0,T.XT)(c),[W,M]=(0,T.AV)([N,g],[O,_,y,F],{props:J}),V=a.createElement("div",{className:(0,S.$)(`${D}-handle`,W.indicator),style:M.indicator},o&&a.createElement(A.A,{className:`${D}-loading-icon`})),X=(0,S.$)(I,{[`${D}-small`]:"small"===B,[`${D}-loading`]:o,[`${D}-rtl`]:"rtl"===v},l,r,W.root,L,U);return a.createElement(E.A,{component:"Switch",disabled:q},a.createElement(k,{...x,classNames:W,styles:M,checked:f,onChange:(...e)=>{j(e[0]),h?.(...e)},prefixCls:D,className:X,style:M.root,disabled:q,ref:n,loadingIcon:V}))});U.__ANT_SWITCH=!0;var B=t(48318),J=t(54746),_=t(96651),F=t(60470),W=t(99650),M=t(58209),V=t(6578),X=t(64209);let G=[{label:"文本",value:"text"},{label:"数字",value:"number"},{label:"日期",value:"date"},{label:"表格",value:"table"},{label:"列表",value:"list"}],Q=[{label:"必需事实",value:"required_fact"},{label:"必需章节",value:"required_chapter"},{label:"必需文件角色",value:"required_file_role"},{label:"必需提示词角色",value:"required_prompt_role"},{label:"事实必须有来源",value:"source_required"},{label:"禁止出现文本",value:"forbidden_text"},{label:"章节最低字数",value:"min_chapter_length"},{label:"必须有表格",value:"table_required"}],K=[{label:"错误(阻断)",value:"error"},{label:"警告(提醒)",value:"warning"},{label:"信息(提示)",value:"info"}],Z=e=>{let{label:n,closable:t,onClose:a}=e;return(0,i.jsx)(s.A,{closable:t,onClose:a,color:"blue",style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:n})};function Y(){var e;let n=(0,X.Vr)(),{message:t}=o.A.useApp(),[A]=l.A.useForm(),[S,v]=(0,a.useState)([]),[I,w]=(0,a.useState)([]),[k,$]=(0,a.useState)(!1),[T,E]=(0,a.useState)(!1),C=async()=>{let[e,n]=await Promise.all([(0,V.mx)(),(0,V.lv)()]);v(e.specs),w(n.roles)};(0,a.useEffect)(()=>{C().catch(()=>t.error(n("common.error")))},[t,n]);let R=I.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),z=I.filter(e=>"prompt"===e.type).map(e=>({label:e.name,value:e.id})),[N,O]=(0,a.useState)(0),[P,q]=(0,a.useState)(0),[D,L]=(0,a.useState)(0),H=()=>{var e,n,t;O((null!=(e=A.getFieldValue("factFields"))?e:[]).length),q((null!=(n=A.getFieldValue("chapterRules"))?n:[]).length),L((null!=(t=A.getFieldValue("gateRules"))?t:[]).length)},Y=(null!=(e=l.A.useWatch("factFields",A))?e:[]).filter(e=>e.id&&e.name).map(e=>({label:"".concat(e.name,"(").concat(e.id,")"),value:e.id})),ee=e=>{A.setFieldsValue(null!=e?e:{id:"spec-".concat(Date.now()),name:"",description:"",factFields:[{id:"document-goal",name:"文档目标",type:"text",required:!0},{id:"target-audience",name:"目标读者",type:"text",required:!1},{id:"key-conclusion",name:"关键结论",type:"list",required:!0}],chapterRules:[],gateRules:[]}),$(!0),window.setTimeout(()=>H(),50)},en=async()=>{try{let e=await A.validateFields(),i=await (0,V.EK)(e);v(i.specs),$(!1),t.success(n("common.success"))}catch(e){e instanceof Error&&t.error(e.message)}},et=async e=>{v((await (0,V.ER)(e)).specs)};return(0,i.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"pageTitle",children:n("specs.title")}),(0,i.jsx)("p",{className:"pageDesc",children:n("specs.description")})]}),(0,i.jsx)(r.Ay,{type:"primary",icon:(0,i.jsx)(J.A,{}),onClick:()=>ee(),children:n("specs.newSpec")})]}),(0,i.jsx)(c.A,{type:"info",showIcon:!0,message:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)("span",{children:n("specs.plainGuideTitle")}),(0,i.jsx)(r.Ay,{type:"link",size:"small",icon:T?(0,i.jsx)(_.A,{}):(0,i.jsx)(F.A,{}),onClick:()=>E(!T),style:{padding:"0 4px"},children:T?"收起说明":"展开说明"})]}),description:T?n("specs.plainGuideDesc"):void 0}),(0,i.jsx)(d.A,{size:"small",title:"".concat(n("specs.list")," (").concat(S.length,")"),children:0===S.length?(0,i.jsx)(m.A,{description:n("common.noData")}):(0,i.jsx)(p.A,{dataSource:S,renderItem:(e,t)=>(0,i.jsx)(p.A.Item,{style:{padding:"10px 0"},actions:[(0,i.jsx)(r.Ay,{size:"small",icon:(0,i.jsx)(W.A,{}),onClick:()=>ee(e),children:"编辑"},"edit"),(0,i.jsx)(u.A,{title:n("common.confirm"),disabled:e.builtIn,onConfirm:()=>{et(e.id)},children:(0,i.jsx)(r.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(M.A,{}),disabled:e.builtIn})},"del")],children:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[(0,i.jsx)("div",{style:{width:28,height:28,borderRadius:8,background:"var(--colorFillSecondary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:700,color:"var(--colorTextSecondary)",flexShrink:0},children:t+1}),(0,i.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),e.builtIn&&(0,i.jsx)(s.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"内置"})]}),(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.description&&(0,i.jsx)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:e.description}),(0,i.jsxs)(h.A,{size:4,children:[(0,i.jsxs)(s.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:["事实 ",e.factFields.length]}),(0,i.jsxs)(s.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:["章节 ",e.chapterRules.length]}),(0,i.jsxs)(s.A,{color:"orange",style:{margin:0,fontSize:10,lineHeight:"16px"},children:["门禁 ",e.gateRules.length]})]})]})]})]})})})}),(0,i.jsx)(y.A,{title:n("specs.editor"),open:k,onClose:()=>$(!1),width:800,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,i.jsx)(r.Ay,{type:"primary",onClick:()=>{en()},children:n("common.save")}),children:(0,i.jsxs)(l.A,{form:A,layout:"vertical",onValuesChange:()=>H(),children:[(0,i.jsxs)(g.A,{gutter:12,children:[(0,i.jsx)(l.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(x.A,{})}),(0,i.jsx)(f.A,{xs:24,md:12,children:(0,i.jsx)(l.A.Item,{name:"name",label:n("specs.name"),rules:[{required:!0}],children:(0,i.jsx)(x.A,{})})}),(0,i.jsx)(f.A,{xs:24,md:12,children:(0,i.jsx)(l.A.Item,{name:"description",label:n("specs.specDescription"),children:(0,i.jsx)(x.A,{})})})]}),(0,i.jsx)(j.A,{destroyInactiveTabPane:!1,items:[{key:"facts",label:"".concat(n("specs.facts")," (").concat(N,")"),children:(0,i.jsx)(l.A.List,{name:"factFields",children:(e,t)=>{let{add:a,remove:s}=t;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.map((e,t)=>(0,i.jsxs)(d.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsx)(r.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(M.A,{}),onClick:()=>s(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsx)(l.A.Item,{name:[e.name,"id"],hidden:!0,children:(0,i.jsx)(x.A,{})}),(0,i.jsxs)(g.A,{gutter:[14,8],children:[(0,i.jsx)(f.A,{xs:24,sm:7,children:(0,i.jsx)(l.A.Item,{name:[e.name,"name"],label:n("specs.factName"),rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(x.A,{size:"small"})})}),(0,i.jsx)(f.A,{xs:12,sm:5,children:(0,i.jsx)(l.A.Item,{name:[e.name,"type"],label:n("specs.factType"),style:{marginBottom:0},children:(0,i.jsx)(b.A,{options:G,size:"small"})})}),(0,i.jsx)(f.A,{xs:12,sm:4,children:(0,i.jsx)(l.A.Item,{name:[e.name,"required"],label:n("specs.required"),valuePropName:"checked",style:{marginBottom:0},children:(0,i.jsx)(U,{})})}),(0,i.jsx)(f.A,{xs:24,sm:8,children:(0,i.jsx)(l.A.Item,{name:[e.name,"sourceRoleIds"],label:n("specs.sourceRoles"),style:{marginBottom:0},children:(0,i.jsx)(b.A,{mode:"multiple",showSearch:!0,options:R,tagRender:Z,placeholder:"选择文件角色",size:"small"})})}),(0,i.jsx)(f.A,{xs:24,sm:12,children:(0,i.jsx)(l.A.Item,{name:[e.name,"extractionHint"],label:n("specs.extractionHint"),style:{marginBottom:0},children:(0,i.jsx)(x.A,{size:"small"})})}),(0,i.jsx)(f.A,{xs:24,sm:12,children:(0,i.jsx)(l.A.Item,{name:[e.name,"validationHint"],label:n("specs.validationHint"),style:{marginBottom:0},children:(0,i.jsx)(x.A,{size:"small"})})})]})]},e.key)),(0,i.jsx)(r.Ay,{icon:(0,i.jsx)(J.A,{}),onClick:()=>a({id:"fact-".concat(Date.now()),type:"text",required:!0}),children:n("specs.addFact")})]})}})},{key:"chapters",label:"".concat(n("specs.chapters")," (").concat(P,")"),children:(0,i.jsx)(l.A.List,{name:"chapterRules",children:(e,t)=>{let{add:a,remove:s}=t;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.map((e,t)=>(0,i.jsxs)(d.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsx)(r.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(M.A,{}),onClick:()=>s(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsx)(l.A.Item,{name:[e.name,"id"],hidden:!0,children:(0,i.jsx)(x.A,{})}),(0,i.jsxs)(g.A,{gutter:[14,8],children:[(0,i.jsx)(f.A,{xs:24,sm:7,children:(0,i.jsx)(l.A.Item,{name:[e.name,"title"],label:n("specs.chapterTitle"),rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(x.A,{size:"small"})})}),(0,i.jsx)(f.A,{xs:8,sm:3,children:(0,i.jsx)(l.A.Item,{name:[e.name,"order"],label:n("specs.order"),initialValue:t,style:{marginBottom:0},children:(0,i.jsx)(B.A,{size:"small",style:{width:"100%"}})})}),(0,i.jsx)(f.A,{xs:8,sm:3,children:(0,i.jsx)(l.A.Item,{name:[e.name,"minWords"],label:n("specs.minWords"),style:{marginBottom:0},children:(0,i.jsx)(B.A,{size:"small",style:{width:"100%"}})})}),(0,i.jsx)(f.A,{xs:8,sm:3,children:(0,i.jsx)(l.A.Item,{name:[e.name,"required"],label:n("specs.required"),valuePropName:"checked",style:{marginBottom:0},children:(0,i.jsx)(U,{})})}),(0,i.jsx)(f.A,{xs:24,sm:8,children:(0,i.jsx)(l.A.Item,{name:[e.name,"requiredFactIds"],label:n("specs.requiredFacts"),style:{marginBottom:0},children:(0,i.jsx)(b.A,{mode:"multiple",showSearch:!0,optionFilterProp:"label",placeholder:"选择事实字段",options:Y,tagRender:Z,size:"small"})})}),(0,i.jsx)(f.A,{xs:24,sm:12,children:(0,i.jsx)(l.A.Item,{name:[e.name,"requiredFileRoleIds"],label:n("specs.requiredFileRoles"),style:{marginBottom:0},children:(0,i.jsx)(b.A,{mode:"multiple",showSearch:!0,options:R,tagRender:Z,placeholder:"选择文件角色",size:"small"})})}),(0,i.jsx)(f.A,{xs:24,sm:12,children:(0,i.jsx)(l.A.Item,{name:[e.name,"requiredPromptRoleIds"],label:n("specs.requiredPromptRoles"),style:{marginBottom:0},children:(0,i.jsx)(b.A,{mode:"multiple",showSearch:!0,options:z,tagRender:Z,placeholder:"选择提示词角色",size:"small"})})}),(0,i.jsx)(f.A,{xs:24,children:(0,i.jsx)(l.A.Item,{name:[e.name,"generationHint"],label:n("specs.generationHint"),style:{marginBottom:0},children:(0,i.jsx)(x.A,{size:"small"})})})]})]},e.key)),(0,i.jsx)(r.Ay,{icon:(0,i.jsx)(J.A,{}),onClick:()=>a({id:"chapter-".concat(Date.now()),order:e.length,required:!0}),children:n("specs.addChapter")})]})}})},{key:"gates",label:"".concat(n("specs.gates")," (").concat(D,")"),children:(0,i.jsx)(l.A.List,{name:"gateRules",children:(e,t)=>{let{add:a,remove:s}=t;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.map((e,t)=>(0,i.jsxs)(d.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsx)(r.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(M.A,{}),onClick:()=>s(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsx)(l.A.Item,{name:[e.name,"id"],hidden:!0,children:(0,i.jsx)(x.A,{})}),(0,i.jsxs)(g.A,{gutter:[12,8],align:"middle",children:[(0,i.jsx)(f.A,{xs:24,sm:6,children:(0,i.jsx)(l.A.Item,{name:[e.name,"name"],label:"名称",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(x.A,{placeholder:n("specs.gateName"),size:"small"})})}),(0,i.jsx)(f.A,{xs:12,sm:6,children:(0,i.jsx)(l.A.Item,{name:[e.name,"type"],label:"类型",style:{marginBottom:0},children:(0,i.jsx)(b.A,{options:Q,size:"small"})})}),(0,i.jsx)(f.A,{xs:12,sm:3,children:(0,i.jsx)(l.A.Item,{name:[e.name,"level"],label:"级别",style:{marginBottom:0},children:(0,i.jsx)(b.A,{options:K,size:"small"})})}),(0,i.jsx)(f.A,{xs:12,sm:4,children:(0,i.jsx)(l.A.Item,{name:[e.name,"target"],label:"目标",style:{marginBottom:0},children:(0,i.jsx)(x.A,{placeholder:"target",size:"small"})})}),(0,i.jsx)(f.A,{xs:12,sm:5,children:(0,i.jsx)(l.A.Item,{name:[e.name,"value"],label:"值",style:{marginBottom:0},children:(0,i.jsx)(x.A,{placeholder:"value",size:"small"})})})]})]},e.key)),(0,i.jsx)(r.Ay,{icon:(0,i.jsx)(J.A,{}),onClick:()=>a({id:"gate-".concat(Date.now()),type:"required_fact",level:"error"}),children:n("specs.addGate")})]})}})}]})]})})]})}},94773:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-specs",function(){return t(51533)}])}},e=>{e.O(0,[4260,4277,7889,1210,7576,9551,2700,4696,9189,5695,5938,4052,8332,636,6593,8792],()=>e(e.s=94773)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4298],{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 i(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function s(e){var t,n;let i=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&i.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&i.set("category",e.category),(null==e?void 0:e.page)&&i.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&i.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(i))}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 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 l(e,t,n){return o("/api/kb/files/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function c(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 c(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function p(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(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){let n=new URLSearchParams({id:e});return t&&n.set("projectRoot",t),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function f(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 g(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 w(){return o("/api/kb/features")}async function j(e,t){var n,i,s,r,a;let l=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&l.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&l.set("category",t.category),(null==t?void 0:t.limit)&&l.set("limit",String(null!=(a=t.limit)?a:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&l.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(i=t.weights)?void 0:i.vector)!=null&&l.set("vectorWeight",String(t.weights.vector)),(null==t||null==(s=t.weights)?void 0:s.rewrite)!=null&&l.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(r=t.weights)?void 0:r.hybridBonus)!=null&&l.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(l))}async function v(){return o("/api/prompt")}async function S(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 k(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function A(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function I(){return o("/api/documents/specs")}async function C(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 P(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function L(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function _(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function D(){return o("/api/documents/generated")}async function z(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function N(e,t){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function U(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function M(){return o("/api/assets/generated")}async function J(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function F(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function W(e,t){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function B(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function H(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function q(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),n=t.headers.get("content-type")||"",o=async()=>{let e=await t.text(),n=e||"导出失败";try{var o;let t=JSON.parse(e),i=null==(o=t.issues)?void 0:o.map(e=>e.message).filter(Boolean).slice(0,3).join(";");n=i?"".concat(t.error||"导出失败",":").concat(i):t.error||n}catch(e){}throw Error(n.length>300?"".concat(n.slice(0,300),"..."):n)};return t.ok||await o(),"pdf"!==e.format||n.includes("application/pdf")||await o(),"docx"!==e.format||n.includes("officedocument.wordprocessingml.document")||await o(),t.blob()}async function G(){return o("/api/config/providers")}async function K(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function V(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function X(){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 $(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Y(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function ee(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function et(){return o("/api/system/stats")}async function en(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return o("/api/system/logs?limit=".concat(e))}async function eo(){return o("/api/system/logs",{method:"DELETE"})}async function ei(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function es(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function er(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ea(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function el(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ec(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ed(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>H,Bh:()=>ed,CU:()=>h,Dl:()=>R,E:()=>ea,EK:()=>C,ER:()=>E,FC:()=>et,FV:()=>k,H1:()=>x,H7:()=>m,HC:()=>a,HT:()=>s,II:()=>Z,JU:()=>J,NR:()=>A,OX:()=>_,PH:()=>er,QG:()=>U,QT:()=>p,Qx:()=>u,R1:()=>B,SJ:()=>y,UE:()=>q,VW:()=>w,W2:()=>j,X8:()=>g,Z3:()=>G,_m:()=>K,a6:()=>N,aP:()=>Q,bV:()=>L,bZ:()=>ee,c1:()=>d,cQ:()=>D,dd:()=>$,dg:()=>b,dw:()=>T,dx:()=>v,f$:()=>M,h0:()=>O,h1:()=>V,hH:()=>eo,hc:()=>i,hn:()=>ei,l2:()=>P,lv:()=>S,mx:()=>I,oH:()=>en,oS:()=>W,p:()=>es,tn:()=>l,u6:()=>Y,uc:()=>F,v7:()=>z,xC:()=>r,xq:()=>f,xw:()=>el,zo:()=>ec,zr:()=>X})},16403:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return n(19562)}])},19562:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>ee});var o=n(65321),i=n(97109),s=n(7576),r=n(35292),a=n(17807),l=n(63455),c=n(42700),d=n(85114),p=n(68787),u=n(84253),m=n(38332),h=n(26171),f=n(11702),y=n(33442),g=n(34052),x=n(9730),w=n(58569),j=n(76506),v=n(25258),S=n(2256),b=n(38770),k=n(57271),A=n(23216),T=n(26619),I=n(8263),C=n(16285),E=n(8579),R=n(75548),P=n(7851),O=n(84742),L=n(29071),_=n(63552),D=n(26631),z=n(76830),N=n(83914),U=n(58209),M=n(54746),J=n(71330),F=n(64068),W=n(93051),B=n(67547),H=n(99811),q=n(6578),G=n(64209);let{TextArea:K}=s.A,{Paragraph:V,Text:X}=r.A,Q=null;function Z(){null==Q||Q.listeners.forEach(e=>e())}let $={role_binding:(0,o.jsx)(A.A,{}),knowledge_retrieval:(0,o.jsx)(T.A,{}),file_understanding:(0,o.jsx)(I.A,{}),fact_extraction:(0,o.jsx)(C.A,{}),chapter_generation:(0,o.jsx)(E.A,{}),asset_generation:(0,o.jsx)(R.A,{}),validation:(0,o.jsx)(P.A,{}),formatting:(0,o.jsx)(O.A,{}),llm_review:(0,o.jsx)(L.A,{}),export_ready:(0,o.jsx)(_.A,{}),reference:(0,o.jsx)(R.A,{})},Y={role_binding:"角色配置绑定",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",asset_generation:"多模态资源生成",validation:"规则校验",formatting:"格式化排版",llm_review:"LLM 审查优化",export_ready:"导出就绪",reference:"参考资源处理"};function ee(){let e=(0,G.Vr)(),{message:t}=a.A.useApp(),[n]=l.A.useForm(),r=(0,i.useRef)(null),[V,ee]=(0,i.useState)([]),[et,en]=(0,i.useState)("construction-organization-design"),[eo,ei]=(0,i.useState)([]),[es,er]=(0,i.useState)([]),[ea,el]=(0,i.useState)([]),[ec,ed]=(0,i.useState)(!0),[ep,eu]=(0,i.useState)(!1),[em,eh]=(0,i.useState)(null),[ef,ey]=(0,i.useState)(""),[eg,ex]=(0,i.useState)([]),[ew,ej]=(0,i.useState)(null),[ev,eS]=(0,i.useState)(!1),[eb,ek]=(0,i.useState)(null),[eA,eT]=(0,i.useState)(!1),[eI,eC]=(0,i.useState)([]),[eE,eR]=(0,i.useState)(null),[eP,eO]=(0,i.useState)("templates"),[eL,e_]=(0,i.useState)(!1),[eD,ez]=(0,i.useState)("workflow"),eN=async()=>{try{ex((await (0,q.cQ)()).documents)}catch(e){ex([])}};(0,i.useEffect)(()=>{let e=()=>{Q&&(eC(Q.flowSteps),eR(Q.activeFlowKey),eu(Q.loading),Q.draft&&eh(Q.draft),void 0!==Q.content&&ey(Q.content))};return null==Q||Q.listeners.add(e),e(),()=>{null==Q||Q.listeners.delete(e)}},[]),(0,i.useEffect)(()=>{ed(!0),Promise.all([(0,q.Dl)().then(e=>{var t,n;ee(e.templates),en(null!=(n=null==(t=e.templates[0])?void 0:t.id)?n:"construction-organization-design")}),(0,q.lv)().then(e=>{ei(e.roles),er(e.configs)}),(0,q.mx)().then(e=>el(e.specs)),eN()]).catch(()=>t.error(e("common.error"))).finally(()=>ed(!1))},[t,e]);let eU=(0,i.useMemo)(()=>V.find(e=>e.id===et),[V,et]),eM=es.map(e=>({label:e.name,value:e.id})),eJ=ea.map(e=>({label:e.name,value:e.id})),eF=Math.max(0,eI.findIndex(e=>e.key===eE)),eW=async n=>{ej(n.id),en(n.templateId),ez("editor"),eC([]),eR(null);try{let{document:e}=await (0,q.v7)(n.id);eh(e.draft||null),ey(e.editedMarkdown||e.markdown)}catch(n){t.error(e("common.error"))}e_(!0)},eB=e=>e.map((e,t)=>({key:"sub-".concat(t),title:e,status:"wait"})),eH=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eU,n=ea.find(e=>e.id===(null==t?void 0:t.documentSpecId)),i=es.find(e=>e.id===(null==t?void 0:t.projectRoleConfigId)),s=((null==i?void 0:i.fileRoles)||[]).map(e=>{var t;return(null==(t=eo.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),r=((null==i?void 0:i.promptRoles)||[]).map(e=>{var t;return(null==(t=eo.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),a=(null==n?void 0:n.factFields.map(e=>e.name))||(null==t?void 0:t.chapters.flatMap(e=>e.requiredFacts))||[],l=(null==t?void 0:t.chapters.map(e=>e.title))||[],c=r.some(e=>/封面|图片|资源|cover|image/iu.test(e));return[{key:"prepare",title:e("documents.flowPrepare"),description:'读取"'.concat((null==t?void 0:t.name)||"当前模板",'"并创建后台生成任务'),status:"process",icon:(0,o.jsx)(D.A,{}),subSteps:eB(["读取模板参数",(null==t?void 0:t.documentSpecId)?"加载规范包:".concat((null==n?void 0:n.name)||t.documentSpecId):"未绑定规范包,使用模板章节要求","创建后台生成任务"])},{key:"role_binding",title:"动态角色配置绑定",description:"绑定 ".concat(s.length," 个文件角色、").concat(r.length," 个提示词角色"),status:"wait",icon:(0,o.jsx)(A.A,{}),subSteps:eB([...s.length?s.map(e=>"文件角色:".concat(e)):["没有文件角色,使用模板绑定文件"],...r.length?r.map(e=>"提示词角色:".concat(e)):["没有提示词角色,使用默认生成策略"]].slice(0,10))},{key:"knowledge_retrieval",title:"知识库证据检索",description:"按 ".concat(l.length," 个章节检索文本、文档、表格、图片、图纸和附件"),status:"wait",icon:(0,o.jsx)(T.A,{}),subSteps:eB(l.length?l.slice(0,10).map(e=>"检索章节:".concat(e)):["按模板标题检索证据"])},{key:"file_understanding",title:"多类型文件理解",description:"按文件角色处理文本、PDF/Word、表格、图片、图纸和附件",status:"wait",icon:(0,o.jsx)(I.A,{}),subSteps:eB(["识别文件类型和角色","构建结构化资源证据包","必要时调用多模态文件理解"])},{key:"fact_extraction",title:"动态 schema 事实抽取",description:"按 ".concat(a.length," 个规范/章节事实字段抽取并检测冲突"),status:"wait",icon:(0,o.jsx)(C.A,{}),subSteps:eB(a.length?a.slice(0,10).map(e=>"抽取事实:".concat(e)):["抽取模板要求的事实","合并来源和角色","检测事实冲突"])},{key:"chapter_generation",title:"章节生成",description:"按 ".concat(l.length," 个模板章节逐章生成"),status:"wait",icon:(0,o.jsx)(E.A,{}),subSteps:eB(l.length?l.slice(0,10).map(e=>"生成:".concat(e)):["构造章节提示词","等待 LLM 生成","整理章节证据"])},...c?[{key:"asset_generation",title:"生成资源处理",description:"根据资源/图片提示词生成或登记本地资源",status:"wait",icon:(0,o.jsx)(R.A,{}),subSteps:eB(["生成资源提示词","保存到 generatedDocuments/assets","登记资源元数据"])}]:[],{key:"validation",title:"规范包与门禁校验",description:n?"执行 ".concat(n.gateRules.length," 条门禁规则"):"执行模板基础校验",status:"wait",icon:(0,o.jsx)(P.A,{}),subSteps:eB([...(null==n?void 0:n.factFields.filter(e=>e.required).map(e=>"必填事实:".concat(e.name)))||[],...(null==n?void 0:n.gateRules.map(e=>"门禁:".concat(e.name)))||["检查章节证据","检查缺失项","检查导出门禁"]].slice(0,10))},{key:"formatting",title:e("documents.flowFormatting"),description:"整理标题、表格、图片、附件引用和正式 Markdown",status:"wait",icon:(0,o.jsx)(O.A,{}),subSteps:eB(["整理标题层级","整理多类型资源引用","生成正式 Markdown"])},{key:"llm_review",title:"LLM 审查优化",description:"再次使用动态 schema、角色和结构化证据审查优化初稿",status:"wait",icon:(0,o.jsx)(L.A,{}),subSteps:eB(["构造审查提示词","检查事实来源和冲突","回填优化后的 Markdown"])},{key:"export_ready",title:"导出就绪",description:"确认 Markdown/HTML/DOCX/PDF 可导出",status:"wait",icon:(0,o.jsx)(_.A,{}),subSteps:eB(["生成导出检查清单","确认阻断项","准备导出格式"])},{key:"done",title:e("documents.flowDone"),description:e("documents.flowDoneDesc"),status:"wait",icon:(0,o.jsx)(z.A,{}),subSteps:eB(["展示生成结果","允许编辑正文","允许导出文件"])}]},eq=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ep;(null==Q?void 0:Q.loading)&&(Q.flowSteps=e,Q.activeFlowKey=t,Q.loading=n,Z())},eG=(e,t)=>{if("wait"===t)return e.subSteps.map(e=>({...e,status:"wait"}));if("finish"===t)return e.subSteps.map(e=>({...e,status:"finish"}));if("error"===t)return e.subSteps.map((e,t)=>({...e,status:0===t?"error":e.status}));let n=e.subSteps.findIndex(e=>"wait"===e.status);return e.subSteps.map((e,t)=>t<n||-1===n?{...e,status:"finish"}:t===n?{...e,status:"process"}:e)},eK=(e,t,n)=>{eR(e),eC(o=>{let i=o.map(o=>o.key===e?{...o,status:t,description:n||o.description,subSteps:eG(o,t)}:o);return eq(i,e),i})};(0,i.useEffect)(()=>{if(!ep||!eE)return;let e=window.setInterval(()=>eC(e=>{let t=e.map(e=>{if(e.key!==eE||"process"!==e.status)return e;let t=e.subSteps.findIndex(e=>"process"===e.status),n=t<0?0:Math.min(t+1,e.subSteps.length-1);return{...e,subSteps:e.subSteps.map((e,t)=>t<n?{...e,status:"finish"}:t===n?{...e,status:"process"}:{...e,status:"wait"})}});return eq(t,eE),t}),1400);return()=>window.clearInterval(e)},[eE,ep]);let eV=e=>{eC(t=>{let n=t.findIndex(t=>t.key===e),o=t.map((e,t)=>t<n&&"error"!==e.status?{...e,status:"finish",subSteps:eG(e,"finish")}:e);return eq(o,e),o})},eX=e=>{n.setFieldsValue(null!=e?e:{id:"tpl-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,documentSpecId:void 0,chapters:[]}),eT(!0)},eQ=async()=>{try{let o=await n.validateFields(),i=await (0,q.l2)(o);ee(i.templates),en(i.template.id),eT(!1),await eN(),t.success(e("common.success"))}catch(e){e instanceof Error&&t.error(e.message)}},eZ=async n=>{try{let o=await (0,q.bV)(n);ee(o.templates),en(o.template.id),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}},e$=async n=>{try{var o,i;let s=await (0,q.h0)(n);ee(s.templates),en(null!=(i=null==(o=s.templates[0])?void 0:o.id)?i:""),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}},eY=async n=>{try{await (0,q.QG)(n),ew===n&&(ej(null),eh(null),ey("")),await eN(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}},e0=async e=>{let t=[{k:"chapter_generation",m:"后台任务已创建,正在轮询等待 LLM 章节生成完成…"},{k:"asset_generation",m:"正在轮询等待封面和生成资源写入本地记录…"},{k:"validation",m:"正在轮询等待校验、导出门禁和格式化完成…"},{k:"llm_review",m:"正在轮询等待 LLM 审查优化完成…"}],n=0;for(;;){let{document:o}=await (0,q.v7)(e);if(("completed"===o.status||"warning"===o.status)&&o.draft)return o;if("failed"===o.status)throw Error(o.error||"生成失败");let i=t[Math.min(n,t.length-1)];eV(i.k),eK(i.k,"process",i.m),n++,await new Promise(e=>window.setTimeout(e,1500))}},e1=async()=>{if(!et)return;if(null==Q?void 0:Q.loading){eC(Q.flowSteps),eR(Q.activeFlowKey),eu(!0);return}eu(!0);let n=eH(V.find(e=>e.id===et)||eU),o=(0,q.OX)({templateId:et});Q={id:Date.now(),templateId:et,loading:!0,flowSteps:n,activeFlowKey:"prepare",promise:o,listeners:new Set},eC(n),eR("prepare");let i=[{k:"role_binding",m:"正在读取模板、文件角色、提示词角色和文档规范包…"},{k:"knowledge_retrieval",m:"正在从知识库检索章节证据、表格、图片和附件…"},{k:"file_understanding",m:"正在准备多模态文件理解…"},{k:"fact_extraction",m:"正在等待 LLM 事实抽取和后续章节生成结果…"}].map((e,t)=>window.setTimeout(()=>{eV(e.k),eK(e.k,"process",e.m)},600+900*t));try{let n=await o,s=n.documentId?await e0(n.documentId):void 0,a=n.draft||(null==s?void 0:s.draft);if(!a)throw Error("生成结果为空");(n.documentId||(null==s?void 0:s.id))&&ej(n.documentId||s.id),i.forEach(e=>window.clearTimeout(e)),eV("done"),eh(a),ey((null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||a.markdown),(null==Q?void 0:Q.promise)===o&&(Q.draft=a,Q.content=(null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||a.markdown),eC(t=>{let n=t.map(t=>{let n=a.executionStages.find(e=>e.type===t.key);if("prepare"===t.key)return{...t,status:"finish",description:e("documents.flowPrepareDone"),subSteps:eG(t,"finish")};if("done"===t.key){var o;let n=a.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!a.exportGate.passed,i=n?"warning":"finish",s=null==(o=a.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:o.message;return{...t,status:i,description:n?"生成完成,但需复核:".concat(s||e("documents.flowGateFailed")):e("documents.flowDoneDesc"),subSteps:eG(t,i)}}if(!n)return"process"===t.status?{...t,status:"finish",subSteps:eG(t,"finish")}:t;let i="failed"===n.status?"error":"finish";return{...t,status:i,description:"".concat(n.status.toUpperCase(),":").concat(n.message||t.description),subSteps:eG(t,i)}});return eq(n,"done",!1),n}),eR("done"),(null==Q?void 0:Q.promise)===o&&(Q.activeFlowKey="done",Q.loading=!1,Z()),await eN(),t.success(e("common.success")),window.setTimeout(()=>{var e;return null==(e=r.current)?void 0:e.scrollIntoView({behavior:"smooth",block:"start"})},200)}catch(i){let n=i instanceof Error?i.message:e("common.error");eC(e=>{let t=e.map(e=>"process"===e.status?{...e,status:"error",description:n,subSteps:eG(e,"error")}:e);return eq(t,eE,!1),t}),(null==Q?void 0:Q.promise)===o&&(Q.loading=!1,Q.error=n,Z()),t.error(n)}finally{i.forEach(e=>window.clearTimeout(e)),eu(!1),(null==Q?void 0:Q.promise)===o&&(Q.loading=!1,Z())}},e2=(0,i.useRef)(!1);(0,i.useEffect)(()=>{eL&&"workflow"===eD&&!e2.current&&(null==eU?void 0:eU.projectRoleConfigId)&&(e2.current=!0,window.setTimeout(()=>{e1()},300)),eL||(e2.current=!1)},[eL,eD]);let e6=async n=>{if(em){eS(!0);try{var o;let e="markdown"===n?"md":n,t=null==(o=ea.find(e=>e.id===(null==eU?void 0:eU.documentSpecId)))?void 0:o.wordTemplatePath,i=await (0,q.UE)({documentId:ew||void 0,title:em.title,markdown:ef,format:n,enforceGate:!1,exportGate:em.exportGate,wordTemplatePath:t});((e,t,n)=>{let o=new Blob([e],{type:n}),i=URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=t,s.target="_self",s.rel="noopener",s.style.display="none",document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),s.remove(),window.setTimeout(()=>URL.revokeObjectURL(i),1e3)})(i,"".concat(em.title,".").concat(e),{markdown:"text/markdown;charset=utf-8",html:"text/html;charset=utf-8",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}[n])}catch(n){t.error(n instanceof Error?n.message:e("common.error"))}finally{eS(!1)}}},e8=async()=>{if(em)try{if(ew)await (0,q.a6)(ew,{editedMarkdown:ef,markdown:ef});else{let e=await (0,q.Af)({...em,markdown:ef});eh(e.draft)}await eN(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}},e5=async n=>{if(em){ek(n.id);try{var o;let i=await (0,q.R1)({templateId:em.templateId,chapterId:n.id});eh({...em,chapters:em.chapters.map(e=>e.id===n.id?i.chapter:e)}),o=i.chapter,ey(e=>e.includes(n.content)?e.replace(n.content,o.content):"".concat(e,"\n\n").concat(o.content)),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{ek(null)}}};if(ec)return(0,o.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:300},children:(0,o.jsx)(c.A,{size:"large"})});let e3="workflow"===eD?"工作流:".concat((null==eU?void 0:eU.name)||"选择模板"):"编辑:".concat((null==em?void 0:em.title)||(null==eU?void 0:eU.outputTitle)||"文档");return(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("documents.title")}),(0,o.jsx)("p",{className:"pageDesc",children:e("documents.description")})]}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(M.A,{}),onClick:()=>eX(),children:e("documents.newTemplate")})]}),(0,o.jsx)(p.A,{size:"small",tabList:[{key:"templates",label:"模板库 (".concat(V.length,")")},{key:"drafts",label:"生成记录 (".concat(eg.length,")")}],activeTabKey:eP,onTabChange:eO,children:"templates"===eP?0===V.length?(0,o.jsx)(u.A,{description:e("common.noData")}):(0,o.jsx)(m.A,{dataSource:V,renderItem:(t,n)=>(0,o.jsx)(m.A.Item,{style:{cursor:"pointer",padding:"10px 0"},actions:[(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(J.A,{}),onClick:e=>{e.stopPropagation(),eX(t)},children:"配置"},"cfg"),(0,o.jsx)(d.Ay,{size:"small",type:"primary",icon:(0,o.jsx)(F.A,{}),onClick:e=>{e.stopPropagation(),en(t.id),ez("workflow"),e_(!0)},disabled:!t.projectRoleConfigId,children:"运行"},"run"),(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(W.A,{}),onClick:e=>{e.stopPropagation(),eZ(t.id)}},"copy"),(0,o.jsx)(h.A,{title:e("documents.deleteTemplateConfirm"),disabled:t.builtIn,onConfirm:e=>{null==e||e.stopPropagation(),e$(t.id)},children:(0,o.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,o.jsx)(U.A,{}),disabled:t.builtIn,onClick:e=>e.stopPropagation()})},"del")],onClick:()=>en(t.id),children:(0,o.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[(0,o.jsx)(D.A,{style:{fontSize:16,color:et===t.id?"var(--colorAccent)":"var(--colorTextSecondary)",marginTop:2,flexShrink:0}}),(0,o.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,o.jsx)("span",{style:{fontWeight:et===t.id?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),t.builtIn&&(0,o.jsx)(f.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"内置"}),et===t.id&&(0,o.jsx)(f.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"当前"}),(0,o.jsx)(f.A,{style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:t.category})]}),t.description&&(0,o.jsx)(X,{type:"secondary",style:{fontSize:12,lineHeight:"18px"},children:t.description})]})]})})}):0===eg.length?(0,o.jsx)(u.A,{description:e("common.noData")}):(0,o.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:eg.slice(0,15).map((e,t)=>{var n,i,s;let r;return(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",border:"1px solid var(--colorBorderSecondary)",borderRadius:10,cursor:"pointer",background:ew===e.id?"var(--colorFillAlter)":void 0,minWidth:0},onClick:()=>{eW(e)},children:[(0,o.jsx)(D.A,{style:{fontSize:18,color:"var(--colorAccent)",flexShrink:0}}),(0,o.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,o.jsx)("div",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:3},children:e.title}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px 10px",color:"var(--colorTextSecondary)",fontSize:11},children:[(0,o.jsx)("span",{children:new Date(e.updatedAt).toLocaleString()}),(0,o.jsxs)("span",{children:["耗时 ",(e=>{let t=Math.max(0,Math.round(((e.completedAt||e.updatedAt)-e.createdAt)/1e3));if(t<60)return"".concat(t," 秒");let n=Math.floor(t/60),o=t%60;if(n<60)return o?"".concat(n," 分 ").concat(o," 秒"):"".concat(n," 分");let i=Math.floor(n/60),s=n%60;return s?"".concat(i," 小时 ").concat(s," 分"):"".concat(i," 小时")})(e)]})]}),("warning"===e.status||"failed"===e.status)&&(0,o.jsx)("div",{style:{marginTop:3,color:"failed"===e.status?"var(--colorError)":"var(--colorWarning)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(null==(n=e.warningIssues)?void 0:n[0])||(null==(s=e.draft)||null==(i=s.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:i.message)||"需复核"})]}),(0,o.jsxs)(y.A,{size:4,align:"center",children:[(0,o.jsx)(f.A,{color:"completed"===(r=e.status)?"success":"warning"===r?"warning":"failed"===r?"error":"processing",style:{margin:0,fontSize:10,lineHeight:"18px"},children:"warning"===e.status?"需复核":e.status}),(0,o.jsxs)(f.A,{style:{margin:0,fontSize:10,lineHeight:"18px"},children:["#",t+1]}),(0,o.jsx)(h.A,{title:"确认删除?",onConfirm:t=>{null==t||t.stopPropagation(),eY(e.id)},children:(0,o.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,o.jsx)(U.A,{}),onClick:e=>e.stopPropagation()})}),(0,o.jsx)(d.Ay,{size:"small",type:"primary",icon:(0,o.jsx)(F.A,{}),onClick:t=>{t.stopPropagation(),eW(e)},children:"打开"})]})]},e.id)})})}),(0,o.jsx)(g.A,{title:e3,open:eL,onClose:()=>e_(!1),width:960,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:em?(0,o.jsxs)(y.A,{wrap:!0,children:[(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(B.A,{}),onClick:()=>{e8()},children:e("documents.saveDraft")}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(z.A,{}),loading:ev,onClick:()=>{e6("markdown")},children:"MD"}),(0,o.jsx)(d.Ay,{loading:ev,onClick:()=>{e6("html")},children:"HTML"}),(0,o.jsx)(d.Ay,{loading:ev,onClick:()=>{e6("docx")},children:"DOCX"}),(0,o.jsx)(d.Ay,{type:"primary",loading:ev,onClick:()=>{e6("pdf")},children:"PDF"})]}):void 0,children:(0,o.jsxs)(y.A,{direction:"vertical",style:{width:"100%"},size:"middle",children:["workflow"===eD&&eI.length>0&&(0,o.jsx)(p.A,{size:"small",type:"inner",title:e("documents.executionStatus"),style:{maxHeight:360,overflow:"auto"},children:(0,o.jsx)(x.A,{direction:"vertical",size:"small",current:eF,items:eI.map(e=>{let t;return{title:e.title,description:(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{children:e.description}),(0,o.jsx)("div",{style:{marginTop:4},children:e.subSteps.map(e=>{var t;return(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:12,color:"var(--colorTextSecondary)"},children:["process"===(t=e.status)?(0,o.jsx)(N.A,{}):"finish"===t?(0,o.jsx)(O.A,{}):"warning"===t?(0,o.jsx)(P.A,{style:{color:"var(--colorWarning)"}}):"error"===t?(0,o.jsx)(U.A,{}):(0,o.jsx)("span",{style:{display:"inline-block",height:6,width:6,borderRadius:"50%",background:"var(--colorTextTertiary)"}}),(0,o.jsx)("span",{children:e.title})]},e.key)})})]}),status:"warning"===(t=e.status)?"finish":t,icon:"process"===e.status?(0,o.jsx)(N.A,{}):"warning"===e.status?(0,o.jsx)(P.A,{style:{color:"var(--colorWarning)"}}):e.icon}})})}),"workflow"===eD&&ep&&0===eI.length&&(0,o.jsx)("div",{style:{textAlign:"center",padding:40},children:(0,o.jsx)(c.A,{tip:"正在准备生成…"})}),em&&(0,o.jsx)("div",{ref:r,children:(0,o.jsx)(p.A,{size:"small",title:"编辑器",children:(0,o.jsx)(w.A,{items:[{key:"edit",label:e("documents.edit"),children:(0,o.jsx)(K,{rows:22,value:ef,onChange:e=>ey(e.target.value)})},{key:"chapters-facts",label:"章节与事实",children:(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16,maxHeight:500,overflow:"auto"},children:[em.chapters.length>0&&(0,o.jsxs)("div",{children:[(0,o.jsxs)(X,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["章节 (",em.chapters.length,")"]}),(0,o.jsx)(m.A,{size:"small",dataSource:em.chapters,renderItem:e=>(0,o.jsx)(m.A.Item,{actions:[(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(H.A,{}),loading:eb===e.id,onClick:()=>{e5(e)},children:"重新生成"},"regen")],children:(0,o.jsx)(m.A.Item.Meta,{title:e.title,description:"证据: ".concat(e.evidence.length," \xb7 缺失: ").concat(e.missingFacts.length)})})})]}),em.structuredFacts.length>0&&(0,o.jsxs)("div",{children:[(0,o.jsxs)(X,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["结构化事实 (",em.structuredFacts.length,")"]}),(0,o.jsx)(j.A,{size:"small",column:1,bordered:!0,children:em.structuredFacts.map((e,t)=>(0,o.jsxs)(j.A.Item,{label:e.key,children:[(0,o.jsx)("span",{children:e.value}),(0,o.jsx)(f.A,{style:{marginLeft:8},children:e.confidence.toFixed(2)}),(0,o.jsx)(X,{type:"secondary",style:{fontSize:11,marginLeft:8},children:e.sourceFile})]},t))})]})]})},{key:"sources-missing",label:"来源与缺失",children:(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)(X,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["引用来源 (",em.sources.length,")"]}),0===em.sources.length?(0,o.jsx)(u.A,{description:"暂无"}):(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:em.sources.map(e=>(0,o.jsxs)(f.A,{color:"blue",children:[e.filePath," (",e.count,")"]},e.filePath))})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(X,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["缺失项 (",em.missingItems.length,")"]}),0===em.missingItems.length?(0,o.jsx)(u.A,{description:"无缺失"}):(0,o.jsx)(m.A,{size:"small",dataSource:em.missingItems,renderItem:e=>(0,o.jsx)(m.A.Item,{children:e})})]})]})},{key:"validation",label:"校验 (".concat(em.validationIssues.length,")"),children:0===em.validationIssues.length?(0,o.jsx)(u.A,{description:"校验通过"}):(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8,maxHeight:500,overflow:"auto"},children:[em.validationIssues.map(e=>(0,o.jsxs)("div",{style:{border:"1px solid var(--colorBorderSecondary)",borderRadius:8,padding:12},children:[(0,o.jsx)(f.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:e.level}),(0,o.jsx)("div",{style:{marginTop:6,whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.message}),e.suggestion&&(0,o.jsx)("div",{style:{marginTop:6,color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all"},children:e.suggestion})]},"".concat(e.level,"-").concat(e.message))),em.exportGate.checklist.length>0&&(0,o.jsxs)("div",{style:{marginTop:8},children:[(0,o.jsx)(X,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:"导出门禁"}),(0,o.jsx)(m.A,{size:"small",dataSource:em.exportGate.checklist,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)(X,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.label}),(0,o.jsx)(f.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})]})]})},{key:"stages",label:"执行阶段 (".concat(em.executionStages.length,")"),children:(0,o.jsx)(m.A,{size:"small",dataSource:em.executionStages,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)(m.A.Item.Meta,{avatar:$[e.type]||(0,o.jsx)(D.A,{}),title:(0,o.jsx)(X,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:"".concat(Y[e.type]||e.type," \xb7 ").concat(e.roleId)}),description:(0,o.jsx)(X,{type:"secondary",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})}),(0,o.jsx)(f.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})})}]})})})]})}),(0,o.jsx)(v.A,{maskClosable:!1,title:e("documents.templateEditor"),open:eA,onOk:()=>{eQ()},onCancel:()=>eT(!1),width:760,centered:!0,okText:e("common.save"),children:(0,o.jsxs)(l.A,{form:n,layout:"vertical",requiredMark:"optional",children:[(0,o.jsxs)(S.A,{gutter:12,children:[(0,o.jsx)(b.A,{xs:24,md:8,children:(0,o.jsx)(l.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(s.A,{disabled:!0})})}),(0,o.jsx)(b.A,{xs:24,md:8,children:(0,o.jsx)(l.A.Item,{name:"name",label:e("documents.templateName"),rules:[{required:!0}],children:(0,o.jsx)(s.A,{})})}),(0,o.jsx)(b.A,{xs:24,md:8,children:(0,o.jsx)(l.A.Item,{name:"category",label:e("documents.templateCategory"),children:(0,o.jsx)(s.A,{})})}),(0,o.jsx)(b.A,{xs:24,md:12,children:(0,o.jsx)(l.A.Item,{name:"outputTitle",label:e("documents.outputTitle"),children:(0,o.jsx)(s.A,{})})}),(0,o.jsx)(b.A,{xs:24,md:12,children:(0,o.jsx)(l.A.Item,{name:"description",label:e("documents.templateDescription"),children:(0,o.jsx)(s.A,{})})})]}),(0,o.jsx)(l.A.Item,{name:"projectRoleConfigId",label:e("documents.projectRoleConfig"),rules:[{required:!0,message:e("documents.projectRoleConfigRequired")}],children:(0,o.jsx)(k.A,{showSearch:!0,placeholder:e("documents.projectRoleConfigRequired"),options:eM})}),(0,o.jsx)(l.A.Item,{name:"documentSpecId",label:e("documents.documentSpec"),children:(0,o.jsx)(k.A,{allowClear:!0,showSearch:!0,placeholder:e("documents.documentSpecPlaceholder"),options:eJ})})]})})]})}}},e=>{e.O(0,[4260,4277,7889,1210,7576,9551,2700,4696,9189,5695,5292,6506,4052,4427,8332,2169,636,6593,8792],()=>e(e.s=16403)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6920],{2548:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>b});var i=l(65321),c=l(35292),r=l(68787),n=l(2256),d=l(38770),t=l(11702),x=l(9730),h=l(13399),a=l(55122),j=l(15622),o=l(71330),g=l(8579),m=l(66926),p=l(7851),A=l(84742),u=l(64209);let{Paragraph:k,Title:N,Text:w}=c.A,D=[{icon:(0,i.jsx)(o.A,{}),title:"准备阶段",color:"blue",items:["配置模型","上传知识库资料","创建提示词"]},{icon:(0,i.jsx)(g.A,{}),title:"编排阶段",color:"purple",items:["创建文件角色","创建提示词角色","创建项目角色配置并排序"]},{icon:(0,i.jsx)(m.A,{}),title:"生成阶段",color:"geekblue",items:["创建模板","后台生成轮询","动态执行状态"]},{icon:(0,i.jsx)(p.A,{}),title:"交付阶段",color:"green",items:["审查事实和来源","检查导出门禁","导出正式文件"]}],y=[{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:["点击生成按钮后,页面会出现“执行状态”卡片。","执行状态会根据当前模板、文档规范包、文件角色、提示词角色和章节自动生成,不是固定工程流程。","当前执行节点会高亮显示,子状态会展示正在处理的章节、事实字段、文件角色或门禁规则。","生成任务在后台运行,页面通过 documentId 轮询;切换页面后回到生成编辑仍可恢复状态。","生成完成后,系统会用后端真实 executionStages 回填最终状态。","如果导出门禁未通过,生成完成节点会提示需要检查校验结果。"],checks:["执行状态 Card 出现","当前节点有高亮","生成完成后有执行阶段结果"],tips:"如果长时间停留在某一步,优先检查模型配置、知识库索引和文件角色绑定。"},{title:"第九步:审查结果并导出",goal:"确保文档可追溯、可校验、可交付,同时能区分阻断问题和可复核 warning。",path:"生成编辑 → 编辑器下方 Tabs → 导出按钮 / 草稿历史",steps:["查看“结构化事实”,确认事实字段是否按文档规范包动态 schema 抽取,并检查冲突提示。","查看“来源”,确认事实来自规范包要求的文件角色和绑定资料。","查看“缺失项”,补齐缺失资料或调整角色配置。","查看“校验”,优先处理 error;warning 表示可导出但建议复核。","查看“导出门禁”,真实 blockingIssues 会阻断 PDF/DOCX 导出,普通 warning 不阻断。","在草稿历史中确认生成状态、warning 原因、整体生成耗时,并可删除不需要的记录。","可以先导出 HTML 预览排版,再导出 DOCX/PDF。"],checks:["无真实阻断问题","关键事实有来源","章节有证据","warning 原因已复核","导出文件可打开"],tips:"导出不是简单放行:真实阻断仍会拦截;生成完成但存在可复核问题时显示 warning,用户可以继续导出并按原因优化资料。"}];function b(){let e=(0,u.Vr)();return(0,i.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,i.jsxs)(r.A,{className:"cardGlass",styles:{body:{padding:24}},children:[(0,i.jsx)(N,{level:2,className:"mb-2",children:e("guide.title")}),(0,i.jsx)(k,{className:"pageDesc mb-0",children:e("guide.description")})]}),(0,i.jsx)(n.A,{gutter:[16,16],children:D.map(e=>(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.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)(t.A,{color:e.color,children:s})},s))})})},e.title))}),(0,i.jsx)(r.A,{title:e("guide.fullFlow"),children:(0,i.jsx)(x.A,{direction:"vertical",items:y.map(e=>({title:e.title,description:"".concat(e.goal,"(入口:").concat(e.path,")")}))})}),(0,i.jsx)(r.A,{title:"详细步骤说明:照着做即可跑通",children:(0,i.jsx)(h.A,{mode:"left",items:y.map(e=>({dot:(0,i.jsx)(A.A,{}),children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(N,{level:4,className:"mb-0",children:e.title}),(0,i.jsxs)(k,{children:[(0,i.jsx)(w,{strong:!0,children:"目标:"}),e.goal]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(w,{strong:!0,children:"入口:"}),e.path]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(w,{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)(w,{strong:!0,children:"完成检查:"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:e.checks.map(e=>(0,i.jsx)(t.A,{color:"success",children:e},e))})]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(w,{strong:!0,children:"提示:"}),e.tips]}),(0,i.jsx)(a.A,{})]})}))})}),(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(r.A,{title:e("guide.roleDesign"),children:[(0,i.jsx)(k,{children:e("guide.roleDesignDesc")}),(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(t.A,{color:"blue",children:"file"}),(0,i.jsx)(w,{strong:!0,children:e("guide.fileRole")}),(0,i.jsx)(k,{children:e("guide.fileRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(t.A,{color:"purple",children:"prompt"}),(0,i.jsx)(w,{strong:!0,children:e("guide.promptRole")}),(0,i.jsx)(k,{children:e("guide.promptRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(t.A,{color:"geekblue",children:"config"}),(0,i.jsx)(w,{strong:!0,children:e("guide.projectConfig")}),(0,i.jsx)(k,{children:e("guide.projectConfigDesc")})]})]})]})}),(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(r.A,{title:e("guide.generationEngine"),children:[(0,i.jsx)(k,{children:e("guide.generationEngineDesc")}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(t.A,{children:e("roles.factExtraction")}),(0,i.jsx)(t.A,{children:e("roles.chapterGeneration")}),(0,i.jsx)(t.A,{children:e("roles.validation")}),(0,i.jsx)(t.A,{children:e("roles.formatting")}),(0,i.jsx)(t.A,{children:e("documents.exportGate")})]})]})})]}),(0,i.jsx)(r.A,{title:"动态 schema、证据和执行状态说明",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.A,{size:"small",title:"动态事实 schema",children:(0,i.jsx)(k,{children:"系统不会写死工程字段。文档规范包的事实字段、模板章节 requiredFacts、字段 sourceRoleIds 和 extractionHint 会共同组成抽取 schema,并驱动事实抽取、冲突检测和导出门禁。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.A,{size:"small",title:"结构化资源证据",children:(0,i.jsx)(k,{children:"文本、PDF/Word、Excel/CSV、图片、地图图纸和其他附件都会被整理成资源证据,包含文件角色、处理类型、正文用途、关联事实和证据片段,模型据此理解资料关系。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.A,{size:"small",title:"动态执行状态",children:(0,i.jsx)(k,{children:"生成编辑页的执行节点会随模板、规范包、文件角色、提示词角色、章节和门禁规则变化;用户生成不同项目文件时看到的是对应项目的流程,而不是固定示例流程。"})})})]})}),(0,i.jsx)(r.A,{title:"生成记录、warning 和导出门禁怎么理解",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,lg:8,children:(0,i.jsxs)(r.A,{size:"small",title:"草稿历史记录",children:[(0,i.jsxs)(k,{children:["每次后台生成都会写入全局项目目录 ",(0,i.jsxs)(w,{code:!0,children:["~/.customize-agent/projects/","{projectId}","/generatedDocuments"]}),"。记录会保存标题、模板、状态、创建时间、完成时间、生成耗时、正文、结构化结果和资源引用。"]}),(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"completed:生成完成且无需要关注的问题。"}),(0,i.jsx)("li",{children:"warning:生成完成,但存在可复核问题。"}),(0,i.jsx)("li",{children:"failed:生成失败,需要查看错误原因。"}),(0,i.jsx)("li",{children:"generating:后台任务仍在执行,可轮询恢复。"})]})]})}),(0,i.jsx)(d.A,{xs:24,lg:8,children:(0,i.jsxs)(r.A,{size:"small",title:"warning 不是失败",children:[(0,i.jsx)(k,{children:"warning 用于提醒用户“文档已经生成,但建议复核”。例如必需事实没有在最佳来源角色中抽到、部分来源需要人工确认、格式或内容有优化建议。warning 会显示在草稿历史和校验详情中,并保留导出能力。"}),(0,i.jsx)(k,{children:"如果是明确阻断问题,例如正文包含临时图片生成 URL、出现“资料未提供”占位、真实 blockingIssues 未解决,则导出门禁仍会阻断 DOCX/PDF。"})]})}),(0,i.jsx)(d.A,{xs:24,lg:8,children:(0,i.jsxs)(r.A,{size:"small",title:"导出门禁规则",children:[(0,i.jsx)(k,{children:"门禁分为“真实阻断”和“复核建议”。系统不会因为普通 warning 简单禁止导出,但会在出现阻断级问题时保护交付质量。"}),(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"Markdown/HTML 更适合快速预览和人工调整。"}),(0,i.jsx)("li",{children:"DOCX/PDF 会启用真实门禁检查。"}),(0,i.jsx)("li",{children:"草稿历史可保留多个版本,便于对比和再次导出。"})]})]})})]})}),(0,i.jsx)(r.A,{title:"生成资源和知识库的关系",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsxs)(r.A,{size:"small",title:"生成资源默认不入库",children:[(0,i.jsx)(k,{children:"模型生成的图片、封面或后处理资源会保存在 generatedDocuments/assets 下,并登记到生成资源管理页。它们默认不进入知识库索引,避免临时产物污染原始资料。"}),(0,i.jsx)(k,{children:"如果某个生成资源已经被人工确认可以复用,再到资源管理页手动加入知识库索引。"})]})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsxs)(r.A,{size:"small",title:"资源预览和坏图处理",children:[(0,i.jsx)(k,{children:"资源预览会从全局 generatedDocuments 目录解析文件,不依赖当前页面临时路径。图片下载会识别“image is generating”等占位响应,并校验 PNG/JPEG/WebP 字节,避免把占位文本当成图片保存。"}),(0,i.jsx)(k,{children:"如果预览失败,优先查看资源管理页中的文件路径、资源状态和原始生成记录。"})]})})]})}),(0,i.jsx)(r.A,{title:"文件角色处理类型大白话说明",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"规则文件",children:(0,i.jsx)(k,{children:"用来告诉系统“必须怎么写、不能怎么写、按什么标准判断”。适合放评分办法、甲方编制要求、攻略写作要求、输出格式要求。生成时会优先作为约束使用。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"项目事实文件",children:(0,i.jsx)(k,{children:"用来告诉系统“真实情况是什么”。适合放项目概况、合同摘要、招标文件关键信息、游戏角色资料、产品资料。事实字段通常从这里抽取。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"表格数据",children:(0,i.jsx)(k,{children:"用来解析结构化数据。适合放 Excel、CSV、清单、计划表、评分表、推荐指数表。系统会读取 Sheet、表头、行列和来源范围。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"图纸文件",children:(0,i.jsx)(k,{children:"用来表达空间关系、路线、结构、站位或设计说明。可以是图纸目录、设计说明、路线示意、阵型图说明。没有 CAD 时也可以用文字图纸说明。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"规范文件",children:(0,i.jsx)(k,{children:"用来作为专业依据。适合放国家规范、行业标准、企业标准、攻略结构规范、质量标准。校验和生成时会把它当成依据。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"参考资料",children:(0,i.jsx)(k,{children:"只作为辅助阅读材料,不建议放关键事实。适合放图片来源、公开网页链接、背景资料、案例资料。系统可以参考,但不应把它当成强事实。"})})})]})}),(0,i.jsx)(r.A,{title:"推荐资料清单",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.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)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.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)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.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)(r.A,{title:"生产级生成前检查清单",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.A,{size:"small",title:"资料完整性",children:(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"事实源、规则源、表格源、图片/图纸源分开绑定。"}),(0,i.jsx)("li",{children:"关键事实在知识库检索中可以搜索到。"}),(0,i.jsx)("li",{children:"表格有清晰表头,图片和图纸有说明文字。"})]})})}),(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.A,{size:"small",title:"角色配置",children:(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"文件角色处理类型选对。"}),(0,i.jsx)("li",{children:"提示词角色执行类型选对。"}),(0,i.jsx)("li",{children:"项目角色配置排序符合生成流程。"})]})})}),(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.A,{size:"small",title:"规范包",children:(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"required fact 不要过度配置。"}),(0,i.jsx)("li",{children:"sourceRoleIds 只绑定真正应该提供该事实的角色。"}),(0,i.jsx)("li",{children:"gateRules 区分 error 和 warning。"})]})})}),(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.A,{size:"small",title:"交付检查",children:(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"草稿历史记录状态合理。"}),(0,i.jsx)("li",{children:"warning 原因已经阅读。"}),(0,i.jsx)("li",{children:"导出文件打开正常,图片和表格可读。"})]})})})]})}),(0,i.jsx)(r.A,{title:"常见问题和处理建议",children:(0,i.jsx)(j.A,{items:[{key:"warning-export",label:"为什么生成完成后显示 warning,但仍然可以导出?",children:(0,i.jsx)(k,{children:"warning 表示文档已生成,但存在建议复核的问题,例如来源角色不完全匹配、某些事实需要人工确认或格式可优化。它不是失败,也不是导出阻断。只有真实 blockingIssues 或 error 级门禁问题才会阻断 DOCX/PDF 导出。"})},{key:"missing-facts",label:"为什么提示必需事实缺失?",children:(0,i.jsx)(k,{children:"优先检查文档规范包中的 factFields、sourceRoleIds、模板章节 requiredFacts 和文件角色绑定。很多情况下不是模型失败,而是资料没有被绑定到正确角色,或字段要求比资料实际内容更严格。"})},{key:"draft-duration",label:"草稿历史里的耗时怎么计算?",children:(0,i.jsx)(k,{children:"耗时使用生成记录的 createdAt 到 completedAt 计算;旧记录或未完成记录会使用 updatedAt 兜底。它用于判断本次生成链路整体成本,包括知识库检索、事实抽取、章节生成、资源处理、校验和格式化。"})},{key:"asset-index",label:"生成资源为什么不自动进入知识库?",children:(0,i.jsx)(k,{children:"生成资源属于输出产物,不是原始知识来源。默认不入库可以避免模型下一次把临时封面、草稿图片或错误资源当成事实来源。确认可复用后,再在生成资源管理页手动加入知识库索引。"})}]})}),(0,i.jsx)(j.A,{items:[{key:"prepare",label:e("guide.prepareTitle"),children:(0,i.jsx)(k,{children:e("guide.prepareContent")})},{key:"roles",label:e("guide.rolesTitle"),children:(0,i.jsx)(k,{children:e("guide.rolesContent")})},{key:"template",label:e("guide.templateTitle"),children:(0,i.jsx)(k,{children:e("guide.templateContent")})},{key:"generate",label:e("guide.generateTitle"),children:(0,i.jsx)(k,{children:e("guide.generateContent")})},{key:"qa",label:e("guide.qaTitle"),children:(0,i.jsx)(k,{children:e("guide.qaContent")})}]})]})}},34899:(e,s,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/guide",function(){return l(2548)}])}},e=>{e.O(0,[4260,7167,9382,5292,1054,2969,636,6593,8792],()=>e(e.s=34899)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6920],{2548:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>b});var i=l(65321),c=l(35292),r=l(68787),n=l(2256),d=l(38770),t=l(11702),x=l(9730),h=l(13399),a=l(55122),j=l(15622),o=l(71330),g=l(8579),m=l(66926),p=l(7851),A=l(84742),u=l(64209);let{Paragraph:k,Title:N,Text:w}=c.A,D=[{icon:(0,i.jsx)(o.A,{}),title:"准备阶段",color:"blue",items:["配置模型","上传知识库资料","创建提示词"]},{icon:(0,i.jsx)(g.A,{}),title:"编排阶段",color:"purple",items:["创建文件角色","创建提示词角色","创建项目角色配置并排序"]},{icon:(0,i.jsx)(m.A,{}),title:"生成阶段",color:"geekblue",items:["创建模板","后台生成轮询","动态执行状态"]},{icon:(0,i.jsx)(p.A,{}),title:"交付阶段",color:"green",items:["审查事实和来源","检查导出门禁","导出正式文件"]}],y=[{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:["点击生成按钮后,页面会出现“执行状态”卡片。","执行状态会根据当前模板、文档规范包、文件角色、提示词角色和章节自动生成,不是固定工程流程。","当前执行节点会高亮显示,子状态会展示正在处理的章节、事实字段、文件角色或门禁规则。","生成任务在后台运行,页面通过 documentId 轮询;切换页面后回到生成编辑仍可恢复状态。","生成完成后,系统会用后端真实 executionStages 回填最终状态。","如果导出门禁未通过,生成完成节点会提示需要检查校验结果。"],checks:["执行状态 Card 出现","当前节点有高亮","生成完成后有执行阶段结果"],tips:"如果长时间停留在某一步,优先检查模型配置、知识库索引和文件角色绑定。"},{title:"第九步:审查结果并导出",goal:"确保文档可追溯、可校验、可交付,同时能区分阻断问题和可复核 warning。",path:"生成编辑 → 编辑器下方 Tabs → 导出按钮 / 草稿历史",steps:["查看“结构化事实”,确认事实字段是否按文档规范包动态 schema 抽取,并检查冲突提示。","查看“来源”,确认事实来自规范包要求的文件角色和绑定资料。","查看“缺失项”,补齐缺失资料或调整角色配置。","查看“校验”,优先处理 error;warning 表示可导出但建议复核。","查看“导出门禁”,真实 blockingIssues 会阻断 PDF/DOCX 导出,普通 warning 不阻断。","在草稿历史中确认生成状态、warning 原因、整体生成耗时,并可删除不需要的记录。","可以先导出 HTML 预览排版,再导出 DOCX/PDF。"],checks:["无真实阻断问题","关键事实有来源","章节有证据","warning 原因已复核","导出文件可打开"],tips:"导出不是简单放行:真实阻断仍会拦截;生成完成但存在可复核问题时显示 warning,用户可以继续导出并按原因优化资料。"}];function b(){let e=(0,u.Vr)();return(0,i.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,i.jsxs)(r.A,{className:"cardGlass",styles:{body:{padding:24}},children:[(0,i.jsx)(N,{level:2,className:"mb-2",children:e("guide.title")}),(0,i.jsx)(k,{className:"pageDesc mb-0",children:e("guide.description")})]}),(0,i.jsx)(n.A,{gutter:[16,16],children:D.map(e=>(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.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)(t.A,{color:e.color,children:s})},s))})})},e.title))}),(0,i.jsx)(r.A,{title:e("guide.fullFlow"),children:(0,i.jsx)(x.A,{direction:"vertical",items:y.map(e=>({title:e.title,description:"".concat(e.goal,"(入口:").concat(e.path,")")}))})}),(0,i.jsx)(r.A,{title:"详细步骤说明:照着做即可跑通",children:(0,i.jsx)(h.A,{mode:"left",items:y.map(e=>({dot:(0,i.jsx)(A.A,{}),children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(N,{level:4,className:"mb-0",children:e.title}),(0,i.jsxs)(k,{children:[(0,i.jsx)(w,{strong:!0,children:"目标:"}),e.goal]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(w,{strong:!0,children:"入口:"}),e.path]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(w,{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)(w,{strong:!0,children:"完成检查:"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:e.checks.map(e=>(0,i.jsx)(t.A,{color:"success",children:e},e))})]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(w,{strong:!0,children:"提示:"}),e.tips]}),(0,i.jsx)(a.A,{})]})}))})}),(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(r.A,{title:e("guide.roleDesign"),children:[(0,i.jsx)(k,{children:e("guide.roleDesignDesc")}),(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(t.A,{color:"blue",children:"file"}),(0,i.jsx)(w,{strong:!0,children:e("guide.fileRole")}),(0,i.jsx)(k,{children:e("guide.fileRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(t.A,{color:"purple",children:"prompt"}),(0,i.jsx)(w,{strong:!0,children:e("guide.promptRole")}),(0,i.jsx)(k,{children:e("guide.promptRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(t.A,{color:"geekblue",children:"config"}),(0,i.jsx)(w,{strong:!0,children:e("guide.projectConfig")}),(0,i.jsx)(k,{children:e("guide.projectConfigDesc")})]})]})]})}),(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(r.A,{title:e("guide.generationEngine"),children:[(0,i.jsx)(k,{children:e("guide.generationEngineDesc")}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(t.A,{children:e("roles.factExtraction")}),(0,i.jsx)(t.A,{children:e("roles.chapterGeneration")}),(0,i.jsx)(t.A,{children:e("roles.validation")}),(0,i.jsx)(t.A,{children:e("roles.formatting")}),(0,i.jsx)(t.A,{children:e("documents.exportGate")})]})]})})]}),(0,i.jsx)(r.A,{title:"动态 schema、证据和执行状态说明",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.A,{size:"small",title:"动态事实 schema",children:(0,i.jsx)(k,{children:"系统不会写死工程字段。文档规范包的事实字段、模板章节 requiredFacts、字段 sourceRoleIds 和 extractionHint 会共同组成抽取 schema,并驱动事实抽取、冲突检测和导出门禁。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.A,{size:"small",title:"结构化资源证据",children:(0,i.jsx)(k,{children:"文本、PDF/Word、Excel/CSV、图片、地图图纸和其他附件都会被整理成资源证据,包含文件角色、处理类型、正文用途、关联事实和证据片段,模型据此理解资料关系。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.A,{size:"small",title:"动态执行状态",children:(0,i.jsx)(k,{children:"生成编辑页的执行节点会随模板、规范包、文件角色、提示词角色、章节和门禁规则变化;用户生成不同项目文件时看到的是对应项目的流程,而不是固定示例流程。"})})})]})}),(0,i.jsx)(r.A,{title:"生成记录、warning 和导出门禁怎么理解",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,lg:8,children:(0,i.jsxs)(r.A,{size:"small",title:"草稿历史记录",children:[(0,i.jsxs)(k,{children:["每次后台生成都会写入全局项目目录 ",(0,i.jsxs)(w,{code:!0,children:["~/.customize-agent/projects/","{projectId}","/generatedDocuments"]}),"。记录会保存标题、模板、状态、创建时间、完成时间、生成耗时、正文、结构化结果和资源引用。"]}),(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"completed:生成完成且无需要关注的问题。"}),(0,i.jsx)("li",{children:"warning:生成完成,但存在可复核问题。"}),(0,i.jsx)("li",{children:"failed:生成失败,需要查看错误原因。"}),(0,i.jsx)("li",{children:"generating:后台任务仍在执行,可轮询恢复。"})]})]})}),(0,i.jsx)(d.A,{xs:24,lg:8,children:(0,i.jsxs)(r.A,{size:"small",title:"warning 不是失败",children:[(0,i.jsx)(k,{children:"warning 用于提醒用户“文档已经生成,但建议复核”。例如必需事实没有在最佳来源角色中抽到、部分来源需要人工确认、格式或内容有优化建议。warning 会显示在草稿历史和校验详情中,并保留导出能力。"}),(0,i.jsx)(k,{children:"如果是明确阻断问题,例如正文包含临时图片生成 URL、出现“资料未提供”占位、真实 blockingIssues 未解决,则导出门禁仍会阻断 DOCX/PDF。"})]})}),(0,i.jsx)(d.A,{xs:24,lg:8,children:(0,i.jsxs)(r.A,{size:"small",title:"导出门禁规则",children:[(0,i.jsx)(k,{children:"门禁分为“真实阻断”和“复核建议”。系统不会因为普通 warning 简单禁止导出,但会在出现阻断级问题时保护交付质量。"}),(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"Markdown/HTML 更适合快速预览和人工调整。"}),(0,i.jsx)("li",{children:"DOCX/PDF 会启用真实门禁检查。"}),(0,i.jsx)("li",{children:"草稿历史可保留多个版本,便于对比和再次导出。"})]})]})})]})}),(0,i.jsx)(r.A,{title:"生成资源和知识库的关系",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsxs)(r.A,{size:"small",title:"生成资源默认不入库",children:[(0,i.jsx)(k,{children:"模型生成的图片、封面或后处理资源会保存在 generatedDocuments/assets 下,并登记到生成资源管理页。它们默认不进入知识库索引,避免临时产物污染原始资料。"}),(0,i.jsx)(k,{children:"如果某个生成资源已经被人工确认可以复用,再到资源管理页手动加入知识库索引。"})]})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsxs)(r.A,{size:"small",title:"资源预览和坏图处理",children:[(0,i.jsx)(k,{children:"资源预览会从全局 generatedDocuments 目录解析文件,不依赖当前页面临时路径。图片下载会识别“image is generating”等占位响应,并校验 PNG/JPEG/WebP 字节,避免把占位文本当成图片保存。"}),(0,i.jsx)(k,{children:"如果预览失败,优先查看资源管理页中的文件路径、资源状态和原始生成记录。"})]})})]})}),(0,i.jsx)(r.A,{title:"文件角色处理类型大白话说明",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"规则文件",children:(0,i.jsx)(k,{children:"用来告诉系统“必须怎么写、不能怎么写、按什么标准判断”。适合放评分办法、甲方编制要求、攻略写作要求、输出格式要求。生成时会优先作为约束使用。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"项目事实文件",children:(0,i.jsx)(k,{children:"用来告诉系统“真实情况是什么”。适合放项目概况、合同摘要、招标文件关键信息、游戏角色资料、产品资料。事实字段通常从这里抽取。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"表格数据",children:(0,i.jsx)(k,{children:"用来解析结构化数据。适合放 Excel、CSV、清单、计划表、评分表、推荐指数表。系统会读取 Sheet、表头、行列和来源范围。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"图纸文件",children:(0,i.jsx)(k,{children:"用来表达空间关系、路线、结构、站位或设计说明。可以是图纸目录、设计说明、路线示意、阵型图说明。没有 CAD 时也可以用文字图纸说明。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"规范文件",children:(0,i.jsx)(k,{children:"用来作为专业依据。适合放国家规范、行业标准、企业标准、攻略结构规范、质量标准。校验和生成时会把它当成依据。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(r.A,{size:"small",title:"参考资料",children:(0,i.jsx)(k,{children:"只作为辅助阅读材料,不建议放关键事实。适合放图片来源、公开网页链接、背景资料、案例资料。系统可以参考,但不应把它当成强事实。"})})})]})}),(0,i.jsx)(r.A,{title:"推荐资料清单",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.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)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.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)(d.A,{xs:24,md:8,children:(0,i.jsx)(r.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)(r.A,{title:"生产级生成前检查清单",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.A,{size:"small",title:"资料完整性",children:(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"事实源、规则源、表格源、图片/图纸源分开绑定。"}),(0,i.jsx)("li",{children:"关键事实在知识库检索中可以搜索到。"}),(0,i.jsx)("li",{children:"表格有清晰表头,图片和图纸有说明文字。"})]})})}),(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.A,{size:"small",title:"角色配置",children:(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"文件角色处理类型选对。"}),(0,i.jsx)("li",{children:"提示词角色执行类型选对。"}),(0,i.jsx)("li",{children:"项目角色配置排序符合生成流程。"})]})})}),(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.A,{size:"small",title:"规范包",children:(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"required fact 不要过度配置。"}),(0,i.jsx)("li",{children:"sourceRoleIds 只绑定真正应该提供该事实的角色。"}),(0,i.jsx)("li",{children:"gateRules 区分 error 和 warning。"})]})})}),(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(r.A,{size:"small",title:"交付检查",children:(0,i.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,i.jsx)("li",{children:"草稿历史记录状态合理。"}),(0,i.jsx)("li",{children:"warning 原因已经阅读。"}),(0,i.jsx)("li",{children:"导出文件打开正常,图片和表格可读。"})]})})})]})}),(0,i.jsx)(r.A,{title:"常见问题和处理建议",children:(0,i.jsx)(j.A,{items:[{key:"warning-export",label:"为什么生成完成后显示 warning,但仍然可以导出?",children:(0,i.jsx)(k,{children:"warning 表示文档已生成,但存在建议复核的问题,例如来源角色不完全匹配、某些事实需要人工确认或格式可优化。它不是失败,也不是导出阻断。只有真实 blockingIssues 或 error 级门禁问题才会阻断 DOCX/PDF 导出。"})},{key:"missing-facts",label:"为什么提示必需事实缺失?",children:(0,i.jsx)(k,{children:"优先检查文档规范包中的 factFields、sourceRoleIds、模板章节 requiredFacts 和文件角色绑定。很多情况下不是模型失败,而是资料没有被绑定到正确角色,或字段要求比资料实际内容更严格。"})},{key:"draft-duration",label:"草稿历史里的耗时怎么计算?",children:(0,i.jsx)(k,{children:"耗时使用生成记录的 createdAt 到 completedAt 计算;旧记录或未完成记录会使用 updatedAt 兜底。它用于判断本次生成链路整体成本,包括知识库检索、事实抽取、章节生成、资源处理、校验和格式化。"})},{key:"asset-index",label:"生成资源为什么不自动进入知识库?",children:(0,i.jsx)(k,{children:"生成资源属于输出产物,不是原始知识来源。默认不入库可以避免模型下一次把临时封面、草稿图片或错误资源当成事实来源。确认可复用后,再在生成资源管理页手动加入知识库索引。"})}]})}),(0,i.jsx)(j.A,{items:[{key:"prepare",label:e("guide.prepareTitle"),children:(0,i.jsx)(k,{children:e("guide.prepareContent")})},{key:"roles",label:e("guide.rolesTitle"),children:(0,i.jsx)(k,{children:e("guide.rolesContent")})},{key:"template",label:e("guide.templateTitle"),children:(0,i.jsx)(k,{children:e("guide.templateContent")})},{key:"generate",label:e("guide.generateTitle"),children:(0,i.jsx)(k,{children:e("guide.generateContent")})},{key:"qa",label:e("guide.qaTitle"),children:(0,i.jsx)(k,{children:e("guide.qaContent")})}]})]})}},34899:(e,s,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/guide",function(){return l(2548)}])}},e=>{e.O(0,[4260,4277,1210,5292,4427,8449,636,6593,8792],()=>e(e.s=34899)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3309],{14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusFileIcon:"style_statusFileIcon__t1ezs",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineTime:"style_timelineTime__oFbi_",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},37690:(e,l,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return t(48200)}])},48200:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>L});var n=t(65321),i=t(97109),a=t(1873),r=t.n(a),s=t(86109),c=t(35292),o=t(76506),d=t(33442),u=t(11702),h=t(9137),m=t(21289),p=t(68787),g=t(56985),x=t(46092),y=t(42700),_=t(85493),f=t(84253),j=t(85114),A=t(58569),w=t(7576),C=t(47210),k=t(6578),v=t(45551),S=t(14569),b=t.n(S);let{Paragraph:I}=c.A;function P(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}function N(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).slice(0,30):[]}function R(e,l){let t=l.trim()?[l.trim(),...l.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,l)=>l.length-e.length):[];if(0===t.length)return e;let i=RegExp("(".concat(t.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(i).map((e,l)=>t.some(l=>l.toLowerCase()===e.toLowerCase())?(0,n.jsx)("mark",{children:e},l):e)}function z(e,l,t){return null==l||""===l||Array.isArray(l)&&0===l.length?null:(0,n.jsx)(o.A.Item,{label:e,children:Array.isArray(l)?(0,n.jsx)(d.A,{wrap:!0,children:l.map(e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>null==t?void 0:t(String(e)),children:String(e)},String(e)))}):String(l)})}function O(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return e.map((e,t)=>({key:"".concat(l,"-").concat(t),name:e}))}function L(){var e,l,t,a,c;let S=(0,s.useRouter)(),L="string"==typeof S.query.relativePath?S.query.relativePath:"",[T,E]=(0,i.useState)(),[D,M]=(0,i.useState)(!1),[F,J]=(0,i.useState)(""),[K,V]=(0,i.useState)(!1),[B,H]=(0,i.useState)(""),[X,W]=(0,i.useState)([]);(0,i.useEffect)(()=>{L&&(M(!0),J(""),(0,k.xC)(L).then(E).catch(e=>{E(void 0),J(e instanceof Error?e.message:"文件详情加载失败")}).finally(()=>M(!1)))},[L]);let $=(0,i.useMemo)(()=>(function(e){let l=P(null==e?void 0:e.file.metadataJson);return"object"==typeof l.extraction&&l.extraction?l.extraction:l})(T),[T]),q=N($.layerNames);(0,i.useEffect)(()=>{W(q)},[null==T?void 0:T.file.relativePath,q.join("|")]);let G=B.trim().toLowerCase(),U=(0,i.useMemo)(()=>{var e;return T&&G?T.chunks.filter(e=>{let l=P(e.metadataJson);return[e.content,e.sectionTitle,l.rowRange,l.chunkKind,l.parentId,JSON.stringify(l)].some(e=>String(null!=e?e:"").toLowerCase().includes(G))}):null!=(e=null==T?void 0:T.chunks)?e:[]},[T,G]),Q=(0,i.useMemo)(()=>{var e;return T&&G?T.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(G))):null!=(e=null==T?void 0:T.parents)?e:[]},[T,G]),Y=async()=>{if(L){V(!0);try{let e=await (0,k.HC)(L);e.detail&&E(e.detail),h.Ay.success("文件索引已重建")}finally{V(!1)}}},Z=async e=>{e&&(await navigator.clipboard.writeText(e),h.Ay.success("已复制"))},ee=async e=>{L&&(await (0,k.tn)(L,e),h.Ay.success("file"===e?"已请求打开文件":"已请求打开目录"))},el=(0,i.useMemo)(()=>{var e,l,t,i,a;let s=[],c=N($.sheetNames),h=N($.columnNames),y=N($.layerNames),_=N($.blockNames),f=N($.entityTypes),j=N($.productNames),A=N($.materialNames),w=N($.entityNames),C=N($.dataPaths),k=c.length>0||h.length>0||null!=$.rowCount||null!=$.columnCount||null!=$.formulaCount||null!=$.mergeCount,v=O(h,"column"),S=(null!=(e=null==T?void 0:T.chunks)?e:[]).map(e=>P(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,l)=>({key:"row-".concat(l),name:e})),R=(null!=(l=null==T?void 0:T.chunks)?l:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>e.includes("|")).slice(0,80).map((e,l)=>({key:"grid-".concat(l),cells:e.split("|").map(e=>e.trim()).filter(Boolean)}));(k||v.length>0||S.length>0||R.length>0)&&s.push({key:"table",label:"表格",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[k&&(0,n.jsxs)(o.A,{size:"small",column:2,bordered:!0,children:[z("Sheet",c,H),z("表头",h,H),z("行数",$.rowCount),z("列数",$.columnCount),z("公式数",$.formulaCount),z("合并单元格",$.mergeCount)]}),v.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:v,columns:[{title:"列名",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>H(String(e)),children:String(e)})}]}),S.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:S,columns:[{title:"行范围",dataIndex:"name",render:e=>(0,n.jsxs)(u.A,{color:"gold",className:"cursor-pointer",onClick:()=>H(String(e)),children:["行 ",String(e)]})}]}),R.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:R,pagination:{pageSize:10},columns:[{title:"表格网格预览",dataIndex:"cells",render:e=>(0,n.jsx)(d.A,{wrap:!0,children:e.map((e,l)=>(0,n.jsx)(u.A,{children:e},"".concat(e,"-").concat(l)))})}]})]})});let L=y.length>0||_.length>0||f.length>0||j.length>0||A.length>0||w.length>0,E=[...O(y,"layer").map(e=>({...e,type:"图层"})),...O(f,"entity").map(e=>({...e,type:"实体类型"})),...O(_,"block").map(e=>({...e,type:"块/符号"}))];(L||y.length>0||E.length>0)&&s.push({key:"drawing",label:"图纸",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[L&&(0,n.jsxs)(o.A,{size:"small",column:2,bordered:!0,children:[z("图层",y,H),z("块/符号",_,H),z("实体类型",f,H),z("产品/零件",j,H),z("材料",A,H),z("实体名称",w,H)]}),y.length>0&&(0,n.jsxs)(p.A,{size:"small",title:"图层开关 / 图纸预览",children:[(0,n.jsx)(g.A.Group,{value:X,options:y.map(e=>({label:e,value:e})),onChange:e=>W(e.map(String))}),(0,n.jsx)("div",{className:b().drawingPreview,children:X.map(e=>(0,n.jsx)(u.A,{color:"blue",children:e},e))})]}),E.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:E,columns:[{title:"类型",dataIndex:"type",width:120},{title:"名称",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>H(String(e)),children:String(e)})}]})]})});let D=(null!=(t=null==T?void 0:T.chunks)?t:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>/^[\w.[\]-]+\s*[:=]/u.test(e)).slice(0,200).map((e,l)=>{var t,n,i,a;let r=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(l),path:null!=(i=null==r||null==(t=r[1])?void 0:t.trim())?i:e,value:null!=(a=null==r||null==(n=r[2])?void 0:n.trim())?a:""}});(C.length>0||D.length>0)&&s.push({key:"data",label:"数据路径",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[C.length>0&&(0,n.jsx)(x.A,{defaultExpandAll:!0,treeData:function(e){let l=new Map;for(let t of e){let e=l;for(let l of t.replace(/\[(\d+)\]/gu,".$1").split(".").filter(Boolean))e.has(l)||e.set(l,new Map),e=e.get(l)}let t=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return[...e.entries()].map(e=>{let[n,i]=e;return{title:n,key:l?"".concat(l,".").concat(n):n,children:t(i,l?"".concat(l,".").concat(n):n)}})};return t(l)}(C),onSelect:e=>{var l;return H(String(null!=(l=e[0])?l:""))}}),D.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:D,pagination:{pageSize:20},columns:[{title:"Path",dataIndex:"path",width:260,render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>H(String(e)),children:String(e)})},{title:"Value",dataIndex:"value",render:e=>(0,n.jsx)("span",{className:"break-all",children:String(e)})}]})]})});let M=null!=$.ocrRecommended||null!=$.ocrReason||null!=$.ocrProvider||null!=$.ocrLanguages||null!=$.ocrTextLength||null!=$.pdfPageOcrSupported||null!=$.ocrPageCount||null!=$.pdfOcrPageLimit||null!=$.pdfRenderer,F=(null!=(i=null==T?void 0:T.chunks)?i:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,l,t,n)=>{var i,a,r;return t%2==0&&e.push({key:"page-".concat(l),page:l,text:null!=(r=null==(a=n[t+1])||null==(i=a.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:i.trim())?r:""}),e},[]),J=(null==T?void 0:T.file.format)==="pdf";return(M||J||F.length>0)&&s.push({key:"ocr",label:"OCR/PDF",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[M&&(0,n.jsxs)(o.A,{size:"small",column:2,bordered:!0,children:[z("OCR 建议",$.ocrRecommended),z("OCR 原因",$.ocrReason),z("OCR 引擎",$.ocrProvider),z("OCR 语言",$.ocrLanguages),z("OCR 文本长度",$.ocrTextLength),z("PDF 页面 OCR 支持",$.pdfPageOcrSupported),z("PDF OCR 页数",$.ocrPageCount),z("PDF OCR 页数上限",$.pdfOcrPageLimit),z("PDF 渲染器",$.pdfRenderer)]}),J&&(0,n.jsx)("div",{className:b().pdfPreviewStrip,children:Array.from({length:Math.min(Number(null!=(a=$.ocrPageCount)?a:1)||1,6)},(e,l)=>(0,n.jsx)(r(),{width:220,height:320,src:"/api/kb/files/preview-pdf-page?relativePath=".concat(encodeURIComponent(T.file.relativePath),"&page=").concat(l+1),alt:"PDF 第 ".concat(l+1," 页"),unoptimized:!0},l))}),F.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:F,pagination:{pageSize:10},columns:[{title:"页码",dataIndex:"page",width:90},{title:"OCR 文本",dataIndex:"text",render:e=>(0,n.jsx)(I,{ellipsis:{rows:4,expandable:!0,symbol:"展开"},children:String(e)})}]})]})}),s},[$,T,X]),et=[{title:"序号",key:"index",width:70,render:(e,l,t)=>t+1},{title:"#",dataIndex:"chunkIndex",width:70,render:e=>String(e)},{title:"类型",width:110,render:(e,l)=>{var t;return(0,n.jsx)(u.A,{children:String(null!=(t=P(l.metadataJson).chunkKind)?t:l.category)})}},{title:"章节/范围",width:220,render:(e,l)=>{let t=P(l.metadataJson),i="string"==typeof t.rowRange?t.rowRange:void 0;return(0,n.jsxs)(d.A,{wrap:!0,children:[l.sectionTitle?(0,n.jsx)(u.A,{color:"cyan",children:l.sectionTitle}):null,i?(0,n.jsxs)(u.A,{color:"gold",children:["行 ",i]}):null]})}},{title:"Token",dataIndex:"tokenCount",width:90},{title:"内容",render:(e,l)=>(0,n.jsx)(I,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:b().searchContent,children:R(l.content,B)})}],en=[{title:"序号",key:"index",width:70,render:(e,l,t)=>t+1},{title:"Parent",dataIndex:"parentId",width:260,render:e=>(0,n.jsx)("span",{className:"break-all",children:e})},{title:"切片数",dataIndex:"chunkCount",width:90},{title:"章节",dataIndex:"sectionTitle",width:220},{title:"内容",render:(e,l)=>(0,n.jsx)(I,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:b().searchContent,children:R(l.content,B)})}];return D?(0,n.jsx)(y.A,{}):F?(0,n.jsx)(_.A,{type:"error",showIcon:!0,message:"文件详情加载失败",description:F}):T?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(j.Ay,{icon:(0,n.jsx)(C.A,{}),href:"/knowledge/files",size:"small",style:{marginBottom:12},children:"返回文件列表"}),(0,n.jsxs)("div",{className:b().searchResultHeader,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:"文件详情"}),(0,n.jsx)("p",{className:"pageDesc",children:"查看解析结果、图纸/表格/数据结构化字段、parent chunk 和 child chunk。"})]}),(0,n.jsxs)(d.A,{children:[(0,n.jsx)(j.Ay,{onClick:()=>{Z(null==T?void 0:T.absolutePath)},children:"复制原文件路径"}),(0,n.jsx)(j.Ay,{onClick:()=>{Z(null==T?void 0:T.directory)},children:"复制所在目录"}),(0,n.jsx)(j.Ay,{onClick:()=>{ee("file")},children:"打开文件"}),(0,n.jsx)(j.Ay,{onClick:()=>{ee("directory")},children:"打开目录"}),"pdf"===T.file.format?(0,n.jsx)(j.Ay,{loading:K,onClick:()=>{Y()},children:"重新 OCR"}):null,(0,n.jsx)(j.Ay,{type:"primary",loading:K,onClick:()=>{Y()},children:"重建该文件索引"})]})]})]}),(0,n.jsx)(p.A,{size:"small",title:"基础信息",children:(0,n.jsxs)(o.A,{size:"small",column:2,bordered:!0,children:[(0,n.jsx)(o.A.Item,{label:"路径",children:T.file.relativePath}),(0,n.jsx)(o.A.Item,{label:"原文件",children:null!=(e=T.absolutePath)?e:"-"}),(0,n.jsx)(o.A.Item,{label:"所在目录",children:null!=(l=T.directory)?l:"-"}),(0,n.jsxs)(o.A.Item,{label:"分类",children:[(0,n.jsx)(u.A,{children:(0,v.Jm)(T.file.category)})," ",(0,n.jsx)(u.A,{children:T.file.format})]}),(0,n.jsx)(o.A.Item,{label:"大小",children:(0,v.z3)(T.file.fileSize)}),(0,n.jsx)(o.A.Item,{label:"切片数",children:T.file.chunkCount}),(0,n.jsx)(o.A.Item,{label:"状态",children:T.file.status}),(0,n.jsx)(o.A.Item,{label:"解析模式",children:String(null!=(t=$.extractionMode)?t:"-")}),(0,n.jsx)(o.A.Item,{label:"覆盖范围",children:String(null!=(a=$.contentCoverage)?a:"-")}),(0,n.jsx)(o.A.Item,{label:"正文长度",children:String(null!=(c=$.textLength)?c:"-")})]})}),el.length>0&&(0,n.jsx)(p.A,{size:"small",title:"结构化信息",children:(0,n.jsx)(A.A,{items:el})}),(0,n.jsx)(p.A,{size:"small",title:"详情筛选",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[(0,n.jsx)(w.A,{allowClear:!0,value:B,onChange:e=>H(e.target.value),placeholder:"筛选 rowRange、图层、实体、data path、section、chunk 内容"}),B?(0,n.jsxs)(d.A,{wrap:!0,children:[(0,n.jsxs)(u.A,{color:"blue",children:["Parent 命中 ",Q.length]}),(0,n.jsxs)(u.A,{color:"green",children:["Child 命中 ",U.length]}),(0,n.jsxs)(u.A,{color:"purple",children:["筛选词 ",B]})]}):null]})}),(0,n.jsx)(p.A,{size:"small",title:"Parent Chunks (".concat(Q.length,"/").concat(T.parents.length,")"),children:(0,n.jsx)(m.A,{rowKey:"id",columns:en,dataSource:Q,pagination:{pageSize:10},size:"small"})}),(0,n.jsx)(p.A,{size:"small",title:"Child Chunks (".concat(U.length,"/").concat(T.chunks.length,")"),children:(0,n.jsx)(m.A,{rowKey:"id",columns:et,dataSource:U,pagination:{pageSize:20},size:"small"})})]}):(0,n.jsx)(f.A,{description:"请选择文件"})}}},e=>{e.O(0,[4260,4277,7889,1210,7576,9551,2700,9189,6985,7150,5292,1289,6506,861,1515,9978,636,6593,8792],()=>e(e.s=37690)),_N_E=e.O()}]);
|