@customize-agent/server 3.0.16 → 3.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/build-manifest.json +12 -12
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/chunks/3445.js +2 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/api/assets/generated/preview.js +1 -1
- package/.next/server/pages/api/assets/generated.js +1 -1
- package/.next/server/pages/api/documents/export.js +2 -2
- package/.next/server/pages/api/documents/generate.js +1 -1
- package/.next/server/pages/api/documents/generated/[id].js +1 -1
- package/.next/server/pages/api/documents/generated.js +1 -1
- package/.next/server/pages/api/documents/specs.js +1 -1
- package/.next/server/pages/api/prompt.js +97 -1
- package/.next/server/pages/asset-library.html +1 -1
- package/.next/server/pages/context/long-term.html +1 -1
- package/.next/server/pages/context/short-term.html +1 -1
- package/.next/server/pages/document-roles.html +1 -1
- package/.next/server/pages/document-specs.html +1 -1
- package/.next/server/pages/documents.html +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/search.html +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages-manifest.json +21 -21
- package/.next/static/chunks/pages/asset-library-82606363f9142bad.js +1 -0
- package/.next/static/chunks/pages/context/{long-term-09e23b06634b08d9.js → long-term-f2a550bc848ec1a3.js} +1 -1
- package/.next/static/chunks/pages/context/short-term-1de28da82d2b6276.js +1 -0
- package/.next/static/chunks/pages/document-roles-54a1cc04116e8c18.js +1 -0
- package/.next/static/chunks/pages/document-specs-723dee6883949a17.js +1 -0
- package/.next/static/chunks/pages/documents-cf8bb78fbcc70bb1.js +1 -0
- package/.next/static/chunks/pages/knowledge/file-detail-7a1a3d4352ecfa0a.js +1 -0
- package/.next/static/chunks/pages/knowledge/files-f0e05583bf7c57d9.js +1 -0
- package/.next/static/chunks/pages/knowledge/manage-8acff53019eb6cc1.js +1 -0
- package/.next/static/chunks/pages/knowledge/{search-3fd704d2afa1af3e.js → search-1f3bd8fcb7af3e4d.js} +1 -1
- package/.next/static/chunks/pages/models-11533caad3723009.js +1 -0
- package/.next/static/chunks/pages/overview-f80672c242d9aa32.js +1 -0
- package/.next/static/customize-agent-dashboard/_buildManifest.js +1 -1
- package/package.json +1 -1
- package/.next/static/chunks/pages/asset-library-0f607b74fa016470.js +0 -1
- package/.next/static/chunks/pages/context/short-term-2f5fd8531e87b5bd.js +0 -1
- package/.next/static/chunks/pages/document-roles-077fc7159c88e89e.js +0 -1
- package/.next/static/chunks/pages/document-specs-fb5b8a89cff6d1e3.js +0 -1
- package/.next/static/chunks/pages/documents-38320ae2fd50be35.js +0 -1
- package/.next/static/chunks/pages/knowledge/file-detail-ad1dc61c1413db0c.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-896c058f2da5e907.js +0 -1
- package/.next/static/chunks/pages/knowledge/manage-6da10158f75718cf.js +0 -1
- package/.next/static/chunks/pages/models-7bdf24068811ae91.js +0 -1
- package/.next/static/chunks/pages/overview-572bba4876e617f5.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28],{6578:(e,t,n)=>{"use strict";async function a(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 o(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(t))}async function r(e){var t,n;let o=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&o.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&o.set("category",e.category),(null==e?void 0:e.page)&&o.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&o.set("limit",String(null!=(n=e.limit)?n:50)),a("/api/kb/files?".concat(o))}async function i(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),a("/api/kb/files/detail?".concat(n))}async function s(e,t){return a("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function c(e,t,n){return a("/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 a=new FileReader;a.onload=()=>{let e=a.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},a.onerror=n,a.readAsDataURL(e)})}async function d(e,t,n){return a("/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 a("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t))}async function h(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t),{method:"DELETE"})}async function f(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function g(e){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function m(e){return a("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function v(){return a("/api/kb/features")}async function w(e,t){var n,o,r,i,s;let c=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&c.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&c.set("category",t.category),(null==t?void 0:t.limit)&&c.set("limit",String(null!=(s=t.limit)?s:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(o=t.weights)?void 0:o.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(r=t.weights)?void 0:r.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(i=t.weights)?void 0:i.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),a("/api/kb/search?".concat(c))}async function x(){return a("/api/prompt")}async function b(e){return a("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function j(e){return a("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e,t){return a("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function S(e){return a("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return a("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function _(){return a("/api/documents/specs")}async function k(e){return a("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(e){return a("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function N(){return a("/api/documents/templates")}async function E(e){return a("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function A(e){return a("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(e){return a("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function R(e){return a("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function I(){return a("/api/documents/generated")}async function L(e){return a("/api/documents/generated/".concat(encodeURIComponent(e)))}async function M(e,t){return a("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function H(){return a("/api/assets/generated")}async function J(e){return a("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function U(e){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function D(e,t){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function B(e){return a("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function F(e,t){return a("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function W(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 z(){return a("/api/config/providers")}async function $(e,t){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function V(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function X(){return a("/api/config/models")}async function q(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Q(){return a("/api/config/embedding")}async function K(e){return a("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Z(){return a("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function G(){return a("/api/system/stats")}async function ee(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return a("/api/context".concat(n))}async function et(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function en(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ea(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function eo(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function er(e,t){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ei(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>F,Bh:()=>ei,Dl:()=>N,E:()=>ea,EK:()=>k,ER:()=>P,FC:()=>G,FV:()=>C,H1:()=>m,H7:()=>h,HC:()=>s,HT:()=>r,II:()=>Q,JU:()=>J,NR:()=>S,OX:()=>R,PH:()=>en,QT:()=>u,Qx:()=>p,R1:()=>B,SJ:()=>y,UE:()=>W,VW:()=>v,W2:()=>w,X8:()=>g,Z3:()=>z,_m:()=>$,a6:()=>M,aP:()=>q,bV:()=>O,bZ:()=>Y,c1:()=>d,cQ:()=>I,dd:()=>K,dg:()=>j,dw:()=>T,dx:()=>x,f$:()=>H,h0:()=>A,h1:()=>V,hc:()=>o,hn:()=>ee,l2:()=>E,lv:()=>b,mx:()=>_,oS:()=>D,p:()=>et,tn:()=>c,u6:()=>Z,uc:()=>U,v7:()=>L,xC:()=>i,xq:()=>f,xw:()=>eo,zo:()=>er,zr:()=>X})},10218:(e,t,n)=>{"use strict";n.d(t,{A:()=>g,H:()=>f});var a=n(97109),o=n(4932),r=n(42644);let i=e=>"object"==typeof e&&null!=e&&1===e.nodeType,s=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,c=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return s(n.overflowY,t)||s(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},l=(e,t,n,a,o,r,i,s)=>r<e&&i>t||r>e&&i<t?0:r<=e&&s<=n||i>=t&&s>=n?r-e-a:i>t&&s<n||r<e&&s>n?i-t+o:0,d=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},u=(e,t)=>{var n,a,o,r;if("undefined"==typeof document)return[];let{scrollMode:s,block:u,inline:p,boundary:h,skipOverflowHiddenElements:f}=t,y="function"==typeof h?h:e=>e!==h;if(!i(e))throw TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,m=[],v=e;for(;i(v)&&y(v);){if((v=d(v))===g){m.push(v);break}null!=v&&v===document.body&&c(v)&&!c(document.documentElement)||null!=v&&c(v,f)&&m.push(v)}let w=null!=(a=null==(n=window.visualViewport)?void 0:n.width)?a:innerWidth,x=null!=(r=null==(o=window.visualViewport)?void 0:o.height)?r:innerHeight,{scrollX:b,scrollY:j}=window,{height:C,width:S,top:T,right:_,bottom:k,left:P}=e.getBoundingClientRect(),{top:N,right:E,bottom:A,left:O}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),R="start"===u||"nearest"===u?T-N:"end"===u?k+A:T+C/2-N+A,I="center"===p?P+S/2-O+E:"end"===p?_+E:P-O,L=[];for(let e=0;e<m.length;e++){let t=m[e],{height:n,width:a,top:o,right:r,bottom:i,left:d}=t.getBoundingClientRect();if("if-needed"===s&&T>=0&&P>=0&&k<=x&&_<=w&&(t===g&&!c(t)||T>=o&&k<=i&&P>=d&&_<=r))break;let h=getComputedStyle(t),f=parseInt(h.borderLeftWidth,10),y=parseInt(h.borderTopWidth,10),v=parseInt(h.borderRightWidth,10),N=parseInt(h.borderBottomWidth,10),E=0,A=0,O="offsetWidth"in t?t.offsetWidth-t.clientWidth-f-v:0,M="offsetHeight"in t?t.offsetHeight-t.clientHeight-y-N:0,H="offsetWidth"in t?0===t.offsetWidth?0:a/t.offsetWidth:0,J="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(g===t)E="start"===u?R:"end"===u?R-x:"nearest"===u?l(j,j+x,x,y,N,j+R,j+R+C,C):R-x/2,A="start"===p?I:"center"===p?I-w/2:"end"===p?I-w:l(b,b+w,w,f,v,b+I,b+I+S,S),E=Math.max(0,E+j),A=Math.max(0,A+b);else{E="start"===u?R-o-y:"end"===u?R-i+N+M:"nearest"===u?l(o,i,n,y,N+M,R,R+C,C):R-(o+n/2)+M/2,A="start"===p?I-d-f:"center"===p?I-(d+a/2)+O/2:"end"===p?I-r+v+O:l(d,r,a,f,v+O,I,I+S,S);let{scrollLeft:e,scrollTop:s}=t;E=0===J?0:Math.max(0,Math.min(s+E/J,t.scrollHeight-n/J+M)),A=0===H?0:Math.max(0,Math.min(e+A/H,t.scrollWidth-a/H+O)),R+=s-E,I+=e-A}L.push({el:t,top:E,left:A})}return L};var p=n(26047),h=n(44624);function f(e){return(0,h.$r)(e).join("_")}function y(e,t){let n=t.getFieldInstance(e),a=(0,r.rb)(n);if(a)return a;let o=(0,h.kV)((0,h.$r)(e),t.__INTERNAL__.name);if(o)return document.getElementById(o)}function g(e){let[t]=(0,o.mN)(),n=a.useRef({}),r=a.useMemo(()=>e??{...t,__INTERNAL__:{itemRef:e=>t=>{let a=f(e);t?n.current[a]=t:delete n.current[a]}},scrollToField:(e,t={})=>{let{focus:n,...a}=t,o=y(e,r);o&&(!function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let n=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(u(e,t));let a="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:o,top:r,left:i}of u(e,!1===t?{block:"end",inline:"nearest"}:t===Object(t)&&0!==Object.keys(t).length?t:{block:"start",inline:"nearest"})){let e=r-n.top+n.bottom,t=i-n.left+n.right;o.scroll({top:e,left:t,behavior:a})}}(o,{scrollMode:"if-needed",block:"nearest",...a}),n&&r.focusField(e))},focusField:e=>{let t=r.getFieldInstance(e);(0,p.Tn)(t?.focus)?t.focus():y(e,r)?.focus?.()},getFieldInstance:e=>{let t=f(e);return n.current[t]}},[e,t]);return[r]}},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusPanel:"style_statusPanel__9arTu",statusPanelHeader:"style_statusPanelHeader__nKv1I",statusEmpty:"style_statusEmpty__8LWzH",statusList:"style_statusList__FpNgC",statusItem:"style_statusItem__uzO80",statusHeader:"style_statusHeader__o9q_b",statusDesc:"style_statusDesc__XiWFa",statusPath:"style_statusPath__Udxvv",statusMeta:"style_statusMeta__XukHt",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},15437:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=e=>{let{componentCls:t,antCls:n,motionDurationMid:a,motionEaseInOut:o}=e;return{[t]:{[`${n}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`${["height","opacity"].map(e=>`${e} ${a} ${o}`).join(", ")} !important`}},[`${n}-motion-collapse`]:{overflow:"hidden",transition:`${["height","opacity"].map(e=>`${e} ${a} ${o}`).join(", ")} !important`}}}}},23793:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"}},25258:(e,t,n)=>{"use strict";n.d(t,{A:()=>x});var a=n(51541),o=n(61848),r=n(1249),i=n(97109),s=n(72658),c=n(3638),l=n(92162),d=n(82725),u=n(74567),p=n(632),h=n(49517),f=n(79412),y=n(19527);let g=(0,d.U)(e=>{let{prefixCls:t,className:n,closeIcon:a,closable:o,type:r,title:d,children:g,footer:m,classNames:v,styles:w,...x}=e,{getPrefixCls:b}=i.useContext(u.QO),{className:j,style:C,classNames:S,styles:T}=(0,u.TP)("modal"),_=b(),k=t||b("modal"),P=(0,p.A)(_),[N,E]=(0,y.Ay)(k,P),[A,O]=(0,l.AV)([S,v],[T,w],{props:e}),R=`${k}-confirm`,I={};return I=r?{closable:o??!1,title:"",footer:"",children:i.createElement(h.k,{...e,prefixCls:k,confirmPrefixCls:R,rootPrefixCls:_,content:g})}:{closable:o??!0,title:d,footer:null!==m&&i.createElement(f.w,{...e}),children:g},i.createElement(s.Z,{prefixCls:k,className:(0,c.$)(N,`${k}-pure-panel`,r&&R,r&&`${R}-${r}`,n,j,E,P,A.root),style:{...C,...O.root},...x,closeIcon:(0,f.O)(k,a),closable:o,classNames:A,styles:O,...I})});var m=n(99739);function v(e){return(0,a.Ay)((0,a.fp)(e))}let w=r.A;w.useModal=m.A,w.info=function(e){return(0,a.Ay)((0,a.$D)(e))},w.success=function(e){return(0,a.Ay)((0,a.Ej)(e))},w.error=function(e){return(0,a.Ay)((0,a.jT)(e))},w.warning=v,w.warn=v,w.confirm=function(e){return(0,a.Ay)((0,a.lr)(e))},w.destroyAll=function(){for(;o.A.length;){let e=o.A.pop();e&&e()}},w.config=a.FB,w._InternalPanelDoNotUseOrYouWillBeFired=g;let x=w},36451:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>O});var a=n(65321),o=n(97109),r=n(13014),i=n(43220),s=n.n(i),c=n(86109),l=n(17807),d=n(25258),u=n(33442),p=n(11702),h=n(85114),f=n(7576),y=n(57271),g=n(14932),m=n(99605),v=n(68787),w=n(59400),x=n(26631),b=n(58209),j=n(30486),C=n(92803),S=n(88483);function T(){return(T=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let _=o.forwardRef((e,t)=>o.createElement(S.A,T({},e,{ref:t,icon:C.A})));var k=n(6578),P=n(45551),N=n(14569),E=n.n(N);let A=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function O(){let e=(0,r.Vr)("knowledge"),{locale:t}=(0,r.x_)(),{message:n}=l.A.useApp(),i=(0,c.useRouter)(),C="string"==typeof i.query.category?i.query.category:"",[S,T]=(0,o.useState)([]),[N,O]=(0,o.useState)(!1),[R,I]=(0,o.useState)(""),[L,M]=(0,o.useState)(""),[H,J]=(0,o.useState)(C),[U,D]=(0,o.useState)(!1),[B,F]=(0,o.useState)([]),[W,z]=(0,o.useState)([]),[$,V]=(0,o.useState)(1),X=(0,o.useRef)(H);(0,o.useEffect)(()=>{X.current=H},[H]),(0,o.useEffect)(()=>{J("string"==typeof i.query.category?i.query.category:"")},[i.query.category]);let q=(0,o.useCallback)(async e=>{let t=null!=e?e:X.current;O(!0),I("");try{let e=await (0,k.HT)({category:t||void 0,limit:200});T(e.files||[]),e.initializing&&window.setTimeout(()=>{q(t)},1500)}catch(e){T([]),I(e instanceof Error?e.message:"文件列表加载失败")}finally{O(!1)}},[]);(0,o.useEffect)(()=>{q(H)},[H,q]);let Q=e=>({type:e.type,title:e.title,description:e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,textLength:e.textLength,extractionMode:e.extractionMode}),K=(0,o.useCallback)(async()=>{try{let e=await (0,k.Qx)();F(e.operations.map(Q))}catch(e){}},[]);(0,o.useEffect)(()=>{K()},[K]);let Z=async()=>{try{await (0,k.H7)(),F([]),n.success("任务状态已清空")}catch(e){n.error("清空任务状态失败")}},Y=async e=>{if(0===e.length)return;let t=1===e.length?e[0].name:"".concat(e.length," 个文件");D(!0),F(e=>[{type:"upload",title:"上传 ".concat(t),description:"等待上传、解析、切片和入库",status:"processing",percent:10},...e].slice(0,50));let a="".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2)),o=setInterval(()=>{(0,k.QT)(a).then(e=>{F(n=>[{type:"upload",title:"上传 ".concat(t),description:"".concat(e.message).concat(e.chunkCount?",".concat(e.chunkCount," 个切片"):""),status:"error"===e.stage?"warning":"processing",percent:e.percent},...n.filter(e=>e.title!=="上传 ".concat(t))].slice(0,50))}).catch(()=>void 0)},500);try{var r,i;let s=await (0,k.c1)(e,void 0,a);clearInterval(o),(null==(r=s.vectorStatus)?void 0:r.status)==="error"?n.info("文件已上传,正在后台入库"):n.success("上传成功"),M(""),J(""),z([]),V(1),X.current="";let c=null==(i=s.files)?void 0:i.find(e=>e.relativePath===s.relativePath),l=(e=>{if(!e)return{};let t={};try{t=e.metadataJson?JSON.parse(e.metadataJson):{}}catch(e){}let n="object"==typeof t.extraction&&t.extraction?t.extraction:t;return{textLength:"number"==typeof n.textLength?n.textLength:void 0,extractionMode:"string"==typeof n.extractionMode?n.extractionMode:void 0}})(c);await K(),F(e=>[{type:"upload",title:"上传完成 ".concat(t),description:"解析、分块和入库流程已完成",status:"success",filePath:null==c?void 0:c.relativePath,chunkCount:null==c?void 0:c.chunkCount,textLength:l.textLength,extractionMode:l.extractionMode},...e.filter(e=>e.title!=="上传 ".concat(t))].slice(0,50)),Array.isArray(s.files)?T(s.files):(await (0,k.H1)(),await q(""),await K())}catch(e){n.error("上传失败"),F(e=>[{type:"error",title:"上传失败 ".concat(t),description:"请重试或检查文件格式",status:"error"},...e].slice(0,50))}finally{clearInterval(o),D(!1)}},G=e=>{let t="selected"===e?W.map(String):"filtered"===e?ee.map(e=>e.relativePath):[];if("all"!==e&&0===t.length)return;let a="all"===e?"删除全部文件?":"filtered"===e?"删除当前筛选结果 ".concat(t.length," 个文件?"):"删除已选 ".concat(t.length," 个文件?");d.A.confirm({title:a,content:"将同时删除文件、切片、索引和向量记录。此操作不可撤销。",okText:"确认删除",cancelText:"取消",okButtonProps:{danger:!0},onOk:async()=>{F(e=>[{type:"delete",title:a,description:"正在批量删除文件和索引",status:"processing",percent:10},...e].slice(0,50));try{var o;let a=null!=(o=("all"===e?await (0,k.X8)():await (0,k.SJ)(t)).deleted)?o:t.length;n.success("已删除 ".concat(a," 个文件")),z([]),F(e=>[{type:"delete",title:"批量删除完成",description:"已删除 ".concat(a," 个文件、切片和索引"),status:"success"},...e].slice(0,50)),await q(),await K()}catch(e){n.error("批量删除失败"),F(e=>[{type:"error",title:"批量删除失败",description:"请重试",status:"error"},...e].slice(0,50))}}})},ee=L?S.filter(e=>e.relativePath.toLowerCase().includes(L.toLowerCase())):S,et=[{title:e("fileName"),dataIndex:"relativePath",key:"name",render:(e,t)=>(0,a.jsxs)(u.A,{children:[(0,a.jsx)(x.A,{}),t.builtIn&&(0,a.jsx)(p.A,{color:"gold",children:"内置"}),(0,a.jsx)(s(),{className:"truncate max-w-[400px] inline-block",href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(e)),children:e})]})},{title:e("fileCategory"),dataIndex:"category",key:"cat",width:120,render:e=>(0,a.jsx)(p.A,{children:(0,P.Jm)(e,t)})},{title:e("fileSize"),dataIndex:"fileSize",key:"size",width:100,render:e=>(0,P.z3)(e)},{title:"切片",dataIndex:"chunkCount",key:"chunks",width:90,render:e=>(0,a.jsx)(p.A,{color:e>1?"green":"orange",children:e})},{title:"解析状态",dataIndex:"status",key:"status",width:110,render:(e,t)=>(0,a.jsx)(p.A,{color:"active"===e?"green":"red",children:t.errorMessage||e})},{title:e("fileDate"),dataIndex:"mtime",key:"date",width:140,render:e=>e?new Date(e).toLocaleDateString(t):"—"},{title:"",key:"act",width:60,render:(t,o)=>(0,a.jsx)(h.Ay,{type:"text",danger:!0,size:"small",icon:(0,a.jsx)(b.A,{}),onClick:()=>{d.A.confirm({title:e("delete"),content:e("deleteConfirm"),okText:"确认",cancelText:"取消",okButtonProps:{danger:!0},onOk:async()=>{F(e=>[{type:"delete",title:"删除 ".concat(o.relativePath),description:"正在删除文件记录",status:"processing"},...e].slice(0,50));try{await (0,k.xq)(o.relativePath),n.success("已删除"),F(e=>[{type:"delete",title:"删除完成 ".concat(o.relativePath),description:"文件和索引记录已移除",status:"success"},...e].slice(0,50)),z(e=>e.filter(e=>e!==o.relativePath)),await q(),await K()}catch(e){n.error("删除失败"),F(e=>[{type:"error",title:"删除失败 ".concat(o.relativePath),description:"请重试",status:"error"},...e].slice(0,50))}}})}})}];return(0,a.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,a.jsx)("h2",{className:"pageTitle",children:e("fileList")}),(0,a.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,a.jsx)(f.A,{placeholder:e("searchPlaceholder"),prefix:(0,a.jsx)(j.A,{}),value:L,onChange:e=>{M(e.target.value),V(1)},allowClear:!0,className:E().filterInput}),(0,a.jsx)(y.A,{value:H||void 0,onChange:e=>{J(e||""),V(1)},placeholder:e("filterCategory"),allowClear:!0,className:E().filterSelect,options:[{label:e("allCategories"),value:""},...A.map(e=>({label:(0,P.Jm)(e,t),value:e}))]}),(0,a.jsx)(h.Ay,{type:"primary",icon:(0,a.jsx)(_,{}),loading:U,onClick:()=>{var e;return null==(e=document.getElementById("kb-file-upload-input"))?void 0:e.click()},children:U?e("uploading"):e("upload")}),(0,a.jsx)(h.Ay,{icon:(0,a.jsx)(_,{}),loading:U,onClick:()=>{var e;return null==(e=document.getElementById("kb-folder-upload-input"))?void 0:e.click()},children:"上传文件夹"}),(0,a.jsxs)(h.Ay,{danger:!0,disabled:0===W.length,icon:(0,a.jsx)(b.A,{}),onClick:()=>G("selected"),children:["删除已选 ",W.length||""]}),(0,a.jsx)(h.Ay,{danger:!0,disabled:0===ee.length||!L&&!H,onClick:()=>G("filtered"),children:"删除筛选结果"}),(0,a.jsx)(h.Ay,{danger:!0,disabled:0===S.length,onClick:()=>G("all"),children:"删除全部"}),(0,a.jsx)("input",{id:"kb-file-upload-input",type:"file",multiple:!0,hidden:!0,onChange:e=>{var t;let n=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",Y(n)}}),(0,a.jsx)("input",{id:"kb-folder-upload-input",type:"file",multiple:!0,hidden:!0,webkitdirectory:"",onChange:e=>{var t;let n=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",Y(n)}})]}),(0,a.jsxs)("div",{className:E().statusPanel,children:[(0,a.jsxs)("div",{className:E().statusPanelHeader,children:[(0,a.jsxs)(u.A,{children:[(0,a.jsx)(x.A,{}),"文件任务状态"]}),(0,a.jsx)(h.Ay,{size:"small",type:"text",disabled:0===B.length,onClick:()=>void Z(),children:"清空"})]}),0===B.length?(0,a.jsx)("div",{className:E().statusEmpty,children:"暂无文件任务。"}):(0,a.jsx)("div",{className:E().statusList,children:B.map((e,n)=>(0,a.jsxs)("div",{className:E().statusItem,children:[(0,a.jsxs)("div",{className:E().statusHeader,children:[(0,a.jsxs)(u.A,{size:8,wrap:!0,children:[(0,a.jsx)(p.A,{color:"success"===e.status?"green":"error"===e.status?"red":"warning"===e.status?"orange":"blue",children:"upload"===e.type?"上传":"delete"===e.type?"删除":"reindex"===e.type?"重建":"失败"}),(0,a.jsx)(g.A,{title:e.title,children:(0,a.jsx)("strong",{children:e.title})})]}),(0,a.jsx)(p.A,{color:"success"===e.status?"success":"processing"===e.status?"processing":"warning"===e.status?"warning":"error",children:"success"===e.status?"完成":"processing"===e.status?"处理中":"warning"===e.status?"需关注":"失败"})]}),(0,a.jsx)(g.A,{title:e.description,children:(0,a.jsx)("div",{className:E().statusDesc,children:e.description})}),e.filePath&&(0,a.jsx)(g.A,{title:e.filePath,children:(0,a.jsx)("div",{className:E().statusPath,children:e.filePath})}),(0,a.jsxs)("div",{className:E().statusMeta,children:["number"==typeof e.chunkCount&&(0,a.jsxs)("span",{children:["切片 ",(0,a.jsx)("b",{children:e.chunkCount})]}),"number"==typeof e.textLength&&(0,a.jsxs)("span",{children:["正文 ",(0,a.jsx)("b",{children:e.textLength.toLocaleString(t)})," 字符"]}),e.extractionMode&&(0,a.jsxs)("span",{children:["解析 ",(0,a.jsx)("b",{children:e.extractionMode})]})]}),"number"==typeof e.percent&&"processing"===e.status&&(0,a.jsx)(m.A,{percent:e.percent,size:"small"})]},"".concat(e.title,"-").concat(n)))})]}),(0,a.jsxs)(v.A,{children:[R&&(0,a.jsxs)("div",{className:E().statusEmpty,children:["文件列表加载失败:",R]}),(0,a.jsx)(w.A,{rowKey:"relativePath",columns:et,dataSource:ee,loading:N,size:"middle",locale:{emptyText:N?"正在加载文件列表...":L?e("emptySearch"):e("noFiles")},pagination:{current:$,pageSize:50,showSizeChanger:!1,onChange:V},rowSelection:{selectedRowKeys:W,onChange:z}})]})]})}},44624:(e,t,n)=>{"use strict";n.d(t,{$r:()=>o,BS:()=>i,kV:()=>r});let a=["parentNode"];function o(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function r(e,t){if(!e.length)return;let n=e.join("_");return t?`${t}_${n}`:a.includes(n)?`form_item_${n}`:n}function i(e,t,n,a,o,r){let i=a;return void 0!==r?i=r:n.validating?i="validating":e.length?i="error":t.length?i="warning":(n.touched||o&&n.validated)&&(i="success"),i}},45551:(e,t,n)=>{"use strict";function a(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),a=Math.floor(n/60),o=Math.floor(a/24);return o>30?new Date(e).toLocaleDateString(t):"en-US"===t?o>0?"".concat(o,"d ago"):a>0?"".concat(a,"h ago"):n>0?"".concat(n,"m ago"):"Just now":o>0?"".concat(o," 天前"):a>0?"".concat(a," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>s,fw:()=>o,z3:()=>a});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},i={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?i:r)[e])?t:e}},58209:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var a=n(97109),o=n(23793),r=n(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let s=a.forwardRef((e,t)=>a.createElement(r.A,i({},e,{ref:t,icon:o.A})))},90426:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/files",function(){return n(36451)}])},92803:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 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:"upload",theme:"outlined"}}},e=>{e.O(0,[260,167,382,628,271,576,700,174,985,400,15,636,593,792],()=>e(e.s=90426)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[414],{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 a(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(n))}async function i(e){var n,t;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(t=e.limit)?t:50)),o("/api/kb/files?".concat(a))}async function c(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),o("/api/kb/files/detail?".concat(t))}async function r(e,n){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function s(e,n,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function l(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 l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n))}async function y(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function f(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 m(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 b(){return o("/api/kb/features")}async function S(e,n){var t,a,i,c,r;let s=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&s.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&s.set("category",n.category),(null==n?void 0:n.limit)&&s.set("limit",String(null!=(r=n.limit)?r:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&s.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(a=n.weights)?void 0:a.vector)!=null&&s.set("vectorWeight",String(n.weights.vector)),(null==n||null==(i=n.weights)?void 0:i.rewrite)!=null&&s.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(c=n.weights)?void 0:c.hybridBonus)!=null&&s.set("hybridBonus",String(n.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function w(){return o("/api/prompt")}async function k(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 j(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function x(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(){return o("/api/documents/specs")}async function E(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function N(){return o("/api/documents/templates")}async function P(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function A(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function J(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function U(){return o("/api/documents/generated")}async function D(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function I(e,n){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function z(){return o("/api/assets/generated")}async function L(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function _(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function B(e,n){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function H(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function M(e,n){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function V(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 W(){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 X(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function Q(){return o("/api/config/models")}async function q(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function K(){return o("/api/config/embedding")}async function Z(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function G(){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 Y(){return o("/api/system/stats")}async function ee(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function en(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function et(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function eo(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ea(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ei(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ec(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>M,Bh:()=>ec,Dl:()=>N,E:()=>eo,EK:()=>E,ER:()=>O,FC:()=>Y,FV:()=>j,H1:()=>g,H7:()=>y,HC:()=>r,HT:()=>i,II:()=>K,JU:()=>L,NR:()=>x,OX:()=>J,PH:()=>et,QT:()=>u,Qx:()=>p,R1:()=>H,SJ:()=>h,UE:()=>V,VW:()=>b,W2:()=>S,X8:()=>m,Z3:()=>W,_m:()=>F,a6:()=>I,aP:()=>q,bV:()=>R,bZ:()=>$,c1:()=>d,cQ:()=>U,dd:()=>Z,dg:()=>T,dw:()=>v,dx:()=>w,f$:()=>z,h0:()=>A,h1:()=>X,hc:()=>a,hn:()=>ee,l2:()=>P,lv:()=>k,mx:()=>C,oS:()=>B,p:()=>en,tn:()=>s,u6:()=>G,uc:()=>_,v7:()=>D,xC:()=>c,xq:()=>f,xw:()=>ea,zo:()=>ei,zr:()=>Q})},45551:(e,n,t)=>{"use strict";function o(e){if(0===e)return"0 B";let n=Math.floor(Math.log(e)/Math.log(1024)),t=e/Math.pow(1024,n);return"".concat(t.toFixed(+(0!==n))," ").concat(["B","KB","MB","GB","TB"][n])}function a(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===n?"Never":"从未";let t=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(t/60),a=Math.floor(o/24);return a>30?new Date(e).toLocaleDateString(n):"en-US"===n?a>0?"".concat(a,"d ago"):o>0?"".concat(o,"h ago"):t>0?"".concat(t,"m ago"):"Just now":a>0?"".concat(a," 天前"):o>0?"".concat(o," 小时前"):t>0?"".concat(t," 分钟前"):"刚刚"}t.d(n,{Jm:()=>r,fw:()=>a,z3:()=>o});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},c={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function r(e){var n;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(n=("en-US"===t?c:i)[e])?n:e}},50423:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>E});var o=t(65321),a=t(97109),i=t(34986),c=t(13014),r=t(17807),s=t(33442),l=t(85114),d=t(2256),u=t(38770),p=t(68787),y=t(54849),f=t(49292),h=t(59400),m=t(11702),g=t(29606),b=t(30486),S=t(99811),w=t(56768),k=t(26619),T=t(93314),j=t(58740),x=t(6578),v=t(45551);let C=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function E(){var e,n,t;let E=(0,c.Vr)(),{locale:O}=(0,c.x_)(),N=(0,i.useRouter)(),{stats:P,loading:A,reload:R}=function(){let[e,n]=(0,a.useState)(null),[t,o]=(0,a.useState)(!1),i=(0,a.useCallback)(async()=>{o(!0);try{n(await (0,x.hc)())}catch(e){}finally{o(!1)}},[]);return(0,a.useEffect)(()=>{i()},[i]),{stats:e,loading:t,reload:i}}(),J=function(){let[e,n]=(0,a.useState)(null);return(0,a.useEffect)(()=>{(0,x.VW)().then(n).catch(()=>{})},[]),e}(),{reindexing:U,reindex:D}=function(){let[e,n]=(0,a.useState)(!1);return{reindexing:e,reindex:(0,a.useCallback)(async()=>{n(!0);try{return await (0,x.H1)(),!0}catch(e){return!1}finally{n(!1)}},[])}}(),[I,z]=(0,a.useState)("document"),[L,_]=(0,a.useState)({count:0,totalSize:0}),{message:B}=r.A.useApp(),H=(0,a.useCallback)(async e=>{try{let n=await (0,x.HT)({category:e,limit:1e4}),t=0;if(Array.isArray(n.files))for(let e of n.files)t+=e.fileSize||0;_({count:n.total||0,totalSize:t})}catch(e){_({count:0,totalSize:0})}},[]);(0,a.useEffect)(()=>{H(I)},[I,H]);let M=async()=>{await D()?await Promise.all([R(),H(I)]):B.error(E("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:E("knowledge.manageTitle")}),(0,o.jsx)("p",{className:"pageDesc",children:E("knowledge.manageDesc")})]}),(0,o.jsxs)(s.A,{children:[(0,o.jsx)(l.Ay,{icon:(0,o.jsx)(g.A,{}),onClick:()=>N.push("/knowledge/files"),children:E("knowledge.files")}),(0,o.jsx)(l.Ay,{icon:(0,o.jsx)(b.A,{}),onClick:()=>N.push("/knowledge/search"),children:E("knowledge.search")}),(0,o.jsx)(l.Ay,{icon:(0,o.jsx)(S.A,{}),loading:U,onClick:()=>{M()},children:E("knowledge.reindex")})]})]}),(0,o.jsx)(d.A,{gutter:[16,16],children:[{icon:(0,o.jsx)(w.A,{}),label:E("knowledge.totalFiles"),value:null!=(e=null==P?void 0:P.fileCount)?e:0},{icon:(0,o.jsx)(k.A,{}),label:E("knowledge.totalChunks"),value:null!=(n=null==P?void 0:P.chunkCount)?n:0},{icon:(0,o.jsx)(T.A,{}),label:E("knowledge.totalSize"),value:(0,v.z3)(null!=(t=null==P?void 0:P.totalSizeBytes)?t:0)},{icon:(0,o.jsx)(j.A,{}),label:E("knowledge.lastIndexed"),value:(null==P?void 0:P.lastIndexedAt)?(0,v.fw)(P.lastIndexedAt,O):E("common.never")}].map((e,n)=>(0,o.jsx)(u.A,{xs:12,sm:6,children:(0,o.jsx)(p.A,{size:"small",loading:A&&!P,children:(0,o.jsx)(y.A,{title:e.label,value:e.value,prefix:e.icon})})},n))}),(0,o.jsxs)(p.A,{title:E("knowledge.categories"),size:"small",children:[(0,o.jsx)(f.A,{value:I,onChange:e=>z(String(e)),options:C.map(e=>({label:(0,v.Jm)(e,O),value:e})),className:"mb-4"}),(0,o.jsxs)(d.A,{gutter:[16,16],children:[(0,o.jsx)(u.A,{xs:12,sm:8,children:(0,o.jsx)(y.A,{title:E("knowledge.fileCount"),value:L.count,prefix:(0,o.jsx)(w.A,{})})}),(0,o.jsx)(u.A,{xs:12,sm:8,children:(0,o.jsx)(y.A,{title:E("knowledge.totalSize"),value:(0,v.z3)(L.totalSize),prefix:(0,o.jsx)(T.A,{})})})]})]}),J&&(0,o.jsx)(p.A,{title:E("knowledge.features"),size:"small",children:(0,o.jsx)(h.A,{dataSource:[{key:"vectorStore",label:"Vector Store",desc:E("knowledge.featureVectorStoreDesc"),value:J.vectorStore},{key:"embedding",label:"Embedding",desc:E("knowledge.featureEmbeddingDesc"),value:J.embeddingProvider},{key:"dedup",label:E("knowledge.featureDedup"),desc:E("knowledge.featureDedupDesc"),value:J.dedupEngine},{key:"chunker",label:E("knowledge.featureChunker"),desc:E("knowledge.featureChunkerDesc"),value:J.chunker}],columns:[{title:E("knowledge.featureName"),dataIndex:"label",key:"label",width:120},{title:E("knowledge.featureDesc"),dataIndex:"desc",key:"desc"},{title:E("knowledge.featureValue"),dataIndex:"value",key:"value",render:e=>(0,o.jsx)(m.A,{color:"blue",children:e})}],pagination:!1,size:"small"})})]})}},54178:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/manage",function(){return t(50423)}])}},e=>{e.O(0,[260,167,382,628,271,700,174,985,400,577,935,636,593,792],()=>e(e.s=54178)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46],{69:(e,n)=>{"use strict";n.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"}},2256:(e,n,t)=>{"use strict";t.d(n,{A:()=>a});let a=t(25341).A},5450:(e,n)=>{"use strict";n.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"}},6578:(e,n,t)=>{"use strict";async function a(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 o(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(n))}async function s(e){var n,t;let o=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&o.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&o.set("category",e.category),(null==e?void 0:e.page)&&o.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&o.set("limit",String(null!=(t=e.limit)?t:50)),a("/api/kb/files?".concat(o))}async function i(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),a("/api/kb/files/detail?".concat(t))}async function c(e,n){return a("/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 a("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function r(e){return new Promise((n,t)=>{let a=new FileReader;a.onload=()=>{let e=a.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},a.onerror=t,a.readAsDataURL(e)})}async function d(e,n,t){return a("/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 r(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function m(e){return a("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),a("/api/kb/operations?".concat(n))}async function u(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),a("/api/kb/operations?".concat(n),{method:"DELETE"})}async function h(e,n){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function y(e,n){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function f(e){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return a("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function v(){return a("/api/kb/features")}async function b(e,n){var t,o,s,i,c;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!=(c=n.limit)?c:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&l.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(o=n.weights)?void 0:o.vector)!=null&&l.set("vectorWeight",String(n.weights.vector)),(null==n||null==(s=n.weights)?void 0:s.rewrite)!=null&&l.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(i=n.weights)?void 0:i.hybridBonus)!=null&&l.set("hybridBonus",String(n.weights.hybridBonus)),a("/api/kb/search?".concat(l))}async function j(){return a("/api/prompt")}async function x(e){return a("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function A(e){return a("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e,n){return a("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function S(e){return a("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e){return a("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(){return a("/api/documents/specs")}async function T(e){return a("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return a("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(){return a("/api/documents/templates")}async function k(e){return a("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return a("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return a("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function U(e){return a("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(){return a("/api/documents/generated")}async function I(e){return a("/api/documents/generated/".concat(encodeURIComponent(e)))}async function z(e,n){return a("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function L(){return a("/api/assets/generated")}async function J(e){return a("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function M(e){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function D(e,n){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function K(e){return a("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function H(e,n){return a("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function V(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 B(){return a("/api/config/providers")}async function F(e,n){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function G(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function W(){return a("/api/config/models")}async function X(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Z(){return a("/api/config/embedding")}async function q(e){return a("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Q(){return a("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function $(){return a("/api/system/stats")}async function ee(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return a("/api/context".concat(t))}async function en(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function et(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ea(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function eo(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function es(e,n){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ei(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>H,Bh:()=>ei,Dl:()=>P,E:()=>ea,EK:()=>T,ER:()=>N,FC:()=>$,FV:()=>C,H1:()=>g,H7:()=>u,HC:()=>c,HT:()=>s,II:()=>Z,JU:()=>J,NR:()=>S,OX:()=>U,PH:()=>et,QT:()=>m,Qx:()=>p,R1:()=>K,SJ:()=>y,UE:()=>V,VW:()=>v,W2:()=>b,X8:()=>f,Z3:()=>B,_m:()=>F,a6:()=>z,aP:()=>X,bV:()=>R,bZ:()=>Y,c1:()=>d,cQ:()=>_,dd:()=>q,dg:()=>A,dw:()=>w,dx:()=>j,f$:()=>L,h0:()=>E,h1:()=>G,hc:()=>o,hn:()=>ee,l2:()=>k,lv:()=>x,mx:()=>O,oS:()=>D,p:()=>en,tn:()=>l,u6:()=>Q,uc:()=>M,v7:()=>I,xC:()=>i,xq:()=>h,xw:()=>eo,zo:()=>es,zr:()=>W})},13114:(e,n,t)=>{"use strict";t.d(n,{A:()=>c});var a=t(97109),o=t(5450),s=t(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let c=a.forwardRef((e,n)=>a.createElement(s.A,i({},e,{ref:n,icon:o.A})))},15527:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>K});var a=t(65321),o=t(97109),s=t(13014),i=t(17807),c=t(85114),l=t(68787),r=t(2256),d=t(38770),m=t(33442),p=t(26171),u=t(11702),h=t(85493),y=t(63455),f=t(57271),g=t(7576),v=t(94992),b=t(25258),j=t(56985),x=t(54746),A=t(29071),C=t(59188),S=t(4216),w=t(13114),O=t(99650),T=t(58209),N=t(69),P=t(88483);function k(){return(k=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let E=o.forwardRef((e,n)=>o.createElement(P.A,k({},e,{ref:n,icon:N.A})));var R=t(30289);function U(){return(U=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let _=o.forwardRef((e,n)=>o.createElement(P.A,U({},e,{ref:n,icon:R.A})));var I=t(6578),z=t(42323),L=t.n(z);let J=[{label:"OpenAI 兼容",value:"openai"},{label:"Anthropic",value:"anthropic"},{label:"Google",value:"google"},{label:"Ollama",value:"ollama"},{label:"OpenRouter",value:"openrouter"}],M=[{key:"reader",labelKey:"models.tierReader",descKey:"models.tierReaderDesc"},{key:"reasoning",labelKey:"models.tierReasoning",descKey:"models.tierReasoningDesc"},{key:"action",labelKey:"models.tierAction",descKey:"models.tierActionDesc"}],D=[{key:"imageGeneration",label:"图片生成"},{key:"imageUnderstanding",label:"图片理解"},{key:"fileUnderstanding",label:"文件理解"},{key:"audio",label:"音频能力"},{key:"video",label:"视频能力"}];function K(){let e=(0,s.Vr)(),{message:n}=i.A.useApp(),t=[{label:e("models.embeddingProviderHash"),value:"hash"},{label:e("models.embeddingProviderOpenAI"),value:"openai-compatible"}],[N,P]=(0,o.useState)(!0),[k,R]=(0,o.useState)([]),[U,z]=(0,o.useState)(null),[K,H]=(0,o.useState)({provider:"hash",dimensions:384}),[V,B]=(0,o.useState)(!1),[F,G]=(0,o.useState)(!1),[W,X]=(0,o.useState)(null),[Z,q]=(0,o.useState)(!1),[Q,Y]=(0,o.useState)(""),[$,ee]=(0,o.useState)(""),[en,et]=(0,o.useState)(""),[ea,eo]=(0,o.useState)("openai"),[es,ei]=(0,o.useState)({}),[ec,el]=(0,o.useState)(!1),[er,ed]=(0,o.useState)(!1),[em,ep]=(0,o.useState)(""),[eu,eh]=(0,o.useState)(""),[ey,ef]=(0,o.useState)(""),[eg,ev]=(0,o.useState)(""),[eb,ej]=(0,o.useState)("openai"),[ex,eA]=(0,o.useState)({}),[eC,eS]=(0,o.useState)(!1),[ew,eO]=(0,o.useState)(null),[eT,eN]=(0,o.useState)({}),eP=async()=>{P(!0);try{let[e,n,t]=await Promise.all([(0,I.Z3)().catch(()=>[]),(0,I.zr)().catch(()=>null),(0,I.II)().catch(()=>({provider:"hash",dimensions:384}))]);R(e),z(n),H(t)}catch(t){n.error(e("common.error"))}finally{P(!1)}};(0,o.useEffect)(()=>{eP()},[]);let ek=async()=>{if(Q.trim()){el(!0);try{await (0,I._m)(Q.trim(),{apiKey:$||void 0,baseUrl:en||void 0,protocol:ea,capabilities:es}),q(!1),Y(""),ee(""),et(""),eo("openai"),ei({}),await eP(),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}finally{el(!1)}}},eE=async t=>{try{await (0,I.h1)(t),await eP(),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},eR=async e=>{ep(e.name),eh(e.name),ef("");try{let n=await (0,I.Bh)(e.name);ef(n.apiKey?"••••••••":""),ev(n.baseUrl||""),ej(n.protocol||n.detectedProtocol||"openai"),eA(n.capabilities||{})}catch(n){ev(e.baseUrl||""),ej(e.protocol||e.detectedProtocol||"openai"),eA(e.capabilities||{})}ed(!0)},eU=async()=>{if(eu.trim()){eS(!0);try{let t=ey.includes("•")?void 0:ey||void 0;await (0,I._m)(eu.trim(),{oldName:em,apiKey:t,baseUrl:eg||void 0,protocol:eb,capabilities:ex}),ed(!1),ep(""),eh(""),ef(""),ev(""),ej("openai"),eA({}),await eP(),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}finally{eS(!1)}}},e_=async t=>{eO(t);try{let a=await (0,I.bZ)(t);eN(e=>({...e,[t]:a.success})),n[a.success?"success":"error"](a.success?e("models.connected"):e("models.connectionFailed"))}catch(e){eN(e=>({...e,[t]:!1}))}finally{eO(null)}},eI=async()=>{B(!0);try{let t=await (0,I.dd)(K);H(t),X(null),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}finally{B(!1)}},ez=async()=>{G(!0);try{let t=await (0,I.u6)();X(t.success),n[t.success?"success":"error"](t.message||(t.success?e("models.connected"):e("models.connectionFailed")))}catch(t){X(!1),n.error(e("common.error"))}finally{G(!1)}},eL=async(t,a)=>{if(!U)return;let o={...U},s=o[t];if(!a){s.active="",z(o);try{await (0,I.aP)(o)}catch(t){n.error(e("common.error"))}return}let i=a.indexOf(":"),c=i>=0?a.slice(0,i):a,l=i>=0?a.slice(i+1):a;s.active=l,s.list.some(e=>e.name===l&&e.provider===c)||s.list.push({name:l,provider:c}),z(o);try{await (0,I.aP)(o)}catch(t){n.error(e("common.error"))}};return(0,a.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle",children:e("models.title")}),(0,a.jsx)("p",{className:"pageDesc",children:e("models.description")})]}),(0,a.jsx)(c.Ay,{type:"primary",icon:(0,a.jsx)(x.A,{}),onClick:()=>q(!0),children:e("models.addModel")})]}),(0,a.jsx)(l.A,{title:e("models.modelList"),size:"small",loading:N,children:0===k.length?(0,a.jsx)("span",{className:L().cardMeta,children:e("models.noProviders")}):(0,a.jsx)(r.A,{gutter:[12,12],align:"stretch",children:k.map(n=>(0,a.jsx)(d.A,{xs:24,sm:12,lg:8,xl:6,className:L().providerGrid,children:(0,a.jsxs)(l.A,{size:"small",className:L().providerCard,children:[(0,a.jsxs)("div",{className:L().cardAction,children:[(0,a.jsxs)("div",{className:L().cardMain,children:[(0,a.jsx)("div",{className:L().cardName,title:n.name,children:n.name}),(0,a.jsxs)("div",{className:L().cardMeta,children:[(0,a.jsx)(A.A,{})," ",n.protocol||n.detectedProtocol||"openai"]})]}),(0,a.jsxs)(m.A,{size:2,wrap:!1,children:[(0,a.jsx)(c.Ay,{size:"small",type:"text",loading:ew===n.name,onClick:()=>{e_(n.name)},icon:!0===eT[n.name]?(0,a.jsx)(C.A,{className:"text-[var(--colorOk)]"}):!1===eT[n.name]?(0,a.jsx)(S.A,{className:"text-[var(--colorDanger)]"}):(0,a.jsx)(w.A,{})}),(0,a.jsx)(c.Ay,{size:"small",type:"text",icon:(0,a.jsx)(O.A,{}),onClick:()=>{eR(n)}}),(0,a.jsx)(p.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{eE(n.name)},children:(0,a.jsx)(c.Ay,{size:"small",type:"text",danger:!0,icon:(0,a.jsx)(T.A,{})})})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,a.jsxs)("span",{className:"".concat(L().cardMeta," text-xs"),children:[(0,a.jsx)(E,{})," ",n.hasApiKey?"••••••••":"—"]}),n.baseUrl&&(0,a.jsxs)("span",{className:"".concat(L().cardMeta," ").concat(L().urlLine," text-xs"),title:n.baseUrl,children:[(0,a.jsx)(_,{})," ",n.baseUrl]}),(0,a.jsx)(m.A,{size:[4,4],wrap:!0,children:D.filter(e=>{var t;return null==(t=n.capabilities)?void 0:t[e.key]}).map(e=>(0,a.jsx)(u.A,{color:"purple",children:e.label},e.key))})]})]})},n.name))})}),(0,a.jsxs)(l.A,{title:e("models.embeddingConfig"),size:"small",loading:N,children:[(0,a.jsx)(h.A,{className:"mb-4",type:"info",showIcon:!0,message:e("models.embeddingHint")}),(0,a.jsxs)(y.A,{layout:"vertical",size:"middle",children:[(0,a.jsxs)(r.A,{gutter:[12,12],children:[(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(y.A.Item,{label:e("models.embeddingProvider"),children:(0,a.jsx)(f.A,{value:K.provider,options:t,onChange:e=>H(n=>({...n,provider:e,dimensions:"hash"===e?384:n.dimensions||1024}))})})}),"openai-compatible"===K.provider&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(y.A.Item,{label:"Base URL",children:(0,a.jsx)(g.A,{value:K.baseUrl,onChange:e=>H(n=>({...n,baseUrl:e.target.value})),placeholder:"http://localhost:11434/v1"})})}),(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(y.A.Item,{label:e("models.model"),children:(0,a.jsx)(g.A,{value:K.model,onChange:e=>H(n=>({...n,model:e.target.value})),placeholder:"bge-m3"})})}),(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(y.A.Item,{label:e("models.apiKey"),help:K.hasApiKey?e("models.embeddingApiKeyHint"):void 0,children:(0,a.jsx)(g.A.Password,{value:K.apiKey,onFocus:()=>{var e;(null==(e=K.apiKey)?void 0:e.includes("•"))&&H(e=>({...e,apiKey:""}))},onChange:e=>H(n=>({...n,apiKey:e.target.value})),placeholder:e("models.optional")})})})]}),(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(y.A.Item,{label:e("models.dimensions"),children:(0,a.jsx)(v.A,{className:"w-full",min:1,value:K.dimensions,onChange:e=>H(n=>({...n,dimensions:Number(e||("hash"===n.provider?384:1024))}))})})}),(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(y.A.Item,{label:e("models.status"),children:(0,a.jsxs)(m.A,{children:[(0,a.jsx)(u.A,{color:"hash"===K.provider?"default":"blue",children:"hash"===K.provider?e("models.localHash"):e("models.openAICompatible")}),!0===W&&(0,a.jsx)(u.A,{color:"success",children:e("models.connected")}),!1===W&&(0,a.jsx)(u.A,{color:"error",children:e("models.connectionFailed")})]})})})]}),(0,a.jsxs)(m.A,{children:[(0,a.jsx)(c.Ay,{type:"primary",loading:V,onClick:()=>{eI()},children:e("models.saveEmbedding")}),(0,a.jsx)(c.Ay,{icon:(0,a.jsx)(w.A,{}),loading:F,onClick:()=>{ez()},children:e("models.testEmbedding")})]})]})]}),U&&(0,a.jsx)(l.A,{title:e("models.modelTiers"),size:"small",children:(0,a.jsx)(r.A,{gutter:[12,12],children:M.map(t=>{var o;let{key:s,labelKey:i,descKey:c}=t,r=U[s],m=r.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),p=k.filter(e=>!r.list.some(n=>n.provider===e.name)).map(e=>({label:"".concat(e.name," / ").concat(e.name),value:"".concat(e.name,":").concat(e.name)}));return(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsxs)(l.A,{size:"small",title:e(i),children:[(0,a.jsx)("span",{className:L().tierDesc,children:e(c)}),(0,a.jsx)(f.A,{value:r.active?"".concat((null==(o=r.list.find(e=>e.name===r.active))?void 0:o.provider)||"",":").concat(r.active):void 0,onChange:e=>{eL(s,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),className:"w-full",options:[...m,...p]}),r.list.length>0&&(0,a.jsx)("div",{className:L().modelTags,children:r.list.map(t=>(0,a.jsxs)(u.A,{color:t.name===r.active?"blue":void 0,closable:!0,onClose:()=>{var a,o;let i={...U},c=i[s];c.list=c.list.filter(e=>e.name!==t.name||e.provider!==t.provider),c.active===t.name&&(c.active=null!=(o=null==(a=c.list[0])?void 0:a.name)?o:""),z(i),(0,I.aP)(i).catch(()=>n.error(e("common.error")))},children:[t.provider,"/",t.name]},"".concat(t.provider,":").concat(t.name)))})]})},s)})})}),(0,a.jsx)(b.A,{maskClosable:!1,title:e("models.addModel"),open:Z,onCancel:()=>{q(!1),Y(""),ee(""),et(""),eo("openai")},onOk:()=>{ek()},confirmLoading:ec,children:(0,a.jsxs)(y.A,{layout:"vertical",size:"middle",children:[(0,a.jsx)(y.A.Item,{label:e("models.modelName"),children:(0,a.jsx)(g.A,{value:Q,onChange:e=>Y(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,a.jsx)(y.A.Item,{label:e("models.apiKey"),children:(0,a.jsx)(g.A.Password,{value:$,onChange:e=>ee(e.target.value),placeholder:"sk-..."})}),(0,a.jsx)(y.A.Item,{label:e("models.baseUrl"),children:(0,a.jsx)(g.A,{value:en,onChange:e=>et(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,a.jsx)(y.A.Item,{label:e("models.protocol"),children:(0,a.jsx)(f.A,{value:ea,onChange:eo,options:J})}),(0,a.jsx)(y.A.Item,{label:"多模态能力",children:(0,a.jsx)(j.A.Group,{value:D.filter(e=>es[e.key]).map(e=>e.key),options:D.map(e=>({label:e.label,value:e.key})),onChange:e=>ei(Object.fromEntries(D.map(n=>[n.key,e.includes(n.key)])))})})]})}),(0,a.jsx)(b.A,{maskClosable:!1,title:e("models.editModel"),open:er,onCancel:()=>{ed(!1),ep(""),eh(""),ef(""),ev(""),ej("openai")},onOk:()=>{eU()},confirmLoading:eC,children:(0,a.jsxs)(y.A,{layout:"vertical",size:"middle",children:[(0,a.jsx)(y.A.Item,{label:e("models.modelName"),children:(0,a.jsx)(g.A,{value:eu,onChange:e=>eh(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,a.jsx)(y.A.Item,{label:e("models.apiKey"),help:e("models.apiKeyEditHint"),children:(0,a.jsx)(g.A.Password,{value:ey,onFocus:()=>{ey.includes("•")&&ef("")},onCopy:e=>e.preventDefault(),onChange:e=>ef(e.target.value),placeholder:e("models.apiKeyEditPlaceholder")})}),(0,a.jsx)(y.A.Item,{label:e("models.baseUrl"),children:(0,a.jsx)(g.A,{value:eg,onChange:e=>ev(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,a.jsx)(y.A.Item,{label:e("models.protocol"),children:(0,a.jsx)(f.A,{value:eb,onChange:ej,options:J})}),(0,a.jsx)(y.A.Item,{label:"多模态能力",children:(0,a.jsx)(j.A.Group,{value:D.filter(e=>ex[e.key]).map(e=>e.key),options:D.map(e=>({label:e.label,value:e.key})),onChange:e=>eA(Object.fromEntries(D.map(n=>[n.key,e.includes(n.key)])))})})]})})]})}},29071:(e,n,t)=>{"use strict";t.d(n,{A:()=>c});var a=t(97109),o=t(78847),s=t(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let c=a.forwardRef((e,n)=>a.createElement(s.A,i({},e,{ref:n,icon:o.A})))},30289:(e,n)=>{"use strict";n.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"}},38770:(e,n,t)=>{"use strict";t.d(n,{A:()=>a});let a=t(51916).A},42323: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"}},77305:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return t(15527)}])},78847:(e,n)=>{"use strict";n.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"}}},e=>{e.O(0,[260,167,382,628,271,576,183,985,232,20,636,593,792],()=>e(e.s=77305)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[449],{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 s(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 r(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 c(e,n,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function l(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 l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n))}async function y(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function m(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 g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function v(){return o("/api/kb/features")}async function x(e,n){var t,i,s,r,a;let c=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&c.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&c.set("category",n.category),(null==n?void 0:n.limit)&&c.set("limit",String(null!=(a=n.limit)?a:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&c.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(i=n.weights)?void 0:i.vector)!=null&&c.set("vectorWeight",String(n.weights.vector)),(null==n||null==(s=n.weights)?void 0:s.rewrite)!=null&&c.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(r=n.weights)?void 0:r.hybridBonus)!=null&&c.set("hybridBonus",String(n.weights.hybridBonus)),o("/api/kb/search?".concat(c))}async function j(){return o("/api/prompt")}async function T(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function S(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function b(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 k(){return o("/api/documents/specs")}async function A(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return o("/api/documents/templates")}async function P(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function U(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J(){return o("/api/documents/generated")}async function D(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function I(e,n){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function L(){return o("/api/assets/generated")}async function z(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function _(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function B(e,n){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function F(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function M(e,n){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function H(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 W(){return o("/api/config/providers")}async function V(e,n){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function X(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function q(){return o("/api/config/models")}async function Q(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Z(){return o("/api/config/embedding")}async function K(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function G(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function Y(){return o("/api/system/stats")}async function ee(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function en(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function et(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function eo(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ei(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function es(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function er(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>M,Bh:()=>er,Dl:()=>E,E:()=>eo,EK:()=>A,ER:()=>O,FC:()=>Y,FV:()=>w,H1:()=>g,H7:()=>y,HC:()=>a,HT:()=>s,II:()=>Z,JU:()=>z,NR:()=>b,OX:()=>U,PH:()=>et,QT:()=>u,Qx:()=>p,R1:()=>F,SJ:()=>h,UE:()=>H,VW:()=>v,W2:()=>x,X8:()=>f,Z3:()=>W,_m:()=>V,a6:()=>I,aP:()=>Q,bV:()=>R,bZ:()=>G,c1:()=>d,cQ:()=>J,dd:()=>K,dg:()=>S,dw:()=>C,dx:()=>j,f$:()=>L,h0:()=>N,h1:()=>X,hc:()=>i,hn:()=>ee,l2:()=>P,lv:()=>T,mx:()=>k,oS:()=>B,p:()=>en,tn:()=>c,u6:()=>$,uc:()=>_,v7:()=>D,xC:()=>r,xq:()=>m,xw:()=>ei,zo:()=>es,zr:()=>q})},27795:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>b});var o=t(65321),i=t(97109),s=t(13014),r=t(85114),a=t(2256),c=t(38770),l=t(68787),d=t(99605),u=t(54849),p=t(33442),y=t(11702),m=t(86109),h=t(99811),f=t(520),g=t(93314),v=t(13114),x=t(29071),j=t(26631),T=t(84742),S=t(38762),w=t(6578);function b(){var e,n,t,b,C,k,A,O,E,P,N,R;let U=(0,s.Vr)(),J=(0,m.useRouter)(),[D,I]=(0,i.useState)(null),[L,z]=(0,i.useState)(!0),[_,B]=(0,i.useState)(0),F=(0,i.useCallback)(async()=>{z(!0);try{let[e,n]=await Promise.all([(0,w.FC)(),(0,w.Z3)().catch(()=>[])]);I(e),B(Array.isArray(n)?n.length:0)}catch(e){}finally{z(!1)}},[]);(0,i.useEffect)(()=>{F();let e=setInterval(()=>{F()},1e4);return()=>clearInterval(e)},[F]);let M=(null!=(n=null==D?void 0:D.cpu.usagePercent)?n:0)>80?"var(--colorDanger)":(null!=(t=null==D?void 0:D.cpu.usagePercent)?t:0)>50?"var(--colorWarning)":"var(--colorOk)",H=(null!=(b=null==D?void 0:D.memory.usagePercent)?b:0)>80?"var(--colorDanger)":(null!=(C=null==D?void 0:D.memory.usagePercent)?C:0)>50?"var(--colorWarning)":"var(--colorOk)",W=(null==D?void 0:D.tasks.total)?Math.round(D.tasks.success/D.tasks.total*100):0,V=null==D||null==(e=D.models)?void 0:e[0];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:U("overview.title")}),(0,o.jsx)("p",{className:"pageDesc",children:U("overview.description")})]}),(0,o.jsx)(r.Ay,{icon:(0,o.jsx)(h.A,{spin:L}),loading:L,onClick:()=>{F()},children:U("common.retry")})]}),(0,o.jsxs)(a.A,{gutter:[16,16],children:[(0,o.jsx)(c.A,{xs:24,sm:12,children:(0,o.jsx)(l.A,{size:"small",title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(f.A,{})," CPU"]}),children:(0,o.jsxs)("div",{style:{textAlign:"center"},children:[(0,o.jsx)(d.A,{type:"circle",percent:null!=(k=null==D?void 0:D.cpu.usagePercent)?k:0,size:120,strokeColor:M,format:e=>"".concat(null==e?void 0:e.toFixed(1),"%")}),(0,o.jsxs)("div",{className:"text-xs mt-2",style:{color:"var(--colorTextSecondary)"},children:[null!=(A=null==D?void 0:D.cpu.cores)?A:0," ",U("overview.cores")]})]})})}),(0,o.jsx)(c.A,{xs:24,sm:12,children:(0,o.jsx)(l.A,{size:"small",title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g.A,{})," ",U("overview.memory")]}),children:(0,o.jsxs)("div",{style:{textAlign:"center"},children:[(0,o.jsx)(d.A,{type:"circle",percent:null!=(O=null==D?void 0:D.memory.usagePercent)?O:0,size:120,strokeColor:H,format:e=>"".concat(e,"%")}),(0,o.jsxs)("div",{className:"text-xs mt-2",style:{color:"var(--colorTextSecondary)"},children:[null!=(E=null==D?void 0:D.memory.processMB)?E:0," MB / ",null!=(P=null==D?void 0:D.memory.totalMB)?P:0," MB"]})]})})})]}),(0,o.jsxs)(a.A,{gutter:[16,16],children:[(0,o.jsx)(c.A,{xs:12,sm:6,children:(0,o.jsx)(l.A,{size:"small",children:(0,o.jsx)(u.A,{title:U("overview.providersCount"),value:_,prefix:(0,o.jsx)(v.A,{})})})}),(0,o.jsx)(c.A,{xs:12,sm:6,children:(0,o.jsx)(l.A,{size:"small",children:(0,o.jsx)(u.A,{title:U("overview.tokensUsed"),value:null!=(N=null==D?void 0:D.tokens.total)?N:0,prefix:(0,o.jsx)(x.A,{})})})}),(0,o.jsx)(c.A,{xs:12,sm:6,children:(0,o.jsx)(l.A,{size:"small",children:(0,o.jsx)(u.A,{title:U("overview.tasksTotal"),value:null!=(R=null==D?void 0:D.tasks.total)?R:0,prefix:(0,o.jsx)(j.A,{})})})}),(0,o.jsx)(c.A,{xs:12,sm:6,children:(0,o.jsx)(l.A,{size:"small",children:(0,o.jsx)(u.A,{title:U("overview.successRate"),value:W,suffix:"%",prefix:W>80?(0,o.jsx)(T.A,{style:{color:"var(--colorOk)"}}):(0,o.jsx)(S.A,{style:{color:"var(--colorDanger)"}})})})})]}),(0,o.jsxs)(a.A,{gutter:[16,16],children:[(0,o.jsx)(c.A,{xs:24,sm:12,children:(0,o.jsx)(l.A,{size:"small",title:U("overview.topModel"),children:V?(0,o.jsxs)("div",{className:"flex items-center gap-4",children:[(0,o.jsx)(v.A,{style:{fontSize:24,color:"var(--colorAccent)"}}),(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:"font-semibold",children:V.model}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["@",V.provider," — ",V.count," ",U("overview.calls")]})]})]}):(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:U("common.noData")})})}),(0,o.jsx)(c.A,{xs:24,sm:12,children:(0,o.jsx)(l.A,{size:"small",title:U("overview.taskTypes"),children:(null==D?void 0:D.tasks.types)&&Object.keys(D.tasks.types).length>0?(0,o.jsx)(p.A,{wrap:!0,children:Object.entries(D.tasks.types).map(e=>{let[n,t]=e;return(0,o.jsxs)(y.A,{children:[n.slice(0,30),": ",t]},n)})}):(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:U("common.noData")})})})]}),(0,o.jsx)(l.A,{title:U("overview.quickActions"),size:"small",children:(0,o.jsxs)(p.A,{wrap:!0,children:[(0,o.jsx)(r.Ay,{onClick:()=>{J.push("/knowledge/manage")},children:U("overview.goToKnowledge")}),(0,o.jsx)(r.Ay,{onClick:()=>{J.push("/models")},children:U("overview.goToModels")}),(0,o.jsx)(r.Ay,{onClick:()=>{J.push("/settings")},children:U("overview.goToSettings")}),(0,o.jsx)(r.Ay,{onClick:()=>{J.push("/prompt")},children:U("nav.promptManagement")}),(0,o.jsx)(r.Ay,{onClick:()=>{J.push("/context/long-term")},children:U("nav.contextEngineering")})]})})]})}},53139:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/overview",function(){return t(27795)}])}},e=>{e.O(0,[260,167,15,577,224,636,593,792],()=>e(e.s=53139)),_N_E=e.O()}]);
|