@customize-agent/server 3.0.8 → 3.0.9

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 (93) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +145 -123
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/routes-manifest.json +6 -0
  5. package/.next/server/chunks/5076.js +2 -2
  6. package/.next/server/chunks/8204.js +1 -1
  7. package/.next/server/chunks/9270.js +1 -1
  8. package/.next/server/chunks/9301.js +2 -2
  9. package/.next/server/middleware-build-manifest.js +1 -1
  10. package/.next/server/pages/404.html +1 -1
  11. package/.next/server/pages/500.html +1 -1
  12. package/.next/server/pages/context/long-term.html +1 -1
  13. package/.next/server/pages/context/short-term.html +1 -1
  14. package/.next/server/pages/document-roles.html +1 -1
  15. package/.next/server/pages/documents.html +1 -1
  16. package/.next/server/pages/guide.html +1 -0
  17. package/.next/server/pages/guide.js.nft.json +1 -0
  18. package/.next/server/pages/index.html +1 -1
  19. package/.next/server/pages/knowledge/file-detail.html +1 -1
  20. package/.next/server/pages/knowledge/files.html +1 -1
  21. package/.next/server/pages/knowledge/manage.html +1 -1
  22. package/.next/server/pages/knowledge/search.html +1 -1
  23. package/.next/server/pages/knowledge.html +1 -1
  24. package/.next/server/pages/models.html +1 -1
  25. package/.next/server/pages/overview.html +1 -1
  26. package/.next/server/pages/prompt.html +1 -1
  27. package/.next/server/pages/settings.html +1 -1
  28. package/.next/server/pages-manifest.json +17 -16
  29. package/.next/static/VXIEr9wT7-PwtFzF1Z4a2/_buildManifest.js +1 -0
  30. package/.next/static/chunks/{15-c0cd098235feea60.js → 15-289cb38b53bafa4a.js} +1 -1
  31. package/.next/static/chunks/167-9f45623d7ea7ab43.js +1 -0
  32. package/.next/static/chunks/174-e7df14600b457a5c.js +10 -0
  33. package/.next/static/chunks/201-b16b4788042ed1aa.js +1 -0
  34. package/.next/static/chunks/227-442963c7b630eade.js +1 -0
  35. package/.next/static/chunks/257-ba16dfe16a27f417.js +1 -0
  36. package/.next/static/chunks/260-7a7a65a3ca8539ba.js +28 -0
  37. package/.next/static/chunks/{292-a1cc113f5092109b.js → 292-c2888a94068fae74.js} +1 -1
  38. package/.next/static/chunks/382-dd7535429e16931b.js +25 -0
  39. package/.next/static/chunks/{400-82e564931b06011b.js → 400-ba996d76e74a7368.js} +1 -1
  40. package/.next/static/chunks/446-0591221372df7d49.js +4 -0
  41. package/.next/static/chunks/{455-3fed2dde34ca1eef.js → 455-e31becaaf948f868.js} +1 -1
  42. package/.next/static/chunks/492-62671486700ed3f9.js +1 -0
  43. package/.next/static/chunks/{517-c6a8c0e680dafa46.js → 517-f43787133528ba48.js} +1 -1
  44. package/.next/static/chunks/668-662b7bc81e4ad48f.js +4 -0
  45. package/.next/static/chunks/740-cd38299e151d3ffc.js +16 -0
  46. package/.next/static/chunks/841-3d29160e695d62bc.js +1 -0
  47. package/.next/static/chunks/851-1190cb42a0630eef.js +1 -0
  48. package/.next/static/chunks/{891-ff3efd43c148bd2c.js → 891-b6a172e1df7ab8c1.js} +1 -1
  49. package/.next/static/chunks/912-6c4e14cfeb726d91.js +11 -0
  50. package/.next/static/chunks/951-320008e618be7e4f.js +1 -0
  51. package/.next/static/chunks/958-0793922b6b146891.js +1 -0
  52. package/.next/static/chunks/969-8843874536e7fd83.js +1 -0
  53. package/.next/static/chunks/992-ea93dfa182a02a8e.js +1 -0
  54. package/.next/static/chunks/pages/_app-15fb8428c7126df0.js +140 -0
  55. package/.next/static/chunks/pages/context/{long-term-7dd213ed6aaf6901.js → long-term-9685fc1fd8397807.js} +1 -1
  56. package/.next/static/chunks/pages/context/{short-term-70f45e74d6778422.js → short-term-86f5d204405bb05c.js} +1 -1
  57. package/.next/static/chunks/pages/document-roles-1449654aa961426e.js +1 -0
  58. package/.next/static/chunks/pages/documents-214c9e8ba476e90b.js +1 -0
  59. package/.next/static/chunks/pages/guide-b1a75703238c7f77.js +1 -0
  60. package/.next/static/chunks/pages/knowledge/{file-detail-9a889d5cb64f568c.js → file-detail-21dbc84d04f969ca.js} +1 -1
  61. package/.next/static/chunks/pages/knowledge/{files-1d99abf5b4d33896.js → files-369d7ccf6a6e4e43.js} +1 -1
  62. package/.next/static/chunks/pages/knowledge/{manage-21b21d79b5cf4cd5.js → manage-447ce42652c203f4.js} +1 -1
  63. package/.next/static/chunks/pages/knowledge/{search-70a7b107d722facd.js → search-5a199ff773f7938b.js} +1 -1
  64. package/.next/static/chunks/pages/knowledge-81fd1e907a6fcb84.js +1 -0
  65. package/.next/static/chunks/pages/models-fc67c4147d2aa3cb.js +1 -0
  66. package/.next/static/chunks/pages/overview-558db8205a06d058.js +1 -0
  67. package/.next/static/chunks/pages/prompt-654d82321a383233.js +1 -0
  68. package/.next/static/chunks/pages/{settings-daf6d46ceb1dbd41.js → settings-88f50b9cafc389e0.js} +1 -1
  69. package/package.json +2 -2
  70. package/.next/static/TPNkWJVdxfNk1foFSh7Uw/_buildManifest.js +0 -1
  71. package/.next/static/chunks/129-abc5698c238befa3.js +0 -1
  72. package/.next/static/chunks/174-4fe307a1ae432ca3.js +0 -10
  73. package/.next/static/chunks/227-5d0e79ce4e00983e.js +0 -1
  74. package/.next/static/chunks/257-43a44acbd7b6e330.js +0 -1
  75. package/.next/static/chunks/260-b4f5be8cad9d5eb8.js +0 -28
  76. package/.next/static/chunks/425-fe4960449c1faceb.js +0 -25
  77. package/.next/static/chunks/446-c2604ca982998533.js +0 -4
  78. package/.next/static/chunks/492-764fcf49f0c198bc.js +0 -1
  79. package/.next/static/chunks/544-b1e7fb125bd5ba92.js +0 -1
  80. package/.next/static/chunks/668-ff3d8f8bff59e606.js +0 -4
  81. package/.next/static/chunks/740-2d2619c22f2573ad.js +0 -16
  82. package/.next/static/chunks/846-7f8d40514b6985f3.js +0 -1
  83. package/.next/static/chunks/958-ed6bd7651b040ee8.js +0 -1
  84. package/.next/static/chunks/969-7ca2307001c18a53.js +0 -1
  85. package/.next/static/chunks/992-52509d4b96af607f.js +0 -1
  86. package/.next/static/chunks/pages/_app-b70d02eb20e482ce.js +0 -140
  87. package/.next/static/chunks/pages/document-roles-8f6b20debf515131.js +0 -1
  88. package/.next/static/chunks/pages/documents-56ca6f45e69c19e5.js +0 -1
  89. package/.next/static/chunks/pages/knowledge-b3ef77e79801287c.js +0 -1
  90. package/.next/static/chunks/pages/models-faf86bc243e1e43a.js +0 -1
  91. package/.next/static/chunks/pages/overview-f7614487f399659f.js +0 -1
  92. package/.next/static/chunks/pages/prompt-54f8cf8df33e3c2e.js +0 -1
  93. /package/.next/static/{TPNkWJVdxfNk1foFSh7Uw → VXIEr9wT7-PwtFzF1Z4a2}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[623],{3507:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return t(9889)}])},6578:(e,n,t)=>{"use strict";async function o(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function i(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(n))}async function r(e){var n,t;let i=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&i.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&i.set("category",e.category),(null==e?void 0:e.page)&&i.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&i.set("limit",String(null!=(t=e.limit)?t:50)),o("/api/kb/files?".concat(i))}async function s(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),o("/api/kb/files/detail?".concat(t))}async function a(e,n){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function l(e,n,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function c(e){return new Promise((n,t)=>{let o=new FileReader;o.onload=()=>{let e=o.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},o.onerror=t,o.readAsDataURL(e)})}async function d(e,n,t){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await c(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function p(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n))}async function m(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function y(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function h(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function x(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function j(){return o("/api/kb/features")}async function g(e,n){var t,i,r,s,a;let l=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&l.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&l.set("category",n.category),(null==n?void 0:n.limit)&&l.set("limit",String(null!=(a=n.limit)?a:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&l.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(i=n.weights)?void 0:i.vector)!=null&&l.set("vectorWeight",String(n.weights.vector)),(null==n||null==(r=n.weights)?void 0:r.rewrite)!=null&&l.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(s=n.weights)?void 0:s.hybridBonus)!=null&&l.set("hybridBonus",String(n.weights.hybridBonus)),o("/api/kb/search?".concat(l))}async function A(){return o("/api/prompt")}async function b(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function T(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function w(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function S(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(){return o("/api/documents/templates")}async function R(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function I(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function N(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(){return o("/api/documents/drafts")}async function P(e,n){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function J(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw Error(await n.text());return n.blob()}async function U(){return o("/api/config/providers")}async function F(e,n){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function D(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function L(){return o("/api/config/models")}async function _(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(){return o("/api/config/embedding")}async function V(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function H(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function W(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function B(){return o("/api/system/stats")}async function X(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function z(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function G(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function M(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Q(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function Z(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function K(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>P,Bh:()=>K,Dl:()=>C,E:()=>M,FC:()=>B,FV:()=>v,H1:()=>x,H7:()=>m,HC:()=>a,HT:()=>r,II:()=>q,NR:()=>w,OX:()=>N,PH:()=>G,QT:()=>p,Qx:()=>u,R1:()=>O,SJ:()=>h,UE:()=>J,VW:()=>j,W2:()=>g,X8:()=>f,Z3:()=>U,_m:()=>F,aP:()=>_,bV:()=>I,bZ:()=>W,c1:()=>d,dd:()=>V,dg:()=>T,dw:()=>S,dx:()=>A,h0:()=>k,h1:()=>D,hc:()=>i,hn:()=>X,l2:()=>R,lv:()=>b,p:()=>z,q7:()=>E,tn:()=>l,u6:()=>H,xC:()=>s,xq:()=>y,xw:()=>Q,zo:()=>Z,zr:()=>L})},9889:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>S});var o=t(5321),i=t(7109),r=t(7807),s=t(3455),a=t(8332),l=t(4253),c=t(5114),d=t(6171),p=t(3442),u=t(1702),m=t(8787),y=t(2256),h=t(8770),f=t(5258),x=t(7271),j=t(4668),g=t(8569),A=t(9650),b=t(8209),T=t(4746),v=t(6578),w=t(6644);function S(){let e=(0,w.Vr)(),{message:n}=r.A.useApp(),[t]=s.A.useForm(),[S]=s.A.useForm(),[C,R]=(0,i.useState)([]),[k,I]=(0,i.useState)([]),[N,O]=(0,i.useState)([]),[E,P]=(0,i.useState)([]),[J,U]=(0,i.useState)(!1),[F,D]=(0,i.useState)(!1),L=async()=>{let[e,n,t]=await Promise.all([(0,v.lv)(),(0,v.HT)(),(0,v.dx)()]);R(e.roles),I(e.configs),O(n.files),P(t)};(0,i.useEffect)(()=>{L().catch(()=>n.error(e("common.error")))},[n,e]);let _=C.filter(e=>"file"===e.type),q=C.filter(e=>"prompt"===e.type),V=async()=>{try{let o=await t.validateFields(),i=await (0,v.dg)(o);R(i.roles),I(i.configs),U(!1),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},H=async()=>{try{let t=await S.validateFields(),o=e=>(null!=e?e:[]).map((e,n)=>{var t;return{roleId:e.roleId,order:Number(null!=(t=e.order)?t:n)}}),i=await (0,v.NR)({...t,fileRoles:o(t.fileRoles),promptRoles:o(t.promptRoles)});R(i.roles),I(i.configs),D(!1),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},W=async e=>{let n=await (0,v.FV)(e.type,e.id);R(n.roles),I(n.configs)},B=async e=>{let n=await (0,v.dw)(e);R(n.roles),I(n.configs)},X=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";t.setFieldsValue(null!=e?e:{id:"role-".concat(Date.now()),name:"",description:"",type:n,executionType:"prompt"===n?"reference":void 0,processingType:"file"===n?"reference":void 0}),U(!0)},z=e=>{S.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[]}),D(!0)},G=n=>(0,o.jsx)(a.A,{dataSource:C.filter(e=>e.type===n),locale:{emptyText:(0,o.jsx)(l.A,{description:e("common.noData")})},renderItem:n=>(0,o.jsx)(a.A.Item,{actions:[(0,o.jsx)(c.Ay,{type:"text",icon:(0,o.jsx)(A.A,{}),onClick:()=>X(n)},"edit"),(0,o.jsx)(d.A,{title:e("common.confirm"),onConfirm:()=>{W(n)},children:(0,o.jsx)(c.Ay,{type:"text",danger:!0,icon:(0,o.jsx)(b.A,{})})},"delete")],children:(0,o.jsx)(a.A.Item.Meta,{title:(0,o.jsxs)(p.A,{children:[n.name,(0,o.jsx)(u.A,{children:n.id})]}),description:(0,o.jsxs)(p.A,{direction:"vertical",children:[(0,o.jsx)("span",{children:n.description}),(0,o.jsx)("span",{children:"prompt"===n.type?n.executionType:n.processingType}),(0,o.jsx)("span",{children:n.resourceId||"-"})]})})})});return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsx)(m.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,o.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle mb-1",children:e("roles.title")}),(0,o.jsx)("p",{className:"pageDesc mb-0",children:e("roles.description")})]}),(0,o.jsxs)(p.A,{children:[(0,o.jsx)(c.Ay,{icon:(0,o.jsx)(T.A,{}),onClick:()=>X(void 0,"file"),children:e("roles.newFileRole")}),(0,o.jsx)(c.Ay,{icon:(0,o.jsx)(T.A,{}),onClick:()=>X(void 0,"prompt"),children:e("roles.newPromptRole")}),(0,o.jsx)(c.Ay,{type:"primary",icon:(0,o.jsx)(T.A,{}),onClick:()=>z(),children:e("roles.newConfig")})]})]})}),(0,o.jsxs)(y.A,{gutter:[16,16],children:[(0,o.jsx)(h.A,{xs:24,lg:12,children:(0,o.jsx)(m.A,{title:e("roles.fileRoles"),children:G("file")})}),(0,o.jsx)(h.A,{xs:24,lg:12,children:(0,o.jsx)(m.A,{title:e("roles.promptRoles"),children:G("prompt")})}),(0,o.jsx)(h.A,{xs:24,children:(0,o.jsx)(m.A,{title:e("roles.configs"),children:(0,o.jsx)(a.A,{dataSource:k,locale:{emptyText:(0,o.jsx)(l.A,{description:e("common.noData")})},renderItem:n=>(0,o.jsx)(a.A.Item,{actions:[(0,o.jsx)(c.Ay,{type:"text",icon:(0,o.jsx)(A.A,{}),onClick:()=>z(n)},"edit"),(0,o.jsx)(d.A,{title:e("common.confirm"),onConfirm:()=>{B(n.id)},children:(0,o.jsx)(c.Ay,{type:"text",danger:!0,icon:(0,o.jsx)(b.A,{})})},"delete")],children:(0,o.jsx)(a.A.Item.Meta,{title:(0,o.jsxs)(p.A,{children:[n.name,(0,o.jsx)(u.A,{children:n.id})]}),description:"".concat(e("roles.fileRoles"),": ").concat(n.fileRoles.length," \xb7 ").concat(e("roles.promptRoles"),": ").concat(n.promptRoles.length)})})})})})]}),(0,o.jsx)(f.A,{title:e("roles.roleEditor"),open:J,onOk:()=>{V()},onCancel:()=>U(!1),centered:!0,okText:e("common.save"),children:(0,o.jsxs)(s.A,{form:t,layout:"vertical",children:[(0,o.jsx)(s.A.Item,{name:"type",label:e("roles.roleType"),rules:[{required:!0}],children:(0,o.jsx)(x.A,{options:[{label:e("roles.fileRole"),value:"file"},{label:e("roles.promptRole"),value:"prompt"}]})}),(0,o.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(j.A,{disabled:!0})}),(0,o.jsx)(s.A.Item,{name:"name",label:e("roles.roleName"),rules:[{required:!0}],children:(0,o.jsx)(j.A,{})}),(0,o.jsx)(s.A.Item,{name:"description",label:e("roles.roleDescription"),children:(0,o.jsx)(j.A,{})}),(0,o.jsx)(s.A.Item,{noStyle:!0,shouldUpdate:(e,n)=>e.type!==n.type,children:n=>{let{getFieldValue:t}=n;return"prompt"===t("type")?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.A.Item,{name:"executionType",label:e("roles.executionType"),rules:[{required:!0}],children:(0,o.jsx)(x.A,{options:[{label:e("roles.factExtraction"),value:"fact_extraction"},{label:e("roles.chapterGeneration"),value:"chapter_generation"},{label:e("roles.validation"),value:"validation"},{label:e("roles.formatting"),value:"formatting"},{label:e("roles.reference"),value:"reference"}]})}),(0,o.jsx)(s.A.Item,{name:"resourceId",label:e("roles.bindPrompt"),children:(0,o.jsx)(x.A,{showSearch:!0,options:E.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.A.Item,{name:"processingType",label:e("roles.processingType"),rules:[{required:!0}],children:(0,o.jsx)(x.A,{options:[{label:e("roles.ruleFile"),value:"rule"},{label:e("roles.projectFactFile"),value:"project_fact"},{label:e("roles.tableFile"),value:"table"},{label:e("roles.drawingFile"),value:"drawing"},{label:e("roles.specificationFile"),value:"specification"},{label:e("roles.reference"),value:"reference"}]})}),(0,o.jsx)(s.A.Item,{name:"resourceId",label:e("roles.bindFile"),children:(0,o.jsx)(x.A,{showSearch:!0,options:N.map(e=>({label:e.relativePath,value:e.relativePath}))})})]})}})]})}),(0,o.jsx)(f.A,{title:e("roles.configEditor"),open:F,onOk:()=>{H()},onCancel:()=>D(!1),width:820,centered:!0,okText:e("common.save"),children:(0,o.jsxs)(s.A,{form:S,layout:"vertical",children:[(0,o.jsxs)(y.A,{gutter:12,children:[(0,o.jsx)(h.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(j.A,{disabled:!0})})}),(0,o.jsx)(h.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"name",label:e("roles.configName"),rules:[{required:!0}],children:(0,o.jsx)(j.A,{})})}),(0,o.jsx)(h.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"description",label:e("roles.configDescription"),children:(0,o.jsx)(j.A,{})})})]}),(0,o.jsx)(g.A,{items:[{key:"file",label:e("roles.fileRoles"),children:(0,o.jsx)(s.A.List,{name:"fileRoles",children:(n,t)=>{let{add:i,remove:r}=t;return(0,o.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[n.map((e,n)=>(0,o.jsxs)(y.A,{gutter:8,children:[(0,o.jsx)(h.A,{span:16,children:(0,o.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],children:(0,o.jsx)(x.A,{options:_.map(e=>({label:e.name,value:e.id}))})})}),(0,o.jsx)(h.A,{span:6,children:(0,o.jsx)(s.A.Item,{name:[e.name,"order"],initialValue:n,children:(0,o.jsx)(j.A,{type:"number"})})}),(0,o.jsx)(h.A,{span:2,children:(0,o.jsx)(c.Ay,{danger:!0,onClick:()=>r(e.name),children:"-"})})]},e.key)),(0,o.jsx)(c.Ay,{onClick:()=>i({order:n.length}),children:e("roles.addRole")})]})}})},{key:"prompt",label:e("roles.promptRoles"),children:(0,o.jsx)(s.A.List,{name:"promptRoles",children:(n,t)=>{let{add:i,remove:r}=t;return(0,o.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[n.map((e,n)=>(0,o.jsxs)(y.A,{gutter:8,children:[(0,o.jsx)(h.A,{span:16,children:(0,o.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],children:(0,o.jsx)(x.A,{options:q.map(e=>({label:e.name,value:e.id}))})})}),(0,o.jsx)(h.A,{span:6,children:(0,o.jsx)(s.A.Item,{name:[e.name,"order"],initialValue:n,children:(0,o.jsx)(j.A,{type:"number"})})}),(0,o.jsx)(h.A,{span:2,children:(0,o.jsx)(c.Ay,{danger:!0,onClick:()=>r(e.name),children:"-"})})]},e.key)),(0,o.jsx)(c.Ay,{onClick:()=>i({order:n.length}),children:e("roles.addRole")})]})}})}]})]})})]})}}},e=>{e.O(0,[260,544,425,668,227,740,174,492,455,846,636,593,792],()=>e(e.s=3507)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{1307:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"}},1699:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>H});var o=n(5321),c=n(7109),s=n(4668),a=n(5292),r=n(7807),i=n(3455),l=n(8787),d=n(5114),u=n(2256),p=n(8770),m=n(8332),h=n(4253),y=n(6171),f=n(3442),g=n(1702),j=n(7271),x=n(8569),A=n(5258),b=n(4746),v=n(3051),w=n(9650),S=n(8209),C=n(9012),T=n(9071),k=n(1307),I=n(8483);function O(){return(O=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let R=c.forwardRef((e,t)=>c.createElement(I.A,O({},e,{ref:t,icon:k.A})));var E=n(6398);function P(){return(P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let N=c.forwardRef((e,t)=>c.createElement(I.A,P({},e,{ref:t,icon:E.A})));var z=n(2192),L=n(6578),U=n(6644);let{TextArea:J}=s.A,{Paragraph:D}=a.A;function H(){var e,t;let n=(0,U.Vr)(),{message:a}=r.A.useApp(),[k]=i.A.useForm(),[I,O]=(0,c.useState)([]),[E,P]=(0,c.useState)("construction-organization-design"),[H,M]=(0,c.useState)([]),[V,F]=(0,c.useState)([]),[_,q]=(0,c.useState)(!1),[B,G]=(0,c.useState)(null),[W,X]=(0,c.useState)(""),[Q,Z]=(0,c.useState)([]),[K,Y]=(0,c.useState)(!1),[$,ee]=(0,c.useState)(null),[et,en]=(0,c.useState)(!1),eo=async()=>{try{Z((await (0,L.q7)()).drafts)}catch(e){Z([])}};(0,c.useEffect)(()=>{(0,L.Dl)().then(e=>{var t,n;O(e.templates),P(null!=(n=null==(t=e.templates[0])?void 0:t.id)?n:"construction-organization-design")}).catch(()=>a.error(n("common.error"))),(0,L.lv)().then(e=>{M(e.roles),F(e.configs)}).catch(()=>{M([]),F([])}),eo()},[a,n]);let ec=(0,c.useMemo)(()=>I.find(e=>e.id===E),[I,E]),es=V.map(e=>({label:e.name,value:e.id})),ea=e=>{k.setFieldsValue(null!=e?e:{id:"custom-template-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,chapters:[]}),en(!0)},er=async()=>{try{let e=await k.validateFields(),t=await (0,L.l2)(e);O(t.templates),P(t.template.id),en(!1),a.success(n("common.success"))}catch(e){e instanceof Error&&a.error(e.message)}},ei=async e=>{try{let t=await (0,L.bV)(e);O(t.templates),P(t.template.id),a.success(n("common.success"))}catch(e){a.error(n("common.error"))}},el=async e=>{try{var t,o;let c=await (0,L.h0)(e);O(c.templates),P(null!=(o=null==(t=c.templates[0])?void 0:t.id)?o:""),a.success(n("common.success"))}catch(e){a.error(n("common.error"))}},ed=async()=>{if(E){q(!0);try{let e=await (0,L.OX)({templateId:E});G(e.draft),X(e.draft.markdown),a.success(n("common.success"))}catch(e){a.error(e instanceof Error?e.message:n("common.error"))}finally{q(!1)}}},eu=async e=>{if(B){Y(!0);try{var t=await (0,L.UE)({title:B.title,markdown:W,format:e,enforceGate:"pdf"===e,exportGate:B.exportGate}),o="".concat(B.title,".").concat("markdown"===e?"md":e);let n=URL.createObjectURL(t),c=document.createElement("a");c.href=n,c.download=o,c.click(),URL.revokeObjectURL(n)}catch(e){a.error(n("common.error"))}finally{Y(!1)}}},ep=async()=>{if(B)try{let e=await (0,L.Af)({...B,markdown:W});G(e.draft),await eo(),a.success(n("common.success"))}catch(e){a.error(n("common.error"))}},em=async e=>{if(B){ee(e.id);try{var t;let o=await (0,L.R1)({templateId:B.templateId,chapterId:e.id}),c=B.chapters.map(t=>t.id===e.id?o.chapter:t);G({...B,chapters:c}),t=o.chapter,X(n=>n.includes(e.content)?n.replace(e.content,t.content):"".concat(n,"\n\n").concat(t.content)),a.success(n("common.success"))}catch(e){a.error(n("common.error"))}finally{ee(null)}}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsx)(l.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,o.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle mb-1",children:n("documents.title")}),(0,o.jsx)("p",{className:"pageDesc mb-0",children:n("documents.description")})]}),(0,o.jsx)(d.Ay,{type:"primary",size:"large",icon:(0,o.jsx)(b.A,{}),onClick:()=>ea(),children:n("documents.newTemplate")})]})}),(0,o.jsxs)(u.A,{gutter:[16,16],align:"top",children:[(0,o.jsxs)(p.A,{xs:24,lg:8,children:[(0,o.jsx)(l.A,{size:"small",title:n("documents.templateLibrary"),children:(0,o.jsx)(m.A,{dataSource:I,locale:{emptyText:(0,o.jsx)(h.A,{description:n("common.noData")})},renderItem:e=>(0,o.jsx)(m.A.Item,{onClick:()=>P(e.id),className:"cursor-pointer",actions:[(0,o.jsx)(d.Ay,{size:"small",type:"text",icon:(0,o.jsx)(v.A,{}),onClick:t=>{t.stopPropagation(),ei(e.id)}},"copy"),(0,o.jsx)(d.Ay,{size:"small",type:"text",icon:(0,o.jsx)(w.A,{}),disabled:e.builtIn,onClick:t=>{t.stopPropagation(),ea(e)}},"edit"),(0,o.jsx)(y.A,{title:n("documents.deleteTemplateConfirm"),disabled:e.builtIn,onConfirm:t=>{null==t||t.stopPropagation(),el(e.id)},children:(0,o.jsx)(d.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(S.A,{}),disabled:e.builtIn,onClick:e=>e.stopPropagation()})},"delete")],children:(0,o.jsx)(m.A.Item.Meta,{avatar:(0,o.jsx)(C.A,{}),title:(0,o.jsxs)(f.A,{children:[(0,o.jsx)("span",{children:e.name}),e.builtIn&&(0,o.jsx)(g.A,{children:n("documents.builtIn")}),E===e.id&&(0,o.jsx)(g.A,{color:"blue",children:n("documents.selected")})]}),description:(0,o.jsxs)(f.A,{direction:"vertical",size:2,children:[(0,o.jsx)("span",{children:e.description}),(0,o.jsx)(g.A,{children:e.category})]})})})})}),(0,o.jsx)(l.A,{className:"mt-4",size:"small",title:n("documents.draftHistory"),children:(0,o.jsx)(m.A,{size:"small",dataSource:Q.slice(0,8),locale:{emptyText:(0,o.jsx)(h.A,{description:n("common.noData")})},renderItem:e=>(0,o.jsx)(m.A.Item,{onClick:()=>{G(e),X(e.markdown),P(e.templateId)},className:"cursor-pointer",children:(0,o.jsx)(m.A.Item.Meta,{title:e.title,description:new Date(e.updatedAt).toLocaleString()})})})})]}),(0,o.jsx)(p.A,{xs:24,lg:16,children:(0,o.jsx)(l.A,{size:"small",title:n("documents.workflow"),children:(0,o.jsxs)(f.A,{direction:"vertical",className:"w-full",size:"middle",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"block mb-1",children:n("documents.template")}),(0,o.jsx)(j.A,{className:"w-full",value:E,onChange:P,options:I.map(e=>({label:e.name,value:e.id}))})]}),ec&&(0,o.jsxs)(l.A,{size:"small",type:"inner",title:ec.outputTitle,children:[(0,o.jsx)(D,{children:ec.description}),(0,o.jsx)(f.A,{wrap:!0,children:ec.projectRoleConfigId?(0,o.jsx)(g.A,{color:"geekblue",children:(null==(e=V.find(e=>e.id===ec.projectRoleConfigId))?void 0:e.name)||ec.projectRoleConfigId}):(0,o.jsx)(g.A,{color:"warning",children:n("documents.noRoleConfig")})})]}),ec&&(0,o.jsx)(f.A,{direction:"vertical",size:4,children:(0,o.jsxs)("span",{children:[n("documents.projectRoleConfig"),": ",(null==(t=V.find(e=>e.id===ec.projectRoleConfigId))?void 0:t.name)||n("documents.noRoleConfig")]})}),(0,o.jsx)(d.Ay,{type:"primary",size:"large",block:!0,icon:(0,o.jsx)(T.A,{}),loading:_,disabled:!(null==ec?void 0:ec.projectRoleConfigId),onClick:()=>{ed()},children:n("documents.generate")})]})})})]}),(0,o.jsx)(l.A,{size:"small",title:n("documents.editor"),extra:(0,o.jsx)(f.A,{wrap:!0,children:B&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(R,{}),onClick:()=>{ep()},children:n("documents.saveDraft")}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(N,{}),loading:K,onClick:()=>{eu("markdown")},children:n("documents.downloadMarkdown")}),(0,o.jsx)(d.Ay,{loading:K,onClick:()=>{eu("html")},children:n("documents.exportHtml")}),(0,o.jsx)(d.Ay,{type:"primary",loading:K,onClick:()=>{eu("pdf")},children:n("documents.exportPdf")})]})}),children:B?(0,o.jsx)(x.A,{items:[{key:"edit",label:n("documents.edit"),children:(0,o.jsx)(J,{rows:26,value:W,onChange:e=>X(e.target.value)})},{key:"chapters",label:n("documents.chapters"),children:(0,o.jsx)(m.A,{dataSource:B.chapters,renderItem:e=>(0,o.jsx)(m.A.Item,{actions:[(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(z.A,{}),loading:$===e.id,onClick:()=>{em(e)},children:n("documents.regenerateChapter")},"regen")],children:(0,o.jsx)(m.A.Item.Meta,{title:e.title,description:(0,o.jsxs)(f.A,{direction:"vertical",children:[(0,o.jsxs)("span",{children:[n("documents.evidenceCount"),": ",e.evidence.length]}),(0,o.jsxs)("span",{children:[n("documents.missingCount"),": ",e.missingFacts.length]})]})})})})},{key:"facts",label:n("documents.structuredFacts"),children:(0,o.jsx)(m.A,{dataSource:B.structuredFacts,renderItem:e=>{var t;return(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)(m.A.Item.Meta,{title:"".concat(e.key,": ").concat(e.value),description:"".concat(e.sourceFile," \xb7 ").concat((null==(t=H.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId)}),(0,o.jsx)(g.A,{children:e.confidence.toFixed(2)})]})}})},{key:"sources",label:n("documents.sources"),children:(0,o.jsx)(m.A,{dataSource:B.sources,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)("span",{children:e.filePath}),(0,o.jsx)(g.A,{children:e.count})]})})},{key:"missing",label:n("documents.missingItems"),children:0===B.missingItems.length?(0,o.jsx)(h.A,{description:n("common.noData")}):(0,o.jsx)(m.A,{dataSource:B.missingItems,renderItem:e=>(0,o.jsx)(m.A.Item,{children:e})})},{key:"validation",label:n("documents.validation"),children:(0,o.jsx)(f.A,{direction:"vertical",className:"w-full",children:B.validationIssues.map(e=>(0,o.jsxs)(g.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:[e.message,e.suggestion?":".concat(e.suggestion):""]},e.message))})},{key:"gate",label:n("documents.exportGate"),children:(0,o.jsx)(m.A,{dataSource:B.exportGate.checklist,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)("span",{children:e.label}),(0,o.jsx)(g.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})},{key:"stages",label:n("documents.executionStages"),children:(0,o.jsx)(m.A,{dataSource:B.executionStages,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)(m.A.Item.Meta,{title:"".concat(e.type," \xb7 ").concat(e.roleId),description:e.message}),(0,o.jsx)(g.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"warning",children:e.status})]})})}]}):(0,o.jsx)(h.A,{description:n("documents.noDraft")})}),(0,o.jsx)(A.A,{title:n("documents.templateEditor"),open:et,onOk:()=>{er()},onCancel:()=>en(!1),width:760,centered:!0,okText:n("common.save"),children:(0,o.jsxs)(i.A,{form:k,layout:"vertical",requiredMark:"optional",children:[(0,o.jsxs)(u.A,{gutter:12,children:[(0,o.jsx)(p.A,{xs:24,md:8,children:(0,o.jsx)(i.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(s.A,{disabled:!0})})}),(0,o.jsx)(p.A,{xs:24,md:8,children:(0,o.jsx)(i.A.Item,{name:"name",label:n("documents.templateName"),rules:[{required:!0}],children:(0,o.jsx)(s.A,{})})}),(0,o.jsx)(p.A,{xs:24,md:8,children:(0,o.jsx)(i.A.Item,{name:"category",label:n("documents.templateCategory"),children:(0,o.jsx)(s.A,{})})}),(0,o.jsx)(p.A,{xs:24,md:12,children:(0,o.jsx)(i.A.Item,{name:"outputTitle",label:n("documents.outputTitle"),children:(0,o.jsx)(s.A,{})})}),(0,o.jsx)(p.A,{xs:24,md:12,children:(0,o.jsx)(i.A.Item,{name:"description",label:n("documents.templateDescription"),children:(0,o.jsx)(s.A,{})})})]}),(0,o.jsx)(i.A.Item,{name:"projectRoleConfigId",label:n("documents.projectRoleConfig"),rules:[{required:!0,message:n("documents.projectRoleConfigRequired")}],children:(0,o.jsx)(j.A,{showSearch:!0,placeholder:n("documents.projectRoleConfigRequired"),options:es})})]})})]})}},2192:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var o=n(7109),c=n(4995),s=n(8483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let r=o.forwardRef((e,t)=>o.createElement(s.A,a({},e,{ref:t,icon:c.A})))},2887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},4995:(e,t)=>{"use strict";t.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"}},6398:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"}},6403:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return n(1699)}])},6578:(e,t,n)=>{"use strict";async function o(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function c(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function s(e){var t,n;let c=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&c.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&c.set("category",e.category),(null==e?void 0:e.page)&&c.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&c.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(c))}async function a(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function r(e,t){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function i(e,t,n){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function j(){return o("/api/kb/features")}async function x(e,t){var n,c,s,a,r;let i=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&i.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&i.set("category",t.category),(null==t?void 0:t.limit)&&i.set("limit",String(null!=(r=t.limit)?r:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&i.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(c=t.weights)?void 0:c.vector)!=null&&i.set("vectorWeight",String(t.weights.vector)),(null==t||null==(s=t.weights)?void 0:s.rewrite)!=null&&i.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(a=t.weights)?void 0:a.hybridBonus)!=null&&i.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(i))}async function A(){return o("/api/prompt")}async function b(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function v(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function S(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function T(){return o("/api/documents/templates")}async function k(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function I(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function R(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(){return o("/api/documents/drafts")}async function N(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function z(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function L(){return o("/api/config/providers")}async function U(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function J(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function D(){return o("/api/config/models")}async function H(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function M(){return o("/api/config/embedding")}async function V(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function F(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function _(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function q(){return o("/api/system/stats")}async function B(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function G(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function W(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function X(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Q(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function Z(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function K(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>N,Bh:()=>K,Dl:()=>T,E:()=>X,FC:()=>q,FV:()=>w,H1:()=>g,H7:()=>m,HC:()=>r,HT:()=>s,II:()=>M,NR:()=>S,OX:()=>R,PH:()=>W,QT:()=>u,Qx:()=>p,R1:()=>E,SJ:()=>y,UE:()=>z,VW:()=>j,W2:()=>x,X8:()=>f,Z3:()=>L,_m:()=>U,aP:()=>H,bV:()=>O,bZ:()=>_,c1:()=>d,dd:()=>V,dg:()=>v,dw:()=>C,dx:()=>A,h0:()=>I,h1:()=>J,hc:()=>c,hn:()=>B,l2:()=>k,lv:()=>b,p:()=>G,q7:()=>P,tn:()=>i,u6:()=>F,xC:()=>a,xq:()=>h,xw:()=>Q,zo:()=>Z,zr:()=>D})},8847:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"}},9012:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var o=n(7109),c=n(2887),s=n(8483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let r=o.forwardRef((e,t)=>o.createElement(s.A,a({},e,{ref:t,icon:c.A})))},9071:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var o=n(7109),c=n(8847),s=n(8483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let r=o.forwardRef((e,t)=>o.createElement(s.A,a({},e,{ref:t,icon:c.A})))}},e=>{e.O(0,[260,544,425,668,227,740,174,492,455,292,846,636,593,792],()=>e(e.s=6403)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[12],{4183:(e,n,u)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge",function(){return u(7354)}])},6109:(e,n,u)=>{e.exports=u(7212)},7354:(e,n,u)=>{"use strict";u.r(n),u.d(n,{default:()=>r});var _=u(7109),t=u(6109);function r(){let e=(0,t.useRouter)();return(0,_.useEffect)(()=>{e.replace("/knowledge/manage")},[e]),null}}},e=>{e.O(0,[636,593,792],()=>e(e.s=4183)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46],{69:(e,l)=>{"use strict";l.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5L255.8 713.6l-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l110.3 111.2c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.1 304.1 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112m161.2 465.2C726.2 620.3 668.9 644 608 644s-118.2-23.7-161.2-66.8C403.7 534.2 380 476.9 380 416s23.7-118.2 66.8-161.2c43-43.1 100.3-66.8 161.2-66.8s118.2 23.7 161.2 66.8c43.1 43 66.8 100.3 66.8 161.2s-23.7 118.2-66.8 161.2"}}]},name:"key",theme:"outlined"}},289:(e,l)=>{"use strict";l.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"}},2256:(e,l,a)=>{"use strict";a.d(l,{A:()=>t});let t=a(5341).A},2323:e=>{e.exports={cardMeta:"style_cardMeta__6KOa3",cardName:"style_cardName__WcLAf",cardAction:"style_cardAction__XUfPD",cardMain:"style_cardMain__qI1jU",providerCard:"style_providerCard__tLKGs",providerGrid:"style_providerGrid__Gx5GR",urlLine:"style_urlLine__DuMYs",tierDesc:"style_tierDesc__wOd6p",modelTags:"style_modelTags__nmMVj"}},3214:(e,l)=>{"use strict";l.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"}},4190:(e,l,a)=>{"use strict";a.d(l,{A:()=>r});var t=a(7109),o=a(3214),s=a(8483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var a=arguments[l];for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t])}return e}).apply(this,arguments)}let r=t.forwardRef((e,l)=>t.createElement(s.A,n({},e,{ref:l,icon:o.A})))},7305:(e,l,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return a(9526)}])},8770:(e,l,a)=>{"use strict";a.d(l,{A:()=>t});let t=a(1916).A},9526:(e,l,a)=>{"use strict";a.r(l),a.d(l,{default:()=>ei});var t=a(5321),o=a(7109),s=a(6644),n=a(7807),r=a(5114),i=a(8787),c=a(2256),d=a(8770),m=a(3442),p=a(6171),u=a(9188),h=a(4216),v=a(5042),x=a(7137),g=a(2188),A=a(7189),y=a(505),j=a(3638),b=a(2162),f=a(6047),C=a(4567),w=a(5561),$=a(7961),N=a(540);let I=(e,l,a)=>({background:e,[`${a}-icon`]:{color:l}}),_=(0,N.OF)("Alert",e=>[(e=>{let{componentCls:l,motionDurationSlow:a,marginXS:t,marginSM:o,fontSize:s,fontSizeLG:n,lineHeight:r,borderRadiusLG:i,motionEaseInOutCirc:c,withDescriptionIconSize:d,colorText:m,colorTextHeading:p,withDescriptionPadding:u,defaultPadding:h,lineWidth:v,lineType:x,colorSuccessBorder:g,colorWarningBorder:A,colorErrorBorder:y,colorInfoBorder:j}=e;return{[l]:{...(0,$.dF)(e),position:"relative",display:"flex",alignItems:"center",padding:h,wordWrap:"break-word",borderRadius:i,borderWidth:(0,w.zA)(v),borderStyle:x,[`&${l}-success`]:{borderColor:g},[`&${l}-info`]:{borderColor:j},[`&${l}-warning`]:{borderColor:A},[`&${l}-error`]:{borderColor:y},[`&${l}-filled`]:{borderColor:"transparent"},[`&${l}-rtl`]:{direction:"rtl"},[`${l}-section`]:{flex:1,minWidth:0},[`${l}-icon`]:{marginInlineEnd:t,lineHeight:0},"&-description":{display:"none",fontSize:s,lineHeight:r},"&-title":{color:p},[`&${l}-motion-leave`]:{overflow:"hidden",opacity:1,transition:["max-height","opacity","padding-top","padding-bottom","margin-bottom"].map(e=>`${e} ${a} ${c}`).join(", ")},[`&${l}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0},[`&${l}-with-description`]:{alignItems:"flex-start",padding:u,[`${l}-icon`]:{marginInlineEnd:o,fontSize:d,lineHeight:0},[`${l}-title`]:{display:"block",marginBottom:t,color:p,fontSize:n},[`${l}-description`]:{display:"block",color:m}},[`&${l}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}}})(e),(e=>{let{componentCls:l,colorSuccess:a,colorSuccessBg:t,colorWarning:o,colorWarningBg:s,colorError:n,colorErrorBg:r,colorInfo:i,colorInfoBg:c}=e;return{[l]:{"&-success":I(t,a,l),"&-info":I(c,i,l),"&-warning":I(s,o,l),"&-error":{...I(r,n,l),[`${l}-description > pre`]:{margin:0,padding:0}}}}})(e),(e=>{let{componentCls:l,iconCls:a,motionDurationMid:t,marginXS:o,fontSizeIcon:s,colorIcon:n,colorIconHover:r}=e;return{[l]:{[`${l}-actions`]:{marginInlineStart:o},[`${l}-close-icon`]:{marginInlineStart:o,padding:0,overflow:"hidden",fontSize:s,lineHeight:(0,w.zA)(s),backgroundColor:"transparent",border:"none",cursor:"pointer",...(0,$.K8)(e),[`${a}-close`]:{color:n,transition:`color ${t}`,"&:hover":{color:r}}},"&-close-text":{color:n,transition:`color ${t}`,"&:hover":{color:r}}}}})(e)],e=>({withDescriptionIconSize:e.fontSizeHeading3,defaultPadding:`${e.paddingContentVerticalSM}px 12px`,withDescriptionPadding:`${e.paddingMD}px ${e.paddingContentHorizontalLG}px`})),z=e=>{let{icon:l,type:a,className:t,style:s,successIcon:n,infoIcon:r,warningIcon:i,errorIcon:c}=e,d={success:n??o.createElement(u.A,null),info:r??o.createElement(g.A,null),error:c??o.createElement(h.A,null),warning:i??o.createElement(x.A,null)};return o.createElement("span",{className:t,style:s},l??d[a])},E=e=>{let{isClosable:l,prefixCls:a,closeIcon:t,handleClose:s,ariaProps:n,className:r,style:i}=e,c=!0===t||void 0===t?o.createElement(v.A,null):t;return l?o.createElement("button",{type:"button",onClick:s,className:(0,j.$)(`${a}-close-icon`,r),tabIndex:0,style:i,...n},c):null},S=o.forwardRef((e,l)=>{let{description:a,prefixCls:t,message:s,title:n,banner:r,className:i,rootClassName:c,style:d,onMouseEnter:m,onMouseLeave:p,onClick:u,afterClose:h,showIcon:v,closable:x,closeText:g,closeIcon:w,action:$,id:N,styles:I,classNames:S,...M}=e,P=n??s,[k,K]=o.useState(!1),O=o.useRef(null);o.useImperativeHandle(l,()=>({nativeElement:O.current}));let{getPrefixCls:H,direction:R,variant:D,closable:L,closeIcon:U,className:T,style:B,classNames:V,styles:F,successIcon:G,infoIcon:X,warningIcon:Q,errorIcon:W}=(0,C.TP)("alert"),Z=H("alert",t),[q,Y]=_(Z),{onClose:J,afterClose:ee}=(0,f.Qd)(x)?x:{},el=l=>{K(!0),(J??e.onClose)?.(l)},ea=o.useMemo(()=>void 0!==e.type?e.type:r?"warning":"info",[e.type,r]),et=e.variant??D??"outlined",eo=o.useMemo(()=>!!(0,f.Qd)(x)&&!!x.closeIcon||!!g||("boolean"==typeof x?x:!!(!1!==w&&(0,f.R)(w))||!!L),[g,w,x,L]),es=!!r&&void 0===v||v,en={...e,prefixCls:Z,variant:et,type:ea,showIcon:es,closable:eo},er=(0,b.XT)(B),ei=(0,b.XT)(d),[ec,ed]=(0,b.AV)([V,S],[F,er,I,ei],{props:en}),em=(0,j.$)(Z,`${Z}-${ea}`,`${Z}-${et}`,{[`${Z}-with-description`]:!!a,[`${Z}-no-icon`]:!es,[`${Z}-banner`]:!!r,[`${Z}-rtl`]:"rtl"===R},T,i,c,ec.root,Y,q),ep=(0,y.KE)(M,{aria:!0,data:!0}),eu=o.useMemo(()=>(0,f.Qd)(x)&&x.closeIcon?x.closeIcon:g||(void 0!==w?w:(0,f.Qd)(L)&&L.closeIcon?L.closeIcon:U),[w,x,L,g,U]),eh=o.useMemo(()=>{let e=x??L;return(0,f.Qd)(e)?(0,y.KE)(e,{data:!0,aria:!0}):{}},[x,L]);return o.createElement(A.Ay,{visible:!k,motionName:`${Z}-motion`,motionAppear:!1,motionEnter:!1,onLeaveStart:e=>({maxHeight:e.offsetHeight}),onLeaveEnd:ee??h},({className:l,style:t},s)=>o.createElement("div",{id:N,ref:(0,y.K4)(O,s),"data-show":!k,className:(0,j.$)(em,l),style:{...ed.root,...t},onMouseEnter:m,onMouseLeave:p,onClick:u,role:"alert",...ep},es?o.createElement(z,{className:(0,j.$)(`${Z}-icon`,ec.icon),style:ed.icon,description:a,icon:e.icon,prefixCls:Z,type:ea,successIcon:G,infoIcon:X,warningIcon:Q,errorIcon:W}):null,o.createElement("div",{className:(0,j.$)(`${Z}-section`,ec.section),style:ed.section},P?o.createElement("div",{className:(0,j.$)(`${Z}-title`,ec.title),style:ed.title},P):null,a?o.createElement("div",{className:(0,j.$)(`${Z}-description`,ec.description),style:ed.description},a):null),$?o.createElement("div",{className:(0,j.$)(`${Z}-actions`,ec.actions),style:ed.actions},$):null,o.createElement(E,{className:ec.close,style:ed.close,isClosable:eo,prefixCls:Z,closeIcon:eu,handleClose:el,ariaProps:eh})))});var M=a(1113),P=a(9939),k=a(218),K=a(3076),O=a(3784),H=a(5472);let R=function(e){function l(){var e,a,t;return(0,M.A)(this,l),a=l,t=arguments,a=(0,k.A)(a),(e=(0,O.A)(this,(0,K.A)()?Reflect.construct(a,t||[],(0,k.A)(this).constructor):a.apply(this,t))).state={error:void 0,info:{}},e}return(0,H.A)(l,e),(0,P.A)(l,[{key:"componentDidCatch",value:function(e,l){this.setState({error:e,info:l})}},{key:"render",value:function(){let{message:e,title:l,description:a,id:t,children:s}=this.props,{error:n,info:r}=this.state,i=l??e,c=r?.componentStack||null,d=(0,f.R)(i)?i:n?.toString(),m=(0,f.R)(a)?a:c;return n?o.createElement(S,{id:t,type:"error",title:d,description:o.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},m)}):s}}])}(o.PureComponent);S.ErrorBoundary=R;var D=a(3455),L=a(7271),U=a(4668),T=a(4992),B=a(1702),V=a(5258),F=a(4746),G=a(9071),X=a(3114),Q=a(9650),W=a(8209),Z=a(69),q=a(8483);function Y(){return(Y=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var a=arguments[l];for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t])}return e}).apply(this,arguments)}let J=o.forwardRef((e,l)=>o.createElement(q.A,Y({},e,{ref:l,icon:Z.A})));var ee=a(289);function el(){return(el=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var a=arguments[l];for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t])}return e}).apply(this,arguments)}let ea=o.forwardRef((e,l)=>o.createElement(q.A,el({},e,{ref:l,icon:ee.A})));var et=a(6578),eo=a(2323),es=a.n(eo);let en=[{label:"OpenAI 兼容",value:"openai"},{label:"Anthropic",value:"anthropic"},{label:"Google",value:"google"},{label:"Ollama",value:"ollama"},{label:"OpenRouter",value:"openrouter"}],er=[{key:"reader",labelKey:"models.tierReader",descKey:"models.tierReaderDesc"},{key:"reasoning",labelKey:"models.tierReasoning",descKey:"models.tierReasoningDesc"},{key:"action",labelKey:"models.tierAction",descKey:"models.tierActionDesc"}];function ei(){let e=(0,s.Vr)(),{message:l}=n.A.useApp(),a=[{label:e("models.embeddingProviderHash"),value:"hash"},{label:e("models.embeddingProviderOpenAI"),value:"openai-compatible"}],[v,x]=(0,o.useState)(!0),[g,A]=(0,o.useState)([]),[y,j]=(0,o.useState)(null),[b,f]=(0,o.useState)({provider:"hash",dimensions:384}),[C,w]=(0,o.useState)(!1),[$,N]=(0,o.useState)(!1),[I,_]=(0,o.useState)(null),[z,E]=(0,o.useState)(!1),[M,P]=(0,o.useState)(""),[k,K]=(0,o.useState)(""),[O,H]=(0,o.useState)(""),[R,Z]=(0,o.useState)("openai"),[q,Y]=(0,o.useState)(!1),[ee,el]=(0,o.useState)(!1),[eo,ei]=(0,o.useState)(""),[ec,ed]=(0,o.useState)(""),[em,ep]=(0,o.useState)(""),[eu,eh]=(0,o.useState)(""),[ev,ex]=(0,o.useState)("openai"),[eg,eA]=(0,o.useState)(!1),[ey,ej]=(0,o.useState)(null),[eb,ef]=(0,o.useState)({}),eC=async()=>{x(!0);try{let[e,l,a]=await Promise.all([(0,et.Z3)().catch(()=>[]),(0,et.zr)().catch(()=>null),(0,et.II)().catch(()=>({provider:"hash",dimensions:384}))]);A(e),j(l),f(a)}catch(a){l.error(e("common.error"))}finally{x(!1)}};(0,o.useEffect)(()=>{eC()},[]);let ew=async()=>{if(M.trim()){Y(!0);try{await (0,et._m)(M.trim(),{apiKey:k||void 0,baseUrl:O||void 0,protocol:R}),E(!1),P(""),K(""),H(""),Z("openai"),await eC(),l.success(e("common.success"))}catch(a){l.error(e("common.error"))}finally{Y(!1)}}},e$=async a=>{try{await (0,et.h1)(a),await eC(),l.success(e("common.success"))}catch(a){l.error(e("common.error"))}},eN=async e=>{ei(e.name),ed(e.name),ep("");try{let l=await (0,et.Bh)(e.name);ep(l.apiKey?"••••••••":""),eh(l.baseUrl||""),ex(l.protocol||l.detectedProtocol||"openai")}catch(l){eh(e.baseUrl||""),ex(e.protocol||e.detectedProtocol||"openai")}el(!0)},eI=async()=>{if(ec.trim()){eA(!0);try{let a=em.includes("•")?void 0:em||void 0;await (0,et._m)(ec.trim(),{oldName:eo,apiKey:a,baseUrl:eu||void 0,protocol:ev}),el(!1),ei(""),ed(""),ep(""),eh(""),ex("openai"),await eC(),l.success(e("common.success"))}catch(a){l.error(e("common.error"))}finally{eA(!1)}}},e_=async a=>{ej(a);try{let t=await (0,et.bZ)(a);ef(e=>({...e,[a]:t.success})),l[t.success?"success":"error"](t.success?e("models.connected"):e("models.connectionFailed"))}catch(e){ef(e=>({...e,[a]:!1}))}finally{ej(null)}},ez=async()=>{w(!0);try{let a=await (0,et.dd)(b);f(a),_(null),l.success(e("common.success"))}catch(a){l.error(e("common.error"))}finally{w(!1)}},eE=async()=>{N(!0);try{let a=await (0,et.u6)();_(a.success),l[a.success?"success":"error"](a.message||(a.success?e("models.connected"):e("models.connectionFailed")))}catch(a){_(!1),l.error(e("common.error"))}finally{N(!1)}},eS=async(a,t)=>{if(!y)return;let o={...y},s=o[a];if(!t){s.active="",j(o);try{await (0,et.aP)(o)}catch(a){l.error(e("common.error"))}return}let n=t.indexOf(":"),r=n>=0?t.slice(0,n):t,i=n>=0?t.slice(n+1):t;s.active=i,s.list.some(e=>e.name===i&&e.provider===r)||s.list.push({name:i,provider:r}),j(o);try{await (0,et.aP)(o)}catch(a){l.error(e("common.error"))}};return(0,t.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"pageTitle",children:e("models.title")}),(0,t.jsx)("p",{className:"pageDesc",children:e("models.description")})]}),(0,t.jsx)(r.Ay,{type:"primary",icon:(0,t.jsx)(F.A,{}),onClick:()=>E(!0),children:e("models.addModel")})]}),(0,t.jsx)(i.A,{title:e("models.modelList"),size:"small",loading:v,children:0===g.length?(0,t.jsx)("span",{className:es().cardMeta,children:e("models.noProviders")}):(0,t.jsx)(c.A,{gutter:[12,12],align:"stretch",children:g.map(l=>(0,t.jsx)(d.A,{xs:24,sm:12,lg:8,xl:6,className:es().providerGrid,children:(0,t.jsxs)(i.A,{size:"small",className:es().providerCard,children:[(0,t.jsxs)("div",{className:es().cardAction,children:[(0,t.jsxs)("div",{className:es().cardMain,children:[(0,t.jsx)("div",{className:es().cardName,title:l.name,children:l.name}),(0,t.jsxs)("div",{className:es().cardMeta,children:[(0,t.jsx)(G.A,{})," ",l.protocol||l.detectedProtocol||"openai"]})]}),(0,t.jsxs)(m.A,{size:2,wrap:!1,children:[(0,t.jsx)(r.Ay,{size:"small",type:"text",loading:ey===l.name,onClick:()=>{e_(l.name)},icon:!0===eb[l.name]?(0,t.jsx)(u.A,{className:"text-[var(--colorOk)]"}):!1===eb[l.name]?(0,t.jsx)(h.A,{className:"text-[var(--colorDanger)]"}):(0,t.jsx)(X.A,{})}),(0,t.jsx)(r.Ay,{size:"small",type:"text",icon:(0,t.jsx)(Q.A,{}),onClick:()=>{eN(l)}}),(0,t.jsx)(p.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{e$(l.name)},children:(0,t.jsx)(r.Ay,{size:"small",type:"text",danger:!0,icon:(0,t.jsx)(W.A,{})})})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsxs)("span",{className:"".concat(es().cardMeta," text-xs"),children:[(0,t.jsx)(J,{})," ",l.hasApiKey?"••••••••":"—"]}),l.baseUrl&&(0,t.jsxs)("span",{className:"".concat(es().cardMeta," ").concat(es().urlLine," text-xs"),title:l.baseUrl,children:[(0,t.jsx)(ea,{})," ",l.baseUrl]})]})]})},l.name))})}),(0,t.jsxs)(i.A,{title:e("models.embeddingConfig"),size:"small",loading:v,children:[(0,t.jsx)(S,{className:"mb-4",type:"info",showIcon:!0,message:e("models.embeddingHint")}),(0,t.jsxs)(D.A,{layout:"vertical",size:"middle",children:[(0,t.jsxs)(c.A,{gutter:[12,12],children:[(0,t.jsx)(d.A,{xs:24,lg:8,children:(0,t.jsx)(D.A.Item,{label:e("models.embeddingProvider"),children:(0,t.jsx)(L.A,{value:b.provider,options:a,onChange:e=>f(l=>({...l,provider:e,dimensions:"hash"===e?384:l.dimensions||1024}))})})}),"openai-compatible"===b.provider&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.A,{xs:24,lg:8,children:(0,t.jsx)(D.A.Item,{label:"Base URL",children:(0,t.jsx)(U.A,{value:b.baseUrl,onChange:e=>f(l=>({...l,baseUrl:e.target.value})),placeholder:"http://localhost:11434/v1"})})}),(0,t.jsx)(d.A,{xs:24,lg:8,children:(0,t.jsx)(D.A.Item,{label:e("models.model"),children:(0,t.jsx)(U.A,{value:b.model,onChange:e=>f(l=>({...l,model:e.target.value})),placeholder:"bge-m3"})})}),(0,t.jsx)(d.A,{xs:24,lg:8,children:(0,t.jsx)(D.A.Item,{label:e("models.apiKey"),help:b.hasApiKey?e("models.embeddingApiKeyHint"):void 0,children:(0,t.jsx)(U.A.Password,{value:b.apiKey,onFocus:()=>{var e;(null==(e=b.apiKey)?void 0:e.includes("•"))&&f(e=>({...e,apiKey:""}))},onChange:e=>f(l=>({...l,apiKey:e.target.value})),placeholder:e("models.optional")})})})]}),(0,t.jsx)(d.A,{xs:24,lg:8,children:(0,t.jsx)(D.A.Item,{label:e("models.dimensions"),children:(0,t.jsx)(T.A,{className:"w-full",min:1,value:b.dimensions,onChange:e=>f(l=>({...l,dimensions:Number(e||("hash"===l.provider?384:1024))}))})})}),(0,t.jsx)(d.A,{xs:24,lg:8,children:(0,t.jsx)(D.A.Item,{label:e("models.status"),children:(0,t.jsxs)(m.A,{children:[(0,t.jsx)(B.A,{color:"hash"===b.provider?"default":"blue",children:"hash"===b.provider?e("models.localHash"):e("models.openAICompatible")}),!0===I&&(0,t.jsx)(B.A,{color:"success",children:e("models.connected")}),!1===I&&(0,t.jsx)(B.A,{color:"error",children:e("models.connectionFailed")})]})})})]}),(0,t.jsxs)(m.A,{children:[(0,t.jsx)(r.Ay,{type:"primary",loading:C,onClick:()=>{ez()},children:e("models.saveEmbedding")}),(0,t.jsx)(r.Ay,{icon:(0,t.jsx)(X.A,{}),loading:$,onClick:()=>{eE()},children:e("models.testEmbedding")})]})]})]}),y&&(0,t.jsx)(i.A,{title:e("models.modelTiers"),size:"small",children:(0,t.jsx)(c.A,{gutter:[12,12],children:er.map(a=>{var o;let{key:s,labelKey:n,descKey:r}=a,c=y[s],m=c.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),p=g.filter(e=>!c.list.some(l=>l.provider===e.name)).map(e=>({label:"".concat(e.name," / ").concat(e.name),value:"".concat(e.name,":").concat(e.name)}));return(0,t.jsx)(d.A,{xs:24,lg:8,children:(0,t.jsxs)(i.A,{size:"small",title:e(n),children:[(0,t.jsx)("span",{className:es().tierDesc,children:e(r)}),(0,t.jsx)(L.A,{value:c.active?"".concat((null==(o=c.list.find(e=>e.name===c.active))?void 0:o.provider)||"",":").concat(c.active):void 0,onChange:e=>{eS(s,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),className:"w-full",options:[...m,...p]}),c.list.length>0&&(0,t.jsx)("div",{className:es().modelTags,children:c.list.map(a=>(0,t.jsxs)(B.A,{color:a.name===c.active?"blue":void 0,closable:!0,onClose:()=>{var t,o;let n={...y},r=n[s];r.list=r.list.filter(e=>e.name!==a.name||e.provider!==a.provider),r.active===a.name&&(r.active=null!=(o=null==(t=r.list[0])?void 0:t.name)?o:""),j(n),(0,et.aP)(n).catch(()=>l.error(e("common.error")))},children:[a.provider,"/",a.name]},"".concat(a.provider,":").concat(a.name)))})]})},s)})})}),(0,t.jsx)(V.A,{title:e("models.addModel"),open:z,onCancel:()=>{E(!1),P(""),K(""),H(""),Z("openai")},onOk:()=>{ew()},confirmLoading:q,children:(0,t.jsxs)(D.A,{layout:"vertical",size:"middle",children:[(0,t.jsx)(D.A.Item,{label:e("models.modelName"),children:(0,t.jsx)(U.A,{value:M,onChange:e=>P(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,t.jsx)(D.A.Item,{label:e("models.apiKey"),children:(0,t.jsx)(U.A.Password,{value:k,onChange:e=>K(e.target.value),placeholder:"sk-..."})}),(0,t.jsx)(D.A.Item,{label:e("models.baseUrl"),children:(0,t.jsx)(U.A,{value:O,onChange:e=>H(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,t.jsx)(D.A.Item,{label:e("models.protocol"),children:(0,t.jsx)(L.A,{value:R,onChange:Z,options:en})})]})}),(0,t.jsx)(V.A,{title:e("models.editModel"),open:ee,onCancel:()=>{el(!1),ei(""),ed(""),ep(""),eh(""),ex("openai")},onOk:()=>{eI()},confirmLoading:eg,children:(0,t.jsxs)(D.A,{layout:"vertical",size:"middle",children:[(0,t.jsx)(D.A.Item,{label:e("models.modelName"),children:(0,t.jsx)(U.A,{value:ec,onChange:e=>ed(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,t.jsx)(D.A.Item,{label:e("models.apiKey"),help:e("models.apiKeyEditHint"),children:(0,t.jsx)(U.A.Password,{value:em,onFocus:()=>{em.includes("•")&&ep("")},onCopy:e=>e.preventDefault(),onChange:e=>ep(e.target.value),placeholder:e("models.apiKeyEditPlaceholder")})}),(0,t.jsx)(D.A.Item,{label:e("models.baseUrl"),children:(0,t.jsx)(U.A,{value:eu,onChange:e=>eh(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,t.jsx)(D.A.Item,{label:e("models.protocol"),children:(0,t.jsx)(L.A,{value:ev,onChange:ex,options:en})})]})})]})}}},e=>{e.O(0,[260,544,425,668,740,492,455,992,129,636,593,792],()=>e(e.s=7305)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[449],{3018:(e,s)=>{"use strict";s.A={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-circle",theme:"outlined"}},3139:(e,s,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/overview",function(){return l(3502)}])},3502:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>T});var r=l(5321),t=l(7109),n=l(6644),c=l(2700),a=l(5114),i=l(2256),o=l(8770),d=l(8787),v=l(9605),u=l(4849),x=l(3442),h=l(1702),m=l(6109),j=l(2192),p=l(8200),g=l(8483);function A(){return(A=Object.assign?Object.assign.bind():function(e){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let f=t.forwardRef((e,s)=>t.createElement(g.A,A({},e,{ref:s,icon:p.A})));var y=l(933),w=l(3114),k=l(9071),z=l(9012),b=l(6374);function O(){return(O=Object.assign?Object.assign.bind():function(e){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let C=t.forwardRef((e,s)=>t.createElement(g.A,O({},e,{ref:s,icon:b.A})));var M=l(3018);function N(){return(N=Object.assign?Object.assign.bind():function(e){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let S=t.forwardRef((e,s)=>t.createElement(g.A,N({},e,{ref:s,icon:M.A})));var P=l(6578);function T(){var e,s,l,p,g,A,b,O,M,N,T,_;let E=(0,n.Vr)(),B=(0,m.useRouter)(),[D,F]=(0,t.useState)(null),[L,R]=(0,t.useState)(!0),[V,H]=(0,t.useState)(0),I=(0,t.useCallback)(async()=>{R(!0);try{let[e,s]=await Promise.all([(0,P.FC)(),(0,P.Z3)().catch(()=>[])]);F(e),H(Array.isArray(s)?s.length:0)}catch(e){}finally{R(!1)}},[]);if((0,t.useEffect)(()=>{I();let e=setInterval(()=>{I()},1e4);return()=>clearInterval(e)},[I]),L&&!D)return(0,r.jsx)("div",{className:"flex justify-center py-16",children:(0,r.jsx)(c.A,{size:"large"})});let U=(null!=(s=null==D?void 0:D.cpu.usagePercent)?s:0)>80?"var(--colorDanger)":(null!=(l=null==D?void 0:D.cpu.usagePercent)?l:0)>50?"var(--colorWarning)":"var(--colorOk)",W=(null!=(p=null==D?void 0:D.memory.usagePercent)?p:0)>80?"var(--colorDanger)":(null!=(g=null==D?void 0:D.memory.usagePercent)?g:0)>50?"var(--colorWarning)":"var(--colorOk)",X=(null==D?void 0:D.tasks.total)?Math.round(D.tasks.success/D.tasks.total*100):0,q=null==D||null==(e=D.models)?void 0:e[0];return(0,r.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"pageTitle",children:E("overview.title")}),(0,r.jsx)("p",{className:"pageDesc",children:E("overview.description")})]}),(0,r.jsx)(a.Ay,{icon:(0,r.jsx)(j.A,{spin:L}),loading:L,onClick:()=>{I()},children:E("common.retry")})]}),(0,r.jsxs)(i.A,{gutter:[16,16],children:[(0,r.jsx)(o.A,{xs:24,sm:12,children:(0,r.jsx)(d.A,{size:"small",title:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f,{})," CPU"]}),children:(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)(v.A,{type:"circle",percent:null!=(A=null==D?void 0:D.cpu.usagePercent)?A:0,size:120,strokeColor:U,format:e=>"".concat(null==e?void 0:e.toFixed(1),"%")}),(0,r.jsxs)("div",{className:"text-xs mt-2",style:{color:"var(--colorTextSecondary)"},children:[null!=(b=null==D?void 0:D.cpu.cores)?b:0," ",E("overview.cores")]})]})})}),(0,r.jsx)(o.A,{xs:24,sm:12,children:(0,r.jsx)(d.A,{size:"small",title:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.A,{})," ",E("overview.memory")]}),children:(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)(v.A,{type:"circle",percent:null!=(O=null==D?void 0:D.memory.usagePercent)?O:0,size:120,strokeColor:W,format:e=>"".concat(e,"%")}),(0,r.jsxs)("div",{className:"text-xs mt-2",style:{color:"var(--colorTextSecondary)"},children:[null!=(M=null==D?void 0:D.memory.processMB)?M:0," MB / ",null!=(N=null==D?void 0:D.memory.totalMB)?N:0," MB"]})]})})})]}),(0,r.jsxs)(i.A,{gutter:[16,16],children:[(0,r.jsx)(o.A,{xs:12,sm:6,children:(0,r.jsx)(d.A,{size:"small",children:(0,r.jsx)(u.A,{title:E("overview.providersCount"),value:V,prefix:(0,r.jsx)(w.A,{})})})}),(0,r.jsx)(o.A,{xs:12,sm:6,children:(0,r.jsx)(d.A,{size:"small",children:(0,r.jsx)(u.A,{title:E("overview.tokensUsed"),value:null!=(T=null==D?void 0:D.tokens.total)?T:0,prefix:(0,r.jsx)(k.A,{})})})}),(0,r.jsx)(o.A,{xs:12,sm:6,children:(0,r.jsx)(d.A,{size:"small",children:(0,r.jsx)(u.A,{title:E("overview.tasksTotal"),value:null!=(_=null==D?void 0:D.tasks.total)?_:0,prefix:(0,r.jsx)(z.A,{})})})}),(0,r.jsx)(o.A,{xs:12,sm:6,children:(0,r.jsx)(d.A,{size:"small",children:(0,r.jsx)(u.A,{title:E("overview.successRate"),value:X,suffix:"%",prefix:X>80?(0,r.jsx)(C,{style:{color:"var(--colorOk)"}}):(0,r.jsx)(S,{style:{color:"var(--colorDanger)"}})})})})]}),(0,r.jsxs)(i.A,{gutter:[16,16],children:[(0,r.jsx)(o.A,{xs:24,sm:12,children:(0,r.jsx)(d.A,{size:"small",title:E("overview.topModel"),children:q?(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)(w.A,{style:{fontSize:24,color:"var(--colorAccent)"}}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-semibold",children:q.model}),(0,r.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["@",q.provider," — ",q.count," ",E("overview.calls")]})]})]}):(0,r.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:E("common.noData")})})}),(0,r.jsx)(o.A,{xs:24,sm:12,children:(0,r.jsx)(d.A,{size:"small",title:E("overview.taskTypes"),children:(null==D?void 0:D.tasks.types)&&Object.keys(D.tasks.types).length>0?(0,r.jsx)(x.A,{wrap:!0,children:Object.entries(D.tasks.types).map(e=>{let[s,l]=e;return(0,r.jsxs)(h.A,{children:[s.slice(0,30),": ",l]},s)})}):(0,r.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:E("common.noData")})})})]}),(0,r.jsx)(d.A,{title:E("overview.quickActions"),size:"small",children:(0,r.jsxs)(x.A,{wrap:!0,children:[(0,r.jsx)(a.Ay,{onClick:()=>{B.push("/knowledge/manage")},children:E("overview.goToKnowledge")}),(0,r.jsx)(a.Ay,{onClick:()=>{B.push("/models")},children:E("overview.goToModels")}),(0,r.jsx)(a.Ay,{onClick:()=>{B.push("/settings")},children:E("overview.goToSettings")}),(0,r.jsx)(a.Ay,{onClick:()=>{B.push("/prompt")},children:E("nav.promptManagement")}),(0,r.jsx)(a.Ay,{onClick:()=>{B.push("/context/long-term")},children:E("nav.contextEngineering")})]})})]})}},6109:(e,s,l)=>{e.exports=l(7212)},6374:(e,s)=>{"use strict";s.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{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"}}]},name:"check-circle",theme:"outlined"}},8200:(e,s)=>{"use strict";s.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M704 446H320c-4.4 0-8 3.6-8 8v402c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8V454c0-4.4-3.6-8-8-8zm-328 64h272v117H376V510zm272 290H376V683h272v117z"}},{tag:"path",attrs:{d:"M424 748a32 32 0 1064 0 32 32 0 10-64 0zm0-178a32 32 0 1064 0 32 32 0 10-64 0z"}},{tag:"path",attrs:{d:"M811.4 368.9C765.6 248 648.9 162 512.2 162S258.8 247.9 213 368.8C126.9 391.5 63.5 470.2 64 563.6 64.6 668 145.6 752.9 247.6 762c4.7.4 8.7-3.3 8.7-8v-60.4c0-4-3-7.4-7-7.9-27-3.4-52.5-15.2-72.1-34.5-24-23.5-37.2-55.1-37.2-88.6 0-28 9.1-54.4 26.2-76.4 16.7-21.4 40.2-36.9 66.1-43.7l37.9-10 13.9-36.7c8.6-22.8 20.6-44.2 35.7-63.5 14.9-19.2 32.6-36 52.4-50 41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.3c19.9 14 37.5 30.8 52.4 50 15.1 19.3 27.1 40.7 35.7 63.5l13.8 36.6 37.8 10c54.2 14.4 92.1 63.7 92.1 120 0 33.6-13.2 65.1-37.2 88.6-19.5 19.2-44.9 31.1-71.9 34.5-4 .5-6.9 3.9-6.9 7.9V754c0 4.7 4.1 8.4 8.8 8 101.7-9.2 182.5-94 183.2-198.2.6-93.4-62.7-172.1-148.6-194.9z"}}]},name:"cloud-server",theme:"outlined"}}},e=>{e.O(0,[260,544,227,15,958,129,636,593,792],()=>e(e.s=3139)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{2256:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(5341).A},2725:(e,t,r)=>{"use strict";r.d(t,{A:()=>i,U:()=>a});var o=r(7109),n=r(505),s=r(8921),c=r(4567);function a(e){return t=>o.createElement(s.Ay,{theme:{token:{motion:!1,zIndexPopupBase:0}}},o.createElement(e,{...t}))}let i=(e,t,r,s,i)=>a(a=>{let{prefixCls:l,style:d}=a,p=o.useRef(null),[h,m]=o.useState(0),[u,f]=o.useState(0),[y,j]=(0,n.PW)(!1,a.open),{getPrefixCls:x}=o.useContext(c.QO),v=x(s||"select",l);o.useEffect(()=>{if(j(!0),"undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{let t=e[0].target;m(t.offsetHeight+8),f(t.offsetWidth)}),t=setInterval(()=>{let r=i?`.${i(v)}`:`.${v}-dropdown`,o=p.current?.querySelector(r);o&&(clearInterval(t),e.observe(o))},10);return()=>{clearInterval(t),e.disconnect()}}},[v]);let g={...a,style:{...d,margin:0},open:y,getPopupContainer:()=>p.current};return r&&(g=r(g)),t&&(g={...g,[t]:{overflow:{adjustX:!1,adjustY:!1}}}),o.createElement("div",{ref:p,style:{paddingBottom:h,position:"relative",minWidth:u}},o.createElement(e,{...g}))})},2887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},4084:(e,t)=>{"use strict";t.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:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"}},4508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>T});var o=r(5321),n=r(7109),s=r(6644),c=r(7807),a=r(5114),i=r(8787),l=r(1702),d=r(4253),p=r(2256),h=r(8770),m=r(6985),u=r(6171),f=r(3442),y=r(5258),j=r(4668),x=r(4746),v=r(9606),g=r(9012),A=r(9650),w=r(8209),S=r(8740);async function z(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function b(e,t){let r=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function C(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 E(){let e=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:"自定义提示词",content:"# 自定义提示词\n"})});if(!e.ok)throw Error("Failed");return e.json()}async function O(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()}function T(){var e;let t=(0,s.Vr)(),{message:r}=c.A.useApp(),[T,k]=(0,n.useState)(!0),[F,N]=(0,n.useState)([]),[P,R]=(0,n.useState)(!1),[_,M]=(0,n.useState)(null),[B,H]=(0,n.useState)(""),[I,L]=(0,n.useState)(!1),J=async()=>{k(!0);try{N(await z())}catch(e){r.error(t("common.error"))}finally{k(!1)}};(0,n.useEffect)(()=>{J()},[]);let V=async()=>{if(_){L(!0);try{await b(_.customizePath,B),r.success(t("common.success")),R(!1),await J()}catch(e){r.error(t("common.error"))}finally{L(!1)}}},D=async e=>{try{(null==e?void 0:e.projectRoot)?await C(e.projectRoot):await E(),r.success(t("common.success")),await J()}catch(e){r.error(t("common.error"))}},U=async(e,o)=>{let n=o?Array.from(new Set([...F.filter(e=>e.selected).map(e=>e.id),e.id])):F.filter(t=>t.selected&&t.id!==e.id).map(e=>e.id);try{await O(n),N(e=>e.map(e=>({...e,selected:n.includes(e.id)})))}catch(e){r.error(t("common.error"))}},W=async e=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e.projectId,filePath:e.customizePath})})).ok)throw Error("Failed");r.success(t("common.success")),await J()}catch(e){r.error(t("common.error"))}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:t("nav.promptManagement")}),(0,o.jsx)("p",{className:"pageDesc",children:t("prompt.description")})]}),(0,o.jsx)(a.Ay,{type:"primary",icon:(0,o.jsx)(x.A,{}),onClick:()=>{D()},children:"创建提示词"})]}),F.find(e=>e.isCurrent)&&(0,o.jsx)(i.A,{size:"small",children:(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[(0,o.jsx)(l.A,{color:"green",style:{width:"fit-content"},children:"当前工作项目"}),(0,o.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,o.jsx)(v.A,{})," ",null==(e=F.find(e=>e.isCurrent))?void 0:e.projectRoot]})]})}),0!==F.length||T?null:(0,o.jsx)(d.A,{}),(0,o.jsx)(p.A,{gutter:[16,16],children:T?Array.from({length:3}).map((e,t)=>(0,o.jsx)(h.A,{xs:24,sm:12,lg:8,children:(0,o.jsx)(i.A,{loading:!0,size:"small"})},t)):F.map(e=>(0,o.jsx)(h.A,{xs:24,sm:12,lg:8,children:(0,o.jsxs)(i.A,{size:"small",title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g.A,{})," ",e.projectName]}),extra:(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[e.hasFile&&(0,o.jsx)(m.A,{checked:e.selected,onChange:t=>{U(e,t.target.checked)},children:"选中"}),!e.hasFile&&e.projectRoot&&(0,o.jsx)(a.Ay,{size:"small",type:"text",icon:(0,o.jsx)(x.A,{}),onClick:()=>{D(e)}}),e.hasFile&&(0,o.jsx)(a.Ay,{size:"small",type:"text",icon:(0,o.jsx)(A.A,{}),onClick:()=>{M(e),H(e.content||""),R(!0)}}),(0,o.jsx)(u.A,{title:"custom"===e.source?"删除自定义提示词?":"删除项目记录及其提示词文件?",onConfirm:()=>{W(e)},children:(0,o.jsx)(a.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(w.A,{})})})]}),children:[e.projectRoot&&(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:[(0,o.jsx)(v.A,{})," ",e.projectRoot]}),(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:[(0,o.jsx)(S.A,{})," ",e.mtime?new Date(e.mtime).toLocaleString():t("common.never")]}),(0,o.jsxs)(f.A,{wrap:!0,children:[e.isCurrent&&(0,o.jsx)(l.A,{color:"green",children:"当前项目"}),e.selected&&(0,o.jsx)(l.A,{color:"purple",children:"已选中"}),"custom"===e.source&&(0,o.jsx)(l.A,{color:"cyan",children:"自定义"}),e.hasFile?(0,o.jsx)(l.A,{color:"blue",children:t("prompt.hasFile")}):(0,o.jsx)(l.A,{color:"default",children:t("prompt.noFile")})]}),e.hasFile&&e.content&&(0,o.jsxs)("div",{style:{marginTop:8,padding:8,background:"var(--colorBgSecondary)",borderRadius:8,fontSize:12,maxHeight:80,overflow:"hidden",color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap"},children:[e.content.slice(0,200),e.content.length>200?"...":""]})]})},e.id))}),0===F.length&&(0,o.jsx)(i.A,{size:"small",children:(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:t("prompt.noProjects")})}),(0,o.jsxs)(y.A,{title:"".concat(t("common.edit")," — ").concat((null==_?void 0:_.projectName)||""),open:P,width:800,onCancel:()=>R(!1),onOk:()=>{V()},confirmLoading:I,children:[(0,o.jsx)("div",{style:{marginBottom:12,fontSize:12,color:"var(--colorTextSecondary)"},children:null==_?void 0:_.customizePath}),(0,o.jsx)(j.A.TextArea,{value:B,onChange:e=>H(e.target.value),rows:25,style:{fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13}})]})]})}},7549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(4508)}])},8740:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var o=r(7109),n=r(4084),s=r(8483);function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(s.A,c({},e,{ref:t,icon:n.A})))},8770:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(1916).A},9012:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var o=r(7109),n=r(2887),s=r(8483);function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(s.A,c({},e,{ref:t,icon:n.A})))}},e=>{e.O(0,[260,544,425,668,492,446,636,593,792],()=>e(e.s=7549)),_N_E=e.O()}]);