@customize-agent/server 4.1.18 → 4.1.20

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 (98) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +174 -18
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/_error.js +1 -1
  5. package/.next/server/chunks/1928.js +1 -1
  6. package/.next/server/chunks/582.js +223 -0
  7. package/.next/server/chunks/5840.js +1 -1
  8. package/.next/server/chunks/8661.js +2 -2
  9. package/.next/server/middleware-build-manifest.js +1 -40
  10. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  11. package/.next/server/next-font-manifest.js +1 -1
  12. package/.next/server/pages/404.html +1 -1
  13. package/.next/server/pages/500.html +1 -1
  14. package/.next/server/pages/api/assets/generated/preview.js +1 -1
  15. package/.next/server/pages/api/assets/generated/preview.js.nft.json +1 -1
  16. package/.next/server/pages/api/assets/generated.js +1 -1
  17. package/.next/server/pages/api/assets/generated.js.nft.json +1 -1
  18. package/.next/server/pages/api/config/providers.js +1 -1
  19. package/.next/server/pages/api/documents/chapter/regenerate.js +1 -1
  20. package/.next/server/pages/api/documents/chapter/regenerate.js.nft.json +1 -1
  21. package/.next/server/pages/api/documents/export.js +7 -7
  22. package/.next/server/pages/api/documents/export.js.nft.json +1 -1
  23. package/.next/server/pages/api/documents/generate.js +2 -2
  24. package/.next/server/pages/api/documents/generate.js.nft.json +1 -1
  25. package/.next/server/pages/api/documents/generated/[id].js +1 -1
  26. package/.next/server/pages/api/documents/generated/[id].js.nft.json +1 -1
  27. package/.next/server/pages/api/documents/generated.js +1 -1
  28. package/.next/server/pages/api/documents/generated.js.nft.json +1 -1
  29. package/.next/server/pages/api/documents/roles.js +1 -1
  30. package/.next/server/pages/api/documents/templates.js +1 -1
  31. package/.next/server/pages/api/documents/templates.js.nft.json +1 -1
  32. package/.next/server/pages/asset-library.html +1 -1
  33. package/.next/server/pages/document-roles.html +1 -1
  34. package/.next/server/pages/document-roles.js.nft.json +1 -1
  35. package/.next/server/pages/documents.html +1 -1
  36. package/.next/server/pages/guide.html +1 -1
  37. package/.next/server/pages/guide.js.nft.json +1 -1
  38. package/.next/server/pages/index.html +1 -1
  39. package/.next/server/pages/knowledge/file-detail.html +1 -1
  40. package/.next/server/pages/knowledge/files.html +1 -1
  41. package/.next/server/pages/knowledge/manage.html +1 -1
  42. package/.next/server/pages/knowledge.html +1 -1
  43. package/.next/server/pages/models.html +1 -1
  44. package/.next/server/pages/overview.html +1 -1
  45. package/.next/server/pages/prompt.html +1 -1
  46. package/.next/server/pages/settings.html +1 -1
  47. package/.next/server/pages/system/logs.html +1 -1
  48. package/.next/server/pages-manifest.json +60 -3
  49. package/.next/server/vendor-chunks/next@15.5.19_react-dom@19.2.7_react@19.2.7__react@19.2.7_sass@1.101.0.js +10 -10
  50. package/.next/static/Q_xFgspIZa7UtyNcbbeXp/_buildManifest.js +1 -0
  51. package/.next/static/chunks/44-d3545eedd5c75ef1.js +4 -0
  52. package/.next/static/chunks/563-b12f299d34bb9e44.js +1 -0
  53. package/.next/static/chunks/717-743b697a417dd5ee.js +4 -0
  54. package/.next/static/chunks/795-cd94e8d4e9768eb9.js +1 -0
  55. package/.next/static/chunks/827-a6dc09e42833e6a3.js +1 -0
  56. package/.next/static/chunks/883-506cbca959974997.js +16 -0
  57. package/.next/static/chunks/957-7c7f05f1c2ccfb96.js +8 -0
  58. package/.next/static/chunks/{238-16333381c574f65b.js → 994-241f87efc61005b8.js} +4 -1
  59. package/.next/static/chunks/fallback/amp.js +1015 -0
  60. package/.next/static/chunks/fallback/main.js +1616 -0
  61. package/.next/static/chunks/fallback/pages/_app.js +28 -0
  62. package/.next/static/chunks/fallback/pages/_error.js +28 -0
  63. package/.next/static/chunks/fallback/react-refresh.js +62 -0
  64. package/.next/static/chunks/fallback/webpack.js +1192 -0
  65. package/.next/static/chunks/pages/{asset-library-bedc7113dfc7ad6a.js → asset-library-a1047694e888e655.js} +1 -1
  66. package/.next/static/chunks/pages/document-roles-5620a98d6312f81c.js +1 -0
  67. package/.next/static/chunks/pages/documents-7550a1ef2e5f266c.js +1 -0
  68. package/.next/static/chunks/pages/guide-b847733a9a832c2c.js +1 -0
  69. package/.next/static/chunks/pages/knowledge/{file-detail-f70a35f5b24a5b61.js → file-detail-02cd5d87cd1d1c5d.js} +1 -1
  70. package/.next/static/chunks/pages/knowledge/{files-3b5d049efb076e4b.js → files-8503246ce2bc07c6.js} +1 -1
  71. package/.next/static/chunks/pages/knowledge/{manage-67b5c7fe257f37c5.js → manage-a00bb7fc6a76f820.js} +1 -1
  72. package/.next/static/chunks/pages/{models-89f9769a32da8e5f.js → models-aa250428e72433df.js} +1 -1
  73. package/.next/static/chunks/pages/{prompt-08ecf369f65abdfd.js → prompt-224af05519ef8304.js} +1 -1
  74. package/.next/static/chunks/pages/system/{logs-a76f9e3131e0cd79.js → logs-6f45ef8d862759a2.js} +1 -1
  75. package/.next/static/chunks/polyfills.js +1 -0
  76. package/.next/static/chunks/webpack.js +2 -2
  77. package/.next/static/css/3f9e41b5c0ba95f7.css +1 -0
  78. package/package.json +4 -4
  79. package/.next/server/chunks/1924.js +0 -215
  80. package/.next/static/VJfTgkSHEgD9CkDEznJbt/_buildManifest.js +0 -1
  81. package/.next/static/chunks/209-5117020514c2bd0c.js +0 -4
  82. package/.next/static/chunks/466-1cd359f130473697.js +0 -1
  83. package/.next/static/chunks/576-6699fed6c88502fe.js +0 -1
  84. package/.next/static/chunks/580-618d7d7e7b74daf6.js +0 -19
  85. package/.next/static/chunks/644-3299885a9dc1ef78.js +0 -11
  86. package/.next/static/chunks/649-06b72042a4de8074.js +0 -4
  87. package/.next/static/chunks/795-18a2b5f64892634d.js +0 -1
  88. package/.next/static/chunks/pages/document-roles-3d8c5440cc3f15fd.js +0 -1
  89. package/.next/static/chunks/pages/documents-b59eba36e96a5621.js +0 -1
  90. package/.next/static/chunks/pages/guide-9d7d88a25d972c06.js +0 -1
  91. package/.next/static/css/9daa4d0938f1a323.css +0 -1
  92. package/.next/static/development/_buildManifest.js +0 -1
  93. package/.next/static/development/_ssgManifest.js +0 -1
  94. package/.next/static/webpack/0dc2c45812c77911.webpack.hot-update.json +0 -1
  95. package/.next/static/webpack/7de8e01bd19935ee.webpack.hot-update.json +0 -1
  96. package/.next/static/webpack/webpack.0dc2c45812c77911.hot-update.js +0 -12
  97. package/.next/static/webpack/webpack.7de8e01bd19935ee.hot-update.js +0 -12
  98. /package/.next/static/{VJfTgkSHEgD9CkDEznJbt → Q_xFgspIZa7UtyNcbbeXp}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[414],{45551:(e,l,t)=>{"use strict";function n(e){if(0===e)return"0 B";let l=Math.floor(Math.log(e)/Math.log(1024)),t=e/Math.pow(1024,l);return"".concat(t.toFixed(+(0!==l))," ").concat(["B","KB","MB","GB","TB"][l])}function a(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===l?"Never":"从未";let t=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(t/60),a=Math.floor(n/24);return a>30?new Date(e).toLocaleDateString(l):"en-US"===l?a>0?"".concat(a,"d ago"):n>0?"".concat(n,"h ago"):t>0?"".concat(t,"m ago"):"Just now":a>0?"".concat(a," 天前"):n>0?"".concat(n," 小时前"):t>0?"".concat(t," 分钟前"):"刚刚"}t.d(l,{Jm:()=>s,fw:()=>a,z3:()=>n});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},o={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var l;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(l=("en-US"===t?o:r)[e])?l:e}},50423:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>E});var n=t(65321),a=t(97109),r=t(34986),o=t(48321),s=t(17807),c=t(33442),i=t(85114),d=t(2256),u=t(38770),h=t(68787),x=t(54849),g=t(50883),m=t(76506),j=t(11702),A=t(7225),f=t(30486),w=t(99811),k=t(56768),v=t(26619),p=t(93314),y=t(58740),b=t(35459),C=t(23216),S=t(63663),z=t(49484),D=t(6578),N=t(45551);let _=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function E(){var e,l,t,E;let I=(0,o.Vr)(),{locale:T}=(0,o.x_)(),M=(0,r.useRouter)(),{stats:B,loading:F,reload:R}=function(){let[e,l]=(0,a.useState)(null),[t,n]=(0,a.useState)(!1),r=(0,a.useCallback)(async()=>{n(!0);try{l(await (0,D.hc)())}catch(e){}finally{n(!1)}},[]);return(0,a.useEffect)(()=>{r()},[r]),{stats:e,loading:t,reload:r}}(),O=function(){let[e,l]=(0,a.useState)(null);return(0,a.useEffect)(()=>{(0,D.VW)().then(l).catch(()=>{})},[]),e}(),{reindexing:P,reindex:J}=function(){let[e,l]=(0,a.useState)(!1);return{reindexing:e,reindex:(0,a.useCallback)(async()=>{l(!0);try{return await (0,D.H1)(),!0}catch(e){return!1}finally{l(!1)}},[])}}(),[U,W]=(0,a.useState)("document"),[H,V]=(0,a.useState)({count:0,totalSize:0,totalChunks:0}),{message:X}=s.A.useApp(),G=(0,a.useCallback)(async e=>{try{let l=await (0,D.HT)({category:e,limit:1e4}),t=0,n=0;if(Array.isArray(l.files))for(let e of l.files)t+=e.fileSize||0,n+=e.chunkCount||0;V({count:l.total||0,totalSize:t,totalChunks:n})}catch(e){V({count:0,totalSize:0,totalChunks:0})}},[]);(0,a.useEffect)(()=>{G(U)},[U,G]);let K=async()=>{await J()?await Promise.all([R(),G(U)]):X.error(I("common.error"))};return(0,n.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:I("knowledge.manageTitle")}),(0,n.jsx)("p",{className:"pageDesc",children:I("knowledge.manageDesc")})]}),(0,n.jsxs)(c.A,{children:[(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(A.A,{}),onClick:()=>M.push("/knowledge/files"),children:I("knowledge.files")}),(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(f.A,{}),onClick:()=>M.push("/knowledge/search"),children:I("knowledge.search")}),(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(w.A,{}),loading:P,onClick:()=>{K()},children:I("knowledge.reindex")})]})]}),(0,n.jsx)(d.A,{gutter:[16,16],children:[{icon:(0,n.jsx)(k.A,{}),label:I("knowledge.totalFiles"),value:null!=(l=null==B?void 0:B.fileCount)?l:0},{icon:(0,n.jsx)(v.A,{}),label:I("knowledge.totalChunks"),value:null!=(t=null==B?void 0:B.chunkCount)?t:0},{icon:(0,n.jsx)(p.A,{}),label:I("knowledge.totalSize"),value:(0,N.z3)(null!=(E=null==B?void 0:B.totalSizeBytes)?E:0)},{icon:(0,n.jsx)(y.A,{}),label:I("knowledge.lastIndexed"),value:(null==B?void 0:B.lastIndexedAt)?(0,N.fw)(B.lastIndexedAt,T):I("common.never")}].map((e,l)=>(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(h.A,{size:"small",loading:F&&!B,children:(0,n.jsx)(x.A,{title:e.label,value:e.value,prefix:e.icon})})},l))}),(0,n.jsxs)(h.A,{title:I("knowledge.categories"),size:"small",children:[(0,n.jsx)(g.A,{value:U,onChange:e=>W(e),options:_.map(e=>({label:(0,N.Jm)(e,T),value:e})),style:{width:160,marginBottom:16}}),(0,n.jsxs)(d.A,{gutter:[16,16],children:[(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.fileCount"),value:H.count,prefix:(0,n.jsx)(k.A,{style:{color:"var(--colorAccent)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.totalSize"),value:(0,N.z3)(H.totalSize),prefix:(0,n.jsx)(p.A,{style:{color:"var(--colorWarning)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.chunksCount"),value:H.totalChunks,prefix:(0,n.jsx)(b.A,{style:{color:"var(--colorOk)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.averageSize"),value:H.count>0?(0,N.z3)(H.totalSize/H.count):"—",prefix:(0,n.jsx)(v.A,{style:{color:"var(--colorDanger)"}})})})]})]}),O&&(0,n.jsx)(h.A,{title:I("knowledge.features"),size:"small",children:(0,n.jsxs)(m.A,{size:"small",column:{xs:1,sm:2},bordered:!0,children:[(0,n.jsx)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(C.A,{style:{marginRight:4}}),I("knowledge.vectorStore")]}),children:(0,n.jsx)(j.A,{color:"blue",children:O.vectorStore})}),(0,n.jsx)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b.A,{style:{marginRight:4}}),I("knowledge.embedding")]}),children:(0,n.jsx)(j.A,{color:"purple",children:O.embeddingProvider})}),(0,n.jsxs)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(S.A,{style:{marginRight:4}}),I("knowledge.featureDedup")]}),children:[(0,n.jsx)(j.A,{color:"green",children:O.dedupEngine}),(0,n.jsx)("div",{className:"text-xs",style:{color:"var(--colorTextSecondary)",marginTop:2},children:I("knowledge.featureDedupDesc")})]}),(0,n.jsxs)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z.A,{style:{marginRight:4}}),I("knowledge.featureChunker")]}),children:[(0,n.jsx)(j.A,{color:"orange",children:O.chunker}),(0,n.jsx)("div",{className:"text-xs",style:{color:"var(--colorTextSecondary)",marginTop:2},children:I("knowledge.featureChunkerDesc")})]}),(null==(e=O.builtinExtractors)?void 0:e.length)>0&&(0,n.jsx)(m.A.Item,{label:I("knowledge.builtinExtractors"),span:2,children:(0,n.jsx)(c.A,{wrap:!0,children:O.builtinExtractors.map(e=>(0,n.jsx)(j.A,{color:"cyan",children:e},e))})})]})})]})}},54178:(e,l,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/manage",function(){return t(50423)}])}},e=>{e.O(0,[580,665,787,506,788,636,593,792],()=>e(e.s=54178)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[414],{45551:(e,l,t)=>{"use strict";function n(e){if(0===e)return"0 B";let l=Math.floor(Math.log(e)/Math.log(1024)),t=e/Math.pow(1024,l);return"".concat(t.toFixed(+(0!==l))," ").concat(["B","KB","MB","GB","TB"][l])}function a(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===l?"Never":"从未";let t=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(t/60),a=Math.floor(n/24);return a>30?new Date(e).toLocaleDateString(l):"en-US"===l?a>0?"".concat(a,"d ago"):n>0?"".concat(n,"h ago"):t>0?"".concat(t,"m ago"):"Just now":a>0?"".concat(a," 天前"):n>0?"".concat(n," 小时前"):t>0?"".concat(t," 分钟前"):"刚刚"}t.d(l,{Jm:()=>s,fw:()=>a,z3:()=>n});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},o={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var l;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(l=("en-US"===t?o:r)[e])?l:e}},50423:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>E});var n=t(65321),a=t(97109),r=t(34986),o=t(48321),s=t(17807),c=t(33442),i=t(85114),d=t(2256),u=t(38770),h=t(68787),x=t(54849),g=t(50883),m=t(76506),j=t(11702),A=t(7225),f=t(30486),w=t(99811),k=t(56768),v=t(26619),p=t(93314),y=t(58740),b=t(35459),C=t(23216),S=t(63663),z=t(49484),D=t(6578),N=t(45551);let _=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function E(){var e,l,t,E;let I=(0,o.Vr)(),{locale:T}=(0,o.x_)(),M=(0,r.useRouter)(),{stats:B,loading:F,reload:R}=function(){let[e,l]=(0,a.useState)(null),[t,n]=(0,a.useState)(!1),r=(0,a.useCallback)(async()=>{n(!0);try{l(await (0,D.hc)())}catch(e){}finally{n(!1)}},[]);return(0,a.useEffect)(()=>{r()},[r]),{stats:e,loading:t,reload:r}}(),O=function(){let[e,l]=(0,a.useState)(null);return(0,a.useEffect)(()=>{(0,D.VW)().then(l).catch(()=>{})},[]),e}(),{reindexing:P,reindex:J}=function(){let[e,l]=(0,a.useState)(!1);return{reindexing:e,reindex:(0,a.useCallback)(async()=>{l(!0);try{return await (0,D.H1)(),!0}catch(e){return!1}finally{l(!1)}},[])}}(),[U,W]=(0,a.useState)("document"),[H,V]=(0,a.useState)({count:0,totalSize:0,totalChunks:0}),{message:X}=s.A.useApp(),G=(0,a.useCallback)(async e=>{try{let l=await (0,D.HT)({category:e,limit:1e4}),t=0,n=0;if(Array.isArray(l.files))for(let e of l.files)t+=e.fileSize||0,n+=e.chunkCount||0;V({count:l.total||0,totalSize:t,totalChunks:n})}catch(e){V({count:0,totalSize:0,totalChunks:0})}},[]);(0,a.useEffect)(()=>{G(U)},[U,G]);let K=async()=>{await J()?await Promise.all([R(),G(U)]):X.error(I("common.error"))};return(0,n.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:I("knowledge.manageTitle")}),(0,n.jsx)("p",{className:"pageDesc",children:I("knowledge.manageDesc")})]}),(0,n.jsxs)(c.A,{children:[(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(A.A,{}),onClick:()=>M.push("/knowledge/files"),children:I("knowledge.files")}),(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(f.A,{}),onClick:()=>M.push("/knowledge/search"),children:I("knowledge.search")}),(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(w.A,{}),loading:P,onClick:()=>{K()},children:I("knowledge.reindex")})]})]}),(0,n.jsx)(d.A,{gutter:[16,16],children:[{icon:(0,n.jsx)(k.A,{}),label:I("knowledge.totalFiles"),value:null!=(l=null==B?void 0:B.fileCount)?l:0},{icon:(0,n.jsx)(v.A,{}),label:I("knowledge.totalChunks"),value:null!=(t=null==B?void 0:B.chunkCount)?t:0},{icon:(0,n.jsx)(p.A,{}),label:I("knowledge.totalSize"),value:(0,N.z3)(null!=(E=null==B?void 0:B.totalSizeBytes)?E:0)},{icon:(0,n.jsx)(y.A,{}),label:I("knowledge.lastIndexed"),value:(null==B?void 0:B.lastIndexedAt)?(0,N.fw)(B.lastIndexedAt,T):I("common.never")}].map((e,l)=>(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(h.A,{size:"small",loading:F&&!B,children:(0,n.jsx)(x.A,{title:e.label,value:e.value,prefix:e.icon})})},l))}),(0,n.jsxs)(h.A,{title:I("knowledge.categories"),size:"small",children:[(0,n.jsx)(g.A,{value:U,onChange:e=>W(e),options:_.map(e=>({label:(0,N.Jm)(e,T),value:e})),style:{width:160,marginBottom:16}}),(0,n.jsxs)(d.A,{gutter:[16,16],children:[(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.fileCount"),value:H.count,prefix:(0,n.jsx)(k.A,{style:{color:"var(--colorAccent)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.totalSize"),value:(0,N.z3)(H.totalSize),prefix:(0,n.jsx)(p.A,{style:{color:"var(--colorWarning)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.chunksCount"),value:H.totalChunks,prefix:(0,n.jsx)(b.A,{style:{color:"var(--colorOk)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.averageSize"),value:H.count>0?(0,N.z3)(H.totalSize/H.count):"—",prefix:(0,n.jsx)(v.A,{style:{color:"var(--colorDanger)"}})})})]})]}),O&&(0,n.jsx)(h.A,{title:I("knowledge.features"),size:"small",children:(0,n.jsxs)(m.A,{size:"small",column:{xs:1,sm:2},bordered:!0,children:[(0,n.jsx)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(C.A,{style:{marginRight:4}}),I("knowledge.vectorStore")]}),children:(0,n.jsx)(j.A,{color:"blue",children:O.vectorStore})}),(0,n.jsx)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b.A,{style:{marginRight:4}}),I("knowledge.embedding")]}),children:(0,n.jsx)(j.A,{color:"purple",children:O.embeddingProvider})}),(0,n.jsxs)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(S.A,{style:{marginRight:4}}),I("knowledge.featureDedup")]}),children:[(0,n.jsx)(j.A,{color:"green",children:O.dedupEngine}),(0,n.jsx)("div",{className:"text-xs",style:{color:"var(--colorTextSecondary)",marginTop:2},children:I("knowledge.featureDedupDesc")})]}),(0,n.jsxs)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z.A,{style:{marginRight:4}}),I("knowledge.featureChunker")]}),children:[(0,n.jsx)(j.A,{color:"orange",children:O.chunker}),(0,n.jsx)("div",{className:"text-xs",style:{color:"var(--colorTextSecondary)",marginTop:2},children:I("knowledge.featureChunkerDesc")})]}),(null==(e=O.builtinExtractors)?void 0:e.length)>0&&(0,n.jsx)(m.A.Item,{label:I("knowledge.builtinExtractors"),span:2,children:(0,n.jsx)(c.A,{wrap:!0,children:O.builtinExtractors.map(e=>(0,n.jsx)(j.A,{color:"cyan",children:e},e))})})]})})]})}},54178:(e,l,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/manage",function(){return t(50423)}])}},e=>{e.O(0,[717,883,665,787,506,788,636,593,792],()=>e(e.s=54178)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46],{77305:(e,a,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return r(82744)}])},82744:(e,a,r)=>{"use strict";r.r(a),r.d(a,{default:()=>z});var l=r(65321),s=r(97109),o=r(48321),t=r(35292),i=r(33442);let{Title:c,Text:n}=t.A;function d(e){let{title:a,description:r,extra:s,bottomContent:o}=e;return(0,l.jsxs)("div",{className:"mb-6 animateFadeIn",children:[(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(c,{level:4,style:{margin:0,fontWeight:700,letterSpacing:"-0.01em"},children:a}),r&&(0,l.jsx)(n,{type:"secondary",className:"mt-1 block text-sm",children:r})]}),s&&(0,l.jsx)(i.A,{className:"w-full sm:w-auto overflow-x-auto pb-1 sm:pb-0",size:"middle",wrap:!1,children:s})]}),o&&(0,l.jsx)("div",{className:"mt-4",children:o})]})}var m=r(17807),x=r(88762),p=r(85114),v=r(26171),b=r(11702),h=r(50883),u=r(7576),g=r(48318),y=r(34052),j=r(63455),f=r(56985),N=r(44534),A=r(54746),w=r(29071),k=r(59188),C=r(4216),T=r(13114),S=r(99650),K=r(58209),B=r(76981),P=r(61825),E=r(6578);let I=[{labelKey:"models.openAICompatible",value:"openai"},{labelKey:"models.anthropic",value:"anthropic"},{labelKey:"models.google",value:"google"},{labelKey:"models.ollama",value:"ollama"},{labelKey:"models.openRouter",value:"openrouter"}],H=[{key:"reader",labelKey:"models.tierReader",descKey:"models.tierReaderDesc"},{key:"reasoning",labelKey:"models.tierReasoning",descKey:"models.tierReasoningDesc"},{key:"action",labelKey:"models.tierAction",descKey:"models.tierActionDesc"}],U=[{key:"imageGeneration",labelKey:"models.imageGeneration"},{key:"imageUnderstanding",labelKey:"models.imageUnderstanding"},{key:"fileUnderstanding",labelKey:"models.fileUnderstanding"},{key:"audio",labelKey:"models.audioCapability"},{key:"video",labelKey:"models.videoCapability"}],_={enabled:!1,allowProjectFacts:!1,maxQueriesPerChapter:2,maxResultsPerQuery:3,trustedDomains:[]};function z(){let e=(0,o.Vr)(),{message:a}=m.A.useApp(),[r,t]=(0,s.useState)(!0),[c,n]=(0,s.useState)([]),[z,F]=(0,s.useState)(null),[R,D]=(0,s.useState)({provider:"transformers-local",model:"BAAI/bge-small-zh-v1.5",dimensions:512}),[M,O]=(0,s.useState)(_),[G,Q]=(0,s.useState)(!1),[q,L]=(0,s.useState)(!1),[X,Z]=(0,s.useState)(!1),[V,W]=(0,s.useState)(null),[J,Y]=(0,s.useState)(null),[$,ee]=(0,s.useState)({}),[ea,er]=(0,s.useState)(!1),[el,es]=(0,s.useState)(!1),[eo,et]=(0,s.useState)(""),[ei,ec]=(0,s.useState)(""),[en,ed]=(0,s.useState)(""),[em,ex]=(0,s.useState)(""),[ep,ev]=(0,s.useState)("openai"),[eb,eh]=(0,s.useState)(!1),[eu,eg]=(0,s.useState)({}),[ey,ej]=(0,s.useState)(!1),[ef,eN]=(0,s.useState)(!1),eA=async()=>{t(!0);try{let[e,a,r,l]=await Promise.all([(0,E.Z3)().catch(()=>[]),(0,E.zr)().catch(()=>null),(0,E.II)().catch(()=>({provider:"transformers-local",model:"BAAI/bge-small-zh-v1.5",dimensions:512})),(0,E.jQ)().catch(()=>_)]);n(e),F(a),D(r),O(l)}catch(r){a.error(e("common.error"))}finally{t(!1)}};(0,s.useEffect)(()=>{eA()},[]);let ew=async e=>{var a,r;es(!0),et(e.name),ec(e.name),ed(""),ex(e.baseUrl||""),ev(e.protocol||e.detectedProtocol||"openai"),eg(e.capabilities||{}),ej(!!(null==(a=e.capabilities)?void 0:a.webSearch));try{let a=await (0,E.Bh)(e.name);ed(a.apiKey?"••••••••":""),ex(a.baseUrl||""),eg(a.capabilities||{}),ej(!!(null==(r=a.capabilities)?void 0:r.webSearch))}catch(e){}er(!0)},ek=async()=>{if(ei.trim()){eN(!0);try{let r=el&&en.includes("•")?void 0:en||void 0,l={...eu,webSearch:ey};await (0,E._m)(ei.trim(),{oldName:el?eo:void 0,apiKey:r,baseUrl:em||void 0,protocol:ep,directEndpoint:eb,capabilities:l}),er(!1),await eA(),a.success(e("common.success"))}catch(r){a.error(e("common.error"))}finally{eN(!1)}}},eC=async r=>{try{await (0,E.h1)(r),await eA(),a.success(e("common.success"))}catch(r){a.error(e("common.error"))}},eT=async r=>{Y(r);try{let l=await (0,E.bZ)(r);ee(e=>({...e,[r]:l.success}));let s=l.success?e("models.connected"):"".concat(e("models.connectionFailed")).concat(l.message?":".concat(l.message):"").concat(l.requestId?" (".concat(l.requestId,")"):"");a[l.success?"success":"error"](s)}catch(l){ee(e=>({...e,[r]:!1})),a.error(l instanceof Error?l.message:e("models.connectionFailed"))}finally{Y(null)}},eS=async(r,l)=>{if(!z)return;let s={...z},o=s[r];if(!l){o.active="",F(s);try{await (0,E.aP)(s)}catch(r){a.error(e("common.error"))}return}let[t,i]=l.includes(":")?l.split(":"):[l,l];o.active=i,o.list.some(e=>e.name===i&&e.provider===t)||o.list.push({name:i,provider:t}),F(s);try{await (0,E.aP)(s)}catch(r){a.error(e("common.error"))}},eK=async()=>{L(!0);try{let r=await (0,E.dd)(R);D(r),W(null),a.success(e("common.success"))}catch(r){a.error(e("common.error"))}finally{L(!1)}},eB=async()=>{Z(!0);try{let r=await (0,E.u6)();W(r.success),a[r.success?"success":"error"](r.message||(r.success?e("models.connected"):e("models.connectionFailed")))}catch(e){W(!1)}finally{Z(!1)}};return r?(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)(x.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,l.jsx)("div",{className:"p-4 bg-[var(--colorBgHover)] rounded-xl border border-[var(--borderColor)]",children:(0,l.jsx)(x.A,{active:!0,paragraph:{rows:6}})}),(0,l.jsx)("div",{className:"p-4 bg-[var(--colorBgHover)] rounded-xl border border-[var(--borderColor)]",children:(0,l.jsx)(x.A,{active:!0,paragraph:{rows:4}})}),(0,l.jsx)("div",{className:"p-4 bg-[var(--colorBgHover)] rounded-xl border border-[var(--borderColor)]",children:(0,l.jsx)(x.A,{active:!0,paragraph:{rows:3}})})]}):(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)(d,{title:e("models.title"),description:e("models.description"),extra:(0,l.jsx)(p.Ay,{type:"primary",icon:(0,l.jsx)(A.A,{}),onClick:()=>{es(!1),et(""),ec(""),ed(""),ex(""),ev("openai"),eh(!1),eg({}),ej(!1),er(!0)},children:e("models.addModel")})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"flex items-center justify-between mb-6",children:(0,l.jsxs)("h2",{className:"text-base font-semibold text-[var(--colorText)] tracking-wide",children:[e("models.modelList")," ",(0,l.jsxs)("span",{className:"text-[var(--colorTextTertiary)] ml-2 font-normal",children:["(",c.length,")"]})]})}),0===c.length?(0,l.jsx)("div",{className:"text-center py-12 bg-[var(--colorBgHover)] rounded-2xl border border-dashed border-[var(--borderColorStrong)] text-[var(--colorTextTertiary)] text-sm",children:e("models.noProviders")}):(0,l.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:c.map(a=>{var r;return(0,l.jsxs)("div",{className:"group p-5 rounded-2xl border border-transparent hover:border-[var(--borderColorStrong)] bg-[var(--colorBgContainer)] hover:bg-[var(--colorBgHover)] hover:shadow-sm flex flex-col cursor-pointer transition-all duration-300",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-4 min-w-0",children:[(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("div",{className:"font-bold text-base text-[var(--colorText)] truncate mb-1",children:a.name}),(0,l.jsxs)("div",{className:"text-xs text-[var(--colorTextTertiary)] flex items-center gap-1 uppercase tracking-wider font-semibold",children:[(0,l.jsx)(w.A,{})," ",a.protocol||a.detectedProtocol||"openai"]})]}),(0,l.jsxs)(i.A,{size:0,className:"-mr-2 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,l.jsx)(p.Ay,{type:"text",size:"small",loading:J===a.name,onClick:e=>{e.stopPropagation(),eT(a.name)},icon:!0===$[a.name]?(0,l.jsx)(k.A,{className:"text-[var(--colorOk)]"}):!1===$[a.name]?(0,l.jsx)(C.A,{className:"text-[var(--colorDanger)]"}):(0,l.jsx)(T.A,{className:"text-[var(--colorTextSecondary)]"})}),(0,l.jsx)(p.Ay,{type:"text",size:"small",icon:(0,l.jsx)(S.A,{className:"text-[var(--colorTextSecondary)]"}),onClick:e=>{e.stopPropagation(),ew(a)}}),(0,l.jsx)(v.A,{title:e("models.deleteProviderConfirm"),onConfirm:e=>{null==e||e.stopPropagation(),eC(a.name)},onCancel:e=>null==e?void 0:e.stopPropagation(),children:(0,l.jsx)(p.Ay,{type:"text",size:"small",danger:!0,icon:(0,l.jsx)(K.A,{}),onClick:e=>e.stopPropagation()})})]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-3 mt-auto pt-4 border-t border-[var(--borderColor)]",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between text-xs text-[var(--colorTextSecondary)]",children:[(0,l.jsxs)("span",{className:"flex items-center gap-1",children:[(0,l.jsx)(B.A,{})," ",e("models.apiKey")]}),(0,l.jsx)("span",{className:"font-mono text-[var(--colorTextTertiary)]",children:a.hasApiKey?"••••••••":e("models.none")})]}),a.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center justify-between text-xs text-[var(--colorTextSecondary)]",children:[(0,l.jsxs)("span",{className:"flex items-center gap-1",children:[(0,l.jsx)(P.A,{})," URL"]}),(0,l.jsx)("span",{className:"truncate max-w-[120px] font-mono text-[var(--colorTextTertiary)]",title:a.baseUrl,children:a.baseUrl.replace(/^https?:\/\//,"")})]}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-1 mt-2",children:[U.filter(e=>{var r;return null==(r=a.capabilities)?void 0:r[e.key]}).map(a=>(0,l.jsx)(b.A,{color:"blue",bordered:!1,className:"m-0 text-[10px] bg-[var(--colorBrand)]/5 text-[var(--colorBrand)] leading-[18px]",children:e(a.labelKey)},a.key)),(null==(r=a.capabilities)?void 0:r.webSearch)&&(0,l.jsx)(b.A,{color:"green",bordered:!1,className:"m-0 text-[10px] leading-[18px]",children:e("models.webEnhancement")})]})]})]},a.name)})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-base font-semibold text-[var(--colorText)] tracking-wide mb-6",children:e("models.embeddingConfig")}),(0,l.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:e("models.embeddingProvider")}),(0,l.jsx)(h.A,{value:R.provider,className:"w-full h-10",variant:"borderless",style:{background:"var(--colorBgHover)",borderRadius:"8px"},options:[{label:e("models.localRecommended"),value:"transformers-local"},{label:e("models.externalAdvanced"),value:"openai-compatible"}],onChange:e=>D(a=>({...a,provider:e,model:"transformers-local"===e?a.model||"BAAI/bge-small-zh-v1.5":a.model,dimensions:"transformers-local"===e?512:a.dimensions||1024}))})]}),"openai-compatible"===R.provider&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:e("models.baseUrl")}),(0,l.jsx)(u.A,{className:"h-10 px-4 bg-[var(--colorBgHover)]",value:R.baseUrl,onChange:e=>D(a=>({...a,baseUrl:e.target.value})),placeholder:"http://localhost:11434/v1"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:e("models.model")}),(0,l.jsx)(u.A,{className:"h-10 px-4 bg-[var(--colorBgHover)]",value:R.model,onChange:e=>D(a=>({...a,model:e.target.value})),placeholder:"bge-m3"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:e("models.apiKey")}),(0,l.jsx)(u.A.Password,{className:"h-10 px-4 bg-[var(--colorBgHover)]",value:R.apiKey,onFocus:()=>{var e;(null==(e=R.apiKey)?void 0:e.includes("•"))&&D(e=>({...e,apiKey:""}))},onChange:e=>D(a=>({...a,apiKey:e.target.value})),placeholder:e("models.optional")})]})]}),"transformers-local"===R.provider&&(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:e("models.model")}),(0,l.jsx)(u.A,{className:"h-10 px-4 bg-[var(--colorBgHover)]",value:R.model,onChange:e=>D(a=>({...a,model:e.target.value})),placeholder:"BAAI/bge-small-zh-v1.5"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:e("models.dimensions")}),(0,l.jsx)(g.A,{className:"w-full h-10 px-2 bg-[var(--colorBgHover)] border-transparent flex items-center",min:1,value:R.dimensions,onChange:e=>D(a=>({...a,dimensions:Number(e||("transformers-local"===a.provider?512:1024))}))})]})]}),(0,l.jsxs)("div",{className:"mt-8 flex gap-3",children:[(0,l.jsx)(p.Ay,{type:"primary",className:"h-10 px-6 font-medium shadow-none",loading:q,onClick:()=>{eK()},children:e("models.saveEmbedding")}),(0,l.jsx)(p.Ay,{className:"h-10 px-6 font-medium shadow-none bg-[var(--colorBgHover)] border-transparent hover:border-[var(--borderColorStrong)]",loading:X,onClick:()=>{eB()},children:e("models.testEmbedding")}),(0,l.jsxs)("div",{className:"ml-auto flex items-center h-10 gap-2",children:[(0,l.jsx)(b.A,{color:"blue",bordered:!1,className:"m-0 bg-[var(--colorBgHover)] text-[var(--colorTextSecondary)]",children:"transformers-local"===R.provider?e("models.localEmbedding"):e("models.openAICompatible")}),!0===V&&(0,l.jsx)(b.A,{color:"success",bordered:!1,className:"m-0",icon:(0,l.jsx)(k.A,{}),children:e("models.connected")}),!1===V&&(0,l.jsx)(b.A,{color:"error",bordered:!1,className:"m-0",icon:(0,l.jsx)(C.A,{}),children:e("models.connectionFailed")})]})]})]}),z&&(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsx)("h2",{className:"text-base font-semibold text-[var(--colorText)] tracking-wide mb-6",children:e("models.modelTiers")}),(0,l.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:H.map(a=>{let{key:r,labelKey:s,descKey:o}=a,t=z[r],i=t.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),n=c.filter(e=>!t.list.some(a=>a.provider===e.name)).map(e=>({label:e.name,value:"".concat(e.name,":").concat(e.name)})),d=t.active?t.list.find(e=>e.name===t.active):null;return(0,l.jsxs)("div",{className:"p-6 bg-[var(--colorBgHover)] rounded-xl flex flex-col transition-colors border border-transparent hover:border-[var(--borderColorStrong)]",children:[(0,l.jsx)("div",{className:"text-sm font-semibold text-[var(--colorText)] uppercase tracking-wider mb-2",children:e(s)}),(0,l.jsx)("div",{className:"text-xs text-[var(--colorTextTertiary)] mb-5 leading-relaxed flex-1",children:e(o)}),(0,l.jsx)(h.A,{value:t.active?"".concat((null==d?void 0:d.provider)||"",":").concat(t.active):void 0,onChange:e=>{eS(r,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),className:"w-full h-10",variant:"borderless",style:{background:"var(--colorBgElevated)",borderRadius:"8px"},options:[...i,...n]}),d&&(()=>{let a=c.find(e=>e.name===d.provider);return(0,l.jsxs)("div",{className:"mt-4 px-4 py-3 bg-[var(--colorBgElevated)] rounded-lg border border-[var(--borderColor)] flex items-center gap-3 transition-colors",children:[(0,l.jsx)(T.A,{className:"text-[var(--colorBrand)] text-base shrink-0"}),(0,l.jsx)("span",{className:"text-sm font-medium flex-1 min-w-0 truncate text-[var(--colorText)]",children:d.provider}),(null==a?void 0:a.capabilities)&&U.filter(e=>a.capabilities[e.key]).length>0&&(0,l.jsx)("div",{className:"flex gap-1 shrink-0",children:U.filter(e=>a.capabilities[e.key]).slice(0,2).map(a=>(0,l.jsx)(b.A,{color:"blue",bordered:!1,className:"m-0 text-[10px] bg-[var(--colorBrand)]/5 text-[var(--colorBrand)] leading-[18px]",children:e(a.labelKey)},a.key))}),(0,l.jsx)(b.A,{color:"success",bordered:!1,className:"m-0 text-[10px] leading-[18px] shrink-0 uppercase",children:e("models.active")})]})})()]},r)})})]})}),(0,l.jsx)(y.A,{title:el?e("models.editModel"):e("models.addModel"),open:ea,onClose:()=>er(!1),size:"large",styles:{body:{padding:"24px 32px"},header:{padding:"16px 32px",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,l.jsx)(p.Ay,{type:"primary",loading:ef,onClick:()=>{ek()},children:e("common.save")}),children:(0,l.jsxs)(j.A,{layout:"vertical",children:[(0,l.jsx)(j.A.Item,{label:e("models.modelName"),children:(0,l.jsx)(u.A,{value:ei,onChange:e=>ec(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,l.jsx)(j.A.Item,{label:e("models.apiKey"),help:el?e("models.apiKeyEditHint"):void 0,children:(0,l.jsx)(u.A.Password,{value:en,onFocus:()=>{el&&en.includes("•")&&ed("")},onChange:e=>ed(e.target.value),placeholder:el?e("models.apiKeyEditPlaceholder"):"sk-..."})}),(0,l.jsx)(j.A.Item,{label:e("models.baseUrl"),children:(0,l.jsx)(u.A,{value:em,onChange:e=>ex(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,l.jsx)(j.A.Item,{label:e("models.protocol"),children:(0,l.jsx)(h.A,{value:ep,onChange:ev,options:I.map(a=>({label:e(a.labelKey),value:a.value}))})}),(0,l.jsx)(j.A.Item,{label:e("models.directEndpoint"),children:(0,l.jsx)(f.A,{checked:eb,onChange:e=>eh(e.target.checked),children:e("models.directEndpointDesc")})}),(0,l.jsxs)(j.A.Item,{label:e("models.webEnhancement"),children:[(0,l.jsx)(N.A,{checked:ey,onChange:ej}),(0,l.jsx)("span",{className:"ml-3 text-xs text-[var(--colorTextSecondary)]",children:e("models.webEnhancementDesc")})]}),(0,l.jsx)(j.A.Item,{label:e("models.capabilities"),children:(0,l.jsx)(f.A.Group,{value:U.filter(e=>eu[e.key]).map(e=>e.key),options:U.map(a=>({label:e(a.labelKey),value:a.key})),onChange:e=>eg(Object.fromEntries(U.map(a=>[a.key,e.includes(a.key)])))})})]})})]})}}},e=>{e.O(0,[580,576,195,455,649,636,593,792],()=>e(e.s=77305)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46],{77305:(e,a,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return r(82744)}])},82744:(e,a,r)=>{"use strict";r.r(a),r.d(a,{default:()=>z});var l=r(65321),s=r(97109),o=r(48321),t=r(35292),i=r(33442);let{Title:c,Text:n}=t.A;function d(e){let{title:a,description:r,extra:s,bottomContent:o}=e;return(0,l.jsxs)("div",{className:"mb-6 animateFadeIn",children:[(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(c,{level:4,style:{margin:0,fontWeight:700,letterSpacing:"-0.01em"},children:a}),r&&(0,l.jsx)(n,{type:"secondary",className:"mt-1 block text-sm",children:r})]}),s&&(0,l.jsx)(i.A,{className:"w-full sm:w-auto overflow-x-auto pb-1 sm:pb-0",size:"middle",wrap:!1,children:s})]}),o&&(0,l.jsx)("div",{className:"mt-4",children:o})]})}var m=r(17807),x=r(88762),p=r(85114),v=r(26171),b=r(11702),h=r(50883),u=r(7576),g=r(94992),y=r(34052),j=r(63455),f=r(56985),N=r(44534),A=r(54746),w=r(29071),k=r(59188),C=r(4216),T=r(13114),S=r(99650),K=r(58209),B=r(76981),P=r(61825),E=r(6578);let I=[{labelKey:"models.openAICompatible",value:"openai"},{labelKey:"models.anthropic",value:"anthropic"},{labelKey:"models.google",value:"google"},{labelKey:"models.ollama",value:"ollama"},{labelKey:"models.openRouter",value:"openrouter"}],H=[{key:"reader",labelKey:"models.tierReader",descKey:"models.tierReaderDesc"},{key:"reasoning",labelKey:"models.tierReasoning",descKey:"models.tierReasoningDesc"},{key:"action",labelKey:"models.tierAction",descKey:"models.tierActionDesc"}],U=[{key:"imageGeneration",labelKey:"models.imageGeneration"},{key:"imageUnderstanding",labelKey:"models.imageUnderstanding"},{key:"fileUnderstanding",labelKey:"models.fileUnderstanding"},{key:"audio",labelKey:"models.audioCapability"},{key:"video",labelKey:"models.videoCapability"}],_={enabled:!1,allowProjectFacts:!1,maxQueriesPerChapter:2,maxResultsPerQuery:3,trustedDomains:[]};function z(){let e=(0,o.Vr)(),{message:a}=m.A.useApp(),[r,t]=(0,s.useState)(!0),[c,n]=(0,s.useState)([]),[z,F]=(0,s.useState)(null),[R,D]=(0,s.useState)({provider:"transformers-local",model:"BAAI/bge-small-zh-v1.5",dimensions:512}),[M,O]=(0,s.useState)(_),[G,Q]=(0,s.useState)(!1),[q,L]=(0,s.useState)(!1),[X,Z]=(0,s.useState)(!1),[V,W]=(0,s.useState)(null),[J,Y]=(0,s.useState)(null),[$,ee]=(0,s.useState)({}),[ea,er]=(0,s.useState)(!1),[el,es]=(0,s.useState)(!1),[eo,et]=(0,s.useState)(""),[ei,ec]=(0,s.useState)(""),[en,ed]=(0,s.useState)(""),[em,ex]=(0,s.useState)(""),[ep,ev]=(0,s.useState)("openai"),[eb,eh]=(0,s.useState)(!1),[eu,eg]=(0,s.useState)({}),[ey,ej]=(0,s.useState)(!1),[ef,eN]=(0,s.useState)(!1),eA=async()=>{t(!0);try{let[e,a,r,l]=await Promise.all([(0,E.Z3)().catch(()=>[]),(0,E.zr)().catch(()=>null),(0,E.II)().catch(()=>({provider:"transformers-local",model:"BAAI/bge-small-zh-v1.5",dimensions:512})),(0,E.jQ)().catch(()=>_)]);n(e),F(a),D(r),O(l)}catch(r){a.error(e("common.error"))}finally{t(!1)}};(0,s.useEffect)(()=>{eA()},[]);let ew=async e=>{var a,r;es(!0),et(e.name),ec(e.name),ed(""),ex(e.baseUrl||""),ev(e.protocol||e.detectedProtocol||"openai"),eg(e.capabilities||{}),ej(!!(null==(a=e.capabilities)?void 0:a.webSearch));try{let a=await (0,E.Bh)(e.name);ed(a.apiKey?"••••••••":""),ex(a.baseUrl||""),eg(a.capabilities||{}),ej(!!(null==(r=a.capabilities)?void 0:r.webSearch))}catch(e){}er(!0)},ek=async()=>{if(ei.trim()){eN(!0);try{let r=el&&en.includes("•")?void 0:en||void 0,l={...eu,webSearch:ey};await (0,E._m)(ei.trim(),{oldName:el?eo:void 0,apiKey:r,baseUrl:em||void 0,protocol:ep,directEndpoint:eb,capabilities:l}),er(!1),await eA(),a.success(e("common.success"))}catch(r){a.error(e("common.error"))}finally{eN(!1)}}},eC=async r=>{try{await (0,E.h1)(r),await eA(),a.success(e("common.success"))}catch(r){a.error(e("common.error"))}},eT=async r=>{Y(r);try{let l=await (0,E.bZ)(r);ee(e=>({...e,[r]:l.success}));let s=l.success?e("models.connected"):"".concat(e("models.connectionFailed")).concat(l.message?":".concat(l.message):"").concat(l.requestId?" (".concat(l.requestId,")"):"");a[l.success?"success":"error"](s)}catch(l){ee(e=>({...e,[r]:!1})),a.error(l instanceof Error?l.message:e("models.connectionFailed"))}finally{Y(null)}},eS=async(r,l)=>{if(!z)return;let s={...z},o=s[r];if(!l){o.active="",F(s);try{await (0,E.aP)(s)}catch(r){a.error(e("common.error"))}return}let[t,i]=l.includes(":")?l.split(":"):[l,l];o.active=i,o.list.some(e=>e.name===i&&e.provider===t)||o.list.push({name:i,provider:t}),F(s);try{await (0,E.aP)(s)}catch(r){a.error(e("common.error"))}},eK=async()=>{L(!0);try{let r=await (0,E.dd)(R);D(r),W(null),a.success(e("common.success"))}catch(r){a.error(e("common.error"))}finally{L(!1)}},eB=async()=>{Z(!0);try{let r=await (0,E.u6)();W(r.success),a[r.success?"success":"error"](r.message||(r.success?e("models.connected"):e("models.connectionFailed")))}catch(e){W(!1)}finally{Z(!1)}};return r?(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)(x.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,l.jsx)("div",{className:"p-4 bg-[var(--colorBgHover)] rounded-xl border border-[var(--borderColor)]",children:(0,l.jsx)(x.A,{active:!0,paragraph:{rows:6}})}),(0,l.jsx)("div",{className:"p-4 bg-[var(--colorBgHover)] rounded-xl border border-[var(--borderColor)]",children:(0,l.jsx)(x.A,{active:!0,paragraph:{rows:4}})}),(0,l.jsx)("div",{className:"p-4 bg-[var(--colorBgHover)] rounded-xl border border-[var(--borderColor)]",children:(0,l.jsx)(x.A,{active:!0,paragraph:{rows:3}})})]}):(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)(d,{title:e("models.title"),description:e("models.description"),extra:(0,l.jsx)(p.Ay,{type:"primary",icon:(0,l.jsx)(A.A,{}),onClick:()=>{es(!1),et(""),ec(""),ed(""),ex(""),ev("openai"),eh(!1),eg({}),ej(!1),er(!0)},children:e("models.addModel")})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"flex items-center justify-between mb-6",children:(0,l.jsxs)("h2",{className:"text-base font-semibold text-[var(--colorText)] tracking-wide",children:[e("models.modelList")," ",(0,l.jsxs)("span",{className:"text-[var(--colorTextTertiary)] ml-2 font-normal",children:["(",c.length,")"]})]})}),0===c.length?(0,l.jsx)("div",{className:"text-center py-12 bg-[var(--colorBgHover)] rounded-2xl border border-dashed border-[var(--borderColorStrong)] text-[var(--colorTextTertiary)] text-sm",children:e("models.noProviders")}):(0,l.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:c.map(a=>{var r;return(0,l.jsxs)("div",{className:"group p-5 rounded-2xl border border-transparent hover:border-[var(--borderColorStrong)] bg-[var(--colorBgContainer)] hover:bg-[var(--colorBgHover)] hover:shadow-sm flex flex-col cursor-pointer transition-all duration-300",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-4 min-w-0",children:[(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("div",{className:"font-bold text-base text-[var(--colorText)] truncate mb-1",children:a.name}),(0,l.jsxs)("div",{className:"text-xs text-[var(--colorTextTertiary)] flex items-center gap-1 uppercase tracking-wider font-semibold",children:[(0,l.jsx)(w.A,{})," ",a.protocol||a.detectedProtocol||"openai"]})]}),(0,l.jsxs)(i.A,{size:0,className:"-mr-2 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,l.jsx)(p.Ay,{type:"text",size:"small",loading:J===a.name,onClick:e=>{e.stopPropagation(),eT(a.name)},icon:!0===$[a.name]?(0,l.jsx)(k.A,{className:"text-[var(--colorOk)]"}):!1===$[a.name]?(0,l.jsx)(C.A,{className:"text-[var(--colorDanger)]"}):(0,l.jsx)(T.A,{className:"text-[var(--colorTextSecondary)]"})}),(0,l.jsx)(p.Ay,{type:"text",size:"small",icon:(0,l.jsx)(S.A,{className:"text-[var(--colorTextSecondary)]"}),onClick:e=>{e.stopPropagation(),ew(a)}}),(0,l.jsx)(v.A,{title:e("models.deleteProviderConfirm"),onConfirm:e=>{null==e||e.stopPropagation(),eC(a.name)},onCancel:e=>null==e?void 0:e.stopPropagation(),children:(0,l.jsx)(p.Ay,{type:"text",size:"small",danger:!0,icon:(0,l.jsx)(K.A,{}),onClick:e=>e.stopPropagation()})})]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-3 mt-auto pt-4 border-t border-[var(--borderColor)]",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between text-xs text-[var(--colorTextSecondary)]",children:[(0,l.jsxs)("span",{className:"flex items-center gap-1",children:[(0,l.jsx)(B.A,{})," ",e("models.apiKey")]}),(0,l.jsx)("span",{className:"font-mono text-[var(--colorTextTertiary)]",children:a.hasApiKey?"••••••••":e("models.none")})]}),a.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center justify-between text-xs text-[var(--colorTextSecondary)]",children:[(0,l.jsxs)("span",{className:"flex items-center gap-1",children:[(0,l.jsx)(P.A,{})," URL"]}),(0,l.jsx)("span",{className:"truncate max-w-[120px] font-mono text-[var(--colorTextTertiary)]",title:a.baseUrl,children:a.baseUrl.replace(/^https?:\/\//,"")})]}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-1 mt-2",children:[U.filter(e=>{var r;return null==(r=a.capabilities)?void 0:r[e.key]}).map(a=>(0,l.jsx)(b.A,{color:"blue",bordered:!1,className:"m-0 text-[10px] bg-[var(--colorBrand)]/5 text-[var(--colorBrand)] leading-[18px]",children:e(a.labelKey)},a.key)),(null==(r=a.capabilities)?void 0:r.webSearch)&&(0,l.jsx)(b.A,{color:"green",bordered:!1,className:"m-0 text-[10px] leading-[18px]",children:e("models.webEnhancement")})]})]})]},a.name)})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-base font-semibold text-[var(--colorText)] tracking-wide mb-6",children:e("models.embeddingConfig")}),(0,l.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:e("models.embeddingProvider")}),(0,l.jsx)(h.A,{value:R.provider,className:"w-full h-10",variant:"borderless",style:{background:"var(--colorBgHover)",borderRadius:"8px"},options:[{label:e("models.localRecommended"),value:"transformers-local"},{label:e("models.externalAdvanced"),value:"openai-compatible"}],onChange:e=>D(a=>({...a,provider:e,model:"transformers-local"===e?a.model||"BAAI/bge-small-zh-v1.5":a.model,dimensions:"transformers-local"===e?512:a.dimensions||1024}))})]}),"openai-compatible"===R.provider&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:e("models.baseUrl")}),(0,l.jsx)(u.A,{className:"h-10 px-4 bg-[var(--colorBgHover)]",value:R.baseUrl,onChange:e=>D(a=>({...a,baseUrl:e.target.value})),placeholder:"http://localhost:11434/v1"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:e("models.model")}),(0,l.jsx)(u.A,{className:"h-10 px-4 bg-[var(--colorBgHover)]",value:R.model,onChange:e=>D(a=>({...a,model:e.target.value})),placeholder:"bge-m3"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:e("models.apiKey")}),(0,l.jsx)(u.A.Password,{className:"h-10 px-4 bg-[var(--colorBgHover)]",value:R.apiKey,onFocus:()=>{var e;(null==(e=R.apiKey)?void 0:e.includes("•"))&&D(e=>({...e,apiKey:""}))},onChange:e=>D(a=>({...a,apiKey:e.target.value})),placeholder:e("models.optional")})]})]}),"transformers-local"===R.provider&&(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:e("models.model")}),(0,l.jsx)(u.A,{className:"h-10 px-4 bg-[var(--colorBgHover)]",value:R.model,onChange:e=>D(a=>({...a,model:e.target.value})),placeholder:"BAAI/bge-small-zh-v1.5"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:e("models.dimensions")}),(0,l.jsx)(g.A,{className:"w-full h-10 px-2 bg-[var(--colorBgHover)] border-transparent flex items-center",min:1,value:R.dimensions,onChange:e=>D(a=>({...a,dimensions:Number(e||("transformers-local"===a.provider?512:1024))}))})]})]}),(0,l.jsxs)("div",{className:"mt-8 flex gap-3",children:[(0,l.jsx)(p.Ay,{type:"primary",className:"h-10 px-6 font-medium shadow-none",loading:q,onClick:()=>{eK()},children:e("models.saveEmbedding")}),(0,l.jsx)(p.Ay,{className:"h-10 px-6 font-medium shadow-none bg-[var(--colorBgHover)] border-transparent hover:border-[var(--borderColorStrong)]",loading:X,onClick:()=>{eB()},children:e("models.testEmbedding")}),(0,l.jsxs)("div",{className:"ml-auto flex items-center h-10 gap-2",children:[(0,l.jsx)(b.A,{color:"blue",bordered:!1,className:"m-0 bg-[var(--colorBgHover)] text-[var(--colorTextSecondary)]",children:"transformers-local"===R.provider?e("models.localEmbedding"):e("models.openAICompatible")}),!0===V&&(0,l.jsx)(b.A,{color:"success",bordered:!1,className:"m-0",icon:(0,l.jsx)(k.A,{}),children:e("models.connected")}),!1===V&&(0,l.jsx)(b.A,{color:"error",bordered:!1,className:"m-0",icon:(0,l.jsx)(C.A,{}),children:e("models.connectionFailed")})]})]})]}),z&&(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsx)("h2",{className:"text-base font-semibold text-[var(--colorText)] tracking-wide mb-6",children:e("models.modelTiers")}),(0,l.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:H.map(a=>{let{key:r,labelKey:s,descKey:o}=a,t=z[r],i=t.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),n=c.filter(e=>!t.list.some(a=>a.provider===e.name)).map(e=>({label:e.name,value:"".concat(e.name,":").concat(e.name)})),d=t.active?t.list.find(e=>e.name===t.active):null;return(0,l.jsxs)("div",{className:"p-6 bg-[var(--colorBgHover)] rounded-xl flex flex-col transition-colors border border-transparent hover:border-[var(--borderColorStrong)]",children:[(0,l.jsx)("div",{className:"text-sm font-semibold text-[var(--colorText)] uppercase tracking-wider mb-2",children:e(s)}),(0,l.jsx)("div",{className:"text-xs text-[var(--colorTextTertiary)] mb-5 leading-relaxed flex-1",children:e(o)}),(0,l.jsx)(h.A,{value:t.active?"".concat((null==d?void 0:d.provider)||"",":").concat(t.active):void 0,onChange:e=>{eS(r,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),className:"w-full h-10",variant:"borderless",style:{background:"var(--colorBgElevated)",borderRadius:"8px"},options:[...i,...n]}),d&&(()=>{let a=c.find(e=>e.name===d.provider);return(0,l.jsxs)("div",{className:"mt-4 px-4 py-3 bg-[var(--colorBgElevated)] rounded-lg border border-[var(--borderColor)] flex items-center gap-3 transition-colors",children:[(0,l.jsx)(T.A,{className:"text-[var(--colorBrand)] text-base shrink-0"}),(0,l.jsx)("span",{className:"text-sm font-medium flex-1 min-w-0 truncate text-[var(--colorText)]",children:d.provider}),(null==a?void 0:a.capabilities)&&U.filter(e=>a.capabilities[e.key]).length>0&&(0,l.jsx)("div",{className:"flex gap-1 shrink-0",children:U.filter(e=>a.capabilities[e.key]).slice(0,2).map(a=>(0,l.jsx)(b.A,{color:"blue",bordered:!1,className:"m-0 text-[10px] bg-[var(--colorBrand)]/5 text-[var(--colorBrand)] leading-[18px]",children:e(a.labelKey)},a.key))}),(0,l.jsx)(b.A,{color:"success",bordered:!1,className:"m-0 text-[10px] leading-[18px] shrink-0 uppercase",children:e("models.active")})]})})()]},r)})})]})}),(0,l.jsx)(y.A,{title:el?e("models.editModel"):e("models.addModel"),open:ea,onClose:()=>er(!1),size:"large",styles:{body:{padding:"24px 32px"},header:{padding:"16px 32px",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,l.jsx)(p.Ay,{type:"primary",loading:ef,onClick:()=>{ek()},children:e("common.save")}),children:(0,l.jsxs)(j.A,{layout:"vertical",children:[(0,l.jsx)(j.A.Item,{label:e("models.modelName"),children:(0,l.jsx)(u.A,{value:ei,onChange:e=>ec(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,l.jsx)(j.A.Item,{label:e("models.apiKey"),help:el?e("models.apiKeyEditHint"):void 0,children:(0,l.jsx)(u.A.Password,{value:en,onFocus:()=>{el&&en.includes("•")&&ed("")},onChange:e=>ed(e.target.value),placeholder:el?e("models.apiKeyEditPlaceholder"):"sk-..."})}),(0,l.jsx)(j.A.Item,{label:e("models.baseUrl"),children:(0,l.jsx)(u.A,{value:em,onChange:e=>ex(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,l.jsx)(j.A.Item,{label:e("models.protocol"),children:(0,l.jsx)(h.A,{value:ep,onChange:ev,options:I.map(a=>({label:e(a.labelKey),value:a.value}))})}),(0,l.jsx)(j.A.Item,{label:e("models.directEndpoint"),children:(0,l.jsx)(f.A,{checked:eb,onChange:e=>eh(e.target.checked),children:e("models.directEndpointDesc")})}),(0,l.jsxs)(j.A.Item,{label:e("models.webEnhancement"),children:[(0,l.jsx)(N.A,{checked:ey,onChange:ej}),(0,l.jsx)("span",{className:"ml-3 text-xs text-[var(--colorTextSecondary)]",children:e("models.webEnhancementDesc")})]}),(0,l.jsx)(j.A.Item,{label:e("models.capabilities"),children:(0,l.jsx)(f.A.Group,{value:U.filter(e=>eu[e.key]).map(e=>e.key),options:U.map(a=>({label:e(a.labelKey),value:a.key})),onChange:e=>eg(Object.fromEntries(U.map(a=>[a.key,e.includes(a.key)])))})})]})})]})}}},e=>{e.O(0,[717,883,44,195,455,827,636,593,792],()=>e(e.s=77305)),_N_E=e.O()}]);
@@ -1 +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:()=>q});var o=r(65321),l=r(97109),a=r(48321),s=r(17807),n=r(33442),i=r(11702),c=r(56985),d=r(85114),p=r(26171),m=r(88762),h=r(7576),x=r(50883),u=r(49292),g=r(84253),f=r(34052),v=r(42700),y=r(55122),j=r(54746),w=r(99650),b=r(81668),S=r(58209),A=r(26631),N=r(7225),C=r(96091),k=r(30486),T=r(46082),F=r(42758),z=r(24810),P=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 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 R(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 I(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 M("",!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 M(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 J(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 L(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 W(e){return e.id.startsWith("custom:")}function K(e){return W(e)?"custom":e.isCurrent?"current":"project"}function U(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 $(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 G(e){let t=Date.parse(e);return Number.isNaN(t)?"-":new Date(t).toLocaleString()}function X(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:K(e)}))}}function Y(e){let t=e.match(/(^|\s)@([^\s@]*)$/);return t?t[2]:null}function q(){let e=(0,a.Vr)(),{message:t}=s.A.useApp(),[r,q]=(0,l.useState)(!0),[Q,V]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(!1),[et,er]=(0,l.useState)(null),[eo,el]=(0,l.useState)(""),[ea,es]=(0,l.useState)(""),[en,ei]=(0,l.useState)(!1),[ec,ed]=(0,l.useState)(!1),[ep,em]=(0,l.useState)("custom"),[eh,ex]=(0,l.useState)("all"),[eu,eg]=(0,l.useState)("mtime"),[ef,ev]=(0,l.useState)("list"),[ey,ej]=(0,l.useState)(""),[ew,eb]=(0,l.useState)(null),[eS,eA]=(0,l.useState)([]),[eN,eC]=(0,l.useState)(!1),[ek,eT]=(0,l.useState)([]),[eF,ez]=(0,l.useState)(""),[eP,eB]=(0,l.useState)(""),[eE,eO]=(0,l.useState)(!1),[eR,eI]=(0,l.useState)([]),[eD,eH]=(0,l.useState)([]),[e_,eM]=(0,l.useState)([]),[eJ,eL]=(0,l.useState)(!1),[eW,eK]=(0,l.useState)(!1),[eU,e$]=(0,l.useState)(!1),eG=(0,l.useRef)(null),eX=(0,l.useRef)(null),eY=Y(eP),eq=async()=>{q(!0);try{V(await B())}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)&&ev(e)},[]),(0,l.useEffect)(()=>{window.localStorage.setItem("customize-agent:prompt-view-mode",ef)},[ef]),(0,l.useEffect)(()=>{let e=eX.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),eF&&window.localStorage.setItem(eF,JSON.stringify(ek.slice(-30)))},[ek,eE,eF]),(0,l.useEffect)(()=>{!Z||eR.length>0||eJ||(eL(!0),H().then(eI).catch(()=>void 0).finally(()=>eL(!1)))},[Z,eR.length,eJ]),(0,l.useEffect)(()=>{let e=null==eY?void 0:eY.trim();if(!Z||!e){eH([]),eK(!1);return}let t=!1;eK(!0);let r=window.setTimeout(()=>{M(e).then(e=>{t||eH(e)}).catch(()=>{t||eH([])}).finally(()=>{t||eK(!1)})},250);return()=>{t=!0,window.clearTimeout(r)}},[Z,eY]);let eQ=Q.find(e=>e.isCurrent),eV=Q.filter(W),eZ={all:Q.length,custom:Q.filter(e=>"custom"===K(e)).length,current:Q.filter(e=>"current"===K(e)).length,project:Q.filter(e=>"project"===K(e)).length,selected:Q.filter(e=>e.selected).length,unselected:Q.filter(e=>!e.selected).length,hasFile:Q.filter(e=>e.hasFile).length,missingFile:Q.filter(e=>!e.hasFile).length},e0=Q.filter(e=>{var t;let r=K(e);return("all"===ep||r===ep)&&("selected"!==eh||!!e.selected)&&("unselected"!==eh||!e.selected)&&("hasFile"!==eh||!!e.hasFile)&&("missingFile"!==eh||!e.hasFile)&&(!ey.trim()||(t=ey.trim(),!!"".concat(e.projectName,"\n").concat(e.projectRoot||"","\n").concat(e.customizePath||"","\n").concat(e.content||"").toLowerCase().includes(t.toLowerCase())))}).sort((e,t)=>"name"===eu?e.projectName.localeCompare(t.projectName):"source"===eu?["custom","current","project"].indexOf(K(e))-["custom","current","project"].indexOf(K(t)):"selected"===eu&&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=eS.filter(e=>e0.some(t=>t.id===e)),e4=(null==eY?void 0:eY.trim())?eD:eR,e3=(e,t,r)=>{let o=U(e,t,r);ez(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)),eB(""),eO(!1),eM([]),e$(!1)},e8=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),es(""),el(""),e3(null,"new",o),ee(!0)},e5=async()=>{if(!ea.trim())return void t.error("请输入名称");ei(!0);try{if(et)await E(et.customizePath,eo,W(et)?ea.trim():void 0),t.success(e("common.success"));else{let r=await R(ea.trim(),eo||"# ".concat(ea.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,U({id:r.id,projectId:r.id,projectName:ea.trim(),customizePath:r.id,content:eo,mtime:"",hasFile:!0,isCurrent:!1,selected:!1,source:"custom"},ea.trim())),t.success(e("common.success"))}ee(!1),await eq()}catch(r){t.error(e("common.error"))}finally{ei(!1)}},e6=async e=>{let t=Array.from(new Set([...e_,...eR.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},e7=async()=>{let e=eP.trim();if(!e||eE)return;let r=[...ek,{role:"user",content:e}];eT(r),eB(""),e$(!1),eO(!0);try{let t=await e6(e),o=await J({name:ea||(null==et?void 0:et.projectName)||"未命名提示词",content:eo,message:e,history:ek,references:t});eT([...r,{role:"assistant",content:o.content||"AI 未返回内容"}])}catch(e){t.error(e instanceof Error?e.message:"AI 对话失败,请检查模型配置"),eT(r)}finally{eO(!1)}},e9=async(r,o)=>{let l=o?Array.from(new Set([...Q.filter(e=>e.selected).map(e=>e.id),r.id])):Q.filter(e=>e.selected&&e.id!==r.id).map(e=>e.id);try{await I(l),V(e=>e.map(e=>({...e,selected:l.includes(e.id)})))}catch(r){t.error(e("common.error"))}},te=async r=>{let o=Q.filter(e=>e.selected).map(e=>e.id),l=r?Array.from(new Set([...o,...e2])):o.filter(e=>!e2.includes(e));try{await I(l),V(e=>e.map(e=>({...e,selected:l.includes(e.id)}))),eA([]),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")),eA(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?Q.filter(e=>e2.includes(e.id)):"filtered"===e?e0:eV;L("customize-prompts-".concat(new Date().toISOString().slice(0,10),".json"),X(r)),t.success("已导出 ".concat(r.length," 条提示词"))},to=async e=>{if(e){eC(!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{eC(!1),eG.current&&(eG.current.value="")}}},tl=t=>{let r=K(t);return(0,o.jsxs)(n.A,{size:4,wrap:!0,children:[(0,o.jsx)(i.A,{color:"custom"===r?"cyan":"current"===r?"green":"project"===r?"blue":"default",style:{margin:0},children:e("custom"===r?"prompt.customPrompt":"current"===r?"prompt.currentProject":"project"===r?"prompt.otherProjects":"prompt.allPrompts")}),t.selected&&(0,o.jsx)(i.A,{color:"purple",style:{margin:0},children:e("prompt.selected")}),!t.hasFile&&(0,o.jsx)(i.A,{style:{margin:0},children:e("prompt.missingFileStatus")})]})},ta=r=>(0,o.jsxs)("div",{className:"flex items-center gap-1.5",children:[r.hasFile&&(0,o.jsx)(c.A,{checked:r.selected,onChange:e=>{e9(r,e.target.checked)},className:"mr-1",children:e("prompt.selected")}),!r.hasFile&&r.projectRoot&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(j.A,{}),onClick:()=>e8(r),children:e("common.add")}),r.hasFile&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(w.A,{}),onClick:()=>{er(r),ed(!1),es(r.projectName),el(r.content||""),e3(r,r.projectName),ee(!0)},children:e("common.edit")}),r.hasFile&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(b.A,{}),onClick:()=>{var e;return e=r,void(L("customize-prompt-".concat(e.projectName.trim().replace(/[\\/:*?"<>|]/g,"-").slice(0,80)||"untitled","-").concat(new Date().toISOString().slice(0,10),".json"),X([e])),t.success("已导出 1 条提示词"))},children:"导出"}),(0,o.jsx)(p.A,{title:W(r)?"删除自定义提示词?":"删除项目记录及文件?",onConfirm:()=>{tt(r)},children:(0,o.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,o.jsx)(S.A,{})})})]});return r?(0,o.jsxs)("div",{className:"space-y-12",children:[(0,o.jsx)(m.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,o.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:Array.from({length:4}).map((e,t)=>(0,o.jsx)("div",{className:"p-4 border border-[var(--borderColor)]",children:(0,o.jsx)(m.A,{active:!0,paragraph:{rows:4}})},t))})]}):(0,o.jsxs)("div",{className:"space-y-8 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4 pb-6 mb-2",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("h1",{className:"text-3xl font-extrabold tracking-tight text-[var(--colorText)] mb-2.5 flex items-center gap-2",children:[(0,o.jsx)(A.A,{className:"text-[var(--colorAccent)]"}),e("nav.promptManagement")]}),(0,o.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)]",children:e("prompt.description")})]}),(0,o.jsxs)(n.A,{wrap:!0,children:[eQ&&(0,o.jsxs)(i.A,{color:"green",style:{lineHeight:"22px"},className:"border-0",children:[(0,o.jsx)(N.A,{})," ",eQ.projectRoot]}),(0,o.jsx)("input",{ref:eG,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)(C.A,{}),loading:eN,onClick:()=>{var e;return null==(e=eG.current)?void 0:e.click()},className:"rounded-lg",children:e("prompt.import")}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(b.A,{}),disabled:0===e0.length,onClick:()=>tr("filtered"),className:"rounded-lg",children:e("prompt.exportFiltered")}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(j.A,{}),onClick:()=>e8(),className:"shadow-none rounded-lg",children:e("prompt.createPrompt")})]})]}),(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-3 bg-[var(--colorBgContainer)] p-3 rounded-xl shadow-sm mb-6",children:[(0,o.jsx)(h.A,{prefix:(0,o.jsx)(k.A,{className:"text-[var(--colorTextTertiary)]"}),allowClear:!0,placeholder:e("prompt.searchPrompt"),value:ey,onChange:e=>ej(e.target.value),style:{width:280},variant:"borderless",className:"bg-[var(--colorBgHover)] rounded-lg hover:bg-[var(--colorFillAlter)] focus:bg-[var(--colorBgElevated)] transition-colors"}),(0,o.jsx)("div",{className:"h-4 w-[1px] bg-[var(--borderColorStrong)] mx-1"}),(0,o.jsx)(x.A,{value:ep,onChange:em,style:{width:150},variant:"borderless",options:[{label:"".concat(e("prompt.allPrompts")," (").concat(eZ.all,")"),value:"all"},{label:"".concat(e("prompt.customPrompt")," (").concat(eZ.custom,")"),value:"custom"},{label:"".concat(e("prompt.currentProject")," (").concat(eZ.current,")"),value:"current"},{label:"".concat(e("prompt.otherProjects")," (").concat(eZ.project,")"),value:"project"}]}),(0,o.jsx)(x.A,{value:eh,onChange:ex,style:{width:130},variant:"borderless",options:[{label:e("prompt.promptStatus"),value:"all"},{label:"".concat(e("prompt.selected")," (").concat(eZ.selected,")"),value:"selected"},{label:"".concat(e("prompt.unselected")," (").concat(eZ.unselected,")"),value:"unselected"},{label:"".concat(e("prompt.hasFileStatus")," (").concat(eZ.hasFile,")"),value:"hasFile"},{label:"".concat(e("prompt.missingFileStatus")," (").concat(eZ.missingFile,")"),value:"missingFile"}]}),(0,o.jsx)(x.A,{value:eu,onChange:eg,style:{width:140},variant:"borderless",options:[{label:e("prompt.sortByMtime"),value:"mtime"},{label:e("prompt.sortByName"),value:"name"},{label:e("prompt.sortBySource"),value:"source"},{label:e("prompt.sortBySelected"),value:"selected"}]}),(0,o.jsx)("div",{className:"flex-1"}),(0,o.jsx)(u.A,{value:ef,onChange:e=>ev(e),options:[{label:(0,o.jsx)(T.A,{}),value:"list"},{label:(0,o.jsx)(F.A,{}),value:"card"}],className:"bg-[var(--colorBgHover)] p-1 rounded-lg"})]}),(0,o.jsx)("div",{className:"grid grid-cols-1 gap-8 items-start",children:(0,o.jsxs)("div",{className:"min-w-0",children:[e2.length>0&&(0,o.jsxs)("div",{className:"flex items-center gap-3 flex-wrap p-4 mb-6 bg-[var(--colorBgHover)] rounded-xl shadow-sm",children:[(0,o.jsxs)("span",{className:"font-semibold text-sm",children:["已选择 ",(0,o.jsx)("span",{className:"text-[var(--colorAccent)]",children:e2.length})," 项"]}),(0,o.jsx)("div",{className:"h-4 w-[1px] bg-[var(--borderColorStrong)] mx-1"}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>{te(!0)},children:e("prompt.batchSelect")}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>{te(!1)},children:e("prompt.cancelSelect")}),(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(b.A,{}),onClick:()=>tr("checked"),children:e("prompt.exportSelected")}),(0,o.jsx)(d.Ay,{size:"small",danger:!0,onClick:()=>eA([]),children:e("prompt.clearSelect")})]}),0===e0.length?(0,o.jsx)("div",{className:"py-32 text-center border border-dashed border-[var(--borderColor)] rounded-2xl bg-[var(--colorBgHover)]",children:(0,o.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:(0,o.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:ey||"all"!==eh?e("prompt.noMatchDesc"):e("prompt.noPromptInGroup")})})}):"list"===ef?(0,o.jsx)("div",{className:"flex flex-col gap-3",children:e0.map(e=>{let t=$(e,180),r=(null==e1?void 0:e1.id)===e.id;return(0,o.jsxs)("div",{onClick:()=>eb(e.id),className:"group grid grid-cols-[28px_1fr_auto] gap-4 items-center p-4 rounded-xl transition-all cursor-pointer ".concat(r?"bg-[var(--colorBgSelected)] shadow-md":"bg-transparent hover:bg-[var(--colorBgHover)] hover:shadow-sm"),children:[(0,o.jsx)(c.A,{checked:eS.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eA(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,o.jsxs)("div",{className:"min-w-0",children:[(0,o.jsxs)("div",{className:"flex items-center gap-3 mb-1.5",children:[(0,o.jsx)(A.A,{className:e.isCurrent?"text-[var(--colorOk)] text-lg":"text-[var(--colorTextSecondary)] text-lg"}),(0,o.jsx)("span",{className:"font-semibold truncate text-[var(--colorText)] text-base",children:e.projectName}),tl(e)]}),(0,o.jsxs)("div",{className:"text-xs text-[var(--colorTextTertiary)] truncate flex items-center gap-1.5 font-medium",children:[(0,o.jsx)(N.A,{})," ",e.projectRoot||e.customizePath||"本地提示词",(0,o.jsx)("span",{className:"text-[var(--colorBorderSecondary)]",children:"|"}),G(e.mtime)]}),t&&(0,o.jsx)("div",{className:"mt-2.5 bg-[var(--colorFillAlter)] p-2.5 rounded-lg overflow-hidden",children:(0,o.jsx)("div",{className:"text-sm text-[var(--colorTextSecondary)] line-clamp-2 leading-normal",children:t})})]}),(0,o.jsx)("div",{onClick:e=>e.stopPropagation(),className:"transition-opacity flex items-center ".concat(r?"opacity-100":"opacity-0 group-hover:opacity-100"),children:ta(e)})]},e.id)})}):(0,o.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:e0.map(e=>{let t=$(e,180),r=(null==e1?void 0:e1.id)===e.id;return(0,o.jsxs)("div",{onClick:()=>eb(e.id),className:"group flex flex-col p-5 rounded-2xl transition-all cursor-pointer ".concat(r?"bg-[var(--colorBgSelected)] shadow-md":"bg-[var(--colorBgContainer)] hover:bg-[var(--colorBgHover)] shadow-sm hover:shadow-md"),children:[(0,o.jsx)("div",{className:"flex items-start justify-between gap-3 mb-4 min-w-0",children:(0,o.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[(0,o.jsx)(c.A,{checked:eS.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eA(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,o.jsx)(A.A,{className:e.isCurrent?"text-[var(--colorOk)] text-lg":"text-[var(--colorTextSecondary)] text-lg"}),(0,o.jsx)("span",{className:"font-bold text-base text-[var(--colorText)] truncate mb-1",children:e.projectName})]})}),(0,o.jsx)("div",{className:"mb-3",children:tl(e)}),(0,o.jsxs)("div",{className:"text-xs text-[var(--colorTextTertiary)] truncate flex items-center gap-1.5 mb-4 bg-[var(--colorFillAlter)] p-1.5 rounded inline-flex self-start",children:[(0,o.jsx)(N.A,{}),e.projectRoot||e.customizePath||"本地提示词"]}),(0,o.jsx)("div",{className:"flex-1 bg-[var(--colorFillAlter)] p-3 rounded-xl mb-4 overflow-hidden",children:t?(0,o.jsx)("div",{className:"text-sm text-[var(--colorTextSecondary)] line-clamp-3 leading-normal",children:t}):(0,o.jsx)("div",{className:"text-sm text-[var(--colorTextQuaternary)] italic",children:"暂无内容预览"})}),(0,o.jsxs)("div",{className:"mt-auto pt-4 flex justify-between items-center",onClick:e=>e.stopPropagation(),children:[(0,o.jsx)("span",{className:"text-xs font-medium text-[var(--colorTextTertiary)] bg-[var(--colorFillSecondary)] px-2 py-1 rounded",children:G(e.mtime)}),(0,o.jsx)("div",{className:"transition-opacity ".concat(r?"opacity-100":"opacity-0 group-hover:opacity-100"),children:ta(e)})]})]},e.id)})})]})}),(0,o.jsxs)(f.A,{title:ec?e("prompt.createPrompt"):et&&W(et)?"".concat(e("prompt.customPrompt")," — ").concat(ea||et.projectName):"".concat(e("prompt.currentProject")," — ").concat((null==et?void 0:et.projectName)||""),open:Z,onClose:()=>ee(!1),styles:{wrapper:{width:1080},mask:{pointerEvents:"none"},body:{padding:"24px 32px",display:"grid",gridTemplateRows:"minmax(320px, 1fr) 420px",gap:24,height:"100%"},header:{borderBottom:"1px solid var(--colorBorderSecondary)",padding:"16px 32px"}},extra:(0,o.jsxs)(n.A,{children:[(0,o.jsx)(d.Ay,{onClick:()=>ee(!1),children:e("common.cancel")}),(0,o.jsx)(d.Ay,{type:"primary",loading:en,onClick:()=>{e5()},children:e("common.save")})]}),children:[(0,o.jsxs)("div",{style:{minHeight:0,display:"flex",flexDirection:"column"},children:[(0,o.jsx)("div",{style:{marginBottom:16},children:ec||et&&W(et)?(0,o.jsx)(h.A,{size:"large",placeholder:e("prompt.promptName"),value:ea,onChange:e=>es(e.target.value),style:{maxWidth:"100%",fontWeight:500,fontSize:16}}):null}),(0,o.jsx)(h.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)(n.A,{size:6,children:[(0,o.jsx)(z.A,{style:{color:"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:600},children:e("prompt.aiPromptAssistant")})]}),(0,o.jsxs)(n.A,{size:6,children:[ek.length>0&&(0,o.jsx)(d.Ay,{size:"small",onClick:()=>eT([]),children:e("prompt.clearHistory")}),eE?(0,o.jsx)(i.A,{color:"processing",style:{margin:0},children:e("prompt.generating")}):(0,o.jsx)(i.A,{color:"blue",style:{margin:0},children:e("prompt.canConverse")})]})]}),(0,o.jsx)("div",{ref:eX,style:{flex:1,minHeight:0,overflowY:"auto",padding:14,background:"var(--colorFillAlter)"},children:0!==ek.length||eE?(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12,width:"100%"},children:[ek.map((r,l)=>{let a="user"===r.role;return(0,o.jsx)("div",{style:{display:"flex",justifyContent:a?"flex-end":"flex-start"},children:(0,o.jsxs)("div",{style:{maxWidth:"78%",padding:"10px 12px",borderRadius:12,background:a?"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:[r.content,!a&&(0,o.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:8},children:(0,o.jsx)(d.Ay,{size:"small",type:"primary",onClick:()=>{el(r.content),t.success("已应用到编辑内容,请确认后保存")},children:e("prompt.apply")})})]})},"".concat(r.role,"-").concat(l))}),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}}),e("prompt.aiAnalyzing")]})})]}):(0,o.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:e("prompt.mentionRecallHint")})}),(0,o.jsx)(y.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)(i.A,{closable:!0,onClose:()=>eM(t=>t.filter(t=>t!==e)),style:{margin:0,maxWidth:360,overflow:"hidden",textOverflow:"ellipsis"},children:["@",e]},e))}),eU&&(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:e("prompt.recallKbFiles")}),(0,o.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11},children:e("prompt.recallLimitHint")})]}),(0,o.jsx)(i.A,{color:eY?"blue":"default",style:{margin:0,maxWidth:240,overflow:"hidden",textOverflow:"ellipsis"},children:eY?"@".concat(eY):e("prompt.inputAtKeyword")})]}),eJ?(0,o.jsxs)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),e("prompt.loadingKbFiles")]}):0===eR.length?(0,o.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:e("prompt.noRecallableKbFiles")}):0===e4.length?(0,o.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:eW?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),e("prompt.searchingKbContent")]}):e("prompt.noMatchingKbFiles")}):(0,o.jsxs)(o.Fragment,{children:[eW&&(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}}),e("prompt.continueSearchingKb")]}),e4.slice(0,30).map(t=>(0,o.jsxs)("div",{onMouseDown:e=>{var r;e.preventDefault(),r=t.relativePath,eM(e=>e.includes(r)?e:[...e,r]),eB(e=>e.replace(/(^|\s)@([^\s@]*)$/,"$1@".concat(r," "))),e$(!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)(A.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:t.relativePath}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[t.category||e("prompt.unclassified")," \xb7 ",t.format||e("prompt.unknownFormat"),"number"==typeof t.score?" \xb7 score ".concat(t.score.toFixed(2)):""]})]}),(0,o.jsxs)(n.A,{size:4,children:[(0,o.jsx)(i.A,{color:"content"===t.matchedBy?"purple":"disk"===t.matchedBy?"orange":"blue",style:{margin:0},children:"content"===t.matchedBy?e("prompt.contentMatch"):"disk"===t.matchedBy?e("prompt.diskFile"):e("prompt.fileMatch")}),(0,o.jsx)(i.A,{style:{margin:0},children:t.status})]})]},t.relativePath))]})]}),(0,o.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-end"},children:[(0,o.jsx)(h.A.TextArea,{value:eP,onChange:e=>{let t=e.target.value;eB(t),e$(null!==Y(t))},onFocus:()=>e$(null!==Y(eP)),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),e7())},disabled:eE,placeholder:e("prompt.mentionRecallPlaceholder"),autoSize:{minRows:2,maxRows:5},style:{fontSize:13,lineHeight:1.6}}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(P.A,{}),loading:eE,disabled:!eP.trim(),onClick:()=>{e7()},children:e("prompt.send")})]})]})]})]})]})}}},e=>{e.O(0,[580,576,209,195,187,636,593,792],()=>e(e.s=27549)),_N_E=e.O()}]);
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),a=r(48321),s=r(17807),n=r(33442),i=r(11702),c=r(56985),d=r(85114),p=r(26171),m=r(88762),h=r(7576),x=r(50883),u=r(49292),g=r(84253),f=r(34052),v=r(42700),y=r(55122),j=r(54746),w=r(99650),b=r(81668),S=r(58209),A=r(26631),N=r(7225),C=r(96091),k=r(30486),T=r(46082),F=r(42758),z=r(24810),P=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 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 R(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 I(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 M("",!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 M(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 J(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 L(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 W(e){return e.id.startsWith("custom:")}function K(e){return W(e)?"custom":e.isCurrent?"current":"project"}function U(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 $(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 G(e){let t=Date.parse(e);return Number.isNaN(t)?"-":new Date(t).toLocaleString()}function X(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:K(e)}))}}function Y(e){let t=e.match(/(^|\s)@([^\s@]*)$/);return t?t[2]:null}function q(){let e=(0,a.Vr)(),{message:t}=s.A.useApp(),[r,q]=(0,l.useState)(!0),[Q,V]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(!1),[et,er]=(0,l.useState)(null),[eo,el]=(0,l.useState)(""),[ea,es]=(0,l.useState)(""),[en,ei]=(0,l.useState)(!1),[ec,ed]=(0,l.useState)(!1),[ep,em]=(0,l.useState)("custom"),[eh,ex]=(0,l.useState)("all"),[eu,eg]=(0,l.useState)("mtime"),[ef,ev]=(0,l.useState)("list"),[ey,ej]=(0,l.useState)(""),[ew,eb]=(0,l.useState)(null),[eS,eA]=(0,l.useState)([]),[eN,eC]=(0,l.useState)(!1),[ek,eT]=(0,l.useState)([]),[eF,ez]=(0,l.useState)(""),[eP,eB]=(0,l.useState)(""),[eE,eO]=(0,l.useState)(!1),[eR,eI]=(0,l.useState)([]),[eD,eH]=(0,l.useState)([]),[e_,eM]=(0,l.useState)([]),[eJ,eL]=(0,l.useState)(!1),[eW,eK]=(0,l.useState)(!1),[eU,e$]=(0,l.useState)(!1),eG=(0,l.useRef)(null),eX=(0,l.useRef)(null),eY=Y(eP),eq=async()=>{q(!0);try{V(await B())}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)&&ev(e)},[]),(0,l.useEffect)(()=>{window.localStorage.setItem("customize-agent:prompt-view-mode",ef)},[ef]),(0,l.useEffect)(()=>{let e=eX.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),eF&&window.localStorage.setItem(eF,JSON.stringify(ek.slice(-30)))},[ek,eE,eF]),(0,l.useEffect)(()=>{!Z||eR.length>0||eJ||(eL(!0),H().then(eI).catch(()=>void 0).finally(()=>eL(!1)))},[Z,eR.length,eJ]),(0,l.useEffect)(()=>{let e=null==eY?void 0:eY.trim();if(!Z||!e){eH([]),eK(!1);return}let t=!1;eK(!0);let r=window.setTimeout(()=>{M(e).then(e=>{t||eH(e)}).catch(()=>{t||eH([])}).finally(()=>{t||eK(!1)})},250);return()=>{t=!0,window.clearTimeout(r)}},[Z,eY]);let eQ=Q.find(e=>e.isCurrent),eV=Q.filter(W),eZ={all:Q.length,custom:Q.filter(e=>"custom"===K(e)).length,current:Q.filter(e=>"current"===K(e)).length,project:Q.filter(e=>"project"===K(e)).length,selected:Q.filter(e=>e.selected).length,unselected:Q.filter(e=>!e.selected).length,hasFile:Q.filter(e=>e.hasFile).length,missingFile:Q.filter(e=>!e.hasFile).length},e0=Q.filter(e=>{var t;let r=K(e);return("all"===ep||r===ep)&&("selected"!==eh||!!e.selected)&&("unselected"!==eh||!e.selected)&&("hasFile"!==eh||!!e.hasFile)&&("missingFile"!==eh||!e.hasFile)&&(!ey.trim()||(t=ey.trim(),!!"".concat(e.projectName,"\n").concat(e.projectRoot||"","\n").concat(e.customizePath||"","\n").concat(e.content||"").toLowerCase().includes(t.toLowerCase())))}).sort((e,t)=>"name"===eu?e.projectName.localeCompare(t.projectName):"source"===eu?["custom","current","project"].indexOf(K(e))-["custom","current","project"].indexOf(K(t)):"selected"===eu&&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=eS.filter(e=>e0.some(t=>t.id===e)),e4=(null==eY?void 0:eY.trim())?eD:eR,e3=(e,t,r)=>{let o=U(e,t,r);ez(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)),eB(""),eO(!1),eM([]),e$(!1)},e8=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),es(""),el(""),e3(null,"new",o),ee(!0)},e5=async()=>{if(!ea.trim())return void t.error("请输入名称");ei(!0);try{if(et)await E(et.customizePath,eo,W(et)?ea.trim():void 0),t.success(e("common.success"));else{let r=await R(ea.trim(),eo||"# ".concat(ea.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,U({id:r.id,projectId:r.id,projectName:ea.trim(),customizePath:r.id,content:eo,mtime:"",hasFile:!0,isCurrent:!1,selected:!1,source:"custom"},ea.trim())),t.success(e("common.success"))}ee(!1),await eq()}catch(r){t.error(e("common.error"))}finally{ei(!1)}},e6=async e=>{let t=Array.from(new Set([...e_,...eR.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},e7=async()=>{let e=eP.trim();if(!e||eE)return;let r=[...ek,{role:"user",content:e}];eT(r),eB(""),e$(!1),eO(!0);try{let t=await e6(e),o=await J({name:ea||(null==et?void 0:et.projectName)||"未命名提示词",content:eo,message:e,history:ek,references:t});eT([...r,{role:"assistant",content:o.content||"AI 未返回内容"}])}catch(e){t.error(e instanceof Error?e.message:"AI 对话失败,请检查模型配置"),eT(r)}finally{eO(!1)}},e9=async(r,o)=>{let l=o?Array.from(new Set([...Q.filter(e=>e.selected).map(e=>e.id),r.id])):Q.filter(e=>e.selected&&e.id!==r.id).map(e=>e.id);try{await I(l),V(e=>e.map(e=>({...e,selected:l.includes(e.id)})))}catch(r){t.error(e("common.error"))}},te=async r=>{let o=Q.filter(e=>e.selected).map(e=>e.id),l=r?Array.from(new Set([...o,...e2])):o.filter(e=>!e2.includes(e));try{await I(l),V(e=>e.map(e=>({...e,selected:l.includes(e.id)}))),eA([]),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")),eA(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?Q.filter(e=>e2.includes(e.id)):"filtered"===e?e0:eV;L("customize-prompts-".concat(new Date().toISOString().slice(0,10),".json"),X(r)),t.success("已导出 ".concat(r.length," 条提示词"))},to=async e=>{if(e){eC(!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{eC(!1),eG.current&&(eG.current.value="")}}},tl=t=>{let r=K(t);return(0,o.jsxs)(n.A,{size:4,wrap:!0,children:[(0,o.jsx)(i.A,{color:"custom"===r?"cyan":"current"===r?"green":"project"===r?"blue":"default",style:{margin:0},children:e("custom"===r?"prompt.customPrompt":"current"===r?"prompt.currentProject":"project"===r?"prompt.otherProjects":"prompt.allPrompts")}),t.selected&&(0,o.jsx)(i.A,{color:"purple",style:{margin:0},children:e("prompt.selected")}),!t.hasFile&&(0,o.jsx)(i.A,{style:{margin:0},children:e("prompt.missingFileStatus")})]})},ta=r=>(0,o.jsxs)("div",{className:"flex items-center gap-1.5",children:[r.hasFile&&(0,o.jsx)(c.A,{checked:r.selected,onChange:e=>{e9(r,e.target.checked)},className:"mr-1",children:e("prompt.selected")}),!r.hasFile&&r.projectRoot&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(j.A,{}),onClick:()=>e8(r),children:e("common.add")}),r.hasFile&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(w.A,{}),onClick:()=>{er(r),ed(!1),es(r.projectName),el(r.content||""),e3(r,r.projectName),ee(!0)},children:e("common.edit")}),r.hasFile&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(b.A,{}),onClick:()=>{var e;return e=r,void(L("customize-prompt-".concat(e.projectName.trim().replace(/[\\/:*?"<>|]/g,"-").slice(0,80)||"untitled","-").concat(new Date().toISOString().slice(0,10),".json"),X([e])),t.success("已导出 1 条提示词"))},children:"导出"}),(0,o.jsx)(p.A,{title:W(r)?"删除自定义提示词?":"删除项目记录及文件?",onConfirm:()=>{tt(r)},children:(0,o.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,o.jsx)(S.A,{})})})]});return r?(0,o.jsxs)("div",{className:"space-y-12",children:[(0,o.jsx)(m.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,o.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:Array.from({length:4}).map((e,t)=>(0,o.jsx)("div",{className:"p-4 border border-[var(--borderColor)]",children:(0,o.jsx)(m.A,{active:!0,paragraph:{rows:4}})},t))})]}):(0,o.jsxs)("div",{className:"space-y-8 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4 pb-6 mb-2",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("h1",{className:"text-3xl font-extrabold tracking-tight text-[var(--colorText)] mb-2.5 flex items-center gap-2",children:[(0,o.jsx)(A.A,{className:"text-[var(--colorAccent)]"}),e("nav.promptManagement")]}),(0,o.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)]",children:e("prompt.description")})]}),(0,o.jsxs)(n.A,{wrap:!0,children:[eQ&&(0,o.jsxs)(i.A,{color:"green",style:{lineHeight:"22px"},className:"border-0",children:[(0,o.jsx)(N.A,{})," ",eQ.projectRoot]}),(0,o.jsx)("input",{ref:eG,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)(C.A,{}),loading:eN,onClick:()=>{var e;return null==(e=eG.current)?void 0:e.click()},className:"rounded-lg",children:e("prompt.import")}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(b.A,{}),disabled:0===e0.length,onClick:()=>tr("filtered"),className:"rounded-lg",children:e("prompt.exportFiltered")}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(j.A,{}),onClick:()=>e8(),className:"shadow-none rounded-lg",children:e("prompt.createPrompt")})]})]}),(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-3 bg-[var(--colorBgContainer)] p-3 rounded-xl shadow-sm mb-6",children:[(0,o.jsx)(h.A,{prefix:(0,o.jsx)(k.A,{className:"text-[var(--colorTextTertiary)]"}),allowClear:!0,placeholder:e("prompt.searchPrompt"),value:ey,onChange:e=>ej(e.target.value),style:{width:280},variant:"borderless",className:"bg-[var(--colorBgHover)] rounded-lg hover:bg-[var(--colorFillAlter)] focus:bg-[var(--colorBgElevated)] transition-colors"}),(0,o.jsx)("div",{className:"h-4 w-[1px] bg-[var(--borderColorStrong)] mx-1"}),(0,o.jsx)(x.A,{value:ep,onChange:em,style:{width:150},variant:"borderless",options:[{label:"".concat(e("prompt.allPrompts")," (").concat(eZ.all,")"),value:"all"},{label:"".concat(e("prompt.customPrompt")," (").concat(eZ.custom,")"),value:"custom"},{label:"".concat(e("prompt.currentProject")," (").concat(eZ.current,")"),value:"current"},{label:"".concat(e("prompt.otherProjects")," (").concat(eZ.project,")"),value:"project"}]}),(0,o.jsx)(x.A,{value:eh,onChange:ex,style:{width:130},variant:"borderless",options:[{label:e("prompt.promptStatus"),value:"all"},{label:"".concat(e("prompt.selected")," (").concat(eZ.selected,")"),value:"selected"},{label:"".concat(e("prompt.unselected")," (").concat(eZ.unselected,")"),value:"unselected"},{label:"".concat(e("prompt.hasFileStatus")," (").concat(eZ.hasFile,")"),value:"hasFile"},{label:"".concat(e("prompt.missingFileStatus")," (").concat(eZ.missingFile,")"),value:"missingFile"}]}),(0,o.jsx)(x.A,{value:eu,onChange:eg,style:{width:140},variant:"borderless",options:[{label:e("prompt.sortByMtime"),value:"mtime"},{label:e("prompt.sortByName"),value:"name"},{label:e("prompt.sortBySource"),value:"source"},{label:e("prompt.sortBySelected"),value:"selected"}]}),(0,o.jsx)("div",{className:"flex-1"}),(0,o.jsx)(u.A,{value:ef,onChange:e=>ev(e),options:[{label:(0,o.jsx)(T.A,{}),value:"list"},{label:(0,o.jsx)(F.A,{}),value:"card"}],className:"bg-[var(--colorBgHover)] p-1 rounded-lg"})]}),(0,o.jsx)("div",{className:"grid grid-cols-1 gap-8 items-start",children:(0,o.jsxs)("div",{className:"min-w-0",children:[e2.length>0&&(0,o.jsxs)("div",{className:"flex items-center gap-3 flex-wrap p-4 mb-6 bg-[var(--colorBgHover)] rounded-xl shadow-sm",children:[(0,o.jsxs)("span",{className:"font-semibold text-sm",children:["已选择 ",(0,o.jsx)("span",{className:"text-[var(--colorAccent)]",children:e2.length})," 项"]}),(0,o.jsx)("div",{className:"h-4 w-[1px] bg-[var(--borderColorStrong)] mx-1"}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>{te(!0)},children:e("prompt.batchSelect")}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>{te(!1)},children:e("prompt.cancelSelect")}),(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(b.A,{}),onClick:()=>tr("checked"),children:e("prompt.exportSelected")}),(0,o.jsx)(d.Ay,{size:"small",danger:!0,onClick:()=>eA([]),children:e("prompt.clearSelect")})]}),0===e0.length?(0,o.jsx)("div",{className:"py-32 text-center border border-dashed border-[var(--borderColor)] rounded-2xl bg-[var(--colorBgHover)]",children:(0,o.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:(0,o.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:ey||"all"!==eh?e("prompt.noMatchDesc"):e("prompt.noPromptInGroup")})})}):"list"===ef?(0,o.jsx)("div",{className:"flex flex-col gap-3",children:e0.map(e=>{let t=$(e,180),r=(null==e1?void 0:e1.id)===e.id;return(0,o.jsxs)("div",{onClick:()=>eb(e.id),className:"group grid grid-cols-[28px_1fr_auto] gap-4 items-center p-4 rounded-xl transition-all cursor-pointer ".concat(r?"bg-[var(--colorBgSelected)] shadow-md":"bg-transparent hover:bg-[var(--colorBgHover)] hover:shadow-sm"),children:[(0,o.jsx)(c.A,{checked:eS.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eA(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,o.jsxs)("div",{className:"min-w-0",children:[(0,o.jsxs)("div",{className:"flex items-center gap-3 mb-1.5",children:[(0,o.jsx)(A.A,{className:e.isCurrent?"text-[var(--colorOk)] text-lg":"text-[var(--colorTextSecondary)] text-lg"}),(0,o.jsx)("span",{className:"font-semibold truncate text-[var(--colorText)] text-base",children:e.projectName}),tl(e)]}),(0,o.jsxs)("div",{className:"text-xs text-[var(--colorTextTertiary)] truncate flex items-center gap-1.5 font-medium",children:[(0,o.jsx)(N.A,{})," ",e.projectRoot||e.customizePath||"本地提示词",(0,o.jsx)("span",{className:"text-[var(--colorBorderSecondary)]",children:"|"}),G(e.mtime)]}),t&&(0,o.jsx)("div",{className:"mt-2.5 bg-[var(--colorFillAlter)] p-2.5 rounded-lg overflow-hidden",children:(0,o.jsx)("div",{className:"text-sm text-[var(--colorTextSecondary)] line-clamp-2 leading-normal",children:t})})]}),(0,o.jsx)("div",{onClick:e=>e.stopPropagation(),className:"transition-opacity flex items-center ".concat(r?"opacity-100":"opacity-0 group-hover:opacity-100"),children:ta(e)})]},e.id)})}):(0,o.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:e0.map(e=>{let t=$(e,180),r=(null==e1?void 0:e1.id)===e.id;return(0,o.jsxs)("div",{onClick:()=>eb(e.id),className:"group flex flex-col p-5 rounded-2xl transition-all cursor-pointer ".concat(r?"bg-[var(--colorBgSelected)] shadow-md":"bg-[var(--colorBgContainer)] hover:bg-[var(--colorBgHover)] shadow-sm hover:shadow-md"),children:[(0,o.jsx)("div",{className:"flex items-start justify-between gap-3 mb-4 min-w-0",children:(0,o.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[(0,o.jsx)(c.A,{checked:eS.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eA(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,o.jsx)(A.A,{className:e.isCurrent?"text-[var(--colorOk)] text-lg":"text-[var(--colorTextSecondary)] text-lg"}),(0,o.jsx)("span",{className:"font-bold text-base text-[var(--colorText)] truncate mb-1",children:e.projectName})]})}),(0,o.jsx)("div",{className:"mb-3",children:tl(e)}),(0,o.jsxs)("div",{className:"text-xs text-[var(--colorTextTertiary)] truncate flex items-center gap-1.5 mb-4 bg-[var(--colorFillAlter)] p-1.5 rounded inline-flex self-start",children:[(0,o.jsx)(N.A,{}),e.projectRoot||e.customizePath||"本地提示词"]}),(0,o.jsx)("div",{className:"flex-1 bg-[var(--colorFillAlter)] p-3 rounded-xl mb-4 overflow-hidden",children:t?(0,o.jsx)("div",{className:"text-sm text-[var(--colorTextSecondary)] line-clamp-3 leading-normal",children:t}):(0,o.jsx)("div",{className:"text-sm text-[var(--colorTextQuaternary)] italic",children:"暂无内容预览"})}),(0,o.jsxs)("div",{className:"mt-auto pt-4 flex justify-between items-center",onClick:e=>e.stopPropagation(),children:[(0,o.jsx)("span",{className:"text-xs font-medium text-[var(--colorTextTertiary)] bg-[var(--colorFillSecondary)] px-2 py-1 rounded",children:G(e.mtime)}),(0,o.jsx)("div",{className:"transition-opacity ".concat(r?"opacity-100":"opacity-0 group-hover:opacity-100"),children:ta(e)})]})]},e.id)})})]})}),(0,o.jsxs)(f.A,{title:ec?e("prompt.createPrompt"):et&&W(et)?"".concat(e("prompt.customPrompt")," — ").concat(ea||et.projectName):"".concat(e("prompt.currentProject")," — ").concat((null==et?void 0:et.projectName)||""),open:Z,onClose:()=>ee(!1),styles:{wrapper:{width:1080},mask:{pointerEvents:"none"},body:{padding:"24px 32px",display:"grid",gridTemplateRows:"minmax(320px, 1fr) 420px",gap:24,height:"100%"},header:{borderBottom:"1px solid var(--colorBorderSecondary)",padding:"16px 32px"}},extra:(0,o.jsxs)(n.A,{children:[(0,o.jsx)(d.Ay,{onClick:()=>ee(!1),children:e("common.cancel")}),(0,o.jsx)(d.Ay,{type:"primary",loading:en,onClick:()=>{e5()},children:e("common.save")})]}),children:[(0,o.jsxs)("div",{style:{minHeight:0,display:"flex",flexDirection:"column"},children:[(0,o.jsx)("div",{style:{marginBottom:16},children:ec||et&&W(et)?(0,o.jsx)(h.A,{size:"large",placeholder:e("prompt.promptName"),value:ea,onChange:e=>es(e.target.value),style:{maxWidth:"100%",fontWeight:500,fontSize:16}}):null}),(0,o.jsx)(h.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)(n.A,{size:6,children:[(0,o.jsx)(z.A,{style:{color:"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:600},children:e("prompt.aiPromptAssistant")})]}),(0,o.jsxs)(n.A,{size:6,children:[ek.length>0&&(0,o.jsx)(d.Ay,{size:"small",onClick:()=>eT([]),children:e("prompt.clearHistory")}),eE?(0,o.jsx)(i.A,{color:"processing",style:{margin:0},children:e("prompt.generating")}):(0,o.jsx)(i.A,{color:"blue",style:{margin:0},children:e("prompt.canConverse")})]})]}),(0,o.jsx)("div",{ref:eX,style:{flex:1,minHeight:0,overflowY:"auto",padding:14,background:"var(--colorFillAlter)"},children:0!==ek.length||eE?(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12,width:"100%"},children:[ek.map((r,l)=>{let a="user"===r.role;return(0,o.jsx)("div",{style:{display:"flex",justifyContent:a?"flex-end":"flex-start"},children:(0,o.jsxs)("div",{style:{maxWidth:"78%",padding:"10px 12px",borderRadius:12,background:a?"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:[r.content,!a&&(0,o.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:8},children:(0,o.jsx)(d.Ay,{size:"small",type:"primary",onClick:()=>{el(r.content),t.success("已应用到编辑内容,请确认后保存")},children:e("prompt.apply")})})]})},"".concat(r.role,"-").concat(l))}),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}}),e("prompt.aiAnalyzing")]})})]}):(0,o.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:e("prompt.mentionRecallHint")})}),(0,o.jsx)(y.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)(i.A,{closable:!0,onClose:()=>eM(t=>t.filter(t=>t!==e)),style:{margin:0,maxWidth:360,overflow:"hidden",textOverflow:"ellipsis"},children:["@",e]},e))}),eU&&(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:e("prompt.recallKbFiles")}),(0,o.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11},children:e("prompt.recallLimitHint")})]}),(0,o.jsx)(i.A,{color:eY?"blue":"default",style:{margin:0,maxWidth:240,overflow:"hidden",textOverflow:"ellipsis"},children:eY?"@".concat(eY):e("prompt.inputAtKeyword")})]}),eJ?(0,o.jsxs)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),e("prompt.loadingKbFiles")]}):0===eR.length?(0,o.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:e("prompt.noRecallableKbFiles")}):0===e4.length?(0,o.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:eW?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),e("prompt.searchingKbContent")]}):e("prompt.noMatchingKbFiles")}):(0,o.jsxs)(o.Fragment,{children:[eW&&(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}}),e("prompt.continueSearchingKb")]}),e4.slice(0,30).map(t=>(0,o.jsxs)("div",{onMouseDown:e=>{var r;e.preventDefault(),r=t.relativePath,eM(e=>e.includes(r)?e:[...e,r]),eB(e=>e.replace(/(^|\s)@([^\s@]*)$/,"$1@".concat(r," "))),e$(!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)(A.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:t.relativePath}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[t.category||e("prompt.unclassified")," \xb7 ",t.format||e("prompt.unknownFormat"),"number"==typeof t.score?" \xb7 score ".concat(t.score.toFixed(2)):""]})]}),(0,o.jsxs)(n.A,{size:4,children:[(0,o.jsx)(i.A,{color:"content"===t.matchedBy?"purple":"disk"===t.matchedBy?"orange":"blue",style:{margin:0},children:"content"===t.matchedBy?e("prompt.contentMatch"):"disk"===t.matchedBy?e("prompt.diskFile"):e("prompt.fileMatch")}),(0,o.jsx)(i.A,{style:{margin:0},children:t.status})]})]},t.relativePath))]})]}),(0,o.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-end"},children:[(0,o.jsx)(h.A.TextArea,{value:eP,onChange:e=>{let t=e.target.value;eB(t),e$(null!==Y(t))},onFocus:()=>e$(null!==Y(eP)),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),e7())},disabled:eE,placeholder:e("prompt.mentionRecallPlaceholder"),autoSize:{minRows:2,maxRows:5},style:{fontSize:13,lineHeight:1.6}}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(P.A,{}),loading:eE,disabled:!eP.trim(),onClick:()=>{e7()},children:e("prompt.send")})]})]})]})]})]})}}},e=>{e.O(0,[717,883,44,563,195,187,636,593,792],()=>e(e.s=27549)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[979],{9137:(e,r,t)=>{"use strict";t.d(r,{Ay:()=>C});var a=t(9750),s=t(97109),o=t(42644),l=t(10252),n=t(74567),c=t(48921),i=t(98379),d=t(3638),x=t(632),m=t(34475),g=t(52093),p=t(60815),u=t(5741);let f=null,h=e=>e(),v=[],b={};function y(){let{getContainer:e,duration:r,rtl:t,maxCount:a,top:s,stack:o}=b,l=e?.()||document.body;return{getContainer:()=>l,duration:r,rtl:t,maxCount:a,top:s,stack:o}}let w=s.forwardRef((e,r)=>{let{messageConfig:t,sync:a}=e,{getPrefixCls:o}=(0,s.useContext)(n.QO),c=b.prefixCls||o("message"),i=(0,s.useContext)(l.B),[d,x]=(0,p.y)({...t,prefixCls:c,...i.message});return s.useImperativeHandle(r,()=>{let e={...d};return Object.keys(e).forEach(r=>{e[r]=(...e)=>(a(),d[r].apply(d,e))}),{instance:e,sync:a}}),x}),j=s.forwardRef((e,r)=>{let[t,a]=s.useState(y),o=()=>{a(y)};s.useEffect(o,[]);let l=(0,c.cr)(),n=l.getRootPrefixCls(),i=l.getIconPrefixCls(),d=l.getTheme(),x=s.createElement(w,{ref:r,sync:o,messageConfig:t});return s.createElement(c.Ay,{prefixCls:n,iconPrefixCls:i,theme:d},l.holderRender?l.holderRender(x):x)}),N=()=>{if(!f){let e=document.createDocumentFragment(),r={fragment:e};f=r,h(()=>{(0,o.XX)(s.createElement(j,{ref:e=>{let{instance:t,sync:a}=e||{};Promise.resolve().then(()=>{!r.instance&&t&&(r.instance=t,r.sync=a,N())})}}),e)});return}f.instance&&(v.forEach(e=>{let{type:r,skipped:t}=e;if(!t)switch(r){case"open":h(()=>{let r=f.instance.open({...b,...e.config});r?.then(e.resolve),e.setCloseFn(r)});break;case"destroy":h(()=>{f?.instance.destroy(e.key)});break;default:h(()=>{var t;let s=(t=f.instance)[r].apply(t,(0,a.A)(e.args));s?.then(e.resolve),e.setCloseFn(s)})}}),v=[])},A={open:function(e){let r=(0,u.E)(r=>{let t,a={type:"open",config:e,resolve:r,setCloseFn:e=>{t=e}};return v.push(a),()=>{t?h(()=>{t()}):a.skipped=!0}});return N(),r},destroy:e=>{v.push({type:"destroy",key:e}),N()},config:function(e){b={...b,...e},h(()=>{f?.sync?.()})},useMessage:p.A,_InternalPanelDoNotUseOrYouWillBeFired:m.Ay,_InternalListDoNotUseOrYouWillBeFired:e=>{let{items:r,classNames:t,style:a}=e,{getPrefixCls:o}=(0,n.TP)("message"),l=o("message"),c=(0,x.A)(l),[p,u]=(0,g.A)(l,c),f=`${l}-notice`,h=r.map(e=>{let{content:r,duration:t,key:a,type:s}=e,o=s?`${f}-icon-${s}`:void 0;return{key:a,duration:t,icon:(0,m.HC)(s),title:r,className:`${f}-${s}`,classNames:{wrapper:`${l}-${s}`,icon:o}}});return s.createElement(i.qb,{prefixCls:l,placement:"top",configList:h,className:(0,d.$)(p,u,c),classNames:{...t,wrapper:t?.wrapper,title:t?.title},style:a,stack:!1})}};["success","info","warning","error","loading"].forEach(e=>{A[e]=(...r)=>(function(e,r){(0,c.cr)();let t=(0,u.E)(t=>{let a,s={type:e,args:r,resolve:t,setCloseFn:e=>{a=e}};return v.push(s),()=>{a?h(()=>{a()}):s.skipped=!0}});return N(),t})(e,r)});let C=A},12446:(e,r)=>{"use strict";r.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"}},14995:(e,r)=>{"use strict";r.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"}},29606:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>A});var a=t(65321),s=t(97109),o=t(35292),l=t(9137),n=t(11702),c=t(88762),i=t(7576),d=t(85114),x=t(26171),m=t(21289),g=t(84253),p=t(30486),u=t(99811),f=t(58209),h=t(12446),v=t(88483);function b(){return(b=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let y=s.forwardRef((e,r)=>s.createElement(v.A,b({},e,{ref:r,icon:h.A})));var w=t(48321),j=t(6578);let{Text:N}=o.A;function A(){let e=(0,w.Vr)(),[r,t]=(0,s.useState)([]),[o,h]=(0,s.useState)(!0),[v,b]=(0,s.useState)(""),A=async()=>{h(!0);try{t((await (0,j.oH)(500)).logs)}catch(e){l.Ay.error(e instanceof Error?e.message:"加载日志失败")}finally{h(!1)}};(0,s.useEffect)(()=>{A()},[]);let C=(0,s.useMemo)(()=>{let e=v.trim().toLowerCase();return e?r.filter(r=>[r.id,r.level,r.source,r.functionName,r.message,r.stack].filter(Boolean).some(r=>String(r).toLowerCase().includes(e))):r},[v,r]),k=[{title:e("logs.time"),dataIndex:"createdAt",width:160,render:e=>(0,a.jsx)("span",{className:"text-xs text-[var(--colorTextSecondary)] font-mono",children:new Date(e).toLocaleString()})},{title:e("logs.level"),dataIndex:"level",width:80,render:e=>(0,a.jsx)(n.A,{color:"error"===e?"error":"warn"===e?"warning":"blue",className:"m-0 text-[10px] uppercase tracking-wider border-0",children:e})},{title:e("logs.source"),dataIndex:"source",width:220,render:e=>(0,a.jsx)("span",{className:"text-xs font-mono text-[var(--colorTextSecondary)] break-all",children:e})},{title:e("logs.message"),dataIndex:"message",render:e=>(0,a.jsx)("div",{className:"text-sm text-[var(--colorText)] max-w-3xl whitespace-normal break-words leading-relaxed",title:e,children:e})},{title:e("logs.requestId"),dataIndex:"id",width:120,render:e=>(0,a.jsx)(N,{copyable:!0,className:"text-[10px] font-mono text-[var(--colorTextTertiary)]",children:e.slice(0,8)})}];return o&&0===r.length?(0,a.jsxs)("div",{className:"space-y-8 animateFadeIn",children:[(0,a.jsx)(c.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,a.jsx)(c.A,{active:!0,paragraph:{rows:12}})]}):(0,a.jsxs)("div",{className:"h-[calc(100vh-140px)] flex flex-col",children:[(0,a.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 pb-4 border-b border-[var(--borderColor)] shrink-0 animateFadeIn",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold tracking-tight text-[var(--colorText)] mb-1",children:e("nav.systemLogs")}),(0,a.jsx)("p",{className:"text-xs text-[var(--colorTextSecondary)]",children:e("logs.monitorSystem")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(i.A,{placeholder:e("logs.searchLogs"),prefix:(0,a.jsx)(p.A,{className:"text-[var(--colorTextTertiary)]"}),value:v,onChange:e=>b(e.target.value),allowClear:!0,className:"w-[260px] bg-[var(--colorBgHover)] border-transparent"}),(0,a.jsx)(d.Ay,{icon:(0,a.jsx)(u.A,{}),loading:o,onClick:()=>void A(),className:"shadow-none",children:e("logs.refresh")}),(0,a.jsx)(x.A,{title:e("logs.clearConfirm"),onConfirm:()=>{(async()=>{await (0,j.hH)(),l.Ay.success(e("common.success")),await A()})()},children:(0,a.jsx)(d.Ay,{danger:!0,icon:(0,a.jsx)(f.A,{}),className:"shadow-none border-transparent",children:e("logs.clear")})})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 py-3 px-1 text-xs text-[var(--colorTextTertiary)] shrink-0 animateFadeIn stagger-1",children:[(0,a.jsx)(y,{})," ",e("logs.logStorageInfo")," ",(0,a.jsx)("code",{className:"bg-[var(--colorBgHover)] px-1 rounded",children:"~/.customize-agent/logs/errors.jsonl"}),". ",e("logs.maxLoaded")]}),(0,a.jsx)("div",{className:"flex-1 overflow-hidden bg-[var(--colorBg)] rounded-lg animateFadeIn stagger-2",children:(0,a.jsx)(m.A,{rowKey:"id",loading:o,dataSource:C,columns:k,size:"middle",className:"h-full modern-table",scroll:{y:"calc(100vh - 280px)"},locale:{emptyText:(0,a.jsx)(g.A,{description:e("logs.noLogsFound"),className:"py-20"})},pagination:!1,rowClassName:"hover:bg-[var(--colorBgHover)] transition-colors cursor-pointer",expandable:{expandedRowRender:r=>(0,a.jsxs)("div",{className:"flex flex-col gap-4 p-4 bg-[var(--colorBgHover)]/50 border-t border-[var(--borderColor)]",children:[r.functionName&&(0,a.jsxs)("div",{className:"text-xs text-[var(--colorTextSecondary)]",children:[(0,a.jsx)("span",{className:"font-semibold uppercase tracking-wider text-[var(--colorTextTertiary)] mr-2",children:e("logs.function")}),(0,a.jsx)("code",{className:"font-mono bg-[var(--colorBgElevated)] px-2 py-1 rounded",children:r.functionName})]}),r.request&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-[var(--colorTextTertiary)] mb-2",children:e("logs.requestContext")}),(0,a.jsx)("pre",{className:"text-xs font-mono bg-[var(--colorBgElevated)] p-3 rounded-md border border-[var(--borderColor)] whitespace-pre-wrap break-all m-0 text-[var(--colorTextSecondary)]",children:JSON.stringify(r.request,null,2)})]}),void 0!==r.meta&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-[var(--colorTextTertiary)] mb-2",children:e("logs.metadata")}),(0,a.jsx)("pre",{className:"text-xs font-mono bg-[var(--colorBgElevated)] p-3 rounded-md border border-[var(--borderColor)] whitespace-pre-wrap break-all m-0 text-[var(--colorTextSecondary)]",children:JSON.stringify(r.meta,null,2)})]}),r.stack&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-[var(--colorTextTertiary)] mb-2",children:e("logs.stackTrace")}),(0,a.jsx)("pre",{className:"text-[11px] font-mono bg-[#1e1e1e] text-[#d4d4d4] p-3 rounded-md overflow-x-auto m-0 leading-relaxed",children:r.stack})]})]})}})})]})}},39214:(e,r,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/system/logs",function(){return t(29606)}])},99811:(e,r,t)=>{"use strict";t.d(r,{A:()=>n});var a=t(97109),s=t(14995),o=t(88483);function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let n=a.forwardRef((e,r)=>a.createElement(o.A,l({},e,{ref:r,icon:s.A})))}},e=>{e.O(0,[580,665,576,209,7,195,289,636,593,792],()=>e(e.s=39214)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[979],{9137:(e,r,t)=>{"use strict";t.d(r,{Ay:()=>C});var a=t(9750),s=t(97109),o=t(42644),l=t(10252),n=t(74567),c=t(48921),i=t(98379),d=t(3638),x=t(632),m=t(34475),g=t(52093),p=t(60815),u=t(5741);let f=null,h=e=>e(),v=[],b={};function y(){let{getContainer:e,duration:r,rtl:t,maxCount:a,top:s,stack:o}=b,l=e?.()||document.body;return{getContainer:()=>l,duration:r,rtl:t,maxCount:a,top:s,stack:o}}let w=s.forwardRef((e,r)=>{let{messageConfig:t,sync:a}=e,{getPrefixCls:o}=(0,s.useContext)(n.QO),c=b.prefixCls||o("message"),i=(0,s.useContext)(l.B),[d,x]=(0,p.y)({...t,prefixCls:c,...i.message});return s.useImperativeHandle(r,()=>{let e={...d};return Object.keys(e).forEach(r=>{e[r]=(...e)=>(a(),d[r].apply(d,e))}),{instance:e,sync:a}}),x}),j=s.forwardRef((e,r)=>{let[t,a]=s.useState(y),o=()=>{a(y)};s.useEffect(o,[]);let l=(0,c.cr)(),n=l.getRootPrefixCls(),i=l.getIconPrefixCls(),d=l.getTheme(),x=s.createElement(w,{ref:r,sync:o,messageConfig:t});return s.createElement(c.Ay,{prefixCls:n,iconPrefixCls:i,theme:d},l.holderRender?l.holderRender(x):x)}),N=()=>{if(!f){let e=document.createDocumentFragment(),r={fragment:e};f=r,h(()=>{(0,o.XX)(s.createElement(j,{ref:e=>{let{instance:t,sync:a}=e||{};Promise.resolve().then(()=>{!r.instance&&t&&(r.instance=t,r.sync=a,N())})}}),e)});return}f.instance&&(v.forEach(e=>{let{type:r,skipped:t}=e;if(!t)switch(r){case"open":h(()=>{let r=f.instance.open({...b,...e.config});r?.then(e.resolve),e.setCloseFn(r)});break;case"destroy":h(()=>{f?.instance.destroy(e.key)});break;default:h(()=>{var t;let s=(t=f.instance)[r].apply(t,(0,a.A)(e.args));s?.then(e.resolve),e.setCloseFn(s)})}}),v=[])},A={open:function(e){let r=(0,u.E)(r=>{let t,a={type:"open",config:e,resolve:r,setCloseFn:e=>{t=e}};return v.push(a),()=>{t?h(()=>{t()}):a.skipped=!0}});return N(),r},destroy:e=>{v.push({type:"destroy",key:e}),N()},config:function(e){b={...b,...e},h(()=>{f?.sync?.()})},useMessage:p.A,_InternalPanelDoNotUseOrYouWillBeFired:m.Ay,_InternalListDoNotUseOrYouWillBeFired:e=>{let{items:r,classNames:t,style:a}=e,{getPrefixCls:o}=(0,n.TP)("message"),l=o("message"),c=(0,x.A)(l),[p,u]=(0,g.A)(l,c),f=`${l}-notice`,h=r.map(e=>{let{content:r,duration:t,key:a,type:s}=e,o=s?`${f}-icon-${s}`:void 0;return{key:a,duration:t,icon:(0,m.HC)(s),title:r,className:`${f}-${s}`,classNames:{wrapper:`${l}-${s}`,icon:o}}});return s.createElement(i.qb,{prefixCls:l,placement:"top",configList:h,className:(0,d.$)(p,u,c),classNames:{...t,wrapper:t?.wrapper,title:t?.title},style:a,stack:!1})}};["success","info","warning","error","loading"].forEach(e=>{A[e]=(...r)=>(function(e,r){(0,c.cr)();let t=(0,u.E)(t=>{let a,s={type:e,args:r,resolve:t,setCloseFn:e=>{a=e}};return v.push(s),()=>{a?h(()=>{a()}):s.skipped=!0}});return N(),t})(e,r)});let C=A},12446:(e,r)=>{"use strict";r.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"}},14995:(e,r)=>{"use strict";r.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"}},29606:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>A});var a=t(65321),s=t(97109),o=t(35292),l=t(9137),n=t(11702),c=t(88762),i=t(7576),d=t(85114),x=t(26171),m=t(21289),g=t(84253),p=t(30486),u=t(99811),f=t(58209),h=t(12446),v=t(88483);function b(){return(b=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let y=s.forwardRef((e,r)=>s.createElement(v.A,b({},e,{ref:r,icon:h.A})));var w=t(48321),j=t(6578);let{Text:N}=o.A;function A(){let e=(0,w.Vr)(),[r,t]=(0,s.useState)([]),[o,h]=(0,s.useState)(!0),[v,b]=(0,s.useState)(""),A=async()=>{h(!0);try{t((await (0,j.oH)(500)).logs)}catch(e){l.Ay.error(e instanceof Error?e.message:"加载日志失败")}finally{h(!1)}};(0,s.useEffect)(()=>{A()},[]);let C=(0,s.useMemo)(()=>{let e=v.trim().toLowerCase();return e?r.filter(r=>[r.id,r.level,r.source,r.functionName,r.message,r.stack].filter(Boolean).some(r=>String(r).toLowerCase().includes(e))):r},[v,r]),k=[{title:e("logs.time"),dataIndex:"createdAt",width:160,render:e=>(0,a.jsx)("span",{className:"text-xs text-[var(--colorTextSecondary)] font-mono",children:new Date(e).toLocaleString()})},{title:e("logs.level"),dataIndex:"level",width:80,render:e=>(0,a.jsx)(n.A,{color:"error"===e?"error":"warn"===e?"warning":"blue",className:"m-0 text-[10px] uppercase tracking-wider border-0",children:e})},{title:e("logs.source"),dataIndex:"source",width:220,render:e=>(0,a.jsx)("span",{className:"text-xs font-mono text-[var(--colorTextSecondary)] break-all",children:e})},{title:e("logs.message"),dataIndex:"message",render:e=>(0,a.jsx)("div",{className:"text-sm text-[var(--colorText)] max-w-3xl whitespace-normal break-words leading-relaxed",title:e,children:e})},{title:e("logs.requestId"),dataIndex:"id",width:120,render:e=>(0,a.jsx)(N,{copyable:!0,className:"text-[10px] font-mono text-[var(--colorTextTertiary)]",children:e.slice(0,8)})}];return o&&0===r.length?(0,a.jsxs)("div",{className:"space-y-8 animateFadeIn",children:[(0,a.jsx)(c.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,a.jsx)(c.A,{active:!0,paragraph:{rows:12}})]}):(0,a.jsxs)("div",{className:"h-[calc(100vh-140px)] flex flex-col",children:[(0,a.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 pb-4 border-b border-[var(--borderColor)] shrink-0 animateFadeIn",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold tracking-tight text-[var(--colorText)] mb-1",children:e("nav.systemLogs")}),(0,a.jsx)("p",{className:"text-xs text-[var(--colorTextSecondary)]",children:e("logs.monitorSystem")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(i.A,{placeholder:e("logs.searchLogs"),prefix:(0,a.jsx)(p.A,{className:"text-[var(--colorTextTertiary)]"}),value:v,onChange:e=>b(e.target.value),allowClear:!0,className:"w-[260px] bg-[var(--colorBgHover)] border-transparent"}),(0,a.jsx)(d.Ay,{icon:(0,a.jsx)(u.A,{}),loading:o,onClick:()=>void A(),className:"shadow-none",children:e("logs.refresh")}),(0,a.jsx)(x.A,{title:e("logs.clearConfirm"),onConfirm:()=>{(async()=>{await (0,j.hH)(),l.Ay.success(e("common.success")),await A()})()},children:(0,a.jsx)(d.Ay,{danger:!0,icon:(0,a.jsx)(f.A,{}),className:"shadow-none border-transparent",children:e("logs.clear")})})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 py-3 px-1 text-xs text-[var(--colorTextTertiary)] shrink-0 animateFadeIn stagger-1",children:[(0,a.jsx)(y,{})," ",e("logs.logStorageInfo")," ",(0,a.jsx)("code",{className:"bg-[var(--colorBgHover)] px-1 rounded",children:"~/.customize-agent/logs/errors.jsonl"}),". ",e("logs.maxLoaded")]}),(0,a.jsx)("div",{className:"flex-1 overflow-hidden bg-[var(--colorBg)] rounded-lg animateFadeIn stagger-2",children:(0,a.jsx)(m.A,{rowKey:"id",loading:o,dataSource:C,columns:k,size:"middle",className:"h-full modern-table",scroll:{y:"calc(100vh - 280px)"},locale:{emptyText:(0,a.jsx)(g.A,{description:e("logs.noLogsFound"),className:"py-20"})},pagination:!1,rowClassName:"hover:bg-[var(--colorBgHover)] transition-colors cursor-pointer",expandable:{expandedRowRender:r=>(0,a.jsxs)("div",{className:"flex flex-col gap-4 p-4 bg-[var(--colorBgHover)]/50 border-t border-[var(--borderColor)]",children:[r.functionName&&(0,a.jsxs)("div",{className:"text-xs text-[var(--colorTextSecondary)]",children:[(0,a.jsx)("span",{className:"font-semibold uppercase tracking-wider text-[var(--colorTextTertiary)] mr-2",children:e("logs.function")}),(0,a.jsx)("code",{className:"font-mono bg-[var(--colorBgElevated)] px-2 py-1 rounded",children:r.functionName})]}),r.request&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-[var(--colorTextTertiary)] mb-2",children:e("logs.requestContext")}),(0,a.jsx)("pre",{className:"text-xs font-mono bg-[var(--colorBgElevated)] p-3 rounded-md border border-[var(--borderColor)] whitespace-pre-wrap break-all m-0 text-[var(--colorTextSecondary)]",children:JSON.stringify(r.request,null,2)})]}),void 0!==r.meta&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-[var(--colorTextTertiary)] mb-2",children:e("logs.metadata")}),(0,a.jsx)("pre",{className:"text-xs font-mono bg-[var(--colorBgElevated)] p-3 rounded-md border border-[var(--borderColor)] whitespace-pre-wrap break-all m-0 text-[var(--colorTextSecondary)]",children:JSON.stringify(r.meta,null,2)})]}),r.stack&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-[var(--colorTextTertiary)] mb-2",children:e("logs.stackTrace")}),(0,a.jsx)("pre",{className:"text-[11px] font-mono bg-[#1e1e1e] text-[#d4d4d4] p-3 rounded-md overflow-x-auto m-0 leading-relaxed",children:r.stack})]})]})}})})]})}},39214:(e,r,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/system/logs",function(){return t(29606)}])},99811:(e,r,t)=>{"use strict";t.d(r,{A:()=>n});var a=t(97109),s=t(14995),o=t(88483);function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let n=a.forwardRef((e,r)=>a.createElement(o.A,l({},e,{ref:r,icon:s.A})))}},e=>{e.O(0,[717,883,665,44,563,7,289,195,636,593,792],()=>e(e.s=39214)),_N_E=e.O()}]);