@customize-agent/server 4.0.79 → 4.0.81
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 +7 -7
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/chunks/6315.js +126 -0
- package/.next/server/chunks/7899.js +1 -1
- package/.next/server/chunks/8204.js +1 -1
- package/.next/server/chunks/8661.js +5 -0
- 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/context.js +7 -7
- 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 +3 -3
- 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/templates.js +1 -1
- package/.next/server/pages/api/documents/templates.js.nft.json +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 +27 -27
- package/.next/static/chunks/466-1cd359f130473697.js +1 -0
- package/.next/static/chunks/pages/{_app-f06a3dbee23ac3b7.js → _app-e1434faf3490a025.js} +1 -1
- package/.next/static/chunks/pages/context/long-term-29cbf51a281951d9.js +1 -0
- package/.next/static/chunks/pages/document-roles-60f29e52f817dc11.js +1 -0
- package/.next/static/chunks/pages/documents-19de2ee3e879a1c1.js +1 -0
- package/.next/static/{aKLpMs_cEbuYMIgEW2ytH → s7N5y_UYXU2QdjCnGHipC}/_buildManifest.js +1 -1
- package/messages/en-US.json +0 -1
- package/messages/zh-CN.json +0 -1
- package/package.json +4 -4
- package/.next/server/chunks/5247.js +0 -144
- package/.next/static/chunks/496-4fb9a063790e65ff.js +0 -1
- package/.next/static/chunks/pages/context/long-term-994425812e118c6c.js +0 -1
- package/.next/static/chunks/pages/document-roles-fd02980db151650c.js +0 -1
- package/.next/static/chunks/pages/documents-9209f54ac7717b41.js +0 -1
- /package/.next/static/{aKLpMs_cEbuYMIgEW2ytH → s7N5y_UYXU2QdjCnGHipC}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[496],{2256:(e,t,n)=>{n.d(t,{A:()=>r});let r=n(25341).A},8579:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(97109),o=n(95008),l=n(88483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(l.A,a({},e,{ref:t,icon:o.A})))},10218:(e,t,n)=>{n.d(t,{A:()=>v,H:()=>p});var r=n(97109),o=n(4932),l=n(42644);let a=e=>"object"==typeof e&&null!=e&&1===e.nodeType,i=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,c=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return i(n.overflowY,t)||i(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},s=(e,t,n,r,o,l,a,i)=>l<e&&a>t||l>e&&a<t?0:l<=e&&i<=n||a>=t&&i>=n?l-e-r:a>t&&i<n||l<e&&i>n?a-t+o:0,d=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},f=(e,t)=>{var n,r,o,l;if("undefined"==typeof document)return[];let{scrollMode:i,block:f,inline:h,boundary:u,skipOverflowHiddenElements:p}=t,m="function"==typeof u?u:e=>e!==u;if(!a(e))throw TypeError("Invalid target");let v=document.scrollingElement||document.documentElement,g=[],b=e;for(;a(b)&&m(b);){if((b=d(b))===v){g.push(b);break}null!=b&&b===document.body&&c(b)&&!c(document.documentElement)||null!=b&&c(b,p)&&g.push(b)}let y=null!=(r=null==(n=window.visualViewport)?void 0:n.width)?r:innerWidth,w=null!=(l=null==(o=window.visualViewport)?void 0:o.height)?l:innerHeight,{scrollX:A,scrollY:$}=window,{height:H,width:z,top:E,right:M,bottom:O,left:j}=e.getBoundingClientRect(),{top:V,right:x,bottom:I,left:L}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),R="start"===f||"nearest"===f?E-V:"end"===f?O+I:E+H/2-V+I,C="center"===h?j+z/2-L+x:"end"===h?M+x:j-L,N=[];for(let e=0;e<g.length;e++){let t=g[e],{height:n,width:r,top:o,right:l,bottom:a,left:d}=t.getBoundingClientRect();if("if-needed"===i&&E>=0&&j>=0&&O<=w&&M<=y&&(t===v&&!c(t)||E>=o&&O<=a&&j>=d&&M<=l))break;let u=getComputedStyle(t),p=parseInt(u.borderLeftWidth,10),m=parseInt(u.borderTopWidth,10),b=parseInt(u.borderRightWidth,10),V=parseInt(u.borderBottomWidth,10),x=0,I=0,L="offsetWidth"in t?t.offsetWidth-t.clientWidth-p-b:0,k="offsetHeight"in t?t.offsetHeight-t.clientHeight-m-V:0,B="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,S="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(v===t)x="start"===f?R:"end"===f?R-w:"nearest"===f?s($,$+w,w,m,V,$+R,$+R+H,H):R-w/2,I="start"===h?C:"center"===h?C-y/2:"end"===h?C-y:s(A,A+y,y,p,b,A+C,A+C+z,z),x=Math.max(0,x+$),I=Math.max(0,I+A);else{x="start"===f?R-o-m:"end"===f?R-a+V+k:"nearest"===f?s(o,a,n,m,V+k,R,R+H,H):R-(o+n/2)+k/2,I="start"===h?C-d-p:"center"===h?C-(d+r/2)+L/2:"end"===h?C-l+b+L:s(d,l,r,p,b+L,C,C+z,z);let{scrollLeft:e,scrollTop:i}=t;x=0===S?0:Math.max(0,Math.min(i+x/S,t.scrollHeight-n/S+k)),I=0===B?0:Math.max(0,Math.min(e+I/B,t.scrollWidth-r/B+L)),R+=i-x,C+=e-I}N.push({el:t,top:x,left:I})}return N};var h=n(26047),u=n(44624);function p(e){return(0,u.$r)(e).join("_")}function m(e,t){let n=t.getFieldInstance(e),r=(0,l.rb)(n);if(r)return r;let o=(0,u.kV)((0,u.$r)(e),t.__INTERNAL__.name);if(o)return document.getElementById(o)}function v(e){let[t]=(0,o.mN)(),n=r.useRef({}),l=r.useMemo(()=>e??{...t,__INTERNAL__:{itemRef:e=>t=>{let r=p(e);t?n.current[r]=t:delete n.current[r]}},scrollToField:(e,t={})=>{let{focus:n,...r}=t,o=m(e,l);o&&(!function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let n=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(f(e,t));let r="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:o,top:l,left:a}of f(e,!1===t?{block:"end",inline:"nearest"}:t===Object(t)&&0!==Object.keys(t).length?t:{block:"start",inline:"nearest"})){let e=l-n.top+n.bottom,t=a-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}(o,{scrollMode:"if-needed",block:"nearest",...r}),n&&l.focusField(e))},focusField:e=>{let t=l.getFieldInstance(e);(0,h.Tn)(t?.focus)?t.focus():m(e,l)?.focus?.()},getFieldInstance:e=>{let t=p(e);return n.current[t]}},[e,t]);return[l]}},12887:(e,t)=>{t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},15437:(e,t,n)=>{n.d(t,{A:()=>r});let r=e=>{let{componentCls:t,antCls:n,motionDurationMid:r,motionEaseInOut:o}=e;return{[t]:{[`${n}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`${["height","opacity"].map(e=>`${e} ${r} ${o}`).join(", ")} !important`}},[`${n}-motion-collapse`]:{overflow:"hidden",transition:`${["height","opacity"].map(e=>`${e} ${r} ${o}`).join(", ")} !important`}}}}},20966:(e,t)=>{t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"}},25345:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(97109),o=n(99729),l=n(88483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(l.A,a({},e,{ref:t,icon:o.A})))},26631:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(97109),o=n(12887),l=n(88483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(l.A,a({},e,{ref:t,icon:o.A})))},38770:(e,t,n)=>{n.d(t,{A:()=>r});let r=n(51916).A},43094:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(97109),o=n(72870),l=n(88483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(l.A,a({},e,{ref:t,icon:o.A})))},43979:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(97109),o=n(59291),l=n(88483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(l.A,a({},e,{ref:t,icon:o.A})))},44624:(e,t,n)=>{n.d(t,{$r:()=>o,BS:()=>a,kV:()=>l});let r=["parentNode"];function o(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function l(e,t){if(!e.length)return;let n=e.join("_");return t?`${t}_${n}`:r.includes(n)?`form_item_${n}`:n}function a(e,t,n,r,o,l){let a=r;return void 0!==l?a=l:n.validating?a="validating":e.length?a="error":t.length?a="warning":(n.touched||o&&n.validated)&&(a="success"),a}},44858:(e,t)=>{t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 208H676V232h212v136zm0 224H676V432h212v160zM412 432h200v160H412V432zm200-64H412V232h200v136zm-476 64h212v160H136V432zm0-200h212v136H136V232zm0 424h212v136H136V656zm276 0h200v136H412V656zm476 136H676V656h212v136z"}}]},name:"table",theme:"outlined"}},53707:(e,t)=>{t.A={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"}},59291:(e,t)=>{t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM492 400h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0 144h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0 144h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zM340 368a40 40 0 1080 0 40 40 0 10-80 0zm0 144a40 40 0 1080 0 40 40 0 10-80 0zm0 144a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"profile",theme:"outlined"}},66284:(e,t)=>{t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2zM304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z"}}]},name:"picture",theme:"outlined"}},72870:(e,t)=>{t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M120 230h496c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm0 424h496c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm784 140H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-424H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z"}}]},name:"align-left",theme:"outlined"}},75548:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(97109),o=n(66284),l=n(88483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(l.A,a({},e,{ref:t,icon:o.A})))},80042:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(97109),o=n(44858),l=n(88483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(l.A,a({},e,{ref:t,icon:o.A})))},81668:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(97109),o=n(96724),l=n(88483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(l.A,a({},e,{ref:t,icon:o.A})))},84662:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(97109),o=n(20966),l=n(88483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(l.A,a({},e,{ref:t,icon:o.A})))},85493:(e,t,n)=>{n.d(t,{A:()=>x});var r=n(97109),o=n(59188),l=n(4216),a=n(45042),i=n(97137),c=n(62188),s=n(67189),d=n(42644),f=n(3638),h=n(92162),u=n(26047),p=n(74567),m=n(15561),v=n(7961),g=n(10540);let b=(e,t,n)=>({background:e,[`${n}-icon`]:{color:t}}),y=(0,g.OF)("Alert",e=>[(e=>{let{componentCls:t,motionDurationSlow:n,marginXS:r,marginSM:o,fontSize:l,fontSizeLG:a,lineHeight:i,borderRadiusLG:c,motionEaseInOutCirc:s,withDescriptionIconSize:d,colorText:f,colorTextHeading:h,withDescriptionPadding:u,defaultPadding:p,lineWidth:g,lineType:b,colorSuccessBorder:y,colorWarningBorder:w,colorErrorBorder:A,colorInfoBorder:$}=e;return{[t]:{...(0,v.dF)(e),position:"relative",display:"flex",alignItems:"center",padding:p,wordWrap:"break-word",borderRadius:c,borderWidth:(0,m.zA)(g),borderStyle:b,[`&${t}-success`]:{borderColor:y},[`&${t}-info`]:{borderColor:$},[`&${t}-warning`]:{borderColor:w},[`&${t}-error`]:{borderColor:A},[`&${t}-filled`]:{borderColor:"transparent"},[`&${t}-rtl`]:{direction:"rtl"},[`${t}-section`]:{flex:1,minWidth:0},[`${t}-icon`]:{marginInlineEnd:r,lineHeight:0},"&-description":{display:"none",fontSize:l,lineHeight:i},"&-title":{color:h},[`&${t}-motion-leave`]:{overflow:"hidden",opacity:1,transition:["max-height","opacity","padding-top","padding-bottom","margin-bottom"].map(e=>`${e} ${n} ${s}`).join(", ")},[`&${t}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0},[`&${t}-with-description`]:{alignItems:"flex-start",padding:u,[`${t}-icon`]:{marginInlineEnd:o,fontSize:d,lineHeight:0},[`${t}-title`]:{display:"block",marginBottom:r,color:h,fontSize:a},[`${t}-description`]:{display:"block",color:f}},[`&${t}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}}})(e),(e=>{let{componentCls:t,colorSuccess:n,colorSuccessBg:r,colorWarning:o,colorWarningBg:l,colorError:a,colorErrorBg:i,colorInfo:c,colorInfoBg:s}=e;return{[t]:{"&-success":b(r,n,t),"&-info":b(s,c,t),"&-warning":b(l,o,t),"&-error":{...b(i,a,t),[`${t}-description > pre`]:{margin:0,padding:0}}}}})(e),(e=>{let{componentCls:t,iconCls:n,motionDurationMid:r,marginXS:o,fontSizeIcon:l,colorIcon:a,colorIconHover:i}=e;return{[t]:{[`${t}-actions`]:{marginInlineStart:o},[`${t}-close-icon`]:{marginInlineStart:o,padding:0,overflow:"hidden",fontSize:l,lineHeight:(0,m.zA)(l),backgroundColor:"transparent",border:"none",cursor:"pointer",...(0,v.K8)(e),[`${n}-close`]:{color:a,transition:`color ${r}`,"&:hover":{color:i}}},"&-close-text":{color:a,transition:`color ${r}`,"&:hover":{color:i}}}}})(e)],e=>({withDescriptionIconSize:e.fontSizeHeading3,defaultPadding:`${e.paddingContentVerticalSM}px 12px`,withDescriptionPadding:`${e.paddingMD}px ${e.paddingContentHorizontalLG}px`})),w=e=>{let{icon:t,type:n,className:a,style:s,successIcon:d,infoIcon:f,warningIcon:h,errorIcon:u}=e,p={success:d??r.createElement(o.A,null),info:f??r.createElement(c.A,null),error:u??r.createElement(l.A,null),warning:h??r.createElement(i.A,null)};return r.createElement("span",{className:a,style:s},t??p[n])},A=e=>{let{isClosable:t,prefixCls:n,closeIcon:o,handleClose:l,ariaProps:i,className:c,style:s}=e,d=!0===o||void 0===o?r.createElement(a.A,null):o;return t?r.createElement("button",{type:"button",onClick:l,className:(0,f.$)(`${n}-close-icon`,c),tabIndex:0,style:s,...i},d):null},$=r.forwardRef((e,t)=>{let{description:n,prefixCls:o,message:l,title:a,banner:i,className:c,rootClassName:m,style:v,onMouseEnter:g,onMouseLeave:b,onClick:$,afterClose:H,showIcon:z,closable:E,closeText:M,closeIcon:O,action:j,id:V,styles:x,classNames:I,...L}=e,R=a??l,[C,N]=r.useState(!1),k=r.useRef(null);r.useImperativeHandle(t,()=>({nativeElement:k.current}));let{getPrefixCls:B,direction:S,variant:W,closable:_,closeIcon:F,className:P,style:T,classNames:D,styles:Q,successIcon:X,infoIcon:K,warningIcon:G,errorIcon:Y}=(0,p.TP)("alert"),q=B("alert",o),[J,U]=y(q),{onClose:Z,afterClose:ee}=(0,u.Qd)(E)?E:{},et=t=>{N(!0),(Z??e.onClose)?.(t)},en=r.useMemo(()=>void 0!==e.type?e.type:i?"warning":"info",[e.type,i]),er=e.variant??W??"outlined",eo=r.useMemo(()=>!!(0,u.Qd)(E)&&!!E.closeIcon||!!M||("boolean"==typeof E?E:!!(!1!==O&&(0,u.R)(O))||!!_),[M,O,E,_]),el=!!i&&void 0===z||z,ea={...e,prefixCls:q,variant:er,type:en,showIcon:el,closable:eo},ei=(0,h.XT)(T),ec=(0,h.XT)(v),[es,ed]=(0,h.AV)([D,I],[Q,ei,x,ec],{props:ea}),ef=(0,f.$)(q,`${q}-${en}`,`${q}-${er}`,{[`${q}-with-description`]:!!n,[`${q}-no-icon`]:!el,[`${q}-banner`]:!!i,[`${q}-rtl`]:"rtl"===S},P,c,m,es.root,U,J),eh=(0,d.KE)(L,{aria:!0,data:!0}),eu=r.useMemo(()=>(0,u.Qd)(E)&&E.closeIcon?E.closeIcon:M||(void 0!==O?O:(0,u.Qd)(_)&&_.closeIcon?_.closeIcon:F),[O,E,_,M,F]),ep=r.useMemo(()=>{let e=E??_;return(0,u.Qd)(e)?(0,d.KE)(e,{data:!0,aria:!0}):{}},[E,_]);return r.createElement(s.Ay,{visible:!C,motionName:`${q}-motion`,motionAppear:!1,motionEnter:!1,onLeaveStart:e=>({maxHeight:e.offsetHeight}),onLeaveEnd:ee??H},({className:t,style:o},l)=>r.createElement("div",{id:V,ref:(0,d.K4)(k,l),"data-show":!C,className:(0,f.$)(ef,t),style:{...ed.root,...o},onMouseEnter:g,onMouseLeave:b,onClick:$,role:"alert",...eh},el?r.createElement(w,{className:(0,f.$)(`${q}-icon`,es.icon),style:ed.icon,description:n,icon:e.icon,prefixCls:q,type:en,successIcon:X,infoIcon:K,warningIcon:G,errorIcon:Y}):null,r.createElement("div",{className:(0,f.$)(`${q}-section`,es.section),style:ed.section},R?r.createElement("div",{className:(0,f.$)(`${q}-title`,es.title),style:ed.title},R):null,n?r.createElement("div",{className:(0,f.$)(`${q}-description`,es.description),style:ed.description},n):null),j?r.createElement("div",{className:(0,f.$)(`${q}-actions`,es.actions),style:ed.actions},j):null,r.createElement(A,{className:es.close,style:ed.close,isClosable:eo,prefixCls:q,closeIcon:eu,handleClose:et,ariaProps:ep})))});var H=n(41113),z=n(49939),E=n(90218),M=n(13076),O=n(83784),j=n(15472);let V=function(e){function t(){var e,n,r;return(0,H.A)(this,t),n=t,r=arguments,n=(0,E.A)(n),(e=(0,O.A)(this,(0,M.A)()?Reflect.construct(n,r||[],(0,E.A)(this).constructor):n.apply(this,r))).state={error:void 0,info:{}},e}return(0,j.A)(t,e),(0,z.A)(t,[{key:"componentDidCatch",value:function(e,t){this.setState({error:e,info:t})}},{key:"render",value:function(){let{message:e,title:t,description:n,id:o,children:l}=this.props,{error:a,info:i}=this.state,c=t??e,s=i?.componentStack||null,d=(0,u.R)(c)?c:a?.toString(),f=(0,u.R)(n)?n:s;return a?r.createElement($,{id:o,type:"error",title:d,description:r.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},f)}):l}}])}(r.PureComponent);$.ErrorBoundary=V;let x=$},92123:(e,t)=>{t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"}},95008:(e,t)=>{t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M904 512h-56c-4.4 0-8 3.6-8 8v320H184V184h320c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V520c0-4.4-3.6-8-8-8z"}},{tag:"path",attrs:{d:"M355.9 534.9L354 653.8c-.1 8.9 7.1 16.2 16 16.2h.4l118-2.9c2-.1 4-.9 5.4-2.3l415.9-415c3.1-3.1 3.1-8.2 0-11.3L785.4 114.3c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-415.8 415a8.3 8.3 0 00-2.3 5.6zm63.5 23.6L779.7 199l45.2 45.1-360.5 359.7-45.7 1.1.7-46.4z"}}]},name:"form",theme:"outlined"}},96091:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(97109),o=n(53707),l=n(88483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(l.A,a({},e,{ref:t,icon:o.A})))},96651:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(97109),o=n(92123),l=n(88483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(l.A,a({},e,{ref:t,icon:o.A})))},96724:(e,t)=>{t.A={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"}}]},name:"export",theme:"outlined"}},99729:(e,t)=>{t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M296 250c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm184 144H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm-48 458H208V148h560v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h264c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm440-88H728v-36.6c46.3-13.8 80-56.6 80-107.4 0-61.9-50.1-112-112-112s-112 50.1-112 112c0 50.7 33.7 93.6 80 107.4V764H520c-8.8 0-16 7.2-16 16v152c0 8.8 7.2 16 16 16h352c8.8 0 16-7.2 16-16V780c0-8.8-7.2-16-16-16zM646 620c0-27.6 22.4-50 50-50s50 22.4 50 50-22.4 50-50 50-50-22.4-50-50zm180 266H566v-60h260v60z"}}]},name:"audit",theme:"outlined"}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
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,375,102,289,455,932,636,593,792],()=>e(e.s=36382)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
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:()=>Y});var i=r(65321),n=r(97109),t=r(35292),s=r(17807),o=r(63455),a=r(11702),c=r(84253),d=r(68787),p=r(85114),x=r(26171),m=r(33442),h=r(57271),u=r(85493),f=r(34052),y=r(7576),g=r(2256),j=r(38770),A=r(58569),v=r(25345),b=r(43979),w=r(80042),I=r(75548),S=r(26631),z=r(84662),T=r(30486),R=r(99650),k=r(8263),C=r(84742),_=r(43094),B=r(8579),F=r(81668),N=r(58209),O=r(96091),W=r(54746),E=r(96651),D=r(60470),H=r(6578),P=r(79059);let{Paragraph:L}=t.A,U={rule:(0,i.jsx)(v.A,{}),project_fact:(0,i.jsx)(b.A,{}),table:(0,i.jsx)(w.A,{}),drawing:(0,i.jsx)(I.A,{}),specification:(0,i.jsx)(S.A,{}),reference:(0,i.jsx)(z.A,{})},q={fact_extraction:(0,i.jsx)(T.A,{}),chapter_generation:(0,i.jsx)(R.A,{}),llm_review:(0,i.jsx)(k.A,{}),validation:(0,i.jsx)(C.A,{}),formatting:(0,i.jsx)(_.A,{}),reference:(0,i.jsx)(z.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"},Q={rule:"roles.ruleFile",project_fact:"roles.projectFactFile",table:"roles.tableFile",drawing:"roles.drawingFile",specification:"roles.specificationFile",reference:"roles.reference"},J={fact_extraction:"roles.factExtraction",chapter_generation:"roles.chapterGeneration",llm_review:"roles.llmReview",validation:"roles.validation",formatting:"roles.formatting",reference:"roles.reference"};function M(e,l){let r=new Blob([JSON.stringify(l,null,2)],{type:"application/json;charset=utf-8"}),i=URL.createObjectURL(r),n=document.createElement("a");n.href=i,n.download=e,n.click(),URL.revokeObjectURL(i)}function X(e){return e.trim().replace(/[\\/:*?"<>|]/g,"-").slice(0,80)||"untitled"}function K(e,l){return{type:"customize-agent.documentRoles",version:1,exportedAt:new Date().toISOString(),roles:e,configs:l}}function Y(){let e,l,r=(0,P.Vr)(),{message:t}=s.A.useApp(),[v]=o.A.useForm(),[b]=o.A.useForm(),[w,I]=(0,n.useState)([]),[z,T]=(0,n.useState)([]),[k,C]=(0,n.useState)([]),[_,Y]=(0,n.useState)(!1),[Z,$]=(0,n.useState)(!1),[ee,el]=(0,n.useState)(!1),[er,ei]=(0,n.useState)("file"),[en,et]=(0,n.useState)("custom"),[es,eo]=(0,n.useState)(!1),ea=(0,n.useRef)(null),ec=async()=>{let[e,l]=await Promise.all([(0,H.lv)(),(0,H.dx)()]);I(e.roles),T(e.configs),C(l)};(0,n.useEffect)(()=>{ec().catch(()=>t.error(r("common.error")))},[t,r]);let ed=()=>"all"===en||"custom"===en,ep=w.filter(ed),ex=z.filter(ed),em=ep.filter(e=>"file"===e.type),eh=ep.filter(e=>"prompt"===e.type),eu=w.filter(e=>"file"===e.type),ef=w.filter(e=>"prompt"===e.type),ey=async()=>{try{let e=await v.validateFields(),l="file"===e.type?{...e,resourceId:void 0,resourceIds:[]}:e,i=await (0,H.dg)(l);I(i.roles),T(i.configs),Y(!1),t.success(r("common.success"))}catch(e){t.error(r("common.error"))}},eg=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,H.NR)({...e,fileRoles:l(e.fileRoles),promptRoles:l(e.promptRoles)});I(i.roles),T(i.configs),$(!1),t.success(r("common.success"))}catch(e){t.error(r("common.error"))}},ej=async e=>{let l=await (0,H.FV)(e.type,e.id);I(l.roles),T(l.configs)},eA=async e=>{let l=await (0,H.dw)(e);I(l.roles),T(l.configs)},ev=async e=>{if(e){eo(!0);try{let l=JSON.parse(await e.text()),r=await fetch("/api/documents/roles?mode=import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw Error(await r.text());let i=await r.json();I(i.roles),T(i.configs),t.success("已导入 ".concat(i.importedRoles," 个角色、").concat(i.importedConfigs," 个配置"))}catch(e){t.error("导入失败,请确认 JSON 文件格式正确")}finally{eo(!1),ea.current&&(ea.current.value="")}}},eb=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)},ew=e=>{b.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[],builtIn:!1}),$(!0)},eI=e=>w.find(l=>l.id===e),eS=e=>{var l;return(null==e?void 0:e.type)==="prompt"?(null==(l=e.resourceIds)?void 0:l.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]:[]},ez=e=>{var l;return(null==(l=k.find(l=>l.id===e))?void 0:l.projectName)||e},eT=e=>(0,i.jsx)(a.A,{closable:e.closable,onClose:e.onClose,color:"purple",title:e.value,style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:ez(e.value)}),eR=(e,l)=>{let n="file"===l?"blue":"purple",t="file"===l?Q:J,s=[...e].sort((e,l)=>{var r,i;return Number(null!=(r=e.order)?r:0)-Number(null!=(i=l.order)?i:0)}).map(e=>eI(e.roleId)).filter(e=>!!e);return 0===s.length?(0,i.jsx)(c.A,{image:c.A.PRESENTED_IMAGE_SIMPLE,description:"file"===l?"暂未选择文件角色":"暂未选择提示词角色"}):(0,i.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:s.map((e,l)=>{var s,o;let c=eS(e),d="file"===e.type?null!=(s=e.processingType)?s:"":null!=(o=e.executionType)?o:"";return(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:8,background:"var(--colorBgContainer)",border:"1px solid var(--colorBorderSecondary)"},children:[(0,i.jsxs)(a.A,{color:n,style:{margin:0},children:["#",l+1]}),(0,i.jsx)("span",{style:{fontWeight:600,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),(0,i.jsx)(a.A,{style:{margin:0},children:r(t[d]||"roles.reference")}),"prompt"===e.type&&(0,i.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",c.length," 个提示词"]})]},e.id)})})},ek=e=>{if(!e)return null;let l=eS(e);return(0,i.jsxs)("div",{style:{marginTop:8,padding:8,borderRadius:8,background:"var(--colorFillQuaternary)",fontSize:12,color:"var(--colorTextSecondary)"},children:[e.description&&(0,i.jsx)("div",{style:{marginBottom:4*("prompt"===e.type)},children:e.description}),"prompt"===e.type&&(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[l.slice(0,4).map(e=>(0,i.jsx)(a.A,{title:e,style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:180,overflow:"hidden",textOverflow:"ellipsis"},children:ez(e)},e)),l.length>4&&(0,i.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",l.length-4]}),0===l.length&&(0,i.jsx)("span",{children:"未绑定提示词"})]})]})};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)(m.A,{children:[(0,i.jsx)(h.A,{value:en,onChange:et,style:{width:170},options:[{label:"我的配置 (".concat(w.length+z.length,")"),value:"custom"},{label:"全部来源 (".concat(w.length+z.length,")"),value:"all"}]}),(0,i.jsx)("input",{ref:ea,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:e=>{var l;ev(null==(l=e.target.files)?void 0:l[0])}}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(O.A,{}),loading:es,onClick:()=>{var e;return null==(e=ea.current)?void 0:e.click()},children:"导入"}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(F.A,{}),disabled:w.length+z.length===0,onClick:()=>{M("customize-document-roles-".concat(new Date().toISOString().slice(0,10),".json"),K(w,z)),t.success("已导出 ".concat(w.length," 个角色、").concat(z.length," 个配置"))},children:"导出全部"}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>eb(void 0,"file"),children:r("roles.newFileRole")}),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>eb(void 0,"prompt"),children:r("roles.newPromptRole")}),(0,i.jsx)(p.Ay,{type:"primary",icon:(0,i.jsx)(W.A,{}),onClick:()=>ew(),children:r("roles.newConfig")})]})]}),(0,i.jsx)(u.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)(p.Ay,{type:"link",size:"small",icon:ee?(0,i.jsx)(E.A,{}):(0,i.jsx)(D.A,{}),onClick:()=>el(!ee),style:{padding:"0 4px"},children:ee?"收起说明":"展开说明"})]}),description:ee?r("roles.plainGuideDesc"):void 0}),(0,i.jsx)(d.A,{size:"small",tabList:[{key:"file",label:"文件角色 (".concat(em.length,")")},{key:"prompt",label:"提示词角色 (".concat(eh.length,")")},{key:"configs",label:"项目角色配置 (".concat(ex.length,")")}],activeTabKey:er,onTabChange:ei,children:"configs"===er?0===ex.length?(0,i.jsx)(c.A,{description:r("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:ex.map(e=>{let l=e.fileRoles.map(e=>({...e,role:eI(e.roleId)})).filter(e=>e.role),n=e.promptRoles.map(e=>({...e,role:eI(e.roleId)})).filter(e=>e.role);return(0,i.jsxs)(d.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)(a.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)(p.Ay,{size:"small",icon:(0,i.jsx)(R.A,{}),onClick:()=>ew(e),children:"编辑"}),!e.builtIn&&(0,i.jsx)(p.Ay,{size:"small",icon:(0,i.jsx)(F.A,{}),onClick:()=>(e=>{let l=new Set([...e.fileRoles.map(e=>e.roleId),...e.promptRoles.map(e=>e.roleId)]);M("customize-role-config-".concat(X(e.name),"-").concat(new Date().toISOString().slice(0,10),".json"),K(w.filter(e=>l.has(e.id)&&!e.builtIn),[e])),t.success("已导出 1 个配置")})(e),children:"导出"}),(0,i.jsx)(x.A,{title:r("common.confirm"),onConfirm:()=>{eA(e.id)},children:(0,i.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(N.A,{})})})]})]}),e.description&&(0,i.jsx)(L,{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)(a.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),l.length>4&&(0,i.jsxs)(a.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,"): "]}),n.length>0?(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[n.slice(0,4).map(e=>(0,i.jsx)(a.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),n.length>4&&(0,i.jsxs)(a.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",n.length-4]})]}):(0,i.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]})]})]},e.id)})}):(e="file"===er?em:eh,l=r,0===e.length?(0,i.jsx)(c.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=>{var n,s,o,c,m,h,u,f,y;let g="prompt"===e.type?(null==(n=e.resourceIds)?void 0:n.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]:[],j=g.slice(0,3),A=g.length-j.length,v="file"===e.type?null!=(o=U[null!=(s=e.processingType)?s:""])?o:(0,i.jsx)(S.A,{}):null!=(m=q[null!=(c=e.executionType)?c:""])?m:(0,i.jsx)(B.A,{}),b="file"===e.type?null!=(u=V[null!=(h=e.processingType)?h:""])?u:"var(--colorAccent)":null!=(y=G[null!=(f=e.executionType)?f:""])?y:"var(--colorWarning)";return(0,i.jsxs)(d.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)(a.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的角色"})})]}),e.description&&(0,i.jsx)(L,{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)(a.A,{color:"file"===e.type?"blue":"purple",style:{margin:0},children:function(e,l){var r,i,n;let t="file"===e.type?Q[null!=(r=e.processingType)?r:""]:J[null!=(i=e.executionType)?i:""];return t?l(t):null!=(n="file"===e.type?e.processingType:e.executionType)?n:""}(e,l)}),g.length>0&&(0,i.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",g.length," 个提示词"]})]}),j.length>0&&(0,i.jsx)("div",{style:{marginBottom:10},children:(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[j.map(e=>(0,i.jsx)(a.A,{color:"purple",title:e,style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"},children:ez(e)},e)),A>0&&(0,i.jsxs)(a.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)(p.Ay,{size:"small",icon:(0,i.jsx)(R.A,{}),onClick:()=>eb(e),children:"编辑"}),!e.builtIn&&(0,i.jsx)(p.Ay,{size:"small",icon:(0,i.jsx)(F.A,{}),onClick:()=>{M("customize-role-".concat(X(e.name),"-").concat(new Date().toISOString().slice(0,10),".json"),K([e],[])),t.success("已导出 1 个角色")},children:"导出"}),(0,i.jsx)(x.A,{title:r("common.confirm"),onConfirm:()=>{ej(e)},children:(0,i.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(N.A,{})})})]})]},e.id)})}))}),(0,i.jsx)(f.A,{title:r("roles.roleEditor"),open:_,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)(p.Ay,{type:"primary",onClick:()=>{ey()},children:r("common.save")}),children:(0,i.jsxs)(o.A,{form:v,layout:"vertical",children:[(0,i.jsx)(o.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(y.A,{})}),(0,i.jsxs)(g.A,{gutter:16,children:[(0,i.jsx)(j.A,{span:12,children:(0,i.jsx)(o.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)(j.A,{span:12,children:(0,i.jsx)(o.A.Item,{name:"name",label:r("roles.roleName"),rules:[{required:!0}],children:(0,i.jsx)(y.A,{})})})]}),(0,i.jsx)(o.A.Item,{name:"description",label:r("roles.roleDescription"),children:(0,i.jsx)(y.A.TextArea,{rows:2})}),(0,i.jsx)(o.A.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.type!==l.type,children:e=>{let{getFieldValue:l}=e,n="prompt"===l("type");return(0,i.jsx)(d.A,{size:"small",title:n?"提示词角色配置":"文件角色配置",style:{border:"1px solid var(--colorBorderSecondary)"},children:n?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.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)(o.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:eT,placeholder:"选择提示词",options:k.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.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)(u.A,{type:"info",showIcon:!0,message:"文件角色只定义处理类型",description:"具体项目文件由生成流程自动识别,或在模板的高级固定绑定资料中手动覆盖;这里不再绑定知识库文件,避免角色复用时混入其他项目资料。"})]})})}})]})}),(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)(p.Ay,{type:"primary",onClick:()=>{eg()},children:r("common.save")}),children:(0,i.jsxs)(o.A,{form:b,layout:"vertical",children:[(0,i.jsx)(o.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(y.A,{})}),(0,i.jsxs)(g.A,{gutter:16,children:[(0,i.jsx)(j.A,{span:12,children:(0,i.jsx)(o.A.Item,{name:"name",label:r("roles.configName"),rules:[{required:!0}],children:(0,i.jsx)(y.A,{})})}),(0,i.jsx)(j.A,{span:12,children:(0,i.jsx)(o.A.Item,{name:"description",label:r("roles.configDescription"),children:(0,i.jsx)(y.A,{})})})]}),(0,i.jsx)(o.A.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.fileRoles!==l.fileRoles||e.promptRoles!==l.promptRoles,children:e=>{let{getFieldValue:l}=e,n=l("fileRoles")||[],t=l("promptRoles")||[];return(0,i.jsx)(A.A,{destroyInactiveTabPane:!1,items:[{key:"file",label:"文件角色 (".concat(n.length,"/").concat(eu.length,")"),children:(0,i.jsx)(o.A.List,{name:"fileRoles",children:(e,l)=>{let{add:t,remove:s}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[(0,i.jsx)(d.A,{size:"small",title:"已选文件角色",style:{background:"var(--colorFillQuaternary)"},children:eR(n,"file")}),0===e.length&&(0,i.jsx)(c.A,{description:"暂未添加文件角色"}),e.map((e,l)=>(0,i.jsxs)(d.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)(p.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(N.A,{}),onClick:()=>s(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsxs)(g.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,i.jsxs)(j.A,{flex:"auto",children:[(0,i.jsx)(o.A.Item,{name:[e.name,"roleId"],label:"文件角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(h.A,{placeholder:"选择文件角色",size:"small",options:eu.map(e=>{var l;return{label:"".concat(e.name," (").concat(r(Q[null!=(l=e.processingType)?l:""]||"roles.reference"),")"),value:e.id}})})}),(0,i.jsx)(o.A.Item,{noStyle:!0,shouldUpdate:!0,children:l=>{let{getFieldValue:r}=l;return ek(eI(r(["fileRoles",e.name,"roleId"])))}})]}),(0,i.jsx)(j.A,{style:{width:90},children:(0,i.jsx)(o.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(y.A,{type:"number",size:"small"})})})]})]},e.key)),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>t({order:e.length}),children:r("roles.addRole")})]})}})},{key:"prompt",label:"提示词角色 (".concat(t.length,"/").concat(ef.length,")"),children:(0,i.jsx)(o.A.List,{name:"promptRoles",children:(e,l)=>{let{add:n,remove:s}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[(0,i.jsx)(d.A,{size:"small",title:"已选提示词角色",style:{background:"var(--colorFillQuaternary)"},children:eR(t,"prompt")}),0===e.length&&(0,i.jsx)(c.A,{description:"暂未添加提示词角色"}),e.map((e,l)=>(0,i.jsxs)(d.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)(p.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(N.A,{}),onClick:()=>s(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsxs)(g.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,i.jsxs)(j.A,{flex:"auto",children:[(0,i.jsx)(o.A.Item,{name:[e.name,"roleId"],label:"提示词角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(h.A,{placeholder:"选择提示词角色",size:"small",options:ef.map(e=>{var l;return{label:"".concat(e.name," (").concat(r(J[null!=(l=e.executionType)?l:""]||"roles.reference"),")"),value:e.id}})})}),(0,i.jsx)(o.A.Item,{noStyle:!0,shouldUpdate:!0,children:l=>{let{getFieldValue:r}=l;return ek(eI(r(["promptRoles",e.name,"roleId"])))}})]}),(0,i.jsx)(j.A,{style:{width:90},children:(0,i.jsx)(o.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(y.A,{type:"number",size:"small"})})})]})]},e.key)),(0,i.jsx)(p.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>n({order:e.length}),children:r("roles.addRole")})]})}})}]})}})]})})]})}}},e=>{e.O(0,[433,787,576,195,455,496,636,593,792],()=>e(e.s=23507)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{16403:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return r(19562)}])},19562:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>ec});var l=r(65321),n=r(97109),s=r(7576),a=r(35292),i=r(33442),o=r(11702),c=r(17807),d=r(63455),u=r(88762),p=r(85114),h=r(68787),m=r(84253),g=r(38332),x=r(26171),f=r(34052),j=r(42700),y=r(58569),v=r(2256),w=r(38770),A=r(76506),S=r(57271),b=r(49604),k=r(23216),I=r(16285),C=r(26619),T=r(8263),z=r(8579),B=r(75548),E=r(7851),M=r(84742),R=r(29071),_=r(63552),D=r(26631),F=r(29606),P=r(83914),L=r(58209),W=r(54746),G=r(71330),N=r(64068),O=r(93051),H=r(38762),q=r(64629),K=r(67547),V=r(76830),U=r(1310),X=r(6578),Q=r(79059);let{TextArea:J}=s.A,{Text:Y}=a.A;function Z(e){let{type:t="info",title:r,children:n,style:s}=e,a="error"===t?"var(--colorError)":"warning"===t?"var(--colorWarning)":"success"===t?"var(--colorSuccess)":"var(--colorInfo)";return(0,l.jsxs)("div",{style:{border:"1px solid ".concat(a),background:"error"===t?"var(--colorErrorBg)":"warning"===t?"var(--colorWarningBg)":"success"===t?"var(--colorSuccessBg)":"var(--colorInfoBg)",borderRadius:8,padding:"9px 12px",...s},children:[(0,l.jsx)(Y,{strong:!0,style:{color:a},children:r}),n&&(0,l.jsx)("div",{style:{marginTop:4,color:"var(--colorTextSecondary)",fontSize:12},children:n})]})}function $(e){let{children:t,gap:r=12,style:n}=e;return(0,l.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:r,...n},children:t})}let ee=null;function et(){null==ee||ee.listeners.forEach(e=>e())}let er={role_binding:(0,l.jsx)(k.A,{}),context_recall:(0,l.jsx)(I.A,{}),knowledge_retrieval:(0,l.jsx)(C.A,{}),file_understanding:(0,l.jsx)(T.A,{}),fact_extraction:(0,l.jsx)(I.A,{}),chapter_generation:(0,l.jsx)(z.A,{}),asset_generation:(0,l.jsx)(B.A,{}),validation:(0,l.jsx)(E.A,{}),formatting:(0,l.jsx)(M.A,{}),llm_review:(0,l.jsx)(R.A,{}),export_ready:(0,l.jsx)(_.A,{}),reference:(0,l.jsx)(B.A,{})},el={施工组织设计:(0,l.jsx)(E.A,{}),投标文件:(0,l.jsx)(_.A,{}),技术方案:(0,l.jsx)(I.A,{}),报告:(0,l.jsx)(D.A,{}),自定义:(0,l.jsx)(z.A,{})};function en(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function es(e){return e?e.split(/[\\/]/u).pop()||e:""}function ea(e){let t=[],r=e=>{for(let l of e)l.isFolder?l.children&&r(l.children):t.push(l.key)};return r(e),t}let ei={role_binding:"角色配置绑定",context_recall:"上下文召回",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",asset_generation:"多模态资源生成",validation:"规则校验",formatting:"格式化排版",llm_review:"LLM 审查优化",export_ready:"导出就绪",reference:"参考资源处理"},eo={"knowledge-base":"知识库","document-readiness":"生成准备度检查","quality-repair":"质量补写","export-gate":"导出门禁","context-memory":"项目上下文","final-format":"正式排版","multimodal-files":"多模态文件理解",tender_announcement:"招标公告"};function ec(){var e,t,r,a,B;let ec=(0,Q.Vr)(),{message:ed}=c.A.useApp(),[eu]=d.A.useForm(),ep=(0,n.useRef)(null),[eh,em]=(0,n.useState)([]),[eg,ex]=(0,n.useState)("construction-organization-design"),[ef,ej]=(0,n.useState)([]),[ey,ev]=(0,n.useState)([]),[ew,eA]=(0,n.useState)([]),[eS,eb]=(0,n.useState)([]),[ek,eI]=(0,n.useState)(!1),[eC,eT]=(0,n.useState)(""),[ez,eB]=(0,n.useState)([]),[eE,eM]=(0,n.useState)(!0),[eR,e_]=(0,n.useState)(!1),[eD,eF]=(0,n.useState)(null),[eP,eL]=(0,n.useState)(""),[eW,eG]=(0,n.useState)([]),[eN,eO]=(0,n.useState)(null),[eH,eq]=(0,n.useState)(null),[eK,eV]=(0,n.useState)(""),[eU,eX]=(0,n.useState)(!1),[eQ,eJ]=(0,n.useState)("idle"),[eY,eZ]=(0,n.useState)(null),[e$,e0]=(0,n.useState)(null),[e1,e2]=(0,n.useState)({start:0,end:0}),[e6,e8]=(0,n.useState)([]),[e3,e4]=(0,n.useState)(!1),[e5,e7]=(0,n.useState)(!1),[e9,te]=(0,n.useState)({}),tt=ef.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),tr=d.A.useWatch("fileBindingGroups",eu)||{},tl=(0,n.useMemo)(()=>(function(e){let t={};for(let n of[...e].sort((e,t)=>e.relativePath.localeCompare(t.relativePath,"zh-CN"))){let e=n.relativePath.split("/").filter(Boolean),s="";for(let a=0;a<e.length;a++){let o=e[a],c=s;s=s?"".concat(s,"/").concat(o):o;let d=a===e.length-1;if(!t[s]){var r;t[s]={key:s,rawTitle:o,title:d?(0,l.jsx)("span",{title:n.relativePath,children:o}):(0,l.jsxs)(i.A,{size:4,children:[(0,l.jsx)(F.A,{style:{color:"#faad14"}}),(0,l.jsx)("span",{children:o})]}),isFolder:!d,fileCount:+!!d,...d?{}:{children:[]}},c&&(null==(r=t[c])?void 0:r.children)&&t[c].children.push(t[s])}d&&(t[s].fileCount=1)}}let n=e=>{for(let r of e){var t;(null==(t=r.children)?void 0:t.length)&&(n(r.children),r.fileCount=r.children.reduce((e,t)=>e+t.fileCount,0),r.title=(0,l.jsxs)(i.A,{size:4,children:[(0,l.jsx)(F.A,{style:{color:"#faad14"}}),(0,l.jsx)("span",{children:r.rawTitle}),(0,l.jsx)(o.A,{style:{margin:0},children:r.fileCount})]}))}},s=Object.values(t).filter(e=>!e.key.includes("/"));return n(s),s.filter(e=>!e.isFolder||e.fileCount>0)})(eS),[eS]),tn=(0,n.useMemo)(()=>(function e(t,r){let l=r.trim().toLowerCase();return l?t.flatMap(t=>{let r=t.children?e(t.children,l):void 0;return t.key.toLowerCase().includes(l)||t.rawTitle.toLowerCase().includes(l)||(null==r?void 0:r.length)?[{...t,children:r}]:[]}):t})(tl,eC),[tl,eC]),ts=(0,n.useMemo)(()=>ea(tl),[tl]),ta=(0,n.useMemo)(()=>{var e,t,r;return(null==(e=ew.find(e=>e.selected))?void 0:e.projectRoot)||(null==(t=ew.find(e=>e.isCurrent))?void 0:t.projectRoot)||(null==(r=ew[0])?void 0:r.projectRoot)||""},[ew]),ti=(0,n.useMemo)(()=>{let e=[],t=r=>{for(let l of r)e.push(l.key),l.children&&t(l.children)};return t(tl),e},[tl]),[to,tc]=(0,n.useState)([]),[td,tu]=(0,n.useState)(null),[tp,th]=(0,n.useState)(null),[tm,tg]=(0,n.useState)("templates"),[tx,tf]=(0,n.useState)(!1),[tj,ty]=(0,n.useState)("workflow"),tv=(0,n.useRef)(null),tw=(0,n.useRef)(null),tA=(0,n.useRef)(0),tS=(0,n.useMemo)(()=>"activeGenDocId:".concat(ta||"default"),[ta]),tb=async()=>{try{eG((await (0,X.cQ)(ta||void 0)).documents)}catch(e){eG([])}};(0,n.useEffect)(()=>{let e=()=>{ee&&(tc(ee.flowSteps),tu(ee.activeFlowKey),e_(ee.loading),ee.documentId&&eO(ee.documentId),ee.draft&&eF(ee.draft),void 0!==ee.content&&eL(ee.content))},t=ee;return null==t||t.listeners.add(e),e(),()=>{null==t||t.listeners.delete(e)}},[]),(0,n.useEffect)(()=>{eM(!0),Promise.all([(0,X.Dl)().then(e=>{var t,r;em(e.templates),ex(null!=(r=null==(t=e.templates[0])?void 0:t.id)?r:"construction-organization-design")}),(0,X.lv)().then(e=>{ej(e.roles),ev(e.configs)}),(0,X.dx)().then(e=>eA(e))]).catch(()=>ed.error(ec("common.error"))).finally(()=>eM(!1))},[ed,ec]),(0,n.useEffect)(()=>{ta&&(localStorage.removeItem("activeGenDocId"),tb())},[ta]),(0,n.useEffect)(()=>{if(0===eW.length)return;let e=localStorage.getItem(tS);if(!e)return;if(!eW.find(t=>t.id===e&&"generating"===t.status))return void localStorage.removeItem(tS);let t=setInterval(()=>{(async()=>{try{let{document:r}=await (0,X.v7)(e,!1,ta||void 0);await tb(),"generating"!==r.status&&(localStorage.removeItem(tS),clearInterval(t))}catch(e){clearInterval(t)}})()},3e3);return()=>clearInterval(t)},[eW]);let tk=(0,n.useMemo)(()=>eh.find(e=>e.id===eg),[eh,eg]),tI=ey.map(e=>({label:e.name,value:e.id})),tC=Math.max(0,to.findIndex(e=>e.key===td)),tT=e=>{var t;return e?(null==(t=ef.find(t=>t.id===e))?void 0:t.name)||eo[e]||"未知角色":""},tz=e=>e.subtitle||e.roleName||tT(e.roleId)||ei[e.type]||e.type,tB=e=>{var t,r,l;return e.promptName||((t=e.promptId)?(null==(r=ew.find(e=>e.id===t))?void 0:r.projectName)||(null==(l=ef.find(e=>e.id===t))?void 0:l.name)||eo[t]||"未知提示词":"")},tE=()=>{tA.current+=1,eV(""),eZ(null),e0(null),e8([]),e4(!1),eX(!1),eJ("idle")},tM=e=>{ex(e),eO(null),eF(null),eL(""),tE(),ty("workflow"),tf(!0),tg("drafts")},tR=async e=>{eO(e.id),ex(e.templateId);let t=t_(e.status);if(t||"failed"===e.status||"aborted"===e.status){tE(),th(e),eF(null),eL(""),e_(t),ty("workflow"),tf(!0);try{let{document:t}=await (0,X.v7)(e.id,!1,e.projectRoot||ta||void 0);tP(t),t_(t.status)?tL(t.id,t.projectRoot||e.projectRoot||ta||void 0):await tb()}catch(t){tP(e)}return}ty("editor"),tc([]),tu(null),tE();try{let{document:t}=await (0,X.v7)(e.id,!1,e.projectRoot||ta||void 0);eF(t.draft||null),eL(t.editedMarkdown||t.markdown)}catch(e){ed.error(ec("common.error"))}tf(!0)},t_=e=>"completed"!==e&&"warning"!==e&&"failed"!==e&&"aborted"!==e,tD=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:eR;(null==ee?void 0:ee.loading)&&(ee.flowSteps=e,ee.activeFlowKey=t,ee.loading=r,et())},tF=e=>{var t,r,n,s,a;let i=e.executionStages||(null==(t=e.draft)?void 0:t.executionStages)||[];if(i.length>0){let t=i.map((t,r)=>{var n;let s,a=("failed"===e.status||"aborted"===e.status)&&"running"===t.status||"failed"===(s=t.status)?"error":"running"===s?"process":"fallback"===s?"warning":"finish";return{key:"".concat(t.type,"-").concat(r),title:t.title||ei[t.type]||t.type,subtitle:tz(t),description:t.message||"",status:a,icon:"role_binding"===(n=t.type)?(0,l.jsx)(k.A,{}):"knowledge_retrieval"===n?(0,l.jsx)(C.A,{}):"context_recall"===n?(0,l.jsx)(I.A,{}):"file_understanding"===n?(0,l.jsx)(T.A,{}):"fact_extraction"===n?(0,l.jsx)(I.A,{}):"chapter_generation"===n?(0,l.jsx)(z.A,{}):"llm_review"===n?(0,l.jsx)(R.A,{}):"validation"===n?(0,l.jsx)(E.A,{}):"formatting"===n?(0,l.jsx)(M.A,{}):"export_ready"===n?(0,l.jsx)(_.A,{}):(0,l.jsx)(D.A,{}),subSteps:((e,t,r)=>{let l=Array.isArray(e.details)?e.details.filter(Boolean):[],n=e.progress?"".concat(e.progress.label||"进度",":").concat(e.progress.current,"/").concat(e.progress.total):"",s=[...n?[n]:[],...l];return 0===s.length?[{key:"stage-".concat(r),title:tB(e)?"提示词:".concat(tB(e)):tz(e),status:t}]:s.slice(0,8).map((e,l)=>({key:"stage-".concat(r,"-").concat(l),title:e,status:"process"===t&&0===l?"process":"error"===t&&0===l?"error":"warning"===t?"warning":"process"===t?"finish":t}))})(t,a,r)}});"generating"===e.status&&t.length>0&&(null==(r=t.at(-1))?void 0:r.status)==="finish"&&(t[t.length-1]={...t[t.length-1],status:"process"});let o="generating"===e.status?(null==(n=t.at(-1))?void 0:n.key)||"prepare":"failed"===e.status||"aborted"===e.status?(null==(s=t.find(e=>"error"===e.status))?void 0:s.key)||(null==(a=t.at(-1))?void 0:a.key)||"prepare":"done";return{steps:t,activeKey:o}}return{steps:[],activeKey:null}},tP=e=>{th(e);let{steps:t,activeKey:r}=tF(e);tc(t),tu(r),e_(t_(e.status)),tD(t,r,t_(e.status)),("failed"===e.status||"aborted"===e.status)&&ty("workflow"),("completed"===e.status||"warning"===e.status)&&e.draft&&(eF(e.draft),eL(e.editedMarkdown||e.markdown),ty("editor"),tc([]),tu(null))},tL=(e,t)=>{tv.current&&clearInterval(tv.current),tv.current=setInterval(()=>{(async()=>{try{let{document:r}=await (0,X.v7)(e,!0,t||ta||void 0);tP(r),await tb(),t_(r.status)||(tv.current&&clearInterval(tv.current),tv.current=null,localStorage.removeItem(tS))}catch(e){}})()},2e3)};(0,n.useEffect)(()=>()=>{tv.current&&(clearInterval(tv.current),tv.current=null),tw.current&&(clearTimeout(tw.current),tw.current=null)},[]),(0,n.useEffect)(()=>{if(!eR||!td)return;let e=window.setInterval(()=>tc(e=>{let t=e.map(e=>{if(e.key!==td||"process"!==e.status)return e;let t=e.subSteps.findIndex(e=>"process"===e.status),r=t<0?0:Math.min(t+1,e.subSteps.length-1);return{...e,subSteps:e.subSteps.map((e,t)=>t<r?{...e,status:"finish"}:t===r?{...e,status:"process"}:{...e,status:"wait"})}});return tD(t,td),t}),1400);return()=>window.clearInterval(e)},[td,eR]);let tW=async()=>{eI(!0);try{let e=await (0,X.HT)({limit:5e3,projectRoot:ta||void 0});eb(e.files)}catch(e){ed.error("知识库文件加载失败")}finally{eI(!1)}},tG=e=>{let t=null!=e?e:{id:"tpl-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,chapters:[],fileBindings:[]};eu.resetFields(),eu.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]=en([...e[t.roleId]||[],t.filePath])),e),{})}(t.fileBindings)}),eT(""),tW(),e7(!0)},tN=(e,t)=>{let r=eu.getFieldValue("fileBindingGroups")||{};eu.setFieldValue("fileBindingGroups",{...r,[e]:en(t)})},tO=async()=>{try{await eu.validateFields();let e=eu.getFieldsValue(!0),t=e.fileBindingGroups||{},r=Object.entries(t).flatMap(e=>{let[t,r]=e;return en(r||[]).map(e=>({roleId:t,filePath:e}))}),{fileBindingGroups:l,...n}=e,s={...n,chapters:[],fileBindings:r},a=await (0,X.l2)(s);em(a.templates),ex(a.template.id),e7(!1),await tb(),ed.success(ec("common.success"))}catch(e){e instanceof Error&&ed.error(e.message)}},tH=async e=>{try{let t=await (0,X.bV)(e);em(t.templates),ex(t.template.id),ed.success(ec("common.success"))}catch(e){ed.error(ec("common.error"))}},tq=async e=>{try{var t,r;let l=await (0,X.h0)(e);em(l.templates),ex(null!=(r=null==(t=l.templates[0])?void 0:t.id)?r:""),ed.success(ec("common.success"))}catch(e){ed.error(ec("common.error"))}},tK=async e=>{try{let{validation:t}=await (0,X.SM)(e,ta||void 0);te(r=>({...r,[e]:t}));let r=t.issues.filter(e=>"error"===e.level);if(ex(e),r.length>0)return void ed.warning("模板运行前检查未通过,请先处理阻断项");if(t.issues.length>0)return void ed.warning("模板存在警告,可在检查面板确认后继续运行");tM(e)}catch(e){ed.error(e instanceof Error?e.message:"模板运行前检查失败")}},tV=async e=>{try{await (0,X.QG)(e.id,e.projectRoot||ta||void 0),eN===e.id&&(eO(null),eF(null),eL("")),await tb(),ed.success(ec("common.success"))}catch(e){ed.error(ec("common.error"))}},tU=async(e,t)=>{let r=Date.now(),l=0,n=Date.now();for(;;){let s;if(null==t?void 0:t.aborted)throw Error("用户中止");let a=new AbortController;t&&(t.pollController=a);try{({document:s}=await (0,X.v7)(e,!0,ta||void 0,a.signal))}finally{(null==t?void 0:t.pollController)===a&&(t.pollController=void 0)}if(tP(s),s.updatedAt!==l&&(l=s.updatedAt,n=Date.now()),("completed"===s.status||"warning"===s.status)&&s.draft)return s;if("failed"===s.status||"aborted"===s.status)throw Error(s.error||("aborted"===s.status?"生成已中止":"生成失败"));if(Date.now()-r>75e5||Date.now()-n>96e4)throw Error("生成任务疑似卡住,请点击继续生成或重新生成");await new Promise(e=>window.setTimeout(e,1500))}},tX=async()=>{if(!eg)return;if((null==ee?void 0:ee.aborted)&&(ee=null),null==ee?void 0:ee.loading){tc(ee.flowSteps),tu(ee.activeFlowKey),e_(!0);return}if(!ta)return void ed.error("未识别当前项目,请先选择或打开项目后再生成文件");e_(!0);let e=(0,X.OX)({templateId:eg,projectRoot:ta});ee={id:Date.now(),templateId:eg,loading:!0,flowSteps:[],activeFlowKey:null,promise:e,listeners:new Set},tc([]),tu(null);let t=[];try{let r=await e;r.documentId&&(localStorage.setItem(tS,r.documentId),eO(r.documentId),(null==ee?void 0:ee.promise)===e&&(ee.documentId=r.documentId)),await tb();let l=r.documentId?await tU(r.documentId,(null==ee?void 0:ee.promise)===e?ee:void 0):void 0,n=r.draft||(null==l?void 0:l.draft);if(!n)throw Error("生成结果为空");(r.documentId||(null==l?void 0:l.id))&&eO(r.documentId||l.id),t.forEach(e=>window.clearTimeout(e)),eF(n),eL((null==l?void 0:l.editedMarkdown)||(null==l?void 0:l.markdown)||n.markdown),(null==ee?void 0:ee.promise)===e&&(ee.draft=n,ee.content=(null==l?void 0:l.editedMarkdown)||(null==l?void 0:l.markdown)||n.markdown);let s=l||{id:r.documentId||"draft-".concat(Date.now()),templateId:eg,title:n.title,requirement:n.requirement,projectRoot:n.projectRoot||ta,projectId:n.projectId,markdown:n.markdown,status:n.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!n.exportGate.passed?"warning":"completed",draft:n,executionStages:n.executionStages,assets:n.assets||[],createdAt:n.generatedAt,updatedAt:Date.now()},{steps:a}=tF(s);tc(a),tD(a,"done",!1),tu("done"),(null==ee?void 0:ee.promise)===e&&(ee.activeFlowKey="done",ee.loading=!1,et(),ee=null),localStorage.removeItem(tS),await tb(),ed.success(ec("common.success")),window.setTimeout(()=>{var e;return null==(e=ep.current)?void 0:e.scrollIntoView({behavior:"smooth",block:"start"})},200)}catch(l){localStorage.removeItem(tS);let t=l instanceof Error?l.message:ec("common.error"),r=/用户中止|abort|aborted/i.test(t);r||tc(e=>{let r=e.map(e=>"process"===e.status?{...e,status:"error",description:t,subSteps:((e,t)=>{if("wait"===t)return e.subSteps.map(e=>({...e,status:"wait"}));if("finish"===t)return e.subSteps.map(e=>({...e,status:"finish"}));if("error"===t)return e.subSteps.map((e,t)=>({...e,status:0===t?"error":e.status}));let r=e.subSteps.findIndex(e=>"wait"===e.status);return e.subSteps.map((e,t)=>t<r||-1===r?{...e,status:"finish"}:t===r?{...e,status:"process"}:e)})(e,"error")}:e);return tD(r,td,!1),r}),(null==ee?void 0:ee.promise)===e&&(ee.loading=!1,ee.error=t,et(),ee=null),await tb().catch(()=>void 0),r||ed.error(t)}finally{t.forEach(e=>window.clearTimeout(e)),e_(!1),(null==ee?void 0:ee.promise)===e&&(ee.loading=!1,et())}},tQ=(0,n.useRef)(!1);(0,n.useEffect)(()=>(tw.current&&(clearTimeout(tw.current),tw.current=null),!tx||"workflow"!==tj||eN||tQ.current||(null==ee?void 0:ee.loading)||null==tk||!tk.projectRoleConfigId||(tQ.current=!0,tw.current=setTimeout(()=>{tw.current=null,tx&&"workflow"===tj&&!eN&&eg==eg&&tX()},300)),tx||(tQ.current=!1),()=>{tw.current&&(clearTimeout(tw.current),tw.current=null)}),[tx,tj,eN,tk,eg]);let tJ=async e=>{try{eO(e.id),ex(e.templateId),ty("workflow"),tf(!0),e_(!0);let t=await (0,X.UQ)(e.id,e.projectRoot||ta||void 0);localStorage.setItem(tS,t.documentId),await tb();let r=await tU(t.documentId);r.draft&&(eF(r.draft),eL(r.editedMarkdown||r.markdown||r.draft.markdown),ty("editor")),localStorage.removeItem(tS),await tb(),ed.success("已继续生成并完成")}catch(e){ed.error(e instanceof Error?e.message:"继续生成失败")}finally{e_(!1)}},tY=async e=>{if((null==ee?void 0:ee.loading)&&ee.documentId===e.id){var t;ee.aborted=!0,null==(t=ee.pollController)||t.abort(),ee.loading=!1,ee.error="用户中止",et(),ee=null,e_(!1)}localStorage.removeItem(tS),tv.current&&(clearInterval(tv.current),tv.current=null);try{await (0,X.r)(e.id,e.projectRoot||ta||void 0),ed.success("已中止生成任务")}catch(e){ed.info("任务已不在运行,已刷新状态")}finally{await tb(),eN===e.id&&(eO(null),th(null),eF(null),eL(""))}},tZ=async e=>{if(eD){eq(e);try{eD.exportGate.passed||ed.warning("导出门禁存在风险项,已允许导出,请下载后人工复核。");let t={documentId:eN||void 0,title:eD.title,markdown:eP,format:e,enforceGate:!1,exportGate:eD.exportGate,useClientMarkdown:!0},r=await (0,X.UE)(t);((e,t,r)=>{let l=new Blob([e],{type:r}),n=URL.createObjectURL(l),s=document.createElement("a");s.href=n,s.download=t,s.target="_self",s.rel="noopener",s.style.display="none",document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),s.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)})(r,"".concat(eD.title,".").concat("markdown"===e?"md":e),{markdown:"text/markdown;charset=utf-8",html:"text/html;charset=utf-8",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}[e])}catch(e){ed.error(e instanceof Error?e.message:ec("common.error"))}finally{eq(null)}}},t$=async()=>{if(eD)try{if(eN)await (0,X.a6)(eN,{editedMarkdown:eP,markdown:eP},eD.projectRoot||ta||void 0);else{let e=await (0,X.Af)({...eD,markdown:eP});eF(e.draft)}await tb(),ed.success(ec("common.success"))}catch(e){ed.error(ec("common.error"))}},t0=(e,t)=>{e8(r=>[{id:"".concat(Date.now()),content:e,prompt:t,createdAt:Date.now()},...r].slice(0,12))},t1=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&eV(""),eZ(null),e0(null),e2({start:0,end:0})},t2=(e,t)=>{var r,l;return{title:(null==eD?void 0:eD.title)||"未命名文档",markdown:t,instruction:e,facts:null==eD||null==(r=eD.structuredFacts)?void 0:r.map(e=>"".concat(e.key,": ").concat(e.value)),chapters:null==eD||null==(l=eD.chapters)?void 0:l.map(e=>e.title),...(()=>{let e=e1.start,t=e1.end;return t>e?{selection:{start:e,end:t,text:eP.slice(e,t)},cursorOffset:e}:{cursorOffset:e}})()}},t6=async()=>{let e=eK.trim();if(!eD||!e||eU)return;let t=tA.current+1;tA.current=t,eX(!0),eJ("planning"),e0(null);try{let r=await (0,X.Gi)({mode:"plan",...t2(e,eP)});if(tA.current!==t||eN!=eN)return;if(!r.plan)throw Error("AI 未返回修改计划");eZ(r.plan)}catch(e){tA.current===t&&ed.error(e instanceof Error?e.message:ec("common.error"))}finally{tA.current===t&&(eX(!1),eJ("idle"))}},t8=async e=>{let t=eK.trim();if(!eD||!t||eU)return;let r=tA.current+1;tA.current=r,eX(!0),eJ("applying");try{let l=await (0,X.Gi)({mode:"apply",...t2(t,eP),plan:e});if(tA.current!==r||eN!=eN)return;if(!l.markdown)throw Error("AI 未返回修改结果");e0({plan:l.plan||e,markdown:l.markdown,beforeSnippet:l.beforeSnippet,afterSnippet:l.afterSnippet,summary:l.summary,changedChars:l.changedChars,prompt:t,before:eP})}catch(e){tA.current===r&&ed.error(e instanceof Error?e.message:ec("common.error"))}finally{tA.current===r&&(eX(!1),eJ("idle"))}};if(eE)return(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsx)(u.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,l.jsx)(u.A,{active:!0,paragraph:{rows:2}}),(0,l.jsx)(u.A,{active:!0,paragraph:{rows:8}})]});let t3="workflow"===tj?"工作流:".concat((null==tk?void 0:tk.name)||"选择模板"):"编辑:".concat((null==eD?void 0:eD.title)||(null==tk?void 0:tk.outputTitle)||"文档");return(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"pageTitle",children:ec("documents.title")}),(0,l.jsx)("p",{className:"pageDesc",children:ec("documents.description")})]}),(0,l.jsx)(p.Ay,{type:"primary",icon:(0,l.jsx)(W.A,{}),onClick:()=>tG(),children:ec("documents.newTemplate")})]}),(0,l.jsx)(h.A,{size:"small",tabList:[{key:"templates",label:"模板库 (".concat(eh.length,")")},{key:"drafts",label:"生成记录 (".concat(eW.length,")")}],activeTabKey:tm,onTabChange:tg,children:"templates"===tm?0===eh.length?(0,l.jsx)(m.A,{description:ec("common.noData")}):(0,l.jsx)(g.A,{dataSource:eh,renderItem:e=>(0,l.jsx)(g.A.Item,{style:{cursor:"pointer",padding:"10px 0"},actions:[(0,l.jsx)(p.Ay,{size:"small",icon:(0,l.jsx)(G.A,{}),onClick:t=>{t.stopPropagation(),tG(e)},children:"配置"},"cfg"),(0,l.jsx)(p.Ay,{size:"small",type:"primary",icon:(0,l.jsx)(N.A,{}),onClick:t=>{t.stopPropagation(),tK(e.id)},children:"运行"},"run"),(0,l.jsx)(p.Ay,{size:"small",icon:(0,l.jsx)(O.A,{}),onClick:t=>{t.stopPropagation(),tH(e.id)}},"copy"),(0,l.jsx)(x.A,{title:ec("documents.deleteTemplateConfirm"),onConfirm:t=>{null==t||t.stopPropagation(),tq(e.id)},children:(0,l.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,l.jsx)(L.A,{}),onClick:e=>e.stopPropagation()})},"del")],onClick:()=>ex(e.id),children:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[function(e,t){let r=el[e]||(0,l.jsx)(D.A,{});return(0,l.jsx)("span",{style:{color:t?"var(--colorAccent)":"var(--colorTextSecondary)",fontSize:16,marginTop:2,flexShrink:0},children:r})}(e.category,eg===e.id),(0,l.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,l.jsx)("span",{style:{fontWeight:eg===e.id?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),eg===e.id&&(0,l.jsx)(o.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"当前"}),(0,l.jsx)(o.A,{style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:e.category}),e9[e.id]&&(0,l.jsxs)(o.A,{color:e9[e.id].issues.some(e=>"error"===e.level)?"error":e9[e.id].issues.length?"warning":"success",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:["检查 ",e9[e.id].fileDiagnostics.length," 文件 / ",e9[e.id].promptDiagnostics.length," 提示词"]})]}),e.description&&(0,l.jsx)(Y,{type:"secondary",style:{fontSize:12,lineHeight:"18px"},children:e.description}),e9[e.id]&&(0,l.jsx)("div",{onClick:e=>e.stopPropagation(),style:{marginTop:8,padding:10,border:"1px solid ".concat(e9[e.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBorder)":e9[e.id].issues.length?"var(--colorWarningBorder)":"var(--colorSuccessBorder)"),borderRadius:10,background:e9[e.id].issues.some(e=>"error"===e.level)?"var(--colorErrorBg)":e9[e.id].issues.length?"var(--colorWarningBg)":"var(--colorSuccessBg)"},children:(0,l.jsxs)($,{gap:6,style:{width:"100%"},children:[(0,l.jsxs)(i.A,{wrap:!0,children:[(0,l.jsx)(Y,{strong:!0,children:e9[e.id].issues.some(e=>"error"===e.level)?"运行前检查未通过":e9[e.id].issues.length?"运行前检查存在警告":"运行前检查通过"}),(0,l.jsxs)(o.A,{color:"blue",children:["文件角色 ",e9[e.id].fileDiagnostics.length]}),(0,l.jsxs)(o.A,{color:"purple",children:["提示词角色 ",e9[e.id].promptDiagnostics.length]})]}),e9[e.id].issues.length>0?e9[e.id].issues.map(e=>(0,l.jsx)(Z,{type:"error"===e.level?"error":"warning",title:e.message},e.message)):(0,l.jsx)(Z,{type:"success",title:"文件角色、提示词角色和后台自动规范检查通过,可以运行。"}),!e9[e.id].issues.some(e=>"error"===e.level)&&e9[e.id].issues.length>0&&(0,l.jsx)("div",{children:(0,l.jsx)(p.Ay,{size:"small",type:"primary",icon:(0,l.jsx)(N.A,{}),onClick:()=>tM(e.id),children:"忽略警告并继续运行"})})]})})]})]})})}):0===eW.length?(0,l.jsx)(m.A,{description:ec("common.noData")}):(0,l.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:eW.slice(0,15).map((e,t)=>{var r,n,s;let a,c;return(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,padding:"10px 12px",border:"1px solid var(--colorBorderSecondary)",borderRadius:10,cursor:"pointer",background:eN===e.id?"var(--colorFillAlter)":void 0,minWidth:0},onClick:()=>{tR(e)},children:["completed"===e.status?(0,l.jsx)(M.A,{style:{fontSize:18,color:"var(--colorOk)",flexShrink:0,marginTop:2}}):"failed"===e.status||"aborted"===e.status?(0,l.jsx)(H.A,{style:{fontSize:18,color:"var(--colorDanger)",flexShrink:0,marginTop:2}}):"warning"===e.status?(0,l.jsx)(E.A,{style:{fontSize:18,color:"var(--colorWarning)",flexShrink:0,marginTop:2}}):(0,l.jsx)(q.A,{spin:!0,style:{fontSize:18,color:"#1677ff",flexShrink:0,marginTop:2}}),(0,l.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,l.jsx)("div",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:3},children:e.title}),(0,l.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px 10px",color:"var(--colorTextSecondary)",fontSize:11},children:[(0,l.jsx)("span",{children:new Date(e.updatedAt).toLocaleString()}),(0,l.jsxs)("span",{children:["耗时 ",(e=>{let t=Math.max(0,Math.round(((e.completedAt||e.updatedAt)-e.createdAt)/1e3));if(t<60)return"".concat(t," 秒");let r=Math.floor(t/60),l=t%60;if(r<60)return l?"".concat(r," 分 ").concat(l," 秒"):"".concat(r," 分");let n=Math.floor(r/60),s=r%60;return s?"".concat(n," 小时 ").concat(s," 分"):"".concat(n," 小时")})(e)]})]}),e.partialChapters&&e.partialChapters.length>0&&(0,l.jsxs)("div",{style:{marginTop:3,fontSize:11,color:"var(--colorTextSecondary)"},children:["已完成章节 ",e.partialChapters.filter(e=>"completed"===e.status||"cached"===e.status).length,"/",e.partialChapters.length," \xb7 ",e.partialChapters.reduce((e,t)=>e+t.chars,0).toLocaleString()," 字"]}),("warning"===e.status||"failed"===e.status||"aborted"===e.status)&&(0,l.jsx)("div",{style:{marginTop:3,color:"failed"===e.status||"aborted"===e.status?"var(--colorError)":"var(--colorWarning)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.error||(null==(r=e.warningIssues)?void 0:r[0])||(null==(s=e.draft)||null==(n=s.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message)||"需复核"})]}),(0,l.jsxs)(i.A,{size:4,align:"center",children:[(0,l.jsx)(o.A,{color:"completed"===(a=e.status)?"success":"warning"===a?"warning":"failed"===a?"error":"aborted"===a?"default":"processing",style:{margin:0,fontSize:10,lineHeight:"18px"},children:"completed"===(c=e.status)?"已完成":"warning"===c?"需复核":"failed"===c?"失败":"aborted"===c?"已中止":"生成中"}),(0,l.jsxs)(o.A,{style:{margin:0,fontSize:10,lineHeight:"18px"},children:["#",t+1]}),(0,l.jsx)(x.A,{title:"确认删除?",onConfirm:t=>{null==t||t.stopPropagation(),tV(e)},children:(0,l.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,l.jsx)(L.A,{}),onClick:e=>e.stopPropagation()})}),t_(e.status)&&(0,l.jsx)(x.A,{title:"确定中止此生成任务?",onConfirm:t=>{null==t||t.stopPropagation(),tY(e)},children:(0,l.jsx)(p.Ay,{size:"small",danger:!0,onClick:e=>e.stopPropagation(),children:"中止"})}),("failed"===e.status||"aborted"===e.status)&&(0,l.jsx)(p.Ay,{size:"small",onClick:t=>{t.stopPropagation(),tJ(e)},children:"继续"}),(0,l.jsx)(p.Ay,{size:"small",type:"primary",icon:t_(e.status)?(0,l.jsx)(q.A,{spin:!0}):(0,l.jsx)(N.A,{}),onClick:t=>{t.stopPropagation(),tR(e)},children:"打开"})]})]},e.id)})})}),(0,l.jsx)(f.A,{title:t3,open:tx,onClose:()=>{tf(!1),tv.current&&(clearInterval(tv.current),tv.current=null)},size:800,mask:{closable:!1},style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:eD?(0,l.jsxs)(i.A,{wrap:!0,children:[(0,l.jsx)(p.Ay,{icon:(0,l.jsx)(K.A,{}),disabled:eU,onClick:()=>{t$()},children:ec("documents.saveDraft")}),(0,l.jsx)(p.Ay,{icon:(0,l.jsx)(V.A,{}),disabled:eU,loading:"markdown"===eH,onClick:()=>{tZ("markdown")},children:"MD"}),(0,l.jsx)(p.Ay,{disabled:eU,loading:"html"===eH,onClick:()=>{tZ("html")},children:"HTML"}),(0,l.jsx)(p.Ay,{disabled:eU,loading:"docx"===eH,onClick:()=>{tZ("docx")},children:"DOCX"}),(0,l.jsx)(p.Ay,{type:"primary",disabled:eU,loading:"pdf"===eH,onClick:()=>{tZ("pdf")},children:"PDF"})]}):eR&&"workflow"===tj?(0,l.jsx)(p.Ay,{danger:!0,onClick:()=>{(async()=>{if(eN&&await (0,X.r)(eN,ta||void 0).catch(()=>void 0),ee){var e;ee.aborted=!0,null==(e=ee.pollController)||e.abort(),ee.loading=!1,ee.error="用户中止",et(),ee=null}localStorage.removeItem(tS),tv.current&&(clearInterval(tv.current),tv.current=null),e_(!1),tc([]),tu(null),tf(!1),await tb(),ed.info("已中止生成任务")})()},children:"中止任务"}):void 0,children:(0,l.jsxs)($,{style:{width:"100%"},gap:16,children:["workflow"===tj&&to.length>0&&(0,l.jsx)($,{gap:10,children:to.map((e,t)=>{let r;return(0,l.jsxs)("div",{style:{display:"flex",gap:10,padding:10,border:"1px solid var(--colorBorderSecondary)",borderRadius:10,background:t===tC?"var(--colorFillAlter)":"var(--colorBgContainer)"},children:[(0,l.jsx)("span",{children:"process"===e.status?(0,l.jsx)(P.A,{}):"warning"===e.status?(0,l.jsx)(E.A,{style:{color:"var(--colorWarning)"}}):e.icon}),(0,l.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,l.jsxs)(i.A,{wrap:!0,children:[(0,l.jsx)(Y,{strong:!0,children:e.title}),(0,l.jsx)(o.A,{color:"finish"===e.status?"success":"error"===e.status?"error":"warning"===e.status?"warning":"process"===e.status?"processing":"default",children:"warning"===(r=e.status)?"finish":r})]}),(0,l.jsx)("div",{style:{marginTop:4,color:"var(--colorTextSecondary)",fontSize:12,whiteSpace:"pre-wrap"},children:(0,l.jsxs)("div",{children:[e.subtitle&&(0,l.jsx)("div",{style:{marginBottom:4},children:(0,l.jsx)(o.A,{children:e.subtitle})}),(0,l.jsx)("div",{children:e.description}),(0,l.jsx)("div",{style:{marginTop:4},children:e.subSteps.map(e=>{var t;return(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:12,color:"process"===e.status?"var(--colorPrimary)":"var(--colorTextSecondary)"},children:["process"===(t=e.status)?(0,l.jsx)(P.A,{}):"finish"===t?(0,l.jsx)(M.A,{}):"warning"===t?(0,l.jsx)(E.A,{style:{color:"var(--colorWarning)"}}):"error"===t?(0,l.jsx)(L.A,{}):(0,l.jsx)("span",{style:{display:"inline-block",height:6,width:6,borderRadius:"50%",background:"var(--colorTextTertiary)"}}),(0,l.jsx)("span",{children:e.title})]},e.key)})})]})})]})]},e.key)})}),"workflow"===tj&&(null==tp?void 0:tp.partialChapters)&&tp.partialChapters.length>0&&(0,l.jsx)(h.A,{size:"small",title:"章节进度",extra:(0,l.jsxs)(o.A,{color:"blue",children:[tp.partialChapters.filter(e=>"completed"===e.status||"cached"===e.status).length,"/",tp.partialChapters.length]}),children:(0,l.jsxs)($,{gap:6,style:{width:"100%"},children:[tp.partialChapters.slice(0,12).map(e=>(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,fontSize:12},children:[(0,l.jsx)(Y,{ellipsis:!0,style:{maxWidth:480},children:e.title}),(0,l.jsxs)(i.A,{size:6,children:[(0,l.jsx)(o.A,{color:"cached"===e.status?"purple":"failed"===e.status?"error":"success",children:"cached"===e.status?"缓存":"failed"===e.status?"失败":"完成"}),(0,l.jsxs)(Y,{type:"secondary",children:[e.chars.toLocaleString()," 字"]})]})]},e.id)),tp.partialChapters.length>12&&(0,l.jsxs)(Y,{type:"secondary",style:{fontSize:12},children:["其余 ",tp.partialChapters.length-12," 个章节将在完成后汇总展示"]})]})}),"workflow"===tj&&(null==tp||null==(e=tp.reviewMetadata)?void 0:e.diagnostics)&&(0,l.jsx)(Z,{type:"info",title:"后台自动优化",children:"策略:".concat(tp.reviewMetadata.diagnostics.strategy.mode,";LLM 调用 ").concat(tp.reviewMetadata.diagnostics.llm.calls," 次;缓存命中 ").concat(tp.reviewMetadata.diagnostics.cache.chapterHits," 章/").concat(tp.reviewMetadata.diagnostics.cache.sectionHits||0," 小节;噪声过滤 ").concat((null==(t=tp.reviewMetadata.diagnostics.evidence)?void 0:t.filteredNoise)||0," 条;质量门禁 阻断").concat((null==(r=tp.reviewMetadata.diagnostics.quality)?void 0:r.blockingCount)||0,"/重要").concat((null==(a=tp.reviewMetadata.diagnostics.quality)?void 0:a.importantCount)||0,"/轻微").concat((null==(B=tp.reviewMetadata.diagnostics.quality)?void 0:B.minorCount)||0,";自动限流调整 ").concat(tp.reviewMetadata.diagnostics.llm.limitAdjustments," 次。审查与诊断信息仅用于系统修复,不会写入正文或导出文件。")}),"workflow"===tj&&eR&&0===to.length&&(0,l.jsxs)("div",{style:{textAlign:"center",padding:40},children:[(0,l.jsx)(j.A,{}),(0,l.jsx)("div",{style:{marginTop:12,color:"var(--colorTextSecondary)"},children:"正在准备生成…"})]}),eD&&(0,l.jsx)("div",{ref:ep,children:(0,l.jsx)(y.A,{items:[{key:"edit",label:ec("documents.edit"),children:(0,l.jsxs)($,{gap:16,style:{width:"100%"},children:[(0,l.jsx)(J,{rows:28,value:eP,disabled:eU,onSelect:e=>{var t,r,l;return e2({start:null!=(t=e.currentTarget.selectionStart)?t:0,end:null!=(l=null!=(r=e.currentTarget.selectionEnd)?r:e.currentTarget.selectionStart)?l:0})},onChange:e=>{var t,r,l;eL(e.target.value),eZ(null),e0(null),e2({start:null!=(t=e.target.selectionStart)?t:0,end:null!=(l=null!=(r=e.target.selectionEnd)?r:e.target.selectionStart)?l:0})}}),(0,l.jsx)(h.A,{size:"small",style:{borderRadius:12,background:"linear-gradient(135deg, var(--colorFillAlter), var(--colorBgContainer))"},children:(0,l.jsxs)($,{gap:16,style:{width:"100%"},children:[(0,l.jsxs)(i.A,{align:"start",style:{width:"100%",justifyContent:"space-between"},children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)(i.A,{size:6,children:[(0,l.jsx)(R.A,{style:{color:"var(--colorAccent)"}}),(0,l.jsx)(Y,{strong:!0,children:"精准修改"}),(0,l.jsx)(o.A,{color:"blue",children:"AI 辅助"})]}),(0,l.jsx)("div",{style:{marginTop:4,color:"var(--colorTextSecondary)",fontSize:12},children:"针对当前编辑内容补充更具体的要求,AI 会保留文档结构并按你的提示细化修改。"})]}),(0,l.jsxs)(p.Ay,{size:"small",icon:(0,l.jsx)(U.A,{}),onClick:()=>e4(e=>!e),disabled:0===e6.length,children:["历史版本 ",e6.length>0?e6.length:""]})]}),(0,l.jsx)(Z,{type:"info",title:"系统只负责识别修改范围,不改写你的提示词;选中文字后优先只改选区,没有选区时按光标所在小节/章节定位。"}),(0,l.jsx)(J,{rows:4,value:eK,disabled:eU,onChange:e=>{eV(e.target.value),eZ(null),e0(null)},placeholder:"例如:写细一点;润色这段;第七章补充高处作业和临电安全措施;把安全检查频次改成每周一次。"}),(0,l.jsxs)(i.A,{wrap:!0,style:{width:"100%",justifyContent:"space-between"},children:[(0,l.jsx)(i.A,{wrap:!0,children:["写细一点","更专业","只润色选区","补充可执行措施"].map(e=>(0,l.jsx)(p.Ay,{size:"small",disabled:eU,onClick:()=>eV(t=>t?"".concat(t,";").concat(e):e),children:e},e))}),(0,l.jsx)(p.Ay,{type:"primary",icon:(0,l.jsx)(R.A,{}),loading:eU&&"planning"===eQ,disabled:!eK.trim()||eU,onClick:()=>{t6()},children:"识别修改范围"})]}),eY&&!e$&&(0,l.jsx)(h.A,{size:"small",style:{borderRadius:10,borderColor:"var(--colorAccent)"},children:(0,l.jsxs)($,{gap:8,style:{width:"100%"},children:[(0,l.jsxs)(i.A,{wrap:!0,children:[(0,l.jsx)(o.A,{color:"purple",children:eY.scope}),(0,l.jsx)(o.A,{color:"blue",children:eY.action}),(0,l.jsxs)(o.A,{color:eY.confidence>=.8?"green":"orange",children:["置信度 ",Math.round(100*eY.confidence),"%"]}),eY.targetTitle&&(0,l.jsx)(Y,{strong:!0,children:eY.targetTitle})]}),(0,l.jsx)(Y,{children:eY.summary}),(0,l.jsx)(Y,{type:"secondary",style:{fontSize:12},children:"将按你的原始提示词执行,不添加额外编辑任务。"}),(0,l.jsxs)(i.A,{children:[(0,l.jsx)(p.Ay,{type:"primary",loading:eU&&"applying"===eQ,onClick:()=>{t8(eY)},children:"执行并预览"}),(0,l.jsx)(p.Ay,{disabled:eU,onClick:()=>eZ(null),children:"取消"})]})]})}),e$&&(0,l.jsx)(h.A,{size:"small",style:{borderRadius:10,borderColor:"var(--colorSuccess)"},children:(0,l.jsxs)($,{gap:8,style:{width:"100%"},children:[(0,l.jsxs)(i.A,{wrap:!0,children:[(0,l.jsx)(o.A,{color:"green",children:"修改预览"}),(0,l.jsx)(Y,{children:e$.summary||e$.plan.summary}),(0,l.jsxs)(o.A,{children:[e$.changedChars&&e$.changedChars>0?"+".concat(e$.changedChars):e$.changedChars," 字符"]})]}),(0,l.jsxs)(v.A,{gutter:12,children:[(0,l.jsxs)(w.A,{span:12,children:[(0,l.jsx)(Y,{strong:!0,children:"修改前"}),(0,l.jsx)("div",{style:{marginTop:6,maxHeight:180,overflow:"auto",padding:10,borderRadius:8,background:"var(--colorFillAlter)",whiteSpace:"pre-wrap",fontSize:12},children:e$.beforeSnippet||"无片段预览"})]}),(0,l.jsxs)(w.A,{span:12,children:[(0,l.jsx)(Y,{strong:!0,children:"修改后"}),(0,l.jsx)("div",{style:{marginTop:6,maxHeight:180,overflow:"auto",padding:10,borderRadius:8,background:"var(--colorFillAlter)",whiteSpace:"pre-wrap",fontSize:12},children:e$.afterSnippet||"无片段预览"})]})]}),(0,l.jsxs)(i.A,{children:[(0,l.jsx)(p.Ay,{type:"primary",onClick:()=>{e$&&(t0(e$.before,e$.prompt),eL(e$.markdown),t1(!0),ed.success("已应用精准修改"))},children:"应用到文档"}),(0,l.jsx)(p.Ay,{onClick:()=>e0(null),children:"返回计划"}),(0,l.jsx)(p.Ay,{danger:!0,onClick:()=>{eZ(null),e0(null)},children:"放弃"})]})]})}),e3&&(0,l.jsx)("div",{style:{borderTop:"1px solid var(--colorBorderSecondary)",paddingTop:12},children:(0,l.jsx)(g.A,{size:"small",dataSource:e6,locale:{emptyText:"暂无历史版本"},renderItem:e=>(0,l.jsx)(g.A.Item,{actions:[(0,l.jsx)(p.Ay,{size:"small",disabled:eU,onClick:()=>{t0(eP,"恢复前版本"),eL(e.content),t1(!0),ed.success("已恢复历史版本")},children:"恢复"},"restore")],children:(0,l.jsx)(g.A.Item.Meta,{title:(0,l.jsxs)(i.A,{children:[(0,l.jsx)(Y,{children:new Date(e.createdAt).toLocaleString()}),(0,l.jsx)(o.A,{children:e.prompt})]}),description:(0,l.jsx)(Y,{type:"secondary",ellipsis:!0,children:e.content.replace(/\s+/gu," ").slice(0,120)})})})})})]})})]})},{key:"chapters-facts",label:"章节与事实",children:(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[eD.chapters.length>0&&(0,l.jsxs)("div",{children:[(0,l.jsxs)(Y,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["章节 (",eD.chapters.length,")"]}),(0,l.jsx)(g.A,{size:"small",dataSource:eD.chapters,renderItem:e=>(0,l.jsx)(g.A.Item,{children:(0,l.jsx)(g.A.Item.Meta,{title:e.title,description:"证据: ".concat(e.evidence.length," \xb7 缺失: ").concat(e.missingFacts.length)})})})]}),eD.structuredFacts.length>0&&(0,l.jsxs)("div",{children:[(0,l.jsxs)(Y,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["结构化事实 (",eD.structuredFacts.length,")"]}),(0,l.jsx)(A.A,{size:"small",column:1,bordered:!0,children:eD.structuredFacts.map((e,t)=>(0,l.jsxs)(A.A.Item,{label:e.key,children:[(0,l.jsx)("span",{children:e.value}),(0,l.jsx)(o.A,{style:{marginLeft:8},children:e.confidence.toFixed(2)}),(0,l.jsx)(Y,{type:"secondary",style:{fontSize:11,marginLeft:8},children:e.sourceFile})]},t))})]})]})},{key:"sources-missing",label:"来源与缺失",children:(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)(Y,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["引用来源 (",eD.sources.length,")"]}),0===eD.sources.length?(0,l.jsx)(m.A,{description:"暂无"}):(0,l.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:eD.sources.map(e=>(0,l.jsxs)(o.A,{color:"blue",children:[e.filePath," (",e.count,")"]},e.filePath))})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)(Y,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:["缺失项 (",eD.missingItems.length,")"]}),0===eD.missingItems.length?(0,l.jsx)(m.A,{description:"无缺失"}):(0,l.jsx)(g.A,{size:"small",dataSource:eD.missingItems,renderItem:e=>(0,l.jsx)(g.A.Item,{children:e})})]})]})},{key:"validation",label:"校验 (".concat(eD.validationIssues.length,")"),children:0===eD.validationIssues.length?(0,l.jsx)(m.A,{description:"校验通过"}):(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[eD.validationIssues.map(e=>(0,l.jsxs)("div",{style:{border:"1px solid var(--colorBorderSecondary)",borderRadius:8,padding:12},children:[(0,l.jsx)(o.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:e.level}),(0,l.jsx)("div",{style:{marginTop:6,whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.message}),e.suggestion&&(0,l.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))),eD.exportGate.checklist.length>0&&(0,l.jsxs)("div",{style:{marginTop:8},children:[(0,l.jsx)(Y,{strong:!0,style:{fontSize:13,marginBottom:8,display:"block"},children:"导出门禁"}),(0,l.jsx)(g.A,{size:"small",dataSource:eD.exportGate.checklist,renderItem:e=>(0,l.jsxs)(g.A.Item,{children:[(0,l.jsx)(Y,{style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.label}),(0,l.jsx)(o.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})]})]})},{key:"stages",label:"执行阶段 (".concat(eD.executionStages.length,")"),children:(0,l.jsx)(g.A,{size:"small",dataSource:eD.executionStages,renderItem:e=>(0,l.jsxs)(g.A.Item,{children:[(0,l.jsx)(g.A.Item.Meta,{avatar:er[e.type]||(0,l.jsx)(D.A,{}),title:(0,l.jsx)(Y,{title:e.roleId,style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:"".concat(ei[e.type]||e.type," \xb7 ").concat(e.roleName||tT(e.roleId))}),description:(0,l.jsx)(Y,{type:"secondary",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})}),(0,l.jsx)(o.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})})}]})})]})}),(0,l.jsx)(f.A,{title:ec("documents.templateEditor"),open:e5,onClose:()=>e7(!1),size:860,mask:{closable:!1},styles:{body:{padding:20,overflow:"auto"},header:{borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,l.jsxs)(i.A,{children:[(0,l.jsx)(p.Ay,{onClick:()=>e7(!1),children:ec("common.cancel")}),(0,l.jsx)(p.Ay,{type:"primary",onClick:()=>{tO()},children:ec("common.save")})]}),children:(0,l.jsxs)(d.A,{form:eu,layout:"vertical",requiredMark:"optional",children:[(0,l.jsxs)(v.A,{gutter:12,children:[(0,l.jsx)(d.A.Item,{name:"id",hidden:!0,children:(0,l.jsx)(s.A,{})}),(0,l.jsx)(w.A,{xs:24,md:8,children:(0,l.jsx)(d.A.Item,{name:"name",label:ec("documents.templateName"),rules:[{required:!0}],children:(0,l.jsx)(s.A,{})})}),(0,l.jsx)(w.A,{xs:24,md:8,children:(0,l.jsx)(d.A.Item,{name:"category",label:ec("documents.templateCategory"),children:(0,l.jsx)(s.A,{})})}),(0,l.jsx)(w.A,{xs:24,md:8,children:(0,l.jsx)(d.A.Item,{name:"outputTitle",label:ec("documents.outputTitle"),children:(0,l.jsx)(s.A,{})})}),(0,l.jsx)(w.A,{xs:24,md:12,children:(0,l.jsx)(d.A.Item,{name:"description",label:ec("documents.templateDescription"),children:(0,l.jsx)(s.A,{})})})]}),(0,l.jsx)(d.A.Item,{name:"projectRoleConfigId",label:ec("documents.projectRoleConfig"),rules:[{required:!0,message:ec("documents.projectRoleConfigRequired")}],children:(0,l.jsx)(S.A,{showSearch:!0,placeholder:ec("documents.projectRoleConfigRequired"),options:tI})}),(0,l.jsxs)("div",{style:{marginBottom:16},children:[(0,l.jsxs)(i.A,{style:{width:"100%",justifyContent:"space-between",marginBottom:8},children:[(0,l.jsx)(Y,{strong:!0,children:"项目文件绑定"}),(0,l.jsx)(o.A,{color:"blue",children:"按文件角色多选"})]}),(0,l.jsx)(Z,{type:"info",title:"每个文件角色可直接勾选文件或文件夹;勾选文件夹会自动绑定该文件夹下所有文件。保存时仍按具体文件路径绑定,兼容现有模板和生成流程。",style:{marginBottom:12}}),(0,l.jsx)(s.A.Search,{allowClear:!0,placeholder:"搜索文件或文件夹",value:eC,onChange:e=>eT(e.target.value),style:{marginBottom:12}}),ek?(0,l.jsxs)("div",{style:{textAlign:"center",padding:24},children:[(0,l.jsx)(j.A,{}),(0,l.jsx)("div",{style:{marginTop:12,color:"var(--colorTextSecondary)"},children:"正在加载知识库文件…"})]}):0===tt.length?(0,l.jsx)(m.A,{image:m.A.PRESENTED_IMAGE_SIMPLE,description:"暂无可用文件角色"}):0===tl.length?(0,l.jsx)(m.A,{image:m.A.PRESENTED_IMAGE_SIMPLE,description:"暂无知识库文件"}):tt.map(e=>{let t=en(tr[e.value]||[]).filter(e=>ts.includes(e)),r=new Set(ea(tn));return(0,l.jsxs)(h.A,{size:"small",style:{marginBottom:12},title:(0,l.jsxs)(i.A,{children:[(0,l.jsx)(Y,{children:e.label}),(0,l.jsxs)(o.A,{color:"blue",children:["已选 ",t.length]})]}),extra:(0,l.jsx)(p.Ay,{size:"small",disabled:0===t.length,onClick:()=>tN(e.value,[]),children:"清空"}),children:[(0,l.jsx)(d.A.Item,{name:["fileBindingGroups",e.value],hidden:!0,children:(0,l.jsx)(s.A,{})}),(0,l.jsx)("div",{style:{marginBottom:8,color:"var(--colorTextSecondary)",fontSize:12},children:t.length>0?t.slice(0,3).map(es).join("、")+(t.length>3?" 等 ".concat(t.length," 个文件"):""):"未选择文件"}),(0,l.jsx)(b.A,{checkable:!0,blockNode:!0,height:320,treeData:tn,checkedKeys:t,expandedKeys:eC.trim()?ti:ez,onExpand:e=>eB(e),onCheck:(l,n)=>{let s=new Set(t.filter(e=>!r.has(e)));for(let e of n.checkedNodes)e.isFolder?ea([e]).forEach(e=>s.add(e)):s.add(e.key);tN(e.value,Array.from(s))}})]},e.value)})]}),(0,l.jsx)(Z,{type:"info",title:"文档规范由后台根据模板、提示词和角色绑定自动生成,无需手动维护规范包。"})]})})]})}}},e=>{e.O(0,[433,787,576,195,375,455,506,63,636,593,792],()=>e(e.s=16403)),_N_E=e.O()}]);
|
|
File without changes
|