@customize-agent/server 4.0.32 → 4.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +5 -5
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/chunks/3298.js +1 -1
  5. package/.next/server/middleware-build-manifest.js +1 -1
  6. package/.next/server/pages/404.html +1 -1
  7. package/.next/server/pages/500.html +1 -1
  8. package/.next/server/pages/api/documents/roles.js +1 -1
  9. package/.next/server/pages/api/prompt.js +1 -1
  10. package/.next/server/pages/asset-library.html +1 -1
  11. package/.next/server/pages/context/long-term.html +1 -1
  12. package/.next/server/pages/context/short-term.html +1 -1
  13. package/.next/server/pages/document-roles.html +1 -1
  14. package/.next/server/pages/documents.html +1 -1
  15. package/.next/server/pages/guide.html +1 -1
  16. package/.next/server/pages/index.html +1 -1
  17. package/.next/server/pages/knowledge/file-detail.html +1 -1
  18. package/.next/server/pages/knowledge/files.html +1 -1
  19. package/.next/server/pages/knowledge/manage.html +1 -1
  20. package/.next/server/pages/knowledge/search.html +1 -1
  21. package/.next/server/pages/knowledge.html +1 -1
  22. package/.next/server/pages/models.html +1 -1
  23. package/.next/server/pages/overview.html +1 -1
  24. package/.next/server/pages/prompt.html +1 -1
  25. package/.next/server/pages/settings.html +1 -1
  26. package/.next/server/pages/system/logs.html +1 -1
  27. package/.next/server/pages-manifest.json +24 -24
  28. package/.next/static/chunks/496-4fb9a063790e65ff.js +1 -0
  29. package/.next/static/chunks/pages/document-roles-cb222be93cfd561d.js +1 -0
  30. package/.next/static/chunks/pages/prompt-9b869fbe3463020d.js +1 -0
  31. package/.next/static/{M3RTsFPBW6tg_7bJE5A2X → uHdcfPzCqe3P5ODb-z6TQ}/_buildManifest.js +1 -1
  32. package/package.json +4 -4
  33. package/.next/static/chunks/909-27ada1f00a52e11d.js +0 -1
  34. package/.next/static/chunks/pages/document-roles-24e4ba16d654959d.js +0 -1
  35. package/.next/static/chunks/pages/prompt-3468fb841f4c5c8c.js +0 -1
  36. /package/.next/static/{M3RTsFPBW6tg_7bJE5A2X → uHdcfPzCqe3P5ODb-z6TQ}/_ssgManifest.js +0 -0
@@ -2,63 +2,63 @@
2
2
  "/_app": "pages/_app.js",
3
3
  "/api/assets/generated": "pages/api/assets/generated.js",
4
4
  "/api/assets/generated/preview": "pages/api/assets/generated/preview.js",
5
+ "/api/config/embedding/healthCheck": "pages/api/config/embedding/healthCheck.js",
5
6
  "/api/config/models": "pages/api/config/models.js",
6
- "/_error": "pages/_error.js",
7
7
  "/api/context": "pages/api/context.js",
8
8
  "/api/documents/chapter/regenerate": "pages/api/documents/chapter/regenerate.js",
9
- "/api/config/embedding/healthCheck": "pages/api/config/embedding/healthCheck.js",
10
9
  "/api/documents/drafts": "pages/api/documents/drafts.js",
10
+ "/api/documents/generate": "pages/api/documents/generate.js",
11
11
  "/api/documents/generated/[id]": "pages/api/documents/generated/[id].js",
12
+ "/api/documents/generated": "pages/api/documents/generated.js",
12
13
  "/api/documents/roles": "pages/api/documents/roles.js",
13
- "/api/documents/generate": "pages/api/documents/generate.js",
14
- "/api/jobs/[id]": "pages/api/jobs/[id].js",
15
- "/api/health": "pages/api/health.js",
16
14
  "/api/documents/templates": "pages/api/documents/templates.js",
17
- "/api/documents/generated": "pages/api/documents/generated.js",
15
+ "/_error": "pages/_error.js",
16
+ "/api/health": "pages/api/health.js",
18
17
  "/api/jobs": "pages/api/jobs.js",
19
- "/api/kb/files/detail": "pages/api/kb/files/detail.js",
20
- "/api/kb/categories": "pages/api/kb/categories.js",
18
+ "/api/jobs/[id]": "pages/api/jobs/[id].js",
19
+ "/api/kb/duplicates": "pages/api/kb/duplicates.js",
21
20
  "/api/kb/features": "pages/api/kb/features.js",
21
+ "/api/kb/categories": "pages/api/kb/categories.js",
22
+ "/api/kb/files/detail": "pages/api/kb/files/detail.js",
23
+ "/api/kb/files": "pages/api/kb/files.js",
22
24
  "/api/kb/files/open": "pages/api/kb/files/open.js",
23
- "/api/kb/ignore": "pages/api/kb/ignore.js",
24
25
  "/api/kb/files/reindex": "pages/api/kb/files/reindex.js",
25
- "/api/kb/files": "pages/api/kb/files.js",
26
- "/api/kb/search": "pages/api/kb/search.js",
27
- "/api/kb/stats": "pages/api/kb/stats.js",
26
+ "/api/kb/ignore": "pages/api/kb/ignore.js",
28
27
  "/api/kb/files/search": "pages/api/kb/files/search.js",
29
- "/api/kb/reindex": "pages/api/kb/reindex.js",
30
28
  "/api/kb/operations": "pages/api/kb/operations.js",
29
+ "/api/kb/reindex": "pages/api/kb/reindex.js",
30
+ "/api/kb/search": "pages/api/kb/search.js",
31
+ "/api/kb/stats": "pages/api/kb/stats.js",
31
32
  "/api/kb/tags": "pages/api/kb/tags.js",
32
- "/api/kb/duplicates": "pages/api/kb/duplicates.js",
33
33
  "/api/kb/upload/progress": "pages/api/kb/upload/progress.js",
34
34
  "/api/prompt": "pages/api/prompt.js",
35
35
  "/api/system/logs": "pages/api/system/logs.js",
36
+ "/api/system/stats": "pages/api/system/stats.js",
36
37
  "/context/long-term": "pages/context/long-term.html",
37
- "/context/short-term": "pages/context/short-term.html",
38
38
  "/asset-library": "pages/asset-library.html",
39
39
  "/document-roles": "pages/document-roles.html",
40
40
  "/guide": "pages/guide.html",
41
- "/api/system/stats": "pages/api/system/stats.js",
42
- "/": "pages/index.html",
43
41
  "/documents": "pages/documents.html",
44
- "/knowledge": "pages/knowledge.html",
42
+ "/": "pages/index.html",
45
43
  "/knowledge/files": "pages/knowledge/files.html",
44
+ "/knowledge/file-detail": "pages/knowledge/file-detail.html",
45
+ "/knowledge": "pages/knowledge.html",
46
46
  "/knowledge/manage": "pages/knowledge/manage.html",
47
47
  "/knowledge/search": "pages/knowledge/search.html",
48
- "/overview": "pages/overview.html",
49
48
  "/models": "pages/models.html",
50
- "/knowledge/file-detail": "pages/knowledge/file-detail.html",
49
+ "/overview": "pages/overview.html",
51
50
  "/prompt": "pages/prompt.html",
52
- "/api/config/providers": "pages/api/config/providers.js",
53
- "/api/config/providers/[provider]": "pages/api/config/providers/[provider].js",
54
51
  "/system/logs": "pages/system/logs.html",
55
52
  "/api/config/embedding": "pages/api/config/embedding.js",
56
- "/settings": "pages/settings.html",
53
+ "/api/config/providers/[provider]": "pages/api/config/providers/[provider].js",
54
+ "/api/config/providers": "pages/api/config/providers.js",
55
+ "/context/short-term": "pages/context/short-term.html",
57
56
  "/api/config/healthCheck": "pages/api/config/healthCheck.js",
57
+ "/settings": "pages/settings.html",
58
58
  "/api/kb/files/preview-pdf-page": "pages/api/kb/files/preview-pdf-page.js",
59
59
  "/api/kb/upload": "pages/api/kb/upload.js",
60
60
  "/api/prompt/chat": "pages/api/prompt/chat.js",
61
- "/_document": "pages/_document.js",
62
61
  "/api/documents/export": "pages/api/documents/export.js",
62
+ "/_document": "pages/_document.js",
63
63
  "/404": "pages/404.html"
64
64
  }
@@ -0,0 +1 @@
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"}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[623],{23507:(e,l,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return i(59889)}])},59889:(e,l,i)=>{"use strict";i.r(l),i.d(l,{default:()=>Z});var r=i(65321),n=i(97109),t=i(35292),s=i(11702),o=i(17807),a=i(63455),c=i(33442),d=i(84253),p=i(68787),x=i(85114),m=i(26171),h=i(57271),u=i(85493),f=i(34052),y=i(7576),j=i(2256),g=i(38770),A=i(58569),v=i(25345),b=i(43979),w=i(80042),S=i(75548),I=i(26631),z=i(84662),T=i(30486),C=i(99650),k=i(8263),R=i(84742),B=i(43094),F=i(8579),_=i(81668),O=i(58209),N=i(96091),D=i(54746),W=i(96651),H=i(60470),E=i(6578),P=i(79059);let{Paragraph:L}=t.A,q={rule:(0,r.jsx)(v.A,{}),project_fact:(0,r.jsx)(b.A,{}),table:(0,r.jsx)(w.A,{}),drawing:(0,r.jsx)(S.A,{}),specification:(0,r.jsx)(I.A,{}),reference:(0,r.jsx)(z.A,{})},U={fact_extraction:(0,r.jsx)(T.A,{}),chapter_generation:(0,r.jsx)(C.A,{}),llm_review:(0,r.jsx)(k.A,{}),validation:(0,r.jsx)(R.A,{}),formatting:(0,r.jsx)(B.A,{}),reference:(0,r.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"},J={rule:"roles.ruleFile",project_fact:"roles.projectFactFile",table:"roles.tableFile",drawing:"roles.drawingFile",specification:"roles.specificationFile",reference:"roles.reference"},Q={fact_extraction:"roles.factExtraction",chapter_generation:"roles.chapterGeneration",llm_review:"roles.llmReview",validation:"roles.validation",formatting:"roles.formatting",reference:"roles.reference"},X=e=>(0,r.jsx)(s.A,{closable:e.closable,onClose:e.onClose,color:"blue",style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:e.label});function K(e,l){let i=new Blob([JSON.stringify(l,null,2)],{type:"application/json;charset=utf-8"}),r=URL.createObjectURL(i),n=document.createElement("a");n.href=r,n.download=e,n.click(),URL.revokeObjectURL(r)}function M(e){return e.trim().replace(/[\\/:*?"<>|]/g,"-").slice(0,80)||"untitled"}function Y(e,l){return{type:"customize-agent.documentRoles",version:1,exportedAt:new Date().toISOString(),roles:e,configs:l}}function Z(){let e,l,i=(0,P.Vr)(),{message:t}=o.A.useApp(),[v]=a.A.useForm(),[b]=a.A.useForm(),[w,S]=(0,n.useState)([]),[z,T]=(0,n.useState)([]),[k,R]=(0,n.useState)([]),[B,Z]=(0,n.useState)(!1),[$,ee]=(0,n.useState)([]),[el,ei]=(0,n.useState)(!1),[er,en]=(0,n.useState)(!1),[et,es]=(0,n.useState)(!1),[eo,ea]=(0,n.useState)("file"),[ec,ed]=(0,n.useState)("custom"),[ep,ex]=(0,n.useState)(!1),em=(0,n.useRef)(null),eh=async()=>{let[e,l,i]=await Promise.all([(0,E.lv)(),(0,E.nU)({limit:200,includeContent:!1}),(0,E.dx)()]);S(e.roles),T(e.configs),R(l.files),ee(i)};(0,n.useEffect)(()=>{eh().catch(()=>t.error(i("common.error")))},[t,i]);let eu=()=>"all"===ec||"custom"===ec,ef=w.filter(eu),ey=z.filter(eu),ej=ef.filter(e=>"file"===e.type),eg=ef.filter(e=>"prompt"===e.type),eA=w.filter(e=>"file"===e.type),ev=w.filter(e=>"prompt"===e.type),eb=async()=>{try{let e=await v.validateFields(),l=await (0,E.dg)(e);S(l.roles),T(l.configs),ei(!1),t.success(i("common.success"))}catch(e){t.error(i("common.error"))}},ew=async()=>{try{let e=await b.validateFields(),l=e=>(null!=e?e:[]).map((e,l)=>{var i;return{roleId:e.roleId,order:Number(null!=(i=e.order)?i:l)}}),r=await (0,E.NR)({...e,fileRoles:l(e.fileRoles),promptRoles:l(e.promptRoles)});S(r.roles),T(r.configs),en(!1),t.success(i("common.success"))}catch(e){t.error(i("common.error"))}},eS=async e=>{let l=await (0,E.FV)(e.type,e.id);S(l.roles),T(l.configs)},eI=async e=>{let l=await (0,E.dw)(e);S(l.roles),T(l.configs)},ez=async e=>{if(e){ex(!0);try{let l=JSON.parse(await e.text()),i=await fetch("/api/documents/roles?mode=import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!i.ok)throw Error(await i.text());let r=await i.json();S(r.roles),T(r.configs),t.success("已导入 ".concat(r.importedRoles," 个角色、").concat(r.importedConfigs," 个配置"))}catch(e){t.error("导入失败,请确认 JSON 文件格式正确")}finally{ex(!1),em.current&&(em.current.value="")}}},eT=function(e){var l;let i=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:i,resourceIds:[],executionType:"prompt"===i?"reference":void 0,processingType:"file"===i?"reference":void 0}),ei(!0)},eC=e=>{b.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[],builtIn:!1}),en(!0)},ek=e=>w.find(l=>l.id===e),eR=async e=>{Z(!0);try{let l=await (0,E.nU)({query:e,limit:80,includeContent:!!e.trim()});R(l.files)}catch(e){t.error("知识库文件检索失败")}finally{Z(!1)}},eB=k.map(e=>({label:(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8},children:[(0,r.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.relativePath}),(0,r.jsxs)(c.A,{size:4,children:[(0,r.jsx)(s.A,{color:"content"===e.matchedBy?"purple":"disk"===e.matchedBy?"orange":"blue",style:{margin:0},children:"content"===e.matchedBy?"内容":"disk"===e.matchedBy?"磁盘":"文件"}),(0,r.jsx)(s.A,{style:{margin:0},children:e.status})]})]}),value:e.relativePath}));return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"pageTitle",children:i("roles.title")}),(0,r.jsx)("p",{className:"pageDesc",children:i("roles.description")})]}),(0,r.jsxs)(c.A,{children:[(0,r.jsx)(h.A,{value:ec,onChange:ed,style:{width:170},options:[{label:"我的配置 (".concat(w.length+z.length,")"),value:"custom"},{label:"全部来源 (".concat(w.length+z.length,")"),value:"all"}]}),(0,r.jsx)("input",{ref:em,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:e=>{var l;ez(null==(l=e.target.files)?void 0:l[0])}}),(0,r.jsx)(x.Ay,{icon:(0,r.jsx)(N.A,{}),loading:ep,onClick:()=>{var e;return null==(e=em.current)?void 0:e.click()},children:"导入"}),(0,r.jsx)(x.Ay,{icon:(0,r.jsx)(_.A,{}),disabled:w.length+z.length===0,onClick:()=>{K("customize-document-roles-".concat(new Date().toISOString().slice(0,10),".json"),Y(w,z)),t.success("已导出 ".concat(w.length," 个角色、").concat(z.length," 个配置"))},children:"导出全部"}),(0,r.jsx)(x.Ay,{icon:(0,r.jsx)(D.A,{}),onClick:()=>eT(void 0,"file"),children:i("roles.newFileRole")}),(0,r.jsx)(x.Ay,{icon:(0,r.jsx)(D.A,{}),onClick:()=>eT(void 0,"prompt"),children:i("roles.newPromptRole")}),(0,r.jsx)(x.Ay,{type:"primary",icon:(0,r.jsx)(D.A,{}),onClick:()=>eC(),children:i("roles.newConfig")})]})]}),(0,r.jsx)(u.A,{type:"info",showIcon:!0,message:(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsx)("span",{children:i("roles.plainGuideTitle")}),(0,r.jsx)(x.Ay,{type:"link",size:"small",icon:et?(0,r.jsx)(W.A,{}):(0,r.jsx)(H.A,{}),onClick:()=>es(!et),style:{padding:"0 4px"},children:et?"收起说明":"展开说明"})]}),description:et?i("roles.plainGuideDesc"):void 0}),(0,r.jsx)(p.A,{size:"small",tabList:[{key:"file",label:"文件角色 (".concat(ej.length,")")},{key:"prompt",label:"提示词角色 (".concat(eg.length,")")},{key:"configs",label:"项目角色配置 (".concat(ey.length,")")}],activeTabKey:eo,onTabChange:ea,children:"configs"===eo?0===ey.length?(0,r.jsx)(d.A,{description:i("common.noData")}):(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:ey.map(e=>{let l=e.fileRoles.map(e=>({...e,role:ek(e.roleId)})).filter(e=>e.role),n=e.promptRoles.map(e=>({...e,role:ek(e.roleId)})).filter(e=>e.role);return(0,r.jsxs)(p.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:6},children:[(0,r.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.name}),(0,r.jsx)(s.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的配置"}),(0,r.jsxs)("div",{style:{display:"flex",gap:4,flexShrink:0},children:[(0,r.jsx)(x.Ay,{size:"small",icon:(0,r.jsx)(C.A,{}),onClick:()=>eC(e),children:"编辑"}),!e.builtIn&&(0,r.jsx)(x.Ay,{size:"small",icon:(0,r.jsx)(_.A,{}),onClick:()=>(e=>{let l=new Set([...e.fileRoles.map(e=>e.roleId),...e.promptRoles.map(e=>e.roleId)]);K("customize-role-config-".concat(M(e.name),"-").concat(new Date().toISOString().slice(0,10),".json"),Y(w.filter(e=>l.has(e.id)&&!e.builtIn),[e])),t.success("已导出 1 个配置")})(e),children:"导出"}),(0,r.jsx)(m.A,{title:i("common.confirm"),onConfirm:()=>{eI(e.id)},children:(0,r.jsx)(x.Ay,{size:"small",danger:!0,icon:(0,r.jsx)(O.A,{})})})]})]}),e.description&&(0,r.jsx)(L,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,r.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,r.jsxs)("div",{style:{marginBottom:4},children:[(0,r.jsxs)("span",{children:["文件角色 (",e.fileRoles.length,"): "]}),l.length>0?(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[l.slice(0,4).map(e=>(0,r.jsx)(s.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),l.length>4&&(0,r.jsxs)(s.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",l.length-4]})]}):(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("span",{children:["提示词角色 (",e.promptRoles.length,"): "]}),n.length>0?(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[n.slice(0,4).map(e=>(0,r.jsx)(s.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),n.length>4&&(0,r.jsxs)(s.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",n.length-4]})]}):(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]})]})]},e.id)})}):(e="file"===eo?ej:eg,l=i,0===e.length?(0,r.jsx)(d.A,{description:i("common.noData")}):(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(270px, 1fr))",gap:12},children:e.map((e,n)=>{var o,a,c,d,h,u,f,y,j;let g=(null==(o=e.resourceIds)?void 0:o.length)?e.resourceIds:e.resourceId?[e.resourceId]:[],A=g.slice(0,3),v=g.length-A.length,b="file"===e.type?null!=(c=q[null!=(a=e.processingType)?a:""])?c:(0,r.jsx)(I.A,{}):null!=(h=U[null!=(d=e.executionType)?d:""])?h:(0,r.jsx)(F.A,{}),w="file"===e.type?null!=(f=V[null!=(u=e.processingType)?u:""])?f:"var(--colorAccent)":null!=(j=G[null!=(y=e.executionType)?y:""])?j:"var(--colorWarning)";return(0,r.jsxs)(p.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:8},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,flex:1},children:[(0,r.jsx)("span",{style:{color:w,fontSize:16,flexShrink:0,lineHeight:1},children:b}),(0,r.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"20px"},children:e.name})]}),(0,r.jsx)("div",{style:{display:"flex",gap:4,flexShrink:0},children:(0,r.jsx)(s.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的角色"})})]}),e.description&&(0,r.jsx)(L,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,r.jsxs)("div",{style:{marginBottom:8,display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,r.jsx)(s.A,{color:"file"===e.type?"blue":"purple",style:{margin:0},children:function(e,l){var i,r,n;let t="file"===e.type?J[null!=(i=e.processingType)?i:""]:Q[null!=(r=e.executionType)?r:""];return t?l(t):null!=(n="file"===e.type?e.processingType:e.executionType)?n:""}(e,l)}),g.length>0&&(0,r.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",g.length," 个资源"]})]}),A.length>0&&(0,r.jsx)("div",{style:{marginBottom:10},children:(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[A.map(e=>(0,r.jsx)(s.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"},children:e},e)),v>0&&(0,r.jsxs)(s.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",v]})]})}),(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:6,paddingTop:4,borderTop:"1px solid var(--colorBorderSecondary)"},children:[(0,r.jsx)(x.Ay,{size:"small",icon:(0,r.jsx)(C.A,{}),onClick:()=>eT(e),children:"编辑"}),!e.builtIn&&(0,r.jsx)(x.Ay,{size:"small",icon:(0,r.jsx)(_.A,{}),onClick:()=>{K("customize-role-".concat(M(e.name),"-").concat(new Date().toISOString().slice(0,10),".json"),Y([e],[])),t.success("已导出 1 个角色")},children:"导出"}),(0,r.jsx)(m.A,{title:i("common.confirm"),onConfirm:()=>{eS(e)},children:(0,r.jsx)(x.Ay,{size:"small",danger:!0,icon:(0,r.jsx)(O.A,{})})})]})]},e.id)})}))}),(0,r.jsx)(f.A,{title:i("roles.roleEditor"),open:el,onClose:()=>ei(!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,r.jsx)(x.Ay,{type:"primary",onClick:()=>{eb()},children:i("common.save")}),children:(0,r.jsxs)(a.A,{form:v,layout:"vertical",children:[(0,r.jsx)(a.A.Item,{name:"id",hidden:!0,children:(0,r.jsx)(y.A,{})}),(0,r.jsxs)(j.A,{gutter:16,children:[(0,r.jsx)(g.A,{span:12,children:(0,r.jsx)(a.A.Item,{name:"type",label:i("roles.roleType"),rules:[{required:!0}],children:(0,r.jsx)(h.A,{options:[{label:i("roles.fileRole"),value:"file"},{label:i("roles.promptRole"),value:"prompt"}]})})}),(0,r.jsx)(g.A,{span:12,children:(0,r.jsx)(a.A.Item,{name:"name",label:i("roles.roleName"),rules:[{required:!0}],children:(0,r.jsx)(y.A,{})})})]}),(0,r.jsx)(a.A.Item,{name:"description",label:i("roles.roleDescription"),children:(0,r.jsx)(y.A.TextArea,{rows:2})}),(0,r.jsx)(a.A.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.type!==l.type,children:e=>{let{getFieldValue:l}=e,n="prompt"===l("type");return(0,r.jsx)(p.A,{size:"small",title:n?"提示词角色配置":"文件角色配置",style:{border:"1px solid var(--colorBorderSecondary)"},children:n?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.A.Item,{name:"executionType",label:i("roles.executionType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,r.jsx)(h.A,{options:[{label:i("roles.factExtraction"),value:"fact_extraction"},{label:i("roles.chapterGeneration"),value:"chapter_generation"},{label:i("roles.validation"),value:"validation"},{label:i("roles.formatting"),value:"formatting"},{label:i("roles.reference"),value:"reference"}]})}),(0,r.jsx)(a.A.Item,{name:"resourceIds",label:i("roles.bindPrompt"),style:{marginBottom:0},help:(0,r.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:i("roles.multiBindPromptHelp")}),children:(0,r.jsx)(h.A,{mode:"multiple",showSearch:!0,tagRender:X,placeholder:"选择提示词",options:$.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.A.Item,{name:"processingType",label:i("roles.processingType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,r.jsx)(h.A,{options:[{label:i("roles.ruleFile"),value:"rule"},{label:i("roles.projectFactFile"),value:"project_fact"},{label:i("roles.tableFile"),value:"table"},{label:i("roles.drawingFile"),value:"drawing"},{label:i("roles.specificationFile"),value:"specification"},{label:i("roles.reference"),value:"reference"}]})}),(0,r.jsx)(a.A.Item,{name:"resourceIds",label:i("roles.bindFile"),style:{marginBottom:0},help:(0,r.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:i("roles.multiBindFileHelp")}),children:(0,r.jsx)(h.A,{mode:"multiple",showSearch:!0,filterOption:!1,loading:B,onSearch:e=>{eR(e)},onFocus:()=>{eR("")},tagRender:X,placeholder:"输入关键词搜索知识库文件",options:eB,optionLabelProp:"value"})})]})})}})]})}),(0,r.jsx)(f.A,{title:i("roles.configEditor"),open:er,onClose:()=>en(!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,r.jsx)(x.Ay,{type:"primary",onClick:()=>{ew()},children:i("common.save")}),children:(0,r.jsxs)(a.A,{form:b,layout:"vertical",children:[(0,r.jsx)(a.A.Item,{name:"id",hidden:!0,children:(0,r.jsx)(y.A,{})}),(0,r.jsxs)(j.A,{gutter:16,children:[(0,r.jsx)(g.A,{span:12,children:(0,r.jsx)(a.A.Item,{name:"name",label:i("roles.configName"),rules:[{required:!0}],children:(0,r.jsx)(y.A,{})})}),(0,r.jsx)(g.A,{span:12,children:(0,r.jsx)(a.A.Item,{name:"description",label:i("roles.configDescription"),children:(0,r.jsx)(y.A,{})})})]}),(0,r.jsx)(A.A,{destroyInactiveTabPane:!1,items:[{key:"file",label:"文件角色 (".concat(ej.length,")"),children:(0,r.jsx)(a.A.List,{name:"fileRoles",children:(e,l)=>{let{add:n,remove:t}=l;return(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0===e.length&&(0,r.jsx)(d.A,{description:"暂未添加文件角色"}),e.map((e,l)=>(0,r.jsxs)(p.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,r.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,r.jsx)(x.Ay,{danger:!0,size:"small",icon:(0,r.jsx)(O.A,{}),onClick:()=>t(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,r.jsxs)(j.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,r.jsx)(g.A,{flex:"auto",children:(0,r.jsx)(a.A.Item,{name:[e.name,"roleId"],label:"文件角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,r.jsx)(h.A,{placeholder:"选择文件角色",size:"small",options:eA.map(e=>{var l;return{label:"".concat(e.name," (").concat(i(J[null!=(l=e.processingType)?l:""]||"roles.reference"),")"),value:e.id}})})})}),(0,r.jsx)(g.A,{style:{width:90},children:(0,r.jsx)(a.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,r.jsx)(y.A,{type:"number",size:"small"})})})]})]},e.key)),(0,r.jsx)(x.Ay,{icon:(0,r.jsx)(D.A,{}),onClick:()=>n({order:e.length}),children:i("roles.addRole")})]})}})},{key:"prompt",label:"提示词角色 (".concat(ev.length,")"),children:(0,r.jsx)(a.A.List,{name:"promptRoles",children:(e,l)=>{let{add:n,remove:t}=l;return(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0===e.length&&(0,r.jsx)(d.A,{description:"暂未添加提示词角色"}),e.map((e,l)=>(0,r.jsxs)(p.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,r.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,r.jsx)(x.Ay,{danger:!0,size:"small",icon:(0,r.jsx)(O.A,{}),onClick:()=>t(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,r.jsxs)(j.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,r.jsx)(g.A,{flex:"auto",children:(0,r.jsx)(a.A.Item,{name:[e.name,"roleId"],label:"提示词角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,r.jsx)(h.A,{placeholder:"选择提示词角色",size:"small",options:ev.map(e=>{var l;return{label:"".concat(e.name," (").concat(i(Q[null!=(l=e.executionType)?l:""]||"roles.reference"),")"),value:e.id}})})})}),(0,r.jsx)(g.A,{style:{width:90},children:(0,r.jsx)(a.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,r.jsx)(y.A,{type:"number",size:"small"})})})]})]},e.key)),(0,r.jsx)(x.Ay,{icon:(0,r.jsx)(D.A,{}),onClick:()=>n({order:e.length}),children:i("roles.addRole")})]})}})}]})]})})]})}}},e=>{e.O(0,[433,787,576,195,455,496,636,593,792],()=>e(e.s=23507)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{27549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(34508)}])},34508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>K});var o=r(65321),l=r(97109),i=r(79059),n=r(17807),s=r(33442),a=r(11702),c=r(56985),d=r(85114),p=r(26171),h=r(68787),m=r(88762),u=r(7576),x=r(57271),y=r(49292),f=r(55122),g=r(84253),j=r(34052),v=r(42700),w=r(54746),S=r(99650),A=r(81668),b=r(58209),C=r(26631),k=r(29606),z=r(96091),T=r(30486),N=r(46082),F=r(42758),I=r(24810),O=r(7492);async function B(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function E(e,t,r){let o=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t,name:r})});if(!o.ok)throw Error("Failed");return o.json()}async function R(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function P(e,t){let r=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function W(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"select",selectedIds:e})});if(!t.ok)throw Error("Failed");return t.json()}async function D(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"import",...e&&"object"==typeof e?e:{prompts:[]}})});if(!t.ok)throw Error(await t.text());return t.json()}async function H(){return J("",!1,60)}async function _(e){let t=await fetch("/api/kb/files/detail?relativePath=".concat(encodeURIComponent(e)));if(!t.ok)throw Error("Failed");return((await t.json()).chunks||[]).map(e=>e.content||"").filter(Boolean).join("\n\n").slice(0,12e3)}async function J(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,o=new URLSearchParams({limit:String(r)});e.trim()&&o.set("q",e.trim()),t||o.set("includeContent","0");let l=await fetch("/api/kb/files/search?".concat(o));return l.ok&&(await l.json()).files||[]}async function L(e){let t=await fetch("/api/prompt/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.text();try{let t=JSON.parse(e);throw Error(t.error||t.message||e||"AI 对话失败")}catch(t){throw Error(e||"AI 对话失败")}}return t.json()}function M(e,t){let r=new Blob([JSON.stringify(t,null,2)],{type:"application/json;charset=utf-8"}),o=URL.createObjectURL(r),l=document.createElement("a");l.href=o,l.download=e,l.click(),URL.revokeObjectURL(o)}function U(e){return e.id.startsWith("custom:")}function $(e){return U(e)?"custom":e.isCurrent?"current":"project"}function G(e,t,r){return e?"customize-agent:prompt-chat:".concat(e.id,":").concat(e.customizePath||e.projectName):"customize-agent:prompt-chat:draft:".concat(r||t||"new")}function X(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:220,r=e.hasFile&&e.content?e.content.replace(/^#.*$/gm,"").replace(/\n{3,}/g,"\n\n").trim():"";return r.length>t?"".concat(r.slice(0,t),"..."):r}function Y(e){let t=Date.parse(e);return Number.isNaN(t)?"-":new Date(t).toLocaleString()}function Z(e){return{type:"customize-agent.prompts",version:1,exportedAt:new Date().toISOString(),prompts:e.map(e=>({name:e.projectName,content:e.content||"",selected:e.selected,source:$(e)}))}}function q(e){let t=e.match(/(^|\s)@([^\s@]*)$/);return t?t[2]:null}function K(){let e=(0,i.Vr)(),{message:t}=n.A.useApp(),[r,K]=(0,l.useState)(!0),[V,Q]=(0,l.useState)([]),[ee,et]=(0,l.useState)(!1),[er,eo]=(0,l.useState)(null),[el,ei]=(0,l.useState)(""),[en,es]=(0,l.useState)(""),[ea,ec]=(0,l.useState)(!1),[ed,ep]=(0,l.useState)(!1),[eh,em]=(0,l.useState)("custom"),[eu,ex]=(0,l.useState)("all"),[ey,ef]=(0,l.useState)("mtime"),[eg,ej]=(0,l.useState)("list"),[ev,ew]=(0,l.useState)(""),[eS,eA]=(0,l.useState)(null),[eb,eC]=(0,l.useState)([]),[ek,ez]=(0,l.useState)(!1),[eT,eN]=(0,l.useState)([]),[eF,eI]=(0,l.useState)(""),[eO,eB]=(0,l.useState)(""),[eE,eR]=(0,l.useState)(!1),[eP,eW]=(0,l.useState)([]),[eD,eH]=(0,l.useState)([]),[e_,eJ]=(0,l.useState)([]),[eL,eM]=(0,l.useState)(!1),[eU,e$]=(0,l.useState)(!1),[eG,eX]=(0,l.useState)(!1),eY=(0,l.useRef)(null),eZ=(0,l.useRef)(null),eq=q(eO),eK=async()=>{K(!0);try{Q(await B())}catch(r){t.error(e("common.error"))}finally{K(!1)}};(0,l.useEffect)(()=>{eK()},[]),(0,l.useEffect)(()=>{let e=window.localStorage.getItem("customize-agent:prompt-view-mode");("list"===e||"card"===e)&&ej(e)},[]),(0,l.useEffect)(()=>{window.localStorage.setItem("customize-agent:prompt-view-mode",eg)},[eg]),(0,l.useEffect)(()=>{let e=eZ.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),eF&&window.localStorage.setItem(eF,JSON.stringify(eT.slice(-30)))},[eT,eE,eF]),(0,l.useEffect)(()=>{!ee||eP.length>0||eL||(eM(!0),H().then(eW).catch(()=>void 0).finally(()=>eM(!1)))},[ee,eP.length,eL]),(0,l.useEffect)(()=>{let e=null==eq?void 0:eq.trim();if(!ee||!e){eH([]),e$(!1);return}let t=!1;e$(!0);let r=window.setTimeout(()=>{J(e).then(e=>{t||eH(e)}).catch(()=>{t||eH([])}).finally(()=>{t||e$(!1)})},250);return()=>{t=!0,window.clearTimeout(r)}},[ee,eq]);let eV=V.find(e=>e.isCurrent),eQ=V.filter(U),e0={all:V.length,custom:V.filter(e=>"custom"===$(e)).length,current:V.filter(e=>"current"===$(e)).length,project:V.filter(e=>"project"===$(e)).length,selected:V.filter(e=>e.selected).length,unselected:V.filter(e=>!e.selected).length,hasFile:V.filter(e=>e.hasFile).length,missingFile:V.filter(e=>!e.hasFile).length},e1=V.filter(e=>{var t;let r=$(e);return("all"===eh||r===eh)&&("selected"!==eu||!!e.selected)&&("unselected"!==eu||!e.selected)&&("hasFile"!==eu||!!e.hasFile)&&("missingFile"!==eu||!e.hasFile)&&(!ev.trim()||(t=ev.trim(),!!"".concat(e.projectName,"\n").concat(e.projectRoot||"","\n").concat(e.customizePath||"","\n").concat(e.content||"").toLowerCase().includes(t.toLowerCase())))}).sort((e,t)=>"name"===ey?e.projectName.localeCompare(t.projectName):"source"===ey?["custom","current","project"].indexOf($(e))-["custom","current","project"].indexOf($(t)):"selected"===ey&&Number(t.selected)-Number(e.selected)||Date.parse(t.mtime||"")-Date.parse(e.mtime||"")),e2=e1.find(e=>e.id===eS)||e1[0]||null,e8=eb.filter(e=>e1.some(t=>t.id===e)),e4=(null==eq?void 0:eq.trim())?eD:eP,e6=(e,t,r)=>{let o=G(e,t,r);eI(o),eN(function(e){try{let t=JSON.parse(window.localStorage.getItem(e)||"[]");return Array.isArray(t)?t.filter(e=>("user"===e.role||"assistant"===e.role)&&"string"==typeof e.content).slice(-30):[]}catch(e){return[]}}(o)),eB(""),eR(!1),eJ([]),eX(!1)},e7=r=>{if(null==r?void 0:r.projectRoot)return void R(r.projectRoot).then(()=>{t.success(e("common.success")),eK()}).catch(()=>t.error(e("common.error")));let o="new:".concat(Date.now());eo(null),ep(!0),es(""),ei(""),e6(null,"new",o),et(!0)},e3=async()=>{if(!en.trim())return void t.error("请输入名称");ec(!0);try{if(er)await E(er.customizePath,el,U(er)?en.trim():void 0),t.success(e("common.success"));else{let r=await P(en.trim(),el||"# ".concat(en.trim(),"\n"));!function(e,t){if(!e||!t||e===t)return;let r=window.localStorage.getItem(e);r&&!window.localStorage.getItem(t)&&window.localStorage.setItem(t,r)}(eF,G({id:r.id,projectId:r.id,projectName:en.trim(),customizePath:r.id,content:el,mtime:"",hasFile:!0,isCurrent:!1,selected:!1,source:"custom"},en.trim())),t.success(e("common.success"))}et(!1),await eK()}catch(r){t.error(e("common.error"))}finally{ec(!1)}},e5=async e=>{let t=Array.from(new Set([...e_,...eP.filter(t=>e.includes("@".concat(t.relativePath))).map(e=>e.relativePath)])).slice(0,3),r=[];for(let e of t){let t=await _(e);t&&r.push({relativePath:e,content:t})}return r},e9=async()=>{let e=eO.trim();if(!e||eE)return;let r=[...eT,{role:"user",content:e}];eN(r),eB(""),eX(!1),eR(!0);try{let t=await e5(e),o=await L({name:en||(null==er?void 0:er.projectName)||"未命名提示词",content:el,message:e,history:eT,references:t});eN([...r,{role:"assistant",content:o.content||"AI 未返回内容"}])}catch(e){t.error(e instanceof Error?e.message:"AI 对话失败,请检查模型配置"),eN(r)}finally{eR(!1)}},te=async(r,o)=>{let l=o?Array.from(new Set([...V.filter(e=>e.selected).map(e=>e.id),r.id])):V.filter(e=>e.selected&&e.id!==r.id).map(e=>e.id);try{await W(l),Q(e=>e.map(e=>({...e,selected:l.includes(e.id)})))}catch(r){t.error(e("common.error"))}},tt=async r=>{let o=V.filter(e=>e.selected).map(e=>e.id),l=r?Array.from(new Set([...o,...e8])):o.filter(e=>!e8.includes(e));try{await W(l),Q(e=>e.map(e=>({...e,selected:l.includes(e.id)}))),eC([]),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},tr=async r=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:r.projectId,filePath:r.customizePath})})).ok)throw Error("Failed");t.success(e("common.success")),eC(e=>e.filter(e=>e!==r.id)),await eK()}catch(r){t.error(e("common.error"))}},to=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"custom",r="checked"===e?V.filter(e=>e8.includes(e.id)):"filtered"===e?e1:eQ;M("customize-prompts-".concat(new Date().toISOString().slice(0,10),".json"),Z(r)),t.success("已导出 ".concat(r.length," 条提示词"))},tl=async e=>{if(e){ez(!0);try{let r=await e.text(),o=JSON.parse(r),l=await D(o);t.success("已导入 ".concat(l.imported," 条提示词")),await eK()}catch(e){t.error("导入失败,请确认 JSON 文件格式正确")}finally{ez(!1),eY.current&&(eY.current.value="")}}},ti=e=>{let t=$(e);return(0,o.jsxs)(s.A,{size:4,wrap:!0,children:[(0,o.jsx)(a.A,{color:"custom"===t?"cyan":"current"===t?"green":"project"===t?"blue":"default",style:{margin:0},children:"custom"===t?"我的提示词":"current"===t?"当前项目":"project"===t?"其他项目":"全部"}),e.selected&&(0,o.jsx)(a.A,{color:"purple",style:{margin:0},children:"已选中"}),!e.hasFile&&(0,o.jsx)(a.A,{style:{margin:0},children:"无文件"})]})},tn=e=>(0,o.jsxs)(s.A,{size:6,children:[e.hasFile&&(0,o.jsx)(c.A,{checked:e.selected,onChange:t=>{te(e,t.target.checked)},children:"选中"}),!e.hasFile&&e.projectRoot&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(w.A,{}),onClick:()=>e7(e),children:"创建"}),e.hasFile&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(S.A,{}),onClick:()=>{eo(e),ep(!1),es(e.projectName),ei(e.content||""),e6(e,e.projectName),et(!0)},children:"编辑"}),e.hasFile&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(A.A,{}),onClick:()=>{var r;return r=e,void(M("customize-prompt-".concat(r.projectName.trim().replace(/[\\/:*?"<>|]/g,"-").slice(0,80)||"untitled","-").concat(new Date().toISOString().slice(0,10),".json"),Z([r])),t.success("已导出 1 条提示词"))},children:"导出"}),(0,o.jsx)(p.A,{title:U(e)?"删除自定义提示词?":"删除项目记录及文件?",onConfirm:()=>{tr(e)},children:(0,o.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,o.jsx)(b.A,{})})})]});return r?(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsx)(m.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:Array.from({length:4}).map((e,t)=>(0,o.jsx)(h.A,{size:"small",children:(0,o.jsx)(m.A,{active:!0,paragraph:{rows:4}})},t))})]}):(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.promptManagement")}),(0,o.jsx)("p",{className:"pageDesc",children:e("prompt.description")})]}),(0,o.jsxs)(s.A,{wrap:!0,children:[eV&&(0,o.jsxs)(a.A,{color:"green",style:{lineHeight:"22px"},children:[(0,o.jsx)(k.A,{})," ",eV.projectRoot]}),(0,o.jsx)("input",{ref:eY,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:e=>{var t;tl(null==(t=e.target.files)?void 0:t[0])}}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(z.A,{}),loading:ek,onClick:()=>{var e;return null==(e=eY.current)?void 0:e.click()},children:"导入"}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(A.A,{}),disabled:0===e1.length,onClick:()=>to("filtered"),children:"导出筛选"}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(w.A,{}),onClick:()=>e7(),children:"创建提示词"})]})]}),(0,o.jsxs)(h.A,{size:"small",styles:{body:{display:"flex",gap:10,flexWrap:"wrap",alignItems:"center"}},children:[(0,o.jsx)(u.A,{prefix:(0,o.jsx)(T.A,{}),allowClear:!0,placeholder:"搜索名称、内容、路径...",value:ev,onChange:e=>ew(e.target.value),style:{width:280}}),(0,o.jsx)(x.A,{value:eh,onChange:em,style:{width:150},options:[{label:"全部 (".concat(e0.all,")"),value:"all"},{label:"我的提示词 (".concat(e0.custom,")"),value:"custom"},{label:"当前项目 (".concat(e0.current,")"),value:"current"},{label:"其他项目 (".concat(e0.project,")"),value:"project"}]}),(0,o.jsx)(x.A,{value:eu,onChange:ex,style:{width:130},options:[{label:"全部状态",value:"all"},{label:"已选中 (".concat(e0.selected,")"),value:"selected"},{label:"未选中 (".concat(e0.unselected,")"),value:"unselected"},{label:"有文件 (".concat(e0.hasFile,")"),value:"hasFile"},{label:"无文件 (".concat(e0.missingFile,")"),value:"missingFile"}]}),(0,o.jsx)(x.A,{value:ey,onChange:ef,style:{width:140},options:[{label:"最近修改优先",value:"mtime"},{label:"名称 A-Z",value:"name"},{label:"来源优先",value:"source"},{label:"已选中优先",value:"selected"}]}),(0,o.jsx)(y.A,{value:eg,onChange:e=>ej(e),options:[{label:(0,o.jsx)(N.A,{}),value:"list"},{label:(0,o.jsx)(F.A,{}),value:"card"}]}),(0,o.jsx)("div",{style:{flex:1}}),(0,o.jsxs)("span",{style:{color:"var(--colorTextSecondary)",fontSize:13},children:["已显示 ",e1.length," / ",V.length]})]}),(0,o.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"260px minmax(0, 1fr)",gap:14,alignItems:"start"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[(0,o.jsxs)(h.A,{size:"small",title:"分组导航",styles:{body:{padding:8}},children:[[["all","全部",e0.all],["custom","我的提示词",e0.custom],["current","当前项目",e0.current],["project","其他项目",e0.project]].map(e=>{let[t,r,l]=e;return(0,o.jsxs)("button",{onClick:()=>em(t),style:{width:"100%",border:"none",background:eh===t?"var(--colorFillSecondary)":"transparent",color:"var(--colorText)",padding:"9px 10px",borderRadius:8,display:"flex",justifyContent:"space-between",cursor:"pointer",fontWeight:eh===t?700:400},children:[(0,o.jsx)("span",{children:r}),(0,o.jsx)("span",{children:l})]},t)}),(0,o.jsx)(f.A,{style:{margin:"8px 0"}}),[["selected","已选中",e0.selected],["unselected","未选中",e0.unselected]].map(e=>{let[t,r,l]=e;return(0,o.jsxs)("button",{onClick:()=>ex(eu===t?"all":t),style:{width:"100%",border:"none",background:eu===t?"var(--colorFillSecondary)":"transparent",color:"var(--colorText)",padding:"9px 10px",borderRadius:8,display:"flex",justifyContent:"space-between",cursor:"pointer",fontWeight:eu===t?700:400},children:[(0,o.jsx)("span",{children:r}),(0,o.jsx)("span",{children:l})]},t)})]}),(0,o.jsx)(h.A,{size:"small",title:"详情预览",styles:{body:{height:300,display:"flex",flexDirection:"column",gap:10,overflow:"hidden"}},children:e2?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[(0,o.jsx)(C.A,{style:{color:"var(--colorAccent)",flexShrink:0}}),(0,o.jsx)("strong",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e2.projectName})]}),(0,o.jsx)("div",{style:{minWidth:0,overflow:"hidden"},children:ti(e2)}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.7,minWidth:0},children:[(0,o.jsxs)("div",{children:["更新时间:",Y(e2.mtime)]}),(0,o.jsxs)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["文件路径:",e2.customizePath||"-"]}),(0,o.jsxs)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["项目路径:",e2.projectRoot||"-"]})]}),(0,o.jsx)("div",{style:{flex:1,minHeight:0,padding:10,borderRadius:8,background:"var(--colorFillAlter)",color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.7,overflow:"auto",whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:X(e2,800)||"暂无内容预览"}),(0,o.jsx)("div",{children:tn(e2)})]}):(0,o.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:"请选择一个提示词"})})]}),(0,o.jsxs)("div",{style:{minWidth:0},children:[e8.length>0&&(0,o.jsxs)(h.A,{size:"small",style:{marginBottom:12},styles:{body:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"}},children:[(0,o.jsxs)("span",{style:{fontWeight:600},children:["已选择 ",e8.length," 项"]}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>{tt(!0)},children:"批量选中"}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>{tt(!1)},children:"取消选中"}),(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(A.A,{}),onClick:()=>to("checked"),children:"导出选中"}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>eC([]),children:"清空选择"})]}),0===e1.length?(0,o.jsx)(h.A,{children:(0,o.jsx)(g.A,{description:ev||"all"!==eu?"没有找到匹配的提示词,请尝试更换关键词或清空筛选条件":"当前分组没有提示词"})}):"list"===eg?(0,o.jsx)(s.A,{direction:"vertical",size:10,style:{width:"100%"},children:e1.map(e=>{let t=X(e,180),r=(null==e2?void 0:e2.id)===e.id;return(0,o.jsxs)("div",{onClick:()=>eA(e.id),style:{display:"grid",gridTemplateColumns:"28px minmax(0, 1fr) auto",gap:12,alignItems:"center",padding:14,border:"1px solid ".concat(r?"var(--colorAccent)":"var(--colorBorderSecondary)"),borderRadius:12,background:r?"var(--colorFillSecondary)":"var(--colorBgContainer)",cursor:"pointer",transition:"all .2s ease"},children:[(0,o.jsx)(c.A,{checked:eb.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eC(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,o.jsxs)("div",{style:{minWidth:0},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[(0,o.jsx)(C.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.projectName}),ti(e)]}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:6*!!t},children:[(0,o.jsx)(k.A,{style:{marginRight:4}}),e.projectRoot||e.customizePath||"本地提示词"," \xb7 ",Y(e.mtime)]}),t&&(0,o.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.6,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"pre-wrap"},children:t})]}),(0,o.jsx)("div",{onClick:e=>e.stopPropagation(),children:tn(e)})]},e.id)})}):(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:12},children:e1.map(e=>{let t=X(e,180),r=(null==e2?void 0:e2.id)===e.id;return(0,o.jsxs)(h.A,{size:"small",hoverable:!0,onClick:()=>eA(e.id),style:{borderColor:r?"var(--colorAccent)":void 0},styles:{body:{display:"flex",flexDirection:"column",minHeight:210}},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,o.jsx)(c.A,{checked:eb.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eC(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,o.jsx)(C.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.projectName})]}),(0,o.jsx)("div",{style:{marginBottom:8},children:ti(e)}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:[(0,o.jsx)(k.A,{style:{marginRight:4}}),e.projectRoot||e.customizePath||"本地提示词"]}),(0,o.jsx)("div",{style:{padding:10,background:"var(--colorFillAlter)",borderRadius:8,color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.6,minHeight:72,maxHeight:72,overflow:"hidden",whiteSpace:"pre-wrap"},children:t||"暂无内容预览"}),(0,o.jsxs)("div",{style:{marginTop:"auto",paddingTop:10,borderTop:"1px solid var(--colorBorderSecondary)",display:"flex",justifyContent:"space-between",alignItems:"center"},onClick:e=>e.stopPropagation(),children:[(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:Y(e.mtime)}),tn(e)]})]},e.id)})})]})]}),(0,o.jsxs)(j.A,{title:ed?"创建提示词":er&&U(er)?"编辑我的提示词 — ".concat(en||er.projectName):"编辑项目提示词 — ".concat((null==er?void 0:er.projectName)||""),open:ee,onClose:()=>et(!1),width:980,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px",display:"grid",gridTemplateRows:"minmax(320px, 1fr) 420px",gap:14,height:"100%"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,o.jsxs)(s.A,{children:[(0,o.jsx)(d.Ay,{onClick:()=>et(!1),children:e("common.cancel")}),(0,o.jsx)(d.Ay,{type:"primary",loading:ea,onClick:()=>{e3()},children:e("common.save")})]}),children:[(0,o.jsxs)("div",{style:{minHeight:0,display:"flex",flexDirection:"column"},children:[(0,o.jsx)("div",{style:{marginBottom:12},children:ed||er&&U(er)?(0,o.jsxs)(s.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,o.jsx)(u.A,{placeholder:"提示词名称",value:en,onChange:e=>es(e.target.value),style:{maxWidth:520}}),!ed&&(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==er?void 0:er.customizePath})]}):(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==er?void 0:er.customizePath})}),(0,o.jsx)(u.A.TextArea,{value:el,onChange:e=>ei(e.target.value),style:{flex:1,minHeight:280,fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13,resize:"none"}})]}),(0,o.jsxs)("div",{style:{minHeight:0,border:"1px solid var(--colorBorderSecondary)",borderRadius:10,background:"var(--colorBgContainer)",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 8px 24px rgba(15, 23, 42, 0.06)"},children:[(0,o.jsxs)("div",{style:{padding:"10px 12px",borderBottom:"1px solid var(--colorBorderSecondary)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,o.jsxs)(s.A,{size:6,children:[(0,o.jsx)(I.A,{style:{color:"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:600},children:"AI 提示词助手"})]}),(0,o.jsxs)(s.A,{size:6,children:[eT.length>0&&(0,o.jsx)(d.Ay,{size:"small",onClick:()=>eN([]),children:"清空历史"}),eE?(0,o.jsx)(a.A,{color:"processing",style:{margin:0},children:"生成中"}):(0,o.jsx)(a.A,{color:"blue",style:{margin:0},children:"可对话优化"})]})]}),(0,o.jsx)("div",{ref:eZ,style:{flex:1,minHeight:0,overflowY:"auto",padding:14,background:"var(--colorFillAlter)"},children:0!==eT.length||eE?(0,o.jsxs)(s.A,{direction:"vertical",size:12,style:{width:"100%"},children:[eT.map((e,r)=>{let l="user"===e.role;return(0,o.jsx)("div",{style:{display:"flex",justifyContent:l?"flex-end":"flex-start"},children:(0,o.jsxs)("div",{style:{maxWidth:"78%",padding:"10px 12px",borderRadius:12,background:l?"var(--colorFillSecondary)":"var(--colorBgContainer)",color:"var(--colorText)",border:"1px solid var(--colorBorderSecondary)",whiteSpace:"pre-wrap",lineHeight:1.7,fontSize:13,transition:"all .2s ease"},children:[e.content,!l&&(0,o.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:8},children:(0,o.jsx)(d.Ay,{size:"small",type:"primary",onClick:()=>{ei(e.content),t.success("已应用到编辑内容,请确认后保存")},children:"应用"})})]})},"".concat(e.role,"-").concat(r))}),eE&&(0,o.jsx)("div",{style:{display:"flex",justifyContent:"flex-start"},children:(0,o.jsxs)("div",{style:{padding:"10px 12px",borderRadius:12,background:"var(--colorBgContainer)",border:"1px solid var(--colorBorderSecondary)",color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),"AI 正在分析并生成内容..."]})})]}):(0,o.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:"输入 @ 召回知识库文件,再描述你的优化目标"})}),(0,o.jsx)(f.A,{style:{margin:0}}),(0,o.jsxs)("div",{style:{padding:12},children:[e_.length>0&&(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:e_.map(e=>(0,o.jsxs)(a.A,{closable:!0,onClose:()=>eJ(t=>t.filter(t=>t!==e)),style:{margin:0,maxWidth:360,overflow:"hidden",textOverflow:"ellipsis"},children:["@",e]},e))}),eG&&(0,o.jsxs)("div",{style:{maxHeight:260,overflowY:"auto",marginBottom:8,border:"1px solid var(--colorBorderSecondary)",borderRadius:12,background:"var(--colorBgElevated, var(--colorBgContainer))",boxShadow:"0 16px 40px rgba(15, 23, 42, 0.14)"},children:[(0,o.jsxs)("div",{style:{position:"sticky",top:0,zIndex:1,padding:"10px 12px",borderBottom:"1px solid var(--colorBorderSecondary)",background:"var(--colorBgElevated, var(--colorBgContainer))",display:"flex",justifyContent:"space-between",gap:12,alignItems:"center"},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{style:{color:"var(--colorText)",fontSize:13,fontWeight:700},children:"召回知识库文件"}),(0,o.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11},children:"支持文件名与知识库内容检索,最多召回 3 个文件"})]}),(0,o.jsx)(a.A,{color:eq?"blue":"default",style:{margin:0,maxWidth:240,overflow:"hidden",textOverflow:"ellipsis"},children:eq?"@".concat(eq):"输入 @关键词"})]}),eL?(0,o.jsxs)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在加载知识库文件..."]}):0===eP.length?(0,o.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:"暂无可召回的知识库文件"}):0===e4.length?(0,o.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:eU?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在检索知识库内容..."]}):"没有匹配的知识库文件,请换个关键词"}):(0,o.jsxs)(o.Fragment,{children:[eU&&(0,o.jsxs)("div",{style:{padding:"8px 12px",color:"var(--colorTextSecondary)",fontSize:12,borderBottom:"1px solid var(--colorBorderSecondary)"},children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在继续检索内容匹配..."]}),e4.slice(0,30).map(e=>(0,o.jsxs)("div",{onMouseDown:t=>{var r;t.preventDefault(),r=e.relativePath,eJ(e=>e.includes(r)?e:[...e,r]),eB(e=>e.replace(/(^|\s)@([^\s@]*)$/,"$1@".concat(r," "))),eX(!1)},style:{padding:"10px 12px",cursor:"pointer",borderBottom:"1px solid var(--colorBorderSecondary)",fontSize:12,display:"grid",gridTemplateColumns:"22px minmax(0, 1fr) auto",gap:10,alignItems:"center"},children:[(0,o.jsx)("div",{style:{width:22,height:22,borderRadius:7,background:"var(--colorFillSecondary)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(C.A,{style:{color:"var(--colorAccent)"}})}),(0,o.jsxs)("div",{style:{minWidth:0},children:[(0,o.jsx)("div",{style:{color:"var(--colorText)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:700},children:e.relativePath}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.category||"未分类"," \xb7 ",e.format||"未知格式","number"==typeof e.score?" \xb7 score ".concat(e.score.toFixed(2)):""]})]}),(0,o.jsxs)(s.A,{size:4,children:[(0,o.jsx)(a.A,{color:"content"===e.matchedBy?"purple":"disk"===e.matchedBy?"orange":"blue",style:{margin:0},children:"content"===e.matchedBy?"内容匹配":"disk"===e.matchedBy?"磁盘文件":"文件匹配"}),(0,o.jsx)(a.A,{style:{margin:0},children:e.status})]})]},e.relativePath))]})]}),(0,o.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-end"},children:[(0,o.jsx)(u.A.TextArea,{value:eO,onChange:e=>{let t=e.target.value;eB(t),eX(null!==q(t))},onFocus:()=>eX(null!==q(eO)),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),e9())},disabled:eE,placeholder:"输入 @ 召回知识库文件,再描述优化目标...",autoSize:{minRows:2,maxRows:5},style:{fontSize:13,lineHeight:1.6}}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(O.A,{}),loading:eE,disabled:!eO.trim(),onClick:()=>{e9()},children:"发送"})]})]})]})]})]})}}},e=>{e.O(0,[433,787,576,195,985,525,636,593,792],()=>e(e.s=27549)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- self.__BUILD_MANIFEST=function(s,e,t,c,a,n,d,i,r,u,o,f,k,b,g,h,l,j,m){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:k,bitArray:[]},__routerFilterDynamic:{numItems:r,errorRate:1e-4,numBits:r,numHashes:k,bitArray:[]},"/":[s,e,b,g,"static/chunks/pages/index-a2a24e9602e7ea52.js"],"/_error":["static/chunks/pages/_error-282257fbdcc167b4.js"],"/asset-library":[s,e,n,"static/chunks/749-83476f9bcd014a5a.js","static/chunks/pages/asset-library-e9ddfe1cbaac42d9.js"],"/context/long-term":[s,e,t,c,a,n,d,i,h,"static/chunks/pages/context/long-term-6b9a9683a4d6ea86.js"],"/context/short-term":[s,e,t,c,a,n,d,i,h,"static/chunks/pages/context/short-term-6078efae6e3a905c.js"],"/document-roles":[s,e,t,c,i,"static/chunks/909-27ada1f00a52e11d.js","static/chunks/pages/document-roles-24e4ba16d654959d.js"],"/documents":[s,e,t,c,i,u,l,"static/chunks/53-d534407b1397d66a.js","static/chunks/pages/documents-fc1a4fdb681f49a2.js"],"/guide":[s,e,l,"static/chunks/20-00147a779147a5a4.js","static/chunks/pages/guide-7d15d3d3ddb0205e.js"],"/knowledge":["static/chunks/pages/knowledge-905248d8dcb15453.js"],"/knowledge/file-detail":[s,e,t,a,n,d,u,j,o,"static/chunks/pages/knowledge/file-detail-97c77dfaf472a4b6.js"],"/knowledge/files":[s,e,t,a,n,d,o,"static/chunks/pages/knowledge/files-75a33100a1b3b5b5.js"],"/knowledge/manage":[s,e,u,"static/chunks/788-7f7359a830e3f4fd.js","static/chunks/pages/knowledge/manage-25eb1a993b155450.js"],"/knowledge/search":[s,e,t,u,m,o,"static/chunks/pages/knowledge/search-afb423fc22eb623b.js"],"/models":[s,e,t,c,a,i,m,"static/chunks/647-d5e08fda405f7059.js","static/chunks/pages/models-d5e80645dc4a61b1.js"],"/overview":[s,e,b,g,"static/chunks/pages/overview-1260176045ed5f7a.js"],"/prompt":[s,e,t,c,a,"static/chunks/525-5d947137d894f5fe.js","static/chunks/pages/prompt-3468fb841f4c5c8c.js"],"/settings":[s,e,"static/chunks/pages/settings-fa9d6a56898ba678.js"],"/system/logs":[s,t,c,a,n,d,j,"static/chunks/pages/system/logs-3826fa44a76b12fc.js"],sortedPages:["/","/_app","/_error","/asset-library","/context/long-term","/context/short-term","/document-roles","/documents","/guide","/knowledge","/knowledge/file-detail","/knowledge/files","/knowledge/manage","/knowledge/search","/models","/overview","/prompt","/settings","/system/logs"]}}("static/chunks/433-233659be69169c19.js","static/chunks/787-c18af810af3433f6.js","static/chunks/576-6699fed6c88502fe.js","static/chunks/195-2c0168eacab722d2.js","static/chunks/985-4b4a3ed36ada16eb.js","static/chunks/150-134099bf526e9292.js","static/chunks/289-30e7c55f49a896b7.js","static/chunks/455-97ad88d6604f54b7.js",0,"static/chunks/506-93f730bc149d0dce.js","static/css/09be1fdeab8595ab.css",1e-4,NaN,"static/chunks/694-2d545cfbb9779f2c.js","static/chunks/795-d8fb7a0420512701.js","static/chunks/932-2f195f4200ce9378.js","static/chunks/412-b9c854c6a76db67d.js","static/chunks/861-91cbdd34b8e23151.js","static/chunks/938-45efd516bb130bd5.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
1
+ self.__BUILD_MANIFEST=function(s,e,t,c,a,n,d,i,r,u,o,k,f,b,g,h,l,j,m){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:f,bitArray:[]},__routerFilterDynamic:{numItems:r,errorRate:1e-4,numBits:r,numHashes:f,bitArray:[]},"/":[s,e,b,g,"static/chunks/pages/index-a2a24e9602e7ea52.js"],"/_error":["static/chunks/pages/_error-282257fbdcc167b4.js"],"/asset-library":[s,e,n,"static/chunks/749-83476f9bcd014a5a.js","static/chunks/pages/asset-library-e9ddfe1cbaac42d9.js"],"/context/long-term":[s,e,t,c,a,n,d,i,h,"static/chunks/pages/context/long-term-6b9a9683a4d6ea86.js"],"/context/short-term":[s,e,t,c,a,n,d,i,h,"static/chunks/pages/context/short-term-6078efae6e3a905c.js"],"/document-roles":[s,e,t,c,i,"static/chunks/496-4fb9a063790e65ff.js","static/chunks/pages/document-roles-cb222be93cfd561d.js"],"/documents":[s,e,t,c,i,u,l,"static/chunks/53-d534407b1397d66a.js","static/chunks/pages/documents-fc1a4fdb681f49a2.js"],"/guide":[s,e,l,"static/chunks/20-00147a779147a5a4.js","static/chunks/pages/guide-7d15d3d3ddb0205e.js"],"/knowledge":["static/chunks/pages/knowledge-905248d8dcb15453.js"],"/knowledge/file-detail":[s,e,t,a,n,d,u,j,o,"static/chunks/pages/knowledge/file-detail-97c77dfaf472a4b6.js"],"/knowledge/files":[s,e,t,a,n,d,o,"static/chunks/pages/knowledge/files-75a33100a1b3b5b5.js"],"/knowledge/manage":[s,e,u,"static/chunks/788-7f7359a830e3f4fd.js","static/chunks/pages/knowledge/manage-25eb1a993b155450.js"],"/knowledge/search":[s,e,t,u,m,o,"static/chunks/pages/knowledge/search-afb423fc22eb623b.js"],"/models":[s,e,t,c,a,i,m,"static/chunks/647-d5e08fda405f7059.js","static/chunks/pages/models-d5e80645dc4a61b1.js"],"/overview":[s,e,b,g,"static/chunks/pages/overview-1260176045ed5f7a.js"],"/prompt":[s,e,t,c,a,"static/chunks/525-5d947137d894f5fe.js","static/chunks/pages/prompt-9b869fbe3463020d.js"],"/settings":[s,e,"static/chunks/pages/settings-fa9d6a56898ba678.js"],"/system/logs":[s,t,c,a,n,d,j,"static/chunks/pages/system/logs-3826fa44a76b12fc.js"],sortedPages:["/","/_app","/_error","/asset-library","/context/long-term","/context/short-term","/document-roles","/documents","/guide","/knowledge","/knowledge/file-detail","/knowledge/files","/knowledge/manage","/knowledge/search","/models","/overview","/prompt","/settings","/system/logs"]}}("static/chunks/433-233659be69169c19.js","static/chunks/787-c18af810af3433f6.js","static/chunks/576-6699fed6c88502fe.js","static/chunks/195-2c0168eacab722d2.js","static/chunks/985-4b4a3ed36ada16eb.js","static/chunks/150-134099bf526e9292.js","static/chunks/289-30e7c55f49a896b7.js","static/chunks/455-97ad88d6604f54b7.js",0,"static/chunks/506-93f730bc149d0dce.js","static/css/09be1fdeab8595ab.css",1e-4,NaN,"static/chunks/694-2d545cfbb9779f2c.js","static/chunks/795-d8fb7a0420512701.js","static/chunks/932-2f195f4200ce9378.js","static/chunks/412-b9c854c6a76db67d.js","static/chunks/861-91cbdd34b8e23151.js","static/chunks/938-45efd516bb130bd5.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@customize-agent/server",
3
- "version": "4.0.32",
3
+ "version": "4.0.34",
4
4
  "description": "Customize Agent Web 管理控制台",
5
5
  "exports": {
6
6
  "./package.json": "./package.json"
@@ -49,9 +49,9 @@
49
49
  "tesseract.js": "^7.0.0",
50
50
  "typescript": "^6.0.3",
51
51
  "xlsx": "^0.18.5",
52
- "@customize-agent/knowledge": "^4.0.12",
53
- "@customize-agent/runtime": "^3.0.8",
54
- "@customize-agent/llm": "^3.0.6"
52
+ "@customize-agent/knowledge": "^4.0.13",
53
+ "@customize-agent/llm": "^3.0.7",
54
+ "@customize-agent/runtime": "^3.0.9"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@tailwindcss/postcss": "^4.3.2",
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[909],{2256:(e,t,n)=>{n.d(t,{A:()=>r});let r=n(25341).A},8579:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(97109),o=n(95008),l=n(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let a=r.forwardRef((e,t)=>r.createElement(l.A,i({},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 i=e=>"object"==typeof e&&null!=e&&1===e.nodeType,a=(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 a(n.overflowY,t)||a(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,i,a)=>l<e&&i>t||l>e&&i<t?0:l<=e&&a<=n||i>=t&&a>=n?l-e-r:i>t&&a<n||l<e&&a>n?i-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:a,block:f,inline:u,boundary:h,skipOverflowHiddenElements:p}=t,m="function"==typeof h?h:e=>e!==h;if(!i(e))throw TypeError("Invalid target");let v=document.scrollingElement||document.documentElement,g=[],b=e;for(;i(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:$,scrollY:A}=window,{height:H,width:z,top:E,right:M,bottom:O,left:j}=e.getBoundingClientRect(),{top:I,right:V,bottom:x,left:C}=(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),L="start"===f||"nearest"===f?E-I:"end"===f?O+x:E+H/2-I+x,R="center"===u?j+z/2-C+V:"end"===u?M+V:j-C,N=[];for(let e=0;e<g.length;e++){let t=g[e],{height:n,width:r,top:o,right:l,bottom:i,left:d}=t.getBoundingClientRect();if("if-needed"===a&&E>=0&&j>=0&&O<=w&&M<=y&&(t===v&&!c(t)||E>=o&&O<=i&&j>=d&&M<=l))break;let h=getComputedStyle(t),p=parseInt(h.borderLeftWidth,10),m=parseInt(h.borderTopWidth,10),b=parseInt(h.borderRightWidth,10),I=parseInt(h.borderBottomWidth,10),V=0,x=0,C="offsetWidth"in t?t.offsetWidth-t.clientWidth-p-b:0,k="offsetHeight"in t?t.offsetHeight-t.clientHeight-m-I:0,S="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,B="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(v===t)V="start"===f?L:"end"===f?L-w:"nearest"===f?s(A,A+w,w,m,I,A+L,A+L+H,H):L-w/2,x="start"===u?R:"center"===u?R-y/2:"end"===u?R-y:s($,$+y,y,p,b,$+R,$+R+z,z),V=Math.max(0,V+A),x=Math.max(0,x+$);else{V="start"===f?L-o-m:"end"===f?L-i+I+k:"nearest"===f?s(o,i,n,m,I+k,L,L+H,H):L-(o+n/2)+k/2,x="start"===u?R-d-p:"center"===u?R-(d+r/2)+C/2:"end"===u?R-l+b+C:s(d,l,r,p,b+C,R,R+z,z);let{scrollLeft:e,scrollTop:a}=t;V=0===B?0:Math.max(0,Math.min(a+V/B,t.scrollHeight-n/B+k)),x=0===S?0:Math.max(0,Math.min(e+x/S,t.scrollWidth-r/S+C)),L+=a-V,R+=e-x}N.push({el:t,top:V,left:x})}return N};var u=n(26047),h=n(44624);function p(e){return(0,h.$r)(e).join("_")}function m(e,t){let n=t.getFieldInstance(e),r=(0,l.rb)(n);if(r)return r;let o=(0,h.kV)((0,h.$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:i}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=i-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,u.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:()=>a});var r=n(97109),o=n(99729),l=n(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let a=r.forwardRef((e,t)=>r.createElement(l.A,i({},e,{ref:t,icon:o.A})))},26631:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(97109),o=n(12887),l=n(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let a=r.forwardRef((e,t)=>r.createElement(l.A,i({},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:()=>a});var r=n(97109),o=n(72870),l=n(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let a=r.forwardRef((e,t)=>r.createElement(l.A,i({},e,{ref:t,icon:o.A})))},43979:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(97109),o=n(59291),l=n(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let a=r.forwardRef((e,t)=>r.createElement(l.A,i({},e,{ref:t,icon:o.A})))},44624:(e,t,n)=>{n.d(t,{$r:()=>o,BS:()=>i,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 i(e,t,n,r,o,l){let i=r;return void 0!==l?i=l:n.validating?i="validating":e.length?i="error":t.length?i="warning":(n.touched||o&&n.validated)&&(i="success"),i}},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"}},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:()=>a});var r=n(97109),o=n(66284),l=n(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let a=r.forwardRef((e,t)=>r.createElement(l.A,i({},e,{ref:t,icon:o.A})))},80042:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(97109),o=n(44858),l=n(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let a=r.forwardRef((e,t)=>r.createElement(l.A,i({},e,{ref:t,icon:o.A})))},84662:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(97109),o=n(20966),l=n(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let a=r.forwardRef((e,t)=>r.createElement(l.A,i({},e,{ref:t,icon:o.A})))},85493:(e,t,n)=>{n.d(t,{A:()=>V});var r=n(97109),o=n(59188),l=n(4216),i=n(45042),a=n(97137),c=n(62188),s=n(67189),d=n(42644),f=n(3638),u=n(92162),h=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:i,lineHeight:a,borderRadiusLG:c,motionEaseInOutCirc:s,withDescriptionIconSize:d,colorText:f,colorTextHeading:u,withDescriptionPadding:h,defaultPadding:p,lineWidth:g,lineType:b,colorSuccessBorder:y,colorWarningBorder:w,colorErrorBorder:$,colorInfoBorder:A}=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:A},[`&${t}-warning`]:{borderColor:w},[`&${t}-error`]:{borderColor:$},[`&${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:a},"&-title":{color:u},[`&${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:h,[`${t}-icon`]:{marginInlineEnd:o,fontSize:d,lineHeight:0},[`${t}-title`]:{display:"block",marginBottom:r,color:u,fontSize:i},[`${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:i,colorErrorBg:a,colorInfo:c,colorInfoBg:s}=e;return{[t]:{"&-success":b(r,n,t),"&-info":b(s,c,t),"&-warning":b(l,o,t),"&-error":{...b(a,i,t),[`${t}-description > pre`]:{margin:0,padding:0}}}}})(e),(e=>{let{componentCls:t,iconCls:n,motionDurationMid:r,marginXS:o,fontSizeIcon:l,colorIcon:i,colorIconHover:a}=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:i,transition:`color ${r}`,"&:hover":{color:a}}},"&-close-text":{color:i,transition:`color ${r}`,"&:hover":{color:a}}}}})(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:i,style:s,successIcon:d,infoIcon:f,warningIcon:u,errorIcon:h}=e,p={success:d??r.createElement(o.A,null),info:f??r.createElement(c.A,null),error:h??r.createElement(l.A,null),warning:u??r.createElement(a.A,null)};return r.createElement("span",{className:i,style:s},t??p[n])},$=e=>{let{isClosable:t,prefixCls:n,closeIcon:o,handleClose:l,ariaProps:a,className:c,style:s}=e,d=!0===o||void 0===o?r.createElement(i.A,null):o;return t?r.createElement("button",{type:"button",onClick:l,className:(0,f.$)(`${n}-close-icon`,c),tabIndex:0,style:s,...a},d):null},A=r.forwardRef((e,t)=>{let{description:n,prefixCls:o,message:l,title:i,banner:a,className:c,rootClassName:m,style:v,onMouseEnter:g,onMouseLeave:b,onClick:A,afterClose:H,showIcon:z,closable:E,closeText:M,closeIcon:O,action:j,id:I,styles:V,classNames:x,...C}=e,L=i??l,[R,N]=r.useState(!1),k=r.useRef(null);r.useImperativeHandle(t,()=>({nativeElement:k.current}));let{getPrefixCls:S,direction:B,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=S("alert",o),[J,U]=y(q),{onClose:Z,afterClose:ee}=(0,h.Qd)(E)?E:{},et=t=>{N(!0),(Z??e.onClose)?.(t)},en=r.useMemo(()=>void 0!==e.type?e.type:a?"warning":"info",[e.type,a]),er=e.variant??W??"outlined",eo=r.useMemo(()=>!!(0,h.Qd)(E)&&!!E.closeIcon||!!M||("boolean"==typeof E?E:!!(!1!==O&&(0,h.R)(O))||!!_),[M,O,E,_]),el=!!a&&void 0===z||z,ei={...e,prefixCls:q,variant:er,type:en,showIcon:el,closable:eo},ea=(0,u.XT)(T),ec=(0,u.XT)(v),[es,ed]=(0,u.AV)([D,x],[Q,ea,V,ec],{props:ei}),ef=(0,f.$)(q,`${q}-${en}`,`${q}-${er}`,{[`${q}-with-description`]:!!n,[`${q}-no-icon`]:!el,[`${q}-banner`]:!!a,[`${q}-rtl`]:"rtl"===B},P,c,m,es.root,U,J),eu=(0,d.KE)(C,{aria:!0,data:!0}),eh=r.useMemo(()=>(0,h.Qd)(E)&&E.closeIcon?E.closeIcon:M||(void 0!==O?O:(0,h.Qd)(_)&&_.closeIcon?_.closeIcon:F),[O,E,_,M,F]),ep=r.useMemo(()=>{let e=E??_;return(0,h.Qd)(e)?(0,d.KE)(e,{data:!0,aria:!0}):{}},[E,_]);return r.createElement(s.Ay,{visible:!R,motionName:`${q}-motion`,motionAppear:!1,motionEnter:!1,onLeaveStart:e=>({maxHeight:e.offsetHeight}),onLeaveEnd:ee??H},({className:t,style:o},l)=>r.createElement("div",{id:I,ref:(0,d.K4)(k,l),"data-show":!R,className:(0,f.$)(ef,t),style:{...ed.root,...o},onMouseEnter:g,onMouseLeave:b,onClick:A,role:"alert",...eu},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},L?r.createElement("div",{className:(0,f.$)(`${q}-title`,es.title),style:ed.title},L):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($,{className:es.close,style:ed.close,isClosable:eo,prefixCls:q,closeIcon:eh,handleClose:et,ariaProps:ep})))});var H=n(41113),z=n(49939),E=n(90218),M=n(13076),O=n(83784),j=n(15472);let I=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:i,info:a}=this.state,c=t??e,s=a?.componentStack||null,d=(0,h.R)(c)?c:i?.toString(),f=(0,h.R)(n)?n:s;return i?r.createElement(A,{id:o,type:"error",title:d,description:r.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},f)}):l}}])}(r.PureComponent);A.ErrorBoundary=I;let V=A},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"}},96651:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(97109),o=n(92123),l=n(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let a=r.forwardRef((e,t)=>r.createElement(l.A,i({},e,{ref:t,icon:o.A})))},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([[623],{23507:(e,l,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return r(59889)}])},59889:(e,l,r)=>{"use strict";r.r(l),r.d(l,{default:()=>X});var i=r(65321),s=r(97109),n=r(35292),t=r(11702),o=r(17807),a=r(63455),c=r(33442),d=r(84253),p=r(68787),x=r(85114),m=r(26171),h=r(57271),y=r(85493),f=r(34052),u=r(7576),j=r(2256),g=r(38770),A=r(58569),v=r(25345),b=r(43979),w=r(80042),S=r(75548),I=r(26631),T=r(84662),z=r(30486),C=r(99650),k=r(8263),B=r(84742),R=r(43094),F=r(8579),_=r(58209),W=r(54746),H=r(96651),N=r(60470),D=r(6578),E=r(79059);let{Paragraph:P}=n.A,q={rule:(0,i.jsx)(v.A,{}),project_fact:(0,i.jsx)(b.A,{}),table:(0,i.jsx)(w.A,{}),drawing:(0,i.jsx)(S.A,{}),specification:(0,i.jsx)(I.A,{}),reference:(0,i.jsx)(T.A,{})},O={fact_extraction:(0,i.jsx)(z.A,{}),chapter_generation:(0,i.jsx)(C.A,{}),llm_review:(0,i.jsx)(k.A,{}),validation:(0,i.jsx)(B.A,{}),formatting:(0,i.jsx)(R.A,{}),reference:(0,i.jsx)(T.A,{})},V={rule:"#fa8c16",project_fact:"#1677ff",table:"#52c41a",drawing:"#722ed1",specification:"#eb2f96",reference:"#13c2c2"},G={fact_extraction:"#fa8c16",chapter_generation:"#1677ff",llm_review:"#722ed1",validation:"#52c41a",formatting:"#eb2f96",reference:"#13c2c2"},L={rule:"roles.ruleFile",project_fact:"roles.projectFactFile",table:"roles.tableFile",drawing:"roles.drawingFile",specification:"roles.specificationFile",reference:"roles.reference"},U={fact_extraction:"roles.factExtraction",chapter_generation:"roles.chapterGeneration",llm_review:"roles.llmReview",validation:"roles.validation",formatting:"roles.formatting",reference:"roles.reference"},Q=e=>(0,i.jsx)(t.A,{closable:e.closable,onClose:e.onClose,color:"blue",style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:e.label});function X(){let e,l,r=(0,E.Vr)(),{message:n}=o.A.useApp(),[v]=a.A.useForm(),[b]=a.A.useForm(),[w,S]=(0,s.useState)([]),[T,z]=(0,s.useState)([]),[k,B]=(0,s.useState)([]),[R,X]=(0,s.useState)(!1),[K,J]=(0,s.useState)([]),[M,Y]=(0,s.useState)(!1),[Z,$]=(0,s.useState)(!1),[ee,el]=(0,s.useState)(!1),[er,ei]=(0,s.useState)("file"),[es,en]=(0,s.useState)("custom"),et=async()=>{let[e,l,r]=await Promise.all([(0,D.lv)(),(0,D.nU)({limit:200,includeContent:!1}),(0,D.dx)()]);S(e.roles),z(e.configs),B(l.files),J(r)};(0,s.useEffect)(()=>{et().catch(()=>n.error(r("common.error")))},[n,r]);let eo=()=>"all"===es||"custom"===es,ea=w.filter(eo),ec=T.filter(eo),ed=ea.filter(e=>"file"===e.type),ep=ea.filter(e=>"prompt"===e.type),ex=w.filter(e=>"file"===e.type),em=w.filter(e=>"prompt"===e.type),eh=async()=>{try{let e=await v.validateFields(),l=await (0,D.dg)(e);S(l.roles),z(l.configs),Y(!1),n.success(r("common.success"))}catch(e){n.error(r("common.error"))}},ey=async()=>{try{let e=await b.validateFields(),l=e=>(null!=e?e:[]).map((e,l)=>{var r;return{roleId:e.roleId,order:Number(null!=(r=e.order)?r:l)}}),i=await (0,D.NR)({...e,fileRoles:l(e.fileRoles),promptRoles:l(e.promptRoles)});S(i.roles),z(i.configs),$(!1),n.success(r("common.success"))}catch(e){n.error(r("common.error"))}},ef=async e=>{let l=await (0,D.FV)(e.type,e.id);S(l.roles),z(l.configs)},eu=async e=>{let l=await (0,D.dw)(e);S(l.roles),z(l.configs)},ej=function(e){var l;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";v.setFieldsValue(e?{...e,resourceIds:(null==(l=e.resourceIds)?void 0:l.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]}:{id:"role-".concat(Date.now()),name:"",description:"",type:r,resourceIds:[],executionType:"prompt"===r?"reference":void 0,processingType:"file"===r?"reference":void 0}),Y(!0)},eg=e=>{b.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[],builtIn:!1}),$(!0)},eA=e=>w.find(l=>l.id===e),ev=async e=>{X(!0);try{let l=await (0,D.nU)({query:e,limit:80,includeContent:!!e.trim()});B(l.files)}catch(e){n.error("知识库文件检索失败")}finally{X(!1)}},eb=k.map(e=>({label:(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8},children:[(0,i.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.relativePath}),(0,i.jsxs)(c.A,{size:4,children:[(0,i.jsx)(t.A,{color:"content"===e.matchedBy?"purple":"disk"===e.matchedBy?"orange":"blue",style:{margin:0},children:"content"===e.matchedBy?"内容":"disk"===e.matchedBy?"磁盘":"文件"}),(0,i.jsx)(t.A,{style:{margin:0},children:e.status})]})]}),value:e.relativePath}));return(0,i.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"pageTitle",children:r("roles.title")}),(0,i.jsx)("p",{className:"pageDesc",children:r("roles.description")})]}),(0,i.jsxs)(c.A,{children:[(0,i.jsx)(h.A,{value:es,onChange:en,style:{width:170},options:[{label:"我的配置 (".concat(w.length+T.length,")"),value:"custom"},{label:"全部来源 (".concat(w.length+T.length,")"),value:"all"}]}),(0,i.jsx)(x.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>ej(void 0,"file"),children:r("roles.newFileRole")}),(0,i.jsx)(x.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>ej(void 0,"prompt"),children:r("roles.newPromptRole")}),(0,i.jsx)(x.Ay,{type:"primary",icon:(0,i.jsx)(W.A,{}),onClick:()=>eg(),children:r("roles.newConfig")})]})]}),(0,i.jsx)(y.A,{type:"info",showIcon:!0,message:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)("span",{children:r("roles.plainGuideTitle")}),(0,i.jsx)(x.Ay,{type:"link",size:"small",icon:ee?(0,i.jsx)(H.A,{}):(0,i.jsx)(N.A,{}),onClick:()=>el(!ee),style:{padding:"0 4px"},children:ee?"收起说明":"展开说明"})]}),description:ee?r("roles.plainGuideDesc"):void 0}),(0,i.jsx)(p.A,{size:"small",tabList:[{key:"file",label:"文件角色 (".concat(ed.length,")")},{key:"prompt",label:"提示词角色 (".concat(ep.length,")")},{key:"configs",label:"项目角色配置 (".concat(ec.length,")")}],activeTabKey:er,onTabChange:ei,children:"configs"===er?0===ec.length?(0,i.jsx)(d.A,{description:r("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:ec.map(e=>{let l=e.fileRoles.map(e=>({...e,role:eA(e.roleId)})).filter(e=>e.role),s=e.promptRoles.map(e=>({...e,role:eA(e.roleId)})).filter(e=>e.role);return(0,i.jsxs)(p.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:6},children:[(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.name}),(0,i.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的配置"}),(0,i.jsxs)("div",{style:{display:"flex",gap:4,flexShrink:0},children:[(0,i.jsx)(x.Ay,{size:"small",icon:(0,i.jsx)(C.A,{}),onClick:()=>eg(e),children:"编辑"}),(0,i.jsx)(m.A,{title:r("common.confirm"),onConfirm:()=>{eu(e.id)},children:(0,i.jsx)(x.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(_.A,{})})})]})]}),e.description&&(0,i.jsx)(P,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,i.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,i.jsxs)("div",{style:{marginBottom:4},children:[(0,i.jsxs)("span",{children:["文件角色 (",e.fileRoles.length,"): "]}),l.length>0?(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[l.slice(0,4).map(e=>(0,i.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),l.length>4&&(0,i.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",l.length-4]})]}):(0,i.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("span",{children:["提示词角色 (",e.promptRoles.length,"): "]}),s.length>0?(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[s.slice(0,4).map(e=>(0,i.jsx)(t.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),s.length>4&&(0,i.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",s.length-4]})]}):(0,i.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]})]})]},e.id)})}):(e="file"===er?ed:ep,l=r,0===e.length?(0,i.jsx)(d.A,{description:r("common.noData")}):(0,i.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(270px, 1fr))",gap:12},children:e.map((e,s)=>{var n,o,a,c,d,h,y,f,u;let j=(null==(n=e.resourceIds)?void 0:n.length)?e.resourceIds:e.resourceId?[e.resourceId]:[],g=j.slice(0,3),A=j.length-g.length,v="file"===e.type?null!=(a=q[null!=(o=e.processingType)?o:""])?a:(0,i.jsx)(I.A,{}):null!=(d=O[null!=(c=e.executionType)?c:""])?d:(0,i.jsx)(F.A,{}),b="file"===e.type?null!=(y=V[null!=(h=e.processingType)?h:""])?y:"var(--colorAccent)":null!=(u=G[null!=(f=e.executionType)?f:""])?u:"var(--colorWarning)";return(0,i.jsxs)(p.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:8},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,flex:1},children:[(0,i.jsx)("span",{style:{color:b,fontSize:16,flexShrink:0,lineHeight:1},children:v}),(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"20px"},children:e.name})]}),(0,i.jsx)("div",{style:{display:"flex",gap:4,flexShrink:0},children:(0,i.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的角色"})})]}),e.description&&(0,i.jsx)(P,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,i.jsxs)("div",{style:{marginBottom:8,display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,i.jsx)(t.A,{color:"file"===e.type?"blue":"purple",style:{margin:0},children:function(e,l){var r,i,s;let n="file"===e.type?L[null!=(r=e.processingType)?r:""]:U[null!=(i=e.executionType)?i:""];return n?l(n):null!=(s="file"===e.type?e.processingType:e.executionType)?s:""}(e,l)}),j.length>0&&(0,i.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",j.length," 个资源"]})]}),g.length>0&&(0,i.jsx)("div",{style:{marginBottom:10},children:(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[g.map(e=>(0,i.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"},children:e},e)),A>0&&(0,i.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",A]})]})}),(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:6,paddingTop:4,borderTop:"1px solid var(--colorBorderSecondary)"},children:[(0,i.jsx)(x.Ay,{size:"small",icon:(0,i.jsx)(C.A,{}),onClick:()=>ej(e),children:"编辑"}),(0,i.jsx)(m.A,{title:r("common.confirm"),onConfirm:()=>{ef(e)},children:(0,i.jsx)(x.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(_.A,{})})})]})]},e.id)})}))}),(0,i.jsx)(f.A,{title:r("roles.roleEditor"),open:M,onClose:()=>Y(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,i.jsx)(x.Ay,{type:"primary",onClick:()=>{eh()},children:r("common.save")}),children:(0,i.jsxs)(a.A,{form:v,layout:"vertical",children:[(0,i.jsx)(a.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(u.A,{})}),(0,i.jsxs)(j.A,{gutter:16,children:[(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(a.A.Item,{name:"type",label:r("roles.roleType"),rules:[{required:!0}],children:(0,i.jsx)(h.A,{options:[{label:r("roles.fileRole"),value:"file"},{label:r("roles.promptRole"),value:"prompt"}]})})}),(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(a.A.Item,{name:"name",label:r("roles.roleName"),rules:[{required:!0}],children:(0,i.jsx)(u.A,{})})})]}),(0,i.jsx)(a.A.Item,{name:"description",label:r("roles.roleDescription"),children:(0,i.jsx)(u.A.TextArea,{rows:2})}),(0,i.jsx)(a.A.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.type!==l.type,children:e=>{let{getFieldValue:l}=e,s="prompt"===l("type");return(0,i.jsx)(p.A,{size:"small",title:s?"提示词角色配置":"文件角色配置",style:{border:"1px solid var(--colorBorderSecondary)"},children:s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.A.Item,{name:"executionType",label:r("roles.executionType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,i.jsx)(h.A,{options:[{label:r("roles.factExtraction"),value:"fact_extraction"},{label:r("roles.chapterGeneration"),value:"chapter_generation"},{label:r("roles.validation"),value:"validation"},{label:r("roles.formatting"),value:"formatting"},{label:r("roles.reference"),value:"reference"}]})}),(0,i.jsx)(a.A.Item,{name:"resourceIds",label:r("roles.bindPrompt"),style:{marginBottom:0},help:(0,i.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:r("roles.multiBindPromptHelp")}),children:(0,i.jsx)(h.A,{mode:"multiple",showSearch:!0,tagRender:Q,placeholder:"选择提示词",options:K.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.A.Item,{name:"processingType",label:r("roles.processingType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,i.jsx)(h.A,{options:[{label:r("roles.ruleFile"),value:"rule"},{label:r("roles.projectFactFile"),value:"project_fact"},{label:r("roles.tableFile"),value:"table"},{label:r("roles.drawingFile"),value:"drawing"},{label:r("roles.specificationFile"),value:"specification"},{label:r("roles.reference"),value:"reference"}]})}),(0,i.jsx)(a.A.Item,{name:"resourceIds",label:r("roles.bindFile"),style:{marginBottom:0},help:(0,i.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:r("roles.multiBindFileHelp")}),children:(0,i.jsx)(h.A,{mode:"multiple",showSearch:!0,filterOption:!1,loading:R,onSearch:e=>{ev(e)},onFocus:()=>{ev("")},tagRender:Q,placeholder:"输入关键词搜索知识库文件",options:eb,optionLabelProp:"value"})})]})})}})]})}),(0,i.jsx)(f.A,{title:r("roles.configEditor"),open:Z,onClose:()=>$(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,i.jsx)(x.Ay,{type:"primary",onClick:()=>{ey()},children:r("common.save")}),children:(0,i.jsxs)(a.A,{form:b,layout:"vertical",children:[(0,i.jsx)(a.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(u.A,{})}),(0,i.jsxs)(j.A,{gutter:16,children:[(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(a.A.Item,{name:"name",label:r("roles.configName"),rules:[{required:!0}],children:(0,i.jsx)(u.A,{})})}),(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(a.A.Item,{name:"description",label:r("roles.configDescription"),children:(0,i.jsx)(u.A,{})})})]}),(0,i.jsx)(A.A,{destroyInactiveTabPane:!1,items:[{key:"file",label:"文件角色 (".concat(ed.length,")"),children:(0,i.jsx)(a.A.List,{name:"fileRoles",children:(e,l)=>{let{add:s,remove:n}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0===e.length&&(0,i.jsx)(d.A,{description:"暂未添加文件角色"}),e.map((e,l)=>(0,i.jsxs)(p.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsxs)("div",{style:{position:"absolute",top:-10,left:12,background:"#1677ff",color:"#fff",fontSize:11,fontWeight:700,padding:"1px 8px",borderRadius:10},children:["#",l+1]}),(0,i.jsx)(x.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(_.A,{}),onClick:()=>n(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsxs)(j.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,i.jsx)(g.A,{flex:"auto",children:(0,i.jsx)(a.A.Item,{name:[e.name,"roleId"],label:"文件角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(h.A,{placeholder:"选择文件角色",size:"small",options:ex.map(e=>{var l;return{label:"".concat(e.name," (").concat(r(L[null!=(l=e.processingType)?l:""]||"roles.reference"),")"),value:e.id}})})})}),(0,i.jsx)(g.A,{style:{width:90},children:(0,i.jsx)(a.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(u.A,{type:"number",size:"small"})})})]})]},e.key)),(0,i.jsx)(x.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>s({order:e.length}),children:r("roles.addRole")})]})}})},{key:"prompt",label:"提示词角色 (".concat(em.length,")"),children:(0,i.jsx)(a.A.List,{name:"promptRoles",children:(e,l)=>{let{add:s,remove:n}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0===e.length&&(0,i.jsx)(d.A,{description:"暂未添加提示词角色"}),e.map((e,l)=>(0,i.jsxs)(p.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsxs)("div",{style:{position:"absolute",top:-10,left:12,background:"#722ed1",color:"#fff",fontSize:11,fontWeight:700,padding:"1px 8px",borderRadius:10},children:["#",l+1]}),(0,i.jsx)(x.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(_.A,{}),onClick:()=>n(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsxs)(j.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,i.jsx)(g.A,{flex:"auto",children:(0,i.jsx)(a.A.Item,{name:[e.name,"roleId"],label:"提示词角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(h.A,{placeholder:"选择提示词角色",size:"small",options:em.map(e=>{var l;return{label:"".concat(e.name," (").concat(r(U[null!=(l=e.executionType)?l:""]||"roles.reference"),")"),value:e.id}})})})}),(0,i.jsx)(g.A,{style:{width:90},children:(0,i.jsx)(a.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(u.A,{type:"number",size:"small"})})})]})]},e.key)),(0,i.jsx)(x.Ay,{icon:(0,i.jsx)(W.A,{}),onClick:()=>s({order:e.length}),children:r("roles.addRole")})]})}})}]})]})})]})}}},e=>{e.O(0,[433,787,576,195,455,909,636,593,792],()=>e(e.s=23507)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{27549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(34508)}])},34508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>q});var o=r(65321),l=r(97109),i=r(79059),n=r(17807),a=r(33442),s=r(11702),c=r(56985),d=r(85114),p=r(26171),h=r(68787),m=r(88762),u=r(7576),x=r(57271),y=r(49292),f=r(55122),g=r(84253),j=r(34052),v=r(42700),w=r(54746),S=r(99650),A=r(58209),b=r(26631),C=r(29606),k=r(96091),z=r(81668),T=r(30486),F=r(46082),N=r(42758),B=r(24810),E=r(7492);async function I(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function R(e,t,r){let o=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t,name:r})});if(!o.ok)throw Error("Failed");return o.json()}async function O(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function P(e,t){let r=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function W(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"select",selectedIds:e})});if(!t.ok)throw Error("Failed");return t.json()}async function D(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"import",...e&&"object"==typeof e?e:{prompts:[]}})});if(!t.ok)throw Error(await t.text());return t.json()}async function H(){return J("",!1,60)}async function _(e){let t=await fetch("/api/kb/files/detail?relativePath=".concat(encodeURIComponent(e)));if(!t.ok)throw Error("Failed");return((await t.json()).chunks||[]).map(e=>e.content||"").filter(Boolean).join("\n\n").slice(0,12e3)}async function J(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,o=new URLSearchParams({limit:String(r)});e.trim()&&o.set("q",e.trim()),t||o.set("includeContent","0");let l=await fetch("/api/kb/files/search?".concat(o));return l.ok&&(await l.json()).files||[]}async function L(e){let t=await fetch("/api/prompt/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.text();try{let t=JSON.parse(e);throw Error(t.error||t.message||e||"AI 对话失败")}catch(t){throw Error(e||"AI 对话失败")}}return t.json()}function M(e){return e.id.startsWith("custom:")}function U(e){return M(e)?"custom":e.isCurrent?"current":"project"}function $(e){return"custom"===e?"我的提示词":"current"===e?"当前项目":"project"===e?"其他项目":"全部"}function G(e,t,r){return e?"customize-agent:prompt-chat:".concat(e.id,":").concat(e.customizePath||e.projectName):"customize-agent:prompt-chat:draft:".concat(r||t||"new")}function X(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:220,r=e.hasFile&&e.content?e.content.replace(/^#.*$/gm,"").replace(/\n{3,}/g,"\n\n").trim():"";return r.length>t?"".concat(r.slice(0,t),"..."):r}function Y(e){let t=Date.parse(e);return Number.isNaN(t)?"-":new Date(t).toLocaleString()}function Z(e){let t=e.match(/(^|\s)@([^\s@]*)$/);return t?t[2]:null}function q(){let e=(0,i.Vr)(),{message:t}=n.A.useApp(),[r,q]=(0,l.useState)(!0),[K,V]=(0,l.useState)([]),[Q,ee]=(0,l.useState)(!1),[et,er]=(0,l.useState)(null),[eo,el]=(0,l.useState)(""),[ei,en]=(0,l.useState)(""),[ea,es]=(0,l.useState)(!1),[ec,ed]=(0,l.useState)(!1),[ep,eh]=(0,l.useState)("custom"),[em,eu]=(0,l.useState)("all"),[ex,ey]=(0,l.useState)("mtime"),[ef,eg]=(0,l.useState)("list"),[ej,ev]=(0,l.useState)(""),[ew,eS]=(0,l.useState)(null),[eA,eb]=(0,l.useState)([]),[eC,ek]=(0,l.useState)(!1),[ez,eT]=(0,l.useState)([]),[eF,eN]=(0,l.useState)(""),[eB,eE]=(0,l.useState)(""),[eI,eR]=(0,l.useState)(!1),[eO,eP]=(0,l.useState)([]),[eW,eD]=(0,l.useState)([]),[eH,e_]=(0,l.useState)([]),[eJ,eL]=(0,l.useState)(!1),[eM,eU]=(0,l.useState)(!1),[e$,eG]=(0,l.useState)(!1),eX=(0,l.useRef)(null),eY=(0,l.useRef)(null),eZ=Z(eB),eq=async()=>{q(!0);try{V(await I())}catch(r){t.error(e("common.error"))}finally{q(!1)}};(0,l.useEffect)(()=>{eq()},[]),(0,l.useEffect)(()=>{let e=window.localStorage.getItem("customize-agent:prompt-view-mode");("list"===e||"card"===e)&&eg(e)},[]),(0,l.useEffect)(()=>{window.localStorage.setItem("customize-agent:prompt-view-mode",ef)},[ef]),(0,l.useEffect)(()=>{let e=eY.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),eF&&window.localStorage.setItem(eF,JSON.stringify(ez.slice(-30)))},[ez,eI,eF]),(0,l.useEffect)(()=>{!Q||eO.length>0||eJ||(eL(!0),H().then(eP).catch(()=>void 0).finally(()=>eL(!1)))},[Q,eO.length,eJ]),(0,l.useEffect)(()=>{let e=null==eZ?void 0:eZ.trim();if(!Q||!e){eD([]),eU(!1);return}let t=!1;eU(!0);let r=window.setTimeout(()=>{J(e).then(e=>{t||eD(e)}).catch(()=>{t||eD([])}).finally(()=>{t||eU(!1)})},250);return()=>{t=!0,window.clearTimeout(r)}},[Q,eZ]);let eK=K.find(e=>e.isCurrent),eV=K.filter(M),eQ={all:K.length,custom:K.filter(e=>"custom"===U(e)).length,current:K.filter(e=>"current"===U(e)).length,project:K.filter(e=>"project"===U(e)).length,selected:K.filter(e=>e.selected).length,unselected:K.filter(e=>!e.selected).length,hasFile:K.filter(e=>e.hasFile).length,missingFile:K.filter(e=>!e.hasFile).length},e0=K.filter(e=>{var t;let r=U(e);return("all"===ep||r===ep)&&("selected"!==em||!!e.selected)&&("unselected"!==em||!e.selected)&&("hasFile"!==em||!!e.hasFile)&&("missingFile"!==em||!e.hasFile)&&(!ej.trim()||(t=ej.trim(),!!"".concat(e.projectName,"\n").concat(e.projectRoot||"","\n").concat(e.customizePath||"","\n").concat(e.content||"").toLowerCase().includes(t.toLowerCase())))}).sort((e,t)=>"name"===ex?e.projectName.localeCompare(t.projectName):"source"===ex?["custom","current","project"].indexOf(U(e))-["custom","current","project"].indexOf(U(t)):"selected"===ex&&Number(t.selected)-Number(e.selected)||Date.parse(t.mtime||"")-Date.parse(e.mtime||"")),e1=e0.find(e=>e.id===ew)||e0[0]||null,e2=eA.filter(e=>e0.some(t=>t.id===e)),e8=(null==eZ?void 0:eZ.trim())?eW:eO,e4=(e,t,r)=>{let o=G(e,t,r);eN(o),eT(function(e){try{let t=JSON.parse(window.localStorage.getItem(e)||"[]");return Array.isArray(t)?t.filter(e=>("user"===e.role||"assistant"===e.role)&&"string"==typeof e.content).slice(-30):[]}catch(e){return[]}}(o)),eE(""),eR(!1),e_([]),eG(!1)},e6=r=>{if(null==r?void 0:r.projectRoot)return void O(r.projectRoot).then(()=>{t.success(e("common.success")),eq()}).catch(()=>t.error(e("common.error")));let o="new:".concat(Date.now());er(null),ed(!0),en(""),el(""),e4(null,"new",o),ee(!0)},e7=async()=>{if(!ei.trim())return void t.error("请输入名称");es(!0);try{if(et)await R(et.customizePath,eo,M(et)?ei.trim():void 0),t.success(e("common.success"));else{let r=await P(ei.trim(),eo||"# ".concat(ei.trim(),"\n"));!function(e,t){if(!e||!t||e===t)return;let r=window.localStorage.getItem(e);r&&!window.localStorage.getItem(t)&&window.localStorage.setItem(t,r)}(eF,G({id:r.id,projectId:r.id,projectName:ei.trim(),customizePath:r.id,content:eo,mtime:"",hasFile:!0,isCurrent:!1,selected:!1,source:"custom"},ei.trim())),t.success(e("common.success"))}ee(!1),await eq()}catch(r){t.error(e("common.error"))}finally{es(!1)}},e3=async e=>{let t=Array.from(new Set([...eH,...eO.filter(t=>e.includes("@".concat(t.relativePath))).map(e=>e.relativePath)])).slice(0,3),r=[];for(let e of t){let t=await _(e);t&&r.push({relativePath:e,content:t})}return r},e5=async()=>{let e=eB.trim();if(!e||eI)return;let r=[...ez,{role:"user",content:e}];eT(r),eE(""),eG(!1),eR(!0);try{let t=await e3(e),o=await L({name:ei||(null==et?void 0:et.projectName)||"未命名提示词",content:eo,message:e,history:ez,references:t});eT([...r,{role:"assistant",content:o.content||"AI 未返回内容"}])}catch(e){t.error(e instanceof Error?e.message:"AI 对话失败,请检查模型配置"),eT(r)}finally{eR(!1)}},e9=async(r,o)=>{let l=o?Array.from(new Set([...K.filter(e=>e.selected).map(e=>e.id),r.id])):K.filter(e=>e.selected&&e.id!==r.id).map(e=>e.id);try{await W(l),V(e=>e.map(e=>({...e,selected:l.includes(e.id)})))}catch(r){t.error(e("common.error"))}},te=async r=>{let o=K.filter(e=>e.selected).map(e=>e.id),l=r?Array.from(new Set([...o,...e2])):o.filter(e=>!e2.includes(e));try{await W(l),V(e=>e.map(e=>({...e,selected:l.includes(e.id)}))),eb([]),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},tt=async r=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:r.projectId,filePath:r.customizePath})})).ok)throw Error("Failed");t.success(e("common.success")),eb(e=>e.filter(e=>e!==r.id)),await eq()}catch(r){t.error(e("common.error"))}},tr=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"custom",r="checked"===e?K.filter(e=>e2.includes(e.id)):"filtered"===e?e0:eV;!function(e,t){let r=new Blob([t],{type:"text/plain;charset=utf-8"}),o=URL.createObjectURL(r),l=document.createElement("a");l.href=o,l.download=e,l.click(),URL.revokeObjectURL(o)}("customize-prompts-".concat(new Date().toISOString().slice(0,10),".txt"),r.map(e=>["# Prompt: ".concat(e.projectName),"Source: ".concat($(U(e))),"Path: ".concat(e.customizePath||"-"),"Project: ".concat(e.projectRoot||"-"),"Selected: ".concat(e.selected?"true":"false"),"Updated: ".concat(Y(e.mtime)),"",e.content||""].join("\n")).join("\n\n---\n\n")),t.success("已导出 ".concat(r.length," 条提示词"))},to=async e=>{if(e){ek(!0);try{let r=await e.text(),o=JSON.parse(r),l=await D(o);t.success("已导入 ".concat(l.imported," 条提示词")),await eq()}catch(e){t.error("导入失败,请确认 JSON 文件格式正确")}finally{ek(!1),eX.current&&(eX.current.value="")}}},tl=e=>{let t=U(e);return(0,o.jsxs)(a.A,{size:4,wrap:!0,children:[(0,o.jsx)(s.A,{color:"custom"===t?"cyan":"current"===t?"green":"project"===t?"blue":"default",style:{margin:0},children:$(t)}),e.selected&&(0,o.jsx)(s.A,{color:"purple",style:{margin:0},children:"已选中"}),!e.hasFile&&(0,o.jsx)(s.A,{style:{margin:0},children:"无文件"})]})},ti=e=>(0,o.jsxs)(a.A,{size:6,children:[e.hasFile&&(0,o.jsx)(c.A,{checked:e.selected,onChange:t=>{e9(e,t.target.checked)},children:"选中"}),!e.hasFile&&e.projectRoot&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(w.A,{}),onClick:()=>e6(e),children:"创建"}),e.hasFile&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(S.A,{}),onClick:()=>{er(e),ed(!1),en(e.projectName),el(e.content||""),e4(e,e.projectName),ee(!0)},children:"编辑"}),(0,o.jsx)(p.A,{title:M(e)?"删除自定义提示词?":"删除项目记录及文件?",onConfirm:()=>{tt(e)},children:(0,o.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,o.jsx)(A.A,{})})})]});return r?(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsx)(m.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:Array.from({length:4}).map((e,t)=>(0,o.jsx)(h.A,{size:"small",children:(0,o.jsx)(m.A,{active:!0,paragraph:{rows:4}})},t))})]}):(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.promptManagement")}),(0,o.jsx)("p",{className:"pageDesc",children:e("prompt.description")})]}),(0,o.jsxs)(a.A,{wrap:!0,children:[eK&&(0,o.jsxs)(s.A,{color:"green",style:{lineHeight:"22px"},children:[(0,o.jsx)(C.A,{})," ",eK.projectRoot]}),(0,o.jsx)("input",{ref:eX,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:e=>{var t;to(null==(t=e.target.files)?void 0:t[0])}}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(k.A,{}),loading:eC,onClick:()=>{var e;return null==(e=eX.current)?void 0:e.click()},children:"导入"}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(z.A,{}),disabled:0===e0.length,onClick:()=>tr("filtered"),children:"导出筛选"}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(w.A,{}),onClick:()=>e6(),children:"创建提示词"})]})]}),(0,o.jsxs)(h.A,{size:"small",styles:{body:{display:"flex",gap:10,flexWrap:"wrap",alignItems:"center"}},children:[(0,o.jsx)(u.A,{prefix:(0,o.jsx)(T.A,{}),allowClear:!0,placeholder:"搜索名称、内容、路径...",value:ej,onChange:e=>ev(e.target.value),style:{width:280}}),(0,o.jsx)(x.A,{value:ep,onChange:eh,style:{width:150},options:[{label:"全部 (".concat(eQ.all,")"),value:"all"},{label:"我的提示词 (".concat(eQ.custom,")"),value:"custom"},{label:"当前项目 (".concat(eQ.current,")"),value:"current"},{label:"其他项目 (".concat(eQ.project,")"),value:"project"}]}),(0,o.jsx)(x.A,{value:em,onChange:eu,style:{width:130},options:[{label:"全部状态",value:"all"},{label:"已选中 (".concat(eQ.selected,")"),value:"selected"},{label:"未选中 (".concat(eQ.unselected,")"),value:"unselected"},{label:"有文件 (".concat(eQ.hasFile,")"),value:"hasFile"},{label:"无文件 (".concat(eQ.missingFile,")"),value:"missingFile"}]}),(0,o.jsx)(x.A,{value:ex,onChange:ey,style:{width:140},options:[{label:"最近修改优先",value:"mtime"},{label:"名称 A-Z",value:"name"},{label:"来源优先",value:"source"},{label:"已选中优先",value:"selected"}]}),(0,o.jsx)(y.A,{value:ef,onChange:e=>eg(e),options:[{label:(0,o.jsx)(F.A,{}),value:"list"},{label:(0,o.jsx)(N.A,{}),value:"card"}]}),(0,o.jsx)("div",{style:{flex:1}}),(0,o.jsxs)("span",{style:{color:"var(--colorTextSecondary)",fontSize:13},children:["已显示 ",e0.length," / ",K.length]})]}),(0,o.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"260px minmax(0, 1fr)",gap:14,alignItems:"start"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[(0,o.jsxs)(h.A,{size:"small",title:"分组导航",styles:{body:{padding:8}},children:[[["all","全部",eQ.all],["custom","我的提示词",eQ.custom],["current","当前项目",eQ.current],["project","其他项目",eQ.project]].map(e=>{let[t,r,l]=e;return(0,o.jsxs)("button",{onClick:()=>eh(t),style:{width:"100%",border:"none",background:ep===t?"var(--colorFillSecondary)":"transparent",color:"var(--colorText)",padding:"9px 10px",borderRadius:8,display:"flex",justifyContent:"space-between",cursor:"pointer",fontWeight:ep===t?700:400},children:[(0,o.jsx)("span",{children:r}),(0,o.jsx)("span",{children:l})]},t)}),(0,o.jsx)(f.A,{style:{margin:"8px 0"}}),[["selected","已选中",eQ.selected],["unselected","未选中",eQ.unselected]].map(e=>{let[t,r,l]=e;return(0,o.jsxs)("button",{onClick:()=>eu(em===t?"all":t),style:{width:"100%",border:"none",background:em===t?"var(--colorFillSecondary)":"transparent",color:"var(--colorText)",padding:"9px 10px",borderRadius:8,display:"flex",justifyContent:"space-between",cursor:"pointer",fontWeight:em===t?700:400},children:[(0,o.jsx)("span",{children:r}),(0,o.jsx)("span",{children:l})]},t)})]}),(0,o.jsx)(h.A,{size:"small",title:"详情预览",styles:{body:{height:300,display:"flex",flexDirection:"column",gap:10,overflow:"hidden"}},children:e1?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[(0,o.jsx)(b.A,{style:{color:"var(--colorAccent)",flexShrink:0}}),(0,o.jsx)("strong",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e1.projectName})]}),(0,o.jsx)("div",{style:{minWidth:0,overflow:"hidden"},children:tl(e1)}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.7,minWidth:0},children:[(0,o.jsxs)("div",{children:["更新时间:",Y(e1.mtime)]}),(0,o.jsxs)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["文件路径:",e1.customizePath||"-"]}),(0,o.jsxs)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["项目路径:",e1.projectRoot||"-"]})]}),(0,o.jsx)("div",{style:{flex:1,minHeight:0,padding:10,borderRadius:8,background:"var(--colorFillAlter)",color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.7,overflow:"auto",whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:X(e1,800)||"暂无内容预览"}),(0,o.jsx)("div",{children:ti(e1)})]}):(0,o.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:"请选择一个提示词"})})]}),(0,o.jsxs)("div",{style:{minWidth:0},children:[e2.length>0&&(0,o.jsxs)(h.A,{size:"small",style:{marginBottom:12},styles:{body:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"}},children:[(0,o.jsxs)("span",{style:{fontWeight:600},children:["已选择 ",e2.length," 项"]}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>{te(!0)},children:"批量选中"}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>{te(!1)},children:"取消选中"}),(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(z.A,{}),onClick:()=>tr("checked"),children:"导出选中"}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>eb([]),children:"清空选择"})]}),0===e0.length?(0,o.jsx)(h.A,{children:(0,o.jsx)(g.A,{description:ej||"all"!==em?"没有找到匹配的提示词,请尝试更换关键词或清空筛选条件":"当前分组没有提示词"})}):"list"===ef?(0,o.jsx)(a.A,{direction:"vertical",size:10,style:{width:"100%"},children:e0.map(e=>{let t=X(e,180),r=(null==e1?void 0:e1.id)===e.id;return(0,o.jsxs)("div",{onClick:()=>eS(e.id),style:{display:"grid",gridTemplateColumns:"28px minmax(0, 1fr) auto",gap:12,alignItems:"center",padding:14,border:"1px solid ".concat(r?"var(--colorAccent)":"var(--colorBorderSecondary)"),borderRadius:12,background:r?"var(--colorFillSecondary)":"var(--colorBgContainer)",cursor:"pointer",transition:"all .2s ease"},children:[(0,o.jsx)(c.A,{checked:eA.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eb(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,o.jsxs)("div",{style:{minWidth:0},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[(0,o.jsx)(b.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.projectName}),tl(e)]}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:6*!!t},children:[(0,o.jsx)(C.A,{style:{marginRight:4}}),e.projectRoot||e.customizePath||"本地提示词"," \xb7 ",Y(e.mtime)]}),t&&(0,o.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.6,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"pre-wrap"},children:t})]}),(0,o.jsx)("div",{onClick:e=>e.stopPropagation(),children:ti(e)})]},e.id)})}):(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:12},children:e0.map(e=>{let t=X(e,180),r=(null==e1?void 0:e1.id)===e.id;return(0,o.jsxs)(h.A,{size:"small",hoverable:!0,onClick:()=>eS(e.id),style:{borderColor:r?"var(--colorAccent)":void 0},styles:{body:{display:"flex",flexDirection:"column",minHeight:210}},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,o.jsx)(c.A,{checked:eA.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eb(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,o.jsx)(b.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.projectName})]}),(0,o.jsx)("div",{style:{marginBottom:8},children:tl(e)}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:[(0,o.jsx)(C.A,{style:{marginRight:4}}),e.projectRoot||e.customizePath||"本地提示词"]}),(0,o.jsx)("div",{style:{padding:10,background:"var(--colorFillAlter)",borderRadius:8,color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.6,minHeight:72,maxHeight:72,overflow:"hidden",whiteSpace:"pre-wrap"},children:t||"暂无内容预览"}),(0,o.jsxs)("div",{style:{marginTop:"auto",paddingTop:10,borderTop:"1px solid var(--colorBorderSecondary)",display:"flex",justifyContent:"space-between",alignItems:"center"},onClick:e=>e.stopPropagation(),children:[(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:Y(e.mtime)}),ti(e)]})]},e.id)})})]})]}),(0,o.jsxs)(j.A,{title:ec?"创建提示词":et&&M(et)?"编辑我的提示词 — ".concat(ei||et.projectName):"编辑项目提示词 — ".concat((null==et?void 0:et.projectName)||""),open:Q,onClose:()=>ee(!1),width:980,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px",display:"grid",gridTemplateRows:"minmax(320px, 1fr) 420px",gap:14,height:"100%"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,o.jsxs)(a.A,{children:[(0,o.jsx)(d.Ay,{onClick:()=>ee(!1),children:e("common.cancel")}),(0,o.jsx)(d.Ay,{type:"primary",loading:ea,onClick:()=>{e7()},children:e("common.save")})]}),children:[(0,o.jsxs)("div",{style:{minHeight:0,display:"flex",flexDirection:"column"},children:[(0,o.jsx)("div",{style:{marginBottom:12},children:ec||et&&M(et)?(0,o.jsxs)(a.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,o.jsx)(u.A,{placeholder:"提示词名称",value:ei,onChange:e=>en(e.target.value),style:{maxWidth:520}}),!ec&&(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==et?void 0:et.customizePath})]}):(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==et?void 0:et.customizePath})}),(0,o.jsx)(u.A.TextArea,{value:eo,onChange:e=>el(e.target.value),style:{flex:1,minHeight:280,fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13,resize:"none"}})]}),(0,o.jsxs)("div",{style:{minHeight:0,border:"1px solid var(--colorBorderSecondary)",borderRadius:10,background:"var(--colorBgContainer)",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 8px 24px rgba(15, 23, 42, 0.06)"},children:[(0,o.jsxs)("div",{style:{padding:"10px 12px",borderBottom:"1px solid var(--colorBorderSecondary)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,o.jsxs)(a.A,{size:6,children:[(0,o.jsx)(B.A,{style:{color:"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:600},children:"AI 提示词助手"})]}),(0,o.jsxs)(a.A,{size:6,children:[ez.length>0&&(0,o.jsx)(d.Ay,{size:"small",onClick:()=>eT([]),children:"清空历史"}),eI?(0,o.jsx)(s.A,{color:"processing",style:{margin:0},children:"生成中"}):(0,o.jsx)(s.A,{color:"blue",style:{margin:0},children:"可对话优化"})]})]}),(0,o.jsx)("div",{ref:eY,style:{flex:1,minHeight:0,overflowY:"auto",padding:14,background:"var(--colorFillAlter)"},children:0!==ez.length||eI?(0,o.jsxs)(a.A,{direction:"vertical",size:12,style:{width:"100%"},children:[ez.map((e,r)=>{let l="user"===e.role;return(0,o.jsx)("div",{style:{display:"flex",justifyContent:l?"flex-end":"flex-start"},children:(0,o.jsxs)("div",{style:{maxWidth:"78%",padding:"10px 12px",borderRadius:12,background:l?"var(--colorFillSecondary)":"var(--colorBgContainer)",color:"var(--colorText)",border:"1px solid var(--colorBorderSecondary)",whiteSpace:"pre-wrap",lineHeight:1.7,fontSize:13,transition:"all .2s ease"},children:[e.content,!l&&(0,o.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:8},children:(0,o.jsx)(d.Ay,{size:"small",type:"primary",onClick:()=>{el(e.content),t.success("已应用到编辑内容,请确认后保存")},children:"应用"})})]})},"".concat(e.role,"-").concat(r))}),eI&&(0,o.jsx)("div",{style:{display:"flex",justifyContent:"flex-start"},children:(0,o.jsxs)("div",{style:{padding:"10px 12px",borderRadius:12,background:"var(--colorBgContainer)",border:"1px solid var(--colorBorderSecondary)",color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),"AI 正在分析并生成内容..."]})})]}):(0,o.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:"输入 @ 召回知识库文件,再描述你的优化目标"})}),(0,o.jsx)(f.A,{style:{margin:0}}),(0,o.jsxs)("div",{style:{padding:12},children:[eH.length>0&&(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:eH.map(e=>(0,o.jsxs)(s.A,{closable:!0,onClose:()=>e_(t=>t.filter(t=>t!==e)),style:{margin:0,maxWidth:360,overflow:"hidden",textOverflow:"ellipsis"},children:["@",e]},e))}),e$&&(0,o.jsxs)("div",{style:{maxHeight:260,overflowY:"auto",marginBottom:8,border:"1px solid var(--colorBorderSecondary)",borderRadius:12,background:"var(--colorBgElevated, var(--colorBgContainer))",boxShadow:"0 16px 40px rgba(15, 23, 42, 0.14)"},children:[(0,o.jsxs)("div",{style:{position:"sticky",top:0,zIndex:1,padding:"10px 12px",borderBottom:"1px solid var(--colorBorderSecondary)",background:"var(--colorBgElevated, var(--colorBgContainer))",display:"flex",justifyContent:"space-between",gap:12,alignItems:"center"},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{style:{color:"var(--colorText)",fontSize:13,fontWeight:700},children:"召回知识库文件"}),(0,o.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11},children:"支持文件名与知识库内容检索,最多召回 3 个文件"})]}),(0,o.jsx)(s.A,{color:eZ?"blue":"default",style:{margin:0,maxWidth:240,overflow:"hidden",textOverflow:"ellipsis"},children:eZ?"@".concat(eZ):"输入 @关键词"})]}),eJ?(0,o.jsxs)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在加载知识库文件..."]}):0===eO.length?(0,o.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:"暂无可召回的知识库文件"}):0===e8.length?(0,o.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:eM?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在检索知识库内容..."]}):"没有匹配的知识库文件,请换个关键词"}):(0,o.jsxs)(o.Fragment,{children:[eM&&(0,o.jsxs)("div",{style:{padding:"8px 12px",color:"var(--colorTextSecondary)",fontSize:12,borderBottom:"1px solid var(--colorBorderSecondary)"},children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在继续检索内容匹配..."]}),e8.slice(0,30).map(e=>(0,o.jsxs)("div",{onMouseDown:t=>{var r;t.preventDefault(),r=e.relativePath,e_(e=>e.includes(r)?e:[...e,r]),eE(e=>e.replace(/(^|\s)@([^\s@]*)$/,"$1@".concat(r," "))),eG(!1)},style:{padding:"10px 12px",cursor:"pointer",borderBottom:"1px solid var(--colorBorderSecondary)",fontSize:12,display:"grid",gridTemplateColumns:"22px minmax(0, 1fr) auto",gap:10,alignItems:"center"},children:[(0,o.jsx)("div",{style:{width:22,height:22,borderRadius:7,background:"var(--colorFillSecondary)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(b.A,{style:{color:"var(--colorAccent)"}})}),(0,o.jsxs)("div",{style:{minWidth:0},children:[(0,o.jsx)("div",{style:{color:"var(--colorText)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:700},children:e.relativePath}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.category||"未分类"," \xb7 ",e.format||"未知格式","number"==typeof e.score?" \xb7 score ".concat(e.score.toFixed(2)):""]})]}),(0,o.jsxs)(a.A,{size:4,children:[(0,o.jsx)(s.A,{color:"content"===e.matchedBy?"purple":"disk"===e.matchedBy?"orange":"blue",style:{margin:0},children:"content"===e.matchedBy?"内容匹配":"disk"===e.matchedBy?"磁盘文件":"文件匹配"}),(0,o.jsx)(s.A,{style:{margin:0},children:e.status})]})]},e.relativePath))]})]}),(0,o.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-end"},children:[(0,o.jsx)(u.A.TextArea,{value:eB,onChange:e=>{let t=e.target.value;eE(t),eG(null!==Z(t))},onFocus:()=>eG(null!==Z(eB)),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),e5())},disabled:eI,placeholder:"输入 @ 召回知识库文件,再描述优化目标...",autoSize:{minRows:2,maxRows:5},style:{fontSize:13,lineHeight:1.6}}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(E.A,{}),loading:eI,disabled:!eB.trim(),onClick:()=>{e5()},children:"发送"})]})]})]})]})]})}}},e=>{e.O(0,[433,787,576,195,985,525,636,593,792],()=>e(e.s=27549)),_N_E=e.O()}]);