@customize-agent/server 4.0.30 → 4.0.32
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 +33 -45
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +0 -6
- package/.next/server/chunks/1928.js +1 -1
- package/.next/server/chunks/1936.js +1 -1
- package/.next/server/chunks/3298.js +101 -0
- 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/assets/generated/preview.js +1 -1
- package/.next/server/pages/api/assets/generated/preview.js.nft.json +1 -1
- package/.next/server/pages/api/assets/generated.js +1 -1
- package/.next/server/pages/api/assets/generated.js.nft.json +1 -1
- package/.next/server/pages/api/documents/chapter/regenerate.js +1 -1
- package/.next/server/pages/api/documents/chapter/regenerate.js.nft.json +1 -1
- package/.next/server/pages/api/documents/export.js +1 -1
- package/.next/server/pages/api/documents/export.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generate.js +2 -2
- package/.next/server/pages/api/documents/generate.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id].js +1 -1
- package/.next/server/pages/api/documents/generated/[id].js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated.js +1 -1
- package/.next/server/pages/api/documents/generated.js.nft.json +1 -1
- package/.next/server/pages/api/documents/roles.js +1 -1
- package/.next/server/pages/api/documents/templates.js +1 -1
- package/.next/server/pages/api/documents/templates.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files.js +1 -1
- package/.next/server/pages/api/prompt.js +1 -1
- package/.next/server/pages/asset-library.html +1 -1
- package/.next/server/pages/context/long-term.html +1 -1
- package/.next/server/pages/context/short-term.html +1 -1
- package/.next/server/pages/document-roles.html +1 -1
- package/.next/server/pages/documents.html +1 -1
- package/.next/server/pages/guide.html +1 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/search.html +1 -1
- package/.next/server/pages/knowledge.html +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages/prompt.html +1 -1
- package/.next/server/pages/settings.html +1 -1
- package/.next/server/pages/system/logs.html +1 -1
- package/.next/server/pages-manifest.json +29 -31
- package/.next/static/M3RTsFPBW6tg_7bJE5A2X/_buildManifest.js +1 -0
- package/.next/static/chunks/289-30e7c55f49a896b7.js +38 -0
- package/.next/static/chunks/455-97ad88d6604f54b7.js +6 -0
- package/.next/static/chunks/53-d534407b1397d66a.js +1 -0
- package/.next/static/chunks/647-d5e08fda405f7059.js +1 -0
- package/.next/static/chunks/694-2d545cfbb9779f2c.js +1 -0
- package/.next/static/chunks/795-d8fb7a0420512701.js +1 -0
- package/.next/static/chunks/861-91cbdd34b8e23151.js +1 -0
- package/.next/static/chunks/909-27ada1f00a52e11d.js +1 -0
- package/.next/static/chunks/pages/{_app-8abe93a007ab30a7.js → _app-2df1181f6609ae11.js} +2 -2
- package/.next/static/chunks/pages/context/{long-term-2e6a30a8f879df47.js → long-term-6b9a9683a4d6ea86.js} +1 -1
- package/.next/static/chunks/pages/context/{short-term-730211234fa3add6.js → short-term-6078efae6e3a905c.js} +1 -1
- package/.next/static/chunks/pages/{document-roles-4293f5fae599ff83.js → document-roles-24e4ba16d654959d.js} +1 -1
- package/.next/static/chunks/pages/documents-fc1a4fdb681f49a2.js +1 -0
- package/.next/static/chunks/pages/guide-7d15d3d3ddb0205e.js +1 -0
- package/.next/static/chunks/pages/{index-591c5acdff8d0690.js → index-a2a24e9602e7ea52.js} +1 -1
- package/.next/static/chunks/pages/knowledge/{file-detail-0a5e267f77f4e8b3.js → file-detail-97c77dfaf472a4b6.js} +1 -1
- package/.next/static/chunks/pages/knowledge/files-75a33100a1b3b5b5.js +1 -0
- package/.next/static/chunks/pages/models-d5e80645dc4a61b1.js +1 -0
- package/.next/static/chunks/pages/{overview-8d8ba5a1c0aa39ea.js → overview-1260176045ed5f7a.js} +1 -1
- package/.next/static/chunks/pages/system/{logs-f4e222140dc7b30c.js → logs-3826fa44a76b12fc.js} +1 -1
- package/package.json +1 -1
- package/.next/server/chunks/3445.js +0 -76
- package/.next/server/pages/api/documents/specs.js +0 -1
- package/.next/server/pages/api/documents/specs.js.nft.json +0 -1
- package/.next/server/pages/document-specs.html +0 -1
- package/.next/server/pages/document-specs.js.nft.json +0 -1
- package/.next/static/chunks/130-c1e5c14958fcba2b.js +0 -1
- package/.next/static/chunks/131-e2f0164f12b82496.js +0 -1
- package/.next/static/chunks/265-32ec272a49cfacef.js +0 -1
- package/.next/static/chunks/289-6bf8af72114aefd5.js +0 -38
- package/.next/static/chunks/455-e04e99d9e242de44.js +0 -6
- package/.next/static/chunks/512-12bd409cebeca05b.js +0 -1
- package/.next/static/chunks/698-5f16390243596219.js +0 -1
- package/.next/static/chunks/795-67a87e03d67ed908.js +0 -1
- package/.next/static/chunks/pages/document-specs-0fa19a0e348efc80.js +0 -1
- package/.next/static/chunks/pages/documents-3b87f1bf389b2f18.js +0 -1
- package/.next/static/chunks/pages/guide-74f0f7f42bc211b0.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-4b0132dd66e57085.js +0 -1
- package/.next/static/chunks/pages/models-b5f68c4c70257495.js +0 -1
- package/.next/static/dq39asOIM1hVN5SMdBZn3/_buildManifest.js +0 -1
- /package/.next/static/{dq39asOIM1hVN5SMdBZn3 → M3RTsFPBW6tg_7bJE5A2X}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[893],{260:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>k});var n=a(65321),o=a(97109),c=a(79059),r=a(17807),s=a(11702),l=a(85114),i=a(26171),d=a(33442),m=a(7576),h=a(68787),u=a(54849),x=a(21289),g=a(25258),p=a(63455),f=a(99650),w=a(58209),j=a(30486),A=a(83374),y=a(8383),v=a(26619),S=a(53998),_=a(6578),C=a(45551);let z={project_fact:"项目知识",user_preference:"用户偏好",feedback:"历史纠偏",pattern:"解决方案"},N={high:"red",medium:"orange",low:"default"};function k(){let e=(0,c.Vr)(),{message:t}=r.A.useApp(),[a,k]=(0,o.useState)(!0),[T,b]=(0,o.useState)([]),[D,I]=(0,o.useState)({count:0,totalBytes:0}),[M,B]=(0,o.useState)(""),[E,P]=(0,o.useState)(!1),[O,L]=(0,o.useState)(null),[U,F]=(0,o.useState)(""),[H,J]=(0,o.useState)(""),[K,X]=(0,o.useState)(!1),G=async a=>{k(!0);try{let[e,t]=await Promise.all([(0,_.hn)("long_term",a),(0,_.p)("long_term")]);b(e),I(t)}catch(a){t.error(e("common.error"))}finally{k(!1)}};(0,o.useEffect)(()=>{G()},[]);let V=async a=>{try{await (0,_.xw)(a),t.success(e("common.success")),await G(M)}catch(a){t.error(e("common.error"))}},W=async()=>{try{await (0,_.PH)("long_term"),t.success(e("common.success")),await G(M)}catch(a){t.error(e("common.error"))}},q=async()=>{try{await (0,_.E)("long_term"),t.success(e("common.success")),await G(M)}catch(a){t.error(e("common.error"))}},Q=async()=>{if(O&&U.trim()){X(!0);try{await (0,_.zo)(O.id,{content:U.trim(),context:H||void 0}),t.success(e("common.success")),P(!1),await G(M)}catch(a){t.error(e("common.error"))}finally{X(!1)}}},R=[{title:"序号",key:"index",width:70,render:(e,t,a)=>a+1},{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:"类型",dataIndex:"type",width:90,render:e=>(0,n.jsx)(s.A,{children:z[e]||e})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,n.jsx)(s.A,{color:N[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,a)=>(0,n.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,n.jsx)(l.Ay,{size:"small",type:"text",icon:(0,n.jsx)(f.A,{}),onClick:()=>{L(a),F(a.content),J(""),P(!0)}}),(0,n.jsx)(i.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{V(a.id)},children:(0,n.jsx)(l.Ay,{size:"small",type:"text",danger:!0,icon:(0,n.jsx)(w.A,{})})})]})}];return(0,n.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:e("nav.longTermContext")}),(0,n.jsx)("p",{className:"pageDesc",children:e("context.longTermDesc")})]}),(0,n.jsxs)(d.A,{wrap:!0,children:[(0,n.jsx)(m.A,{prefix:(0,n.jsx)(j.A,{}),placeholder:e("common.search"),value:M,onChange:e=>B(e.target.value),onPressEnter:()=>{G(M)},allowClear:!0,style:{width:240}}),(0,n.jsx)(l.Ay,{icon:(0,n.jsx)(A.A,{}),onClick:()=>{W()},children:"压缩"}),(0,n.jsx)(i.A,{title:"确定清除长期上下文吗?",onConfirm:()=>{q()},children:(0,n.jsx)(l.Ay,{danger:!0,icon:(0,n.jsx)(y.A,{}),children:"清除"})})]})]}),(0,n.jsx)(h.A,{size:"small",children:(0,n.jsx)(u.A,{title:"总上下文大小",value:(0,C.z3)(D.totalBytes),prefix:(0,n.jsx)(v.A,{}),suffix:" / ".concat(D.count," 条")})}),(0,n.jsxs)(h.A,{size:"small",children:[(0,n.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,n.jsx)(S.A,{})," ",e("context.longTermSource")]}),(0,n.jsx)(x.A,{rowKey:"id",columns:R,dataSource:T,loading:a,size:"small",pagination:{pageSize:15}})]}),(0,n.jsx)(g.A,{maskClosable:!1,title:e("models.editModel"),open:E,onCancel:()=>P(!1),onOk:()=>{Q()},confirmLoading:K,okText:e("common.save"),cancelText:e("common.cancel"),children:(0,n.jsxs)(p.A,{layout:"vertical",size:"middle",children:[(0,n.jsx)(p.A.Item,{label:e("context.content"),children:(0,n.jsx)(m.A.TextArea,{rows:6,value:U,onChange:e=>F(e.target.value)})}),(0,n.jsx)(p.A.Item,{label:e("context.source"),children:(0,n.jsx)(m.A,{value:H,onChange:e=>J(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}},36382:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/long-term",function(){return a(260)}])},45551:(e,t,a)=>{"use strict";function n(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),a=e/Math.pow(1024,t);return"".concat(a.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let a=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(a/60),o=Math.floor(n/24);return o>30?new Date(e).toLocaleDateString(t):"en-US"===t?o>0?"".concat(o,"d ago"):n>0?"".concat(n,"h ago"):a>0?"".concat(a,"m ago"):"Just now":o>0?"".concat(o," 天前"):n>0?"".concat(n," 小时前"):a>0?"".concat(a," 分钟前"):"刚刚"}a.d(t,{Jm:()=>s,fw:()=>o,z3:()=>n});let c={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},r={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===a?r:c)[e])?t:e}}},e=>{e.O(0,[433,787,576,195,985,150,455,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[893],{260:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>k});var n=a(65321),o=a(97109),c=a(79059),r=a(17807),s=a(11702),l=a(85114),i=a(26171),d=a(33442),m=a(7576),h=a(68787),u=a(54849),x=a(21289),g=a(25258),p=a(63455),f=a(99650),w=a(58209),j=a(30486),A=a(83374),y=a(8383),v=a(26619),S=a(53998),_=a(6578),C=a(45551);let z={project_fact:"项目知识",user_preference:"用户偏好",feedback:"历史纠偏",pattern:"解决方案"},N={high:"red",medium:"orange",low:"default"};function k(){let e=(0,c.Vr)(),{message:t}=r.A.useApp(),[a,k]=(0,o.useState)(!0),[T,b]=(0,o.useState)([]),[D,I]=(0,o.useState)({count:0,totalBytes:0}),[M,B]=(0,o.useState)(""),[E,P]=(0,o.useState)(!1),[O,L]=(0,o.useState)(null),[U,F]=(0,o.useState)(""),[H,J]=(0,o.useState)(""),[K,X]=(0,o.useState)(!1),G=async a=>{k(!0);try{let[e,t]=await Promise.all([(0,_.hn)("long_term",a),(0,_.p)("long_term")]);b(e),I(t)}catch(a){t.error(e("common.error"))}finally{k(!1)}};(0,o.useEffect)(()=>{G()},[]);let V=async a=>{try{await (0,_.xw)(a),t.success(e("common.success")),await G(M)}catch(a){t.error(e("common.error"))}},W=async()=>{try{await (0,_.PH)("long_term"),t.success(e("common.success")),await G(M)}catch(a){t.error(e("common.error"))}},q=async()=>{try{await (0,_.E)("long_term"),t.success(e("common.success")),await G(M)}catch(a){t.error(e("common.error"))}},Q=async()=>{if(O&&U.trim()){X(!0);try{await (0,_.zo)(O.id,{content:U.trim(),context:H||void 0}),t.success(e("common.success")),P(!1),await G(M)}catch(a){t.error(e("common.error"))}finally{X(!1)}}},R=[{title:"序号",key:"index",width:70,render:(e,t,a)=>a+1},{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:"类型",dataIndex:"type",width:90,render:e=>(0,n.jsx)(s.A,{children:z[e]||e})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,n.jsx)(s.A,{color:N[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,a)=>(0,n.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,n.jsx)(l.Ay,{size:"small",type:"text",icon:(0,n.jsx)(f.A,{}),onClick:()=>{L(a),F(a.content),J(""),P(!0)}}),(0,n.jsx)(i.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{V(a.id)},children:(0,n.jsx)(l.Ay,{size:"small",type:"text",danger:!0,icon:(0,n.jsx)(w.A,{})})})]})}];return(0,n.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:e("nav.longTermContext")}),(0,n.jsx)("p",{className:"pageDesc",children:e("context.longTermDesc")})]}),(0,n.jsxs)(d.A,{wrap:!0,children:[(0,n.jsx)(m.A,{prefix:(0,n.jsx)(j.A,{}),placeholder:e("common.search"),value:M,onChange:e=>B(e.target.value),onPressEnter:()=>{G(M)},allowClear:!0,style:{width:240}}),(0,n.jsx)(l.Ay,{icon:(0,n.jsx)(A.A,{}),onClick:()=>{W()},children:"压缩"}),(0,n.jsx)(i.A,{title:"确定清除长期上下文吗?",onConfirm:()=>{q()},children:(0,n.jsx)(l.Ay,{danger:!0,icon:(0,n.jsx)(y.A,{}),children:"清除"})})]})]}),(0,n.jsx)(h.A,{size:"small",children:(0,n.jsx)(u.A,{title:"总上下文大小",value:(0,C.z3)(D.totalBytes),prefix:(0,n.jsx)(v.A,{}),suffix:" / ".concat(D.count," 条")})}),(0,n.jsxs)(h.A,{size:"small",children:[(0,n.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,n.jsx)(S.A,{})," ",e("context.longTermSource")]}),(0,n.jsx)(x.A,{rowKey:"id",columns:R,dataSource:T,loading:a,size:"small",pagination:{pageSize:15}})]}),(0,n.jsx)(g.A,{maskClosable:!1,title:e("models.editModel"),open:E,onCancel:()=>P(!1),onOk:()=>{Q()},confirmLoading:K,okText:e("common.save"),cancelText:e("common.cancel"),children:(0,n.jsxs)(p.A,{layout:"vertical",size:"middle",children:[(0,n.jsx)(p.A.Item,{label:e("context.content"),children:(0,n.jsx)(m.A.TextArea,{rows:6,value:U,onChange:e=>F(e.target.value)})}),(0,n.jsx)(p.A.Item,{label:e("context.source"),children:(0,n.jsx)(m.A,{value:H,onChange:e=>J(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}},36382:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/long-term",function(){return a(260)}])},45551:(e,t,a)=>{"use strict";function n(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),a=e/Math.pow(1024,t);return"".concat(a.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let a=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(a/60),o=Math.floor(n/24);return o>30?new Date(e).toLocaleDateString(t):"en-US"===t?o>0?"".concat(o,"d ago"):n>0?"".concat(n,"h ago"):a>0?"".concat(a,"m ago"):"Just now":o>0?"".concat(o," 天前"):n>0?"".concat(n," 小时前"):a>0?"".concat(a," 分钟前"):"刚刚"}a.d(t,{Jm:()=>s,fw:()=>o,z3:()=>n});let c={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},r={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===a?r:c)[e])?t:e}}},e=>{e.O(0,[433,787,576,195,985,150,289,455,932,636,593,792],()=>e(e.s=36382)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[409],{19164:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/short-term",function(){return a(51162)}])},45551:(e,t,a)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),a=e/Math.pow(1024,t);return"".concat(a.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let a=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(a/60),n=Math.floor(o/24);return n>30?new Date(e).toLocaleDateString(t):"en-US"===t?n>0?"".concat(n,"d ago"):o>0?"".concat(o,"h ago"):a>0?"".concat(a,"m ago"):"Just now":n>0?"".concat(n," 天前"):o>0?"".concat(o," 小时前"):a>0?"".concat(a," 分钟前"):"刚刚"}a.d(t,{Jm:()=>s,fw:()=>n,z3:()=>o});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},c={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===a?c:r)[e])?t:e}},51162:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>N});var o=a(65321),n=a(97109),r=a(79059),c=a(17807),s=a(11702),i=a(85114),l=a(26171),d=a(33442),m=a(7576),h=a(68787),u=a(54849),x=a(21289),w=a(25258),f=a(63455),p=a(99650),g=a(58209),j=a(30486),A=a(83374),y=a(8383),v=a(26619),S=a(53998),C=a(6578),_=a(45551);let z={high:"red",medium:"orange",low:"default"};function N(){let e=(0,r.Vr)(),{message:t}=c.A.useApp(),[a,N]=(0,n.useState)(!0),[T,k]=(0,n.useState)([]),[D,M]=(0,n.useState)({count:0,totalBytes:0}),[b,B]=(0,n.useState)(""),[I,E]=(0,n.useState)(!1),[P,O]=(0,n.useState)(null),[L,U]=(0,n.useState)(""),[F,H]=(0,n.useState)(""),[J,K]=(0,n.useState)(!1),X=async a=>{N(!0);try{let[e,t]=await Promise.all([(0,C.hn)("short_term",a),(0,C.p)("short_term")]);k(e),M(t)}catch(a){t.error(e("common.error"))}finally{N(!1)}};(0,n.useEffect)(()=>{X()},[]);let G=async a=>{try{await (0,C.xw)(a),t.success(e("common.success")),await X(b)}catch(a){t.error(e("common.error"))}},V=async()=>{try{await (0,C.PH)("short_term"),t.success(e("common.success")),await X(b)}catch(a){t.error(e("common.error"))}},W=async()=>{try{await (0,C.E)("short_term"),t.success(e("common.success")),await X(b)}catch(a){t.error(e("common.error"))}},q=async()=>{if(P&&L.trim()){K(!0);try{await (0,C.zo)(P.id,{content:L.trim(),context:F||void 0}),t.success(e("common.success")),E(!1),await X(b)}catch(a){t.error(e("common.error"))}finally{K(!1)}}},Q=[{title:"序号",key:"index",width:70,render:(e,t,a)=>a+1},{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,o.jsx)(s.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,a)=>(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,o.jsx)(i.Ay,{size:"small",type:"text",icon:(0,o.jsx)(p.A,{}),onClick:()=>{O(a),U(a.content),H(""),E(!0)}}),(0,o.jsx)(l.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{G(a.id)},children:(0,o.jsx)(i.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(g.A,{})})})]})}];return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.shortTermContext")}),(0,o.jsx)("p",{className:"pageDesc",children:e("context.shortTermDesc")})]}),(0,o.jsxs)(d.A,{wrap:!0,children:[(0,o.jsx)(m.A,{prefix:(0,o.jsx)(j.A,{}),placeholder:e("common.search"),value:b,onChange:e=>B(e.target.value),onPressEnter:()=>{X(b)},allowClear:!0,style:{width:240}}),(0,o.jsx)(i.Ay,{icon:(0,o.jsx)(A.A,{}),onClick:()=>{V()},children:"压缩"}),(0,o.jsx)(l.A,{title:"确定清除短期上下文吗?",onConfirm:()=>{W()},children:(0,o.jsx)(i.Ay,{danger:!0,icon:(0,o.jsx)(y.A,{}),children:"清除"})})]})]}),(0,o.jsx)(h.A,{size:"small",children:(0,o.jsx)(u.A,{title:"总上下文大小",value:(0,_.z3)(D.totalBytes),prefix:(0,o.jsx)(v.A,{}),suffix:" / ".concat(D.count," 条")})}),(0,o.jsxs)(h.A,{size:"small",children:[(0,o.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(S.A,{})," ",e("context.shortTermSource")]}),(0,o.jsx)(x.A,{rowKey:"id",columns:Q,dataSource:T,loading:a,size:"small",pagination:{pageSize:15}})]}),(0,o.jsx)(w.A,{maskClosable:!1,title:e("models.editModel"),open:I,onCancel:()=>E(!1),onOk:()=>{q()},confirmLoading:J,okText:e("common.save"),cancelText:e("common.cancel"),children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("context.content"),children:(0,o.jsx)(m.A.TextArea,{rows:6,value:L,onChange:e=>U(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(m.A,{value:F,onChange:e=>H(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}}},e=>{e.O(0,[433,787,576,195,985,150,455,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[409],{19164:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/short-term",function(){return a(51162)}])},45551:(e,t,a)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),a=e/Math.pow(1024,t);return"".concat(a.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let a=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(a/60),n=Math.floor(o/24);return n>30?new Date(e).toLocaleDateString(t):"en-US"===t?n>0?"".concat(n,"d ago"):o>0?"".concat(o,"h ago"):a>0?"".concat(a,"m ago"):"Just now":n>0?"".concat(n," 天前"):o>0?"".concat(o," 小时前"):a>0?"".concat(a," 分钟前"):"刚刚"}a.d(t,{Jm:()=>s,fw:()=>n,z3:()=>o});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},c={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===a?c:r)[e])?t:e}},51162:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>N});var o=a(65321),n=a(97109),r=a(79059),c=a(17807),s=a(11702),i=a(85114),l=a(26171),d=a(33442),m=a(7576),h=a(68787),u=a(54849),x=a(21289),w=a(25258),f=a(63455),p=a(99650),g=a(58209),j=a(30486),A=a(83374),y=a(8383),v=a(26619),S=a(53998),C=a(6578),_=a(45551);let z={high:"red",medium:"orange",low:"default"};function N(){let e=(0,r.Vr)(),{message:t}=c.A.useApp(),[a,N]=(0,n.useState)(!0),[T,k]=(0,n.useState)([]),[D,M]=(0,n.useState)({count:0,totalBytes:0}),[b,B]=(0,n.useState)(""),[I,E]=(0,n.useState)(!1),[P,O]=(0,n.useState)(null),[L,U]=(0,n.useState)(""),[F,H]=(0,n.useState)(""),[J,K]=(0,n.useState)(!1),X=async a=>{N(!0);try{let[e,t]=await Promise.all([(0,C.hn)("short_term",a),(0,C.p)("short_term")]);k(e),M(t)}catch(a){t.error(e("common.error"))}finally{N(!1)}};(0,n.useEffect)(()=>{X()},[]);let G=async a=>{try{await (0,C.xw)(a),t.success(e("common.success")),await X(b)}catch(a){t.error(e("common.error"))}},V=async()=>{try{await (0,C.PH)("short_term"),t.success(e("common.success")),await X(b)}catch(a){t.error(e("common.error"))}},W=async()=>{try{await (0,C.E)("short_term"),t.success(e("common.success")),await X(b)}catch(a){t.error(e("common.error"))}},q=async()=>{if(P&&L.trim()){K(!0);try{await (0,C.zo)(P.id,{content:L.trim(),context:F||void 0}),t.success(e("common.success")),E(!1),await X(b)}catch(a){t.error(e("common.error"))}finally{K(!1)}}},Q=[{title:"序号",key:"index",width:70,render:(e,t,a)=>a+1},{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,o.jsx)(s.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,a)=>(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,o.jsx)(i.Ay,{size:"small",type:"text",icon:(0,o.jsx)(p.A,{}),onClick:()=>{O(a),U(a.content),H(""),E(!0)}}),(0,o.jsx)(l.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{G(a.id)},children:(0,o.jsx)(i.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(g.A,{})})})]})}];return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.shortTermContext")}),(0,o.jsx)("p",{className:"pageDesc",children:e("context.shortTermDesc")})]}),(0,o.jsxs)(d.A,{wrap:!0,children:[(0,o.jsx)(m.A,{prefix:(0,o.jsx)(j.A,{}),placeholder:e("common.search"),value:b,onChange:e=>B(e.target.value),onPressEnter:()=>{X(b)},allowClear:!0,style:{width:240}}),(0,o.jsx)(i.Ay,{icon:(0,o.jsx)(A.A,{}),onClick:()=>{V()},children:"压缩"}),(0,o.jsx)(l.A,{title:"确定清除短期上下文吗?",onConfirm:()=>{W()},children:(0,o.jsx)(i.Ay,{danger:!0,icon:(0,o.jsx)(y.A,{}),children:"清除"})})]})]}),(0,o.jsx)(h.A,{size:"small",children:(0,o.jsx)(u.A,{title:"总上下文大小",value:(0,_.z3)(D.totalBytes),prefix:(0,o.jsx)(v.A,{}),suffix:" / ".concat(D.count," 条")})}),(0,o.jsxs)(h.A,{size:"small",children:[(0,o.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(S.A,{})," ",e("context.shortTermSource")]}),(0,o.jsx)(x.A,{rowKey:"id",columns:Q,dataSource:T,loading:a,size:"small",pagination:{pageSize:15}})]}),(0,o.jsx)(w.A,{maskClosable:!1,title:e("models.editModel"),open:I,onCancel:()=>E(!1),onOk:()=>{q()},confirmLoading:J,okText:e("common.save"),cancelText:e("common.cancel"),children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("context.content"),children:(0,o.jsx)(m.A.TextArea,{rows:6,value:L,onChange:e=>U(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(m.A,{value:F,onChange:e=>H(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}}},e=>{e.O(0,[433,787,576,195,985,150,289,455,932,636,593,792],()=>e(e.s=19164)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[623],{23507:(e,l,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return r(59889)}])},59889:(e,l,r)=>{"use strict";r.r(l),r.d(l,{default:()=>X});var i=r(65321),s=r(97109),n=r(35292),t=r(11702),o=r(17807),a=r(63455),c=r(33442),d=r(84253),p=r(68787),x=r(85114),m=r(26171),h=r(57271),y=r(85493),f=r(34052),u=r(7576),j=r(2256),g=r(38770),A=r(58569),v=r(25345),b=r(43979),w=r(80042),S=r(75548),I=r(26631),T=r(84662),z=r(30486),C=r(99650),k=r(8263),B=r(84742),R=r(43094),F=r(8579),_=r(58209),W=r(54746),H=r(96651),N=r(60470),D=r(6578),E=r(79059);let{Paragraph:P}=n.A,q={rule:(0,i.jsx)(v.A,{}),project_fact:(0,i.jsx)(b.A,{}),table:(0,i.jsx)(w.A,{}),drawing:(0,i.jsx)(S.A,{}),specification:(0,i.jsx)(I.A,{}),reference:(0,i.jsx)(T.A,{})},O={fact_extraction:(0,i.jsx)(z.A,{}),chapter_generation:(0,i.jsx)(C.A,{}),llm_review:(0,i.jsx)(k.A,{}),validation:(0,i.jsx)(B.A,{}),formatting:(0,i.jsx)(R.A,{}),reference:(0,i.jsx)(T.A,{})},V={rule:"#fa8c16",project_fact:"#1677ff",table:"#52c41a",drawing:"#722ed1",specification:"#eb2f96",reference:"#13c2c2"},G={fact_extraction:"#fa8c16",chapter_generation:"#1677ff",llm_review:"#722ed1",validation:"#52c41a",formatting:"#eb2f96",reference:"#13c2c2"},L={rule:"roles.ruleFile",project_fact:"roles.projectFactFile",table:"roles.tableFile",drawing:"roles.drawingFile",specification:"roles.specificationFile",reference:"roles.reference"},U={fact_extraction:"roles.factExtraction",chapter_generation:"roles.chapterGeneration",llm_review:"roles.llmReview",validation:"roles.validation",formatting:"roles.formatting",reference:"roles.reference"},Q=e=>(0,i.jsx)(t.A,{closable:e.closable,onClose:e.onClose,color:"blue",style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:e.label});function X(){let e,l,r=(0,E.Vr)(),{message:n}=o.A.useApp(),[v]=a.A.useForm(),[b]=a.A.useForm(),[w,S]=(0,s.useState)([]),[T,z]=(0,s.useState)([]),[k,B]=(0,s.useState)([]),[R,X]=(0,s.useState)(!1),[K,J]=(0,s.useState)([]),[M,Y]=(0,s.useState)(!1),[Z,$]=(0,s.useState)(!1),[ee,el]=(0,s.useState)(!1),[er,ei]=(0,s.useState)("file"),[es,en]=(0,s.useState)("custom"),et=async()=>{let[e,l,r]=await Promise.all([(0,D.lv)(),(0,D.nU)({limit:200,includeContent:!1}),(0,D.dx)()]);S(e.roles),z(e.configs),B(l.files),J(r)};(0,s.useEffect)(()=>{et().catch(()=>n.error(r("common.error")))},[n,r]);let eo=()=>"all"===es||"custom"===es,ea=w.filter(eo),ec=T.filter(eo),ed=ea.filter(e=>"file"===e.type),ep=ea.filter(e=>"prompt"===e.type),ex=w.filter(e=>"file"===e.type),em=w.filter(e=>"prompt"===e.type),eh=async()=>{try{let e=await v.validateFields(),l=await (0,D.dg)(e);S(l.roles),z(l.configs),Y(!1),n.success(r("common.success"))}catch(e){n.error(r("common.error"))}},ey=async()=>{try{let e=await b.validateFields(),l=e=>(null!=e?e:[]).map((e,l)=>{var r;return{roleId:e.roleId,order:Number(null!=(r=e.order)?r:l)}}),i=await (0,D.NR)({...e,fileRoles:l(e.fileRoles),promptRoles:l(e.promptRoles)});S(i.roles),z(i.configs),$(!1),n.success(r("common.success"))}catch(e){n.error(r("common.error"))}},ef=async e=>{let l=await (0,D.FV)(e.type,e.id);S(l.roles),z(l.configs)},eu=async e=>{let l=await (0,D.dw)(e);S(l.roles),z(l.configs)},ej=function(e){var l;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";v.setFieldsValue(e?{...e,resourceIds:(null==(l=e.resourceIds)?void 0:l.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]}:{id:"role-".concat(Date.now()),name:"",description:"",type:r,resourceIds:[],executionType:"prompt"===r?"reference":void 0,processingType:"file"===r?"reference":void 0}),Y(!0)},eg=e=>{b.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[],builtIn:!1}),$(!0)},eA=e=>w.find(l=>l.id===e),ev=async e=>{X(!0);try{let l=await (0,D.nU)({query:e,limit:80,includeContent:!!e.trim()});B(l.files)}catch(e){n.error("知识库文件检索失败")}finally{X(!1)}},eb=k.map(e=>({label:(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8},children:[(0,i.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.relativePath}),(0,i.jsxs)(c.A,{size:4,children:[(0,i.jsx)(t.A,{color:"content"===e.matchedBy?"purple":"disk"===e.matchedBy?"orange":"blue",style:{margin:0},children:"content"===e.matchedBy?"内容":"disk"===e.matchedBy?"磁盘":"文件"}),(0,i.jsx)(t.A,{style:{margin:0},children:e.status})]})]}),value:e.relativePath}));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:r("roles.title")}),(0,i.jsx)("p",{className:"pageDesc",children:r("roles.description")})]}),(0,i.jsxs)(c.A,{children:[(0,i.jsx)(h.A,{value:es,onChange:en,style:{width:170},options:[{label:"我的配置 (".concat(w.length+T.length,")"),value:"custom"},{label:"全部来源 (".concat(w.length+T.length,")"),value:"all"}]}),(0,i.jsx)(x.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>ej(void 0,"file"),children:r("roles.newFileRole")}),(0,i.jsx)(x.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>ej(void 0,"prompt"),children:r("roles.newPromptRole")}),(0,i.jsx)(x.Ay,{type:"primary",icon:(0,i.jsx)(W.A,{}),onClick:()=>eg(),children:r("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:r("roles.plainGuideTitle")}),(0,i.jsx)(x.Ay,{type:"link",size:"small",icon:ee?(0,i.jsx)(H.A,{}):(0,i.jsx)(N.A,{}),onClick:()=>el(!ee),style:{padding:"0 4px"},children:ee?"收起说明":"展开说明"})]}),description:ee?r("roles.plainGuideDesc"):void 0}),(0,i.jsx)(p.A,{size:"small",tabList:[{key:"file",label:"文件角色 (".concat(ed.length,")")},{key:"prompt",label:"提示词角色 (".concat(ep.length,")")},{key:"configs",label:"项目角色配置 (".concat(ec.length,")")}],activeTabKey:er,onTabChange:ei,children:"configs"===er?0===ec.length?(0,i.jsx)(d.A,{description:r("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:ec.map(e=>{let l=e.fileRoles.map(e=>({...e,role:eA(e.roleId)})).filter(e=>e.role),s=e.promptRoles.map(e=>({...e,role:eA(e.roleId)})).filter(e=>e.role);return(0,i.jsxs)(p.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:6},children:[(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.name}),(0,i.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的配置"}),(0,i.jsxs)("div",{style:{display:"flex",gap:4,flexShrink:0},children:[(0,i.jsx)(x.Ay,{size:"small",icon:(0,i.jsx)(C.A,{}),onClick:()=>eg(e),children:"编辑"}),(0,i.jsx)(m.A,{title:r("common.confirm"),onConfirm:()=>{eu(e.id)},children:(0,i.jsx)(x.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(_.A,{})})})]})]}),e.description&&(0,i.jsx)(P,{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:[(0,i.jsxs)("div",{style:{marginBottom:4},children:[(0,i.jsxs)("span",{children:["文件角色 (",e.fileRoles.length,"): "]}),l.length>0?(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[l.slice(0,4).map(e=>(0,i.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),l.length>4&&(0,i.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",l.length-4]})]}):(0,i.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("span",{children:["提示词角色 (",e.promptRoles.length,"): "]}),s.length>0?(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[s.slice(0,4).map(e=>(0,i.jsx)(t.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),s.length>4&&(0,i.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",s.length-4]})]}):(0,i.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]})]})]},e.id)})}):(e="file"===er?ed:ep,l=r,0===e.length?(0,i.jsx)(d.A,{description:r("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(270px, 1fr))",gap:12},children:e.map((e,s)=>{var n,o,a,c,d,h,y,f,u;let j=(null==(n=e.resourceIds)?void 0:n.length)?e.resourceIds:e.resourceId?[e.resourceId]:[],g=j.slice(0,3),A=j.length-g.length,v="file"===e.type?null!=(a=q[null!=(o=e.processingType)?o:""])?a:(0,i.jsx)(I.A,{}):null!=(d=O[null!=(c=e.executionType)?c:""])?d:(0,i.jsx)(F.A,{}),b="file"===e.type?null!=(y=V[null!=(h=e.processingType)?h:""])?y:"var(--colorAccent)":null!=(u=G[null!=(f=e.executionType)?f:""])?u:"var(--colorWarning)";return(0,i.jsxs)(p.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:b,fontSize:16,flexShrink:0,lineHeight:1},children:v}),(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"20px"},children:e.name})]}),(0,i.jsx)("div",{style:{display:"flex",gap:4,flexShrink:0},children:(0,i.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的角色"})})]}),e.description&&(0,i.jsx)(P,{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)(t.A,{color:"file"===e.type?"blue":"purple",style:{margin:0},children:function(e,l){var r,i,s;let n="file"===e.type?L[null!=(r=e.processingType)?r:""]:U[null!=(i=e.executionType)?i:""];return n?l(n):null!=(s="file"===e.type?e.processingType:e.executionType)?s:""}(e,l)}),j.length>0&&(0,i.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",j.length," 个资源"]})]}),g.length>0&&(0,i.jsx)("div",{style:{marginBottom:10},children:(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[g.map(e=>(0,i.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"},children:e},e)),A>0&&(0,i.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",A]})]})}),(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:6,paddingTop:4,borderTop:"1px solid var(--colorBorderSecondary)"},children:[(0,i.jsx)(x.Ay,{size:"small",icon:(0,i.jsx)(C.A,{}),onClick:()=>ej(e),children:"编辑"}),(0,i.jsx)(m.A,{title:r("common.confirm"),onConfirm:()=>{ef(e)},children:(0,i.jsx)(x.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(_.A,{})})})]})]},e.id)})}))}),(0,i.jsx)(f.A,{title:r("roles.roleEditor"),open:M,onClose:()=>Y(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,i.jsx)(x.Ay,{type:"primary",onClick:()=>{eh()},children:r("common.save")}),children:(0,i.jsxs)(a.A,{form:v,layout:"vertical",children:[(0,i.jsx)(a.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(u.A,{})}),(0,i.jsxs)(j.A,{gutter:16,children:[(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(a.A.Item,{name:"type",label:r("roles.roleType"),rules:[{required:!0}],children:(0,i.jsx)(h.A,{options:[{label:r("roles.fileRole"),value:"file"},{label:r("roles.promptRole"),value:"prompt"}]})})}),(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(a.A.Item,{name:"name",label:r("roles.roleName"),rules:[{required:!0}],children:(0,i.jsx)(u.A,{})})})]}),(0,i.jsx)(a.A.Item,{name:"description",label:r("roles.roleDescription"),children:(0,i.jsx)(u.A.TextArea,{rows:2})}),(0,i.jsx)(a.A.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.type!==l.type,children:e=>{let{getFieldValue:l}=e,s="prompt"===l("type");return(0,i.jsx)(p.A,{size:"small",title:s?"提示词角色配置":"文件角色配置",style:{border:"1px solid var(--colorBorderSecondary)"},children:s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.A.Item,{name:"executionType",label:r("roles.executionType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,i.jsx)(h.A,{options:[{label:r("roles.factExtraction"),value:"fact_extraction"},{label:r("roles.chapterGeneration"),value:"chapter_generation"},{label:r("roles.validation"),value:"validation"},{label:r("roles.formatting"),value:"formatting"},{label:r("roles.reference"),value:"reference"}]})}),(0,i.jsx)(a.A.Item,{name:"resourceIds",label:r("roles.bindPrompt"),style:{marginBottom:0},help:(0,i.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:r("roles.multiBindPromptHelp")}),children:(0,i.jsx)(h.A,{mode:"multiple",showSearch:!0,tagRender:Q,placeholder:"选择提示词",options:K.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.A.Item,{name:"processingType",label:r("roles.processingType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,i.jsx)(h.A,{options:[{label:r("roles.ruleFile"),value:"rule"},{label:r("roles.projectFactFile"),value:"project_fact"},{label:r("roles.tableFile"),value:"table"},{label:r("roles.drawingFile"),value:"drawing"},{label:r("roles.specificationFile"),value:"specification"},{label:r("roles.reference"),value:"reference"}]})}),(0,i.jsx)(a.A.Item,{name:"resourceIds",label:r("roles.bindFile"),style:{marginBottom:0},help:(0,i.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:r("roles.multiBindFileHelp")}),children:(0,i.jsx)(h.A,{mode:"multiple",showSearch:!0,filterOption:!1,loading:R,onSearch:e=>{ev(e)},onFocus:()=>{ev("")},tagRender:Q,placeholder:"输入关键词搜索知识库文件",options:eb,optionLabelProp:"value"})})]})})}})]})}),(0,i.jsx)(f.A,{title:r("roles.configEditor"),open:Z,onClose:()=>$(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,i.jsx)(x.Ay,{type:"primary",onClick:()=>{ey()},children:r("common.save")}),children:(0,i.jsxs)(a.A,{form:b,layout:"vertical",children:[(0,i.jsx)(a.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(u.A,{})}),(0,i.jsxs)(j.A,{gutter:16,children:[(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(a.A.Item,{name:"name",label:r("roles.configName"),rules:[{required:!0}],children:(0,i.jsx)(u.A,{})})}),(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(a.A.Item,{name:"description",label:r("roles.configDescription"),children:(0,i.jsx)(u.A,{})})})]}),(0,i.jsx)(A.A,{destroyInactiveTabPane:!1,items:[{key:"file",label:"文件角色 (".concat(ed.length,")"),children:(0,i.jsx)(a.A.List,{name:"fileRoles",children:(e,l)=>{let{add:s,remove:n}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0===e.length&&(0,i.jsx)(d.A,{description:"暂未添加文件角色"}),e.map((e,l)=>(0,i.jsxs)(p.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsxs)("div",{style:{position:"absolute",top:-10,left:12,background:"#1677ff",color:"#fff",fontSize:11,fontWeight:700,padding:"1px 8px",borderRadius:10},children:["#",l+1]}),(0,i.jsx)(x.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(_.A,{}),onClick:()=>n(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsxs)(j.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,i.jsx)(g.A,{flex:"auto",children:(0,i.jsx)(a.A.Item,{name:[e.name,"roleId"],label:"文件角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(h.A,{placeholder:"选择文件角色",size:"small",options:ex.map(e=>{var l;return{label:"".concat(e.name," (").concat(r(L[null!=(l=e.processingType)?l:""]||"roles.reference"),")"),value:e.id}})})})}),(0,i.jsx)(g.A,{style:{width:90},children:(0,i.jsx)(a.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(u.A,{type:"number",size:"small"})})})]})]},e.key)),(0,i.jsx)(x.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>s({order:e.length}),children:r("roles.addRole")})]})}})},{key:"prompt",label:"提示词角色 (".concat(em.length,")"),children:(0,i.jsx)(a.A.List,{name:"promptRoles",children:(e,l)=>{let{add:s,remove:n}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0===e.length&&(0,i.jsx)(d.A,{description:"暂未添加提示词角色"}),e.map((e,l)=>(0,i.jsxs)(p.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsxs)("div",{style:{position:"absolute",top:-10,left:12,background:"#722ed1",color:"#fff",fontSize:11,fontWeight:700,padding:"1px 8px",borderRadius:10},children:["#",l+1]}),(0,i.jsx)(x.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(_.A,{}),onClick:()=>n(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsxs)(j.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,i.jsx)(g.A,{flex:"auto",children:(0,i.jsx)(a.A.Item,{name:[e.name,"roleId"],label:"提示词角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(h.A,{placeholder:"选择提示词角色",size:"small",options:em.map(e=>{var l;return{label:"".concat(e.name," (").concat(r(U[null!=(l=e.executionType)?l:""]||"roles.reference"),")"),value:e.id}})})})}),(0,i.jsx)(g.A,{style:{width:90},children:(0,i.jsx)(a.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(u.A,{type:"number",size:"small"})})})]})]},e.key)),(0,i.jsx)(x.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>s({order:e.length}),children:r("roles.addRole")})]})}})}]})]})})]})}}},e=>{e.O(0,[433,787,576,195,455,698,636,593,792],()=>e(e.s=23507)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[623],{23507:(e,l,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return r(59889)}])},59889:(e,l,r)=>{"use strict";r.r(l),r.d(l,{default:()=>X});var i=r(65321),s=r(97109),n=r(35292),t=r(11702),o=r(17807),a=r(63455),c=r(33442),d=r(84253),p=r(68787),x=r(85114),m=r(26171),h=r(57271),y=r(85493),f=r(34052),u=r(7576),j=r(2256),g=r(38770),A=r(58569),v=r(25345),b=r(43979),w=r(80042),S=r(75548),I=r(26631),T=r(84662),z=r(30486),C=r(99650),k=r(8263),B=r(84742),R=r(43094),F=r(8579),_=r(58209),W=r(54746),H=r(96651),N=r(60470),D=r(6578),E=r(79059);let{Paragraph:P}=n.A,q={rule:(0,i.jsx)(v.A,{}),project_fact:(0,i.jsx)(b.A,{}),table:(0,i.jsx)(w.A,{}),drawing:(0,i.jsx)(S.A,{}),specification:(0,i.jsx)(I.A,{}),reference:(0,i.jsx)(T.A,{})},O={fact_extraction:(0,i.jsx)(z.A,{}),chapter_generation:(0,i.jsx)(C.A,{}),llm_review:(0,i.jsx)(k.A,{}),validation:(0,i.jsx)(B.A,{}),formatting:(0,i.jsx)(R.A,{}),reference:(0,i.jsx)(T.A,{})},V={rule:"#fa8c16",project_fact:"#1677ff",table:"#52c41a",drawing:"#722ed1",specification:"#eb2f96",reference:"#13c2c2"},G={fact_extraction:"#fa8c16",chapter_generation:"#1677ff",llm_review:"#722ed1",validation:"#52c41a",formatting:"#eb2f96",reference:"#13c2c2"},L={rule:"roles.ruleFile",project_fact:"roles.projectFactFile",table:"roles.tableFile",drawing:"roles.drawingFile",specification:"roles.specificationFile",reference:"roles.reference"},U={fact_extraction:"roles.factExtraction",chapter_generation:"roles.chapterGeneration",llm_review:"roles.llmReview",validation:"roles.validation",formatting:"roles.formatting",reference:"roles.reference"},Q=e=>(0,i.jsx)(t.A,{closable:e.closable,onClose:e.onClose,color:"blue",style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:e.label});function X(){let e,l,r=(0,E.Vr)(),{message:n}=o.A.useApp(),[v]=a.A.useForm(),[b]=a.A.useForm(),[w,S]=(0,s.useState)([]),[T,z]=(0,s.useState)([]),[k,B]=(0,s.useState)([]),[R,X]=(0,s.useState)(!1),[K,J]=(0,s.useState)([]),[M,Y]=(0,s.useState)(!1),[Z,$]=(0,s.useState)(!1),[ee,el]=(0,s.useState)(!1),[er,ei]=(0,s.useState)("file"),[es,en]=(0,s.useState)("custom"),et=async()=>{let[e,l,r]=await Promise.all([(0,D.lv)(),(0,D.nU)({limit:200,includeContent:!1}),(0,D.dx)()]);S(e.roles),z(e.configs),B(l.files),J(r)};(0,s.useEffect)(()=>{et().catch(()=>n.error(r("common.error")))},[n,r]);let eo=()=>"all"===es||"custom"===es,ea=w.filter(eo),ec=T.filter(eo),ed=ea.filter(e=>"file"===e.type),ep=ea.filter(e=>"prompt"===e.type),ex=w.filter(e=>"file"===e.type),em=w.filter(e=>"prompt"===e.type),eh=async()=>{try{let e=await v.validateFields(),l=await (0,D.dg)(e);S(l.roles),z(l.configs),Y(!1),n.success(r("common.success"))}catch(e){n.error(r("common.error"))}},ey=async()=>{try{let e=await b.validateFields(),l=e=>(null!=e?e:[]).map((e,l)=>{var r;return{roleId:e.roleId,order:Number(null!=(r=e.order)?r:l)}}),i=await (0,D.NR)({...e,fileRoles:l(e.fileRoles),promptRoles:l(e.promptRoles)});S(i.roles),z(i.configs),$(!1),n.success(r("common.success"))}catch(e){n.error(r("common.error"))}},ef=async e=>{let l=await (0,D.FV)(e.type,e.id);S(l.roles),z(l.configs)},eu=async e=>{let l=await (0,D.dw)(e);S(l.roles),z(l.configs)},ej=function(e){var l;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";v.setFieldsValue(e?{...e,resourceIds:(null==(l=e.resourceIds)?void 0:l.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]}:{id:"role-".concat(Date.now()),name:"",description:"",type:r,resourceIds:[],executionType:"prompt"===r?"reference":void 0,processingType:"file"===r?"reference":void 0}),Y(!0)},eg=e=>{b.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[],builtIn:!1}),$(!0)},eA=e=>w.find(l=>l.id===e),ev=async e=>{X(!0);try{let l=await (0,D.nU)({query:e,limit:80,includeContent:!!e.trim()});B(l.files)}catch(e){n.error("知识库文件检索失败")}finally{X(!1)}},eb=k.map(e=>({label:(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8},children:[(0,i.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.relativePath}),(0,i.jsxs)(c.A,{size:4,children:[(0,i.jsx)(t.A,{color:"content"===e.matchedBy?"purple":"disk"===e.matchedBy?"orange":"blue",style:{margin:0},children:"content"===e.matchedBy?"内容":"disk"===e.matchedBy?"磁盘":"文件"}),(0,i.jsx)(t.A,{style:{margin:0},children:e.status})]})]}),value:e.relativePath}));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:r("roles.title")}),(0,i.jsx)("p",{className:"pageDesc",children:r("roles.description")})]}),(0,i.jsxs)(c.A,{children:[(0,i.jsx)(h.A,{value:es,onChange:en,style:{width:170},options:[{label:"我的配置 (".concat(w.length+T.length,")"),value:"custom"},{label:"全部来源 (".concat(w.length+T.length,")"),value:"all"}]}),(0,i.jsx)(x.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>ej(void 0,"file"),children:r("roles.newFileRole")}),(0,i.jsx)(x.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>ej(void 0,"prompt"),children:r("roles.newPromptRole")}),(0,i.jsx)(x.Ay,{type:"primary",icon:(0,i.jsx)(W.A,{}),onClick:()=>eg(),children:r("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:r("roles.plainGuideTitle")}),(0,i.jsx)(x.Ay,{type:"link",size:"small",icon:ee?(0,i.jsx)(H.A,{}):(0,i.jsx)(N.A,{}),onClick:()=>el(!ee),style:{padding:"0 4px"},children:ee?"收起说明":"展开说明"})]}),description:ee?r("roles.plainGuideDesc"):void 0}),(0,i.jsx)(p.A,{size:"small",tabList:[{key:"file",label:"文件角色 (".concat(ed.length,")")},{key:"prompt",label:"提示词角色 (".concat(ep.length,")")},{key:"configs",label:"项目角色配置 (".concat(ec.length,")")}],activeTabKey:er,onTabChange:ei,children:"configs"===er?0===ec.length?(0,i.jsx)(d.A,{description:r("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:ec.map(e=>{let l=e.fileRoles.map(e=>({...e,role:eA(e.roleId)})).filter(e=>e.role),s=e.promptRoles.map(e=>({...e,role:eA(e.roleId)})).filter(e=>e.role);return(0,i.jsxs)(p.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:6},children:[(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.name}),(0,i.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的配置"}),(0,i.jsxs)("div",{style:{display:"flex",gap:4,flexShrink:0},children:[(0,i.jsx)(x.Ay,{size:"small",icon:(0,i.jsx)(C.A,{}),onClick:()=>eg(e),children:"编辑"}),(0,i.jsx)(m.A,{title:r("common.confirm"),onConfirm:()=>{eu(e.id)},children:(0,i.jsx)(x.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(_.A,{})})})]})]}),e.description&&(0,i.jsx)(P,{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:[(0,i.jsxs)("div",{style:{marginBottom:4},children:[(0,i.jsxs)("span",{children:["文件角色 (",e.fileRoles.length,"): "]}),l.length>0?(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[l.slice(0,4).map(e=>(0,i.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),l.length>4&&(0,i.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",l.length-4]})]}):(0,i.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("span",{children:["提示词角色 (",e.promptRoles.length,"): "]}),s.length>0?(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[s.slice(0,4).map(e=>(0,i.jsx)(t.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),s.length>4&&(0,i.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",s.length-4]})]}):(0,i.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]})]})]},e.id)})}):(e="file"===er?ed:ep,l=r,0===e.length?(0,i.jsx)(d.A,{description:r("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(270px, 1fr))",gap:12},children:e.map((e,s)=>{var n,o,a,c,d,h,y,f,u;let j=(null==(n=e.resourceIds)?void 0:n.length)?e.resourceIds:e.resourceId?[e.resourceId]:[],g=j.slice(0,3),A=j.length-g.length,v="file"===e.type?null!=(a=q[null!=(o=e.processingType)?o:""])?a:(0,i.jsx)(I.A,{}):null!=(d=O[null!=(c=e.executionType)?c:""])?d:(0,i.jsx)(F.A,{}),b="file"===e.type?null!=(y=V[null!=(h=e.processingType)?h:""])?y:"var(--colorAccent)":null!=(u=G[null!=(f=e.executionType)?f:""])?u:"var(--colorWarning)";return(0,i.jsxs)(p.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:b,fontSize:16,flexShrink:0,lineHeight:1},children:v}),(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"20px"},children:e.name})]}),(0,i.jsx)("div",{style:{display:"flex",gap:4,flexShrink:0},children:(0,i.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的角色"})})]}),e.description&&(0,i.jsx)(P,{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)(t.A,{color:"file"===e.type?"blue":"purple",style:{margin:0},children:function(e,l){var r,i,s;let n="file"===e.type?L[null!=(r=e.processingType)?r:""]:U[null!=(i=e.executionType)?i:""];return n?l(n):null!=(s="file"===e.type?e.processingType:e.executionType)?s:""}(e,l)}),j.length>0&&(0,i.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",j.length," 个资源"]})]}),g.length>0&&(0,i.jsx)("div",{style:{marginBottom:10},children:(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[g.map(e=>(0,i.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"},children:e},e)),A>0&&(0,i.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",A]})]})}),(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:6,paddingTop:4,borderTop:"1px solid var(--colorBorderSecondary)"},children:[(0,i.jsx)(x.Ay,{size:"small",icon:(0,i.jsx)(C.A,{}),onClick:()=>ej(e),children:"编辑"}),(0,i.jsx)(m.A,{title:r("common.confirm"),onConfirm:()=>{ef(e)},children:(0,i.jsx)(x.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(_.A,{})})})]})]},e.id)})}))}),(0,i.jsx)(f.A,{title:r("roles.roleEditor"),open:M,onClose:()=>Y(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,i.jsx)(x.Ay,{type:"primary",onClick:()=>{eh()},children:r("common.save")}),children:(0,i.jsxs)(a.A,{form:v,layout:"vertical",children:[(0,i.jsx)(a.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(u.A,{})}),(0,i.jsxs)(j.A,{gutter:16,children:[(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(a.A.Item,{name:"type",label:r("roles.roleType"),rules:[{required:!0}],children:(0,i.jsx)(h.A,{options:[{label:r("roles.fileRole"),value:"file"},{label:r("roles.promptRole"),value:"prompt"}]})})}),(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(a.A.Item,{name:"name",label:r("roles.roleName"),rules:[{required:!0}],children:(0,i.jsx)(u.A,{})})})]}),(0,i.jsx)(a.A.Item,{name:"description",label:r("roles.roleDescription"),children:(0,i.jsx)(u.A.TextArea,{rows:2})}),(0,i.jsx)(a.A.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.type!==l.type,children:e=>{let{getFieldValue:l}=e,s="prompt"===l("type");return(0,i.jsx)(p.A,{size:"small",title:s?"提示词角色配置":"文件角色配置",style:{border:"1px solid var(--colorBorderSecondary)"},children:s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.A.Item,{name:"executionType",label:r("roles.executionType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,i.jsx)(h.A,{options:[{label:r("roles.factExtraction"),value:"fact_extraction"},{label:r("roles.chapterGeneration"),value:"chapter_generation"},{label:r("roles.validation"),value:"validation"},{label:r("roles.formatting"),value:"formatting"},{label:r("roles.reference"),value:"reference"}]})}),(0,i.jsx)(a.A.Item,{name:"resourceIds",label:r("roles.bindPrompt"),style:{marginBottom:0},help:(0,i.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:r("roles.multiBindPromptHelp")}),children:(0,i.jsx)(h.A,{mode:"multiple",showSearch:!0,tagRender:Q,placeholder:"选择提示词",options:K.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.A.Item,{name:"processingType",label:r("roles.processingType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,i.jsx)(h.A,{options:[{label:r("roles.ruleFile"),value:"rule"},{label:r("roles.projectFactFile"),value:"project_fact"},{label:r("roles.tableFile"),value:"table"},{label:r("roles.drawingFile"),value:"drawing"},{label:r("roles.specificationFile"),value:"specification"},{label:r("roles.reference"),value:"reference"}]})}),(0,i.jsx)(a.A.Item,{name:"resourceIds",label:r("roles.bindFile"),style:{marginBottom:0},help:(0,i.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:r("roles.multiBindFileHelp")}),children:(0,i.jsx)(h.A,{mode:"multiple",showSearch:!0,filterOption:!1,loading:R,onSearch:e=>{ev(e)},onFocus:()=>{ev("")},tagRender:Q,placeholder:"输入关键词搜索知识库文件",options:eb,optionLabelProp:"value"})})]})})}})]})}),(0,i.jsx)(f.A,{title:r("roles.configEditor"),open:Z,onClose:()=>$(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,i.jsx)(x.Ay,{type:"primary",onClick:()=>{ey()},children:r("common.save")}),children:(0,i.jsxs)(a.A,{form:b,layout:"vertical",children:[(0,i.jsx)(a.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(u.A,{})}),(0,i.jsxs)(j.A,{gutter:16,children:[(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(a.A.Item,{name:"name",label:r("roles.configName"),rules:[{required:!0}],children:(0,i.jsx)(u.A,{})})}),(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(a.A.Item,{name:"description",label:r("roles.configDescription"),children:(0,i.jsx)(u.A,{})})})]}),(0,i.jsx)(A.A,{destroyInactiveTabPane:!1,items:[{key:"file",label:"文件角色 (".concat(ed.length,")"),children:(0,i.jsx)(a.A.List,{name:"fileRoles",children:(e,l)=>{let{add:s,remove:n}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0===e.length&&(0,i.jsx)(d.A,{description:"暂未添加文件角色"}),e.map((e,l)=>(0,i.jsxs)(p.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsxs)("div",{style:{position:"absolute",top:-10,left:12,background:"#1677ff",color:"#fff",fontSize:11,fontWeight:700,padding:"1px 8px",borderRadius:10},children:["#",l+1]}),(0,i.jsx)(x.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(_.A,{}),onClick:()=>n(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsxs)(j.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,i.jsx)(g.A,{flex:"auto",children:(0,i.jsx)(a.A.Item,{name:[e.name,"roleId"],label:"文件角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(h.A,{placeholder:"选择文件角色",size:"small",options:ex.map(e=>{var l;return{label:"".concat(e.name," (").concat(r(L[null!=(l=e.processingType)?l:""]||"roles.reference"),")"),value:e.id}})})})}),(0,i.jsx)(g.A,{style:{width:90},children:(0,i.jsx)(a.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(u.A,{type:"number",size:"small"})})})]})]},e.key)),(0,i.jsx)(x.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>s({order:e.length}),children:r("roles.addRole")})]})}})},{key:"prompt",label:"提示词角色 (".concat(em.length,")"),children:(0,i.jsx)(a.A.List,{name:"promptRoles",children:(e,l)=>{let{add:s,remove:n}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0===e.length&&(0,i.jsx)(d.A,{description:"暂未添加提示词角色"}),e.map((e,l)=>(0,i.jsxs)(p.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsxs)("div",{style:{position:"absolute",top:-10,left:12,background:"#722ed1",color:"#fff",fontSize:11,fontWeight:700,padding:"1px 8px",borderRadius:10},children:["#",l+1]}),(0,i.jsx)(x.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(_.A,{}),onClick:()=>n(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsxs)(j.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,i.jsx)(g.A,{flex:"auto",children:(0,i.jsx)(a.A.Item,{name:[e.name,"roleId"],label:"提示词角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(h.A,{placeholder:"选择提示词角色",size:"small",options:em.map(e=>{var l;return{label:"".concat(e.name," (").concat(r(U[null!=(l=e.executionType)?l:""]||"roles.reference"),")"),value:e.id}})})})}),(0,i.jsx)(g.A,{style:{width:90},children:(0,i.jsx)(a.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(u.A,{type:"number",size:"small"})})})]})]},e.key)),(0,i.jsx)(x.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>s({order:e.length}),children:r("roles.addRole")})]})}})}]})]})})]})}}},e=>{e.O(0,[433,787,576,195,455,909,636,593,792],()=>e(e.s=23507)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{16403:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return s(19562)}])},19562:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>ei});var r=s(65321),n=s(97109),i=s(7576),l=s(35292),a=s(17807),o=s(63455),c=s(11702),d=s(88762),u=s(85114),p=s(68787),m=s(84253),h=s(38332),x=s(26171),g=s(33442),f=s(85493),v=s(34052),w=s(9730),j=s(42700),y=s(58569),A=s(76506),k=s(2256),S=s(38770),I=s(57271),b=s(23216),_=s(16285),C=s(26619),z=s(8263),D=s(8579),B=s(75548),T=s(7851),M=s(84742),E=s(29071),P=s(63552),F=s(26631),R=s(76830),G=s(83914),L=s(58209),W=s(54746),O=s(71330),N=s(64068),H=s(93051),q=s(38762),K=s(64629),U=s(67547),V=s(99811),X=s(6578),Q=s(79059);let{TextArea:J}=i.A,{Paragraph:Y,Text:Z}=l.A,$=null;function ee(){null==$||$.listeners.forEach(e=>e())}let et={role_binding:(0,r.jsx)(b.A,{}),context_recall:(0,r.jsx)(_.A,{}),knowledge_retrieval:(0,r.jsx)(C.A,{}),file_understanding:(0,r.jsx)(z.A,{}),fact_extraction:(0,r.jsx)(_.A,{}),chapter_generation:(0,r.jsx)(D.A,{}),asset_generation:(0,r.jsx)(B.A,{}),validation:(0,r.jsx)(T.A,{}),formatting:(0,r.jsx)(M.A,{}),llm_review:(0,r.jsx)(E.A,{}),export_ready:(0,r.jsx)(P.A,{}),reference:(0,r.jsx)(B.A,{})},es={施工组织设计:(0,r.jsx)(T.A,{}),投标文件:(0,r.jsx)(P.A,{}),技术方案:(0,r.jsx)(_.A,{}),报告:(0,r.jsx)(F.A,{}),自定义:(0,r.jsx)(D.A,{})};function er(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}let en={role_binding:"角色配置绑定",context_recall:"上下文召回",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",asset_generation:"多模态资源生成",validation:"规则校验",formatting:"格式化排版",llm_review:"LLM 审查优化",export_ready:"导出就绪",reference:"参考资源处理"};function ei(){let e=(0,Q.Vr)(),{message:t}=a.A.useApp(),[s]=o.A.useForm(),l=(0,n.useRef)(null),[Y,ei]=(0,n.useState)([]),[el,ea]=(0,n.useState)("construction-organization-design"),[eo,ec]=(0,n.useState)([]),[ed,eu]=(0,n.useState)([]),[ep,em]=(0,n.useState)([]),[eh,ex]=(0,n.useState)(!1),[eg,ef]=(0,n.useState)(!0),[ev,ew]=(0,n.useState)(!1),[ej,ey]=(0,n.useState)(null),[eA,ek]=(0,n.useState)(""),[eS,eI]=(0,n.useState)([]),[eb,e_]=(0,n.useState)(null),[eC,ez]=(0,n.useState)(null),[eD,eB]=(0,n.useState)(null),[eT,eM]=(0,n.useState)(!1),[eE,eP]=(0,n.useState)({}),eF=eo.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),eR=er(Object.values(s.getFieldValue("fileBindingGroups")||{}).flat()),eG=er([...eR,...ep.map(e=>e.relativePath)]).map(e=>{let t=ep.find(t=>t.relativePath===e);return{label:(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8},children:[(0,r.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t&&(0,r.jsx)(c.A,{style:{margin:0},children:t.status})]}),value:e}}),[eL,eW]=(0,n.useState)([]),[eO,eN]=(0,n.useState)(null),[eH,eq]=(0,n.useState)("templates"),[eK,eU]=(0,n.useState)(!1),[eV,eX]=(0,n.useState)("workflow"),eQ=(0,n.useRef)(null),eJ=async()=>{try{eI((await (0,X.cQ)()).documents)}catch(e){eI([])}};(0,n.useEffect)(()=>{let e=()=>{$&&(eW($.flowSteps),eN($.activeFlowKey),ew($.loading),$.documentId&&e_($.documentId),$.draft&&ey($.draft),void 0!==$.content&&ek($.content))},t=$;return null==t||t.listeners.add(e),e(),()=>{null==t||t.listeners.delete(e)}},[]),(0,n.useEffect)(()=>{ef(!0),Promise.all([(0,X.Dl)().then(e=>{var t,s;ei(e.templates),ea(null!=(s=null==(t=e.templates[0])?void 0:t.id)?s:"construction-organization-design")}),(0,X.lv)().then(e=>{ec(e.roles),eu(e.configs)}),eJ()]).catch(()=>t.error(e("common.error"))).finally(()=>ef(!1))},[t,e]),(0,n.useEffect)(()=>{if(0===eS.length)return;let e=localStorage.getItem("activeGenDocId");if(!e)return;if(!eS.find(t=>t.id===e&&"generating"===t.status))return void localStorage.removeItem("activeGenDocId");let t=setInterval(()=>{(async()=>{try{let{document:s}=await (0,X.v7)(e);await eJ(),"generating"!==s.status&&(localStorage.removeItem("activeGenDocId"),clearInterval(t))}catch(e){clearInterval(t)}})()},3e3);return()=>clearInterval(t)},[eS]);let eY=(0,n.useMemo)(()=>Y.find(e=>e.id===el),[Y,el]),eZ=ed.map(e=>({label:e.name,value:e.id})),e$=Math.max(0,eL.findIndex(e=>e.key===eO)),e0=e=>{ea(e),e_(null),ey(null),ek(""),eX("workflow"),eU(!0),eq("drafts")},e1=async s=>{e_(s.id),ea(s.templateId);let r=e8(s.status);if(r||"failed"===s.status){tc.current=!0,ey(null),ek(""),ew(r),eX("workflow"),eU(!0);try{let{document:e}=await (0,X.v7)(s.id);e4(e),e8(e.status)?e9(e.id):await eJ()}catch(e){e4(s)}return}eX("editor"),eW([]),eN(null);try{let{document:e}=await (0,X.v7)(s.id);ey(e.draft||null),ek(e.editedMarkdown||e.markdown)}catch(s){t.error(e("common.error"))}eU(!0)},e2=e=>e.map((e,t)=>({key:"sub-".concat(t),title:e,status:"wait"})),e6=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eY,s=ed.find(e=>e.id===(null==t?void 0:t.projectRoleConfigId)),n=((null==s?void 0:s.fileRoles)||[]).map(e=>{var t;return(null==(t=eo.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),i=((null==s?void 0:s.promptRoles)||[]).map(e=>{var t;return(null==(t=eo.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),l=(null==t?void 0:t.chapters.flatMap(e=>e.requiredFacts))||[],a=(null==t?void 0:t.chapters.map(e=>e.title))||[],o=i.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,r.jsx)(F.A,{}),subSteps:e2(["读取模板参数","后台自动生成文档规范","创建后台生成任务"])},{key:"role_binding",title:"动态角色配置绑定",description:"绑定 ".concat(n.length," 个文件角色、").concat(i.length," 个提示词角色"),status:"wait",icon:(0,r.jsx)(b.A,{}),subSteps:e2([...n.length?n.map(e=>"文件角色:".concat(e)):["没有文件角色,使用模板绑定文件"],...i.length?i.map(e=>"提示词角色:".concat(e)):["没有提示词角色,使用默认生成策略"]].slice(0,10))},{key:"context_recall",title:"短期/长期上下文召回",description:"从项目记忆中召回用户偏好、历史纠偏和已生成文档摘要,并注入生成提示词",status:"wait",icon:(0,r.jsx)(_.A,{}),subSteps:e2(["召回相关项目记忆","注入章节生成提示词","生成完成后沉淀新记忆"])},{key:"knowledge_retrieval",title:"知识库证据检索",description:"按 ".concat(a.length||"动态"," 个模板章节检索文本、文档、表格、图片、图纸和附件"),status:"wait",icon:(0,r.jsx)(C.A,{}),subSteps:e2(a.length?a.slice(0,10).map(e=>"检索章节:".concat(e)):["按后台自动规范检索证据"])},{key:"file_understanding",title:"多类型文件理解",description:"按文件角色处理文本、PDF/Word、表格、图片、图纸和附件",status:"wait",icon:(0,r.jsx)(z.A,{}),subSteps:e2(["识别文件类型和角色","构建结构化资源证据包","必要时调用多模态文件理解"])},{key:"fact_extraction",title:"动态 schema 事实抽取",description:"按 ".concat(l.length," 个规范/章节事实字段抽取并检测冲突"),status:"wait",icon:(0,r.jsx)(_.A,{}),subSteps:e2(l.length?l.slice(0,10).map(e=>"抽取事实:".concat(e)):["抽取模板要求的事实","合并来源和角色","检测事实冲突"])},{key:"chapter_generation",title:"章节生成",description:a.length?"按 ".concat(a.length," 个模板章节逐章生成"):"按后台自动规范生成",status:"wait",icon:(0,r.jsx)(D.A,{}),subSteps:e2(a.length?a.slice(0,10).map(e=>"生成:".concat(e)):["构造动态章节提示词","等待 LLM 生成","整理章节证据"])},...o?[{key:"asset_generation",title:"生成资源处理",description:"根据资源/图片提示词生成或登记本地资源",status:"wait",icon:(0,r.jsx)(B.A,{}),subSteps:e2(["生成资源提示词","保存到 generatedDocuments/assets","登记资源元数据"])}]:[],{key:"validation",title:"后台规范与门禁校验",description:"执行后台自动规范、资料满足率和导出门禁校验",status:"wait",icon:(0,r.jsx)(T.A,{}),subSteps:e2(["检查项目资料摘要","检查模板角色满足率","检查章节证据","检查导出门禁"])},{key:"formatting",title:e("documents.flowFormatting"),description:"整理标题、表格、图片、附件引用和正式 Markdown",status:"wait",icon:(0,r.jsx)(M.A,{}),subSteps:e2(["整理标题层级","整理多类型资源引用","生成正式 Markdown"])},{key:"llm_review",title:"LLM 审查优化",description:"再次使用动态 schema、角色和结构化证据审查优化初稿",status:"wait",icon:(0,r.jsx)(E.A,{}),subSteps:e2(["构造审查提示词","检查事实来源和冲突","回填优化后的 Markdown"])},{key:"export_ready",title:"导出就绪",description:"确认 Markdown/HTML/DOCX/PDF 可导出",status:"wait",icon:(0,r.jsx)(P.A,{}),subSteps:e2(["生成导出检查清单","确认阻断项","准备导出格式"])},{key:"done",title:e("documents.flowDone"),description:e("documents.flowDoneDesc"),status:"wait",icon:(0,r.jsx)(R.A,{}),subSteps:e2(["展示生成结果","允许编辑正文","允许导出文件"])}]},e8=e=>"completed"!==e&&"warning"!==e&&"failed"!==e,e3=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ev;(null==$?void 0:$.loading)&&($.flowSteps=e,$.activeFlowKey=t,$.loading=s,ee())},e5=(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 s=e.subSteps.findIndex(e=>"wait"===e.status);return e.subSteps.map((e,t)=>t<s||-1===s?{...e,status:"finish"}:t===s?{...e,status:"process"}:e)},e7=e=>{var t,s,n,i,l;let a=Y.find(t=>t.id===e.templateId)||eY,o=e.executionStages||(null==(t=e.draft)?void 0:t.executionStages)||[];if(o.length>0){let t=o.map((e,t)=>{var s;let n,i="failed"===(n=e.status)?"error":"fallback"===n?"warning":"finish";return{key:"".concat(e.type,"-").concat(t),title:e.title||e.type,subtitle:e.subtitle||e.roleName||e.roleId,description:e.message||"",status:i,icon:"role_binding"===(s=e.type)?(0,r.jsx)(b.A,{}):"knowledge_retrieval"===s?(0,r.jsx)(C.A,{}):"context_recall"===s?(0,r.jsx)(_.A,{}):"file_understanding"===s?(0,r.jsx)(z.A,{}):"fact_extraction"===s?(0,r.jsx)(_.A,{}):"chapter_generation"===s?(0,r.jsx)(D.A,{}):"llm_review"===s?(0,r.jsx)(E.A,{}):"validation"===s?(0,r.jsx)(T.A,{}):"formatting"===s?(0,r.jsx)(M.A,{}):"export_ready"===s?(0,r.jsx)(P.A,{}):(0,r.jsx)(F.A,{}),subSteps:[{key:"stage-".concat(t),title:e.promptName?"提示词:".concat(e.promptName):e.promptId?"提示词:".concat(e.promptId):e.roleId,status:i}]}});"generating"===e.status&&t.length>0&&(null==(s=t.at(-1))?void 0:s.status)==="finish"&&(t[t.length-1]={...t[t.length-1],status:"process"});let a="generating"===e.status?(null==(n=t.at(-1))?void 0:n.key)||"prepare":"failed"===e.status?(null==(i=t.find(e=>"error"===e.status))?void 0:i.key)||(null==(l=t.at(-1))?void 0:l.key)||"prepare":"done";return{steps:t,activeKey:a}}return{steps:e6(a).map(t=>"prepare"===t.key?{...t,status:"generating"===e.status?"process":"finish",subSteps:e5(t,"generating"===e.status?"process":"finish")}:t),activeKey:"generating"===e.status?"prepare":"done"}},e4=e=>{let{steps:t,activeKey:s}=e7(e);eW(t),eN(s),ew(e8(e.status)),e3(t,s,e8(e.status)),"failed"===e.status&&eX("workflow"),("completed"===e.status||"warning"===e.status)&&e.draft&&(ey(e.draft),ek(e.editedMarkdown||e.markdown),eX("editor"),eW([]),eN(null))},e9=e=>{eQ.current&&clearInterval(eQ.current),eQ.current=setInterval(()=>{(async()=>{try{let{document:t}=await (0,X.v7)(e);e4(t),await eJ(),e8(t.status)||(eQ.current&&clearInterval(eQ.current),eQ.current=null,localStorage.removeItem("activeGenDocId"))}catch(e){}})()},2e3)};(0,n.useEffect)(()=>{if(!ev||!eO)return;let e=window.setInterval(()=>eW(e=>{let t=e.map(e=>{if(e.key!==eO||"process"!==e.status)return e;let t=e.subSteps.findIndex(e=>"process"===e.status),s=t<0?0:Math.min(t+1,e.subSteps.length-1);return{...e,subSteps:e.subSteps.map((e,t)=>t<s?{...e,status:"finish"}:t===s?{...e,status:"process"}:{...e,status:"wait"})}});return e3(t,eO),t}),1400);return()=>window.clearInterval(e)},[eO,ev]);let te=async e=>{ex(!0);try{let t=await (0,X.nU)({query:e,limit:120,includeContent:!!e.trim()});em(t.files)}catch(e){t.error("知识库文件检索失败")}finally{ex(!1)}},tt=e=>{let t=null!=e?e:{id:"tpl-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,chapters:[],fileBindings:[]};s.resetFields(),s.setFieldsValue({...t,fileBindingGroups:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.reduce((e,t)=>(t.roleId&&t.filePath&&(e[t.roleId]=er([...e[t.roleId]||[],t.filePath])),e),{})}(t.fileBindings)}),te(""),eM(!0)},ts=async()=>{try{let r=await s.validateFields(),n=r.fileBindingGroups||{},i=Object.entries(n).flatMap(e=>{let[t,s]=e;return er(s||[]).map(e=>({roleId:t,filePath:e}))}),{fileBindingGroups:l,...a}=r,o={...a,chapters:[],fileBindings:i},c=await (0,X.l2)(o);ei(c.templates),ea(c.template.id),eM(!1),await eJ(),t.success(e("common.success"))}catch(e){e instanceof Error&&t.error(e.message)}},tr=async s=>{try{let r=await (0,X.bV)(s);ei(r.templates),ea(r.template.id),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}},tn=async s=>{try{var r,n;let i=await (0,X.h0)(s);ei(i.templates),ea(null!=(n=null==(r=i.templates[0])?void 0:r.id)?n:""),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}},ti=async e=>{try{let{validation:s}=await (0,X.SM)(e);eP(t=>({...t,[e]:s}));let r=s.issues.filter(e=>"error"===e.level);if(ea(e),r.length>0)return void t.warning("模板运行前检查未通过,请先处理阻断项");if(s.issues.length>0)return void t.warning("模板存在警告,可在检查面板确认后继续运行");e0(e)}catch(e){t.error(e instanceof Error?e.message:"模板运行前检查失败")}},tl=async s=>{try{await (0,X.QG)(s),eb===s&&(e_(null),ey(null),ek("")),await eJ(),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}},ta=async e=>{for(;;){let{document:t}=await (0,X.v7)(e);if(e4(t),("completed"===t.status||"warning"===t.status)&&t.draft)return t;if("failed"===t.status)throw Error(t.error||"生成失败");await new Promise(e=>window.setTimeout(e,1500))}},to=async()=>{if(!el)return;if(null==$?void 0:$.loading){eW($.flowSteps),eN($.activeFlowKey),ew(!0);return}ew(!0);let s=e6(Y.find(e=>e.id===el)||eY).slice(0,1),r=(0,X.OX)({templateId:el});$={id:Date.now(),templateId:el,loading:!0,flowSteps:s,activeFlowKey:"prepare",promise:r,listeners:new Set},eW(s),eN("prepare");let n=[];try{let s=await r;s.documentId&&(localStorage.setItem("activeGenDocId",s.documentId),e_(s.documentId),(null==$?void 0:$.promise)===r&&($.documentId=s.documentId)),await eJ();let i=s.documentId?await ta(s.documentId):void 0,a=s.draft||(null==i?void 0:i.draft);if(!a)throw Error("生成结果为空");(s.documentId||(null==i?void 0:i.id))&&e_(s.documentId||i.id),n.forEach(e=>window.clearTimeout(e)),ey(a),ek((null==i?void 0:i.editedMarkdown)||(null==i?void 0:i.markdown)||a.markdown),(null==$?void 0:$.promise)===r&&($.draft=a,$.content=(null==i?void 0:i.editedMarkdown)||(null==i?void 0:i.markdown)||a.markdown);let o=i||{id:s.documentId||"draft-".concat(Date.now()),templateId:el,title:a.title,requirement:a.requirement,markdown:a.markdown,status:a.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!a.exportGate.passed?"warning":"completed",draft:a,executionStages:a.executionStages,assets:a.assets||[],createdAt:a.generatedAt,updatedAt:Date.now()},{steps:c}=e7(o);eW(c),e3(c,"done",!1),eN("done"),(null==$?void 0:$.promise)===r&&($.activeFlowKey="done",$.loading=!1,ee()),localStorage.removeItem("activeGenDocId"),await eJ(),t.success(e("common.success")),window.setTimeout(()=>{var e;return null==(e=l.current)?void 0:e.scrollIntoView({behavior:"smooth",block:"start"})},200)}catch(n){localStorage.removeItem("activeGenDocId");let s=n instanceof Error?n.message:e("common.error");eW(e=>{let t=e.map(e=>"process"===e.status?{...e,status:"error",description:s,subSteps:e5(e,"error")}:e);return e3(t,eO,!1),t}),(null==$?void 0:$.promise)===r&&($.loading=!1,$.error=s,ee()),t.error(s)}finally{n.forEach(e=>window.clearTimeout(e)),ew(!1),(null==$?void 0:$.promise)===r&&($.loading=!1,ee())}},tc=(0,n.useRef)(!1),td=async s=>{(null==$?void 0:$.loading)&&($.loading=!1,$.error="用户中止",ee(),$=null,ew(!1)),localStorage.removeItem("activeGenDocId"),eQ.current&&(clearInterval(eQ.current),eQ.current=null);try{await (0,X.r)(s.id),await eJ(),eb===s.id&&(e_(null),ey(null),ek("")),t.success("已中止生成任务")}catch(s){t.error(e("common.error"))}};(0,n.useEffect)(()=>{eK&&"workflow"===eV&&!tc.current&&!(null==$?void 0:$.loading)&&(null==eY?void 0:eY.projectRoleConfigId)&&(tc.current=!0,window.setTimeout(()=>{to()},300)),eK||(tc.current=!1)},[eK,eV]);let tu=async s=>{if(ej){ez(s);try{let e=eb?{documentId:eb,title:ej.title,format:s,enforceGate:!1,exportGate:ej.exportGate}:{title:ej.title,markdown:eA,format:s,enforceGate:!1,exportGate:ej.exportGate,useClientMarkdown:!0},t=await (0,X.UE)(e);((e,t,s)=>{let r=new Blob([e],{type:s}),n=URL.createObjectURL(r),i=document.createElement("a");i.href=n,i.download=t,i.target="_self",i.rel="noopener",i.style.display="none",document.body.appendChild(i),i.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),i.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)})(t,"".concat(ej.title,".").concat("markdown"===s?"md":s),{markdown:"text/markdown;charset=utf-8",html:"text/html;charset=utf-8",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}[s])}catch(s){t.error(s instanceof Error?s.message:e("common.error"))}finally{ez(null)}}},tp=async()=>{if(ej)try{if(eb)await (0,X.a6)(eb,{editedMarkdown:eA,markdown:eA});else{let e=await (0,X.Af)({...ej,markdown:eA});ey(e.draft)}await eJ(),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}},tm=async s=>{if(ej){eB(s.id);try{var r,n;let i=await (0,X.R1)({templateId:ej.templateId,chapterId:s.id,documentId:eb||void 0,currentMarkdown:eA,existingFacts:null==(r=ej.structuredFacts)?void 0:r.map(e=>e.value)});ey({...ej,chapters:ej.chapters.map(e=>e.id===s.id?i.chapter:e)}),n=i.chapter,ek(e=>e.includes(s.content)?e.replace(s.content,n.content):"".concat(e,"\n\n").concat(n.content)),t.success(e("common.success"))}catch(s){t.error(e("common.error"))}finally{eB(null)}}};if(eg)return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsx)(d.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,r.jsx)(d.A,{active:!0,paragraph:{rows:2}}),(0,r.jsx)(d.A,{active:!0,paragraph:{rows:8}})]});let th="workflow"===eV?"工作流:".concat((null==eY?void 0:eY.name)||"选择模板"):"编辑:".concat((null==ej?void 0:ej.title)||(null==eY?void 0:eY.outputTitle)||"文档");return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"pageTitle",children:e("documents.title")}),(0,r.jsx)("p",{className:"pageDesc",children:e("documents.description")})]}),(0,r.jsx)(u.Ay,{type:"primary",icon:(0,r.jsx)(W.A,{}),onClick:()=>tt(),children:e("documents.newTemplate")})]}),(0,r.jsx)(p.A,{size:"small",tabList:[{key:"templates",label:"模板库 (".concat(Y.length,")")},{key:"drafts",label:"生成记录 (".concat(eS.length,")")}],activeTabKey:eH,onTabChange:eq,children:"templates"===eH?0===Y.length?(0,r.jsx)(m.A,{description:e("common.noData")}):(0,r.jsx)(h.A,{dataSource:Y,renderItem:(t,s)=>(0,r.jsx)(h.A.Item,{style:{cursor:"pointer",padding:"10px 0"},actions:[(0,r.jsx)(u.Ay,{size:"small",icon:(0,r.jsx)(O.A,{}),onClick:e=>{e.stopPropagation(),tt(t)},children:"配置"},"cfg"),(0,r.jsx)(u.Ay,{size:"small",type:"primary",icon:(0,r.jsx)(N.A,{}),onClick:e=>{e.stopPropagation(),ti(t.id)},children:"运行"},"run"),(0,r.jsx)(u.Ay,{size:"small",icon:(0,r.jsx)(H.A,{}),onClick:e=>{e.stopPropagation(),tr(t.id)}},"copy"),(0,r.jsx)(x.A,{title:e("documents.deleteTemplateConfirm"),onConfirm:e=>{null==e||e.stopPropagation(),tn(t.id)},children:(0,r.jsx)(u.Ay,{size:"small",danger:!0,icon:(0,r.jsx)(L.A,{}),onClick:e=>e.stopPropagation()})},"del")],onClick:()=>ea(t.id),children:(0,r.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[function(e,t){let s=es[e]||(0,r.jsx)(F.A,{});return(0,r.jsx)("span",{style:{color:t?"var(--colorAccent)":"var(--colorTextSecondary)",fontSize:16,marginTop:2,flexShrink:0},children:s})}(t.category,el===t.id),(0,r.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,r.jsx)("span",{style:{fontWeight:el===t.id?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),el===t.id&&(0,r.jsx)(c.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"当前"}),(0,r.jsx)(c.A,{style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:t.category}),eE[t.id]&&(0,r.jsxs)(c.A,{color:eE[t.id].issues.some(e=>"error"===e.level)?"error":eE[t.id].issues.length?"warning":"success",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:["检查 ",eE[t.id].fileDiagnostics.length," 文件 / ",eE[t.id].promptDiagnostics.length," 提示词"]})]}),t.description&&(0,r.jsx)(Z,{type:"secondary",style:{fontSize:12,lineHeight:"18px"},children:t.description}),eE[t.id]&&(0,r.jsx)("div",{onClick:e=>e.stopPropagation(),style:{marginTop:8,padding:10,border:"1px solid ".concat(eE[t.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBorder)":eE[t.id].issues.length?"var(--colorWarningBorder)":"var(--colorSuccessBorder)"),borderRadius:10,background:eE[t.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBg)":eE[t.id].issues.length?"var(--colorWarningBg)":"var(--colorSuccessBg)"},children:(0,r.jsxs)(g.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,r.jsxs)(g.A,{wrap:!0,children:[(0,r.jsx)(Z,{strong:!0,children:eE[t.id].issues.some(e=>"error"===e.level)?"运行前检查未通过":eE[t.id].issues.length?"运行前检查存在警告":"运行前检查通过"}),(0,r.jsxs)(c.A,{color:"blue",children:["文件角色 ",eE[t.id].fileDiagnostics.length]}),(0,r.jsxs)(c.A,{color:"purple",children:["提示词角色 ",eE[t.id].promptDiagnostics.length]})]}),eE[t.id].issues.length>0?eE[t.id].issues.map(e=>(0,r.jsx)(f.A,{type:"error"===e.level?"error":"warning",message:e.message,showIcon:!0},e.message)):(0,r.jsx)(f.A,{type:"success",message:"文件角色、提示词角色和后台自动规范检查通过,可以运行。",showIcon:!0}),!eE[t.id].issues.some(e=>"error"===e.level)&&eE[t.id].issues.length>0&&(0,r.jsx)("div",{children:(0,r.jsx)(u.Ay,{size:"small",type:"primary",icon:(0,r.jsx)(N.A,{}),onClick:()=>e0(t.id),children:"忽略警告并继续运行"})})]})})]})]})})}):0===eS.length?(0,r.jsx)(m.A,{description:e("common.noData")}):(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:eS.slice(0,15).map((e,t)=>{var s,n,i;let l,a;return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,padding:"10px 12px",border:"1px solid var(--colorBorderSecondary)",borderRadius:10,cursor:"pointer",background:eb===e.id?"var(--colorFillAlter)":void 0,minWidth:0},onClick:()=>{e1(e)},children:["completed"===e.status?(0,r.jsx)(M.A,{style:{fontSize:18,color:"var(--colorOk)",flexShrink:0,marginTop:2}}):"failed"===e.status?(0,r.jsx)(q.A,{style:{fontSize:18,color:"var(--colorDanger)",flexShrink:0,marginTop:2}}):"warning"===e.status?(0,r.jsx)(T.A,{style:{fontSize:18,color:"var(--colorWarning)",flexShrink:0,marginTop:2}}):(0,r.jsx)(K.A,{spin:!0,style:{fontSize:18,color:"#1677ff",flexShrink:0,marginTop:2}}),(0,r.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,r.jsx)("div",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:3},children:e.title}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px 10px",color:"var(--colorTextSecondary)",fontSize:11},children:[(0,r.jsx)("span",{children:new Date(e.updatedAt).toLocaleString()}),(0,r.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 s=Math.floor(t/60),r=t%60;if(s<60)return r?"".concat(s," 分 ").concat(r," 秒"):"".concat(s," 分");let n=Math.floor(s/60),i=s%60;return i?"".concat(n," 小时 ").concat(i," 分"):"".concat(n," 小时")})(e)]})]}),("warning"===e.status||"failed"===e.status)&&(0,r.jsx)("div",{style:{marginTop:3,color:"failed"===e.status?"var(--colorError)":"var(--colorWarning)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(null==(s=e.warningIssues)?void 0:s[0])||(null==(i=e.draft)||null==(n=i.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message)||"需复核"})]}),(0,r.jsxs)(g.A,{size:4,align:"center",children:[(0,r.jsx)(c.A,{color:"completed"===(l=e.status)?"success":"warning"===l?"warning":"failed"===l?"error":"processing",style:{margin:0,fontSize:10,lineHeight:"18px"},children:"completed"===(a=e.status)?"已完成":"warning"===a?"需复核":"failed"===a?"失败":"生成中"}),(0,r.jsxs)(c.A,{style:{margin:0,fontSize:10,lineHeight:"18px"},children:["#",t+1]}),(0,r.jsx)(x.A,{title:"确认删除?",onConfirm:t=>{null==t||t.stopPropagation(),tl(e.id)},children:(0,r.jsx)(u.Ay,{size:"small",danger:!0,icon:(0,r.jsx)(L.A,{}),onClick:e=>e.stopPropagation()})}),e8(e.status)&&(0,r.jsx)(x.A,{title:"确定中止此生成任务?",onConfirm:t=>{null==t||t.stopPropagation(),td(e)},children:(0,r.jsx)(u.Ay,{size:"small",danger:!0,onClick:e=>e.stopPropagation(),children:"中止"})}),(0,r.jsx)(u.Ay,{size:"small",type:"primary",icon:e8(e.status)?(0,r.jsx)(K.A,{spin:!0}):(0,r.jsx)(N.A,{}),onClick:t=>{t.stopPropagation(),e1(e)},children:"打开"})]})]},e.id)})})}),(0,r.jsx)(v.A,{title:th,open:eK,onClose:()=>{eU(!1),eQ.current&&(clearInterval(eQ.current),eQ.current=null)},width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:ej?(0,r.jsxs)(g.A,{wrap:!0,children:[(0,r.jsx)(u.Ay,{icon:(0,r.jsx)(U.A,{}),onClick:()=>{tp()},children:e("documents.saveDraft")}),(0,r.jsx)(u.Ay,{icon:(0,r.jsx)(R.A,{}),loading:"markdown"===eC,onClick:()=>{tu("markdown")},children:"MD"}),(0,r.jsx)(u.Ay,{loading:"html"===eC,onClick:()=>{tu("html")},children:"HTML"}),(0,r.jsx)(u.Ay,{loading:"docx"===eC,onClick:()=>{tu("docx")},children:"DOCX"}),(0,r.jsx)(u.Ay,{type:"primary",loading:"pdf"===eC,onClick:()=>{tu("pdf")},children:"PDF"})]}):ev&&"workflow"===eV?(0,r.jsx)(u.Ay,{danger:!0,onClick:()=>{(async()=>{eb&&await (0,X.r)(eb).catch(()=>void 0),$&&($.loading=!1,$.error="用户中止",ee(),$=null),localStorage.removeItem("activeGenDocId"),eQ.current&&(clearInterval(eQ.current),eQ.current=null),ew(!1),eW([]),eN(null),eU(!1),await eJ(),t.info("已中止生成任务")})()},children:"中止任务"}):void 0,children:(0,r.jsxs)(g.A,{direction:"vertical",style:{width:"100%"},size:"middle",children:["workflow"===eV&&eL.length>0&&(0,r.jsx)(w.A,{direction:"vertical",size:"small",current:e$,items:eL.map(e=>{let t;return{title:e.title,description:(0,r.jsxs)("div",{children:[e.subtitle&&(0,r.jsx)("div",{style:{marginBottom:4},children:(0,r.jsx)(c.A,{children:e.subtitle})}),(0,r.jsx)("div",{children:e.description}),(0,r.jsx)("div",{style:{marginTop:4},children:e.subSteps.map(e=>{var t;return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:12,color:"var(--colorTextSecondary)"},children:["process"===(t=e.status)?(0,r.jsx)(G.A,{}):"finish"===t?(0,r.jsx)(M.A,{}):"warning"===t?(0,r.jsx)(T.A,{style:{color:"var(--colorWarning)"}}):"error"===t?(0,r.jsx)(L.A,{}):(0,r.jsx)("span",{style:{display:"inline-block",height:6,width:6,borderRadius:"50%",background:"var(--colorTextTertiary)"}}),(0,r.jsx)("span",{children:e.title})]},e.key)})})]}),status:"warning"===(t=e.status)?"finish":t,icon:"process"===e.status?(0,r.jsx)(G.A,{}):"warning"===e.status?(0,r.jsx)(T.A,{style:{color:"var(--colorWarning)"}}):e.icon}})}),"workflow"===eV&&ev&&0===eL.length&&(0,r.jsx)("div",{style:{textAlign:"center",padding:40},children:(0,r.jsx)(j.A,{tip:"正在准备生成…"})}),ej&&(0,r.jsx)("div",{ref:l,children:(0,r.jsx)(y.A,{items:[{key:"edit",label:e("documents.edit"),children:(0,r.jsx)(J,{rows:35,value:eA,onChange:e=>ek(e.target.value)})},{key:"chapters-facts",label:"章节与事实",children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[ej.chapters.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)(Z,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["章节 (",ej.chapters.length,")"]}),(0,r.jsx)(h.A,{size:"small",dataSource:ej.chapters,renderItem:e=>(0,r.jsx)(h.A.Item,{actions:[(0,r.jsx)(u.Ay,{size:"small",icon:(0,r.jsx)(V.A,{}),loading:eD===e.id,onClick:()=>{tm(e)},children:"重新生成"},"regen")],children:(0,r.jsx)(h.A.Item.Meta,{title:e.title,description:"证据: ".concat(e.evidence.length," \xb7 缺失: ").concat(e.missingFacts.length)})})})]}),ej.structuredFacts.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)(Z,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["结构化事实 (",ej.structuredFacts.length,")"]}),(0,r.jsx)(A.A,{size:"small",column:1,bordered:!0,children:ej.structuredFacts.map((e,t)=>(0,r.jsxs)(A.A.Item,{label:e.key,children:[(0,r.jsx)("span",{children:e.value}),(0,r.jsx)(c.A,{style:{marginLeft:8},children:e.confidence.toFixed(2)}),(0,r.jsx)(Z,{type:"secondary",style:{fontSize:11,marginLeft:8},children:e.sourceFile})]},t))})]})]})},{key:"sources-missing",label:"来源与缺失",children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)(Z,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["引用来源 (",ej.sources.length,")"]}),0===ej.sources.length?(0,r.jsx)(m.A,{description:"暂无"}):(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:ej.sources.map(e=>(0,r.jsxs)(c.A,{color:"blue",children:[e.filePath," (",e.count,")"]},e.filePath))})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)(Z,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["缺失项 (",ej.missingItems.length,")"]}),0===ej.missingItems.length?(0,r.jsx)(m.A,{description:"无缺失"}):(0,r.jsx)(h.A,{size:"small",dataSource:ej.missingItems,renderItem:e=>(0,r.jsx)(h.A.Item,{children:e})})]})]})},{key:"validation",label:"校验 (".concat(ej.validationIssues.length,")"),children:0===ej.validationIssues.length?(0,r.jsx)(m.A,{description:"校验通过"}):(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[ej.validationIssues.map(e=>(0,r.jsxs)("div",{style:{border:"1px solid var(--colorBorderSecondary)",borderRadius:8,padding:12},children:[(0,r.jsx)(c.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:e.level}),(0,r.jsx)("div",{style:{marginTop:6,whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.message}),e.suggestion&&(0,r.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))),ej.exportGate.checklist.length>0&&(0,r.jsxs)("div",{style:{marginTop:8},children:[(0,r.jsx)(Z,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:"导出门禁"}),(0,r.jsx)(h.A,{size:"small",dataSource:ej.exportGate.checklist,renderItem:e=>(0,r.jsxs)(h.A.Item,{children:[(0,r.jsx)(Z,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.label}),(0,r.jsx)(c.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})]})]})},{key:"stages",label:"执行阶段 (".concat(ej.executionStages.length,")"),children:(0,r.jsx)(h.A,{size:"small",dataSource:ej.executionStages,renderItem:e=>(0,r.jsxs)(h.A.Item,{children:[(0,r.jsx)(h.A.Item.Meta,{avatar:et[e.type]||(0,r.jsx)(F.A,{}),title:(0,r.jsx)(Z,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:"".concat(en[e.type]||e.type," \xb7 ").concat(e.roleId)}),description:(0,r.jsx)(Z,{type:"secondary",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})}),(0,r.jsx)(c.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})})}]})})]})}),(0,r.jsx)(v.A,{title:e("documents.templateEditor"),open:eT,onClose:()=>eM(!1),width:860,maskClosable:!1,styles:{body:{padding:20,overflow:"auto"},header:{borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,r.jsxs)(g.A,{children:[(0,r.jsx)(u.Ay,{onClick:()=>eM(!1),children:e("common.cancel")}),(0,r.jsx)(u.Ay,{type:"primary",onClick:()=>{ts()},children:e("common.save")})]}),children:(0,r.jsxs)(o.A,{form:s,layout:"vertical",requiredMark:"optional",children:[(0,r.jsxs)(k.A,{gutter:12,children:[(0,r.jsx)(o.A.Item,{name:"id",hidden:!0,children:(0,r.jsx)(i.A,{})}),(0,r.jsx)(S.A,{xs:24,md:8,children:(0,r.jsx)(o.A.Item,{name:"name",label:e("documents.templateName"),rules:[{required:!0}],children:(0,r.jsx)(i.A,{})})}),(0,r.jsx)(S.A,{xs:24,md:8,children:(0,r.jsx)(o.A.Item,{name:"category",label:e("documents.templateCategory"),children:(0,r.jsx)(i.A,{})})}),(0,r.jsx)(S.A,{xs:24,md:8,children:(0,r.jsx)(o.A.Item,{name:"outputTitle",label:e("documents.outputTitle"),children:(0,r.jsx)(i.A,{})})}),(0,r.jsx)(S.A,{xs:24,md:12,children:(0,r.jsx)(o.A.Item,{name:"description",label:e("documents.templateDescription"),children:(0,r.jsx)(i.A,{})})})]}),(0,r.jsx)(o.A.Item,{name:"projectRoleConfigId",label:e("documents.projectRoleConfig"),rules:[{required:!0,message:e("documents.projectRoleConfigRequired")}],children:(0,r.jsx)(I.A,{showSearch:!0,placeholder:e("documents.projectRoleConfigRequired"),options:eZ})}),(0,r.jsxs)("div",{style:{marginBottom:16},children:[(0,r.jsxs)(g.A,{style:{width:"100%",justifyContent:"space-between",marginBottom:8},children:[(0,r.jsx)(Z,{strong:!0,children:"项目文件绑定"}),(0,r.jsx)(c.A,{color:"blue",children:"按文件角色多选"})]}),(0,r.jsx)(f.A,{type:"info",showIcon:!0,style:{marginBottom:12},message:"每个文件角色下多选对应的知识库文件。用户换项目时,只需要在这里重新选择对应项目资料。"}),0===eF.length?(0,r.jsx)(m.A,{image:m.A.PRESENTED_IMAGE_SIMPLE,description:"暂无可用文件角色"}):eF.map(e=>(0,r.jsx)(p.A,{size:"small",style:{marginBottom:12},title:(0,r.jsxs)(g.A,{children:[(0,r.jsx)(Z,{children:e.label}),(0,r.jsx)(c.A,{children:e.value})]}),children:(0,r.jsx)(o.A.Item,{name:["fileBindingGroups",e.value],children:(0,r.jsx)(I.A,{mode:"multiple",showSearch:!0,filterOption:!1,loading:eh,onSearch:e=>{te(e)},onFocus:()=>{te("")},placeholder:"输入关键词搜索知识库文件",options:eG,optionLabelProp:"value"})})},e.value))]}),(0,r.jsx)(f.A,{type:"info",showIcon:!0,message:"文档规范由后台根据模板、提示词和角色绑定自动生成,无需手动维护规范包。"})]})})]})}}},e=>{e.O(0,[433,787,576,195,455,506,412,53,636,593,792],()=>e(e.s=16403)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[920],{2548:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>b});var i=l(65321),r=l(35292),c=l(68787),n=l(2256),d=l(38770),t=l(11702),x=l(9730),h=l(13399),j=l(55122),a=l(15622),o=l(71330),g=l(8579),m=l(66926),A=l(7851),p=l(84742),u=l(79059);let{Paragraph:k,Title:z,Text:N}=r.A,y=[{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)(A.A,{}),title:"交付阶段",color:"green",items:["审查事实和来源","检查导出门禁","导出正式文件"]}],w=[{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)(c.A,{className:"cardGlass",styles:{body:{padding:24}},children:[(0,i.jsx)(z,{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:y.map(e=>(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(c.A,{className:"h-full",title:(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon,e.title]}),children:(0,i.jsx)("div",{className:"space-y-2",children:e.items.map(s=>(0,i.jsx)("div",{children:(0,i.jsx)(t.A,{color:e.color,children:s})},s))})})},e.title))}),(0,i.jsx)(c.A,{title:e("guide.fullFlow"),children:(0,i.jsx)(x.A,{direction:"vertical",items:w.map(e=>({title:e.title,description:"".concat(e.goal,"(入口:").concat(e.path,")")}))})}),(0,i.jsx)(c.A,{title:"详细步骤说明:照着做即可跑通",children:(0,i.jsx)(h.A,{mode:"left",items:w.map(e=>({dot:(0,i.jsx)(p.A,{}),children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(z,{level:4,className:"mb-0",children:e.title}),(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"目标:"}),e.goal]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"入口:"}),e.path]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(N,{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)(N,{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)(N,{strong:!0,children:"提示:"}),e.tips]}),(0,i.jsx)(j.A,{})]})}))})}),(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(c.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)(N,{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)(N,{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)(N,{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)(c.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)(c.A,{title:"文件角色和提示词角色案例:它们在模板生成中到底起什么作用",children:(0,i.jsxs)(n.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{size:"small",title:"案例 A:创建文件角色“招标文件事实源”",children:[(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"怎么创建:"}),"类型选择 file,处理类型选择“项目事实文件”,绑定招标文件、合同摘要或项目概况。"]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"生成时的作用:"}),"系统会从这个角色绑定的文件里抽取工程名称、建设地点、工期、质量目标、范围边界等事实,并把来源带入结构化事实和章节证据。"]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"带来的提升:"}),"模型不再凭空补项目事实;章节生成和导出校验都会追踪“这句话来自哪个文件角色、哪个文件”。"]})]})}),(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{size:"small",title:"案例 B:创建文件角色“工程量清单表格”",children:[(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"怎么创建:"}),"类型选择 file,处理类型选择“表格数据”,绑定 Excel、CSV、清单表或计划表。"]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"生成时的作用:"}),"系统会读取 Sheet、表头、行列和来源范围,把表格数据转换成可引用的结构化资源证据。"]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"带来的提升:"}),"章节中涉及数量、清单、计划、资源配置时,优先引用表格来源,减少数字编造和漏项。"]})]})}),(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{size:"small",title:"案例 C:创建提示词角色“章节生成规则”",children:[(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"怎么创建:"}),"先在提示词管理中写好生成规则,例如“必须引用来源、不要写无来源数据、输出正式报告语气”;再创建 prompt 角色,执行类型选择“章节生成”。"]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"生成时的作用:"}),"系统生成每个章节时会把这个提示词加入 LLM 上下文,用它约束语气、结构、引用方式和禁止事项。"]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"带来的提升:"}),"同一套资料可以生成更稳定的文档风格;不同模板只需替换提示词角色,就能调整写法而不改知识库文件。"]})]})}),(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(c.A,{size:"small",title:"案例 D:创建提示词角色“导出前校验规则”",children:[(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"怎么创建:"}),"提示词内容写清楚必须检查的交付要求,例如“不能出现资料未提供、图片引用必须可访问、关键事实必须有来源”;prompt 角色执行类型选择“校验”或“格式化”。"]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"生成时的作用:"}),"生成完成后,系统会结合后台自动规范、证据来源和导出门禁检查文档是否可交付。"]}),(0,i.jsxs)(k,{children:[(0,i.jsx)(N,{strong:!0,children:"带来的提升:"}),"把人工审稿经验前置到生成流程,降低导出后才发现缺来源、缺图片、格式不合格的概率。"]})]})})]})}),(0,i.jsx)(c.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)(c.A,{size:"small",title:"使用自己的数据",children:(0,i.jsx)(k,{children:"文件、提示词、角色配置和规范包都来自用户自己创建或上传的内容,生成流程会按当前项目配置读取并参与校验。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"自定义门禁类型会执行",children:(0,i.jsx)(k,{children:"门禁规则由后台根据模板、提示词和角色绑定自动形成,并与系统门禁一起参与生成校验,不需要用户手动维护规范包。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"上传后关注索引状态",children:(0,i.jsx)(k,{children:"文件上传完成后,知识库索引会继续在后台写入。请在文件管理页查看状态,如果失败,页面会展示原因,方便重新配置模型或重试。"})})})]})}),(0,i.jsx)(c.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)(c.A,{size:"small",title:"上下文召回不是事实来源",children:(0,i.jsx)(k,{children:"生成前会按当前项目召回短期/长期上下文,但它只用于用户偏好、历史纠偏和连续性参考。如果上下文与知识库证据冲突,系统提示词会要求以知识库证据、模板要求和规范包为准。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"自动检索为主",children:(0,i.jsx)(k,{children:"模板章节的查询词、章节目的和必需事实会驱动系统自动检索知识库证据。高级优先证据只是兜底能力,用于必须指定官方资料、图纸或表格的场景,不是日常必填项。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"增强贡献可追踪",children:(0,i.jsx)(k,{children:"生成流程会展示知识库证据、人工确认/固定证据、项目上下文和自动检索证据的数量,帮助判断本次增强是否真的参与生成,而不是增加用户维护成本。"})})})]})}),(0,i.jsx)(c.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)(c.A,{size:"small",title:"动态事实 schema",children:(0,i.jsx)(k,{children:"系统不会写死工程字段。后台自动规范会结合模板章节 requiredFacts、角色绑定和提示词形成抽取 schema,并驱动事实抽取、冲突检测和导出门禁。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.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)(c.A,{size:"small",title:"动态执行状态",children:(0,i.jsx)(k,{children:"生成编辑页的执行节点会随模板、规范包、文件角色、提示词角色、章节和门禁规则变化;用户生成不同项目文件时看到的是对应项目的流程,而不是固定示例流程。"})})})]})}),(0,i.jsx)(c.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)(c.A,{size:"small",title:"草稿历史记录",children:[(0,i.jsxs)(k,{children:["每次后台生成都会写入全局项目目录 ",(0,i.jsxs)(N,{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)(c.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)(c.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)(c.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)(c.A,{size:"small",title:"生成资源自动回流知识库",children:[(0,i.jsx)(k,{children:"模型生成的图片、封面或后处理资源会登记到生成资源管理页,并自动回流到 knowledgeBase/生成资源 下完成索引。"}),(0,i.jsx)(k,{children:"后续文档可以继续检索和复用这些已生成资源,资源管理页也会展示入库状态。"})]})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsxs)(c.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)(c.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)(c.A,{size:"small",title:"规则文件",children:(0,i.jsx)(k,{children:"用来告诉系统“必须怎么写、不能怎么写、按什么标准判断”。适合放评分办法、甲方编制要求、攻略写作要求、输出格式要求。生成时会优先作为约束使用。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(c.A,{size:"small",title:"项目事实文件",children:(0,i.jsx)(k,{children:"用来告诉系统“真实情况是什么”。适合放项目概况、合同摘要、招标文件关键信息、游戏角色资料、产品资料。事实字段通常从这里抽取。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(c.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)(c.A,{size:"small",title:"图纸文件",children:(0,i.jsx)(k,{children:"用来表达空间关系、路线、结构、站位或设计说明。可以是图纸目录、设计说明、路线示意、阵型图说明。没有 CAD 时也可以用文字图纸说明。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(c.A,{size:"small",title:"规范文件",children:(0,i.jsx)(k,{children:"用来作为专业依据。适合放国家规范、行业标准、企业标准、攻略结构规范、质量标准。校验和生成时会把它当成依据。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(c.A,{size:"small",title:"参考资料",children:(0,i.jsx)(k,{children:"只作为辅助阅读材料,不建议放关键事实。适合放图片来源、公开网页链接、背景资料、案例资料。系统可以参考,但不应把它当成强事实。"})})})]})}),(0,i.jsx)(c.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)(c.A,{size:"small",title:"必备资料",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"项目事实文件"}),(0,i.jsx)("li",{children:"招标或编制规则"}),(0,i.jsx)("li",{children:"章节生成提示词"})]})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"强烈建议",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"表格数据"}),(0,i.jsx)("li",{children:"图纸说明"}),(0,i.jsx)("li",{children:"规范或企业标准"})]})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(c.A,{size:"small",title:"导出前确认",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"无 error 校验"}),(0,i.jsx)("li",{children:"事实有来源"}),(0,i.jsx)("li",{children:"导出门禁通过"})]})})})]})}),(0,i.jsx)(c.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)(c.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)("li",{children:"只有必须指定资料时才维护高级优先证据。"})]})})}),(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(c.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)("li",{children:"生成后查看增强贡献,确认上下文和证据是否真实参与。"})]})})}),(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(c.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)(c.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)(c.A,{title:"常见问题和处理建议",children:(0,i.jsx)(a.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:"优先检查后台自动规范生成的事实字段、模板章节 requiredFacts 和文件角色绑定。很多情况下不是模型失败,而是资料没有被绑定到正确角色,或字段要求比资料实际内容更严格。"})},{key:"draft-duration",label:"草稿历史里的耗时怎么计算?",children:(0,i.jsx)(k,{children:"耗时使用生成记录的 createdAt 到 completedAt 计算;旧记录或未完成记录会使用 updatedAt 兜底。它用于判断本次生成链路整体成本,包括知识库检索、事实抽取、章节生成、资源处理、校验和格式化。"})},{key:"asset-index",label:"生成资源会如何进入知识库?",children:(0,i.jsx)(k,{children:"生成资源完成后会自动回流到 knowledgeBase/生成资源 并建立索引,便于后续模板继续复用。资源管理页会展示入库状态,错误资源可以删除后重新生成。"})},{key:"context-accuracy",label:"上下文召回会不会影响准确度?",children:(0,i.jsx)(k,{children:"上下文只作为当前项目的偏好、历史纠偏和连续性参考,不作为事实来源。生成和审查提示词都要求:如果上下文与知识库证据、模板要求或后台自动规范冲突,以知识库证据和后台自动规范为准。"})},{key:"priority-evidence",label:"什么时候需要维护高级优先证据?",children:(0,i.jsx)(k,{children:"日常不需要维护。只有当某章必须引用指定官方资料、图纸、表格,或自动检索结果不稳定时,才从知识库搜索页复制文件路径并填入章节高级优先证据。"})}]})}),(0,i.jsx)(a.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,[433,787,412,20,636,593,792],()=>e(e.s=34899)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[332],{15766:(_,u,e)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return e(76933)}])},76933:(_,u,e)=>{"use strict";e.r(u),e.d(u,{default:()=>n.default});var n=e(27795)}},_=>{_.O(0,[433,787,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[332],{15766:(_,u,e)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return e(76933)}])},76933:(_,u,e)=>{"use strict";e.r(u),e.d(u,{default:()=>n.default});var n=e(27795)}},_=>{_.O(0,[433,787,694,795,636,593,792],()=>_(_.s=15766)),_N_E=_.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[309],{1873:(e,t,l)=>{e.exports=l(91952)},4632:(e,t)=>{"use strict";function l(e){var t;let{config:l,src:n,width:r,quality:i}=e,a=i||(null==(t=l.qualities)?void 0:t.reduce((e,t)=>Math.abs(t-75)<Math.abs(e-75)?t:e))||75;return l.path+"?url="+encodeURIComponent(n)+"&w="+r+"&q="+a+(n.startsWith("/_next/static/media/"),"")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}}),l.__next_img_default=!0;let n=l},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},37690:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return l(70107)}])},45551:(e,t,l)=>{"use strict";function n(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),l=e/Math.pow(1024,t);return"".concat(l.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let l=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(l/60),r=Math.floor(n/24);return r>30?new Date(e).toLocaleDateString(t):"en-US"===t?r>0?"".concat(r,"d ago"):n>0?"".concat(n,"h ago"):l>0?"".concat(l,"m ago"):"Just now":r>0?"".concat(r," 天前"):n>0?"".concat(n," 小时前"):l>0?"".concat(l," 分钟前"):"刚刚"}l.d(t,{Jm:()=>s,fw:()=>r,z3:()=>n});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},a={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===l?a:i)[e])?t:e}},49952:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return w}});let n=l(34007),r=l(26908),i=l(65321),a=r._(l(97109)),s=n._(l(61222)),o=n._(l(64041)),c=l(62956),d=l(83149),u=l(65059);l(28965);let h=l(99318),m=n._(l(4632)),g=l(47503),p={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function f(e,t,l,n,r,i,a){let s=null==e?void 0:e.src;e&&e["data-loaded-src"]!==s&&(e["data-loaded-src"]=s,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&r(!0),null==l?void 0:l.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let n=!1,r=!1;l.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>n,isPropagationStopped:()=>r,persist:()=>{},preventDefault:()=>{n=!0,t.preventDefault()},stopPropagation:()=>{r=!0,t.stopPropagation()}})}(null==n?void 0:n.current)&&n.current(e)}}))}function y(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}let _=(0,a.forwardRef)((e,t)=>{let{src:l,srcSet:n,sizes:r,height:s,width:o,decoding:c,className:d,style:u,fetchPriority:h,placeholder:m,loading:p,unoptimized:_,fill:x,onLoadRef:w,onLoadingCompleteRef:v,setBlurComplete:j,setShowAltText:b,sizesInput:C,onLoad:A,onError:S,...k}=e,P=(0,a.useCallback)(e=>{e&&(S&&(e.src=e.src),e.complete&&f(e,m,w,v,j,_,C))},[l,m,w,v,j,S,_,C]),R=(0,g.useMergedRef)(t,P);return(0,i.jsx)("img",{...k,...y(h),loading:p,width:o,height:s,decoding:c,"data-nimg":x?"fill":"1",className:d,style:u,sizes:r,srcSet:n,src:l,ref:R,onLoad:e=>{f(e.currentTarget,m,w,v,j,_,C)},onError:e=>{b(!0),"empty"!==m&&j(!0),S&&S(e)}})});function x(e){let{isAppRouter:t,imgAttributes:l}=e,n={as:"image",imageSrcSet:l.srcSet,imageSizes:l.sizes,crossOrigin:l.crossOrigin,referrerPolicy:l.referrerPolicy,...y(l.fetchPriority)};return t&&s.default.preload?(s.default.preload(l.src,n),null):(0,i.jsx)(o.default,{children:(0,i.jsx)("link",{rel:"preload",href:l.srcSet?void 0:l.src,...n},"__nimg-"+l.src+l.srcSet+l.sizes)})}let w=(0,a.forwardRef)((e,t)=>{let l=(0,a.useContext)(h.RouterContext),n=(0,a.useContext)(u.ImageConfigContext),r=(0,a.useMemo)(()=>{var e;let t=p||n||d.imageConfigDefault,l=[...t.deviceSizes,...t.imageSizes].sort((e,t)=>e-t),r=t.deviceSizes.sort((e,t)=>e-t),i=null==(e=t.qualities)?void 0:e.sort((e,t)=>e-t);return{...t,allSizes:l,deviceSizes:r,qualities:i}},[n]),{onLoad:s,onLoadingComplete:o}=e,g=(0,a.useRef)(s);(0,a.useEffect)(()=>{g.current=s},[s]);let f=(0,a.useRef)(o);(0,a.useEffect)(()=>{f.current=o},[o]);let[y,w]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1),{props:b,meta:C}=(0,c.getImgProps)(e,{defaultLoader:m.default,imgConf:r,blurComplete:y,showAltText:v});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_,{...b,unoptimized:C.unoptimized,placeholder:C.placeholder,fill:C.fill,onLoadRef:g,onLoadingCompleteRef:f,setBlurComplete:w,setShowAltText:j,sizesInput:e.sizes,ref:t}),C.priority?(0,i.jsx)(x,{isAppRouter:!l,imgAttributes:b}):null]})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},58970:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"}},62956:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return o}}),l(28965);let n=l(65545),r=l(83149),i=["-moz-initial","fill","none","scale-down",void 0];function a(e){return void 0!==e.default}function s(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function o(e,t){var l,o;let c,d,u,{src:h,sizes:m,unoptimized:g=!1,priority:p=!1,loading:f,className:y,quality:_,width:x,height:w,fill:v=!1,style:j,overrideSrc:b,onLoad:C,onLoadingComplete:A,placeholder:S="empty",blurDataURL:k,fetchPriority:P,decoding:R="async",layout:I,objectFit:z,objectPosition:E,lazyBoundary:O,lazyRoot:N,...M}=e,{imgConf:D,showAltText:L,blurComplete:T,defaultLoader:F}=t,B=D||r.imageConfigDefault;if("allSizes"in B)c=B;else{let e=[...B.deviceSizes,...B.imageSizes].sort((e,t)=>e-t),t=B.deviceSizes.sort((e,t)=>e-t),n=null==(l=B.qualities)?void 0:l.sort((e,t)=>e-t);c={...B,allSizes:e,deviceSizes:t,qualities:n}}if(void 0===F)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let J=M.loader||F;delete M.loader,delete M.srcSet;let V="__next_img_default"in J;if(V){if("custom"===c.loader)throw Object.defineProperty(Error('Image with src "'+h+'" is missing "loader" prop.\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader'),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=J;J=t=>{let{config:l,...n}=t;return e(n)}}if(I){"fill"===I&&(v=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[I];e&&(j={...j,...e});let t={responsive:"100vw",fill:"100vw"}[I];t&&!m&&(m=t)}let H="",K=s(x),G=s(w);if((o=h)&&"object"==typeof o&&(a(o)||void 0!==o.src)){let e=a(h)?h.default:h;if(!e.src)throw Object.defineProperty(Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received "+JSON.stringify(e)),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!e.height||!e.width)throw Object.defineProperty(Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received "+JSON.stringify(e)),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(d=e.blurWidth,u=e.blurHeight,k=k||e.blurDataURL,H=e.src,!v)if(K||G){if(K&&!G){let t=K/e.width;G=Math.round(e.height*t)}else if(!K&&G){let t=G/e.height;K=Math.round(e.width*t)}}else K=e.width,G=e.height}let W=!p&&("lazy"===f||void 0===f);(!(h="string"==typeof h?h:H)||h.startsWith("data:")||h.startsWith("blob:"))&&(g=!0,W=!1),c.unoptimized&&(g=!0),V&&!c.dangerouslyAllowSVG&&h.split("?",1)[0].endsWith(".svg")&&(g=!0);let U=s(_),X=Object.assign(v?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:z,objectPosition:E}:{},L?{}:{color:"transparent"},j),q=T||"empty"===S?null:"blur"===S?'url("data:image/svg+xml;charset=utf-8,'+(0,n.getImageBlurSvg)({widthInt:K,heightInt:G,blurWidth:d,blurHeight:u,blurDataURL:k||"",objectFit:X.objectFit})+'")':'url("'+S+'")',$=i.includes(X.objectFit)?"fill"===X.objectFit?"100% 100%":"cover":X.objectFit,Y=q?{backgroundSize:$,backgroundPosition:X.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:q}:{},Z=function(e){let{config:t,src:l,unoptimized:n,width:r,quality:i,sizes:a,loader:s}=e;if(n)return{src:l,srcSet:void 0,sizes:void 0};let{widths:o,kind:c}=function(e,t,l){let{deviceSizes:n,allSizes:r}=e;if(l){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let n;n=e.exec(l);)t.push(parseInt(n[2]));if(t.length){let e=.01*Math.min(...t);return{widths:r.filter(t=>t>=n[0]*e),kind:"w"}}return{widths:r,kind:"w"}}return"number"!=typeof t?{widths:n,kind:"w"}:{widths:[...new Set([t,2*t].map(e=>r.find(t=>t>=e)||r[r.length-1]))],kind:"x"}}(t,r,a),d=o.length-1;return{sizes:a||"w"!==c?a:"100vw",srcSet:o.map((e,n)=>s({config:t,src:l,quality:i,width:e})+" "+("w"===c?e:n+1)+c).join(", "),src:s({config:t,src:l,quality:i,width:o[d]})}}({config:c,src:h,unoptimized:g,width:K,quality:U,sizes:m,loader:J});return{props:{...M,loading:W?"lazy":f,fetchPriority:P,width:K,height:G,decoding:R,className:y,style:{...X,...Y},sizes:Z.sizes,srcSet:Z.srcSet,src:b||Z.src},meta:{unoptimized:g,priority:p,placeholder:S,fill:v}}}},65545:(e,t)=>{"use strict";function l(e){let{widthInt:t,heightInt:l,blurWidth:n,blurHeight:r,blurDataURL:i,objectFit:a}=e,s=n?40*n:t,o=r?40*r:l,c=s&&o?"viewBox='0 0 "+s+" "+o+"'":"";return"%3Csvg xmlns='http://www.w3.org/2000/svg' "+c+"%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='"+(c?"none":"contain"===a?"xMidYMid":"cover"===a?"xMidYMid slice":"none")+"' style='filter: url(%23b);' href='"+i+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return l}})},70107:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>T});var n=l(65321),r=l(97109),i=l(1873),a=l.n(i),s=l(86109),o=l(35292),c=l(76506),d=l(33442),u=l(11702),h=l(9137),m=l(21289),g=l(68787),p=l(56985),f=l(49604),y=l(88762),_=l(85493),x=l(84253),w=l(85114),v=l(58569),j=l(7576),b=l(58970),C=l(88483);function A(){return(A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e}).apply(this,arguments)}let S=r.forwardRef((e,t)=>r.createElement(C.A,A({},e,{ref:t,icon:b.A})));var k=l(6578),P=l(79059),R=l(45551),I=l(14569),z=l.n(I);let{Paragraph:E}=o.A;function O(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 M(e,t){let l=t.trim()?[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length):[];if(0===l.length)return e;let r=RegExp("(".concat(l.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(r).map((e,t)=>l.some(t=>t.toLowerCase()===e.toLowerCase())?(0,n.jsx)("mark",{children:e},t):e)}function D(e,t,l){return null==t||""===t||Array.isArray(t)&&0===t.length?null:(0,n.jsx)(c.A.Item,{label:e,children:Array.isArray(t)?(0,n.jsx)(d.A,{wrap:!0,children:t.map(e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>null==l?void 0:l(String(e)),children:String(e)},String(e)))}):String(t)})}function L(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return e.map((e,l)=>({key:"".concat(t,"-").concat(l),name:e}))}function T(){var e,t,l,i,o;let b=(0,P.Vr)(),C=(0,s.useRouter)(),A="string"==typeof C.query.relativePath?C.query.relativePath:"",[I,T]=(0,r.useState)(),[F,B]=(0,r.useState)(!1),[J,V]=(0,r.useState)(""),[H,K]=(0,r.useState)(!1),[G,W]=(0,r.useState)(""),[U,X]=(0,r.useState)([]);(0,r.useEffect)(()=>{A&&(B(!0),V(""),(0,k.xC)(A).then(T).catch(e=>{T(void 0),V(e instanceof Error?e.message:"文件详情加载失败")}).finally(()=>B(!1)))},[A]);let q=(0,r.useMemo)(()=>(function(e){let t=O(null==e?void 0:e.file.metadataJson);return"object"==typeof t.extraction&&t.extraction?t.extraction:t})(I),[I]),$=N(q.layerNames);(0,r.useEffect)(()=>{X($)},[null==I?void 0:I.file.relativePath,$.join("|")]);let Y=G.trim().toLowerCase(),Z=(0,r.useMemo)(()=>{var e;return I&&Y?I.chunks.filter(e=>{let t=O(e.metadataJson);return[e.content,e.sectionTitle,t.rowRange,t.chunkKind,t.parentId,JSON.stringify(t)].some(e=>String(null!=e?e:"").toLowerCase().includes(Y))}):null!=(e=null==I?void 0:I.chunks)?e:[]},[I,Y]),Q=(0,r.useMemo)(()=>{var e;return I&&Y?I.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(Y))):null!=(e=null==I?void 0:I.parents)?e:[]},[I,Y]),ee=async()=>{if(A){K(!0);try{let e=await (0,k.HC)(A);e.detail&&T(e.detail),h.Ay.success("文件索引已重建")}finally{K(!1)}}},et=async e=>{e&&(await navigator.clipboard.writeText(e),h.Ay.success("已复制"))},el=async e=>{A&&(await (0,k.tn)(A,e),h.Ay.success("file"===e?"已请求打开文件":"已请求打开目录"))},en=(0,r.useMemo)(()=>{var e,t,l,r,i;let s=[],o=N(q.sheetNames),h=N(q.columnNames),y=N(q.layerNames),_=N(q.blockNames),x=N(q.entityTypes),w=N(q.productNames),v=N(q.materialNames),j=N(q.entityNames),b=N(q.dataPaths),C=o.length>0||h.length>0||null!=q.rowCount||null!=q.columnCount||null!=q.formulaCount||null!=q.mergeCount,A=L(h,"column"),S=(null!=(e=null==I?void 0:I.chunks)?e:[]).map(e=>O(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,t)=>({key:"row-".concat(t),name:e})),k=(null!=(t=null==I?void 0:I.chunks)?t:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>e.includes("|")).slice(0,80).map((e,t)=>({key:"grid-".concat(t),cells:e.split("|").map(e=>e.trim()).filter(Boolean)}));(C||A.length>0||S.length>0||k.length>0)&&s.push({key:"table",label:"表格",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[C&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[D("Sheet",o,W),D("表头",h,W),D("行数",q.rowCount),D("列数",q.columnCount),D("公式数",q.formulaCount),D("合并单元格",q.mergeCount)]}),A.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:A,columns:[{title:"列名",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(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:()=>W(String(e)),children:["行 ",String(e)]})}]}),k.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:k,pagination:{pageSize:10},columns:[{title:"表格网格预览",dataIndex:"cells",render:e=>(0,n.jsx)(d.A,{wrap:!0,children:e.map((e,t)=>(0,n.jsx)(u.A,{children:e},"".concat(e,"-").concat(t)))})}]})]})});let P=y.length>0||_.length>0||x.length>0||w.length>0||v.length>0||j.length>0,R=[...L(y,"layer").map(e=>({...e,type:"图层"})),...L(x,"entity").map(e=>({...e,type:"实体类型"})),...L(_,"block").map(e=>({...e,type:"块/符号"}))];(P||y.length>0||R.length>0)&&s.push({key:"drawing",label:"图纸",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[P&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[D("图层",y,W),D("块/符号",_,W),D("实体类型",x,W),D("产品/零件",w,W),D("材料",v,W),D("实体名称",j,W)]}),y.length>0&&(0,n.jsxs)(g.A,{size:"small",title:"图层开关 / 图纸预览",children:[(0,n.jsx)(p.A.Group,{value:U,options:y.map(e=>({label:e,value:e})),onChange:e=>X(e.map(String))}),(0,n.jsx)("div",{className:z().drawingPreview,children:U.map(e=>(0,n.jsx)(u.A,{color:"blue",children:e},e))})]}),R.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:R,columns:[{title:"类型",dataIndex:"type",width:120},{title:"名称",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})}]})]})});let M=(null!=(l=null==I?void 0:I.chunks)?l:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>/^[\w.[\]-]+\s*[:=]/u.test(e)).slice(0,200).map((e,t)=>{var l,n,r,i;let a=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(t),path:null!=(r=null==a||null==(l=a[1])?void 0:l.trim())?r:e,value:null!=(i=null==a||null==(n=a[2])?void 0:n.trim())?i:""}});(b.length>0||M.length>0)&&s.push({key:"data",label:"数据路径",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[b.length>0&&(0,n.jsx)(f.A,{defaultExpandAll:!0,treeData:function(e){let t=new Map;for(let l of e){let e=t;for(let t of l.replace(/\[(\d+)\]/gu,".$1").split(".").filter(Boolean))e.has(t)||e.set(t,new Map),e=e.get(t)}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return[...e.entries()].map(e=>{let[n,r]=e;return{title:n,key:t?"".concat(t,".").concat(n):n,children:l(r,t?"".concat(t,".").concat(n):n)}})};return l(t)}(b),onSelect:e=>{var t;return W(String(null!=(t=e[0])?t:""))}}),M.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:M,pagination:{pageSize:20},columns:[{title:"Path",dataIndex:"path",width:260,render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})},{title:"Value",dataIndex:"value",render:e=>(0,n.jsx)("span",{className:"break-all",children:String(e)})}]})]})});let T=null!=q.ocrRecommended||null!=q.ocrReason||null!=q.ocrProvider||null!=q.ocrLanguages||null!=q.ocrTextLength||null!=q.pdfPageOcrSupported||null!=q.ocrPageCount||null!=q.pdfOcrPageLimit||null!=q.pdfRenderer,F=(null!=(r=null==I?void 0:I.chunks)?r:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,t,l,n)=>{var r,i,a;return l%2==0&&e.push({key:"page-".concat(t),page:t,text:null!=(a=null==(i=n[l+1])||null==(r=i.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:r.trim())?a:""}),e},[]),B=(null==I?void 0:I.file.format)==="pdf";return(T||B||F.length>0)&&s.push({key:"ocr",label:"OCR/PDF",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[T&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[D("OCR 建议",q.ocrRecommended),D("OCR 原因",q.ocrReason),D("OCR 引擎",q.ocrProvider),D("OCR 语言",q.ocrLanguages),D("OCR 文本长度",q.ocrTextLength),D("PDF 页面 OCR 支持",q.pdfPageOcrSupported),D("PDF OCR 页数",q.ocrPageCount),D("PDF OCR 页数上限",q.pdfOcrPageLimit),D("PDF 渲染器",q.pdfRenderer)]}),B&&(0,n.jsx)("div",{className:z().pdfPreviewStrip,children:Array.from({length:Math.min(Number(null!=(i=q.ocrPageCount)?i:1)||1,6)},(e,t)=>(0,n.jsx)(a(),{width:220,height:320,src:"/api/kb/files/preview-pdf-page?relativePath=".concat(encodeURIComponent(I.file.relativePath),"&page=").concat(t+1),alt:"PDF 第 ".concat(t+1," 页"),unoptimized:!0},t))}),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)(E,{ellipsis:{rows:4,expandable:!0,symbol:"展开"},children:String(e)})}]})]})}),s},[q,I,U]),er=[{title:"序号",key:"index",width:70,render:(e,t,l)=>l+1},{title:b("knowledge.chunkIndex"),dataIndex:"chunkIndex",width:90,render:e=>String(e)},{title:b("knowledge.chunkType"),width:110,render:(e,t)=>{var l;return(0,n.jsx)(u.A,{children:String(null!=(l=O(t.metadataJson).chunkKind)?l:t.category)})}},{title:b("knowledge.sectionOrRange"),width:220,render:(e,t)=>{let l=O(t.metadataJson),r="string"==typeof l.rowRange?l.rowRange:void 0;return(0,n.jsxs)(d.A,{wrap:!0,children:[t.sectionTitle?(0,n.jsx)(u.A,{color:"cyan",children:t.sectionTitle}):null,r?(0,n.jsxs)(u.A,{color:"gold",children:["行 ",r]}):null]})}},{title:"Token",dataIndex:"tokenCount",width:90},{title:b("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(E,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:z().searchContent,children:M(t.content,G)})}],ei=[{title:"序号",key:"index",width:70,render:(e,t,l)=>l+1},{title:b("knowledge.parentChunkId"),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:b("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(E,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:z().searchContent,children:M(t.content,G)})}];return F?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(y.A,{active:!0,paragraph:{rows:1}}),(0,n.jsx)(g.A,{size:"small",children:(0,n.jsx)(y.A,{active:!0,paragraph:{rows:6}})}),(0,n.jsx)(g.A,{size:"small",children:(0,n.jsx)(y.A,{active:!0,paragraph:{rows:4}})})]}):J?(0,n.jsx)(_.A,{type:"error",showIcon:!0,message:"文件详情加载失败",description:J}):I?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(w.Ay,{icon:(0,n.jsx)(S,{}),href:"/knowledge/files",size:"small",style:{marginBottom:12},children:"返回文件列表"}),(0,n.jsxs)("div",{className:z().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)(w.Ay,{onClick:()=>{et(null==I?void 0:I.absolutePath)},children:"复制原文件路径"}),(0,n.jsx)(w.Ay,{onClick:()=>{et(null==I?void 0:I.directory)},children:"复制所在目录"}),(0,n.jsx)(w.Ay,{onClick:()=>{el("file")},children:"打开文件"}),(0,n.jsx)(w.Ay,{onClick:()=>{el("directory")},children:"打开目录"}),"pdf"===I.file.format?(0,n.jsx)(w.Ay,{loading:H,onClick:()=>{ee()},children:"重新 OCR"}):null,(0,n.jsx)(w.Ay,{type:"primary",loading:H,onClick:()=>{ee()},children:"重建该文件索引"})]})]})]}),(0,n.jsx)(g.A,{size:"small",title:"基础信息",children:(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[(0,n.jsx)(c.A.Item,{label:"路径",children:I.file.relativePath}),(0,n.jsx)(c.A.Item,{label:"原文件",children:null!=(e=I.absolutePath)?e:"-"}),(0,n.jsx)(c.A.Item,{label:"所在目录",children:null!=(t=I.directory)?t:"-"}),(0,n.jsxs)(c.A.Item,{label:"分类",children:[(0,n.jsx)(u.A,{children:(0,R.Jm)(I.file.category)})," ",(0,n.jsx)(u.A,{children:I.file.format})]}),(0,n.jsx)(c.A.Item,{label:"大小",children:(0,R.z3)(I.file.fileSize)}),(0,n.jsx)(c.A.Item,{label:"切片数",children:I.file.chunkCount}),(0,n.jsx)(c.A.Item,{label:"状态",children:I.file.status}),(0,n.jsx)(c.A.Item,{label:"解析模式",children:String(null!=(l=q.extractionMode)?l:"-")}),(0,n.jsx)(c.A.Item,{label:"覆盖范围",children:String(null!=(i=q.contentCoverage)?i:"-")}),(0,n.jsx)(c.A.Item,{label:"正文长度",children:String(null!=(o=q.textLength)?o:"-")})]})}),en.length>0&&(0,n.jsx)(g.A,{size:"small",title:"结构化信息",children:(0,n.jsx)(v.A,{items:en})}),(0,n.jsx)(g.A,{size:"small",title:"详情筛选",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[(0,n.jsx)(j.A,{allowClear:!0,value:G,onChange:e=>W(e.target.value),placeholder:"筛选 rowRange、图层、实体、data path、section、chunk 内容"}),G?(0,n.jsxs)(d.A,{wrap:!0,children:[(0,n.jsxs)(u.A,{color:"blue",children:[b("knowledge.parentMatches")," ",Q.length]}),(0,n.jsxs)(u.A,{color:"green",children:[b("knowledge.childMatches")," ",Z.length]}),(0,n.jsxs)(u.A,{color:"purple",children:[b("knowledge.filterTerm")," ",G]})]}):null]})}),(0,n.jsxs)(g.A,{size:"small",title:"".concat(b("knowledge.parentChunks")," (").concat(Q.length,"/").concat(I.parents.length,")"),children:[(0,n.jsx)(_.A,{type:"info",showIcon:!0,message:b("knowledge.parentChunkHint"),style:{marginBottom:12}}),(0,n.jsx)(m.A,{rowKey:"id",columns:ei,dataSource:Q,pagination:{pageSize:10},size:"small"})]}),(0,n.jsx)(g.A,{size:"small",title:"".concat(b("knowledge.childChunks")," (").concat(Z.length,"/").concat(I.chunks.length,")"),children:(0,n.jsx)(m.A,{rowKey:"id",columns:er,dataSource:Z,pagination:{pageSize:20},size:"small"})})]}):(0,n.jsx)(x.A,{description:"请选择文件"})}},91952:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var l in t)Object.defineProperty(e,l,{enumerable:!0,get:t[l]})}(t,{default:function(){return o},getImageProps:function(){return s}});let n=l(34007),r=l(62956),i=l(49952),a=n._(l(4632));function s(e){let{props:t}=(0,r.getImgProps)(e,{defaultLoader:a.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,l]of Object.entries(t))void 0===l&&delete t[e];return{props:t}}let o=i.Image}},e=>{e.O(0,[433,787,576,985,150,289,506,512,636,593,792],()=>e(e.s=37690)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[309],{1873:(e,t,l)=>{e.exports=l(91952)},4632:(e,t)=>{"use strict";function l(e){var t;let{config:l,src:n,width:r,quality:i}=e,a=i||(null==(t=l.qualities)?void 0:t.reduce((e,t)=>Math.abs(t-75)<Math.abs(e-75)?t:e))||75;return l.path+"?url="+encodeURIComponent(n)+"&w="+r+"&q="+a+(n.startsWith("/_next/static/media/"),"")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}}),l.__next_img_default=!0;let n=l},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},37690:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return l(70107)}])},45551:(e,t,l)=>{"use strict";function n(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),l=e/Math.pow(1024,t);return"".concat(l.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let l=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(l/60),r=Math.floor(n/24);return r>30?new Date(e).toLocaleDateString(t):"en-US"===t?r>0?"".concat(r,"d ago"):n>0?"".concat(n,"h ago"):l>0?"".concat(l,"m ago"):"Just now":r>0?"".concat(r," 天前"):n>0?"".concat(n," 小时前"):l>0?"".concat(l," 分钟前"):"刚刚"}l.d(t,{Jm:()=>s,fw:()=>r,z3:()=>n});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},a={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===l?a:i)[e])?t:e}},49952:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return w}});let n=l(34007),r=l(26908),i=l(65321),a=r._(l(97109)),s=n._(l(61222)),o=n._(l(64041)),c=l(62956),d=l(83149),u=l(65059);l(28965);let h=l(99318),m=n._(l(4632)),g=l(47503),p={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function f(e,t,l,n,r,i,a){let s=null==e?void 0:e.src;e&&e["data-loaded-src"]!==s&&(e["data-loaded-src"]=s,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&r(!0),null==l?void 0:l.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let n=!1,r=!1;l.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>n,isPropagationStopped:()=>r,persist:()=>{},preventDefault:()=>{n=!0,t.preventDefault()},stopPropagation:()=>{r=!0,t.stopPropagation()}})}(null==n?void 0:n.current)&&n.current(e)}}))}function y(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}let _=(0,a.forwardRef)((e,t)=>{let{src:l,srcSet:n,sizes:r,height:s,width:o,decoding:c,className:d,style:u,fetchPriority:h,placeholder:m,loading:p,unoptimized:_,fill:x,onLoadRef:w,onLoadingCompleteRef:v,setBlurComplete:j,setShowAltText:b,sizesInput:C,onLoad:A,onError:S,...k}=e,P=(0,a.useCallback)(e=>{e&&(S&&(e.src=e.src),e.complete&&f(e,m,w,v,j,_,C))},[l,m,w,v,j,S,_,C]),R=(0,g.useMergedRef)(t,P);return(0,i.jsx)("img",{...k,...y(h),loading:p,width:o,height:s,decoding:c,"data-nimg":x?"fill":"1",className:d,style:u,sizes:r,srcSet:n,src:l,ref:R,onLoad:e=>{f(e.currentTarget,m,w,v,j,_,C)},onError:e=>{b(!0),"empty"!==m&&j(!0),S&&S(e)}})});function x(e){let{isAppRouter:t,imgAttributes:l}=e,n={as:"image",imageSrcSet:l.srcSet,imageSizes:l.sizes,crossOrigin:l.crossOrigin,referrerPolicy:l.referrerPolicy,...y(l.fetchPriority)};return t&&s.default.preload?(s.default.preload(l.src,n),null):(0,i.jsx)(o.default,{children:(0,i.jsx)("link",{rel:"preload",href:l.srcSet?void 0:l.src,...n},"__nimg-"+l.src+l.srcSet+l.sizes)})}let w=(0,a.forwardRef)((e,t)=>{let l=(0,a.useContext)(h.RouterContext),n=(0,a.useContext)(u.ImageConfigContext),r=(0,a.useMemo)(()=>{var e;let t=p||n||d.imageConfigDefault,l=[...t.deviceSizes,...t.imageSizes].sort((e,t)=>e-t),r=t.deviceSizes.sort((e,t)=>e-t),i=null==(e=t.qualities)?void 0:e.sort((e,t)=>e-t);return{...t,allSizes:l,deviceSizes:r,qualities:i}},[n]),{onLoad:s,onLoadingComplete:o}=e,g=(0,a.useRef)(s);(0,a.useEffect)(()=>{g.current=s},[s]);let f=(0,a.useRef)(o);(0,a.useEffect)(()=>{f.current=o},[o]);let[y,w]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1),{props:b,meta:C}=(0,c.getImgProps)(e,{defaultLoader:m.default,imgConf:r,blurComplete:y,showAltText:v});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_,{...b,unoptimized:C.unoptimized,placeholder:C.placeholder,fill:C.fill,onLoadRef:g,onLoadingCompleteRef:f,setBlurComplete:w,setShowAltText:j,sizesInput:e.sizes,ref:t}),C.priority?(0,i.jsx)(x,{isAppRouter:!l,imgAttributes:b}):null]})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},58970:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"}},62956:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return o}}),l(28965);let n=l(65545),r=l(83149),i=["-moz-initial","fill","none","scale-down",void 0];function a(e){return void 0!==e.default}function s(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function o(e,t){var l,o;let c,d,u,{src:h,sizes:m,unoptimized:g=!1,priority:p=!1,loading:f,className:y,quality:_,width:x,height:w,fill:v=!1,style:j,overrideSrc:b,onLoad:C,onLoadingComplete:A,placeholder:S="empty",blurDataURL:k,fetchPriority:P,decoding:R="async",layout:I,objectFit:z,objectPosition:E,lazyBoundary:O,lazyRoot:N,...M}=e,{imgConf:D,showAltText:L,blurComplete:T,defaultLoader:F}=t,B=D||r.imageConfigDefault;if("allSizes"in B)c=B;else{let e=[...B.deviceSizes,...B.imageSizes].sort((e,t)=>e-t),t=B.deviceSizes.sort((e,t)=>e-t),n=null==(l=B.qualities)?void 0:l.sort((e,t)=>e-t);c={...B,allSizes:e,deviceSizes:t,qualities:n}}if(void 0===F)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let J=M.loader||F;delete M.loader,delete M.srcSet;let V="__next_img_default"in J;if(V){if("custom"===c.loader)throw Object.defineProperty(Error('Image with src "'+h+'" is missing "loader" prop.\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader'),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=J;J=t=>{let{config:l,...n}=t;return e(n)}}if(I){"fill"===I&&(v=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[I];e&&(j={...j,...e});let t={responsive:"100vw",fill:"100vw"}[I];t&&!m&&(m=t)}let H="",K=s(x),G=s(w);if((o=h)&&"object"==typeof o&&(a(o)||void 0!==o.src)){let e=a(h)?h.default:h;if(!e.src)throw Object.defineProperty(Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received "+JSON.stringify(e)),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!e.height||!e.width)throw Object.defineProperty(Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received "+JSON.stringify(e)),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(d=e.blurWidth,u=e.blurHeight,k=k||e.blurDataURL,H=e.src,!v)if(K||G){if(K&&!G){let t=K/e.width;G=Math.round(e.height*t)}else if(!K&&G){let t=G/e.height;K=Math.round(e.width*t)}}else K=e.width,G=e.height}let W=!p&&("lazy"===f||void 0===f);(!(h="string"==typeof h?h:H)||h.startsWith("data:")||h.startsWith("blob:"))&&(g=!0,W=!1),c.unoptimized&&(g=!0),V&&!c.dangerouslyAllowSVG&&h.split("?",1)[0].endsWith(".svg")&&(g=!0);let U=s(_),X=Object.assign(v?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:z,objectPosition:E}:{},L?{}:{color:"transparent"},j),q=T||"empty"===S?null:"blur"===S?'url("data:image/svg+xml;charset=utf-8,'+(0,n.getImageBlurSvg)({widthInt:K,heightInt:G,blurWidth:d,blurHeight:u,blurDataURL:k||"",objectFit:X.objectFit})+'")':'url("'+S+'")',$=i.includes(X.objectFit)?"fill"===X.objectFit?"100% 100%":"cover":X.objectFit,Y=q?{backgroundSize:$,backgroundPosition:X.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:q}:{},Z=function(e){let{config:t,src:l,unoptimized:n,width:r,quality:i,sizes:a,loader:s}=e;if(n)return{src:l,srcSet:void 0,sizes:void 0};let{widths:o,kind:c}=function(e,t,l){let{deviceSizes:n,allSizes:r}=e;if(l){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let n;n=e.exec(l);)t.push(parseInt(n[2]));if(t.length){let e=.01*Math.min(...t);return{widths:r.filter(t=>t>=n[0]*e),kind:"w"}}return{widths:r,kind:"w"}}return"number"!=typeof t?{widths:n,kind:"w"}:{widths:[...new Set([t,2*t].map(e=>r.find(t=>t>=e)||r[r.length-1]))],kind:"x"}}(t,r,a),d=o.length-1;return{sizes:a||"w"!==c?a:"100vw",srcSet:o.map((e,n)=>s({config:t,src:l,quality:i,width:e})+" "+("w"===c?e:n+1)+c).join(", "),src:s({config:t,src:l,quality:i,width:o[d]})}}({config:c,src:h,unoptimized:g,width:K,quality:U,sizes:m,loader:J});return{props:{...M,loading:W?"lazy":f,fetchPriority:P,width:K,height:G,decoding:R,className:y,style:{...X,...Y},sizes:Z.sizes,srcSet:Z.srcSet,src:b||Z.src},meta:{unoptimized:g,priority:p,placeholder:S,fill:v}}}},65545:(e,t)=>{"use strict";function l(e){let{widthInt:t,heightInt:l,blurWidth:n,blurHeight:r,blurDataURL:i,objectFit:a}=e,s=n?40*n:t,o=r?40*r:l,c=s&&o?"viewBox='0 0 "+s+" "+o+"'":"";return"%3Csvg xmlns='http://www.w3.org/2000/svg' "+c+"%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='"+(c?"none":"contain"===a?"xMidYMid":"cover"===a?"xMidYMid slice":"none")+"' style='filter: url(%23b);' href='"+i+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return l}})},70107:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>T});var n=l(65321),r=l(97109),i=l(1873),a=l.n(i),s=l(86109),o=l(35292),c=l(76506),d=l(33442),u=l(11702),h=l(9137),m=l(21289),g=l(68787),p=l(56985),f=l(49604),y=l(88762),_=l(85493),x=l(84253),w=l(85114),v=l(58569),j=l(7576),b=l(58970),C=l(88483);function A(){return(A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e}).apply(this,arguments)}let S=r.forwardRef((e,t)=>r.createElement(C.A,A({},e,{ref:t,icon:b.A})));var k=l(6578),P=l(79059),R=l(45551),I=l(14569),z=l.n(I);let{Paragraph:E}=o.A;function O(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 M(e,t){let l=t.trim()?[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length):[];if(0===l.length)return e;let r=RegExp("(".concat(l.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(r).map((e,t)=>l.some(t=>t.toLowerCase()===e.toLowerCase())?(0,n.jsx)("mark",{children:e},t):e)}function D(e,t,l){return null==t||""===t||Array.isArray(t)&&0===t.length?null:(0,n.jsx)(c.A.Item,{label:e,children:Array.isArray(t)?(0,n.jsx)(d.A,{wrap:!0,children:t.map(e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>null==l?void 0:l(String(e)),children:String(e)},String(e)))}):String(t)})}function L(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return e.map((e,l)=>({key:"".concat(t,"-").concat(l),name:e}))}function T(){var e,t,l,i,o;let b=(0,P.Vr)(),C=(0,s.useRouter)(),A="string"==typeof C.query.relativePath?C.query.relativePath:"",[I,T]=(0,r.useState)(),[F,B]=(0,r.useState)(!1),[J,V]=(0,r.useState)(""),[H,K]=(0,r.useState)(!1),[G,W]=(0,r.useState)(""),[U,X]=(0,r.useState)([]);(0,r.useEffect)(()=>{A&&(B(!0),V(""),(0,k.xC)(A).then(T).catch(e=>{T(void 0),V(e instanceof Error?e.message:"文件详情加载失败")}).finally(()=>B(!1)))},[A]);let q=(0,r.useMemo)(()=>(function(e){let t=O(null==e?void 0:e.file.metadataJson);return"object"==typeof t.extraction&&t.extraction?t.extraction:t})(I),[I]),$=N(q.layerNames);(0,r.useEffect)(()=>{X($)},[null==I?void 0:I.file.relativePath,$.join("|")]);let Y=G.trim().toLowerCase(),Z=(0,r.useMemo)(()=>{var e;return I&&Y?I.chunks.filter(e=>{let t=O(e.metadataJson);return[e.content,e.sectionTitle,t.rowRange,t.chunkKind,t.parentId,JSON.stringify(t)].some(e=>String(null!=e?e:"").toLowerCase().includes(Y))}):null!=(e=null==I?void 0:I.chunks)?e:[]},[I,Y]),Q=(0,r.useMemo)(()=>{var e;return I&&Y?I.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(Y))):null!=(e=null==I?void 0:I.parents)?e:[]},[I,Y]),ee=async()=>{if(A){K(!0);try{let e=await (0,k.HC)(A);e.detail&&T(e.detail),h.Ay.success("文件索引已重建")}finally{K(!1)}}},et=async e=>{e&&(await navigator.clipboard.writeText(e),h.Ay.success("已复制"))},el=async e=>{A&&(await (0,k.tn)(A,e),h.Ay.success("file"===e?"已请求打开文件":"已请求打开目录"))},en=(0,r.useMemo)(()=>{var e,t,l,r,i;let s=[],o=N(q.sheetNames),h=N(q.columnNames),y=N(q.layerNames),_=N(q.blockNames),x=N(q.entityTypes),w=N(q.productNames),v=N(q.materialNames),j=N(q.entityNames),b=N(q.dataPaths),C=o.length>0||h.length>0||null!=q.rowCount||null!=q.columnCount||null!=q.formulaCount||null!=q.mergeCount,A=L(h,"column"),S=(null!=(e=null==I?void 0:I.chunks)?e:[]).map(e=>O(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,t)=>({key:"row-".concat(t),name:e})),k=(null!=(t=null==I?void 0:I.chunks)?t:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>e.includes("|")).slice(0,80).map((e,t)=>({key:"grid-".concat(t),cells:e.split("|").map(e=>e.trim()).filter(Boolean)}));(C||A.length>0||S.length>0||k.length>0)&&s.push({key:"table",label:"表格",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[C&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[D("Sheet",o,W),D("表头",h,W),D("行数",q.rowCount),D("列数",q.columnCount),D("公式数",q.formulaCount),D("合并单元格",q.mergeCount)]}),A.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:A,columns:[{title:"列名",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(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:()=>W(String(e)),children:["行 ",String(e)]})}]}),k.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:k,pagination:{pageSize:10},columns:[{title:"表格网格预览",dataIndex:"cells",render:e=>(0,n.jsx)(d.A,{wrap:!0,children:e.map((e,t)=>(0,n.jsx)(u.A,{children:e},"".concat(e,"-").concat(t)))})}]})]})});let P=y.length>0||_.length>0||x.length>0||w.length>0||v.length>0||j.length>0,R=[...L(y,"layer").map(e=>({...e,type:"图层"})),...L(x,"entity").map(e=>({...e,type:"实体类型"})),...L(_,"block").map(e=>({...e,type:"块/符号"}))];(P||y.length>0||R.length>0)&&s.push({key:"drawing",label:"图纸",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[P&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[D("图层",y,W),D("块/符号",_,W),D("实体类型",x,W),D("产品/零件",w,W),D("材料",v,W),D("实体名称",j,W)]}),y.length>0&&(0,n.jsxs)(g.A,{size:"small",title:"图层开关 / 图纸预览",children:[(0,n.jsx)(p.A.Group,{value:U,options:y.map(e=>({label:e,value:e})),onChange:e=>X(e.map(String))}),(0,n.jsx)("div",{className:z().drawingPreview,children:U.map(e=>(0,n.jsx)(u.A,{color:"blue",children:e},e))})]}),R.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:R,columns:[{title:"类型",dataIndex:"type",width:120},{title:"名称",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})}]})]})});let M=(null!=(l=null==I?void 0:I.chunks)?l:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>/^[\w.[\]-]+\s*[:=]/u.test(e)).slice(0,200).map((e,t)=>{var l,n,r,i;let a=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(t),path:null!=(r=null==a||null==(l=a[1])?void 0:l.trim())?r:e,value:null!=(i=null==a||null==(n=a[2])?void 0:n.trim())?i:""}});(b.length>0||M.length>0)&&s.push({key:"data",label:"数据路径",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[b.length>0&&(0,n.jsx)(f.A,{defaultExpandAll:!0,treeData:function(e){let t=new Map;for(let l of e){let e=t;for(let t of l.replace(/\[(\d+)\]/gu,".$1").split(".").filter(Boolean))e.has(t)||e.set(t,new Map),e=e.get(t)}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return[...e.entries()].map(e=>{let[n,r]=e;return{title:n,key:t?"".concat(t,".").concat(n):n,children:l(r,t?"".concat(t,".").concat(n):n)}})};return l(t)}(b),onSelect:e=>{var t;return W(String(null!=(t=e[0])?t:""))}}),M.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:M,pagination:{pageSize:20},columns:[{title:"Path",dataIndex:"path",width:260,render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})},{title:"Value",dataIndex:"value",render:e=>(0,n.jsx)("span",{className:"break-all",children:String(e)})}]})]})});let T=null!=q.ocrRecommended||null!=q.ocrReason||null!=q.ocrProvider||null!=q.ocrLanguages||null!=q.ocrTextLength||null!=q.pdfPageOcrSupported||null!=q.ocrPageCount||null!=q.pdfOcrPageLimit||null!=q.pdfRenderer,F=(null!=(r=null==I?void 0:I.chunks)?r:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,t,l,n)=>{var r,i,a;return l%2==0&&e.push({key:"page-".concat(t),page:t,text:null!=(a=null==(i=n[l+1])||null==(r=i.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:r.trim())?a:""}),e},[]),B=(null==I?void 0:I.file.format)==="pdf";return(T||B||F.length>0)&&s.push({key:"ocr",label:"OCR/PDF",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[T&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[D("OCR 建议",q.ocrRecommended),D("OCR 原因",q.ocrReason),D("OCR 引擎",q.ocrProvider),D("OCR 语言",q.ocrLanguages),D("OCR 文本长度",q.ocrTextLength),D("PDF 页面 OCR 支持",q.pdfPageOcrSupported),D("PDF OCR 页数",q.ocrPageCount),D("PDF OCR 页数上限",q.pdfOcrPageLimit),D("PDF 渲染器",q.pdfRenderer)]}),B&&(0,n.jsx)("div",{className:z().pdfPreviewStrip,children:Array.from({length:Math.min(Number(null!=(i=q.ocrPageCount)?i:1)||1,6)},(e,t)=>(0,n.jsx)(a(),{width:220,height:320,src:"/api/kb/files/preview-pdf-page?relativePath=".concat(encodeURIComponent(I.file.relativePath),"&page=").concat(t+1),alt:"PDF 第 ".concat(t+1," 页"),unoptimized:!0},t))}),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)(E,{ellipsis:{rows:4,expandable:!0,symbol:"展开"},children:String(e)})}]})]})}),s},[q,I,U]),er=[{title:"序号",key:"index",width:70,render:(e,t,l)=>l+1},{title:b("knowledge.chunkIndex"),dataIndex:"chunkIndex",width:90,render:e=>String(e)},{title:b("knowledge.chunkType"),width:110,render:(e,t)=>{var l;return(0,n.jsx)(u.A,{children:String(null!=(l=O(t.metadataJson).chunkKind)?l:t.category)})}},{title:b("knowledge.sectionOrRange"),width:220,render:(e,t)=>{let l=O(t.metadataJson),r="string"==typeof l.rowRange?l.rowRange:void 0;return(0,n.jsxs)(d.A,{wrap:!0,children:[t.sectionTitle?(0,n.jsx)(u.A,{color:"cyan",children:t.sectionTitle}):null,r?(0,n.jsxs)(u.A,{color:"gold",children:["行 ",r]}):null]})}},{title:"Token",dataIndex:"tokenCount",width:90},{title:b("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(E,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:z().searchContent,children:M(t.content,G)})}],ei=[{title:"序号",key:"index",width:70,render:(e,t,l)=>l+1},{title:b("knowledge.parentChunkId"),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:b("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(E,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:z().searchContent,children:M(t.content,G)})}];return F?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(y.A,{active:!0,paragraph:{rows:1}}),(0,n.jsx)(g.A,{size:"small",children:(0,n.jsx)(y.A,{active:!0,paragraph:{rows:6}})}),(0,n.jsx)(g.A,{size:"small",children:(0,n.jsx)(y.A,{active:!0,paragraph:{rows:4}})})]}):J?(0,n.jsx)(_.A,{type:"error",showIcon:!0,message:"文件详情加载失败",description:J}):I?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(w.Ay,{icon:(0,n.jsx)(S,{}),href:"/knowledge/files",size:"small",style:{marginBottom:12},children:"返回文件列表"}),(0,n.jsxs)("div",{className:z().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)(w.Ay,{onClick:()=>{et(null==I?void 0:I.absolutePath)},children:"复制原文件路径"}),(0,n.jsx)(w.Ay,{onClick:()=>{et(null==I?void 0:I.directory)},children:"复制所在目录"}),(0,n.jsx)(w.Ay,{onClick:()=>{el("file")},children:"打开文件"}),(0,n.jsx)(w.Ay,{onClick:()=>{el("directory")},children:"打开目录"}),"pdf"===I.file.format?(0,n.jsx)(w.Ay,{loading:H,onClick:()=>{ee()},children:"重新 OCR"}):null,(0,n.jsx)(w.Ay,{type:"primary",loading:H,onClick:()=>{ee()},children:"重建该文件索引"})]})]})]}),(0,n.jsx)(g.A,{size:"small",title:"基础信息",children:(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[(0,n.jsx)(c.A.Item,{label:"路径",children:I.file.relativePath}),(0,n.jsx)(c.A.Item,{label:"原文件",children:null!=(e=I.absolutePath)?e:"-"}),(0,n.jsx)(c.A.Item,{label:"所在目录",children:null!=(t=I.directory)?t:"-"}),(0,n.jsxs)(c.A.Item,{label:"分类",children:[(0,n.jsx)(u.A,{children:(0,R.Jm)(I.file.category)})," ",(0,n.jsx)(u.A,{children:I.file.format})]}),(0,n.jsx)(c.A.Item,{label:"大小",children:(0,R.z3)(I.file.fileSize)}),(0,n.jsx)(c.A.Item,{label:"切片数",children:I.file.chunkCount}),(0,n.jsx)(c.A.Item,{label:"状态",children:I.file.status}),(0,n.jsx)(c.A.Item,{label:"解析模式",children:String(null!=(l=q.extractionMode)?l:"-")}),(0,n.jsx)(c.A.Item,{label:"覆盖范围",children:String(null!=(i=q.contentCoverage)?i:"-")}),(0,n.jsx)(c.A.Item,{label:"正文长度",children:String(null!=(o=q.textLength)?o:"-")})]})}),en.length>0&&(0,n.jsx)(g.A,{size:"small",title:"结构化信息",children:(0,n.jsx)(v.A,{items:en})}),(0,n.jsx)(g.A,{size:"small",title:"详情筛选",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[(0,n.jsx)(j.A,{allowClear:!0,value:G,onChange:e=>W(e.target.value),placeholder:"筛选 rowRange、图层、实体、data path、section、chunk 内容"}),G?(0,n.jsxs)(d.A,{wrap:!0,children:[(0,n.jsxs)(u.A,{color:"blue",children:[b("knowledge.parentMatches")," ",Q.length]}),(0,n.jsxs)(u.A,{color:"green",children:[b("knowledge.childMatches")," ",Z.length]}),(0,n.jsxs)(u.A,{color:"purple",children:[b("knowledge.filterTerm")," ",G]})]}):null]})}),(0,n.jsxs)(g.A,{size:"small",title:"".concat(b("knowledge.parentChunks")," (").concat(Q.length,"/").concat(I.parents.length,")"),children:[(0,n.jsx)(_.A,{type:"info",showIcon:!0,message:b("knowledge.parentChunkHint"),style:{marginBottom:12}}),(0,n.jsx)(m.A,{rowKey:"id",columns:ei,dataSource:Q,pagination:{pageSize:10},size:"small"})]}),(0,n.jsx)(g.A,{size:"small",title:"".concat(b("knowledge.childChunks")," (").concat(Z.length,"/").concat(I.chunks.length,")"),children:(0,n.jsx)(m.A,{rowKey:"id",columns:er,dataSource:Z,pagination:{pageSize:20},size:"small"})})]}):(0,n.jsx)(x.A,{description:"请选择文件"})}},91952:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var l in t)Object.defineProperty(e,l,{enumerable:!0,get:t[l]})}(t,{default:function(){return o},getImageProps:function(){return s}});let n=l(34007),r=l(62956),i=l(49952),a=n._(l(4632));function s(e){let{props:t}=(0,r.getImgProps)(e,{defaultLoader:a.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,l]of Object.entries(t))void 0===l&&delete t[e];return{props:t}}let o=i.Image}},e=>{e.O(0,[433,787,576,985,150,289,506,861,636,593,792],()=>e(e.s=37690)),_N_E=e.O()}]);
|