@customize-agent/server 3.0.15 → 3.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/build-manifest.json +12 -12
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/chunks/3328.js +69 -1
- package/.next/server/chunks/3445.js +46 -4
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/api/assets/generated/preview.js +1 -1
- package/.next/server/pages/api/assets/generated.js +1 -1
- package/.next/server/pages/api/documents/export.js +1 -1
- package/.next/server/pages/api/documents/generate.js +1 -1
- package/.next/server/pages/api/documents/generated/[id].js +1 -1
- package/.next/server/pages/api/documents/generated.js +1 -1
- package/.next/server/pages/api/documents/roles.js +1 -1
- package/.next/server/pages/api/documents/specs.js +1 -1
- package/.next/server/pages/asset-library.html +1 -1
- package/.next/server/pages/context/long-term.html +1 -1
- package/.next/server/pages/context/short-term.html +1 -1
- package/.next/server/pages/document-roles.html +1 -1
- package/.next/server/pages/document-specs.html +1 -1
- package/.next/server/pages/documents.html +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/search.html +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages-manifest.json +24 -24
- package/.next/static/chunks/pages/asset-library-82606363f9142bad.js +1 -0
- package/.next/static/chunks/pages/context/{long-term-09e23b06634b08d9.js → long-term-f2a550bc848ec1a3.js} +1 -1
- package/.next/static/chunks/pages/context/short-term-1de28da82d2b6276.js +1 -0
- package/.next/static/chunks/pages/document-roles-54a1cc04116e8c18.js +1 -0
- package/.next/static/chunks/pages/document-specs-723dee6883949a17.js +1 -0
- package/.next/static/chunks/pages/documents-c1a01ae631b42488.js +1 -0
- package/.next/static/chunks/pages/knowledge/file-detail-7a1a3d4352ecfa0a.js +1 -0
- package/.next/static/chunks/pages/knowledge/files-f0e05583bf7c57d9.js +1 -0
- package/.next/static/chunks/pages/knowledge/manage-8acff53019eb6cc1.js +1 -0
- package/.next/static/chunks/pages/knowledge/{search-3fd704d2afa1af3e.js → search-1f3bd8fcb7af3e4d.js} +1 -1
- package/.next/static/chunks/pages/models-11533caad3723009.js +1 -0
- package/.next/static/chunks/pages/overview-f80672c242d9aa32.js +1 -0
- package/.next/static/customize-agent-dashboard/_buildManifest.js +1 -1
- package/package.json +2 -2
- package/.next/static/chunks/pages/asset-library-0f607b74fa016470.js +0 -1
- package/.next/static/chunks/pages/context/short-term-2f5fd8531e87b5bd.js +0 -1
- package/.next/static/chunks/pages/document-roles-077fc7159c88e89e.js +0 -1
- package/.next/static/chunks/pages/document-specs-fb5b8a89cff6d1e3.js +0 -1
- package/.next/static/chunks/pages/documents-38320ae2fd50be35.js +0 -1
- package/.next/static/chunks/pages/knowledge/file-detail-ad1dc61c1413db0c.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-896c058f2da5e907.js +0 -1
- package/.next/static/chunks/pages/knowledge/manage-6da10158f75718cf.js +0 -1
- package/.next/static/chunks/pages/models-7bdf24068811ae91.js +0 -1
- package/.next/static/chunks/pages/overview-572bba4876e617f5.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[207],{838:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"}},4184:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>S});var s=n(65321),r=n(43220),a=n.n(r),o=n(97109),i=n(35292),c=n(68787),l=n(33442),d=n(7576),u=n(85114),p=n(94992),h=n(76506),y=n(11702),m=n(85493),f=n(42700),g=n(84253),j=n(30486),b=n(6578),x=n(14569),w=n.n(x);let{Paragraph:v}=i.A;function _(e){return"number"==typeof e?e.toFixed(2):"-"}function S(){var e,t,n;let[r,i]=(0,o.useState)(""),[x,S]=(0,o.useState)(!1),[T,C]=(0,o.useState)([]),[O,P]=(0,o.useState)(),[E,k]=(0,o.useState)(),[N,R]=(0,o.useState)(""),[A,I]=(0,o.useState)({keyword:1,vector:.9,rewrite:.72,hybridBonus:.35}),U=async()=>{let e=r.trim();if(e){S(!0),R("");try{let t=await (0,b.W2)(e,{limit:10,weights:A});C(t.results),P(t.queryTimeMs),k(t.debug)}catch(e){C([]),R(e instanceof Error?e.message:"搜索失败")}finally{S(!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)(c.A,{size:"small",children:(0,s.jsxs)(l.A.Compact,{className:"w-full",children:[(0,s.jsx)(d.A,{value:r,onChange:e=>i(e.target.value),onPressEnter:()=>{U()},placeholder:"输入要搜索的知识库内容"}),(0,s.jsx)(u.Ay,{type:"primary",icon:(0,s.jsx)(j.A,{}),loading:x,onClick:()=>{U()},children:"搜索"})]})}),(0,s.jsx)(c.A,{size:"small",title:"召回权重调节",children:(0,s.jsxs)(l.A,{wrap:!0,children:[(0,s.jsxs)("span",{children:["Keyword ",(0,s.jsx)(p.A,{min:0,max:5,step:.1,value:A.keyword,onChange:e=>I(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:A.vector,onChange:e=>I(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:A.rewrite,onChange:e=>I(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:A.hybridBonus,onChange:e=>I(t=>({...t,hybridBonus:Number(null!=e?e:.35)}))})]})]})}),E&&(0,s.jsx)(c.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:E.originalQuery}),(0,s.jsx)(h.A.Item,{label:"Reranker",children:E.reranker}),(0,s.jsx)(h.A.Item,{label:"查询改写",span:2,children:(0,s.jsx)(l.A,{wrap:!0,children:null==(e=E.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)(l.A,{wrap:!0,children:Object.entries(null!=(t=E.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)(l.A,{wrap:!0,children:Object.entries(null!=(n=E.weights)?n:{}).map(e=>{let[t,n]=e;return(0,s.jsxs)(y.A,{children:[t,": ",n]},t)})})})]})}),(0,s.jsxs)(c.A,{size:"small",title:"搜索结果",extra:"number"==typeof O?"".concat(O," ms"):void 0,children:[N?(0,s.jsx)(m.A,{type:"error",showIcon:!0,message:"搜索失败",description:N,className:"mb-4"}):null,x?(0,s.jsx)(f.A,{}):0===T.length?(0,s.jsx)(g.A,{description:"暂无结果"}):(0,s.jsx)("div",{className:w().searchResultList,children:T.map(e=>{var t,n,o,i,c,d;return(0,s.jsxs)("div",{className:w().searchResultItem,children:[(0,s.jsxs)("div",{className:w().searchResultHeader,children:[(0,s.jsxs)(l.A,{size:8,wrap:!0,children:[(0,s.jsx)(y.A,{color:"hybrid"===e.source?"purple":"vector"===e.source?"blue":"green",children:null!=(d=e.source)?d:"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:_(e.score)})]}),(0,s.jsxs)("div",{className:w().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)(v,{ellipsis:{rows:6,expandable:!0,symbol:"展开"},className:w().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:w().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:w().statusMeta,children:[(0,s.jsxs)("span",{children:["keyword ",(0,s.jsx)("b",{children:_(null==(t=e.scoreDetails)?void 0:t.keywordScore)})]}),(0,s.jsxs)("span",{children:["bm25 ",(0,s.jsx)("b",{children:_(null==(n=e.scoreDetails)?void 0:n.bm25Score)})]}),(0,s.jsxs)("span",{children:["vector ",(0,s.jsx)("b",{children:_(null==(o=e.scoreDetails)?void 0:o.vectorScore)})]}),(0,s.jsxs)("span",{children:["rerank ",(0,s.jsx)("b",{children:_(null==(i=e.scoreDetails)?void 0:i.rerankBoost)})]}),(0,s.jsxs)("span",{children:["hybrid ",(0,s.jsx)("b",{children:_(null==(c=e.scoreDetails)?void 0:c.hybridScore)})]})]})]},e.id)})})]})]})}},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 o(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),s("/api/kb/files/detail?".concat(n))}async function i(e,t){return s("/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 s("/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 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 d(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 l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(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){let t=new URLSearchParams;return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t),{method:"DELETE"})}async function y(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function m(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(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 b(e,t){var n,r,a,o,i;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!=(i=t.limit)?i: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==(a=t.weights)?void 0:a.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(o=t.weights)?void 0:o.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),s("/api/kb/search?".concat(c))}async function x(){return s("/api/prompt")}async function w(e){return s("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function v(e){return s("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(e,t){return s("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function S(e){return s("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return s("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(){return s("/api/documents/specs")}async function O(e){return s("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(e){return s("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return s("/api/documents/templates")}async function k(e){return s("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return s("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return s("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function A(e){return s("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function I(){return s("/api/documents/generated")}async function U(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)))}async function J(e,t){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function L(){return s("/api/assets/generated")}async function D(e){return s("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function H(e){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function B(e,t){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function z(e){return s("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function V(e,t){return s("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function X(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function F(){return s("/api/config/providers")}async function M(e,t){return s("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function W(e){return s("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function K(){return s("/api/config/models")}async function Q(e){return s("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(){return s("/api/config/embedding")}async function Z(e){return s("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(){return s("/api/config/embedding/healthCheck",{method:"POST"})}async function G(e){return s("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function Y(){return s("/api/system/stats")}async function ee(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return s("/api/context".concat(n))}async function et(e){return s("/api/context?type=".concat(e,"&stats=1"))}async function en(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function es(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function er(e){return s("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ea(e,t){return s("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function eo(e){return s("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>V,Bh:()=>eo,Dl:()=>E,E:()=>es,EK:()=>O,ER:()=>P,FC:()=>Y,FV:()=>_,H1:()=>g,H7:()=>h,HC:()=>i,HT:()=>a,II:()=>q,JU:()=>D,NR:()=>S,OX:()=>A,PH:()=>en,QT:()=>u,Qx:()=>p,R1:()=>z,SJ:()=>m,UE:()=>X,VW:()=>j,W2:()=>b,X8:()=>f,Z3:()=>F,_m:()=>M,a6:()=>J,aP:()=>Q,bV:()=>R,bZ:()=>G,c1:()=>d,cQ:()=>I,dd:()=>Z,dg:()=>v,dw:()=>T,dx:()=>x,f$:()=>L,h0:()=>N,h1:()=>W,hc:()=>r,hn:()=>ee,l2:()=>k,lv:()=>w,mx:()=>C,oS:()=>B,p:()=>et,tn:()=>c,u6:()=>$,uc:()=>H,v7:()=>U,xC:()=>o,xq:()=>y,xw:()=>er,zo:()=>ea,zr:()=>K})},9208:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/search",function(){return n(4184)}])},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusPanel:"style_statusPanel__9arTu",statusPanelHeader:"style_statusPanelHeader__nKv1I",statusEmpty:"style_statusEmpty__8LWzH",statusList:"style_statusList__FpNgC",statusItem:"style_statusItem__uzO80",statusHeader:"style_statusHeader__o9q_b",statusDesc:"style_statusDesc__XiWFa",statusPath:"style_statusPath__Udxvv",statusMeta:"style_statusMeta__XukHt",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},60470:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var s=n(97109),r=n(838),a=n(88483);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}let i=s.forwardRef((e,t)=>s.createElement(a.A,o({},e,{ref:t,icon:r.A})))},63214:(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"}},84190:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var s=n(97109),r=n(63214),a=n(88483);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}let i=s.forwardRef((e,t)=>s.createElement(a.A,o({},e,{ref:t,icon:r.A})))}},e=>{e.O(0,[260,167,382,628,576,700,292,20,350,636,593,792],()=>e(e.s=9208)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[207],{838:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"}},4184:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>S});var s=n(65321),a=n(43220),r=n.n(a),o=n(97109),i=n(35292),c=n(68787),l=n(33442),d=n(7576),u=n(85114),p=n(94992),h=n(76506),y=n(11702),m=n(85493),f=n(42700),g=n(84253),j=n(30486),b=n(6578),x=n(14569),w=n.n(x);let{Paragraph:v}=i.A;function _(e){return"number"==typeof e?e.toFixed(2):"-"}function S(){var e,t,n;let[a,i]=(0,o.useState)(""),[x,S]=(0,o.useState)(!1),[T,C]=(0,o.useState)([]),[O,E]=(0,o.useState)(),[P,k]=(0,o.useState)(),[R,N]=(0,o.useState)(""),[A,I]=(0,o.useState)({keyword:1,vector:.9,rewrite:.72,hybridBonus:.35}),U=async()=>{let e=a.trim();if(e){S(!0),N("");try{let t=await (0,b.W2)(e,{limit:10,weights:A});C(t.results),E(t.queryTimeMs),k(t.debug)}catch(e){C([]),N(e instanceof Error?e.message:"搜索失败")}finally{S(!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)(c.A,{size:"small",children:(0,s.jsxs)(l.A.Compact,{className:"w-full",children:[(0,s.jsx)(d.A,{value:a,onChange:e=>i(e.target.value),onPressEnter:()=>{U()},placeholder:"输入要搜索的知识库内容"}),(0,s.jsx)(u.Ay,{type:"primary",icon:(0,s.jsx)(j.A,{}),loading:x,onClick:()=>{U()},children:"搜索"})]})}),(0,s.jsx)(c.A,{size:"small",title:"召回权重调节",children:(0,s.jsxs)(l.A,{wrap:!0,children:[(0,s.jsxs)("span",{children:["Keyword ",(0,s.jsx)(p.A,{min:0,max:5,step:.1,value:A.keyword,onChange:e=>I(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:A.vector,onChange:e=>I(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:A.rewrite,onChange:e=>I(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:A.hybridBonus,onChange:e=>I(t=>({...t,hybridBonus:Number(null!=e?e:.35)}))})]})]})}),P&&(0,s.jsx)(c.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:P.originalQuery}),(0,s.jsx)(h.A.Item,{label:"Reranker",children:P.reranker}),(0,s.jsx)(h.A.Item,{label:"查询改写",span:2,children:(0,s.jsx)(l.A,{wrap:!0,children:null==(e=P.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)(l.A,{wrap:!0,children:Object.entries(null!=(t=P.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)(l.A,{wrap:!0,children:Object.entries(null!=(n=P.weights)?n:{}).map(e=>{let[t,n]=e;return(0,s.jsxs)(y.A,{children:[t,": ",n]},t)})})})]})}),(0,s.jsxs)(c.A,{size:"small",title:"搜索结果",extra:"number"==typeof O?"".concat(O," ms"):void 0,children:[R?(0,s.jsx)(m.A,{type:"error",showIcon:!0,message:"搜索失败",description:R,className:"mb-4"}):null,x?(0,s.jsx)(f.A,{}):0===T.length?(0,s.jsx)(g.A,{description:"暂无结果"}):(0,s.jsx)("div",{className:w().searchResultList,children:T.map(e=>{var t,n,o,i,c,d;return(0,s.jsxs)("div",{className:w().searchResultItem,children:[(0,s.jsxs)("div",{className:w().searchResultHeader,children:[(0,s.jsxs)(l.A,{size:8,wrap:!0,children:[(0,s.jsx)(y.A,{color:"hybrid"===e.source?"purple":"vector"===e.source?"blue":"green",children:null!=(d=e.source)?d:"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:_(e.score)})]}),(0,s.jsxs)("div",{className:w().statusPath,children:[(0,s.jsx)(r(),{href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(e.filePath)),children:e.filePath}),"number"==typeof e.chunkIndex?" #".concat(e.chunkIndex):""]}),(0,s.jsx)(v,{ellipsis:{rows:6,expandable:!0,symbol:"展开"},className:w().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 a=RegExp("(".concat(n.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(a).map((e,t)=>n.some(t=>t.toLowerCase()===e.toLowerCase())?(0,s.jsx)("mark",{children:e},t):e)}(e.content,a)}),e.facets&&Object.keys(e.facets).length>0&&(0,s.jsx)("div",{className:w().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:w().statusMeta,children:[(0,s.jsxs)("span",{children:["keyword ",(0,s.jsx)("b",{children:_(null==(t=e.scoreDetails)?void 0:t.keywordScore)})]}),(0,s.jsxs)("span",{children:["bm25 ",(0,s.jsx)("b",{children:_(null==(n=e.scoreDetails)?void 0:n.bm25Score)})]}),(0,s.jsxs)("span",{children:["vector ",(0,s.jsx)("b",{children:_(null==(o=e.scoreDetails)?void 0:o.vectorScore)})]}),(0,s.jsxs)("span",{children:["rerank ",(0,s.jsx)("b",{children:_(null==(i=e.scoreDetails)?void 0:i.rerankBoost)})]}),(0,s.jsxs)("span",{children:["hybrid ",(0,s.jsx)("b",{children:_(null==(c=e.scoreDetails)?void 0:c.hybridScore)})]})]})]},e.id)})})]})]})}},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 a(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return s("/api/kb/stats".concat(t))}async function r(e){var t,n;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(n=e.limit)?n:50)),s("/api/kb/files?".concat(a))}async function o(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),s("/api/kb/files/detail?".concat(n))}async function i(e,t){return s("/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 s("/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 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 d(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 l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(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){let t=new URLSearchParams;return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t),{method:"DELETE"})}async function y(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function m(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(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 b(e,t){var n,a,r,o,i;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!=(i=t.limit)?i:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(a=t.weights)?void 0:a.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(r=t.weights)?void 0:r.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(o=t.weights)?void 0:o.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),s("/api/kb/search?".concat(c))}async function x(){return s("/api/prompt")}async function w(e){return s("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function v(e){return s("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(e,t){return s("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function S(e){return s("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return s("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(){return s("/api/documents/specs")}async function O(e){return s("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return s("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(){return s("/api/documents/templates")}async function k(e){return s("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function R(e){return s("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function N(e){return s("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function A(e){return s("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function I(){return s("/api/documents/generated")}async function U(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)))}async function J(e,t){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function L(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function D(){return s("/api/assets/generated")}async function H(e){return s("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function B(e){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function z(e,t){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function V(e){return s("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function X(e,t){return s("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function F(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function M(){return s("/api/config/providers")}async function W(e,t){return s("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function K(e){return s("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function Q(){return s("/api/config/models")}async function q(e){return s("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Z(){return s("/api/config/embedding")}async function $(e){return s("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function G(){return s("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return s("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function ee(){return s("/api/system/stats")}async function et(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return s("/api/context".concat(n))}async function en(e){return s("/api/context?type=".concat(e,"&stats=1"))}async function es(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ea(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function er(e){return s("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function eo(e,t){return s("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ei(e){return s("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>X,Bh:()=>ei,Dl:()=>P,E:()=>ea,EK:()=>O,ER:()=>E,FC:()=>ee,FV:()=>_,H1:()=>g,H7:()=>h,HC:()=>i,HT:()=>r,II:()=>Z,JU:()=>H,NR:()=>S,OX:()=>A,PH:()=>es,QG:()=>L,QT:()=>u,Qx:()=>p,R1:()=>V,SJ:()=>m,UE:()=>F,VW:()=>j,W2:()=>b,X8:()=>f,Z3:()=>M,_m:()=>W,a6:()=>J,aP:()=>q,bV:()=>N,bZ:()=>Y,c1:()=>d,cQ:()=>I,dd:()=>$,dg:()=>v,dw:()=>T,dx:()=>x,f$:()=>D,h0:()=>R,h1:()=>K,hc:()=>a,hn:()=>et,l2:()=>k,lv:()=>w,mx:()=>C,oS:()=>z,p:()=>en,tn:()=>c,u6:()=>G,uc:()=>B,v7:()=>U,xC:()=>o,xq:()=>y,xw:()=>er,zo:()=>eo,zr:()=>Q})},9208:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/search",function(){return n(4184)}])},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusPanel:"style_statusPanel__9arTu",statusPanelHeader:"style_statusPanelHeader__nKv1I",statusEmpty:"style_statusEmpty__8LWzH",statusList:"style_statusList__FpNgC",statusItem:"style_statusItem__uzO80",statusHeader:"style_statusHeader__o9q_b",statusDesc:"style_statusDesc__XiWFa",statusPath:"style_statusPath__Udxvv",statusMeta:"style_statusMeta__XukHt",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},60470:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var s=n(97109),a=n(838),r=n(88483);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}let i=s.forwardRef((e,t)=>s.createElement(r.A,o({},e,{ref:t,icon:a.A})))},63214:(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"}},84190:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var s=n(97109),a=n(63214),r=n(88483);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}let i=s.forwardRef((e,t)=>s.createElement(r.A,o({},e,{ref:t,icon:a.A})))}},e=>{e.O(0,[260,167,382,628,576,700,292,20,350,636,593,792],()=>e(e.s=9208)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46],{69:(e,n)=>{"use strict";n.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5L255.8 713.6l-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l110.3 111.2c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.1 304.1 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112m161.2 465.2C726.2 620.3 668.9 644 608 644s-118.2-23.7-161.2-66.8C403.7 534.2 380 476.9 380 416s23.7-118.2 66.8-161.2c43-43.1 100.3-66.8 161.2-66.8s118.2 23.7 161.2 66.8c43.1 43 66.8 100.3 66.8 161.2s-23.7 118.2-66.8 161.2"}}]},name:"key",theme:"outlined"}},2256:(e,n,t)=>{"use strict";t.d(n,{A:()=>a});let a=t(25341).A},5450:(e,n)=>{"use strict";n.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"}},6578:(e,n,t)=>{"use strict";async function a(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function o(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(n))}async function s(e){var n,t;let o=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&o.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&o.set("category",e.category),(null==e?void 0:e.page)&&o.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&o.set("limit",String(null!=(t=e.limit)?t:50)),a("/api/kb/files?".concat(o))}async function c(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),a("/api/kb/files/detail?".concat(t))}async function i(e,n){return a("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function l(e,n,t){return a("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function r(e){return new Promise((n,t)=>{let a=new FileReader;a.onload=()=>{let e=a.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},a.onerror=t,a.readAsDataURL(e)})}async function d(e,n,t){return a("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await r(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function m(e){return a("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),a("/api/kb/operations?".concat(n))}async function u(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),a("/api/kb/operations?".concat(n),{method:"DELETE"})}async function h(e,n){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function y(e,n){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function f(e){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return a("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function v(){return a("/api/kb/features")}async function b(e,n){var t,o,s,c,i;let l=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&l.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&l.set("category",n.category),(null==n?void 0:n.limit)&&l.set("limit",String(null!=(i=n.limit)?i:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&l.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(o=n.weights)?void 0:o.vector)!=null&&l.set("vectorWeight",String(n.weights.vector)),(null==n||null==(s=n.weights)?void 0:s.rewrite)!=null&&l.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(c=n.weights)?void 0:c.hybridBonus)!=null&&l.set("hybridBonus",String(n.weights.hybridBonus)),a("/api/kb/search?".concat(l))}async function j(){return a("/api/prompt")}async function x(e){return a("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function A(e){return a("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e,n){return a("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function S(e){return a("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e){return a("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(){return a("/api/documents/specs")}async function T(e){return a("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return a("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(){return a("/api/documents/templates")}async function k(e){return a("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return a("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return a("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function U(e){return a("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(){return a("/api/documents/generated")}async function I(e){return a("/api/documents/generated/".concat(encodeURIComponent(e)))}async function z(e,n){return a("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function L(e){return a("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function J(){return a("/api/assets/generated")}async function M(e){return a("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function D(e){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function K(e,n){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function H(e){return a("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function G(e,n){return a("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function V(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw Error(await n.text());return n.blob()}async function B(){return a("/api/config/providers")}async function F(e,n){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function W(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function X(){return a("/api/config/models")}async function Q(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Z(){return a("/api/config/embedding")}async function q(e){return a("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Y(){return a("/api/config/embedding/healthCheck",{method:"POST"})}async function $(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function ee(){return a("/api/system/stats")}async function en(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return a("/api/context".concat(t))}async function et(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function ea(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function eo(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function es(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ec(e,n){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ei(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>G,Bh:()=>ei,Dl:()=>P,E:()=>eo,EK:()=>T,ER:()=>N,FC:()=>ee,FV:()=>C,H1:()=>g,H7:()=>u,HC:()=>i,HT:()=>s,II:()=>Z,JU:()=>M,NR:()=>S,OX:()=>U,PH:()=>ea,QG:()=>L,QT:()=>m,Qx:()=>p,R1:()=>H,SJ:()=>y,UE:()=>V,VW:()=>v,W2:()=>b,X8:()=>f,Z3:()=>B,_m:()=>F,a6:()=>z,aP:()=>Q,bV:()=>R,bZ:()=>$,c1:()=>d,cQ:()=>_,dd:()=>q,dg:()=>A,dw:()=>w,dx:()=>j,f$:()=>J,h0:()=>E,h1:()=>W,hc:()=>o,hn:()=>en,l2:()=>k,lv:()=>x,mx:()=>O,oS:()=>K,p:()=>et,tn:()=>l,u6:()=>Y,uc:()=>D,v7:()=>I,xC:()=>c,xq:()=>h,xw:()=>es,zo:()=>ec,zr:()=>X})},13114:(e,n,t)=>{"use strict";t.d(n,{A:()=>i});var a=t(97109),o=t(5450),s=t(88483);function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let i=a.forwardRef((e,n)=>a.createElement(s.A,c({},e,{ref:n,icon:o.A})))},15527:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>K});var a=t(65321),o=t(97109),s=t(13014),c=t(17807),i=t(85114),l=t(68787),r=t(2256),d=t(38770),m=t(33442),p=t(26171),u=t(11702),h=t(85493),y=t(63455),f=t(57271),g=t(7576),v=t(94992),b=t(25258),j=t(56985),x=t(54746),A=t(29071),C=t(59188),S=t(4216),w=t(13114),O=t(99650),T=t(58209),N=t(69),P=t(88483);function k(){return(k=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let E=o.forwardRef((e,n)=>o.createElement(P.A,k({},e,{ref:n,icon:N.A})));var R=t(30289);function U(){return(U=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let _=o.forwardRef((e,n)=>o.createElement(P.A,U({},e,{ref:n,icon:R.A})));var I=t(6578),z=t(42323),L=t.n(z);let J=[{label:"OpenAI 兼容",value:"openai"},{label:"Anthropic",value:"anthropic"},{label:"Google",value:"google"},{label:"Ollama",value:"ollama"},{label:"OpenRouter",value:"openrouter"}],M=[{key:"reader",labelKey:"models.tierReader",descKey:"models.tierReaderDesc"},{key:"reasoning",labelKey:"models.tierReasoning",descKey:"models.tierReasoningDesc"},{key:"action",labelKey:"models.tierAction",descKey:"models.tierActionDesc"}],D=[{key:"imageGeneration",label:"图片生成"},{key:"imageUnderstanding",label:"图片理解"},{key:"fileUnderstanding",label:"文件理解"},{key:"audio",label:"音频能力"},{key:"video",label:"视频能力"}];function K(){let e=(0,s.Vr)(),{message:n}=c.A.useApp(),t=[{label:e("models.embeddingProviderHash"),value:"hash"},{label:e("models.embeddingProviderOpenAI"),value:"openai-compatible"}],[N,P]=(0,o.useState)(!0),[k,R]=(0,o.useState)([]),[U,z]=(0,o.useState)(null),[K,H]=(0,o.useState)({provider:"hash",dimensions:384}),[G,V]=(0,o.useState)(!1),[B,F]=(0,o.useState)(!1),[W,X]=(0,o.useState)(null),[Q,Z]=(0,o.useState)(!1),[q,Y]=(0,o.useState)(""),[$,ee]=(0,o.useState)(""),[en,et]=(0,o.useState)(""),[ea,eo]=(0,o.useState)("openai"),[es,ec]=(0,o.useState)({}),[ei,el]=(0,o.useState)(!1),[er,ed]=(0,o.useState)(!1),[em,ep]=(0,o.useState)(""),[eu,eh]=(0,o.useState)(""),[ey,ef]=(0,o.useState)(""),[eg,ev]=(0,o.useState)(""),[eb,ej]=(0,o.useState)("openai"),[ex,eA]=(0,o.useState)({}),[eC,eS]=(0,o.useState)(!1),[ew,eO]=(0,o.useState)(null),[eT,eN]=(0,o.useState)({}),eP=async()=>{P(!0);try{let[e,n,t]=await Promise.all([(0,I.Z3)().catch(()=>[]),(0,I.zr)().catch(()=>null),(0,I.II)().catch(()=>({provider:"hash",dimensions:384}))]);R(e),z(n),H(t)}catch(t){n.error(e("common.error"))}finally{P(!1)}};(0,o.useEffect)(()=>{eP()},[]);let ek=async()=>{if(q.trim()){el(!0);try{await (0,I._m)(q.trim(),{apiKey:$||void 0,baseUrl:en||void 0,protocol:ea,capabilities:es}),Z(!1),Y(""),ee(""),et(""),eo("openai"),ec({}),await eP(),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}finally{el(!1)}}},eE=async t=>{try{await (0,I.h1)(t),await eP(),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},eR=async e=>{ep(e.name),eh(e.name),ef("");try{let n=await (0,I.Bh)(e.name);ef(n.apiKey?"••••••••":""),ev(n.baseUrl||""),ej(n.protocol||n.detectedProtocol||"openai"),eA(n.capabilities||{})}catch(n){ev(e.baseUrl||""),ej(e.protocol||e.detectedProtocol||"openai"),eA(e.capabilities||{})}ed(!0)},eU=async()=>{if(eu.trim()){eS(!0);try{let t=ey.includes("•")?void 0:ey||void 0;await (0,I._m)(eu.trim(),{oldName:em,apiKey:t,baseUrl:eg||void 0,protocol:eb,capabilities:ex}),ed(!1),ep(""),eh(""),ef(""),ev(""),ej("openai"),eA({}),await eP(),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}finally{eS(!1)}}},e_=async t=>{eO(t);try{let a=await (0,I.bZ)(t);eN(e=>({...e,[t]:a.success})),n[a.success?"success":"error"](a.success?e("models.connected"):e("models.connectionFailed"))}catch(e){eN(e=>({...e,[t]:!1}))}finally{eO(null)}},eI=async()=>{V(!0);try{let t=await (0,I.dd)(K);H(t),X(null),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}finally{V(!1)}},ez=async()=>{F(!0);try{let t=await (0,I.u6)();X(t.success),n[t.success?"success":"error"](t.message||(t.success?e("models.connected"):e("models.connectionFailed")))}catch(t){X(!1),n.error(e("common.error"))}finally{F(!1)}},eL=async(t,a)=>{if(!U)return;let o={...U},s=o[t];if(!a){s.active="",z(o);try{await (0,I.aP)(o)}catch(t){n.error(e("common.error"))}return}let c=a.indexOf(":"),i=c>=0?a.slice(0,c):a,l=c>=0?a.slice(c+1):a;s.active=l,s.list.some(e=>e.name===l&&e.provider===i)||s.list.push({name:l,provider:i}),z(o);try{await (0,I.aP)(o)}catch(t){n.error(e("common.error"))}};return(0,a.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle",children:e("models.title")}),(0,a.jsx)("p",{className:"pageDesc",children:e("models.description")})]}),(0,a.jsx)(i.Ay,{type:"primary",icon:(0,a.jsx)(x.A,{}),onClick:()=>Z(!0),children:e("models.addModel")})]}),(0,a.jsx)(l.A,{title:e("models.modelList"),size:"small",loading:N,children:0===k.length?(0,a.jsx)("span",{className:L().cardMeta,children:e("models.noProviders")}):(0,a.jsx)(r.A,{gutter:[12,12],align:"stretch",children:k.map(n=>(0,a.jsx)(d.A,{xs:24,sm:12,lg:8,xl:6,className:L().providerGrid,children:(0,a.jsxs)(l.A,{size:"small",className:L().providerCard,children:[(0,a.jsxs)("div",{className:L().cardAction,children:[(0,a.jsxs)("div",{className:L().cardMain,children:[(0,a.jsx)("div",{className:L().cardName,title:n.name,children:n.name}),(0,a.jsxs)("div",{className:L().cardMeta,children:[(0,a.jsx)(A.A,{})," ",n.protocol||n.detectedProtocol||"openai"]})]}),(0,a.jsxs)(m.A,{size:2,wrap:!1,children:[(0,a.jsx)(i.Ay,{size:"small",type:"text",loading:ew===n.name,onClick:()=>{e_(n.name)},icon:!0===eT[n.name]?(0,a.jsx)(C.A,{className:"text-[var(--colorOk)]"}):!1===eT[n.name]?(0,a.jsx)(S.A,{className:"text-[var(--colorDanger)]"}):(0,a.jsx)(w.A,{})}),(0,a.jsx)(i.Ay,{size:"small",type:"text",icon:(0,a.jsx)(O.A,{}),onClick:()=>{eR(n)}}),(0,a.jsx)(p.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{eE(n.name)},children:(0,a.jsx)(i.Ay,{size:"small",type:"text",danger:!0,icon:(0,a.jsx)(T.A,{})})})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,a.jsxs)("span",{className:"".concat(L().cardMeta," text-xs"),children:[(0,a.jsx)(E,{})," ",n.hasApiKey?"••••••••":"—"]}),n.baseUrl&&(0,a.jsxs)("span",{className:"".concat(L().cardMeta," ").concat(L().urlLine," text-xs"),title:n.baseUrl,children:[(0,a.jsx)(_,{})," ",n.baseUrl]}),(0,a.jsx)(m.A,{size:[4,4],wrap:!0,children:D.filter(e=>{var t;return null==(t=n.capabilities)?void 0:t[e.key]}).map(e=>(0,a.jsx)(u.A,{color:"purple",children:e.label},e.key))})]})]})},n.name))})}),(0,a.jsxs)(l.A,{title:e("models.embeddingConfig"),size:"small",loading:N,children:[(0,a.jsx)(h.A,{className:"mb-4",type:"info",showIcon:!0,message:e("models.embeddingHint")}),(0,a.jsxs)(y.A,{layout:"vertical",size:"middle",children:[(0,a.jsxs)(r.A,{gutter:[12,12],children:[(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(y.A.Item,{label:e("models.embeddingProvider"),children:(0,a.jsx)(f.A,{value:K.provider,options:t,onChange:e=>H(n=>({...n,provider:e,dimensions:"hash"===e?384:n.dimensions||1024}))})})}),"openai-compatible"===K.provider&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(y.A.Item,{label:"Base URL",children:(0,a.jsx)(g.A,{value:K.baseUrl,onChange:e=>H(n=>({...n,baseUrl:e.target.value})),placeholder:"http://localhost:11434/v1"})})}),(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(y.A.Item,{label:e("models.model"),children:(0,a.jsx)(g.A,{value:K.model,onChange:e=>H(n=>({...n,model:e.target.value})),placeholder:"bge-m3"})})}),(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(y.A.Item,{label:e("models.apiKey"),help:K.hasApiKey?e("models.embeddingApiKeyHint"):void 0,children:(0,a.jsx)(g.A.Password,{value:K.apiKey,onFocus:()=>{var e;(null==(e=K.apiKey)?void 0:e.includes("•"))&&H(e=>({...e,apiKey:""}))},onChange:e=>H(n=>({...n,apiKey:e.target.value})),placeholder:e("models.optional")})})})]}),(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(y.A.Item,{label:e("models.dimensions"),children:(0,a.jsx)(v.A,{className:"w-full",min:1,value:K.dimensions,onChange:e=>H(n=>({...n,dimensions:Number(e||("hash"===n.provider?384:1024))}))})})}),(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(y.A.Item,{label:e("models.status"),children:(0,a.jsxs)(m.A,{children:[(0,a.jsx)(u.A,{color:"hash"===K.provider?"default":"blue",children:"hash"===K.provider?e("models.localHash"):e("models.openAICompatible")}),!0===W&&(0,a.jsx)(u.A,{color:"success",children:e("models.connected")}),!1===W&&(0,a.jsx)(u.A,{color:"error",children:e("models.connectionFailed")})]})})})]}),(0,a.jsxs)(m.A,{children:[(0,a.jsx)(i.Ay,{type:"primary",loading:G,onClick:()=>{eI()},children:e("models.saveEmbedding")}),(0,a.jsx)(i.Ay,{icon:(0,a.jsx)(w.A,{}),loading:B,onClick:()=>{ez()},children:e("models.testEmbedding")})]})]})]}),U&&(0,a.jsx)(l.A,{title:e("models.modelTiers"),size:"small",children:(0,a.jsx)(r.A,{gutter:[12,12],children:M.map(t=>{var o;let{key:s,labelKey:c,descKey:i}=t,r=U[s],m=r.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),p=k.filter(e=>!r.list.some(n=>n.provider===e.name)).map(e=>({label:"".concat(e.name," / ").concat(e.name),value:"".concat(e.name,":").concat(e.name)}));return(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsxs)(l.A,{size:"small",title:e(c),children:[(0,a.jsx)("span",{className:L().tierDesc,children:e(i)}),(0,a.jsx)(f.A,{value:r.active?"".concat((null==(o=r.list.find(e=>e.name===r.active))?void 0:o.provider)||"",":").concat(r.active):void 0,onChange:e=>{eL(s,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),className:"w-full",options:[...m,...p]}),r.list.length>0&&(0,a.jsx)("div",{className:L().modelTags,children:r.list.map(t=>(0,a.jsxs)(u.A,{color:t.name===r.active?"blue":void 0,closable:!0,onClose:()=>{var a,o;let c={...U},i=c[s];i.list=i.list.filter(e=>e.name!==t.name||e.provider!==t.provider),i.active===t.name&&(i.active=null!=(o=null==(a=i.list[0])?void 0:a.name)?o:""),z(c),(0,I.aP)(c).catch(()=>n.error(e("common.error")))},children:[t.provider,"/",t.name]},"".concat(t.provider,":").concat(t.name)))})]})},s)})})}),(0,a.jsx)(b.A,{maskClosable:!1,title:e("models.addModel"),open:Q,onCancel:()=>{Z(!1),Y(""),ee(""),et(""),eo("openai")},onOk:()=>{ek()},confirmLoading:ei,children:(0,a.jsxs)(y.A,{layout:"vertical",size:"middle",children:[(0,a.jsx)(y.A.Item,{label:e("models.modelName"),children:(0,a.jsx)(g.A,{value:q,onChange:e=>Y(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,a.jsx)(y.A.Item,{label:e("models.apiKey"),children:(0,a.jsx)(g.A.Password,{value:$,onChange:e=>ee(e.target.value),placeholder:"sk-..."})}),(0,a.jsx)(y.A.Item,{label:e("models.baseUrl"),children:(0,a.jsx)(g.A,{value:en,onChange:e=>et(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,a.jsx)(y.A.Item,{label:e("models.protocol"),children:(0,a.jsx)(f.A,{value:ea,onChange:eo,options:J})}),(0,a.jsx)(y.A.Item,{label:"多模态能力",children:(0,a.jsx)(j.A.Group,{value:D.filter(e=>es[e.key]).map(e=>e.key),options:D.map(e=>({label:e.label,value:e.key})),onChange:e=>ec(Object.fromEntries(D.map(n=>[n.key,e.includes(n.key)])))})})]})}),(0,a.jsx)(b.A,{maskClosable:!1,title:e("models.editModel"),open:er,onCancel:()=>{ed(!1),ep(""),eh(""),ef(""),ev(""),ej("openai")},onOk:()=>{eU()},confirmLoading:eC,children:(0,a.jsxs)(y.A,{layout:"vertical",size:"middle",children:[(0,a.jsx)(y.A.Item,{label:e("models.modelName"),children:(0,a.jsx)(g.A,{value:eu,onChange:e=>eh(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,a.jsx)(y.A.Item,{label:e("models.apiKey"),help:e("models.apiKeyEditHint"),children:(0,a.jsx)(g.A.Password,{value:ey,onFocus:()=>{ey.includes("•")&&ef("")},onCopy:e=>e.preventDefault(),onChange:e=>ef(e.target.value),placeholder:e("models.apiKeyEditPlaceholder")})}),(0,a.jsx)(y.A.Item,{label:e("models.baseUrl"),children:(0,a.jsx)(g.A,{value:eg,onChange:e=>ev(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,a.jsx)(y.A.Item,{label:e("models.protocol"),children:(0,a.jsx)(f.A,{value:eb,onChange:ej,options:J})}),(0,a.jsx)(y.A.Item,{label:"多模态能力",children:(0,a.jsx)(j.A.Group,{value:D.filter(e=>ex[e.key]).map(e=>e.key),options:D.map(e=>({label:e.label,value:e.key})),onChange:e=>eA(Object.fromEntries(D.map(n=>[n.key,e.includes(n.key)])))})})]})})]})}},29071:(e,n,t)=>{"use strict";t.d(n,{A:()=>i});var a=t(97109),o=t(78847),s=t(88483);function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let i=a.forwardRef((e,n)=>a.createElement(s.A,c({},e,{ref:n,icon:o.A})))},30289:(e,n)=>{"use strict";n.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"}},38770:(e,n,t)=>{"use strict";t.d(n,{A:()=>a});let a=t(51916).A},42323:e=>{e.exports={cardMeta:"style_cardMeta__6KOa3",cardName:"style_cardName__WcLAf",cardAction:"style_cardAction__XUfPD",cardMain:"style_cardMain__qI1jU",providerCard:"style_providerCard__tLKGs",providerGrid:"style_providerGrid__Gx5GR",urlLine:"style_urlLine__DuMYs",tierDesc:"style_tierDesc__wOd6p",modelTags:"style_modelTags__nmMVj"}},77305:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return t(15527)}])},78847:(e,n)=>{"use strict";n.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"}}},e=>{e.O(0,[260,167,382,628,271,576,183,985,232,20,636,593,792],()=>e(e.s=77305)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[449],{6578:(e,n,t)=>{"use strict";async function o(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function i(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(n))}async function s(e){var n,t;let i=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&i.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&i.set("category",e.category),(null==e?void 0:e.page)&&i.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&i.set("limit",String(null!=(t=e.limit)?t:50)),o("/api/kb/files?".concat(i))}async function r(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),o("/api/kb/files/detail?".concat(t))}async function c(e,n){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function a(e,n,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function l(e){return new Promise((n,t)=>{let o=new FileReader;o.onload=()=>{let e=o.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},o.onerror=t,o.readAsDataURL(e)})}async function d(e,n,t){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n))}async function y(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function m(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function h(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function v(){return o("/api/kb/features")}async function x(e,n){var t,i,s,r,c;let a=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&a.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&a.set("category",n.category),(null==n?void 0:n.limit)&&a.set("limit",String(null!=(c=n.limit)?c:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&a.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(i=n.weights)?void 0:i.vector)!=null&&a.set("vectorWeight",String(n.weights.vector)),(null==n||null==(s=n.weights)?void 0:s.rewrite)!=null&&a.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(r=n.weights)?void 0:r.hybridBonus)!=null&&a.set("hybridBonus",String(n.weights.hybridBonus)),o("/api/kb/search?".concat(a))}async function j(){return o("/api/prompt")}async function T(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function S(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function b(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function k(){return o("/api/documents/specs")}async function A(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return o("/api/documents/templates")}async function P(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function U(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J(){return o("/api/documents/generated")}async function D(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function I(e,n){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function L(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function z(){return o("/api/assets/generated")}async function _(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function B(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function F(e,n){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function M(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function H(e,n){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function W(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw Error(await n.text());return n.blob()}async function Q(){return o("/api/config/providers")}async function V(e,n){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function X(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function q(){return o("/api/config/models")}async function Z(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function K(){return o("/api/config/embedding")}async function G(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function ee(){return o("/api/system/stats")}async function en(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function et(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function eo(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ei(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function es(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function er(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ec(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>H,Bh:()=>ec,Dl:()=>E,E:()=>ei,EK:()=>A,ER:()=>O,FC:()=>ee,FV:()=>w,H1:()=>g,H7:()=>y,HC:()=>c,HT:()=>s,II:()=>K,JU:()=>_,NR:()=>b,OX:()=>U,PH:()=>eo,QG:()=>L,QT:()=>u,Qx:()=>p,R1:()=>M,SJ:()=>h,UE:()=>W,VW:()=>v,W2:()=>x,X8:()=>f,Z3:()=>Q,_m:()=>V,a6:()=>I,aP:()=>Z,bV:()=>R,bZ:()=>Y,c1:()=>d,cQ:()=>J,dd:()=>G,dg:()=>S,dw:()=>C,dx:()=>j,f$:()=>z,h0:()=>N,h1:()=>X,hc:()=>i,hn:()=>en,l2:()=>P,lv:()=>T,mx:()=>k,oS:()=>F,p:()=>et,tn:()=>a,u6:()=>$,uc:()=>B,v7:()=>D,xC:()=>r,xq:()=>m,xw:()=>es,zo:()=>er,zr:()=>q})},27795:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>b});var o=t(65321),i=t(97109),s=t(13014),r=t(85114),c=t(2256),a=t(38770),l=t(68787),d=t(99605),u=t(54849),p=t(33442),y=t(11702),m=t(86109),h=t(99811),f=t(520),g=t(93314),v=t(13114),x=t(29071),j=t(26631),T=t(84742),S=t(38762),w=t(6578);function b(){var e,n,t,b,C,k,A,O,E,P,N,R;let U=(0,s.Vr)(),J=(0,m.useRouter)(),[D,I]=(0,i.useState)(null),[L,z]=(0,i.useState)(!0),[_,B]=(0,i.useState)(0),F=(0,i.useCallback)(async()=>{z(!0);try{let[e,n]=await Promise.all([(0,w.FC)(),(0,w.Z3)().catch(()=>[])]);I(e),B(Array.isArray(n)?n.length:0)}catch(e){}finally{z(!1)}},[]);(0,i.useEffect)(()=>{F();let e=setInterval(()=>{F()},1e4);return()=>clearInterval(e)},[F]);let M=(null!=(n=null==D?void 0:D.cpu.usagePercent)?n:0)>80?"var(--colorDanger)":(null!=(t=null==D?void 0:D.cpu.usagePercent)?t:0)>50?"var(--colorWarning)":"var(--colorOk)",H=(null!=(b=null==D?void 0:D.memory.usagePercent)?b:0)>80?"var(--colorDanger)":(null!=(C=null==D?void 0:D.memory.usagePercent)?C:0)>50?"var(--colorWarning)":"var(--colorOk)",W=(null==D?void 0:D.tasks.total)?Math.round(D.tasks.success/D.tasks.total*100):0,Q=null==D||null==(e=D.models)?void 0:e[0];return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:U("overview.title")}),(0,o.jsx)("p",{className:"pageDesc",children:U("overview.description")})]}),(0,o.jsx)(r.Ay,{icon:(0,o.jsx)(h.A,{spin:L}),loading:L,onClick:()=>{F()},children:U("common.retry")})]}),(0,o.jsxs)(c.A,{gutter:[16,16],children:[(0,o.jsx)(a.A,{xs:24,sm:12,children:(0,o.jsx)(l.A,{size:"small",title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(f.A,{})," CPU"]}),children:(0,o.jsxs)("div",{style:{textAlign:"center"},children:[(0,o.jsx)(d.A,{type:"circle",percent:null!=(k=null==D?void 0:D.cpu.usagePercent)?k:0,size:120,strokeColor:M,format:e=>"".concat(null==e?void 0:e.toFixed(1),"%")}),(0,o.jsxs)("div",{className:"text-xs mt-2",style:{color:"var(--colorTextSecondary)"},children:[null!=(A=null==D?void 0:D.cpu.cores)?A:0," ",U("overview.cores")]})]})})}),(0,o.jsx)(a.A,{xs:24,sm:12,children:(0,o.jsx)(l.A,{size:"small",title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g.A,{})," ",U("overview.memory")]}),children:(0,o.jsxs)("div",{style:{textAlign:"center"},children:[(0,o.jsx)(d.A,{type:"circle",percent:null!=(O=null==D?void 0:D.memory.usagePercent)?O:0,size:120,strokeColor:H,format:e=>"".concat(e,"%")}),(0,o.jsxs)("div",{className:"text-xs mt-2",style:{color:"var(--colorTextSecondary)"},children:[null!=(E=null==D?void 0:D.memory.processMB)?E:0," MB / ",null!=(P=null==D?void 0:D.memory.totalMB)?P:0," MB"]})]})})})]}),(0,o.jsxs)(c.A,{gutter:[16,16],children:[(0,o.jsx)(a.A,{xs:12,sm:6,children:(0,o.jsx)(l.A,{size:"small",children:(0,o.jsx)(u.A,{title:U("overview.providersCount"),value:_,prefix:(0,o.jsx)(v.A,{})})})}),(0,o.jsx)(a.A,{xs:12,sm:6,children:(0,o.jsx)(l.A,{size:"small",children:(0,o.jsx)(u.A,{title:U("overview.tokensUsed"),value:null!=(N=null==D?void 0:D.tokens.total)?N:0,prefix:(0,o.jsx)(x.A,{})})})}),(0,o.jsx)(a.A,{xs:12,sm:6,children:(0,o.jsx)(l.A,{size:"small",children:(0,o.jsx)(u.A,{title:U("overview.tasksTotal"),value:null!=(R=null==D?void 0:D.tasks.total)?R:0,prefix:(0,o.jsx)(j.A,{})})})}),(0,o.jsx)(a.A,{xs:12,sm:6,children:(0,o.jsx)(l.A,{size:"small",children:(0,o.jsx)(u.A,{title:U("overview.successRate"),value:W,suffix:"%",prefix:W>80?(0,o.jsx)(T.A,{style:{color:"var(--colorOk)"}}):(0,o.jsx)(S.A,{style:{color:"var(--colorDanger)"}})})})})]}),(0,o.jsxs)(c.A,{gutter:[16,16],children:[(0,o.jsx)(a.A,{xs:24,sm:12,children:(0,o.jsx)(l.A,{size:"small",title:U("overview.topModel"),children:Q?(0,o.jsxs)("div",{className:"flex items-center gap-4",children:[(0,o.jsx)(v.A,{style:{fontSize:24,color:"var(--colorAccent)"}}),(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:"font-semibold",children:Q.model}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["@",Q.provider," — ",Q.count," ",U("overview.calls")]})]})]}):(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:U("common.noData")})})}),(0,o.jsx)(a.A,{xs:24,sm:12,children:(0,o.jsx)(l.A,{size:"small",title:U("overview.taskTypes"),children:(null==D?void 0:D.tasks.types)&&Object.keys(D.tasks.types).length>0?(0,o.jsx)(p.A,{wrap:!0,children:Object.entries(D.tasks.types).map(e=>{let[n,t]=e;return(0,o.jsxs)(y.A,{children:[n.slice(0,30),": ",t]},n)})}):(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:U("common.noData")})})})]}),(0,o.jsx)(l.A,{title:U("overview.quickActions"),size:"small",children:(0,o.jsxs)(p.A,{wrap:!0,children:[(0,o.jsx)(r.Ay,{onClick:()=>{J.push("/knowledge/manage")},children:U("overview.goToKnowledge")}),(0,o.jsx)(r.Ay,{onClick:()=>{J.push("/models")},children:U("overview.goToModels")}),(0,o.jsx)(r.Ay,{onClick:()=>{J.push("/settings")},children:U("overview.goToSettings")}),(0,o.jsx)(r.Ay,{onClick:()=>{J.push("/prompt")},children:U("nav.promptManagement")}),(0,o.jsx)(r.Ay,{onClick:()=>{J.push("/context/long-term")},children:U("nav.contextEngineering")})]})})]})}},53139:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/overview",function(){return t(27795)}])}},e=>{e.O(0,[260,167,15,577,224,636,593,792],()=>e(e.s=53139)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,e,t,c,a,n,i,
|
|
1
|
+
self.__BUILD_MANIFEST=function(s,e,t,c,a,d,n,i,u,o,b,r,f,k,h,g,l,j,m,p,_,w,x,I,v){return{__rewrites:{afterFiles:[],beforeFiles:[{has:j,source:"/_next/static/:buildId/_buildManifest.js",destination:"/_next/static/customize-agent-dashboard/_buildManifest.js"},{has:j,source:"/_next/static/:buildId/_ssgManifest.js",destination:"/_next/static/customize-agent-dashboard/_ssgManifest.js"}],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:p,bitArray:[]},__routerFilterDynamic:{numItems:k,errorRate:1e-4,numBits:k,numHashes:p,bitArray:[]},"/":["static/chunks/pages/index-c5e0758e6b31deee.js"],"/_error":["static/chunks/pages/_error-282257fbdcc167b4.js"],"/asset-library":[s,e,t,c,a,d,i,u,r,h,"static/chunks/881-a1eb917222b66f09.js","static/chunks/pages/asset-library-82606363f9142bad.js"],"/context/long-term":[s,e,t,c,a,n,d,i,u,o,b,f,_,"static/chunks/pages/context/long-term-f2a550bc848ec1a3.js"],"/context/short-term":[s,e,t,c,a,n,d,i,u,o,b,f,_,"static/chunks/pages/context/short-term-1de28da82d2b6276.js"],"/document-roles":[s,e,t,c,a,n,d,i,u,b,h,"static/chunks/pages/document-roles-54a1cc04116e8c18.js"],"/document-specs":[s,e,t,c,a,n,d,i,u,b,h,g,"static/chunks/pages/document-specs-723dee6883949a17.js"],"/documents":[s,e,t,c,a,n,d,i,u,b,r,h,w,"static/chunks/617-68a9e848c380f9c3.js","static/chunks/pages/documents-c1a01ae631b42488.js"],"/guide":[s,e,t,r,w,"static/chunks/969-5d5ff5a3ed74f52b.js","static/chunks/pages/guide-acf32d66a6df6e5a.js"],"/knowledge":["static/chunks/pages/knowledge-905248d8dcb15453.js"],"/knowledge/file-detail":[s,e,t,c,a,n,d,i,o,f,r,x,"static/chunks/80-96429163e5c103a8.js",l,"static/chunks/pages/knowledge/file-detail-7a1a3d4352ecfa0a.js"],"/knowledge/files":[s,e,t,c,a,n,d,i,o,f,I,l,"static/chunks/pages/knowledge/files-f0e05583bf7c57d9.js"],"/knowledge/manage":[s,e,t,c,a,d,i,o,f,v,"static/chunks/935-daa0026982d7fa8d.js","static/chunks/pages/knowledge/manage-8acff53019eb6cc1.js"],"/knowledge/search":[s,e,t,c,n,d,r,g,x,l,"static/chunks/pages/knowledge/search-1f3bd8fcb7af3e4d.js"],"/models":[s,e,t,c,a,n,u,o,b,g,"static/css/0e153583d22cc52e.css","static/chunks/pages/models-11533caad3723009.js"],"/overview":[s,e,I,v,"static/chunks/224-9a7074031493793b.js","static/chunks/pages/overview-f80672c242d9aa32.js"],"/prompt":[s,e,t,c,n,u,o,"static/chunks/pages/prompt-c9bc7884a44d3767.js"],"/settings":[s,"static/css/82b6ddff0ef364fe.css","static/chunks/pages/settings-68f0d05bf95d12da.js"],sortedPages:["/","/_app","/_error","/asset-library","/context/long-term","/context/short-term","/document-roles","/document-specs","/documents","/guide","/knowledge","/knowledge/file-detail","/knowledge/files","/knowledge/manage","/knowledge/search","/models","/overview","/prompt","/settings"]}}("static/chunks/260-cec84dc6c353e104.js","static/chunks/167-d4f384b289ecb70c.js","static/chunks/382-6ab5f41cd91edad0.js","static/chunks/628-27424ba8ca9ca8ce.js","static/chunks/271-39045be4cdbd6af1.js","static/chunks/700-5d29b0475311f590.js","static/chunks/576-fd55b302cb0c9a48.js","static/chunks/174-51b6d64f21e9b976.js","static/chunks/183-8da0232dd30cdc81.js","static/chunks/985-4b4a3ed36ada16eb.js","static/chunks/232-813af4932a145fdc.js","static/chunks/292-f0a2c92861c304e6.js","static/chunks/400-1fa1899b7c3f0bb4.js",0,"static/chunks/951-8ecf8af33ab36369.js","static/chunks/20-8968ee2d4013a5b8.js","static/css/d284a7454d6f6b06.css",void 0,1e-4,NaN,"static/chunks/257-e4ebae17a8ee8412.js","static/chunks/858-5e6982e2b239d4b7.js","static/chunks/350-8c5e13c0577a38c3.js","static/chunks/15-4683808cb8db7005.js","static/chunks/577-5b2691f0c8f17187.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@customize-agent/server",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.17",
|
|
4
4
|
"description": "Customize Agent Web 管理控制台",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json"
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"react-dom": "^19.0.0",
|
|
47
47
|
"tesseract.js": "^7.0.0",
|
|
48
48
|
"xlsx": "^0.18.5",
|
|
49
|
-
"@customize-agent/llm": "^3.0.3",
|
|
50
49
|
"@customize-agent/knowledge": "^3.0.10",
|
|
50
|
+
"@customize-agent/llm": "^3.0.3",
|
|
51
51
|
"@customize-agent/runtime": "^3.0.5"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[958],{6578:(n,e,t)=>{"use strict";async function o(n,e){let t=await fetch(n,e);if(!t.ok){let n=await t.text(),e=n||"HTTP ".concat(t.status);try{let t=JSON.parse(n);e=t.error||t.message||e}catch(n){}throw Error(e)}return t.json()}async function i(n){let e=n?"?projectRoot=".concat(encodeURIComponent(n)):"";return o("/api/kb/stats".concat(e))}async function a(n){var e,t;let i=new URLSearchParams;return(null==n?void 0:n.projectRoot)&&i.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&i.set("category",n.category),(null==n?void 0:n.page)&&i.set("page",String(null!=(e=n.page)?e:1)),(null==n?void 0:n.limit)&&i.set("limit",String(null!=(t=n.limit)?t:50)),o("/api/kb/files?".concat(i))}async function c(n,e){let t=new URLSearchParams({relativePath:n});return e&&t.set("projectRoot",e),o("/api/kb/files/detail?".concat(t))}async function s(n,e){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:n,projectRoot:e})})}async function r(n,e,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:n,target:e,projectRoot:t})})}async function d(n){return new Promise((e,t)=>{let o=new FileReader;o.onload=()=>{let n=o.result,t=n.indexOf(",");e(t>=0?n.slice(t+1):n)},o.onerror=t,o.readAsDataURL(n)})}async function p(n,e,t){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(n.map(async n=>({fileName:n.name,fileData:await d(n),relativePath:n.webkitRelativePath||void 0}))),projectRoot:e,uploadId:t})})}async function l(n){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(n)))}async function u(n){let e=new URLSearchParams({limit:"50"});return n&&e.set("projectRoot",n),o("/api/kb/operations?".concat(e))}async function y(n){let e=new URLSearchParams;return n&&e.set("projectRoot",n),o("/api/kb/operations?".concat(e),{method:"DELETE"})}async function h(n,e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:n,projectRoot:e})})}async function f(n,e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:n,projectRoot:e})})}async function m(n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:n})})}async function g(n){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:n})})}async function j(){return o("/api/kb/features")}async function T(n,e){var t,i,a,c,s;let r=new URLSearchParams({q:n});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.limit)&&r.set("limit",String(null!=(s=e.limit)?s:20)),(null==e||null==(t=e.weights)?void 0:t.keyword)!=null&&r.set("keywordWeight",String(e.weights.keyword)),(null==e||null==(i=e.weights)?void 0:i.vector)!=null&&r.set("vectorWeight",String(e.weights.vector)),(null==e||null==(a=e.weights)?void 0:a.rewrite)!=null&&r.set("rewriteWeight",String(e.weights.rewrite)),(null==e||null==(c=e.weights)?void 0:c.hybridBonus)!=null&&r.set("hybridBonus",String(e.weights.hybridBonus)),o("/api/kb/search?".concat(r))}async function x(){return o("/api/prompt")}async function S(n){return o("/api/documents/roles".concat(n?"?type=".concat(n):""))}async function b(n){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function C(n,e){return o("/api/documents/roles?type=".concat(n,"&id=").concat(encodeURIComponent(e)),{method:"DELETE"})}async function w(n){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function E(n){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function O(){return o("/api/documents/specs")}async function v(n){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function N(n){return o("/api/documents/specs?id=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function P(){return o("/api/documents/templates")}async function R(n){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function k(n){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function A(n){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:n})})}async function U(n){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function J(){return o("/api/documents/generated")}async function I(n){return o("/api/documents/generated/".concat(encodeURIComponent(n)))}async function D(n,e){return o("/api/documents/generated/".concat(encodeURIComponent(n)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function L(){return o("/api/assets/generated")}async function _(n){return o("/api/assets/generated?id=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function H(n){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n,action:"index"})})}async function F(n,e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n,action:"open",target:e})})}async function W(n){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function B(n,e){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:n,id:e})})}async function X(n){let e=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw Error(await e.text());return e.blob()}async function z(){return o("/api/config/providers")}async function Q(n,e){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n,...e})})}async function V(n){return o("/api/config/providers/".concat(encodeURIComponent(n)),{method:"DELETE"})}async function q(){return o("/api/config/models")}async function Z(n){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function $(){return o("/api/config/embedding")}async function K(n){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function M(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function G(n){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n})})}async function Y(){return o("/api/system/stats")}async function nn(n,e){let t=e?"?type=".concat(n,"&search=").concat(encodeURIComponent(e)):"?type=".concat(n);return o("/api/context".concat(t))}async function ne(n){return o("/api/context?type=".concat(n,"&stats=1"))}async function nt(n){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:n})})}async function no(n){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:n})})}async function ni(n){return o("/api/context?id=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function na(n,e){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n,...e})})}async function nc(n){return o("/api/config/providers/".concat(encodeURIComponent(n)))}t.d(e,{Af:()=>B,Bh:()=>nc,Dl:()=>P,E:()=>no,EK:()=>v,ER:()=>N,FC:()=>Y,FV:()=>C,H1:()=>g,H7:()=>y,HC:()=>s,HT:()=>a,II:()=>$,JU:()=>_,NR:()=>w,OX:()=>U,PH:()=>nt,QT:()=>l,Qx:()=>u,R1:()=>W,SJ:()=>f,UE:()=>X,VW:()=>j,W2:()=>T,X8:()=>m,Z3:()=>z,_m:()=>Q,a6:()=>D,aP:()=>Z,bV:()=>A,bZ:()=>G,c1:()=>p,cQ:()=>J,dd:()=>K,dg:()=>b,dw:()=>E,dx:()=>x,f$:()=>L,h0:()=>k,h1:()=>V,hc:()=>i,hn:()=>nn,l2:()=>R,lv:()=>S,mx:()=>O,oS:()=>F,p:()=>ne,tn:()=>r,u6:()=>M,uc:()=>H,v7:()=>I,xC:()=>c,xq:()=>h,xw:()=>ni,zo:()=>na,zr:()=>q})},63806:(n,e,t)=>{"use strict";t.r(e),t.d(e,{default:()=>E});var o=t(65321),i=t(97109),a=t(35292),c=t(17807),s=t(68787),r=t(38332),d=t(84253),p=t(85114),l=t(26171),u=t(384),y=t(33442),h=t(11702),f=t(93051),m=t(81668),g=t(64254),j=t(26619),T=t(58209),x=t(75548),S=t(56768),b=t(6578);let{Text:C,Paragraph:w}=a.A;function E(){let{message:n}=c.A.useApp(),[e,t]=(0,i.useState)([]),[a,E]=(0,i.useState)(null),O=async()=>{try{t((await (0,b.f$)()).assets)}catch(n){t([])}};(0,i.useEffect)(()=>{O()},[]);let v=async e=>{var t;e&&(await (null==(t=navigator.clipboard)?void 0:t.writeText(e)),n.success("已复制路径"))},N=async(e,o)=>{E(e);try{"index"===o&&t((await (0,b.uc)(e)).assets),"openFile"===o&&await (0,b.oS)(e,"file"),"openDirectory"===o&&await (0,b.oS)(e,"directory"),"delete"===o&&t((await (0,b.JU)(e)).assets),"index"===o&&n.success("已加入知识库索引")}catch(e){n.error(e instanceof Error?e.message:"操作失败")}finally{E(null)}},P=n=>{var e;return"image"===n.type&&(null==(e=n.path)?void 0:e.startsWith("generatedDocuments/assets/"))?"/api/assets/generated/preview?id=".concat(encodeURIComponent(n.id)):void 0};return(0,o.jsxs)("div",{className:"page-shell",children:[(0,o.jsxs)("div",{className:"mb-4",children:[(0,o.jsx)("h1",{className:"text-2xl font-semibold",children:"生成资源"}),(0,o.jsx)("p",{className:"text-[var(--colorTextSecondary)]",children:"管理文档生成产生的本地资源。生成资源默认不进入知识库,可在后续操作中手动加入知识库。"})]}),(0,o.jsx)(s.A,{children:(0,o.jsx)(r.A,{dataSource:e,locale:{emptyText:(0,o.jsx)(d.A,{description:"暂无生成资源"})},renderItem:n=>(0,o.jsx)(r.A.Item,{actions:[n.path?(0,o.jsx)(p.Ay,{icon:(0,o.jsx)(f.A,{}),onClick:()=>{v(n.path)},children:"复制路径"},"copy"):null,n.path?(0,o.jsx)(p.Ay,{icon:(0,o.jsx)(m.A,{}),loading:a===n.id,onClick:()=>{N(n.id,"openFile")},children:"打开"},"open"):null,n.path?(0,o.jsx)(p.Ay,{icon:(0,o.jsx)(g.A,{}),loading:a===n.id,onClick:()=>{N(n.id,"openDirectory")},children:"目录"},"folder"):null,!n.indexed&&n.path?(0,o.jsx)(p.Ay,{icon:(0,o.jsx)(j.A,{}),loading:a===n.id,onClick:()=>{N(n.id,"index")},children:"加入知识库"},"index"):null,(0,o.jsx)(l.A,{title:"确认删除该生成资源记录?",onConfirm:()=>{N(n.id,"delete")},children:(0,o.jsx)(p.Ay,{danger:!0,icon:(0,o.jsx)(T.A,{}),loading:a===n.id,children:"删除"})},"delete")],children:(0,o.jsx)(r.A.Item.Meta,{avatar:P(n)?(0,o.jsx)(u.A,{width:64,height:40,src:P(n),alt:n.name,style:{objectFit:"cover"}}):"image"===n.type?(0,o.jsx)(x.A,{}):(0,o.jsx)(S.A,{}),title:(0,o.jsxs)(y.A,{wrap:!0,children:[(0,o.jsx)("span",{children:n.name}),(0,o.jsx)(h.A,{children:n.type}),(0,o.jsx)(h.A,{color:n.indexed?"success":"default",children:n.indexed?"已入库":"未入库"}),(0,o.jsx)(h.A,{color:"blue",children:n.role})]}),description:(0,o.jsxs)(y.A,{direction:"vertical",size:2,className:"w-full",children:[(0,o.jsxs)(C,{type:"secondary",children:["路径:",n.path||n.url||"—"]}),(0,o.jsxs)(C,{type:"secondary",children:["来源:",n.source," \xb7 使用文档:",n.usedByDocumentIds.length," \xb7 更新时间:",new Date(n.updatedAt).toLocaleString()]}),n.prompt&&(0,o.jsxs)(w,{ellipsis:{rows:2,expandable:!0},className:"!mb-0",children:["提示词:",n.prompt]})]})})})})})]})}},85015:(n,e,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/asset-library",function(){return t(63806)}])}},n=>{n.O(0,[260,167,382,628,271,700,174,183,292,951,881,636,593,792],()=>n(n.s=85015)),_N_E=n.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[409],{6578:(e,t,n)=>{"use strict";async function o(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function a(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function i(e){var t,n;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(a))}async function c(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function r(e,t){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function s(e,t,n){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function d(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function l(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await d(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function y(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function m(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return o("/api/kb/features")}async function S(e,t){var n,a,i,c,r;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!=(r=t.limit)?r:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&s.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(a=t.weights)?void 0:a.vector)!=null&&s.set("vectorWeight",String(t.weights.vector)),(null==t||null==(i=t.weights)?void 0:i.rewrite)!=null&&s.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(c=t.weights)?void 0:c.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function T(){return o("/api/prompt")}async function j(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function w(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function b(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(){return o("/api/documents/specs")}async function E(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(){return o("/api/documents/templates")}async function A(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function R(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function U(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function k(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J(){return o("/api/documents/generated")}async function I(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,t){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function L(){return o("/api/assets/generated")}async function _(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function z(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function B(e,t){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function M(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function H(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function W(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function F(){return o("/api/config/providers")}async function V(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function X(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function K(){return o("/api/config/models")}async function Q(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(){return o("/api/config/embedding")}async function Z(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function G(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function $(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function Y(){return o("/api/system/stats")}async function ee(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function et(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function en(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function eo(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ea(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ei(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ec(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>H,Bh:()=>ec,Dl:()=>P,E:()=>eo,EK:()=>E,ER:()=>N,FC:()=>Y,FV:()=>C,H1:()=>g,H7:()=>y,HC:()=>r,HT:()=>i,II:()=>q,JU:()=>_,NR:()=>b,OX:()=>k,PH:()=>en,QT:()=>u,Qx:()=>p,R1:()=>M,SJ:()=>h,UE:()=>W,VW:()=>x,W2:()=>S,X8:()=>f,Z3:()=>F,_m:()=>V,a6:()=>D,aP:()=>Q,bV:()=>U,bZ:()=>$,c1:()=>l,cQ:()=>J,dd:()=>Z,dg:()=>w,dw:()=>v,dx:()=>T,f$:()=>L,h0:()=>R,h1:()=>X,hc:()=>a,hn:()=>ee,l2:()=>A,lv:()=>j,mx:()=>O,oS:()=>B,p:()=>et,tn:()=>s,u6:()=>G,uc:()=>z,v7:()=>I,xC:()=>c,xq:()=>m,xw:()=>ea,zo:()=>ei,zr:()=>K})},19164:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/short-term",function(){return n(51162)}])},45551:(e,t,n)=>{"use strict";function o(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 a(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),o=Math.floor(n/60),a=Math.floor(o/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):o>0?"".concat(o,"h ago"):n>0?"".concat(n,"m ago"):"Just now":a>0?"".concat(a," 天前"):o>0?"".concat(o," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>r,fw:()=>a,z3:()=>o});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},c={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function r(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?c:i)[e])?t:e}},51162:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>E});var o=n(65321),a=n(97109),i=n(13014),c=n(17807),r=n(11702),s=n(85114),d=n(26171),l=n(33442),u=n(7576),p=n(68787),y=n(54849),m=n(59400),h=n(25258),f=n(63455),g=n(99650),x=n(58209),S=n(30486),T=n(83374),j=n(8383),w=n(26619),C=n(53998),b=n(6578),v=n(45551);let O={high:"red",medium:"orange",low:"default"};function E(){let e=(0,i.Vr)(),{message:t}=c.A.useApp(),[n,E]=(0,a.useState)(!0),[N,P]=(0,a.useState)([]),[A,R]=(0,a.useState)({count:0,totalBytes:0}),[U,k]=(0,a.useState)(""),[J,I]=(0,a.useState)(!1),[D,L]=(0,a.useState)(null),[_,z]=(0,a.useState)(""),[B,M]=(0,a.useState)(""),[H,W]=(0,a.useState)(!1),F=async n=>{E(!0);try{let[e,t]=await Promise.all([(0,b.hn)("short_term",n),(0,b.p)("short_term")]);P(e),R(t)}catch(n){t.error(e("common.error"))}finally{E(!1)}};(0,a.useEffect)(()=>{F()},[]);let V=async n=>{try{await (0,b.xw)(n),t.success(e("common.success")),await F(U)}catch(n){t.error(e("common.error"))}},X=async()=>{try{await (0,b.PH)("short_term"),t.success(e("common.success")),await F(U)}catch(n){t.error(e("common.error"))}},K=async()=>{try{await (0,b.E)("short_term"),t.success(e("common.success")),await F(U)}catch(n){t.error(e("common.error"))}},Q=async()=>{if(D&&_.trim()){W(!0);try{await (0,b.zo)(D.id,{content:_.trim(),context:B||void 0}),t.success(e("common.success")),I(!1),await F(U)}catch(n){t.error(e("common.error"))}finally{W(!1)}}},q=[{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,o.jsx)(r.A,{color:O[e]||"default",children:"high"===e?"高":"medium"===e?"中":"低"})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.source"),dataIndex:"source",width:120,ellipsis:!0},{title:e("context.updatedAt"),dataIndex:"updated_at",width:140,render:e=>e?new Date(e).toLocaleString():"-"},{title:e("common.edit"),width:100,render:(t,n)=>(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,o.jsx)(s.Ay,{size:"small",type:"text",icon:(0,o.jsx)(g.A,{}),onClick:()=>{L(n),z(n.content),M(""),I(!0)}}),(0,o.jsx)(d.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{V(n.id)},children:(0,o.jsx)(s.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(x.A,{})})})]})}];return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.shortTermContext")}),(0,o.jsx)("p",{className:"pageDesc",children:e("context.shortTermDesc")})]}),(0,o.jsxs)(l.A,{wrap:!0,children:[(0,o.jsx)(u.A,{prefix:(0,o.jsx)(S.A,{}),placeholder:e("common.search"),value:U,onChange:e=>k(e.target.value),onPressEnter:()=>{F(U)},allowClear:!0,style:{width:240}}),(0,o.jsx)(s.Ay,{icon:(0,o.jsx)(T.A,{}),onClick:()=>{X()},children:"压缩"}),(0,o.jsx)(d.A,{title:"确定清除短期上下文吗?",onConfirm:()=>{K()},children:(0,o.jsx)(s.Ay,{danger:!0,icon:(0,o.jsx)(j.A,{}),children:"清除"})})]})]}),(0,o.jsx)(p.A,{size:"small",children:(0,o.jsx)(y.A,{title:"总上下文大小",value:(0,v.z3)(A.totalBytes),prefix:(0,o.jsx)(w.A,{}),suffix:" / ".concat(A.count," 条")})}),(0,o.jsxs)(p.A,{size:"small",children:[(0,o.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(C.A,{})," ",e("context.shortTermSource")]}),(0,o.jsx)(m.A,{rowKey:"id",columns:q,dataSource:N,loading:n,size:"small",pagination:{pageSize:15}})]}),(0,o.jsx)(h.A,{maskClosable:!1,title:e("models.editModel"),open:J,onCancel:()=>I(!1),onOk:()=>{Q()},confirmLoading:H,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("context.content"),children:(0,o.jsx)(u.A.TextArea,{rows:6,value:_,onChange:e=>z(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(u.A,{value:B,onChange:e=>M(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}}},e=>{e.O(0,[260,167,382,628,271,576,700,174,183,985,232,400,257,636,593,792],()=>e(e.s=19164)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[623],{2256:(e,n,t)=>{"use strict";t.d(n,{A:()=>o});let o=t(25341).A},6578:(e,n,t)=>{"use strict";async function o(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function r(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(n))}async function i(e){var n,t;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!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&r.set("limit",String(null!=(t=e.limit)?t:50)),o("/api/kb/files?".concat(r))}async function s(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),o("/api/kb/files/detail?".concat(t))}async function a(e,n){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function l(e,n,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function c(e){return new Promise((n,t)=>{let o=new FileReader;o.onload=()=>{let e=o.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},o.onerror=t,o.readAsDataURL(e)})}async function d(e,n,t){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await c(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function p(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n))}async function m(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function y(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function h(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return o("/api/kb/features")}async function j(e,n){var t,r,i,s,a;let l=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&l.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&l.set("category",n.category),(null==n?void 0:n.limit)&&l.set("limit",String(null!=(a=n.limit)?a:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&l.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(r=n.weights)?void 0:r.vector)!=null&&l.set("vectorWeight",String(n.weights.vector)),(null==n||null==(i=n.weights)?void 0:i.rewrite)!=null&&l.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(s=n.weights)?void 0:s.hybridBonus)!=null&&l.set("hybridBonus",String(n.weights.hybridBonus)),o("/api/kb/search?".concat(l))}async function b(){return o("/api/prompt")}async function A(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function v(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function I(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function S(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(){return o("/api/documents/specs")}async function w(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(){return o("/api/documents/templates")}async function N(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function O(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(){return o("/api/documents/generated")}async function U(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,n){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function J(){return o("/api/assets/generated")}async function F(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function L(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function H(e,n){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function _(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(e,n){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function z(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw Error(await n.text());return n.blob()}async function B(){return o("/api/config/providers")}async function V(e,n){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function M(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function Q(){return o("/api/config/models")}async function W(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function X(){return o("/api/config/embedding")}async function G(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function K(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function Z(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function Y(){return o("/api/system/stats")}async function ee(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function en(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function et(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function eo(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function er(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ei(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function es(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>q,Bh:()=>es,Dl:()=>R,E:()=>eo,EK:()=>w,ER:()=>E,FC:()=>Y,FV:()=>T,H1:()=>g,H7:()=>m,HC:()=>a,HT:()=>i,II:()=>X,JU:()=>F,NR:()=>I,OX:()=>O,PH:()=>et,QT:()=>p,Qx:()=>u,R1:()=>_,SJ:()=>h,UE:()=>z,VW:()=>x,W2:()=>j,X8:()=>f,Z3:()=>B,_m:()=>V,a6:()=>D,aP:()=>W,bV:()=>$,bZ:()=>Z,c1:()=>d,cQ:()=>P,dd:()=>G,dg:()=>v,dw:()=>S,dx:()=>b,f$:()=>J,h0:()=>k,h1:()=>M,hc:()=>r,hn:()=>ee,l2:()=>N,lv:()=>A,mx:()=>C,oS:()=>H,p:()=>en,tn:()=>l,u6:()=>K,uc:()=>L,v7:()=>U,xC:()=>s,xq:()=>y,xw:()=>er,zo:()=>ei,zr:()=>Q})},23507:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return t(59889)}])},38770:(e,n,t)=>{"use strict";t.d(n,{A:()=>o});let o=t(51916).A},59889:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>C});var o=t(65321),r=t(97109),i=t(17807),s=t(63455),a=t(38332),l=t(84253),c=t(85114),d=t(26171),p=t(33442),u=t(11702),m=t(68787),y=t(85493),h=t(2256),f=t(38770),g=t(25258),x=t(57271),j=t(7576),b=t(58569),A=t(99650),v=t(58209),T=t(54746),I=t(6578),S=t(13014);function C(){let e=(0,S.Vr)(),{message:n}=i.A.useApp(),[t]=s.A.useForm(),[C]=s.A.useForm(),[w,E]=(0,r.useState)([]),[R,N]=(0,r.useState)([]),[k,$]=(0,r.useState)([]),[O,P]=(0,r.useState)([]),[U,D]=(0,r.useState)(!1),[J,F]=(0,r.useState)(!1),L=async()=>{let[e,n,t]=await Promise.all([(0,I.lv)(),(0,I.HT)(),(0,I.dx)()]);E(e.roles),N(e.configs),$(n.files),P(t)};(0,r.useEffect)(()=>{L().catch(()=>n.error(e("common.error")))},[n,e]);let H=w.filter(e=>"file"===e.type),_=w.filter(e=>"prompt"===e.type),q=async()=>{try{let o=await t.validateFields(),r=await (0,I.dg)(o);E(r.roles),N(r.configs),D(!1),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},z=async()=>{try{let t=await C.validateFields(),o=e=>(null!=e?e:[]).map((e,n)=>{var t;return{roleId:e.roleId,order:Number(null!=(t=e.order)?t:n)}}),r=await (0,I.NR)({...t,fileRoles:o(t.fileRoles),promptRoles:o(t.promptRoles)});E(r.roles),N(r.configs),F(!1),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},B=async e=>{let n=await (0,I.FV)(e.type,e.id);E(n.roles),N(n.configs)},V=async e=>{let n=await (0,I.dw)(e);E(n.roles),N(n.configs)},M=function(e){var n;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";t.setFieldsValue(e?{...e,resourceIds:(null==(n=e.resourceIds)?void 0:n.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]}:{id:"role-".concat(Date.now()),name:"",description:"",type:o,resourceIds:[],executionType:"prompt"===o?"reference":void 0,processingType:"file"===o?"reference":void 0}),D(!0)},Q=e=>{C.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[]}),F(!0)},W=n=>(0,o.jsx)(a.A,{dataSource:w.filter(e=>e.type===n),locale:{emptyText:(0,o.jsx)(l.A,{description:e("common.noData")})},renderItem:n=>{var t;return(0,o.jsx)(a.A.Item,{actions:[(0,o.jsx)(c.Ay,{type:"text",icon:(0,o.jsx)(A.A,{}),onClick:()=>M(n)},"edit"),(0,o.jsx)(d.A,{title:e("common.confirm"),disabled:n.builtIn,onConfirm:()=>{B(n)},children:(0,o.jsx)(c.Ay,{type:"text",danger:!0,icon:(0,o.jsx)(v.A,{}),disabled:n.builtIn})},"delete")],children:(0,o.jsx)(a.A.Item.Meta,{title:(0,o.jsxs)(p.A,{children:[(0,o.jsx)("span",{children:n.name}),n.builtIn&&(0,o.jsx)(u.A,{color:"gold",children:e("documents.builtIn")}),(0,o.jsx)(u.A,{children:n.id})]}),description:(0,o.jsxs)(p.A,{direction:"vertical",children:[(0,o.jsx)("span",{children:n.description}),(0,o.jsx)("span",{children:"prompt"===n.type?n.executionType:n.processingType}),(0,o.jsx)("span",{children:((null==(t=n.resourceIds)?void 0:t.length)?n.resourceIds:n.resourceId?[n.resourceId]:[]).join("、")||"-"})]})})})}});return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsx)(m.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,o.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle mb-1",children:e("roles.title")}),(0,o.jsx)("p",{className:"pageDesc mb-0",children:e("roles.description")})]}),(0,o.jsxs)(p.A,{children:[(0,o.jsx)(c.Ay,{icon:(0,o.jsx)(T.A,{}),onClick:()=>M(void 0,"file"),children:e("roles.newFileRole")}),(0,o.jsx)(c.Ay,{icon:(0,o.jsx)(T.A,{}),onClick:()=>M(void 0,"prompt"),children:e("roles.newPromptRole")}),(0,o.jsx)(c.Ay,{type:"primary",icon:(0,o.jsx)(T.A,{}),onClick:()=>Q(),children:e("roles.newConfig")})]})]})}),(0,o.jsx)(y.A,{type:"info",showIcon:!0,message:e("roles.plainGuideTitle"),description:e("roles.plainGuideDesc")}),(0,o.jsxs)(h.A,{gutter:[16,16],children:[(0,o.jsx)(f.A,{xs:24,lg:12,children:(0,o.jsx)(m.A,{title:e("roles.fileRoles"),children:W("file")})}),(0,o.jsx)(f.A,{xs:24,lg:12,children:(0,o.jsx)(m.A,{title:e("roles.promptRoles"),children:W("prompt")})}),(0,o.jsx)(f.A,{xs:24,children:(0,o.jsx)(m.A,{title:e("roles.configs"),children:(0,o.jsx)(a.A,{dataSource:R,locale:{emptyText:(0,o.jsx)(l.A,{description:e("common.noData")})},renderItem:n=>(0,o.jsx)(a.A.Item,{actions:[(0,o.jsx)(c.Ay,{type:"text",icon:(0,o.jsx)(A.A,{}),onClick:()=>Q(n)},"edit"),(0,o.jsx)(d.A,{title:e("common.confirm"),onConfirm:()=>{V(n.id)},children:(0,o.jsx)(c.Ay,{type:"text",danger:!0,icon:(0,o.jsx)(v.A,{})})},"delete")],children:(0,o.jsx)(a.A.Item.Meta,{title:(0,o.jsxs)(p.A,{children:[n.name,(0,o.jsx)(u.A,{children:n.id})]}),description:"".concat(e("roles.fileRoles"),": ").concat(n.fileRoles.length," \xb7 ").concat(e("roles.promptRoles"),": ").concat(n.promptRoles.length)})})})})})]}),(0,o.jsx)(g.A,{maskClosable:!1,title:e("roles.roleEditor"),open:U,onOk:()=>{q()},onCancel:()=>D(!1),centered:!0,okText:e("common.save"),children:(0,o.jsxs)(s.A,{form:t,layout:"vertical",children:[(0,o.jsx)(s.A.Item,{name:"type",label:e("roles.roleType"),rules:[{required:!0}],children:(0,o.jsx)(x.A,{options:[{label:e("roles.fileRole"),value:"file"},{label:e("roles.promptRole"),value:"prompt"}]})}),(0,o.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(j.A,{disabled:!0})}),(0,o.jsx)(s.A.Item,{name:"name",label:e("roles.roleName"),rules:[{required:!0}],children:(0,o.jsx)(j.A,{})}),(0,o.jsx)(s.A.Item,{name:"description",label:e("roles.roleDescription"),children:(0,o.jsx)(j.A,{})}),(0,o.jsx)(s.A.Item,{noStyle:!0,shouldUpdate:(e,n)=>e.type!==n.type,children:n=>{let{getFieldValue:t}=n;return"prompt"===t("type")?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.A.Item,{name:"executionType",label:e("roles.executionType"),rules:[{required:!0}],extra:e("roles.executionTypeHelp"),children:(0,o.jsx)(x.A,{options:[{label:e("roles.factExtraction"),value:"fact_extraction"},{label:e("roles.chapterGeneration"),value:"chapter_generation"},{label:e("roles.validation"),value:"validation"},{label:e("roles.formatting"),value:"formatting"},{label:e("roles.reference"),value:"reference"}]})}),(0,o.jsx)(s.A.Item,{name:"resourceIds",label:e("roles.bindPrompt"),extra:e("roles.multiBindPromptHelp"),children:(0,o.jsx)(x.A,{mode:"multiple",showSearch:!0,options:O.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.A.Item,{name:"processingType",label:e("roles.processingType"),rules:[{required:!0}],extra:e("roles.processingTypeHelp"),children:(0,o.jsx)(x.A,{options:[{label:e("roles.ruleFile"),value:"rule"},{label:e("roles.projectFactFile"),value:"project_fact"},{label:e("roles.tableFile"),value:"table"},{label:e("roles.drawingFile"),value:"drawing"},{label:e("roles.specificationFile"),value:"specification"},{label:e("roles.reference"),value:"reference"}]})}),(0,o.jsx)(s.A.Item,{name:"resourceIds",label:e("roles.bindFile"),extra:e("roles.multiBindFileHelp"),children:(0,o.jsx)(x.A,{mode:"multiple",showSearch:!0,options:k.map(e=>({label:e.relativePath,value:e.relativePath}))})})]})}})]})}),(0,o.jsx)(g.A,{maskClosable:!1,title:e("roles.configEditor"),open:J,onOk:()=>{z()},onCancel:()=>F(!1),width:820,centered:!0,okText:e("common.save"),children:(0,o.jsxs)(s.A,{form:C,layout:"vertical",children:[(0,o.jsxs)(h.A,{gutter:12,children:[(0,o.jsx)(f.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(j.A,{disabled:!0})})}),(0,o.jsx)(f.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"name",label:e("roles.configName"),rules:[{required:!0}],children:(0,o.jsx)(j.A,{})})}),(0,o.jsx)(f.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"description",label:e("roles.configDescription"),children:(0,o.jsx)(j.A,{})})})]}),(0,o.jsx)(b.A,{items:[{key:"file",label:e("roles.fileRoles"),children:(0,o.jsx)(s.A.List,{name:"fileRoles",children:(n,t)=>{let{add:r,remove:i}=t;return(0,o.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[n.map((e,n)=>(0,o.jsxs)(h.A,{gutter:8,children:[(0,o.jsx)(f.A,{span:16,children:(0,o.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],children:(0,o.jsx)(x.A,{options:H.map(e=>({label:e.name,value:e.id}))})})}),(0,o.jsx)(f.A,{span:6,children:(0,o.jsx)(s.A.Item,{name:[e.name,"order"],initialValue:n,children:(0,o.jsx)(j.A,{type:"number"})})}),(0,o.jsx)(f.A,{span:2,children:(0,o.jsx)(c.Ay,{danger:!0,onClick:()=>i(e.name),children:"-"})})]},e.key)),(0,o.jsx)(c.Ay,{onClick:()=>r({order:n.length}),children:e("roles.addRole")})]})}})},{key:"prompt",label:e("roles.promptRoles"),children:(0,o.jsx)(s.A.List,{name:"promptRoles",children:(n,t)=>{let{add:r,remove:i}=t;return(0,o.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[n.map((e,n)=>(0,o.jsxs)(h.A,{gutter:8,children:[(0,o.jsx)(f.A,{span:16,children:(0,o.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],children:(0,o.jsx)(x.A,{options:_.map(e=>({label:e.name,value:e.id}))})})}),(0,o.jsx)(f.A,{span:6,children:(0,o.jsx)(s.A.Item,{name:[e.name,"order"],initialValue:n,children:(0,o.jsx)(j.A,{type:"number"})})}),(0,o.jsx)(f.A,{span:2,children:(0,o.jsx)(c.Ay,{danger:!0,onClick:()=>i(e.name),children:"-"})})]},e.key)),(0,o.jsx)(c.Ay,{onClick:()=>r({order:n.length}),children:e("roles.addRole")})]})}})}]})]})})]})}},85493:(e,n,t)=>{"use strict";t.d(n,{A:()=>N});var o=t(97109),r=t(59188),i=t(4216),s=t(45042),a=t(97137),l=t(62188),c=t(67189),d=t(42644),p=t(3638),u=t(92162),m=t(26047),y=t(74567),h=t(15561),f=t(7961),g=t(10540);let x=(e,n,t)=>({background:e,[`${t}-icon`]:{color:n}}),j=(0,g.OF)("Alert",e=>[(e=>{let{componentCls:n,motionDurationSlow:t,marginXS:o,marginSM:r,fontSize:i,fontSizeLG:s,lineHeight:a,borderRadiusLG:l,motionEaseInOutCirc:c,withDescriptionIconSize:d,colorText:p,colorTextHeading:u,withDescriptionPadding:m,defaultPadding:y,lineWidth:g,lineType:x,colorSuccessBorder:j,colorWarningBorder:b,colorErrorBorder:A,colorInfoBorder:v}=e;return{[n]:{...(0,f.dF)(e),position:"relative",display:"flex",alignItems:"center",padding:y,wordWrap:"break-word",borderRadius:l,borderWidth:(0,h.zA)(g),borderStyle:x,[`&${n}-success`]:{borderColor:j},[`&${n}-info`]:{borderColor:v},[`&${n}-warning`]:{borderColor:b},[`&${n}-error`]:{borderColor:A},[`&${n}-filled`]:{borderColor:"transparent"},[`&${n}-rtl`]:{direction:"rtl"},[`${n}-section`]:{flex:1,minWidth:0},[`${n}-icon`]:{marginInlineEnd:o,lineHeight:0},"&-description":{display:"none",fontSize:i,lineHeight:a},"&-title":{color:u},[`&${n}-motion-leave`]:{overflow:"hidden",opacity:1,transition:["max-height","opacity","padding-top","padding-bottom","margin-bottom"].map(e=>`${e} ${t} ${c}`).join(", ")},[`&${n}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0},[`&${n}-with-description`]:{alignItems:"flex-start",padding:m,[`${n}-icon`]:{marginInlineEnd:r,fontSize:d,lineHeight:0},[`${n}-title`]:{display:"block",marginBottom:o,color:u,fontSize:s},[`${n}-description`]:{display:"block",color:p}},[`&${n}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}}})(e),(e=>{let{componentCls:n,colorSuccess:t,colorSuccessBg:o,colorWarning:r,colorWarningBg:i,colorError:s,colorErrorBg:a,colorInfo:l,colorInfoBg:c}=e;return{[n]:{"&-success":x(o,t,n),"&-info":x(c,l,n),"&-warning":x(i,r,n),"&-error":{...x(a,s,n),[`${n}-description > pre`]:{margin:0,padding:0}}}}})(e),(e=>{let{componentCls:n,iconCls:t,motionDurationMid:o,marginXS:r,fontSizeIcon:i,colorIcon:s,colorIconHover:a}=e;return{[n]:{[`${n}-actions`]:{marginInlineStart:r},[`${n}-close-icon`]:{marginInlineStart:r,padding:0,overflow:"hidden",fontSize:i,lineHeight:(0,h.zA)(i),backgroundColor:"transparent",border:"none",cursor:"pointer",...(0,f.K8)(e),[`${t}-close`]:{color:s,transition:`color ${o}`,"&:hover":{color:a}}},"&-close-text":{color:s,transition:`color ${o}`,"&:hover":{color:a}}}}})(e)],e=>({withDescriptionIconSize:e.fontSizeHeading3,defaultPadding:`${e.paddingContentVerticalSM}px 12px`,withDescriptionPadding:`${e.paddingMD}px ${e.paddingContentHorizontalLG}px`})),b=e=>{let{icon:n,type:t,className:s,style:c,successIcon:d,infoIcon:p,warningIcon:u,errorIcon:m}=e,y={success:d??o.createElement(r.A,null),info:p??o.createElement(l.A,null),error:m??o.createElement(i.A,null),warning:u??o.createElement(a.A,null)};return o.createElement("span",{className:s,style:c},n??y[t])},A=e=>{let{isClosable:n,prefixCls:t,closeIcon:r,handleClose:i,ariaProps:a,className:l,style:c}=e,d=!0===r||void 0===r?o.createElement(s.A,null):r;return n?o.createElement("button",{type:"button",onClick:i,className:(0,p.$)(`${t}-close-icon`,l),tabIndex:0,style:c,...a},d):null},v=o.forwardRef((e,n)=>{let{description:t,prefixCls:r,message:i,title:s,banner:a,className:l,rootClassName:h,style:f,onMouseEnter:g,onMouseLeave:x,onClick:v,afterClose:T,showIcon:I,closable:S,closeText:C,closeIcon:w,action:E,id:R,styles:N,classNames:k,...$}=e,O=s??i,[P,U]=o.useState(!1),D=o.useRef(null);o.useImperativeHandle(n,()=>({nativeElement:D.current}));let{getPrefixCls:J,direction:F,variant:L,closable:H,closeIcon:_,className:q,style:z,classNames:B,styles:V,successIcon:M,infoIcon:Q,warningIcon:W,errorIcon:X}=(0,y.TP)("alert"),G=J("alert",r),[K,Z]=j(G),{onClose:Y,afterClose:ee}=(0,m.Qd)(S)?S:{},en=n=>{U(!0),(Y??e.onClose)?.(n)},et=o.useMemo(()=>void 0!==e.type?e.type:a?"warning":"info",[e.type,a]),eo=e.variant??L??"outlined",er=o.useMemo(()=>!!(0,m.Qd)(S)&&!!S.closeIcon||!!C||("boolean"==typeof S?S:!!(!1!==w&&(0,m.R)(w))||!!H),[C,w,S,H]),ei=!!a&&void 0===I||I,es={...e,prefixCls:G,variant:eo,type:et,showIcon:ei,closable:er},ea=(0,u.XT)(z),el=(0,u.XT)(f),[ec,ed]=(0,u.AV)([B,k],[V,ea,N,el],{props:es}),ep=(0,p.$)(G,`${G}-${et}`,`${G}-${eo}`,{[`${G}-with-description`]:!!t,[`${G}-no-icon`]:!ei,[`${G}-banner`]:!!a,[`${G}-rtl`]:"rtl"===F},q,l,h,ec.root,Z,K),eu=(0,d.KE)($,{aria:!0,data:!0}),em=o.useMemo(()=>(0,m.Qd)(S)&&S.closeIcon?S.closeIcon:C||(void 0!==w?w:(0,m.Qd)(H)&&H.closeIcon?H.closeIcon:_),[w,S,H,C,_]),ey=o.useMemo(()=>{let e=S??H;return(0,m.Qd)(e)?(0,d.KE)(e,{data:!0,aria:!0}):{}},[S,H]);return o.createElement(c.Ay,{visible:!P,motionName:`${G}-motion`,motionAppear:!1,motionEnter:!1,onLeaveStart:e=>({maxHeight:e.offsetHeight}),onLeaveEnd:ee??T},({className:n,style:r},i)=>o.createElement("div",{id:R,ref:(0,d.K4)(D,i),"data-show":!P,className:(0,p.$)(ep,n),style:{...ed.root,...r},onMouseEnter:g,onMouseLeave:x,onClick:v,role:"alert",...eu},ei?o.createElement(b,{className:(0,p.$)(`${G}-icon`,ec.icon),style:ed.icon,description:t,icon:e.icon,prefixCls:G,type:et,successIcon:M,infoIcon:Q,warningIcon:W,errorIcon:X}):null,o.createElement("div",{className:(0,p.$)(`${G}-section`,ec.section),style:ed.section},O?o.createElement("div",{className:(0,p.$)(`${G}-title`,ec.title),style:ed.title},O):null,t?o.createElement("div",{className:(0,p.$)(`${G}-description`,ec.description),style:ed.description},t):null),E?o.createElement("div",{className:(0,p.$)(`${G}-actions`,ec.actions),style:ed.actions},E):null,o.createElement(A,{className:ec.close,style:ed.close,isClosable:er,prefixCls:G,closeIcon:em,handleClose:en,ariaProps:ey})))});var T=t(41113),I=t(49939),S=t(90218),C=t(13076),w=t(83784),E=t(15472);let R=function(e){function n(){var e,t,o;return(0,T.A)(this,n),t=n,o=arguments,t=(0,S.A)(t),(e=(0,w.A)(this,(0,C.A)()?Reflect.construct(t,o||[],(0,S.A)(this).constructor):t.apply(this,o))).state={error:void 0,info:{}},e}return(0,E.A)(n,e),(0,I.A)(n,[{key:"componentDidCatch",value:function(e,n){this.setState({error:e,info:n})}},{key:"render",value:function(){let{message:e,title:n,description:t,id:r,children:i}=this.props,{error:s,info:a}=this.state,l=n??e,c=a?.componentStack||null,d=(0,m.R)(l)?l:s?.toString(),p=(0,m.R)(t)?t:c;return s?o.createElement(v,{id:r,type:"error",title:d,description:o.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},p)}):i}}])}(o.PureComponent);v.ErrorBoundary=R;let N=v}},e=>{e.O(0,[260,167,382,628,271,576,700,174,183,232,951,636,593,792],()=>e(e.s=23507)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[580],{2256:(e,n,t)=>{"use strict";t.d(n,{A:()=>a});let a=t(25341).A},6578:(e,n,t)=>{"use strict";async function a(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function i(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(n))}async function c(e){var n,t;let i=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&i.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&i.set("category",e.category),(null==e?void 0:e.page)&&i.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&i.set("limit",String(null!=(t=e.limit)?t:50)),a("/api/kb/files?".concat(i))}async function s(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),a("/api/kb/files/detail?".concat(t))}async function r(e,n){return a("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function o(e,n,t){return a("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function l(e){return new Promise((n,t)=>{let a=new FileReader;a.onload=()=>{let e=a.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},a.onerror=t,a.readAsDataURL(e)})}async function d(e,n,t){return a("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function p(e){return a("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),a("/api/kb/operations?".concat(n))}async function m(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),a("/api/kb/operations?".concat(n),{method:"DELETE"})}async function h(e,n){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function y(e,n){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function g(e){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function f(e){return a("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return a("/api/kb/features")}async function j(e,n){var t,i,c,s,r;let o=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&o.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&o.set("category",n.category),(null==n?void 0:n.limit)&&o.set("limit",String(null!=(r=n.limit)?r:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&o.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(i=n.weights)?void 0:i.vector)!=null&&o.set("vectorWeight",String(n.weights.vector)),(null==n||null==(c=n.weights)?void 0:c.rewrite)!=null&&o.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(s=n.weights)?void 0:s.hybridBonus)!=null&&o.set("hybridBonus",String(n.weights.hybridBonus)),a("/api/kb/search?".concat(o))}async function b(){return a("/api/prompt")}async function A(e){return a("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function I(e){return a("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function S(e,n){return a("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function w(e){return a("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(e){return a("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function v(){return a("/api/documents/specs")}async function k(e){return a("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return a("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return a("/api/documents/templates")}async function C(e){return a("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return a("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(e){return a("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function R(e){return a("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(){return a("/api/documents/generated")}async function q(e){return a("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,n){return a("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function J(){return a("/api/assets/generated")}async function L(e){return a("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function U(e){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function _(e,n){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function H(e){return a("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function z(e,n){return a("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function F(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw Error(await n.text());return n.blob()}async function M(){return a("/api/config/providers")}async function V(e,n){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function X(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function W(){return a("/api/config/models")}async function B(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function G(){return a("/api/config/embedding")}async function K(e){return a("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Q(){return a("/api/config/embedding/healthCheck",{method:"POST"})}async function Z(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function Y(){return a("/api/system/stats")}async function ee(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return a("/api/context".concat(t))}async function en(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function et(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ea(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ei(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ec(e,n){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function es(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>z,Bh:()=>es,Dl:()=>E,E:()=>ea,EK:()=>k,ER:()=>T,FC:()=>Y,FV:()=>S,H1:()=>f,H7:()=>m,HC:()=>r,HT:()=>c,II:()=>G,JU:()=>L,NR:()=>w,OX:()=>R,PH:()=>et,QT:()=>p,Qx:()=>u,R1:()=>H,SJ:()=>y,UE:()=>F,VW:()=>x,W2:()=>j,X8:()=>g,Z3:()=>M,_m:()=>V,a6:()=>D,aP:()=>B,bV:()=>O,bZ:()=>Z,c1:()=>d,cQ:()=>P,dd:()=>K,dg:()=>I,dw:()=>$,dx:()=>b,f$:()=>J,h0:()=>N,h1:()=>X,hc:()=>i,hn:()=>ee,l2:()=>C,lv:()=>A,mx:()=>v,oS:()=>_,p:()=>en,tn:()=>o,u6:()=>Q,uc:()=>U,v7:()=>q,xC:()=>s,xq:()=>h,xw:()=>ei,zo:()=>ec,zr:()=>W})},38770:(e,n,t)=>{"use strict";t.d(n,{A:()=>a});let a=t(51916).A},51533:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>K});var a=t(65321),i=t(97109),c=t(17807),s=t(63455),r=t(68787),o=t(85114),l=t(85493),d=t(38332),p=t(84253),u=t(26171),m=t(33442),h=t(11702),y=t(25258),g=t(2256),f=t(38770),x=t(7576),j=t(58569),b=t(57271),A=t(83914),I=t(3638),S=t(32565),w=t(99452);function $(){return($=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let v=i.forwardRef(({prefixCls:e="rc-switch",className:n,checked:t,defaultChecked:a,disabled:c,loadingIcon:s,checkedChildren:r,unCheckedChildren:o,onClick:l,onChange:d,onKeyDown:p,styles:u,classNames:m,...h},y)=>{let[g,f]=(0,S.A)(a??!1,t);function x(e,n){let t=g;return c||(f(t=e),d?.(t,n)),t}let j=(0,I.$)(e,n,{[`${e}-checked`]:g,[`${e}-disabled`]:c});return i.createElement("button",$({},h,{type:"button",role:"switch","aria-checked":g,disabled:c,className:j,ref:y,onKeyDown:function(e){e.which===w.A.LEFT?x(!1,e):e.which===w.A.RIGHT&&x(!0,e),p?.(e)},onClick:function(e){let n=x(!g,e);l?.(n,e)}}),s,i.createElement("span",{className:`${e}-inner`},i.createElement("span",{className:(0,I.$)(`${e}-inner-checked`,m?.content),style:u?.content},r),i.createElement("span",{className:(0,I.$)(`${e}-inner-unchecked`,m?.content),style:u?.content},o)))});v.displayName="Switch";var k=t(42644),T=t(92162),E=t(38862),C=t(74567),N=t(6831),O=t(27273),R=t(15561),P=t(47252),q=t(7961),D=t(16666),J=t(10540),L=t(28403);let U=(0,J.OF)("Switch",e=>{let n=(0,L.oX)(e,{switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchLoadingIconSize:e.calc(e.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[(e=>{let{componentCls:n,trackHeight:t,trackMinWidth:a}=e;return{[n]:{...(0,q.dF)(e),position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:a,height:t,lineHeight:(0,R.zA)(t),verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",...(0,D.V)(),[`&:hover:not(${n}-disabled)`]:{background:e.colorTextTertiary},...(0,q.K8)(e),[`&${n}-checked`]:{background:e.switchColor,[`&:hover:not(${n}-disabled)`]:{background:e.colorPrimaryHover}},[`&${n}-loading, &${n}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${n}-rtl`]:{direction:"rtl"}}}})(n),(e=>{let{componentCls:n,trackHeight:t,trackPadding:a,innerMinMargin:i,innerMaxMargin:c,handleSize:s,switchDuration:r,calc:o}=e,l=`${n}-inner`,d=(0,R.zA)(o(s).add(o(a).mul(2)).equal()),p=(0,R.zA)(o(c).mul(2).equal());return{[n]:{[l]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:c,paddingInlineEnd:i,transition:["padding-inline-start","padding-inline-end"].map(e=>`${e} ${r} ease-in-out`).join(", "),...(0,D.V)(),[`${l}-checked, ${l}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,pointerEvents:"none",minHeight:t,transition:["margin-inline-start","margin-inline-end"].map(e=>`${e} ${r} ease-in-out`).join(", "),...(0,D.V)()},[`${l}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${p})`,marginInlineEnd:`calc(100% - ${d} + ${p})`},[`${l}-unchecked`]:{marginTop:o(t).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${n}-checked ${l}`]:{paddingInlineStart:i,paddingInlineEnd:c,[`${l}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${l}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${p})`,marginInlineEnd:`calc(-100% + ${d} - ${p})`}},[`&:not(${n}-disabled):active`]:{[`&:not(${n}-checked) ${l}`]:{[`${l}-unchecked`]:{marginInlineStart:o(a).mul(2).equal(),marginInlineEnd:o(a).mul(-1).mul(2).equal()}},[`&${n}-checked ${l}`]:{[`${l}-checked`]:{marginInlineStart:o(a).mul(-1).mul(2).equal(),marginInlineEnd:o(a).mul(2).equal()}}}}}})(n),(e=>{let{componentCls:n,trackPadding:t,handleBg:a,handleShadow:i,handleSize:c,calc:s}=e,r=`${n}-handle`;return{[n]:{[r]:{position:"absolute",top:t,insetInlineStart:t,width:c,height:c,transition:`all ${e.switchDuration} ease-in-out`,...(0,D.V)(),"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:a,borderRadius:s(c).div(2).equal(),boxShadow:i,transition:`all ${e.switchDuration} ease-in-out`,content:'""',...(0,D.V)()}},[`&${n}-checked ${r}`]:{insetInlineStart:`calc(100% - ${(0,R.zA)(s(c).add(t).equal())})`},[`&:not(${n}-disabled):active`]:{[`${r}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${n}-checked ${r}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}})(n),(e=>{let{componentCls:n,handleSize:t,calc:a}=e;return{[n]:{[`${n}-loading-icon${e.iconCls}`]:{position:"relative",top:a(a(t).sub(e.fontSize)).div(2).equal(),color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${n}-checked ${n}-loading-icon`]:{color:e.switchColor}}}})(n),(e=>{let{componentCls:n,trackHeightSM:t,trackPadding:a,trackMinWidthSM:i,innerMinMarginSM:c,innerMaxMarginSM:s,handleSizeSM:r,calc:o}=e,l=`${n}-inner`,d=(0,R.zA)(o(r).add(o(a).mul(2)).equal()),p=(0,R.zA)(o(s).mul(2).equal());return{[n]:{[`&${n}-small`]:{minWidth:i,height:t,lineHeight:(0,R.zA)(t),[`${n}-inner`]:{paddingInlineStart:s,paddingInlineEnd:c,[`${l}-checked, ${l}-unchecked`]:{minHeight:t},[`${l}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${p})`,marginInlineEnd:`calc(100% - ${d} + ${p})`},[`${l}-unchecked`]:{marginTop:o(t).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${n}-handle`]:{width:r,height:r},[`${n}-loading-icon`]:{top:o(o(r).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${n}-checked`]:{[`${n}-inner`]:{paddingInlineStart:c,paddingInlineEnd:s,[`${l}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${l}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${p})`,marginInlineEnd:`calc(-100% + ${d} - ${p})`}},[`${n}-handle`]:{insetInlineStart:`calc(100% - ${(0,R.zA)(o(r).add(a).equal())})`}},[`&:not(${n}-disabled):active`]:{[`&:not(${n}-checked) ${l}`]:{[`${l}-unchecked`]:{marginInlineStart:o(e.marginXXS).div(2).equal(),marginInlineEnd:o(e.marginXXS).mul(-1).div(2).equal()}},[`&${n}-checked ${l}`]:{[`${l}-checked`]:{marginInlineStart:o(e.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:o(e.marginXXS).div(2).equal()}}}}}}})(n)]},e=>{let{fontSize:n,lineHeight:t,controlHeight:a,colorWhite:i}=e,c=n*t,s=a/2,r=c-4,o=s-4;return{trackHeight:c,trackHeightSM:s,trackMinWidth:2*r+8,trackMinWidthSM:2*o+4,trackPadding:2,handleBg:i,handleSize:r,handleSizeSM:o,handleShadow:`0 2px 4px 0 ${new P.Y("#00230b").setA(.2).toRgbString()}`,innerMinMargin:r/2,innerMaxMargin:r+2+4,innerMinMarginSM:o/2,innerMaxMarginSM:o+2+4}}),_=i.forwardRef((e,n)=>{let{prefixCls:t,size:a,disabled:c,loading:s,className:r,rootClassName:o,style:l,checked:d,value:p,defaultChecked:u,defaultValue:m,onChange:h,styles:y,classNames:g,...f}=e,[x,j]=(0,k.PW)(u??m??!1,d??p),{getPrefixCls:b,direction:S,className:w,style:$,classNames:R,styles:P}=(0,C.TP)("switch"),q=i.useContext(N.A),D=(c??q)||s,J=b("switch",t),[L,_]=U(J),H=(0,O.A)(a),z={...e,size:H,disabled:D},F=(0,T.XT)($),M=(0,T.XT)(l),[V,X]=(0,T.AV)([R,g],[P,F,y,M],{props:z}),W=i.createElement("div",{className:(0,I.$)(`${J}-handle`,V.indicator),style:X.indicator},s&&i.createElement(A.A,{className:`${J}-loading-icon`})),B=(0,I.$)(w,{[`${J}-small`]:"small"===H,[`${J}-loading`]:s,[`${J}-rtl`]:"rtl"===S},r,o,V.root,L,_);return i.createElement(E.A,{component:"Switch",disabled:D},i.createElement(v,{...f,classNames:V,styles:X,checked:x,onChange:(...e)=>{j(e[0]),h?.(...e)},prefixCls:J,className:B,style:X.root,disabled:D,ref:n,loadingIcon:W}))});_.__ANT_SWITCH=!0;var H=t(94992),z=t(54746),F=t(99650),M=t(58209),V=t(6578),X=t(13014);let W=[{label:"文本",value:"text"},{label:"数字",value:"number"},{label:"日期",value:"date"},{label:"表格",value:"table"},{label:"列表",value:"list"}],B=[{label:"必需事实",value:"required_fact"},{label:"必需章节",value:"required_chapter"},{label:"必需文件角色",value:"required_file_role"},{label:"必需提示词角色",value:"required_prompt_role"},{label:"事实必须有来源",value:"source_required"},{label:"禁止出现文本",value:"forbidden_text"},{label:"章节最低字数",value:"min_chapter_length"},{label:"必须有表格",value:"table_required"}],G=[{label:"错误(阻断)",value:"error"},{label:"警告(提醒)",value:"warning"},{label:"信息(提示)",value:"info"}];function K(){var e,n;let t=(0,X.Vr)(),{message:A}=c.A.useApp(),[I]=s.A.useForm(),[S,w]=(0,i.useState)([]),[$,v]=(0,i.useState)([]),[k,T]=(0,i.useState)(!1),E=async()=>{let[e,n]=await Promise.all([(0,V.mx)(),(0,V.lv)()]);w(e.specs),v(n.roles)};(0,i.useEffect)(()=>{E().catch(()=>A.error(t("common.error")))},[A,t]);let C=$.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),N=$.filter(e=>"prompt"===e.type).map(e=>({label:e.name,value:e.id})),O=null!=(n=null==(e=s.A.useWatch("factFields",I))?void 0:e.map(e=>({label:e.name||e.id,value:e.id})))?n:[],R=e=>{I.setFieldsValue(null!=e?e:{id:"spec-".concat(Date.now()),name:"",description:"",factFields:[],chapterRules:[],gateRules:[]}),T(!0)},P=async()=>{try{let e=await I.validateFields(),n=await (0,V.EK)(e);w(n.specs),T(!1),A.success(t("common.success"))}catch(e){e instanceof Error&&A.error(e.message)}},q=async e=>{w((await (0,V.ER)(e)).specs)};return(0,a.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,a.jsx)(r.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle mb-1",children:t("specs.title")}),(0,a.jsx)("p",{className:"pageDesc mb-0",children:t("specs.description")})]}),(0,a.jsx)(o.Ay,{type:"primary",icon:(0,a.jsx)(z.A,{}),onClick:()=>R(),children:t("specs.newSpec")})]})}),(0,a.jsx)(l.A,{type:"info",showIcon:!0,message:t("specs.plainGuideTitle"),description:t("specs.plainGuideDesc")}),(0,a.jsx)(r.A,{title:t("specs.list"),children:(0,a.jsx)(d.A,{dataSource:S,locale:{emptyText:(0,a.jsx)(p.A,{description:t("common.noData")})},renderItem:e=>(0,a.jsx)(d.A.Item,{actions:[(0,a.jsx)(o.Ay,{type:"text",icon:(0,a.jsx)(F.A,{}),onClick:()=>R(e)},"edit"),(0,a.jsx)(u.A,{title:t("common.confirm"),disabled:e.builtIn,onConfirm:()=>{q(e.id)},children:(0,a.jsx)(o.Ay,{type:"text",danger:!0,icon:(0,a.jsx)(M.A,{}),disabled:e.builtIn})},"delete")],children:(0,a.jsx)(d.A.Item.Meta,{title:(0,a.jsxs)(m.A,{children:[(0,a.jsx)("span",{children:e.name}),e.builtIn&&(0,a.jsx)(h.A,{color:"gold",children:t("documents.builtIn")}),(0,a.jsx)(h.A,{children:e.id})]}),description:"".concat(e.description||"-"," \xb7 ").concat(t("specs.facts"),": ").concat(e.factFields.length," \xb7 ").concat(t("specs.chapters"),": ").concat(e.chapterRules.length," \xb7 ").concat(t("specs.gates"),": ").concat(e.gateRules.length)})})})}),(0,a.jsx)(y.A,{maskClosable:!1,title:t("specs.editor"),open:k,onOk:()=>{P()},onCancel:()=>T(!1),width:980,centered:!0,okText:t("common.save"),children:(0,a.jsxs)(s.A,{form:I,layout:"vertical",children:[(0,a.jsxs)(g.A,{gutter:12,children:[(0,a.jsx)(f.A,{span:8,children:(0,a.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,a.jsx)(x.A,{disabled:!0})})}),(0,a.jsx)(f.A,{span:8,children:(0,a.jsx)(s.A.Item,{name:"name",label:t("specs.name"),rules:[{required:!0}],children:(0,a.jsx)(x.A,{})})}),(0,a.jsx)(f.A,{span:8,children:(0,a.jsx)(s.A.Item,{name:"wordTemplatePath",label:t("specs.wordTemplatePath"),children:(0,a.jsx)(x.A,{placeholder:"/path/to/template.docx"})})})]}),(0,a.jsx)(s.A.Item,{name:"description",label:t("specs.specDescription"),children:(0,a.jsx)(x.A,{})}),(0,a.jsx)(j.A,{items:[{key:"facts",label:t("specs.facts"),children:(0,a.jsx)(s.A.List,{name:"factFields",children:(e,n)=>{let{add:i,remove:c}=n;return(0,a.jsxs)(m.A,{direction:"vertical",className:"w-full",children:[e.map(e=>(0,a.jsxs)(r.A,{size:"small",children:[(0,a.jsxs)(g.A,{gutter:8,children:[(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"id"],label:"ID",initialValue:"fact-".concat(Date.now()),children:(0,a.jsx)(x.A,{disabled:!0})})}),(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"name"],label:t("specs.factName"),rules:[{required:!0}],children:(0,a.jsx)(x.A,{})})}),(0,a.jsx)(f.A,{span:4,children:(0,a.jsx)(s.A.Item,{name:[e.name,"type"],label:t("specs.factType"),initialValue:"text",children:(0,a.jsx)(b.A,{options:W})})}),(0,a.jsx)(f.A,{span:4,children:(0,a.jsx)(s.A.Item,{name:[e.name,"required"],label:t("specs.required"),valuePropName:"checked",children:(0,a.jsx)(_,{})})}),(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"sourceRoleIds"],label:t("specs.sourceRoles"),children:(0,a.jsx)(b.A,{mode:"multiple",options:C})})}),(0,a.jsx)(f.A,{span:1,children:(0,a.jsx)(o.Ay,{danger:!0,onClick:()=>c(e.name),children:"-"})})]}),(0,a.jsx)(s.A.Item,{name:[e.name,"extractionHint"],label:t("specs.extractionHint"),children:(0,a.jsx)(x.A,{})}),(0,a.jsx)(s.A.Item,{name:[e.name,"validationHint"],label:t("specs.validationHint"),children:(0,a.jsx)(x.A,{})})]},e.key)),(0,a.jsx)(o.Ay,{onClick:()=>i({id:"fact-".concat(Date.now()),type:"text",required:!0}),children:t("specs.addFact")})]})}})},{key:"chapters",label:t("specs.chapters"),children:(0,a.jsx)(s.A.List,{name:"chapterRules",children:(e,n)=>{let{add:i,remove:c}=n;return(0,a.jsxs)(m.A,{direction:"vertical",className:"w-full",children:[e.map((e,n)=>(0,a.jsxs)(r.A,{size:"small",children:[(0,a.jsxs)(g.A,{gutter:8,children:[(0,a.jsx)(f.A,{span:4,children:(0,a.jsx)(s.A.Item,{name:[e.name,"id"],label:"ID",initialValue:"chapter-".concat(Date.now()),children:(0,a.jsx)(x.A,{disabled:!0})})}),(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"title"],label:t("specs.chapterTitle"),rules:[{required:!0}],children:(0,a.jsx)(x.A,{})})}),(0,a.jsx)(f.A,{span:3,children:(0,a.jsx)(s.A.Item,{name:[e.name,"order"],label:t("specs.order"),initialValue:n,children:(0,a.jsx)(H.A,{className:"w-full"})})}),(0,a.jsx)(f.A,{span:3,children:(0,a.jsx)(s.A.Item,{name:[e.name,"minWords"],label:t("specs.minWords"),children:(0,a.jsx)(H.A,{className:"w-full"})})}),(0,a.jsx)(f.A,{span:3,children:(0,a.jsx)(s.A.Item,{name:[e.name,"required"],label:t("specs.required"),valuePropName:"checked",children:(0,a.jsx)(_,{})})}),(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"requiredFactIds"],label:t("specs.requiredFacts"),children:(0,a.jsx)(b.A,{mode:"multiple",options:O})})}),(0,a.jsx)(f.A,{span:1,children:(0,a.jsx)(o.Ay,{danger:!0,onClick:()=>c(e.name),children:"-"})})]}),(0,a.jsxs)(g.A,{gutter:8,children:[(0,a.jsx)(f.A,{span:12,children:(0,a.jsx)(s.A.Item,{name:[e.name,"requiredFileRoleIds"],label:t("specs.requiredFileRoles"),children:(0,a.jsx)(b.A,{mode:"multiple",options:C})})}),(0,a.jsx)(f.A,{span:12,children:(0,a.jsx)(s.A.Item,{name:[e.name,"requiredPromptRoleIds"],label:t("specs.requiredPromptRoles"),children:(0,a.jsx)(b.A,{mode:"multiple",options:N})})})]}),(0,a.jsx)(s.A.Item,{name:[e.name,"generationHint"],label:t("specs.generationHint"),children:(0,a.jsx)(x.A,{})})]},e.key)),(0,a.jsx)(o.Ay,{onClick:()=>i({id:"chapter-".concat(Date.now()),order:e.length,required:!0}),children:t("specs.addChapter")})]})}})},{key:"gates",label:t("specs.gates"),children:(0,a.jsx)(s.A.List,{name:"gateRules",children:(e,n)=>{let{add:i,remove:c}=n;return(0,a.jsxs)(m.A,{direction:"vertical",className:"w-full",children:[e.map(e=>(0,a.jsxs)(g.A,{gutter:8,children:[(0,a.jsx)(f.A,{span:4,children:(0,a.jsx)(s.A.Item,{name:[e.name,"id"],initialValue:"gate-".concat(Date.now()),children:(0,a.jsx)(x.A,{disabled:!0})})}),(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"name"],rules:[{required:!0}],children:(0,a.jsx)(x.A,{placeholder:t("specs.gateName")})})}),(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"type"],initialValue:"required_fact",children:(0,a.jsx)(b.A,{options:B})})}),(0,a.jsx)(f.A,{span:4,children:(0,a.jsx)(s.A.Item,{name:[e.name,"level"],initialValue:"error",children:(0,a.jsx)(b.A,{options:G})})}),(0,a.jsx)(f.A,{span:3,children:(0,a.jsx)(s.A.Item,{name:[e.name,"target"],children:(0,a.jsx)(x.A,{placeholder:"target"})})}),(0,a.jsx)(f.A,{span:2,children:(0,a.jsx)(s.A.Item,{name:[e.name,"value"],children:(0,a.jsx)(x.A,{placeholder:"value"})})}),(0,a.jsx)(f.A,{span:1,children:(0,a.jsx)(o.Ay,{danger:!0,onClick:()=>c(e.name),children:"-"})})]},e.key)),(0,a.jsx)(o.Ay,{onClick:()=>i({id:"gate-".concat(Date.now()),type:"required_fact",level:"error"}),children:t("specs.addGate")})]})}})}]})]})})]})}},94773:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-specs",function(){return t(51533)}])}},e=>{e.O(0,[260,167,382,628,271,576,700,174,183,232,951,20,636,593,792],()=>e(e.s=94773)),_N_E=e.O()}]);
|