@customize-agent/server 3.0.3 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +44 -44
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/chunks/76.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/api/kb/files.js +1 -1
- package/.next/server/pages/api/prompt.js +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/index.html +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/search.html +1 -1
- package/.next/server/pages/knowledge.html +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages/prompt.html +1 -1
- package/.next/server/pages/settings.html +1 -1
- package/.next/server/pages-manifest.json +9 -9
- package/.next/static/5G3hi1he-iERgAflQ5C6N/_buildManifest.js +1 -0
- package/.next/static/chunks/{15-341041188dc9798c.js → 15-fed70feebb38d5ae.js} +1 -1
- package/.next/static/chunks/{425-19f06b6c359bb015.js → 425-feceb6e39a2b417d.js} +1 -1
- package/.next/static/chunks/{584-ce8dbed7354f3644.js → 584-69cdccc7c09c47c9.js} +1 -1
- package/.next/static/chunks/{668-96407d9c7815e896.js → 668-db7413b6a8481a6b.js} +1 -1
- package/.next/static/chunks/740-450a37b8ca6fe1c6.js +16 -0
- package/.next/static/chunks/958-0f3a960f8ebe421b.js +1 -0
- package/.next/static/chunks/pages/context/long-term-c26d658c17b69f42.js +1 -0
- package/.next/static/chunks/pages/context/short-term-4413a02c8d732c22.js +1 -0
- package/.next/static/chunks/pages/knowledge/{file-detail-f14cf891dcdf9193.js → file-detail-2ec816e3794317ae.js} +1 -1
- package/.next/static/chunks/pages/knowledge/files-392fd049e0ccc02a.js +1 -0
- package/.next/static/chunks/pages/knowledge/manage-8fbcfeac89571725.js +1 -0
- package/.next/static/chunks/pages/knowledge/search-cdf2ef5d3b41e487.js +1 -0
- package/.next/static/chunks/pages/{models-1af65b8a7006b9a0.js → models-3ee0a169fc9e741e.js} +1 -1
- package/.next/static/chunks/pages/overview-756ea4a035f2d997.js +1 -0
- package/.next/static/chunks/pages/{prompt-024bde9aa4fb4320.js → prompt-b3dd1eeaf8e1c72e.js} +1 -1
- package/.next/static/css/d284a7454d6f6b06.css +1 -0
- package/package.json +4 -4
- package/.next/static/8RJzQXkwI3IjwAJH4aPrr/_buildManifest.js +0 -1
- package/.next/static/chunks/740-0a79dd7ac8c2c334.js +0 -16
- package/.next/static/chunks/958-6f0cb200491b344e.js +0 -1
- package/.next/static/chunks/pages/context/long-term-90d88a67527287ef.js +0 -1
- package/.next/static/chunks/pages/context/short-term-5a07a4e0ef35411a.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-019110a9065f249b.js +0 -1
- package/.next/static/chunks/pages/knowledge/manage-a894b2e4cbba0cbd.js +0 -1
- package/.next/static/chunks/pages/knowledge/search-39d8e63e83c02003.js +0 -1
- package/.next/static/chunks/pages/overview-85235179b50647b3.js +0 -1
- package/.next/static/css/a89ea06061dcfec7.css +0 -1
- /package/.next/static/{8RJzQXkwI3IjwAJH4aPrr → 5G3hi1he-iERgAflQ5C6N}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28],{426:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/files",function(){return n(6451)}])},2803:(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"}},3793:(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"}},4569: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"}},5258:(e,t,n)=>{"use strict";n.d(t,{A:()=>w});var a=n(1541),r=n(1848),s=n(1249),i=n(7109),o=n(2658),c=n(3638),l=n(2162),d=n(2725),u=n(4567),h=n(632),p=n(9517),y=n(9412),f=n(9527);let g=(0,d.U)(e=>{let{prefixCls:t,className:n,closeIcon:a,closable:r,type:s,title:d,children:g,footer:m,classNames:v,styles:x,...w}=e,{getPrefixCls:j}=i.useContext(u.QO),{className:b,style:_,classNames:k,styles:C}=(0,u.TP)("modal"),S=j(),P=t||j("modal"),A=(0,h.A)(S),[N,T]=(0,f.Ay)(P,A),[O,E]=(0,l.AV)([k,v],[C,x],{props:e}),L=`${P}-confirm`,I={};return I=s?{closable:r??!1,title:"",footer:"",children:i.createElement(p.k,{...e,prefixCls:P,confirmPrefixCls:L,rootPrefixCls:S,content:g})}:{closable:r??!0,title:d,footer:null!==m&&i.createElement(y.w,{...e}),children:g},i.createElement(o.Z,{prefixCls:P,className:(0,c.$)(N,`${P}-pure-panel`,s&&L,s&&`${L}-${s}`,n,b,T,A,O.root),style:{..._,...E.root},...w,closeIcon:(0,y.O)(P,a),closable:r,classNames:O,styles:E,...I})});var m=n(9739);function v(e){return(0,a.Ay)((0,a.fp)(e))}let x=s.A;x.useModal=m.A,x.info=function(e){return(0,a.Ay)((0,a.$D)(e))},x.success=function(e){return(0,a.Ay)((0,a.Ej)(e))},x.error=function(e){return(0,a.Ay)((0,a.jT)(e))},x.warning=v,x.warn=v,x.confirm=function(e){return(0,a.Ay)((0,a.lr)(e))},x.destroyAll=function(){for(;r.A.length;){let e=r.A.pop();e&&e()}},x.config=a.FB,x._InternalPanelDoNotUseOrYouWillBeFired=g;let w=x},5551:(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 r(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),r=Math.floor(a/24);return r>30?new Date(e).toLocaleDateString(t):"en-US"===t?r>0?"".concat(r,"d ago"):a>0?"".concat(a,"h ago"):n>0?"".concat(n,"m ago"):"Just now":r>0?"".concat(r," 天前"):a>0?"".concat(a," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>o,fw:()=>r,z3:()=>a});let s={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 o(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?i:s)[e])?t:e}},6451:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>E});var a=n(5321),r=n(7109),s=n(9018),i=n(3220),o=n.n(i),c=n(4986),l=n(7807),d=n(5258),u=n(3442),h=n(1702),p=n(5114),y=n(4668),f=n(7271),g=n(2551),m=n(9605),v=n(8787),x=n(8584),w=n(6631),j=n(8209),b=n(486),_=n(2803),k=n(8483);function C(){return(C=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=r.forwardRef((e,t)=>r.createElement(k.A,C({},e,{ref:t,icon:_.A})));var P=n(6578),A=n(5551),N=n(4569),T=n.n(N);let O=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function E(){let e=(0,s.Vr)("knowledge"),{locale:t}=(0,s.x_)(),{message:n}=l.A.useApp(),i=(0,c.useSearchParams)().get("category")||"",[_,k]=(0,r.useState)([]),[C,N]=(0,r.useState)(!0),[E,L]=(0,r.useState)(""),[I,R]=(0,r.useState)(i),[M,J]=(0,r.useState)(!1),[D,z]=(0,r.useState)([]),[H,U]=(0,r.useState)([]),[B,V]=(0,r.useState)(1),F=(0,r.useRef)(I);(0,r.useEffect)(()=>{F.current=I},[I]);let W=(0,r.useCallback)(async e=>{let t=null!=e?e:F.current;N(!0);try{let e=await (0,P.HT)({category:t||void 0,limit:200});k(e.files||[])}catch(e){k([])}finally{N(!1)}},[]);(0,r.useEffect)(()=>{W(I)},[I,W]);let X=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}),$=(0,r.useCallback)(async()=>{try{let e=await (0,P.Qx)();z(e.operations.map(X))}catch(e){}},[]);(0,r.useEffect)(()=>{$()},[$]);let Q=async e=>{if(0===e.length)return;let t=1===e.length?e[0].name:"".concat(e.length," 个文件");J(!0),z(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)),r=setInterval(()=>{(0,P.QT)(a).then(e=>{z(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 s,i;let o=await (0,P.c1)(e,void 0,a);clearInterval(r),(null==(s=o.vectorStatus)?void 0:s.status)==="error"?n.info("文件已上传,正在后台入库"):n.success("上传成功"),L(""),R(""),U([]),V(1),F.current="";let c=null==(i=o.files)?void 0:i.find(e=>e.relativePath===o.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 $(),z(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(o.files)?k(o.files):(await (0,P.H1)(),await W(""),await $())}catch(e){n.error("上传失败"),z(e=>[{type:"error",title:"上传失败 ".concat(t),description:"请重试或检查文件格式",status:"error"},...e].slice(0,50))}finally{clearInterval(r),J(!1)}},q=e=>{let t="selected"===e?H.map(String):"filtered"===e?K.map(e=>e.relativePath):_.map(e=>e.relativePath);if(0===t.length)return;let a="all"===e?"删除全部 ".concat(t.length," 个文件?"):"filtered"===e?"删除当前筛选结果 ".concat(t.length," 个文件?"):"删除已选 ".concat(t.length," 个文件?");d.A.confirm({title:a,content:"将同时删除文件、切片、索引和向量记录。此操作不可撤销。",okText:"确认删除",cancelText:"取消",okButtonProps:{danger:!0},onOk:async()=>{z(e=>[{type:"delete",title:a,description:"正在批量删除文件和索引",status:"processing",percent:10},...e].slice(0,50));try{var r;let a="all"===e?await (0,P.X8)():await (0,P.SJ)(t);n.success("已删除 ".concat(null!=(r=a.deleted)?r:t.length," 个文件")),U([]),z(e=>{var n;return[{type:"delete",title:"批量删除完成",description:"已删除 ".concat(null!=(n=a.deleted)?n:t.length," 个文件、切片和索引"),status:"success"},...e].slice(0,50)}),await W(),await $()}catch(e){n.error("批量删除失败"),z(e=>[{type:"error",title:"批量删除失败",description:"请重试",status:"error"},...e].slice(0,50))}}})},K=E?_.filter(e=>e.relativePath.toLowerCase().includes(E.toLowerCase())):_,Z=[{title:e("fileName"),dataIndex:"relativePath",key:"name",render:e=>(0,a.jsxs)(u.A,{children:[(0,a.jsx)(w.A,{}),(0,a.jsx)(o(),{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)(h.A,{children:(0,A.Jm)(e,t)})},{title:e("fileSize"),dataIndex:"fileSize",key:"size",width:100,render:e=>(0,A.z3)(e)},{title:"切片",dataIndex:"chunkCount",key:"chunks",width:90,render:e=>(0,a.jsx)(h.A,{color:e>1?"green":"orange",children:e})},{title:"解析状态",dataIndex:"status",key:"status",width:110,render:(e,t)=>(0,a.jsx)(h.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,r)=>(0,a.jsx)(p.Ay,{type:"text",danger:!0,size:"small",icon:(0,a.jsx)(j.A,{}),onClick:()=>{d.A.confirm({title:e("delete"),content:e("deleteConfirm"),okText:"确认",cancelText:"取消",okButtonProps:{danger:!0},onOk:async()=>{z(e=>[{type:"delete",title:"删除 ".concat(r.relativePath),description:"正在删除文件记录",status:"processing"},...e].slice(0,50));try{await (0,P.xq)(r.relativePath),n.success("已删除"),z(e=>[{type:"delete",title:"删除完成 ".concat(r.relativePath),description:"文件和索引记录已移除",status:"success"},...e].slice(0,50)),U(e=>e.filter(e=>e!==r.relativePath)),await W(),await $()}catch(e){n.error("删除失败"),z(e=>[{type:"error",title:"删除失败 ".concat(r.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)(y.A,{placeholder:e("searchPlaceholder"),prefix:(0,a.jsx)(b.A,{}),value:E,onChange:e=>{L(e.target.value),V(1)},allowClear:!0,className:T().filterInput}),(0,a.jsx)(f.A,{value:I||void 0,onChange:e=>{R(e||""),V(1)},placeholder:e("filterCategory"),allowClear:!0,className:T().filterSelect,options:[{label:e("allCategories"),value:""},...O.map(e=>({label:(0,A.Jm)(e,t),value:e}))]}),(0,a.jsx)(p.Ay,{type:"primary",icon:(0,a.jsx)(S,{}),loading:M,onClick:()=>{var e;return null==(e=document.getElementById("kb-file-upload-input"))?void 0:e.click()},children:M?e("uploading"):e("upload")}),(0,a.jsx)(p.Ay,{icon:(0,a.jsx)(S,{}),loading:M,onClick:()=>{var e;return null==(e=document.getElementById("kb-folder-upload-input"))?void 0:e.click()},children:"上传文件夹"}),(0,a.jsxs)(p.Ay,{danger:!0,disabled:0===H.length,icon:(0,a.jsx)(j.A,{}),onClick:()=>q("selected"),children:["删除已选 ",H.length||""]}),(0,a.jsx)(p.Ay,{danger:!0,disabled:0===K.length||!E&&!I,onClick:()=>q("filtered"),children:"删除筛选结果"}),(0,a.jsx)(p.Ay,{danger:!0,disabled:0===_.length,onClick:()=>q("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="",Q(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="",Q(n)}})]}),(0,a.jsxs)("div",{className:T().statusPanel,children:[(0,a.jsxs)("div",{className:T().statusPanelHeader,children:[(0,a.jsxs)(u.A,{children:[(0,a.jsx)(w.A,{}),"文件任务状态"]}),(0,a.jsx)(p.Ay,{size:"small",type:"text",disabled:0===D.length,onClick:()=>z([]),children:"清空"})]}),0===D.length?(0,a.jsx)("div",{className:T().statusEmpty,children:"暂无文件任务。"}):(0,a.jsx)("div",{className:T().statusList,children:D.map((e,n)=>(0,a.jsxs)("div",{className:T().statusItem,children:[(0,a.jsxs)("div",{className:T().statusHeader,children:[(0,a.jsxs)(u.A,{size:8,wrap:!0,children:[(0,a.jsx)(h.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)(h.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:T().statusDesc,children:e.description})}),e.filePath&&(0,a.jsx)(g.A,{title:e.filePath,children:(0,a.jsx)("div",{className:T().statusPath,children:e.filePath})}),(0,a.jsxs)("div",{className:T().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.jsx)(v.A,{children:(0,a.jsx)(x.A,{rowKey:"relativePath",columns:Z,dataSource:K,loading:C,size:"middle",locale:{emptyText:E?e("emptySearch"):e("noFiles")},pagination:{current:B,pageSize:50,showSizeChanger:!1,onChange:V},rowSelection:{selectedRowKeys:H,onChange:U}})})]})}},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 r(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(t))}async function s(e){var t,n;let r=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&r.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&r.set("category",e.category),(null==e?void 0:e.page)&&r.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&r.set("limit",String(null!=(n=e.limit)?n:50)),a("/api/kb/files?".concat(r))}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 o(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 h(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t))}async function p(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 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 m(){return a("/api/kb/features")}async function v(e,t){var n,r,s,i,o;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!=(o=t.limit)?o:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(r=t.weights)?void 0:r.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(s=t.weights)?void 0:s.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/config/providers")}async function w(e,t){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function j(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function b(){return a("/api/config/models")}async function _(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function C(){return a("/api/system/stats")}async function S(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return a("/api/context".concat(n))}async function P(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function A(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function N(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function T(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(e,t){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function E(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Bh:()=>E,E:()=>N,FC:()=>C,H1:()=>g,HC:()=>o,HT:()=>s,PH:()=>A,QT:()=>u,Qx:()=>h,SJ:()=>y,VW:()=>m,W2:()=>v,X8:()=>f,Z3:()=>x,_m:()=>w,aP:()=>_,bZ:()=>k,c1:()=>d,h1:()=>j,hc:()=>r,hn:()=>S,p:()=>P,tn:()=>c,xC:()=>i,xq:()=>p,xw:()=>T,zo:()=>O,zr:()=>b})},8209:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var a=n(7109),r=n(3793),s=n(8483);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 o=a.forwardRef((e,t)=>a.createElement(s.A,i({},e,{ref:t,icon:r.A})))}},e=>{e.O(0,[260,544,425,668,227,740,446,584,15,636,593,792],()=>e(e.s=426)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[414],{423:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>A});var a=n(5321),o=n(7109),i=n(4986),r=n(9018),l=n(7807),c=n(3442),s=n(5114),d=n(2256),u=n(8770),p=n(8787),h=n(4849),f=n(6911),y=n(8584),g=n(1702),m=n(9606),w=n(486),k=n(9811),x=n(6768),v=n(6619),b=n(933),S=n(8740),j=n(6578),C=n(5551);let T=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function A(){var e,t,n;let A=(0,r.Vr)(),{locale:N}=(0,r.x_)(),E=(0,i.useRouter)(),{stats:O,loading:P,reload:D}=function(){let[e,t]=(0,o.useState)(null),[n,a]=(0,o.useState)(!0),i=(0,o.useCallback)(async()=>{a(!0);try{t(await (0,j.hc)())}catch(e){}finally{a(!1)}},[]);return(0,o.useEffect)(()=>{i()},[i]),{stats:e,loading:n,reload:i}}(),R=function(){let[e,t]=(0,o.useState)(null);return(0,o.useEffect)(()=>{(0,j.VW)().then(t).catch(()=>{})},[]),e}(),{reindexing:z,reindex:J}=function(){let[e,t]=(0,o.useState)(!1);return{reindexing:e,reindex:(0,o.useCallback)(async()=>{t(!0);try{return await (0,j.H1)(),!0}catch(e){return!1}finally{t(!1)}},[])}}(),[U,I]=(0,o.useState)("document"),[_,B]=(0,o.useState)({count:0,totalSize:0}),{message:L}=l.A.useApp(),M=(0,o.useCallback)(async e=>{try{let t=await (0,j.HT)({category:e,limit:1e4}),n=0;if(Array.isArray(t.files))for(let e of t.files)n+=e.fileSize||0;B({count:t.total||0,totalSize:n})}catch(e){B({count:0,totalSize:0})}},[]);(0,o.useEffect)(()=>{M(U)},[U,M]);let H=async()=>{await J()?await Promise.all([D(),M(U)]):L.error(A("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:A("knowledge.manageTitle")}),(0,a.jsx)("p",{className:"pageDesc",children:A("knowledge.manageDesc")})]}),(0,a.jsxs)(c.A,{children:[(0,a.jsx)(s.Ay,{icon:(0,a.jsx)(m.A,{}),onClick:()=>E.push("/knowledge/files"),children:A("knowledge.files")}),(0,a.jsx)(s.Ay,{icon:(0,a.jsx)(w.A,{}),onClick:()=>E.push("/knowledge/search"),children:A("knowledge.search")}),(0,a.jsx)(s.Ay,{icon:(0,a.jsx)(k.A,{}),loading:z,onClick:()=>{H()},children:A("knowledge.reindex")})]})]}),(0,a.jsx)(d.A,{gutter:[16,16],children:[{icon:(0,a.jsx)(x.A,{}),label:A("knowledge.totalFiles"),value:null!=(e=null==O?void 0:O.fileCount)?e:0},{icon:(0,a.jsx)(v.A,{}),label:A("knowledge.totalChunks"),value:null!=(t=null==O?void 0:O.chunkCount)?t:0},{icon:(0,a.jsx)(b.A,{}),label:A("knowledge.totalSize"),value:(0,C.z3)(null!=(n=null==O?void 0:O.totalSizeBytes)?n:0)},{icon:(0,a.jsx)(S.A,{}),label:A("knowledge.lastIndexed"),value:(null==O?void 0:O.lastIndexedAt)?(0,C.fw)(O.lastIndexedAt,N):A("common.never")}].map((e,t)=>(0,a.jsx)(u.A,{xs:12,sm:6,children:(0,a.jsx)(p.A,{size:"small",loading:P&&!O,children:(0,a.jsx)(h.A,{title:e.label,value:e.value,prefix:e.icon})})},t))}),(0,a.jsxs)(p.A,{title:A("knowledge.categories"),size:"small",children:[(0,a.jsx)(f.A,{value:U,onChange:e=>I(String(e)),options:T.map(e=>({label:(0,C.Jm)(e,N),value:e})),className:"mb-4"}),(0,a.jsxs)(d.A,{gutter:[16,16],children:[(0,a.jsx)(u.A,{xs:12,sm:8,children:(0,a.jsx)(h.A,{title:A("knowledge.fileCount"),value:_.count,prefix:(0,a.jsx)(x.A,{})})}),(0,a.jsx)(u.A,{xs:12,sm:8,children:(0,a.jsx)(h.A,{title:A("knowledge.totalSize"),value:(0,C.z3)(_.totalSize),prefix:(0,a.jsx)(b.A,{})})})]})]}),R&&(0,a.jsx)(p.A,{title:A("knowledge.features"),size:"small",children:(0,a.jsx)(y.A,{dataSource:[{key:"vectorStore",label:"Vector Store",desc:A("knowledge.featureVectorStoreDesc"),value:R.vectorStore},{key:"embedding",label:"Embedding",desc:A("knowledge.featureEmbeddingDesc"),value:R.embeddingProvider},{key:"dedup",label:A("knowledge.featureDedup"),desc:A("knowledge.featureDedupDesc"),value:R.dedupEngine},{key:"chunker",label:A("knowledge.featureChunker"),desc:A("knowledge.featureChunkerDesc"),value:R.chunker}],columns:[{title:A("knowledge.featureName"),dataIndex:"label",key:"label",width:120},{title:A("knowledge.featureDesc"),dataIndex:"desc",key:"desc"},{title:A("knowledge.featureValue"),dataIndex:"value",key:"value",render:e=>(0,a.jsx)(g.A,{color:"blue",children:e})}],pagination:!1,size:"small"})})]})}},4178:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/manage",function(){return n(423)}])},5551:(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:()=>l,fw:()=>o,z3:()=>a});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},r={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function l(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?r:i)[e])?t:e}},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 i(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 r(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),a("/api/kb/files/detail?".concat(n))}async function l(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 s(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 s(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,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function f(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function y(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 m(){return a("/api/kb/features")}async function w(e,t){var n,o,i,r,l;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!=(l=t.limit)?l: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==(i=t.weights)?void 0:i.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(r=t.weights)?void 0:r.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),a("/api/kb/search?".concat(c))}async function k(){return a("/api/config/providers")}async function x(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 b(){return a("/api/config/models")}async function S(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function j(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function C(){return a("/api/system/stats")}async function T(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return a("/api/context".concat(n))}async function A(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function N(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function E(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function O(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(e,t){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function D(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Bh:()=>D,E:()=>E,FC:()=>C,H1:()=>g,HC:()=>l,HT:()=>i,PH:()=>N,QT:()=>u,Qx:()=>p,SJ:()=>f,VW:()=>m,W2:()=>w,X8:()=>y,Z3:()=>k,_m:()=>x,aP:()=>S,bZ:()=>j,c1:()=>d,h1:()=>v,hc:()=>o,hn:()=>T,p:()=>A,tn:()=>c,xC:()=>r,xq:()=>h,xw:()=>O,zo:()=>P,zr:()=>b})}},e=>{e.O(0,[260,544,425,227,740,446,584,958,891,636,593,792],()=>e(e.s=4178)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[207],{4184:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>v});var s=n(5321),r=n(3220),a=n.n(r),i=n(7109),o=n(8399),l=n(8787),c=n(3442),u=n(4668),d=n(5114),p=n(4992),h=n(6506),y=n(1702),m=n(2700),f=n(4253),j=n(486),x=n(6578),g=n(4569),b=n.n(g);let{Paragraph:_}=o.A;function w(e){return"number"==typeof e?e.toFixed(2):"-"}function v(){var e,t,n;let[r,o]=(0,i.useState)(""),[g,v]=(0,i.useState)(!1),[S,k]=(0,i.useState)([]),[C,P]=(0,i.useState)(),[T,A]=(0,i.useState)(),[R,N]=(0,i.useState)({keyword:1,vector:.9,rewrite:.72,hybridBonus:.35}),O=async()=>{let e=r.trim();if(e){v(!0);try{let t=await (0,x.W2)(e,{limit:10,weights:R});k(t.results),P(t.queryTimeMs),A(t.debug)}finally{v(!1)}}};return(0,s.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"pageTitle",children:"知识库搜索"}),(0,s.jsx)("p",{className:"pageDesc",children:"查看 hybrid 检索、parent 回填、分块来源和评分明细。"})]}),(0,s.jsx)(l.A,{size:"small",children:(0,s.jsxs)(c.A.Compact,{className:"w-full",children:[(0,s.jsx)(u.A,{value:r,onChange:e=>o(e.target.value),onPressEnter:()=>{O()},placeholder:"输入要搜索的知识库内容"}),(0,s.jsx)(d.Ay,{type:"primary",icon:(0,s.jsx)(j.A,{}),loading:g,onClick:()=>{O()},children:"搜索"})]})}),(0,s.jsx)(l.A,{size:"small",title:"召回权重调节",children:(0,s.jsxs)(c.A,{wrap:!0,children:[(0,s.jsxs)("span",{children:["Keyword ",(0,s.jsx)(p.A,{min:0,max:5,step:.1,value:R.keyword,onChange:e=>N(t=>({...t,keyword:Number(null!=e?e:1)}))})]}),(0,s.jsxs)("span",{children:["Vector ",(0,s.jsx)(p.A,{min:0,max:5,step:.1,value:R.vector,onChange:e=>N(t=>({...t,vector:Number(null!=e?e:.9)}))})]}),(0,s.jsxs)("span",{children:["Rewrite ",(0,s.jsx)(p.A,{min:0,max:5,step:.1,value:R.rewrite,onChange:e=>N(t=>({...t,rewrite:Number(null!=e?e:.72)}))})]}),(0,s.jsxs)("span",{children:["Hybrid Bonus ",(0,s.jsx)(p.A,{min:0,max:2,step:.05,value:R.hybridBonus,onChange:e=>N(t=>({...t,hybridBonus:Number(null!=e?e:.35)}))})]})]})}),T&&(0,s.jsx)(l.A,{size:"small",title:"检索调试面板",children:(0,s.jsxs)(h.A,{size:"small",column:2,bordered:!0,children:[(0,s.jsx)(h.A.Item,{label:"原始查询",children:T.originalQuery}),(0,s.jsx)(h.A.Item,{label:"Reranker",children:T.reranker}),(0,s.jsx)(h.A.Item,{label:"查询改写",span:2,children:(0,s.jsx)(c.A,{wrap:!0,children:null==(e=T.rewrittenQueries)?void 0:e.map(e=>(0,s.jsx)(y.A,{children:e},e))})}),(0,s.jsx)(h.A.Item,{label:"召回数量",span:2,children:(0,s.jsx)(c.A,{wrap:!0,children:Object.entries(null!=(t=T.recallCounts)?t:{}).map(e=>{let[t,n]=e;return(0,s.jsxs)(y.A,{children:[t,": ",n]},t)})})}),(0,s.jsx)(h.A.Item,{label:"召回权重",span:2,children:(0,s.jsx)(c.A,{wrap:!0,children:Object.entries(null!=(n=T.weights)?n:{}).map(e=>{let[t,n]=e;return(0,s.jsxs)(y.A,{children:[t,": ",n]},t)})})})]})}),(0,s.jsx)(l.A,{size:"small",title:"搜索结果",extra:"number"==typeof C?"".concat(C," ms"):void 0,children:g?(0,s.jsx)(m.A,{}):0===S.length?(0,s.jsx)(f.A,{description:"暂无结果"}):(0,s.jsx)("div",{className:b().searchResultList,children:S.map(e=>{var t,n,i,o,l,u;return(0,s.jsxs)("div",{className:b().searchResultItem,children:[(0,s.jsxs)("div",{className:b().searchResultHeader,children:[(0,s.jsxs)(c.A,{size:8,wrap:!0,children:[(0,s.jsx)(y.A,{color:"hybrid"===e.source?"purple":"vector"===e.source?"blue":"green",children:null!=(u=e.source)?u:"keyword"}),(0,s.jsx)(y.A,{children:e.scope}),e.chunkKind&&(0,s.jsx)(y.A,{color:"geekblue",children:e.chunkKind}),e.rowRange&&(0,s.jsxs)(y.A,{color:"gold",children:["行 ",e.rowRange]}),e.sectionTitle&&(0,s.jsx)(y.A,{color:"cyan",children:e.sectionTitle})]}),(0,s.jsx)("strong",{children:w(e.score)})]}),(0,s.jsxs)("div",{className:b().statusPath,children:[(0,s.jsx)(a(),{href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(e.filePath)),children:e.filePath}),"number"==typeof e.chunkIndex?" #".concat(e.chunkIndex):""]}),(0,s.jsx)(_,{ellipsis:{rows:6,expandable:!0,symbol:"展开"},className:b().searchContent,children:function(e,t){let n=[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length);if(0===n.length)return e;let r=RegExp("(".concat(n.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(r).map((e,t)=>n.some(t=>t.toLowerCase()===e.toLowerCase())?(0,s.jsx)("mark",{children:e},t):e)}(e.content,r)}),e.facets&&Object.keys(e.facets).length>0&&(0,s.jsx)("div",{className:b().statusMeta,children:Object.entries(e.facets).slice(0,8).map(e=>{let[t,n]=e;return(0,s.jsxs)("span",{children:[t," ",(0,s.jsx)("b",{children:Array.isArray(n)?n.join(", "):String(n)})]},t)})}),(0,s.jsxs)("div",{className:b().statusMeta,children:[(0,s.jsxs)("span",{children:["keyword ",(0,s.jsx)("b",{children:w(null==(t=e.scoreDetails)?void 0:t.keywordScore)})]}),(0,s.jsxs)("span",{children:["bm25 ",(0,s.jsx)("b",{children:w(null==(n=e.scoreDetails)?void 0:n.bm25Score)})]}),(0,s.jsxs)("span",{children:["vector ",(0,s.jsx)("b",{children:w(null==(i=e.scoreDetails)?void 0:i.vectorScore)})]}),(0,s.jsxs)("span",{children:["rerank ",(0,s.jsx)("b",{children:w(null==(o=e.scoreDetails)?void 0:o.rerankBoost)})]}),(0,s.jsxs)("span",{children:["hybrid ",(0,s.jsx)("b",{children:w(null==(l=e.scoreDetails)?void 0:l.hybridScore)})]})]})]},e.id)})})})]})}},4569: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"}},6578:(e,t,n)=>{"use strict";async function s(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 r(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return s("/api/kb/stats".concat(t))}async function a(e){var t,n;let r=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&r.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&r.set("category",e.category),(null==e?void 0:e.page)&&r.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&r.set("limit",String(null!=(n=e.limit)?n:50)),s("/api/kb/files?".concat(r))}async function i(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),s("/api/kb/files/detail?".concat(n))}async function o(e,t){return s("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function l(e,t,n){return s("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function c(e){return new Promise((t,n)=>{let s=new FileReader;s.onload=()=>{let e=s.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},s.onerror=n,s.readAsDataURL(e)})}async function u(e,t,n){return s("/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:t,uploadId:n})})}async function d(e){return s("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t))}async function h(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function m(e){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function f(e){return s("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function j(){return s("/api/kb/features")}async function x(e,t){var n,r,a,i,o;let l=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&l.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&l.set("category",t.category),(null==t?void 0:t.limit)&&l.set("limit",String(null!=(o=t.limit)?o:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&l.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(r=t.weights)?void 0:r.vector)!=null&&l.set("vectorWeight",String(t.weights.vector)),(null==t||null==(a=t.weights)?void 0:a.rewrite)!=null&&l.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(i=t.weights)?void 0:i.hybridBonus)!=null&&l.set("hybridBonus",String(t.weights.hybridBonus)),s("/api/kb/search?".concat(l))}async function g(){return s("/api/config/providers")}async function b(e,t){return s("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function _(e){return s("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function w(){return s("/api/config/models")}async function v(e){return s("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function S(e){return s("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function k(){return s("/api/system/stats")}async function C(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return s("/api/context".concat(n))}async function P(e){return s("/api/context?type=".concat(e,"&stats=1"))}async function T(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function A(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function R(e){return s("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function N(e,t){return s("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function O(e){return s("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Bh:()=>O,E:()=>A,FC:()=>k,H1:()=>f,HC:()=>o,HT:()=>a,PH:()=>T,QT:()=>d,Qx:()=>p,SJ:()=>y,VW:()=>j,W2:()=>x,X8:()=>m,Z3:()=>g,_m:()=>b,aP:()=>v,bZ:()=>S,c1:()=>u,h1:()=>_,hc:()=>r,hn:()=>C,p:()=>P,tn:()=>l,xC:()=>i,xq:()=>h,xw:()=>R,zo:()=>N,zr:()=>w})},9208:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/search",function(){return n(4184)}])}},e=>{e.O(0,[260,544,425,668,227,840,992,636,593,792],()=>e(e.s=9208)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46],{69:(e,t)=>{"use strict";t.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,t)=>{"use strict";t.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,t,a)=>{"use strict";a.d(t,{A:()=>n});let n=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"}},3114:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var n=a(7109),c=a(5450),o=a(8483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}let l=n.forwardRef((e,t)=>n.createElement(o.A,r({},e,{ref:t,icon:c.A})))},3214:(e,t)=>{"use strict";t.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,t,a)=>{"use strict";a.d(t,{A:()=>l});var n=a(7109),c=a(3214),o=a(8483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}let l=n.forwardRef((e,t)=>n.createElement(o.A,r({},e,{ref:t,icon:c.A})))},5450:(e,t)=>{"use strict";t.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"}},5527:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>U});var n=a(5321),c=a(7109),o=a(9018),r=a(7807),l=a(5114),s=a(8787),i=a(2256),d=a(8770),m=a(3442),u=a(6171),p=a(7271),h=a(1702),y=a(5258),f=a(3455),v=a(4668),g=a(4746),j=a(9071),x=a(9188),b=a(4216),A=a(3114),w=a(9650),O=a(8209),S=a(69),C=a(8483);function N(){return(N=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}let P=c.forwardRef((e,t)=>c.createElement(C.A,N({},e,{ref:t,icon:S.A})));var _=a(289);function z(){return(z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}let k=c.forwardRef((e,t)=>c.createElement(C.A,z({},e,{ref:t,icon:_.A})));var T=a(6578),R=a(2323),M=a.n(R);let L=[{label:"OpenAI 兼容",value:"openai"},{label:"Anthropic",value:"anthropic"},{label:"Google",value:"google"},{label:"Ollama",value:"ollama"},{label:"OpenRouter",value:"openrouter"}],E=[{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 U(){let e=(0,o.Vr)(),{message:t}=r.A.useApp(),[a,S]=(0,c.useState)(!0),[C,N]=(0,c.useState)([]),[_,z]=(0,c.useState)(null),[R,U]=(0,c.useState)(!1),[I,D]=(0,c.useState)(""),[H,K]=(0,c.useState)(""),[J,B]=(0,c.useState)(""),[V,G]=(0,c.useState)("openai"),[W,F]=(0,c.useState)(!1),[Z,q]=(0,c.useState)(!1),[X,Q]=(0,c.useState)(""),[Y,$]=(0,c.useState)(""),[ee,et]=(0,c.useState)(""),[ea,en]=(0,c.useState)(""),[ec,eo]=(0,c.useState)("openai"),[er,el]=(0,c.useState)(!1),[es,ei]=(0,c.useState)(null),[ed,em]=(0,c.useState)({}),eu=async()=>{S(!0);try{let[e,t]=await Promise.all([(0,T.Z3)().catch(()=>[]),(0,T.zr)().catch(()=>null)]);N(e),z(t)}catch(a){t.error(e("common.error"))}finally{S(!1)}};(0,c.useEffect)(()=>{eu()},[]);let ep=async()=>{if(I.trim()){F(!0);try{await (0,T._m)(I.trim(),{apiKey:H||void 0,baseUrl:J||void 0,protocol:V}),U(!1),D(""),K(""),B(""),G("openai"),await eu(),t.success(e("common.success"))}catch(a){t.error(e("common.error"))}finally{F(!1)}}},eh=async a=>{try{await (0,T.h1)(a),await eu(),t.success(e("common.success"))}catch(a){t.error(e("common.error"))}},ey=async e=>{Q(e.name),$(e.name),et("");try{let t=await (0,T.Bh)(e.name);et(t.apiKey?"••••••••":""),en(t.baseUrl||""),eo(t.protocol||t.detectedProtocol||"openai")}catch(t){en(e.baseUrl||""),eo(e.protocol||e.detectedProtocol||"openai")}q(!0)},ef=async()=>{if(Y.trim()){el(!0);try{Y.trim()!==X&&await (0,T.h1)(X);let a=ee.includes("•")?void 0:ee||void 0;await (0,T._m)(Y.trim(),{apiKey:a,baseUrl:ea||void 0,protocol:ec}),q(!1),Q(""),$(""),et(""),en(""),eo("openai"),await eu(),t.success(e("common.success"))}catch(a){t.error(e("common.error"))}finally{el(!1)}}},ev=async a=>{ei(a);try{let n=await (0,T.bZ)(a);em(e=>({...e,[a]:n.success})),t[n.success?"success":"error"](n.success?e("models.connected"):e("models.connectionFailed"))}catch(e){em(e=>({...e,[a]:!1}))}finally{ei(null)}},eg=async(a,n)=>{if(!_)return;let c={..._},o=c[a];if(!n){o.active="",z(c);try{await (0,T.aP)(c)}catch(a){t.error(e("common.error"))}return}let r=n.indexOf(":"),l=r>=0?n.slice(0,r):n,s=r>=0?n.slice(r+1):n;o.active=s,o.list.some(e=>e.name===s&&e.provider===l)||o.list.push({name:s,provider:l}),z(c);try{await (0,T.aP)(c)}catch(a){t.error(e("common.error"))}};return(0,n.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:e("models.title")}),(0,n.jsx)("p",{className:"pageDesc",children:e("models.description")})]}),(0,n.jsx)(l.Ay,{type:"primary",icon:(0,n.jsx)(g.A,{}),onClick:()=>U(!0),children:e("models.addModel")})]}),(0,n.jsx)(s.A,{title:e("models.modelList"),size:"small",loading:a,children:0===C.length?(0,n.jsx)("span",{className:M().cardMeta,children:e("models.noProviders")}):(0,n.jsx)(i.A,{gutter:[12,12],align:"stretch",children:C.map(t=>(0,n.jsx)(d.A,{xs:24,sm:12,lg:8,xl:6,className:M().providerGrid,children:(0,n.jsxs)(s.A,{size:"small",className:M().providerCard,children:[(0,n.jsxs)("div",{className:M().cardAction,children:[(0,n.jsxs)("div",{className:M().cardMain,children:[(0,n.jsx)("div",{className:M().cardName,title:t.name,children:t.name}),(0,n.jsxs)("div",{className:M().cardMeta,children:[(0,n.jsx)(j.A,{})," ",t.protocol||t.detectedProtocol||"openai"]})]}),(0,n.jsxs)(m.A,{size:2,wrap:!1,children:[(0,n.jsx)(l.Ay,{size:"small",type:"text",loading:es===t.name,onClick:()=>{ev(t.name)},icon:!0===ed[t.name]?(0,n.jsx)(x.A,{className:"text-[var(--colorOk)]"}):!1===ed[t.name]?(0,n.jsx)(b.A,{className:"text-[var(--colorDanger)]"}):(0,n.jsx)(A.A,{})}),(0,n.jsx)(l.Ay,{size:"small",type:"text",icon:(0,n.jsx)(w.A,{}),onClick:()=>{ey(t)}}),(0,n.jsx)(u.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{eh(t.name)},children:(0,n.jsx)(l.Ay,{size:"small",type:"text",danger:!0,icon:(0,n.jsx)(O.A,{})})})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,n.jsxs)("span",{className:"".concat(M().cardMeta," text-xs"),children:[(0,n.jsx)(P,{})," ",t.hasApiKey?"••••••••":"—"]}),t.baseUrl&&(0,n.jsxs)("span",{className:"".concat(M().cardMeta," ").concat(M().urlLine," text-xs"),title:t.baseUrl,children:[(0,n.jsx)(k,{})," ",t.baseUrl]})]})]})},t.name))})}),_&&(0,n.jsx)(s.A,{title:e("models.modelTiers"),size:"small",children:(0,n.jsx)(i.A,{gutter:[12,12],children:E.map(a=>{var c;let{key:o,labelKey:r,descKey:l}=a,i=_[o],m=i.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),u=C.filter(e=>!i.list.some(t=>t.provider===e.name)).map(e=>({label:"".concat(e.name," / ").concat(e.name),value:"".concat(e.name,":").concat(e.name)}));return(0,n.jsx)(d.A,{xs:24,lg:8,children:(0,n.jsxs)(s.A,{size:"small",title:e(r),children:[(0,n.jsx)("span",{className:M().tierDesc,children:e(l)}),(0,n.jsx)(p.A,{value:i.active?"".concat((null==(c=i.list.find(e=>e.name===i.active))?void 0:c.provider)||"",":").concat(i.active):void 0,onChange:e=>{eg(o,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),className:"w-full",options:[...m,...u]}),i.list.length>0&&(0,n.jsx)("div",{className:M().modelTags,children:i.list.map(a=>(0,n.jsxs)(h.A,{color:a.name===i.active?"blue":void 0,closable:!0,onClose:()=>{var n,c;let r={..._},l=r[o];l.list=l.list.filter(e=>e.name!==a.name||e.provider!==a.provider),l.active===a.name&&(l.active=null!=(c=null==(n=l.list[0])?void 0:n.name)?c:""),z(r),(0,T.aP)(r).catch(()=>t.error(e("common.error")))},children:[a.provider,"/",a.name]},"".concat(a.provider,":").concat(a.name)))})]})},o)})})}),(0,n.jsx)(y.A,{title:e("models.addModel"),open:R,onCancel:()=>{U(!1),D(""),K(""),B(""),G("openai")},onOk:()=>{ep()},confirmLoading:W,children:(0,n.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,n.jsx)(f.A.Item,{label:e("models.modelName"),children:(0,n.jsx)(v.A,{value:I,onChange:e=>D(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,n.jsx)(f.A.Item,{label:e("models.apiKey"),children:(0,n.jsx)(v.A.Password,{value:H,onChange:e=>K(e.target.value),placeholder:"sk-..."})}),(0,n.jsx)(f.A.Item,{label:e("models.baseUrl"),children:(0,n.jsx)(v.A,{value:J,onChange:e=>B(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,n.jsx)(f.A.Item,{label:e("models.protocol"),children:(0,n.jsx)(p.A,{value:V,onChange:G,options:L})})]})}),(0,n.jsx)(y.A,{title:e("models.editModel"),open:Z,onCancel:()=>{q(!1),Q(""),$(""),et(""),en(""),eo("openai")},onOk:()=>{ef()},confirmLoading:er,children:(0,n.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,n.jsx)(f.A.Item,{label:e("models.modelName"),children:(0,n.jsx)(v.A,{value:Y,onChange:e=>$(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,n.jsx)(f.A.Item,{label:e("models.apiKey"),help:e("models.apiKeyEditHint"),children:(0,n.jsx)(v.A.Password,{value:ee,onFocus:()=>{ee.includes("•")&&et("")},onCopy:e=>e.preventDefault(),onChange:e=>et(e.target.value),placeholder:e("models.apiKeyEditPlaceholder")})}),(0,n.jsx)(f.A.Item,{label:e("models.baseUrl"),children:(0,n.jsx)(v.A,{value:ea,onChange:e=>en(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,n.jsx)(f.A.Item,{label:e("models.protocol"),children:(0,n.jsx)(p.A,{value:ec,onChange:eo,options:L})})]})})]})}},6578:(e,t,a)=>{"use strict";async function n(e,t){let a=await fetch(e,t);if(!a.ok){let e=await a.text(),t=e||"HTTP ".concat(a.status);try{let a=JSON.parse(e);t=a.error||a.message||t}catch(e){}throw Error(t)}return a.json()}async function c(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return n("/api/kb/stats".concat(t))}async function o(e){var t,a;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!=(a=e.limit)?a:50)),n("/api/kb/files?".concat(c))}async function r(e,t){let a=new URLSearchParams({relativePath:e});return t&&a.set("projectRoot",t),n("/api/kb/files/detail?".concat(a))}async function l(e,t){return n("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function s(e,t,a){return n("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:a})})}async function i(e){return new Promise((t,a)=>{let n=new FileReader;n.onload=()=>{let e=n.result,a=e.indexOf(",");t(a>=0?e.slice(a+1):e)},n.onerror=a,n.readAsDataURL(e)})}async function d(e,t,a){return n("/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 i(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:a})})}async function m(e){return n("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),n("/api/kb/operations?".concat(t))}async function p(e,t){return n("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function h(e){return n("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function y(){return n("/api/kb/features")}async function f(e,t){var a,c,o,r,l;let s=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&s.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&s.set("category",t.category),(null==t?void 0:t.limit)&&s.set("limit",String(null!=(l=t.limit)?l:20)),(null==t||null==(a=t.weights)?void 0:a.keyword)!=null&&s.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(c=t.weights)?void 0:c.vector)!=null&&s.set("vectorWeight",String(t.weights.vector)),(null==t||null==(o=t.weights)?void 0:o.rewrite)!=null&&s.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(r=t.weights)?void 0:r.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),n("/api/kb/search?".concat(s))}async function v(){return n("/api/config/providers")}async function g(e,t){return n("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function j(e){return n("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function x(){return n("/api/config/models")}async function b(e){return n("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function A(e){return n("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function w(){return n("/api/system/stats")}async function O(e,t){let a=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return n("/api/context".concat(a))}async function S(e){return n("/api/context?type=".concat(e,"&stats=1"))}async function C(e){return n("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function N(e){return n("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function P(e){return n("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function _(e,t){return n("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function z(e){return n("/api/config/providers/".concat(encodeURIComponent(e)))}a.d(t,{Bh:()=>z,E:()=>N,FC:()=>w,H1:()=>h,HC:()=>l,HT:()=>o,PH:()=>C,QT:()=>m,Qx:()=>u,VW:()=>y,W2:()=>f,Z3:()=>v,_m:()=>g,aP:()=>b,bZ:()=>A,c1:()=>d,h1:()=>j,hc:()=>c,hn:()=>O,p:()=>S,tn:()=>s,xC:()=>r,xq:()=>p,xw:()=>P,zo:()=>_,zr:()=>x})},7305:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return a(5527)}])},8770:(e,t,a)=>{"use strict";a.d(t,{A:()=>n});let n=a(1916).A},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"}},9071:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var n=a(7109),c=a(8847),o=a(8483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}let l=n.forwardRef((e,t)=>n.createElement(o.A,r({},e,{ref:t,icon:c.A})))}},e=>{e.O(0,[260,544,425,668,740,492,455,636,593,792],()=>e(e.s=7305)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46],{69:(e,t)=>{"use strict";t.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,t)=>{"use strict";t.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,t,a)=>{"use strict";a.d(t,{A:()=>n});let n=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"}},3114:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var n=a(7109),o=a(5450),c=a(8483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}let l=n.forwardRef((e,t)=>n.createElement(c.A,r({},e,{ref:t,icon:o.A})))},3214:(e,t)=>{"use strict";t.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,t,a)=>{"use strict";a.d(t,{A:()=>l});var n=a(7109),o=a(3214),c=a(8483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}let l=n.forwardRef((e,t)=>n.createElement(c.A,r({},e,{ref:t,icon:o.A})))},5450:(e,t)=>{"use strict";t.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"}},5527:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>U});var n=a(5321),o=a(7109),c=a(9018),r=a(7807),l=a(5114),s=a(8787),i=a(2256),d=a(8770),m=a(3442),p=a(6171),u=a(7271),h=a(1702),y=a(5258),f=a(3455),v=a(4668),g=a(4746),j=a(9071),x=a(9188),b=a(4216),A=a(3114),w=a(9650),O=a(8209),S=a(69),C=a(8483);function N(){return(N=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}let P=o.forwardRef((e,t)=>o.createElement(C.A,N({},e,{ref:t,icon:S.A})));var _=a(289);function T(){return(T=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}let z=o.forwardRef((e,t)=>o.createElement(C.A,T({},e,{ref:t,icon:_.A})));var k=a(6578),R=a(2323),L=a.n(R);let E=[{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"}];function U(){let e=(0,c.Vr)(),{message:t}=r.A.useApp(),[a,S]=(0,o.useState)(!0),[C,N]=(0,o.useState)([]),[_,T]=(0,o.useState)(null),[R,U]=(0,o.useState)(!1),[D,I]=(0,o.useState)(""),[H,J]=(0,o.useState)(""),[K,B]=(0,o.useState)(""),[V,G]=(0,o.useState)("openai"),[W,F]=(0,o.useState)(!1),[X,Z]=(0,o.useState)(!1),[q,Q]=(0,o.useState)(""),[Y,$]=(0,o.useState)(""),[ee,et]=(0,o.useState)(""),[ea,en]=(0,o.useState)(""),[eo,ec]=(0,o.useState)("openai"),[er,el]=(0,o.useState)(!1),[es,ei]=(0,o.useState)(null),[ed,em]=(0,o.useState)({}),ep=async()=>{S(!0);try{let[e,t]=await Promise.all([(0,k.Z3)().catch(()=>[]),(0,k.zr)().catch(()=>null)]);N(e),T(t)}catch(a){t.error(e("common.error"))}finally{S(!1)}};(0,o.useEffect)(()=>{ep()},[]);let eu=async()=>{if(D.trim()){F(!0);try{await (0,k._m)(D.trim(),{apiKey:H||void 0,baseUrl:K||void 0,protocol:V}),U(!1),I(""),J(""),B(""),G("openai"),await ep(),t.success(e("common.success"))}catch(a){t.error(e("common.error"))}finally{F(!1)}}},eh=async a=>{try{await (0,k.h1)(a),await ep(),t.success(e("common.success"))}catch(a){t.error(e("common.error"))}},ey=async e=>{Q(e.name),$(e.name),et("");try{let t=await (0,k.Bh)(e.name);et(t.apiKey?"••••••••":""),en(t.baseUrl||""),ec(t.protocol||t.detectedProtocol||"openai")}catch(t){en(e.baseUrl||""),ec(e.protocol||e.detectedProtocol||"openai")}Z(!0)},ef=async()=>{if(Y.trim()){el(!0);try{Y.trim()!==q&&await (0,k.h1)(q);let a=ee.includes("•")?void 0:ee||void 0;await (0,k._m)(Y.trim(),{apiKey:a,baseUrl:ea||void 0,protocol:eo}),Z(!1),Q(""),$(""),et(""),en(""),ec("openai"),await ep(),t.success(e("common.success"))}catch(a){t.error(e("common.error"))}finally{el(!1)}}},ev=async a=>{ei(a);try{let n=await (0,k.bZ)(a);em(e=>({...e,[a]:n.success})),t[n.success?"success":"error"](n.success?e("models.connected"):e("models.connectionFailed"))}catch(e){em(e=>({...e,[a]:!1}))}finally{ei(null)}},eg=async(a,n)=>{if(!_)return;let o={..._},c=o[a];if(!n){c.active="",T(o);try{await (0,k.aP)(o)}catch(a){t.error(e("common.error"))}return}let r=n.indexOf(":"),l=r>=0?n.slice(0,r):n,s=r>=0?n.slice(r+1):n;c.active=s,c.list.some(e=>e.name===s&&e.provider===l)||c.list.push({name:s,provider:l}),T(o);try{await (0,k.aP)(o)}catch(a){t.error(e("common.error"))}};return(0,n.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:e("models.title")}),(0,n.jsx)("p",{className:"pageDesc",children:e("models.description")})]}),(0,n.jsx)(l.Ay,{type:"primary",icon:(0,n.jsx)(g.A,{}),onClick:()=>U(!0),children:e("models.addModel")})]}),(0,n.jsx)(s.A,{title:e("models.modelList"),size:"small",loading:a,children:0===C.length?(0,n.jsx)("span",{className:L().cardMeta,children:e("models.noProviders")}):(0,n.jsx)(i.A,{gutter:[12,12],align:"stretch",children:C.map(t=>(0,n.jsx)(d.A,{xs:24,sm:12,lg:8,xl:6,className:L().providerGrid,children:(0,n.jsxs)(s.A,{size:"small",className:L().providerCard,children:[(0,n.jsxs)("div",{className:L().cardAction,children:[(0,n.jsxs)("div",{className:L().cardMain,children:[(0,n.jsx)("div",{className:L().cardName,title:t.name,children:t.name}),(0,n.jsxs)("div",{className:L().cardMeta,children:[(0,n.jsx)(j.A,{})," ",t.protocol||t.detectedProtocol||"openai"]})]}),(0,n.jsxs)(m.A,{size:2,wrap:!1,children:[(0,n.jsx)(l.Ay,{size:"small",type:"text",loading:es===t.name,onClick:()=>{ev(t.name)},icon:!0===ed[t.name]?(0,n.jsx)(x.A,{className:"text-[var(--colorOk)]"}):!1===ed[t.name]?(0,n.jsx)(b.A,{className:"text-[var(--colorDanger)]"}):(0,n.jsx)(A.A,{})}),(0,n.jsx)(l.Ay,{size:"small",type:"text",icon:(0,n.jsx)(w.A,{}),onClick:()=>{ey(t)}}),(0,n.jsx)(p.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{eh(t.name)},children:(0,n.jsx)(l.Ay,{size:"small",type:"text",danger:!0,icon:(0,n.jsx)(O.A,{})})})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,n.jsxs)("span",{className:"".concat(L().cardMeta," text-xs"),children:[(0,n.jsx)(P,{})," ",t.hasApiKey?"••••••••":"—"]}),t.baseUrl&&(0,n.jsxs)("span",{className:"".concat(L().cardMeta," ").concat(L().urlLine," text-xs"),title:t.baseUrl,children:[(0,n.jsx)(z,{})," ",t.baseUrl]})]})]})},t.name))})}),_&&(0,n.jsx)(s.A,{title:e("models.modelTiers"),size:"small",children:(0,n.jsx)(i.A,{gutter:[12,12],children:M.map(a=>{var o;let{key:c,labelKey:r,descKey:l}=a,i=_[c],m=i.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),p=C.filter(e=>!i.list.some(t=>t.provider===e.name)).map(e=>({label:"".concat(e.name," / ").concat(e.name),value:"".concat(e.name,":").concat(e.name)}));return(0,n.jsx)(d.A,{xs:24,lg:8,children:(0,n.jsxs)(s.A,{size:"small",title:e(r),children:[(0,n.jsx)("span",{className:L().tierDesc,children:e(l)}),(0,n.jsx)(u.A,{value:i.active?"".concat((null==(o=i.list.find(e=>e.name===i.active))?void 0:o.provider)||"",":").concat(i.active):void 0,onChange:e=>{eg(c,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),className:"w-full",options:[...m,...p]}),i.list.length>0&&(0,n.jsx)("div",{className:L().modelTags,children:i.list.map(a=>(0,n.jsxs)(h.A,{color:a.name===i.active?"blue":void 0,closable:!0,onClose:()=>{var n,o;let r={..._},l=r[c];l.list=l.list.filter(e=>e.name!==a.name||e.provider!==a.provider),l.active===a.name&&(l.active=null!=(o=null==(n=l.list[0])?void 0:n.name)?o:""),T(r),(0,k.aP)(r).catch(()=>t.error(e("common.error")))},children:[a.provider,"/",a.name]},"".concat(a.provider,":").concat(a.name)))})]})},c)})})}),(0,n.jsx)(y.A,{title:e("models.addModel"),open:R,onCancel:()=>{U(!1),I(""),J(""),B(""),G("openai")},onOk:()=>{eu()},confirmLoading:W,children:(0,n.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,n.jsx)(f.A.Item,{label:e("models.modelName"),children:(0,n.jsx)(v.A,{value:D,onChange:e=>I(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,n.jsx)(f.A.Item,{label:e("models.apiKey"),children:(0,n.jsx)(v.A.Password,{value:H,onChange:e=>J(e.target.value),placeholder:"sk-..."})}),(0,n.jsx)(f.A.Item,{label:e("models.baseUrl"),children:(0,n.jsx)(v.A,{value:K,onChange:e=>B(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,n.jsx)(f.A.Item,{label:e("models.protocol"),children:(0,n.jsx)(u.A,{value:V,onChange:G,options:E})})]})}),(0,n.jsx)(y.A,{title:e("models.editModel"),open:X,onCancel:()=>{Z(!1),Q(""),$(""),et(""),en(""),ec("openai")},onOk:()=>{ef()},confirmLoading:er,children:(0,n.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,n.jsx)(f.A.Item,{label:e("models.modelName"),children:(0,n.jsx)(v.A,{value:Y,onChange:e=>$(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,n.jsx)(f.A.Item,{label:e("models.apiKey"),help:e("models.apiKeyEditHint"),children:(0,n.jsx)(v.A.Password,{value:ee,onFocus:()=>{ee.includes("•")&&et("")},onCopy:e=>e.preventDefault(),onChange:e=>et(e.target.value),placeholder:e("models.apiKeyEditPlaceholder")})}),(0,n.jsx)(f.A.Item,{label:e("models.baseUrl"),children:(0,n.jsx)(v.A,{value:ea,onChange:e=>en(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,n.jsx)(f.A.Item,{label:e("models.protocol"),children:(0,n.jsx)(u.A,{value:eo,onChange:ec,options:E})})]})})]})}},6578:(e,t,a)=>{"use strict";async function n(e,t){let a=await fetch(e,t);if(!a.ok){let e=await a.text(),t=e||"HTTP ".concat(a.status);try{let a=JSON.parse(e);t=a.error||a.message||t}catch(e){}throw Error(t)}return a.json()}async function o(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return n("/api/kb/stats".concat(t))}async function c(e){var t,a;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!=(a=e.limit)?a:50)),n("/api/kb/files?".concat(o))}async function r(e,t){let a=new URLSearchParams({relativePath:e});return t&&a.set("projectRoot",t),n("/api/kb/files/detail?".concat(a))}async function l(e,t){return n("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function s(e,t,a){return n("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:a})})}async function i(e){return new Promise((t,a)=>{let n=new FileReader;n.onload=()=>{let e=n.result,a=e.indexOf(",");t(a>=0?e.slice(a+1):e)},n.onerror=a,n.readAsDataURL(e)})}async function d(e,t,a){return n("/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 i(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:a})})}async function m(e){return n("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),n("/api/kb/operations?".concat(t))}async function u(e,t){return n("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function h(e,t){return n("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function y(e){return n("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function f(e){return n("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function v(){return n("/api/kb/features")}async function g(e,t){var a,o,c,r,l;let s=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&s.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&s.set("category",t.category),(null==t?void 0:t.limit)&&s.set("limit",String(null!=(l=t.limit)?l:20)),(null==t||null==(a=t.weights)?void 0:a.keyword)!=null&&s.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(o=t.weights)?void 0:o.vector)!=null&&s.set("vectorWeight",String(t.weights.vector)),(null==t||null==(c=t.weights)?void 0:c.rewrite)!=null&&s.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(r=t.weights)?void 0:r.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),n("/api/kb/search?".concat(s))}async function j(){return n("/api/config/providers")}async function x(e,t){return n("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function b(e){return n("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function A(){return n("/api/config/models")}async function w(e){return n("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(e){return n("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function S(){return n("/api/system/stats")}async function C(e,t){let a=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return n("/api/context".concat(a))}async function N(e){return n("/api/context?type=".concat(e,"&stats=1"))}async function P(e){return n("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function _(e){return n("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function T(e){return n("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function z(e,t){return n("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function k(e){return n("/api/config/providers/".concat(encodeURIComponent(e)))}a.d(t,{Bh:()=>k,E:()=>_,FC:()=>S,H1:()=>f,HC:()=>l,HT:()=>c,PH:()=>P,QT:()=>m,Qx:()=>p,SJ:()=>h,VW:()=>v,W2:()=>g,X8:()=>y,Z3:()=>j,_m:()=>x,aP:()=>w,bZ:()=>O,c1:()=>d,h1:()=>b,hc:()=>o,hn:()=>C,p:()=>N,tn:()=>s,xC:()=>r,xq:()=>u,xw:()=>T,zo:()=>z,zr:()=>A})},7305:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return a(5527)}])},8770:(e,t,a)=>{"use strict";a.d(t,{A:()=>n});let n=a(1916).A},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"}},9071:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var n=a(7109),o=a(8847),c=a(8483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}let l=n.forwardRef((e,t)=>n.createElement(c.A,r({},e,{ref:t,icon:o.A})))}},e=>{e.O(0,[260,544,425,668,740,492,455,636,593,792],()=>e(e.s=7305)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[449],{3018:(e,t)=>{"use strict";t.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"}},3114:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(7109),s=n(5450),o=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let a=r.forwardRef((e,t)=>r.createElement(o.A,i({},e,{ref:t,icon:s.A})))},3139:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/overview",function(){return n(3502)}])},3502:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>N});var r=n(5321),s=n(7109),o=n(9018),i=n(2700),a=n(5114),c=n(2256),l=n(8770),d=n(8787),u=n(9605),p=n(4849),h=n(3442),v=n(1702),y=n(6109),f=n(9811),m=n(8200),g=n(8483);function x(){return(x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let j=s.forwardRef((e,t)=>s.createElement(g.A,x({},e,{ref:t,icon:m.A})));var w=n(933),A=n(3114),b=n(9071),k=n(6631),O=n(6374);function S(){return(S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let T=s.forwardRef((e,t)=>s.createElement(g.A,S({},e,{ref:t,icon:O.A})));var C=n(3018);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 r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let z=s.forwardRef((e,t)=>s.createElement(g.A,P({},e,{ref:t,icon:C.A})));var E=n(6578);function N(){var e,t,n,m,g,x,O,S,C,P,N,R;let L=(0,o.Vr)(),M=(0,y.useRouter)(),[J,U]=(0,s.useState)(null),[B,D]=(0,s.useState)(!0),[_,H]=(0,s.useState)(0),I=(0,s.useCallback)(async()=>{D(!0);try{let[e,t]=await Promise.all([(0,E.FC)(),(0,E.Z3)().catch(()=>[])]);U(e),H(Array.isArray(t)?t.length:0)}catch(e){}finally{D(!1)}},[]);if((0,s.useEffect)(()=>{I();let e=setInterval(()=>{I()},1e4);return()=>clearInterval(e)},[I]),B&&!J)return(0,r.jsx)("div",{className:"flex justify-center py-16",children:(0,r.jsx)(i.A,{size:"large"})});let F=(null!=(t=null==J?void 0:J.cpu.usagePercent)?t:0)>80?"var(--colorDanger)":(null!=(n=null==J?void 0:J.cpu.usagePercent)?n:0)>50?"var(--colorWarning)":"var(--colorOk)",W=(null!=(m=null==J?void 0:J.memory.usagePercent)?m:0)>80?"var(--colorDanger)":(null!=(g=null==J?void 0:J.memory.usagePercent)?g:0)>50?"var(--colorWarning)":"var(--colorOk)",V=(null==J?void 0:J.tasks.total)?Math.round(J.tasks.success/J.tasks.total*100):0,q=null==J||null==(e=J.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:L("overview.title")}),(0,r.jsx)("p",{className:"pageDesc",children:L("overview.description")})]}),(0,r.jsx)(a.Ay,{icon:(0,r.jsx)(f.A,{spin:B}),loading:B,onClick:()=>{I()},children:L("common.retry")})]}),(0,r.jsxs)(c.A,{gutter:[16,16],children:[(0,r.jsx)(l.A,{xs:24,sm:12,children:(0,r.jsx)(d.A,{size:"small",title:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(j,{})," CPU"]}),children:(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)(u.A,{type:"circle",percent:null!=(x=null==J?void 0:J.cpu.usagePercent)?x:0,size:120,strokeColor:F,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!=(O=null==J?void 0:J.cpu.cores)?O:0," ",L("overview.cores")]})]})})}),(0,r.jsx)(l.A,{xs:24,sm:12,children:(0,r.jsx)(d.A,{size:"small",title:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.A,{})," ",L("overview.memory")]}),children:(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)(u.A,{type:"circle",percent:null!=(S=null==J?void 0:J.memory.usagePercent)?S:0,size:120,strokeColor:W,format:e=>"".concat(e,"%")}),(0,r.jsxs)("div",{className:"text-xs mt-2",style:{color:"var(--colorTextSecondary)"},children:[null!=(C=null==J?void 0:J.memory.processMB)?C:0," MB / ",null!=(P=null==J?void 0:J.memory.totalMB)?P:0," MB"]})]})})})]}),(0,r.jsxs)(c.A,{gutter:[16,16],children:[(0,r.jsx)(l.A,{xs:12,sm:6,children:(0,r.jsx)(d.A,{size:"small",children:(0,r.jsx)(p.A,{title:L("overview.providersCount"),value:_,prefix:(0,r.jsx)(A.A,{})})})}),(0,r.jsx)(l.A,{xs:12,sm:6,children:(0,r.jsx)(d.A,{size:"small",children:(0,r.jsx)(p.A,{title:L("overview.tokensUsed"),value:null!=(N=null==J?void 0:J.tokens.total)?N:0,prefix:(0,r.jsx)(b.A,{})})})}),(0,r.jsx)(l.A,{xs:12,sm:6,children:(0,r.jsx)(d.A,{size:"small",children:(0,r.jsx)(p.A,{title:L("overview.tasksTotal"),value:null!=(R=null==J?void 0:J.tasks.total)?R:0,prefix:(0,r.jsx)(k.A,{})})})}),(0,r.jsx)(l.A,{xs:12,sm:6,children:(0,r.jsx)(d.A,{size:"small",children:(0,r.jsx)(p.A,{title:L("overview.successRate"),value:V,suffix:"%",prefix:V>80?(0,r.jsx)(T,{style:{color:"var(--colorOk)"}}):(0,r.jsx)(z,{style:{color:"var(--colorDanger)"}})})})})]}),(0,r.jsxs)(c.A,{gutter:[16,16],children:[(0,r.jsx)(l.A,{xs:24,sm:12,children:(0,r.jsx)(d.A,{size:"small",title:L("overview.topModel"),children:q?(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)(A.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," ",L("overview.calls")]})]})]}):(0,r.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:L("common.noData")})})}),(0,r.jsx)(l.A,{xs:24,sm:12,children:(0,r.jsx)(d.A,{size:"small",title:L("overview.taskTypes"),children:(null==J?void 0:J.tasks.types)&&Object.keys(J.tasks.types).length>0?(0,r.jsx)(h.A,{wrap:!0,children:Object.entries(J.tasks.types).map(e=>{let[t,n]=e;return(0,r.jsxs)(v.A,{children:[t.slice(0,30),": ",n]},t)})}):(0,r.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:L("common.noData")})})})]}),(0,r.jsx)(d.A,{title:L("overview.quickActions"),size:"small",children:(0,r.jsxs)(h.A,{wrap:!0,children:[(0,r.jsx)(a.Ay,{onClick:()=>{M.push("/knowledge/manage")},children:L("overview.goToKnowledge")}),(0,r.jsx)(a.Ay,{onClick:()=>{M.push("/models")},children:L("overview.goToModels")}),(0,r.jsx)(a.Ay,{onClick:()=>{M.push("/settings")},children:L("overview.goToSettings")}),(0,r.jsx)(a.Ay,{onClick:()=>{M.push("/prompt")},children:L("nav.promptManagement")}),(0,r.jsx)(a.Ay,{onClick:()=>{M.push("/context/long-term")},children:L("nav.contextEngineering")})]})})]})}},5450:(e,t)=>{"use strict";t.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"}},6109:(e,t,n)=>{e.exports=n(7212)},6374:(e,t)=>{"use strict";t.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"}},6578:(e,t,n)=>{"use strict";async function r(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 s(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return r("/api/kb/stats".concat(t))}async function o(e){var t,n;let s=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&s.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&s.set("category",e.category),(null==e?void 0:e.page)&&s.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&s.set("limit",String(null!=(n=e.limit)?n:50)),r("/api/kb/files?".concat(s))}async function i(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),r("/api/kb/files/detail?".concat(n))}async function a(e,t){return r("/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 r("/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 r=new FileReader;r.onload=()=>{let e=r.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},r.onerror=n,r.readAsDataURL(e)})}async function d(e,t,n){return r("/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 r("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),r("/api/kb/operations?".concat(t))}async function h(e,t){return r("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function v(e,t){return r("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function y(e){return r("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function f(e){return r("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function m(){return r("/api/kb/features")}async function g(e,t){var n,s,o,i,a;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!=(a=t.limit)?a:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(s=t.weights)?void 0:s.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(o=t.weights)?void 0:o.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)),r("/api/kb/search?".concat(c))}async function x(){return r("/api/config/providers")}async function j(e,t){return r("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function w(e){return r("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function A(){return r("/api/config/models")}async function b(e){return r("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return r("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function O(){return r("/api/system/stats")}async function S(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return r("/api/context".concat(n))}async function T(e){return r("/api/context?type=".concat(e,"&stats=1"))}async function C(e){return r("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function P(e){return r("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function z(e){return r("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(e,t){return r("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function N(e){return r("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Bh:()=>N,E:()=>P,FC:()=>O,H1:()=>f,HC:()=>a,HT:()=>o,PH:()=>C,QT:()=>u,Qx:()=>p,SJ:()=>v,VW:()=>m,W2:()=>g,X8:()=>y,Z3:()=>x,_m:()=>j,aP:()=>b,bZ:()=>k,c1:()=>d,h1:()=>w,hc:()=>s,hn:()=>S,p:()=>T,tn:()=>c,xC:()=>i,xq:()=>h,xw:()=>z,zo:()=>E,zr:()=>A})},8200:(e,t)=>{"use strict";t.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"}},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"}},9071:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(7109),s=n(8847),o=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let a=r.forwardRef((e,t)=>r.createElement(o.A,i({},e,{ref:t,icon:s.A})))}},e=>{e.O(0,[260,544,227,15,958,636,593,792],()=>e(e.s=3139)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
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(9018),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(
|
|
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(9018),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(6631),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}})]})]})}},6631:(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})))},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}},e=>{e.O(0,[260,544,425,668,446,492,636,593,792],()=>e(e.s=7549)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.style_featureLabel__XFSTX{color:var(--colorTextSecondary)}.style_featureValue__I_wMP{color:var(--colorText)}.style_filterInput__4_Elu{width:260px}.style_filterSelect__vUBJ9{width:140px}.style_statusPanel__9arTu{border:1px solid var(--colorBorderSecondary);border-radius:12px;background:var(--colorBgContainer);padding:10px;box-shadow:0 6px 18px rgba(0,0,0,.03)}.style_statusPanelHeader__nKv1I{display:flex;align-items:center;justify-content:space-between;gap:4px;color:var(--colorTextSecondary);font-size:12px;padding:0 2px 6px}.style_statusEmpty__8LWzH{color:var(--colorTextSecondary);padding:4px 2px;font-size:12px}.style_statusList__FpNgC{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:8px;max-height:220px;overflow-y:auto;overscroll-behavior:contain;padding-right:4px}.style_statusItem__uzO80{min-width:0;border:1px solid var(--colorBorderSecondary);border-left:3px solid var(--colorPrimary);border-radius:10px;padding:8px 10px;background:var(--colorFillAlter)}.style_statusHeader__o9q_b{display:flex;align-items:flex-start;justify-content:space-between;gap:6px;margin-bottom:3px;min-width:0}.style_statusHeader__o9q_b strong{display:inline-block;max-width:210px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.style_statusDesc__XiWFa{color:var(--colorText);font-size:12px;margin-bottom:3px;display:-webkit-box;line-clamp:2;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.style_statusPath__Udxvv{color:var(--colorTextSecondary);font-size:12px;background:var(--colorBgContainer);border-radius:6px;padding:3px 6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-bottom:4px}.style_statusMeta__XukHt{display:flex;flex-wrap:wrap;gap:4px;color:var(--colorTextSecondary);font-size:12px}.style_statusMeta__XukHt span{background:var(--colorBgContainer);border:1px solid var(--colorBorderSecondary);border-radius:999px;padding:2px 8px}.style_searchResultList__cVKZg{display:grid;gap:12px}.style_searchResultItem__boj6D{border:1px solid var(--colorBorderSecondary);border-radius:12px;padding:14px;background:var(--colorFillAlter)}.style_searchResultHeader__meVdJ{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}.style_searchContent__XbUVk{margin:10px 0!important;white-space:pre-wrap}.style_pdfPreviewStrip__94_eG{display:flex;gap:12px;overflow-x:auto;padding:8px 0}.style_pdfPreviewStrip__94_eG img{width:220px;max-height:320px;object-fit:contain;border:1px solid var(--colorBorderSecondary);border-radius:8px;background:#fff}.style_drawingPreview__lkk_L{min-height:120px;margin-top:12px;padding:16px;border:1px dashed var(--colorBorderSecondary);border-radius:10px;background:linear-gradient(135deg,rgba(80,140,255,.08),rgba(80,255,180,.06))}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@customize-agent/server",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "Customize Agent Web 管理控制台",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json"
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"react-dom": "^19.0.0",
|
|
42
42
|
"tesseract.js": "^7.0.0",
|
|
43
43
|
"xlsx": "^0.18.5",
|
|
44
|
-
"@customize-agent/knowledge": "^3.0.
|
|
45
|
-
"@customize-agent/
|
|
46
|
-
"@customize-agent/
|
|
44
|
+
"@customize-agent/knowledge": "^3.0.3",
|
|
45
|
+
"@customize-agent/llm": "^3.0.2",
|
|
46
|
+
"@customize-agent/runtime": "^3.0.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@tailwindcss/postcss": "^4.3.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,e,t,c,a,n,d,i,r,k,o,f,b,u,l,g,h,j){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:u,bitArray:[]},__routerFilterDynamic:{numItems:r,errorRate:1e-4,numBits:r,numHashes:u,bitArray:[]},"/":["static/chunks/pages/index-505bd438c95ec0e8.js"],"/_error":["static/chunks/pages/_error-18decb9cd478883d.js"],"/context/long-term":[s,e,t,c,a,n,d,i,k,o,l,"static/chunks/pages/context/long-term-90d88a67527287ef.js"],"/context/short-term":[s,e,t,c,a,n,d,i,k,o,l,"static/chunks/pages/context/short-term-5a07a4e0ef35411a.js"],"/knowledge":["static/chunks/pages/knowledge-b3ef77e79801287c.js"],"/knowledge/file-detail":[s,e,t,c,a,n,d,i,g,"static/chunks/517-c6a8c0e680dafa46.js",f,"static/chunks/pages/knowledge/file-detail-f14cf891dcdf9193.js"],"/knowledge/files":[s,e,t,c,a,n,d,i,h,f,"static/chunks/pages/knowledge/files-019110a9065f249b.js"],"/knowledge/manage":[s,e,t,a,n,d,i,j,"static/chunks/891-fde3ad128ccf30dc.js","static/chunks/pages/knowledge/manage-a894b2e4cbba0cbd.js"],"/knowledge/search":[s,e,t,c,a,g,"static/chunks/992-6e67409e97fe9b6b.js",f,"static/chunks/pages/knowledge/search-39d8e63e83c02003.js"],"/models":[s,e,t,c,n,k,o,"static/css/0e153583d22cc52e.css","static/chunks/pages/models-1af65b8a7006b9a0.js"],"/overview":[s,e,a,h,j,"static/chunks/pages/overview-85235179b50647b3.js"],"/prompt":[s,e,t,c,d,k,"static/chunks/pages/prompt-024bde9aa4fb4320.js"],"/settings":[s,"static/css/82b6ddff0ef364fe.css","static/chunks/pages/settings-e6a894618727eec3.js"],sortedPages:["/","/_app","/_error","/context/long-term","/context/short-term","/knowledge","/knowledge/file-detail","/knowledge/files","/knowledge/manage","/knowledge/search","/models","/overview","/prompt","/settings"]}}("static/chunks/260-03f19eaee776f7fa.js","static/chunks/544-fba84f8cd64c79ed.js","static/chunks/425-19f06b6c359bb015.js","static/chunks/668-96407d9c7815e896.js","static/chunks/227-eb562f29334fcb34.js","static/chunks/740-0a79dd7ac8c2c334.js","static/chunks/446-3bb2f94b52176cb1.js","static/chunks/584-ce8dbed7354f3644.js",0,"static/chunks/492-5245cad2f8d60d8d.js","static/chunks/455-d2aca155a3032ee0.js","static/css/a89ea06061dcfec7.css",1e-4,NaN,"static/chunks/257-c71f52e4adae1e38.js","static/chunks/840-717f0706d50fcb82.js","static/chunks/15-341041188dc9798c.js","static/chunks/958-6f0cb200491b344e.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|