@customize-agent/server 3.0.23 → 3.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +15 -15
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/chunks/3445.js +9 -3
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/api/kb/files.js +1 -1
- package/.next/server/pages/api/kb/upload.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/guide.html +1 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/search.html +1 -1
- package/.next/server/pages/knowledge.html +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages/prompt.html +1 -1
- package/.next/server/pages/settings.html +1 -1
- package/.next/server/pages/system/logs.html +1 -1
- package/.next/server/pages-manifest.json +28 -28
- package/.next/static/{acY08PnMrDcIVFltevLF9 → 8xsL1jpKns40nCUZXfzdc}/_buildManifest.js +1 -1
- package/.next/static/chunks/pages/{asset-library-2002e65d3419a283.js → asset-library-764f3ad063f40fff.js} +1 -1
- package/.next/static/chunks/pages/context/long-term-3b59c9386df2b218.js +1 -0
- package/.next/static/chunks/pages/context/short-term-b1ab1b56112896bf.js +1 -0
- package/.next/static/chunks/pages/{document-roles-fce52968e35419ef.js → document-roles-0288a3e6e00e6e02.js} +1 -1
- package/.next/static/chunks/pages/{document-specs-24821e43bffa0690.js → document-specs-e2337e693c352897.js} +1 -1
- package/.next/static/chunks/pages/documents-cd370a6de9223124.js +1 -0
- package/.next/static/chunks/pages/knowledge/file-detail-9d493b7de07860dc.js +1 -0
- package/.next/static/chunks/pages/knowledge/files-f15c37b88e8329b9.js +1 -0
- package/.next/static/chunks/pages/knowledge/manage-1e8b62ae3c336814.js +1 -0
- package/.next/static/chunks/pages/knowledge/search-50b40e01b826e035.js +1 -0
- package/.next/static/chunks/pages/{models-b8a5b97f6f7c65e1.js → models-58d14888232c7212.js} +1 -1
- package/.next/static/chunks/pages/{prompt-6b34d9f306b1221e.js → prompt-ecb8772b12e5a7e0.js} +1 -1
- package/.next/static/chunks/pages/system/{logs-37b0989401612947.js → logs-7a90a654d4931f5f.js} +1 -1
- package/package.json +1 -1
- package/.next/static/chunks/pages/context/long-term-cb71be058707d986.js +0 -1
- package/.next/static/chunks/pages/context/short-term-a0ea0ce1af223037.js +0 -1
- package/.next/static/chunks/pages/documents-9808d8521057534a.js +0 -1
- package/.next/static/chunks/pages/knowledge/file-detail-a468c2ca1ebe8a0a.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-49cdd7599936e9f4.js +0 -1
- package/.next/static/chunks/pages/knowledge/manage-92e84aa445ce8f03.js +0 -1
- package/.next/static/chunks/pages/knowledge/search-41baae99bb6baf15.js +0 -1
- /package/.next/static/{acY08PnMrDcIVFltevLF9 → 8xsL1jpKns40nCUZXfzdc}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4046],{69:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5L255.8 713.6l-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l110.3 111.2c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.1 304.1 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112m161.2 465.2C726.2 620.3 668.9 644 608 644s-118.2-23.7-161.2-66.8C403.7 534.2 380 476.9 380 416s23.7-118.2 66.8-161.2c43-43.1 100.3-66.8 161.2-66.8s118.2 23.7 161.2 66.8c43.1 43 66.8 100.3 66.8 161.2s-23.7 118.2-66.8 161.2"}}]},name:"key",theme:"outlined"}},2256:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});let o=n(25341).A},5450:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"}},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 r(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function l(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 c(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await c(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function f(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function y(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 b(e,t){var n,a,i,r,l;let s=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&s.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&s.set("category",t.category),(null==t?void 0:t.limit)&&s.set("limit",String(null!=(l=t.limit)?l:20)),(null==t||null==(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==(r=t.weights)?void 0:r.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function j(){return o("/api/prompt")}async function x(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function A(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function C(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 T(){return o("/api/documents/specs")}async function O(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 k(){return o("/api/documents/templates")}async function E(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(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 _(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function I(){return o("/api/documents/generated")}async function L(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function U(e,t){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function M(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function z(){return o("/api/assets/generated")}async function H(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function D(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function J(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 F(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function K(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function B(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),n=t.headers.get("content-type")||"",o=async()=>{let e=await t.text(),n=e||"导出失败";try{var o;let t=JSON.parse(e),a=null==(o=t.issues)?void 0:o.map(e=>e.message).filter(Boolean).slice(0,3).join(";");n=a?"".concat(t.error||"导出失败",":").concat(a):t.error||n}catch(e){}throw Error(n.length>300?"".concat(n.slice(0,300),"..."):n)};return t.ok||await o(),"pdf"!==e.format||n.includes("application/pdf")||await o(),"docx"!==e.format||n.includes("officedocument.wordprocessingml.document")||await o(),t.blob()}async function W(){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 $(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function G(){return o("/api/config/models")}async function X(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 q(){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 et(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return o("/api/system/logs?limit=".concat(e))}async function en(){return o("/api/system/logs",{method:"DELETE"})}async function eo(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function ea(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function ei(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function er(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function el(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function es(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:()=>K,Bh:()=>ec,Dl:()=>k,E:()=>er,EK:()=>O,ER:()=>N,FC:()=>ee,FV:()=>w,H1:()=>g,H7:()=>m,HC:()=>l,HT:()=>i,II:()=>Q,JU:()=>H,NR:()=>C,OX:()=>_,PH:()=>ei,QG:()=>M,QT:()=>u,Qx:()=>p,R1:()=>F,SJ:()=>f,UE:()=>B,VW:()=>v,W2:()=>b,X8:()=>y,Z3:()=>W,_m:()=>V,a6:()=>U,aP:()=>X,bV:()=>R,bZ:()=>Y,c1:()=>d,cQ:()=>I,dd:()=>Z,dg:()=>A,dw:()=>S,dx:()=>j,f$:()=>z,h0:()=>P,h1:()=>$,hH:()=>en,hc:()=>a,hn:()=>eo,l2:()=>E,lv:()=>x,mx:()=>T,oH:()=>et,oS:()=>J,p:()=>ea,tn:()=>s,u6:()=>q,uc:()=>D,v7:()=>L,xC:()=>r,xq:()=>h,xw:()=>el,zo:()=>es,zr:()=>G})},10218:(e,t,n)=>{"use strict";n.d(t,{A:()=>y,H:()=>h});var o=n(97109),a=n(4932),i=n(42644);let r=e=>"object"==typeof e&&null!=e&&1===e.nodeType,l=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,s=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return l(n.overflowY,t)||l(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},c=(e,t,n,o,a,i,r,l)=>i<e&&r>t||i>e&&r<t?0:i<=e&&l<=n||r>=t&&l>=n?i-e-o:r>t&&l<n||i<e&&l>n?r-t+a:0,d=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},u=(e,t)=>{var n,o,a,i;if("undefined"==typeof document)return[];let{scrollMode:l,block:u,inline:p,boundary:m,skipOverflowHiddenElements:h}=t,f="function"==typeof m?m:e=>e!==m;if(!r(e))throw TypeError("Invalid target");let y=document.scrollingElement||document.documentElement,g=[],v=e;for(;r(v)&&f(v);){if((v=d(v))===y){g.push(v);break}null!=v&&v===document.body&&s(v)&&!s(document.documentElement)||null!=v&&s(v,h)&&g.push(v)}let b=null!=(o=null==(n=window.visualViewport)?void 0:n.width)?o:innerWidth,j=null!=(i=null==(a=window.visualViewport)?void 0:a.height)?i:innerHeight,{scrollX:x,scrollY:A}=window,{height:w,width:C,top:S,right:T,bottom:O,left:N}=e.getBoundingClientRect(),{top:k,right:E,bottom:P,left:R}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),_="start"===u||"nearest"===u?S-k:"end"===u?O+P:S+w/2-k+P,I="center"===p?N+C/2-R+E:"end"===p?T+E:N-R,L=[];for(let e=0;e<g.length;e++){let t=g[e],{height:n,width:o,top:a,right:i,bottom:r,left:d}=t.getBoundingClientRect();if("if-needed"===l&&S>=0&&N>=0&&O<=j&&T<=b&&(t===y&&!s(t)||S>=a&&O<=r&&N>=d&&T<=i))break;let m=getComputedStyle(t),h=parseInt(m.borderLeftWidth,10),f=parseInt(m.borderTopWidth,10),v=parseInt(m.borderRightWidth,10),k=parseInt(m.borderBottomWidth,10),E=0,P=0,R="offsetWidth"in t?t.offsetWidth-t.clientWidth-h-v:0,U="offsetHeight"in t?t.offsetHeight-t.clientHeight-f-k:0,M="offsetWidth"in t?0===t.offsetWidth?0:o/t.offsetWidth:0,z="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(y===t)E="start"===u?_:"end"===u?_-j:"nearest"===u?c(A,A+j,j,f,k,A+_,A+_+w,w):_-j/2,P="start"===p?I:"center"===p?I-b/2:"end"===p?I-b:c(x,x+b,b,h,v,x+I,x+I+C,C),E=Math.max(0,E+A),P=Math.max(0,P+x);else{E="start"===u?_-a-f:"end"===u?_-r+k+U:"nearest"===u?c(a,r,n,f,k+U,_,_+w,w):_-(a+n/2)+U/2,P="start"===p?I-d-h:"center"===p?I-(d+o/2)+R/2:"end"===p?I-i+v+R:c(d,i,o,h,v+R,I,I+C,C);let{scrollLeft:e,scrollTop:l}=t;E=0===z?0:Math.max(0,Math.min(l+E/z,t.scrollHeight-n/z+U)),P=0===M?0:Math.max(0,Math.min(e+P/M,t.scrollWidth-o/M+R)),_+=l-E,I+=e-P}L.push({el:t,top:E,left:P})}return L};var p=n(26047),m=n(44624);function h(e){return(0,m.$r)(e).join("_")}function f(e,t){let n=t.getFieldInstance(e),o=(0,i.rb)(n);if(o)return o;let a=(0,m.kV)((0,m.$r)(e),t.__INTERNAL__.name);if(a)return document.getElementById(a)}function y(e){let[t]=(0,a.mN)(),n=o.useRef({}),i=o.useMemo(()=>e??{...t,__INTERNAL__:{itemRef:e=>t=>{let o=h(e);t?n.current[o]=t:delete n.current[o]}},scrollToField:(e,t={})=>{let{focus:n,...o}=t,a=f(e,i);a&&(!function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let n=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(u(e,t));let o="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:a,top:i,left:r}of u(e,!1===t?{block:"end",inline:"nearest"}:t===Object(t)&&0!==Object.keys(t).length?t:{block:"start",inline:"nearest"})){let e=i-n.top+n.bottom,t=r-n.left+n.right;a.scroll({top:e,left:t,behavior:o})}}(a,{scrollMode:"if-needed",block:"nearest",...o}),n&&i.focusField(e))},focusField:e=>{let t=i.getFieldInstance(e);(0,p.Tn)(t?.focus)?t.focus():f(e,i)?.focus?.()},getFieldInstance:e=>{let t=h(e);return n.current[t]}},[e,t]);return[i]}},13114:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var o=n(97109),a=n(5450),i=n(88483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let l=o.forwardRef((e,t)=>o.createElement(i.A,r({},e,{ref:t,icon:a.A})))},15437:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});let o=e=>{let{componentCls:t,antCls:n,motionDurationMid:o,motionEaseInOut:a}=e;return{[t]:{[`${n}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`${["height","opacity"].map(e=>`${e} ${o} ${a}`).join(", ")} !important`}},[`${n}-motion-collapse`]:{overflow:"hidden",transition:`${["height","opacity"].map(e=>`${e} ${o} ${a}`).join(", ")} !important`}}}}},15527:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>J});var o=n(65321),a=n(97109),i=n(64209),r=n(17807),l=n(85114),s=n(68787),c=n(2256),d=n(38770),u=n(33442),p=n(26171),m=n(11702),h=n(85493),f=n(63455),y=n(57271),g=n(7576),v=n(94992),b=n(25258),j=n(56985),x=n(54746),A=n(29071),w=n(59188),C=n(4216),S=n(13114),T=n(99650),O=n(58209),N=n(69),k=n(88483);function E(){return(E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let P=a.forwardRef((e,t)=>a.createElement(k.A,E({},e,{ref:t,icon:N.A})));var R=n(30289);function _(){return(_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let I=a.forwardRef((e,t)=>a.createElement(k.A,_({},e,{ref:t,icon:R.A})));var L=n(6578),U=n(42323),M=n.n(U);let z=[{label:"OpenAI 兼容",value:"openai"},{label:"Anthropic",value:"anthropic"},{label:"Google",value:"google"},{label:"Ollama",value:"ollama"},{label:"OpenRouter",value:"openrouter"}],H=[{key:"reader",labelKey:"models.tierReader",descKey:"models.tierReaderDesc"},{key:"reasoning",labelKey:"models.tierReasoning",descKey:"models.tierReasoningDesc"},{key:"action",labelKey:"models.tierAction",descKey:"models.tierActionDesc"}],D=[{key:"imageGeneration",label:"图片生成"},{key:"imageUnderstanding",label:"图片理解"},{key:"fileUnderstanding",label:"文件理解"},{key:"audio",label:"音频能力"},{key:"video",label:"视频能力"}];function J(){let e=(0,i.Vr)(),{message:t}=r.A.useApp(),n=[{label:e("models.embeddingProviderHash"),value:"hash"},{label:e("models.embeddingProviderOpenAI"),value:"openai-compatible"}],[N,k]=(0,a.useState)(!0),[E,R]=(0,a.useState)([]),[_,U]=(0,a.useState)(null),[J,F]=(0,a.useState)({provider:"hash",dimensions:384}),[K,B]=(0,a.useState)(!1),[W,V]=(0,a.useState)(!1),[$,G]=(0,a.useState)(null),[X,Q]=(0,a.useState)(!1),[Z,q]=(0,a.useState)(""),[Y,ee]=(0,a.useState)(""),[et,en]=(0,a.useState)(""),[eo,ea]=(0,a.useState)("openai"),[ei,er]=(0,a.useState)(!1),[el,es]=(0,a.useState)({}),[ec,ed]=(0,a.useState)(!1),[eu,ep]=(0,a.useState)(!1),[em,eh]=(0,a.useState)(""),[ef,ey]=(0,a.useState)(""),[eg,ev]=(0,a.useState)(""),[eb,ej]=(0,a.useState)(""),[ex,eA]=(0,a.useState)("openai"),[ew,eC]=(0,a.useState)(!1),[eS,eT]=(0,a.useState)({}),[eO,eN]=(0,a.useState)(!1),[ek,eE]=(0,a.useState)(null),[eP,eR]=(0,a.useState)({}),e_=async()=>{k(!0);try{let[e,t,n]=await Promise.all([(0,L.Z3)().catch(()=>[]),(0,L.zr)().catch(()=>null),(0,L.II)().catch(()=>({provider:"hash",dimensions:384}))]);R(e),U(t),F(n)}catch(n){t.error(e("common.error"))}finally{k(!1)}};(0,a.useEffect)(()=>{e_()},[]);let eI=async()=>{if(Z.trim()){ed(!0);try{await (0,L._m)(Z.trim(),{apiKey:Y||void 0,baseUrl:et||void 0,protocol:eo,directEndpoint:ei,capabilities:el}),Q(!1),q(""),ee(""),en(""),ea("openai"),er(!1),es({}),await e_(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{ed(!1)}}},eL=async n=>{try{await (0,L.h1)(n),await e_(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}},eU=async e=>{eh(e.name),ey(e.name),ev("");try{let t=await (0,L.Bh)(e.name);ev(t.apiKey?"••••••••":""),ej(t.baseUrl||""),eA(t.protocol||t.detectedProtocol||"openai"),eT(t.capabilities||{})}catch(t){ej(e.baseUrl||""),eA(e.protocol||e.detectedProtocol||"openai"),eT(e.capabilities||{})}ep(!0)},eM=async()=>{if(ef.trim()){eN(!0);try{let n=eg.includes("•")?void 0:eg||void 0;await (0,L._m)(ef.trim(),{oldName:em,apiKey:n,baseUrl:eb||void 0,protocol:ex,directEndpoint:ew,capabilities:eS}),ep(!1),eh(""),ey(""),ev(""),ej(""),eA("openai"),eC(!1),eT({}),await e_(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{eN(!1)}}},ez=async n=>{eE(n);try{let o=await (0,L.bZ)(n);eR(e=>({...e,[n]:o.success})),t[o.success?"success":"error"](o.success?e("models.connected"):e("models.connectionFailed"))}catch(e){eR(e=>({...e,[n]:!1}))}finally{eE(null)}},eH=async()=>{B(!0);try{let n=await (0,L.dd)(J);F(n),G(null),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{B(!1)}},eD=async()=>{V(!0);try{let n=await (0,L.u6)();G(n.success),t[n.success?"success":"error"](n.message||(n.success?e("models.connected"):e("models.connectionFailed")))}catch(n){G(!1),t.error(e("common.error"))}finally{V(!1)}},eJ=async(n,o)=>{if(!_)return;let a={..._},i=a[n];if(!o){i.active="",U(a);try{await (0,L.aP)(a)}catch(n){t.error(e("common.error"))}return}let r=o.indexOf(":"),l=r>=0?o.slice(0,r):o,s=r>=0?o.slice(r+1):o;i.active=s,i.list.some(e=>e.name===s&&e.provider===l)||i.list.push({name:s,provider:l}),U(a);try{await (0,L.aP)(a)}catch(n){t.error(e("common.error"))}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("models.title")}),(0,o.jsx)("p",{className:"pageDesc",children:e("models.description")})]}),(0,o.jsx)(l.Ay,{type:"primary",icon:(0,o.jsx)(x.A,{}),onClick:()=>Q(!0),children:e("models.addModel")})]}),(0,o.jsx)(s.A,{title:e("models.modelList"),size:"small",loading:N,children:0===E.length?(0,o.jsx)("span",{className:M().cardMeta,children:e("models.noProviders")}):(0,o.jsx)(c.A,{gutter:[12,12],align:"stretch",children:E.map(t=>(0,o.jsx)(d.A,{xs:24,sm:12,lg:8,xl:6,className:M().providerGrid,children:(0,o.jsxs)(s.A,{size:"small",className:M().providerCard,children:[(0,o.jsxs)("div",{className:M().cardAction,children:[(0,o.jsxs)("div",{className:M().cardMain,children:[(0,o.jsx)("div",{className:M().cardName,title:t.name,children:t.name}),(0,o.jsxs)("div",{className:M().cardMeta,children:[(0,o.jsx)(A.A,{})," ",t.protocol||t.detectedProtocol||"openai"]})]}),(0,o.jsxs)(u.A,{size:2,wrap:!1,children:[(0,o.jsx)(l.Ay,{size:"small",type:"text",loading:ek===t.name,onClick:()=>{ez(t.name)},icon:!0===eP[t.name]?(0,o.jsx)(w.A,{className:"text-[var(--colorOk)]"}):!1===eP[t.name]?(0,o.jsx)(C.A,{className:"text-[var(--colorDanger)]"}):(0,o.jsx)(S.A,{})}),(0,o.jsx)(l.Ay,{size:"small",type:"text",icon:(0,o.jsx)(T.A,{}),onClick:()=>{eU(t)}}),(0,o.jsx)(p.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{eL(t.name)},children:(0,o.jsx)(l.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(O.A,{})})})]})]}),(0,o.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,o.jsxs)("span",{className:"".concat(M().cardMeta," text-xs"),children:[(0,o.jsx)(P,{})," ",t.hasApiKey?"••••••••":"—"]}),t.baseUrl&&(0,o.jsxs)("span",{className:"".concat(M().cardMeta," ").concat(M().urlLine," text-xs"),title:t.baseUrl,children:[(0,o.jsx)(I,{})," ",t.baseUrl]}),(0,o.jsx)(u.A,{size:[4,4],wrap:!0,children:D.filter(e=>{var n;return null==(n=t.capabilities)?void 0:n[e.key]}).map(e=>(0,o.jsx)(m.A,{color:"purple",children:e.label},e.key))})]})]})},t.name))})}),(0,o.jsxs)(s.A,{title:e("models.embeddingConfig"),size:"small",loading:N,children:[(0,o.jsx)(h.A,{className:"mb-4",type:"info",showIcon:!0,message:e("models.embeddingHint")}),(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsxs)(c.A,{gutter:[12,12],children:[(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.embeddingProvider"),children:(0,o.jsx)(y.A,{value:J.provider,options:n,onChange:e=>F(t=>({...t,provider:e,dimensions:"hash"===e?384:t.dimensions||1024}))})})}),"openai-compatible"===J.provider&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:"Base URL",children:(0,o.jsx)(g.A,{value:J.baseUrl,onChange:e=>F(t=>({...t,baseUrl:e.target.value})),placeholder:"http://localhost:11434/v1"})})}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.model"),children:(0,o.jsx)(g.A,{value:J.model,onChange:e=>F(t=>({...t,model:e.target.value})),placeholder:"bge-m3"})})}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.apiKey"),help:J.hasApiKey?e("models.embeddingApiKeyHint"):void 0,children:(0,o.jsx)(g.A.Password,{value:J.apiKey,onFocus:()=>{var e;(null==(e=J.apiKey)?void 0:e.includes("•"))&&F(e=>({...e,apiKey:""}))},onChange:e=>F(t=>({...t,apiKey:e.target.value})),placeholder:e("models.optional")})})})]}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.dimensions"),children:(0,o.jsx)(v.A,{className:"w-full",min:1,value:J.dimensions,onChange:e=>F(t=>({...t,dimensions:Number(e||("hash"===t.provider?384:1024))}))})})}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.status"),children:(0,o.jsxs)(u.A,{children:[(0,o.jsx)(m.A,{color:"hash"===J.provider?"default":"blue",children:"hash"===J.provider?e("models.localHash"):e("models.openAICompatible")}),!0===$&&(0,o.jsx)(m.A,{color:"success",children:e("models.connected")}),!1===$&&(0,o.jsx)(m.A,{color:"error",children:e("models.connectionFailed")})]})})})]}),(0,o.jsxs)(u.A,{children:[(0,o.jsx)(l.Ay,{type:"primary",loading:K,onClick:()=>{eH()},children:e("models.saveEmbedding")}),(0,o.jsx)(l.Ay,{icon:(0,o.jsx)(S.A,{}),loading:W,onClick:()=>{eD()},children:e("models.testEmbedding")})]})]})]}),_&&(0,o.jsx)(s.A,{title:e("models.modelTiers"),size:"small",children:(0,o.jsx)(c.A,{gutter:[12,12],children:H.map(n=>{var a;let{key:i,labelKey:r,descKey:l}=n,c=_[i],u=c.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),p=E.filter(e=>!c.list.some(t=>t.provider===e.name)).map(e=>({label:"".concat(e.name," / ").concat(e.name),value:"".concat(e.name,":").concat(e.name)}));return(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsxs)(s.A,{size:"small",title:e(r),children:[(0,o.jsx)("span",{className:M().tierDesc,children:e(l)}),(0,o.jsx)(y.A,{value:c.active?"".concat((null==(a=c.list.find(e=>e.name===c.active))?void 0:a.provider)||"",":").concat(c.active):void 0,onChange:e=>{eJ(i,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),className:"w-full",options:[...u,...p]}),c.list.length>0&&(0,o.jsx)("div",{className:M().modelTags,children:c.list.map(n=>(0,o.jsxs)(m.A,{color:n.name===c.active?"blue":void 0,closable:!0,onClose:()=>{var o,a;let r={..._},l=r[i];l.list=l.list.filter(e=>e.name!==n.name||e.provider!==n.provider),l.active===n.name&&(l.active=null!=(a=null==(o=l.list[0])?void 0:o.name)?a:""),U(r),(0,L.aP)(r).catch(()=>t.error(e("common.error")))},children:[n.provider,"/",n.name]},"".concat(n.provider,":").concat(n.name)))})]})},i)})})}),(0,o.jsx)(b.A,{maskClosable:!1,title:e("models.addModel"),open:X,onCancel:()=>{Q(!1),q(""),ee(""),en(""),ea("openai"),er(!1)},onOk:()=>{eI()},confirmLoading:ec,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("models.modelName"),children:(0,o.jsx)(g.A,{value:Z,onChange:e=>q(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,o.jsx)(f.A.Item,{label:e("models.apiKey"),children:(0,o.jsx)(g.A.Password,{value:Y,onChange:e=>ee(e.target.value),placeholder:"sk-..."})}),(0,o.jsx)(f.A.Item,{label:e("models.baseUrl"),children:(0,o.jsx)(g.A,{value:et,onChange:e=>en(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,o.jsx)(f.A.Item,{label:e("models.protocol"),children:(0,o.jsx)(y.A,{value:eo,onChange:ea,options:z})}),(0,o.jsx)(f.A.Item,{label:"直连端点",tooltip:"开启后 Base URL 会作为完整请求地址使用,不再自动拼接接口路径。",children:(0,o.jsx)(j.A,{checked:ei,onChange:e=>er(e.target.checked),children:"Base URL 是完整接口地址"})}),(0,o.jsx)(f.A.Item,{label:"多模态能力",children:(0,o.jsx)(j.A.Group,{value:D.filter(e=>el[e.key]).map(e=>e.key),options:D.map(e=>({label:e.label,value:e.key})),onChange:e=>es(Object.fromEntries(D.map(t=>[t.key,e.includes(t.key)])))})})]})}),(0,o.jsx)(b.A,{maskClosable:!1,title:e("models.editModel"),open:eu,onCancel:()=>{ep(!1),eh(""),ey(""),ev(""),ej(""),eA("openai"),eC(!1)},onOk:()=>{eM()},confirmLoading:eO,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("models.modelName"),children:(0,o.jsx)(g.A,{value:ef,onChange:e=>ey(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,o.jsx)(f.A.Item,{label:e("models.apiKey"),help:e("models.apiKeyEditHint"),children:(0,o.jsx)(g.A.Password,{value:eg,onFocus:()=>{eg.includes("•")&&ev("")},onCopy:e=>e.preventDefault(),onChange:e=>ev(e.target.value),placeholder:e("models.apiKeyEditPlaceholder")})}),(0,o.jsx)(f.A.Item,{label:e("models.baseUrl"),children:(0,o.jsx)(g.A,{value:eb,onChange:e=>ej(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,o.jsx)(f.A.Item,{label:e("models.protocol"),children:(0,o.jsx)(y.A,{value:ex,onChange:eA,options:z})}),(0,o.jsx)(f.A.Item,{label:"直连端点",tooltip:"开启后 Base URL 会作为完整请求地址使用,不再自动拼接接口路径。",children:(0,o.jsx)(j.A,{checked:ew,onChange:e=>eC(e.target.checked),children:"Base URL 是完整接口地址"})}),(0,o.jsx)(f.A.Item,{label:"多模态能力",children:(0,o.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=>eT(Object.fromEntries(D.map(t=>[t.key,e.includes(t.key)])))})})]})})]})}},29071:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var o=n(97109),a=n(78847),i=n(88483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let l=o.forwardRef((e,t)=>o.createElement(i.A,r({},e,{ref:t,icon:a.A})))},30289:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"}},38770:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});let o=n(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"}},44624:(e,t,n)=>{"use strict";n.d(t,{$r:()=>a,BS:()=>r,kV:()=>i});let o=["parentNode"];function a(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function i(e,t){if(!e.length)return;let n=e.join("_");return t?`${t}_${n}`:o.includes(n)?`form_item_${n}`:n}function r(e,t,n,o,a,i){let r=o;return void 0!==i?r=i:n.validating?r="validating":e.length?r="error":t.length?r="warning":(n.touched||a&&n.validated)&&(r="success"),r}},77305:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return n(15527)}])},78847:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"}}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,4696,6985,288,4020,636,6593,8792],()=>e(e.s=77305)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4046],{69:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5L255.8 713.6l-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l110.3 111.2c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.1 304.1 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112m161.2 465.2C726.2 620.3 668.9 644 608 644s-118.2-23.7-161.2-66.8C403.7 534.2 380 476.9 380 416s23.7-118.2 66.8-161.2c43-43.1 100.3-66.8 161.2-66.8s118.2 23.7 161.2 66.8c43.1 43 66.8 100.3 66.8 161.2s-23.7 118.2-66.8 161.2"}}]},name:"key",theme:"outlined"}},2256:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});let o=n(25341).A},5450:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"}},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 r(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function l(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 c(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await c(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function f(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function y(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 b(e,t){var n,a,i,r,l;let s=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&s.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&s.set("category",t.category),(null==t?void 0:t.limit)&&s.set("limit",String(null!=(l=t.limit)?l:20)),(null==t||null==(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==(r=t.weights)?void 0:r.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function j(){return o("/api/prompt")}async function x(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function A(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function C(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 T(){return o("/api/documents/specs")}async function O(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 k(){return o("/api/documents/templates")}async function E(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(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 _(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function I(){return o("/api/documents/generated")}async function L(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function U(e,t){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function M(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function z(){return o("/api/assets/generated")}async function H(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function D(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function J(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 F(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function K(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function B(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),n=t.headers.get("content-type")||"",o=async()=>{let e=await t.text(),n=e||"导出失败";try{var o;let t=JSON.parse(e),a=null==(o=t.issues)?void 0:o.map(e=>e.message).filter(Boolean).slice(0,3).join(";");n=a?"".concat(t.error||"导出失败",":").concat(a):t.error||n}catch(e){}throw Error(n.length>300?"".concat(n.slice(0,300),"..."):n)};return t.ok||await o(),"pdf"!==e.format||n.includes("application/pdf")||await o(),"docx"!==e.format||n.includes("officedocument.wordprocessingml.document")||await o(),t.blob()}async function W(){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 $(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function G(){return o("/api/config/models")}async function X(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 q(){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 et(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return o("/api/system/logs?limit=".concat(e))}async function en(){return o("/api/system/logs",{method:"DELETE"})}async function eo(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function ea(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function ei(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function er(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function el(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function es(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:()=>K,Bh:()=>ec,Dl:()=>k,E:()=>er,EK:()=>O,ER:()=>N,FC:()=>ee,FV:()=>w,H1:()=>g,H7:()=>m,HC:()=>l,HT:()=>i,II:()=>Q,JU:()=>H,NR:()=>C,OX:()=>_,PH:()=>ei,QG:()=>M,QT:()=>u,Qx:()=>p,R1:()=>F,SJ:()=>f,UE:()=>B,VW:()=>v,W2:()=>b,X8:()=>y,Z3:()=>W,_m:()=>V,a6:()=>U,aP:()=>X,bV:()=>R,bZ:()=>Y,c1:()=>d,cQ:()=>I,dd:()=>Z,dg:()=>A,dw:()=>S,dx:()=>j,f$:()=>z,h0:()=>P,h1:()=>$,hH:()=>en,hc:()=>a,hn:()=>eo,l2:()=>E,lv:()=>x,mx:()=>T,oH:()=>et,oS:()=>J,p:()=>ea,tn:()=>s,u6:()=>q,uc:()=>D,v7:()=>L,xC:()=>r,xq:()=>h,xw:()=>el,zo:()=>es,zr:()=>G})},10218:(e,t,n)=>{"use strict";n.d(t,{A:()=>y,H:()=>h});var o=n(97109),a=n(4932),i=n(42644);let r=e=>"object"==typeof e&&null!=e&&1===e.nodeType,l=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,s=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return l(n.overflowY,t)||l(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},c=(e,t,n,o,a,i,r,l)=>i<e&&r>t||i>e&&r<t?0:i<=e&&l<=n||r>=t&&l>=n?i-e-o:r>t&&l<n||i<e&&l>n?r-t+a:0,d=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},u=(e,t)=>{var n,o,a,i;if("undefined"==typeof document)return[];let{scrollMode:l,block:u,inline:p,boundary:m,skipOverflowHiddenElements:h}=t,f="function"==typeof m?m:e=>e!==m;if(!r(e))throw TypeError("Invalid target");let y=document.scrollingElement||document.documentElement,g=[],v=e;for(;r(v)&&f(v);){if((v=d(v))===y){g.push(v);break}null!=v&&v===document.body&&s(v)&&!s(document.documentElement)||null!=v&&s(v,h)&&g.push(v)}let b=null!=(o=null==(n=window.visualViewport)?void 0:n.width)?o:innerWidth,j=null!=(i=null==(a=window.visualViewport)?void 0:a.height)?i:innerHeight,{scrollX:x,scrollY:A}=window,{height:w,width:C,top:S,right:T,bottom:O,left:N}=e.getBoundingClientRect(),{top:k,right:E,bottom:P,left:R}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),_="start"===u||"nearest"===u?S-k:"end"===u?O+P:S+w/2-k+P,I="center"===p?N+C/2-R+E:"end"===p?T+E:N-R,L=[];for(let e=0;e<g.length;e++){let t=g[e],{height:n,width:o,top:a,right:i,bottom:r,left:d}=t.getBoundingClientRect();if("if-needed"===l&&S>=0&&N>=0&&O<=j&&T<=b&&(t===y&&!s(t)||S>=a&&O<=r&&N>=d&&T<=i))break;let m=getComputedStyle(t),h=parseInt(m.borderLeftWidth,10),f=parseInt(m.borderTopWidth,10),v=parseInt(m.borderRightWidth,10),k=parseInt(m.borderBottomWidth,10),E=0,P=0,R="offsetWidth"in t?t.offsetWidth-t.clientWidth-h-v:0,U="offsetHeight"in t?t.offsetHeight-t.clientHeight-f-k:0,M="offsetWidth"in t?0===t.offsetWidth?0:o/t.offsetWidth:0,z="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(y===t)E="start"===u?_:"end"===u?_-j:"nearest"===u?c(A,A+j,j,f,k,A+_,A+_+w,w):_-j/2,P="start"===p?I:"center"===p?I-b/2:"end"===p?I-b:c(x,x+b,b,h,v,x+I,x+I+C,C),E=Math.max(0,E+A),P=Math.max(0,P+x);else{E="start"===u?_-a-f:"end"===u?_-r+k+U:"nearest"===u?c(a,r,n,f,k+U,_,_+w,w):_-(a+n/2)+U/2,P="start"===p?I-d-h:"center"===p?I-(d+o/2)+R/2:"end"===p?I-i+v+R:c(d,i,o,h,v+R,I,I+C,C);let{scrollLeft:e,scrollTop:l}=t;E=0===z?0:Math.max(0,Math.min(l+E/z,t.scrollHeight-n/z+U)),P=0===M?0:Math.max(0,Math.min(e+P/M,t.scrollWidth-o/M+R)),_+=l-E,I+=e-P}L.push({el:t,top:E,left:P})}return L};var p=n(26047),m=n(44624);function h(e){return(0,m.$r)(e).join("_")}function f(e,t){let n=t.getFieldInstance(e),o=(0,i.rb)(n);if(o)return o;let a=(0,m.kV)((0,m.$r)(e),t.__INTERNAL__.name);if(a)return document.getElementById(a)}function y(e){let[t]=(0,a.mN)(),n=o.useRef({}),i=o.useMemo(()=>e??{...t,__INTERNAL__:{itemRef:e=>t=>{let o=h(e);t?n.current[o]=t:delete n.current[o]}},scrollToField:(e,t={})=>{let{focus:n,...o}=t,a=f(e,i);a&&(!function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let n=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(u(e,t));let o="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:a,top:i,left:r}of u(e,!1===t?{block:"end",inline:"nearest"}:t===Object(t)&&0!==Object.keys(t).length?t:{block:"start",inline:"nearest"})){let e=i-n.top+n.bottom,t=r-n.left+n.right;a.scroll({top:e,left:t,behavior:o})}}(a,{scrollMode:"if-needed",block:"nearest",...o}),n&&i.focusField(e))},focusField:e=>{let t=i.getFieldInstance(e);(0,p.Tn)(t?.focus)?t.focus():f(e,i)?.focus?.()},getFieldInstance:e=>{let t=h(e);return n.current[t]}},[e,t]);return[i]}},13114:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var o=n(97109),a=n(5450),i=n(88483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let l=o.forwardRef((e,t)=>o.createElement(i.A,r({},e,{ref:t,icon:a.A})))},15437:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});let o=e=>{let{componentCls:t,antCls:n,motionDurationMid:o,motionEaseInOut:a}=e;return{[t]:{[`${n}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`${["height","opacity"].map(e=>`${e} ${o} ${a}`).join(", ")} !important`}},[`${n}-motion-collapse`]:{overflow:"hidden",transition:`${["height","opacity"].map(e=>`${e} ${o} ${a}`).join(", ")} !important`}}}}},15527:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>J});var o=n(65321),a=n(97109),i=n(64209),r=n(17807),l=n(85114),s=n(68787),c=n(2256),d=n(38770),u=n(11702),p=n(33442),m=n(26171),h=n(85493),f=n(63455),y=n(57271),g=n(7576),v=n(94992),b=n(25258),j=n(56985),x=n(54746),A=n(29071),w=n(59188),C=n(4216),S=n(13114),T=n(99650),O=n(58209),N=n(69),k=n(88483);function E(){return(E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let P=a.forwardRef((e,t)=>a.createElement(k.A,E({},e,{ref:t,icon:N.A})));var R=n(30289);function _(){return(_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let I=a.forwardRef((e,t)=>a.createElement(k.A,_({},e,{ref:t,icon:R.A})));var L=n(6578),U=n(42323),M=n.n(U);let z=[{label:"OpenAI 兼容",value:"openai"},{label:"Anthropic",value:"anthropic"},{label:"Google",value:"google"},{label:"Ollama",value:"ollama"},{label:"OpenRouter",value:"openrouter"}],H=[{key:"reader",labelKey:"models.tierReader",descKey:"models.tierReaderDesc"},{key:"reasoning",labelKey:"models.tierReasoning",descKey:"models.tierReasoningDesc"},{key:"action",labelKey:"models.tierAction",descKey:"models.tierActionDesc"}],D=[{key:"imageGeneration",label:"图片生成"},{key:"imageUnderstanding",label:"图片理解"},{key:"fileUnderstanding",label:"文件理解"},{key:"audio",label:"音频能力"},{key:"video",label:"视频能力"}];function J(){let e=(0,i.Vr)(),{message:t}=r.A.useApp(),n=[{label:e("models.embeddingProviderHash"),value:"hash"},{label:e("models.embeddingProviderOpenAI"),value:"openai-compatible"}],[N,k]=(0,a.useState)(!0),[E,R]=(0,a.useState)([]),[_,U]=(0,a.useState)(null),[J,F]=(0,a.useState)({provider:"hash",dimensions:384}),[K,B]=(0,a.useState)(!1),[W,V]=(0,a.useState)(!1),[$,G]=(0,a.useState)(null),[X,Q]=(0,a.useState)(!1),[Z,q]=(0,a.useState)(""),[Y,ee]=(0,a.useState)(""),[et,en]=(0,a.useState)(""),[eo,ea]=(0,a.useState)("openai"),[ei,er]=(0,a.useState)(!1),[el,es]=(0,a.useState)({}),[ec,ed]=(0,a.useState)(!1),[eu,ep]=(0,a.useState)(!1),[em,eh]=(0,a.useState)(""),[ef,ey]=(0,a.useState)(""),[eg,ev]=(0,a.useState)(""),[eb,ej]=(0,a.useState)(""),[ex,eA]=(0,a.useState)("openai"),[ew,eC]=(0,a.useState)(!1),[eS,eT]=(0,a.useState)({}),[eO,eN]=(0,a.useState)(!1),[ek,eE]=(0,a.useState)(null),[eP,eR]=(0,a.useState)({}),e_=async()=>{k(!0);try{let[e,t,n]=await Promise.all([(0,L.Z3)().catch(()=>[]),(0,L.zr)().catch(()=>null),(0,L.II)().catch(()=>({provider:"hash",dimensions:384}))]);R(e),U(t),F(n)}catch(n){t.error(e("common.error"))}finally{k(!1)}};(0,a.useEffect)(()=>{e_()},[]);let eI=async()=>{if(Z.trim()){ed(!0);try{await (0,L._m)(Z.trim(),{apiKey:Y||void 0,baseUrl:et||void 0,protocol:eo,directEndpoint:ei,capabilities:el}),Q(!1),q(""),ee(""),en(""),ea("openai"),er(!1),es({}),await e_(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{ed(!1)}}},eL=async n=>{try{await (0,L.h1)(n),await e_(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}},eU=async e=>{eh(e.name),ey(e.name),ev("");try{let t=await (0,L.Bh)(e.name);ev(t.apiKey?"••••••••":""),ej(t.baseUrl||""),eA(t.protocol||t.detectedProtocol||"openai"),eT(t.capabilities||{})}catch(t){ej(e.baseUrl||""),eA(e.protocol||e.detectedProtocol||"openai"),eT(e.capabilities||{})}ep(!0)},eM=async()=>{if(ef.trim()){eN(!0);try{let n=eg.includes("•")?void 0:eg||void 0;await (0,L._m)(ef.trim(),{oldName:em,apiKey:n,baseUrl:eb||void 0,protocol:ex,directEndpoint:ew,capabilities:eS}),ep(!1),eh(""),ey(""),ev(""),ej(""),eA("openai"),eC(!1),eT({}),await e_(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{eN(!1)}}},ez=async n=>{eE(n);try{let o=await (0,L.bZ)(n);eR(e=>({...e,[n]:o.success})),t[o.success?"success":"error"](o.success?e("models.connected"):e("models.connectionFailed"))}catch(e){eR(e=>({...e,[n]:!1}))}finally{eE(null)}},eH=async()=>{B(!0);try{let n=await (0,L.dd)(J);F(n),G(null),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{B(!1)}},eD=async()=>{V(!0);try{let n=await (0,L.u6)();G(n.success),t[n.success?"success":"error"](n.message||(n.success?e("models.connected"):e("models.connectionFailed")))}catch(n){G(!1),t.error(e("common.error"))}finally{V(!1)}},eJ=async(n,o)=>{if(!_)return;let a={..._},i=a[n];if(!o){i.active="",U(a);try{await (0,L.aP)(a)}catch(n){t.error(e("common.error"))}return}let r=o.indexOf(":"),l=r>=0?o.slice(0,r):o,s=r>=0?o.slice(r+1):o;i.active=s,i.list.some(e=>e.name===s&&e.provider===l)||i.list.push({name:s,provider:l}),U(a);try{await (0,L.aP)(a)}catch(n){t.error(e("common.error"))}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("models.title")}),(0,o.jsx)("p",{className:"pageDesc",children:e("models.description")})]}),(0,o.jsx)(l.Ay,{type:"primary",icon:(0,o.jsx)(x.A,{}),onClick:()=>Q(!0),children:e("models.addModel")})]}),(0,o.jsx)(s.A,{title:e("models.modelList"),size:"small",loading:N,children:0===E.length?(0,o.jsx)("span",{className:M().cardMeta,children:e("models.noProviders")}):(0,o.jsx)(c.A,{gutter:[12,12],align:"stretch",children:E.map((t,n)=>(0,o.jsx)(d.A,{xs:24,sm:12,lg:8,xl:6,className:M().providerGrid,children:(0,o.jsxs)(s.A,{size:"small",className:M().providerCard,children:[(0,o.jsxs)("div",{className:M().cardAction,children:[(0,o.jsxs)("div",{className:M().cardMain,children:[(0,o.jsxs)("div",{className:M().cardName,title:t.name,children:[(0,o.jsxs)(u.A,{children:["序号 ",n+1]}),t.name]}),(0,o.jsxs)("div",{className:M().cardMeta,children:[(0,o.jsx)(A.A,{})," ",t.protocol||t.detectedProtocol||"openai"]})]}),(0,o.jsxs)(p.A,{size:2,wrap:!1,children:[(0,o.jsx)(l.Ay,{size:"small",type:"text",loading:ek===t.name,onClick:()=>{ez(t.name)},icon:!0===eP[t.name]?(0,o.jsx)(w.A,{className:"text-[var(--colorOk)]"}):!1===eP[t.name]?(0,o.jsx)(C.A,{className:"text-[var(--colorDanger)]"}):(0,o.jsx)(S.A,{})}),(0,o.jsx)(l.Ay,{size:"small",type:"text",icon:(0,o.jsx)(T.A,{}),onClick:()=>{eU(t)}}),(0,o.jsx)(m.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{eL(t.name)},children:(0,o.jsx)(l.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(O.A,{})})})]})]}),(0,o.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,o.jsxs)("span",{className:"".concat(M().cardMeta," text-xs"),children:[(0,o.jsx)(P,{})," ",t.hasApiKey?"••••••••":"—"]}),t.baseUrl&&(0,o.jsxs)("span",{className:"".concat(M().cardMeta," ").concat(M().urlLine," text-xs"),title:t.baseUrl,children:[(0,o.jsx)(I,{})," ",t.baseUrl]}),(0,o.jsx)(p.A,{size:[4,4],wrap:!0,children:D.filter(e=>{var n;return null==(n=t.capabilities)?void 0:n[e.key]}).map(e=>(0,o.jsx)(u.A,{color:"purple",children:e.label},e.key))})]})]})},t.name))})}),(0,o.jsxs)(s.A,{title:e("models.embeddingConfig"),size:"small",loading:N,children:[(0,o.jsx)(h.A,{className:"mb-4",type:"info",showIcon:!0,message:e("models.embeddingHint")}),(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsxs)(c.A,{gutter:[12,12],children:[(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.embeddingProvider"),children:(0,o.jsx)(y.A,{value:J.provider,options:n,onChange:e=>F(t=>({...t,provider:e,dimensions:"hash"===e?384:t.dimensions||1024}))})})}),"openai-compatible"===J.provider&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:"Base URL",children:(0,o.jsx)(g.A,{value:J.baseUrl,onChange:e=>F(t=>({...t,baseUrl:e.target.value})),placeholder:"http://localhost:11434/v1"})})}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.model"),children:(0,o.jsx)(g.A,{value:J.model,onChange:e=>F(t=>({...t,model:e.target.value})),placeholder:"bge-m3"})})}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.apiKey"),help:J.hasApiKey?e("models.embeddingApiKeyHint"):void 0,children:(0,o.jsx)(g.A.Password,{value:J.apiKey,onFocus:()=>{var e;(null==(e=J.apiKey)?void 0:e.includes("•"))&&F(e=>({...e,apiKey:""}))},onChange:e=>F(t=>({...t,apiKey:e.target.value})),placeholder:e("models.optional")})})})]}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.dimensions"),children:(0,o.jsx)(v.A,{className:"w-full",min:1,value:J.dimensions,onChange:e=>F(t=>({...t,dimensions:Number(e||("hash"===t.provider?384:1024))}))})})}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(f.A.Item,{label:e("models.status"),children:(0,o.jsxs)(p.A,{children:[(0,o.jsx)(u.A,{color:"hash"===J.provider?"default":"blue",children:"hash"===J.provider?e("models.localHash"):e("models.openAICompatible")}),!0===$&&(0,o.jsx)(u.A,{color:"success",children:e("models.connected")}),!1===$&&(0,o.jsx)(u.A,{color:"error",children:e("models.connectionFailed")})]})})})]}),(0,o.jsxs)(p.A,{children:[(0,o.jsx)(l.Ay,{type:"primary",loading:K,onClick:()=>{eH()},children:e("models.saveEmbedding")}),(0,o.jsx)(l.Ay,{icon:(0,o.jsx)(S.A,{}),loading:W,onClick:()=>{eD()},children:e("models.testEmbedding")})]})]})]}),_&&(0,o.jsx)(s.A,{title:e("models.modelTiers"),size:"small",children:(0,o.jsx)(c.A,{gutter:[12,12],children:H.map(n=>{var a;let{key:i,labelKey:r,descKey:l}=n,c=_[i],p=c.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),m=E.filter(e=>!c.list.some(t=>t.provider===e.name)).map(e=>({label:"".concat(e.name," / ").concat(e.name),value:"".concat(e.name,":").concat(e.name)}));return(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsxs)(s.A,{size:"small",title:e(r),children:[(0,o.jsx)("span",{className:M().tierDesc,children:e(l)}),(0,o.jsx)(y.A,{value:c.active?"".concat((null==(a=c.list.find(e=>e.name===c.active))?void 0:a.provider)||"",":").concat(c.active):void 0,onChange:e=>{eJ(i,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),className:"w-full",options:[...p,...m]}),c.list.length>0&&(0,o.jsx)("div",{className:M().modelTags,children:c.list.map(n=>(0,o.jsxs)(u.A,{color:n.name===c.active?"blue":void 0,closable:!0,onClose:()=>{var o,a;let r={..._},l=r[i];l.list=l.list.filter(e=>e.name!==n.name||e.provider!==n.provider),l.active===n.name&&(l.active=null!=(a=null==(o=l.list[0])?void 0:o.name)?a:""),U(r),(0,L.aP)(r).catch(()=>t.error(e("common.error")))},children:[n.provider,"/",n.name]},"".concat(n.provider,":").concat(n.name)))})]})},i)})})}),(0,o.jsx)(b.A,{maskClosable:!1,title:e("models.addModel"),open:X,onCancel:()=>{Q(!1),q(""),ee(""),en(""),ea("openai"),er(!1)},onOk:()=>{eI()},confirmLoading:ec,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("models.modelName"),children:(0,o.jsx)(g.A,{value:Z,onChange:e=>q(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,o.jsx)(f.A.Item,{label:e("models.apiKey"),children:(0,o.jsx)(g.A.Password,{value:Y,onChange:e=>ee(e.target.value),placeholder:"sk-..."})}),(0,o.jsx)(f.A.Item,{label:e("models.baseUrl"),children:(0,o.jsx)(g.A,{value:et,onChange:e=>en(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,o.jsx)(f.A.Item,{label:e("models.protocol"),children:(0,o.jsx)(y.A,{value:eo,onChange:ea,options:z})}),(0,o.jsx)(f.A.Item,{label:"直连端点",tooltip:"开启后 Base URL 会作为完整请求地址使用,不再自动拼接接口路径。",children:(0,o.jsx)(j.A,{checked:ei,onChange:e=>er(e.target.checked),children:"Base URL 是完整接口地址"})}),(0,o.jsx)(f.A.Item,{label:"多模态能力",children:(0,o.jsx)(j.A.Group,{value:D.filter(e=>el[e.key]).map(e=>e.key),options:D.map(e=>({label:e.label,value:e.key})),onChange:e=>es(Object.fromEntries(D.map(t=>[t.key,e.includes(t.key)])))})})]})}),(0,o.jsx)(b.A,{maskClosable:!1,title:e("models.editModel"),open:eu,onCancel:()=>{ep(!1),eh(""),ey(""),ev(""),ej(""),eA("openai"),eC(!1)},onOk:()=>{eM()},confirmLoading:eO,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("models.modelName"),children:(0,o.jsx)(g.A,{value:ef,onChange:e=>ey(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,o.jsx)(f.A.Item,{label:e("models.apiKey"),help:e("models.apiKeyEditHint"),children:(0,o.jsx)(g.A.Password,{value:eg,onFocus:()=>{eg.includes("•")&&ev("")},onCopy:e=>e.preventDefault(),onChange:e=>ev(e.target.value),placeholder:e("models.apiKeyEditPlaceholder")})}),(0,o.jsx)(f.A.Item,{label:e("models.baseUrl"),children:(0,o.jsx)(g.A,{value:eb,onChange:e=>ej(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,o.jsx)(f.A.Item,{label:e("models.protocol"),children:(0,o.jsx)(y.A,{value:ex,onChange:eA,options:z})}),(0,o.jsx)(f.A.Item,{label:"直连端点",tooltip:"开启后 Base URL 会作为完整请求地址使用,不再自动拼接接口路径。",children:(0,o.jsx)(j.A,{checked:ew,onChange:e=>eC(e.target.checked),children:"Base URL 是完整接口地址"})}),(0,o.jsx)(f.A.Item,{label:"多模态能力",children:(0,o.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=>eT(Object.fromEntries(D.map(t=>[t.key,e.includes(t.key)])))})})]})})]})}},29071:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var o=n(97109),a=n(78847),i=n(88483);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let l=o.forwardRef((e,t)=>o.createElement(i.A,r({},e,{ref:t,icon:a.A})))},30289:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"}},38770:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});let o=n(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"}},44624:(e,t,n)=>{"use strict";n.d(t,{$r:()=>a,BS:()=>r,kV:()=>i});let o=["parentNode"];function a(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function i(e,t){if(!e.length)return;let n=e.join("_");return t?`${t}_${n}`:o.includes(n)?`form_item_${n}`:n}function r(e,t,n,o,a,i){let r=o;return void 0!==i?r=i:n.validating?r="validating":e.length?r="error":t.length?r="warning":(n.touched||a&&n.validated)&&(r="success"),r}},77305:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return n(15527)}])},78847:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"}}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,4696,6985,288,4020,636,6593,8792],()=>e(e.s=77305)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1026],{2256:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(25341).A},12887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},15033:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=(0,r(97109).createContext)({})},23793:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"}},23830:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z"}}]},name:"folder",theme:"outlined"}},25258:(e,t,r)=>{"use strict";r.d(t,{A:()=>A});var o=r(51541),n=r(61848),s=r(1249),l=r(97109),a=r(72658),c=r(3638),i=r(92162),d=r(82725),u=r(74567),f=r(632),p=r(49517),h=r(79412),m=r(19527);let y=(0,d.U)(e=>{let{prefixCls:t,className:r,closeIcon:o,closable:n,type:s,title:d,children:y,footer:x,classNames:v,styles:j,...A}=e,{getPrefixCls:g}=l.useContext(u.QO),{className:w,style:$,classNames:b,styles:E}=(0,u.TP)("modal"),S=g(),C=t||g("modal"),O=(0,f.A)(S),[z,N]=(0,m.Ay)(C,O),[P,T]=(0,i.AV)([b,v],[E,j],{props:e}),k=`${C}-confirm`,F={};return F=s?{closable:n??!1,title:"",footer:"",children:l.createElement(p.k,{...e,prefixCls:C,confirmPrefixCls:k,rootPrefixCls:S,content:y})}:{closable:n??!0,title:d,footer:null!==x&&l.createElement(h.w,{...e}),children:y},l.createElement(a.Z,{prefixCls:C,className:(0,c.$)(z,`${C}-pure-panel`,s&&k,s&&`${k}-${s}`,r,w,N,O,P.root),style:{...$,...T.root},...A,closeIcon:(0,h.O)(C,o),closable:n,classNames:P,styles:T,...F})});var x=r(99739);function v(e){return(0,o.Ay)((0,o.fp)(e))}let j=s.A;j.useModal=x.A,j.info=function(e){return(0,o.Ay)((0,o.$D)(e))},j.success=function(e){return(0,o.Ay)((0,o.Ej)(e))},j.error=function(e){return(0,o.Ay)((0,o.jT)(e))},j.warning=v,j.warn=v,j.confirm=function(e){return(0,o.Ay)((0,o.lr)(e))},j.destroyAll=function(){for(;n.A.length;){let e=n.A.pop();e&&e()}},j.config=o.FB,j._InternalPanelDoNotUseOrYouWillBeFired=y;let A=j},25341:(e,t,r)=>{"use strict";r.d(t,{A:()=>f});var o=r(97109),n=r(3638),s=r(26047),l=r(19135),a=r(74567),c=r(59609),i=r(15033),d=r(84060);let u=(e,t)=>{let[r,n]=o.useState(()=>(0,s.Kg)(e)?e:"");return o.useEffect(()=>{(()=>{if((0,s.Kg)(e)&&n(e),(0,s.Qd)(e))for(let r=0;r<l.ye.length;r++){let o=l.ye[r];if(!t||!t[o])continue;let s=e[o];if(void 0!==s)return void n(s)}})()},[JSON.stringify(e),t]),r},f=o.forwardRef((e,t)=>{let{prefixCls:r,justify:f,align:p,className:h,style:m,children:y,gutter:x=0,wrap:v,...j}=e,{getPrefixCls:A,direction:g}=o.useContext(a.QO),w=(0,c.A)(!0,null),$=u(p,w),b=u(f,w),E=A("row",r),[S,C]=(0,d.L3)(E),O=function(e,t){let r=[void 0,void 0],o=Array.isArray(e)?e:[e,void 0],n=t||{xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0,xxxl:!0};return o.forEach((e,t)=>{if((0,s.Qd)(e))for(let o=0;o<l.ye.length;o++){let s=l.ye[o];if(n[s]&&void 0!==e[s]){r[t]=e[s];break}}else r[t]=e}),r}(x,w),z=(0,n.$)(E,{[`${E}-no-wrap`]:!1===v,[`${E}-${b}`]:b,[`${E}-${$}`]:$,[`${E}-rtl`]:"rtl"===g},h,S,C),N={};O?.[0]&&(N.marginInline=(0,s.Et)(O[0])?`${-(O[0]/2)}px`:`calc(${O[0]} / -2)`);let[P,T]=O;N.rowGap=T;let k=o.useMemo(()=>({gutter:[P,T],wrap:v}),[P,T,v]);return o.createElement(i.A.Provider,{value:k},o.createElement("div",{...j,className:z,style:{...N,...m},ref:t},y))})},26631:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var o=r(97109),n=r(12887),s=r(88483);function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(s.A,l({},e,{ref:t,icon:n.A})))},27549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(34508)}])},29606:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var o=r(97109),n=r(23830),s=r(88483);function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(s.A,l({},e,{ref:t,icon:n.A})))},34084:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"}},34508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>z});var o=r(65321),n=r(97109),s=r(64209),l=r(17807),a=r(85114),c=r(68787),i=r(11702),d=r(84253),u=r(2256),f=r(38770),p=r(56985),h=r(26171),m=r(33442),y=r(25258),x=r(7576),v=r(54746),j=r(29606),A=r(26631),g=r(99650),w=r(58209),$=r(58740);async function b(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function E(e,t){let r=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function S(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function C(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"自定义提示词",t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:e,content:"# ".concat(e,"\n")})});if(!t.ok)throw Error("Failed");return t.json()}async function O(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"select",selectedIds:e})});if(!t.ok)throw Error("Failed");return t.json()}function z(){var e;let t=(0,s.Vr)(),{message:r}=l.A.useApp(),[z,N]=(0,n.useState)(!0),[P,T]=(0,n.useState)([]),[k,F]=(0,n.useState)(!1),[R,H]=(0,n.useState)(null),[M,_]=(0,n.useState)(""),[B,I]=(0,n.useState)(!1),V=async()=>{N(!0);try{T(await b())}catch(e){r.error(t("common.error"))}finally{N(!1)}};(0,n.useEffect)(()=>{V()},[]);let W=async()=>{if(R){I(!0);try{await E(R.customizePath,M),r.success(t("common.success")),F(!1),await V()}catch(e){r.error(t("common.error"))}finally{I(!1)}}},L=async e=>{try{if(null==e?void 0:e.projectRoot)await S(e.projectRoot);else{var o;let e=null==(o=window.prompt("请输入自定义提示词名称","自定义提示词"))?void 0:o.trim();if(!e)return;await C(e)}r.success(t("common.success")),await V()}catch(e){r.error(t("common.error"))}},Q=async(e,o)=>{let n=o?Array.from(new Set([...P.filter(e=>e.selected).map(e=>e.id),e.id])):P.filter(t=>t.selected&&t.id!==e.id).map(e=>e.id);try{await O(n),T(e=>e.map(e=>({...e,selected:n.includes(e.id)})))}catch(e){r.error(t("common.error"))}},D=async e=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e.projectId,filePath:e.customizePath})})).ok)throw Error("Failed");r.success(t("common.success")),await V()}catch(e){r.error(t("common.error"))}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:t("nav.promptManagement")}),(0,o.jsx)("p",{className:"pageDesc",children:t("prompt.description")})]}),(0,o.jsx)(a.Ay,{type:"primary",icon:(0,o.jsx)(v.A,{}),onClick:()=>{L()},children:"创建提示词"})]}),P.find(e=>e.isCurrent)&&(0,o.jsx)(c.A,{size:"small",children:(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[(0,o.jsx)(i.A,{color:"green",style:{width:"fit-content"},children:"当前工作项目"}),(0,o.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,o.jsx)(j.A,{})," ",null==(e=P.find(e=>e.isCurrent))?void 0:e.projectRoot]})]})}),0!==P.length||z?null:(0,o.jsx)(d.A,{}),(0,o.jsx)(u.A,{gutter:[16,16],children:z?Array.from({length:3}).map((e,t)=>(0,o.jsx)(f.A,{xs:24,sm:12,lg:8,children:(0,o.jsx)(c.A,{loading:!0,size:"small"})},t)):P.map(e=>(0,o.jsx)(f.A,{xs:24,sm:12,lg:8,children:(0,o.jsxs)(c.A,{size:"small",title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(A.A,{})," ",e.projectName]}),extra:(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[e.hasFile&&(0,o.jsx)(p.A,{checked:e.selected,onChange:t=>{Q(e,t.target.checked)},children:"选中"}),!e.hasFile&&e.projectRoot&&(0,o.jsx)(a.Ay,{size:"small",type:"text",icon:(0,o.jsx)(v.A,{}),onClick:()=>{L(e)}}),e.hasFile&&(0,o.jsx)(a.Ay,{size:"small",type:"text",icon:(0,o.jsx)(g.A,{}),onClick:()=>{H(e),_(e.content||""),F(!0)}}),(0,o.jsx)(h.A,{title:"custom"===e.source?"删除自定义提示词?":"删除项目记录及其提示词文件?",disabled:e.id.startsWith("builtin:"),onConfirm:()=>{D(e)},children:(0,o.jsx)(a.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(w.A,{}),disabled:e.id.startsWith("builtin:")})})]}),children:[e.projectRoot&&(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:[(0,o.jsx)(j.A,{})," ",e.projectRoot]}),(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:[(0,o.jsx)($.A,{})," ",e.mtime?new Date(e.mtime).toLocaleString():t("common.never")]}),(0,o.jsxs)(m.A,{wrap:!0,children:[e.isCurrent&&(0,o.jsx)(i.A,{color:"green",children:"当前项目"}),e.selected&&(0,o.jsx)(i.A,{color:"purple",children:"已选中"}),e.id.startsWith("builtin:")?(0,o.jsx)(i.A,{color:"gold",children:"内置"}):"custom"===e.source&&(0,o.jsx)(i.A,{color:"cyan",children:"自定义"}),e.hasFile?(0,o.jsx)(i.A,{color:"blue",children:t("prompt.hasFile")}):(0,o.jsx)(i.A,{color:"default",children:t("prompt.noFile")})]}),e.hasFile&&e.content&&(0,o.jsxs)("div",{style:{marginTop:8,padding:8,background:"var(--colorBgSecondary)",borderRadius:8,fontSize:12,maxHeight:80,overflow:"hidden",color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap"},children:[e.content.slice(0,200),e.content.length>200?"...":""]})]})},e.id))}),0===P.length&&(0,o.jsx)(c.A,{size:"small",children:(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:t("prompt.noProjects")})}),(0,o.jsxs)(y.A,{maskClosable:!1,title:"".concat(t("common.edit")," — ").concat((null==R?void 0:R.projectName)||""),open:k,width:800,onCancel:()=>F(!1),onOk:()=>{W()},confirmLoading:B,children:[(0,o.jsx)("div",{style:{marginBottom:12,fontSize:12,color:"var(--colorTextSecondary)"},children:null==R?void 0:R.customizePath}),(0,o.jsx)(x.A.TextArea,{value:M,onChange:e=>_(e.target.value),rows:25,style:{fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13}})]})]})}},38770:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(51916).A},51916:(e,t,r)=>{"use strict";r.d(t,{A:()=>f});var o=r(97109),n=r(3638),s=r(26047),l=r(19135),a=r(74567),c=r(10540),i=r(15033),d=r(84060);function u(e){return"auto"===e?"1 1 auto":(0,s.Et)(e)?`${e} ${e} auto`:/^\d+(\.\d+)?(px|em|rem|%)$/.test(e)?`0 0 ${e}`:e}let f=o.forwardRef((e,t)=>{let{getPrefixCls:r,direction:f}=o.useContext(a.QO),{gutter:p,wrap:h}=o.useContext(i.A),{prefixCls:m,span:y,order:x,offset:v,push:j,pull:A,className:g,children:w,flex:$,style:b,...E}=e,S=r("col",m),C=r(),[O,z]=(0,d.xV)(S),[N]=(0,c.PN)(C,"col"),P={},T={};l.Gl.forEach(t=>{let r={},o=e[t];(0,s.Et)(o)?r.span=o:(0,s.Qd)(o)&&(r=o||{}),delete E[t],T={...T,[`${S}-${t}-${r.span}`]:(0,s.R)(r.span),[`${S}-${t}-order-${r.order}`]:r.order||0===r.order,[`${S}-${t}-offset-${r.offset}`]:r.offset||0===r.offset,[`${S}-${t}-push-${r.push}`]:r.push||0===r.push,[`${S}-${t}-pull-${r.pull}`]:r.pull||0===r.pull,[`${S}-rtl`]:"rtl"===f},r.flex&&(T[`${S}-${t}-flex`]=!0,P[N(`${t}-flex`)]=u(r.flex))});let k=(0,n.$)(S,{[`${S}-${y}`]:void 0!==y,[`${S}-order-${x}`]:x,[`${S}-offset-${v}`]:v,[`${S}-push-${j}`]:j,[`${S}-pull-${A}`]:A},g,T,O,z),F={};return p?.[0]&&(F.paddingInline=(0,s.Et)(p[0])?`${p[0]/2}px`:`calc(${p[0]} / 2)`),$&&(F.flex=u($),!1!==h||F.minWidth||(F.minWidth=0)),o.createElement("div",{...E,style:{...F,...b,...P},className:k,ref:t},w)})},58209:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var o=r(97109),n=r(23793),s=r(88483);function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(s.A,l({},e,{ref:t,icon:n.A})))},58740:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var o=r(97109),n=r(34084),s=r(88483);function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(s.A,l({},e,{ref:t,icon:n.A})))},82725:(e,t,r)=>{"use strict";r.d(t,{A:()=>c,U:()=>a});var o=r(97109),n=r(42644),s=r(48921),l=r(74567);function a(e){return t=>o.createElement(s.Ay,{theme:{token:{motion:!1,zIndexPopupBase:0}}},o.createElement(e,{...t}))}let c=(e,t,r,s,c)=>a(a=>{let{prefixCls:i,style:d}=a,u=o.useRef(null),[f,p]=o.useState(0),[h,m]=o.useState(0),[y,x]=(0,n.PW)(!1,a.open),{getPrefixCls:v}=o.useContext(l.QO),j=v(s||"select",i);o.useEffect(()=>{if(x(!0),"undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{let t=e[0].target;p(t.offsetHeight+8),m(t.offsetWidth)}),t=setInterval(()=>{let r=c?`.${c(j)}`:`.${j}-dropdown`,o=u.current?.querySelector(r);o&&(clearInterval(t),e.observe(o))},10);return()=>{clearInterval(t),e.disconnect()}}},[j]);let A={...a,style:{...d,margin:0},open:y,getPopupContainer:()=>u.current};return r&&(A=r(A)),t&&(A={...A,[t]:{overflow:{adjustX:!1,adjustY:!1}}}),o.createElement("div",{ref:u,style:{paddingBottom:f,position:"relative",minWidth:h}},o.createElement(e,{...A}))})}},e=>{e.O(0,[4260,7167,9382,8628,7576,4696,6985,636,6593,8792],()=>e(e.s=27549)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1026],{2256:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(25341).A},12887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},15033:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=(0,r(97109).createContext)({})},23793:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"}},23830:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z"}}]},name:"folder",theme:"outlined"}},25258:(e,t,r)=>{"use strict";r.d(t,{A:()=>A});var o=r(51541),n=r(61848),s=r(1249),l=r(97109),i=r(72658),a=r(3638),c=r(92162),d=r(82725),u=r(74567),f=r(632),p=r(49517),h=r(79412),m=r(19527);let y=(0,d.U)(e=>{let{prefixCls:t,className:r,closeIcon:o,closable:n,type:s,title:d,children:y,footer:x,classNames:v,styles:j,...A}=e,{getPrefixCls:g}=l.useContext(u.QO),{className:w,style:$,classNames:b,styles:E}=(0,u.TP)("modal"),S=g(),C=t||g("modal"),O=(0,f.A)(S),[z,N]=(0,m.Ay)(C,O),[P,T]=(0,c.AV)([b,v],[E,j],{props:e}),k=`${C}-confirm`,F={};return F=s?{closable:n??!1,title:"",footer:"",children:l.createElement(p.k,{...e,prefixCls:C,confirmPrefixCls:k,rootPrefixCls:S,content:y})}:{closable:n??!0,title:d,footer:null!==x&&l.createElement(h.w,{...e}),children:y},l.createElement(i.Z,{prefixCls:C,className:(0,a.$)(z,`${C}-pure-panel`,s&&k,s&&`${k}-${s}`,r,w,N,O,P.root),style:{...$,...T.root},...A,closeIcon:(0,h.O)(C,o),closable:n,classNames:P,styles:T,...F})});var x=r(99739);function v(e){return(0,o.Ay)((0,o.fp)(e))}let j=s.A;j.useModal=x.A,j.info=function(e){return(0,o.Ay)((0,o.$D)(e))},j.success=function(e){return(0,o.Ay)((0,o.Ej)(e))},j.error=function(e){return(0,o.Ay)((0,o.jT)(e))},j.warning=v,j.warn=v,j.confirm=function(e){return(0,o.Ay)((0,o.lr)(e))},j.destroyAll=function(){for(;n.A.length;){let e=n.A.pop();e&&e()}},j.config=o.FB,j._InternalPanelDoNotUseOrYouWillBeFired=y;let A=j},25341:(e,t,r)=>{"use strict";r.d(t,{A:()=>f});var o=r(97109),n=r(3638),s=r(26047),l=r(19135),i=r(74567),a=r(59609),c=r(15033),d=r(84060);let u=(e,t)=>{let[r,n]=o.useState(()=>(0,s.Kg)(e)?e:"");return o.useEffect(()=>{(()=>{if((0,s.Kg)(e)&&n(e),(0,s.Qd)(e))for(let r=0;r<l.ye.length;r++){let o=l.ye[r];if(!t||!t[o])continue;let s=e[o];if(void 0!==s)return void n(s)}})()},[JSON.stringify(e),t]),r},f=o.forwardRef((e,t)=>{let{prefixCls:r,justify:f,align:p,className:h,style:m,children:y,gutter:x=0,wrap:v,...j}=e,{getPrefixCls:A,direction:g}=o.useContext(i.QO),w=(0,a.A)(!0,null),$=u(p,w),b=u(f,w),E=A("row",r),[S,C]=(0,d.L3)(E),O=function(e,t){let r=[void 0,void 0],o=Array.isArray(e)?e:[e,void 0],n=t||{xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0,xxxl:!0};return o.forEach((e,t)=>{if((0,s.Qd)(e))for(let o=0;o<l.ye.length;o++){let s=l.ye[o];if(n[s]&&void 0!==e[s]){r[t]=e[s];break}}else r[t]=e}),r}(x,w),z=(0,n.$)(E,{[`${E}-no-wrap`]:!1===v,[`${E}-${b}`]:b,[`${E}-${$}`]:$,[`${E}-rtl`]:"rtl"===g},h,S,C),N={};O?.[0]&&(N.marginInline=(0,s.Et)(O[0])?`${-(O[0]/2)}px`:`calc(${O[0]} / -2)`);let[P,T]=O;N.rowGap=T;let k=o.useMemo(()=>({gutter:[P,T],wrap:v}),[P,T,v]);return o.createElement(c.A.Provider,{value:k},o.createElement("div",{...j,className:z,style:{...N,...m},ref:t},y))})},26631:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var o=r(97109),n=r(12887),s=r(88483);function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let i=o.forwardRef((e,t)=>o.createElement(s.A,l({},e,{ref:t,icon:n.A})))},27549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(34508)}])},29606:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var o=r(97109),n=r(23830),s=r(88483);function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let i=o.forwardRef((e,t)=>o.createElement(s.A,l({},e,{ref:t,icon:n.A})))},34084:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"}},34508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>z});var o=r(65321),n=r(97109),s=r(64209),l=r(17807),i=r(85114),a=r(68787),c=r(11702),d=r(84253),u=r(2256),f=r(38770),p=r(33442),h=r(56985),m=r(26171),y=r(25258),x=r(7576),v=r(54746),j=r(29606),A=r(26631),g=r(99650),w=r(58209),$=r(58740);async function b(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function E(e,t){let r=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function S(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function C(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"自定义提示词",t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:e,content:"# ".concat(e,"\n")})});if(!t.ok)throw Error("Failed");return t.json()}async function O(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"select",selectedIds:e})});if(!t.ok)throw Error("Failed");return t.json()}function z(){var e;let t=(0,s.Vr)(),{message:r}=l.A.useApp(),[z,N]=(0,n.useState)(!0),[P,T]=(0,n.useState)([]),[k,F]=(0,n.useState)(!1),[R,H]=(0,n.useState)(null),[M,_]=(0,n.useState)(""),[B,I]=(0,n.useState)(!1),V=async()=>{N(!0);try{T(await b())}catch(e){r.error(t("common.error"))}finally{N(!1)}};(0,n.useEffect)(()=>{V()},[]);let W=async()=>{if(R){I(!0);try{await E(R.customizePath,M),r.success(t("common.success")),F(!1),await V()}catch(e){r.error(t("common.error"))}finally{I(!1)}}},L=async e=>{try{if(null==e?void 0:e.projectRoot)await S(e.projectRoot);else{var o;let e=null==(o=window.prompt("请输入自定义提示词名称","自定义提示词"))?void 0:o.trim();if(!e)return;await C(e)}r.success(t("common.success")),await V()}catch(e){r.error(t("common.error"))}},Q=async(e,o)=>{let n=o?Array.from(new Set([...P.filter(e=>e.selected).map(e=>e.id),e.id])):P.filter(t=>t.selected&&t.id!==e.id).map(e=>e.id);try{await O(n),T(e=>e.map(e=>({...e,selected:n.includes(e.id)})))}catch(e){r.error(t("common.error"))}},D=async e=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e.projectId,filePath:e.customizePath})})).ok)throw Error("Failed");r.success(t("common.success")),await V()}catch(e){r.error(t("common.error"))}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:t("nav.promptManagement")}),(0,o.jsx)("p",{className:"pageDesc",children:t("prompt.description")})]}),(0,o.jsx)(i.Ay,{type:"primary",icon:(0,o.jsx)(v.A,{}),onClick:()=>{L()},children:"创建提示词"})]}),P.find(e=>e.isCurrent)&&(0,o.jsx)(a.A,{size:"small",children:(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[(0,o.jsx)(c.A,{color:"green",style:{width:"fit-content"},children:"当前工作项目"}),(0,o.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,o.jsx)(j.A,{})," ",null==(e=P.find(e=>e.isCurrent))?void 0:e.projectRoot]})]})}),0!==P.length||z?null:(0,o.jsx)(d.A,{}),(0,o.jsx)(u.A,{gutter:[16,16],children:z?Array.from({length:3}).map((e,t)=>(0,o.jsx)(f.A,{xs:24,sm:12,lg:8,children:(0,o.jsx)(a.A,{loading:!0,size:"small"})},t)):P.map((e,r)=>(0,o.jsx)(f.A,{xs:24,sm:12,lg:8,children:(0,o.jsxs)(a.A,{size:"small",title:(0,o.jsxs)(p.A,{size:6,children:[(0,o.jsxs)(c.A,{children:["序号 ",r+1]}),(0,o.jsx)(A.A,{})," ",e.projectName]}),extra:(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[e.hasFile&&(0,o.jsx)(h.A,{checked:e.selected,onChange:t=>{Q(e,t.target.checked)},children:"选中"}),!e.hasFile&&e.projectRoot&&(0,o.jsx)(i.Ay,{size:"small",type:"text",icon:(0,o.jsx)(v.A,{}),onClick:()=>{L(e)}}),e.hasFile&&(0,o.jsx)(i.Ay,{size:"small",type:"text",icon:(0,o.jsx)(g.A,{}),onClick:()=>{H(e),_(e.content||""),F(!0)}}),(0,o.jsx)(m.A,{title:"custom"===e.source?"删除自定义提示词?":"删除项目记录及其提示词文件?",disabled:e.id.startsWith("builtin:"),onConfirm:()=>{D(e)},children:(0,o.jsx)(i.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(w.A,{}),disabled:e.id.startsWith("builtin:")})})]}),children:[e.projectRoot&&(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:[(0,o.jsx)(j.A,{})," ",e.projectRoot]}),(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:[(0,o.jsx)($.A,{})," ",e.mtime?new Date(e.mtime).toLocaleString():t("common.never")]}),(0,o.jsxs)(p.A,{wrap:!0,children:[e.isCurrent&&(0,o.jsx)(c.A,{color:"green",children:"当前项目"}),e.selected&&(0,o.jsx)(c.A,{color:"purple",children:"已选中"}),e.id.startsWith("builtin:")?(0,o.jsx)(c.A,{color:"gold",children:"内置"}):"custom"===e.source&&(0,o.jsx)(c.A,{color:"cyan",children:"自定义"}),e.hasFile?(0,o.jsx)(c.A,{color:"blue",children:t("prompt.hasFile")}):(0,o.jsx)(c.A,{color:"default",children:t("prompt.noFile")})]}),e.hasFile&&e.content&&(0,o.jsxs)("div",{style:{marginTop:8,padding:8,background:"var(--colorBgSecondary)",borderRadius:8,fontSize:12,maxHeight:80,overflow:"hidden",color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap"},children:[e.content.slice(0,200),e.content.length>200?"...":""]})]})},e.id))}),0===P.length&&(0,o.jsx)(a.A,{size:"small",children:(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:t("prompt.noProjects")})}),(0,o.jsxs)(y.A,{maskClosable:!1,title:"".concat(t("common.edit")," — ").concat((null==R?void 0:R.projectName)||""),open:k,width:800,onCancel:()=>F(!1),onOk:()=>{W()},confirmLoading:B,children:[(0,o.jsx)("div",{style:{marginBottom:12,fontSize:12,color:"var(--colorTextSecondary)"},children:null==R?void 0:R.customizePath}),(0,o.jsx)(x.A.TextArea,{value:M,onChange:e=>_(e.target.value),rows:25,style:{fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13}})]})]})}},38770:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(51916).A},51916:(e,t,r)=>{"use strict";r.d(t,{A:()=>f});var o=r(97109),n=r(3638),s=r(26047),l=r(19135),i=r(74567),a=r(10540),c=r(15033),d=r(84060);function u(e){return"auto"===e?"1 1 auto":(0,s.Et)(e)?`${e} ${e} auto`:/^\d+(\.\d+)?(px|em|rem|%)$/.test(e)?`0 0 ${e}`:e}let f=o.forwardRef((e,t)=>{let{getPrefixCls:r,direction:f}=o.useContext(i.QO),{gutter:p,wrap:h}=o.useContext(c.A),{prefixCls:m,span:y,order:x,offset:v,push:j,pull:A,className:g,children:w,flex:$,style:b,...E}=e,S=r("col",m),C=r(),[O,z]=(0,d.xV)(S),[N]=(0,a.PN)(C,"col"),P={},T={};l.Gl.forEach(t=>{let r={},o=e[t];(0,s.Et)(o)?r.span=o:(0,s.Qd)(o)&&(r=o||{}),delete E[t],T={...T,[`${S}-${t}-${r.span}`]:(0,s.R)(r.span),[`${S}-${t}-order-${r.order}`]:r.order||0===r.order,[`${S}-${t}-offset-${r.offset}`]:r.offset||0===r.offset,[`${S}-${t}-push-${r.push}`]:r.push||0===r.push,[`${S}-${t}-pull-${r.pull}`]:r.pull||0===r.pull,[`${S}-rtl`]:"rtl"===f},r.flex&&(T[`${S}-${t}-flex`]=!0,P[N(`${t}-flex`)]=u(r.flex))});let k=(0,n.$)(S,{[`${S}-${y}`]:void 0!==y,[`${S}-order-${x}`]:x,[`${S}-offset-${v}`]:v,[`${S}-push-${j}`]:j,[`${S}-pull-${A}`]:A},g,T,O,z),F={};return p?.[0]&&(F.paddingInline=(0,s.Et)(p[0])?`${p[0]/2}px`:`calc(${p[0]} / 2)`),$&&(F.flex=u($),!1!==h||F.minWidth||(F.minWidth=0)),o.createElement("div",{...E,style:{...F,...b,...P},className:k,ref:t},w)})},58209:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var o=r(97109),n=r(23793),s=r(88483);function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let i=o.forwardRef((e,t)=>o.createElement(s.A,l({},e,{ref:t,icon:n.A})))},58740:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var o=r(97109),n=r(34084),s=r(88483);function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let i=o.forwardRef((e,t)=>o.createElement(s.A,l({},e,{ref:t,icon:n.A})))},82725:(e,t,r)=>{"use strict";r.d(t,{A:()=>a,U:()=>i});var o=r(97109),n=r(42644),s=r(48921),l=r(74567);function i(e){return t=>o.createElement(s.Ay,{theme:{token:{motion:!1,zIndexPopupBase:0}}},o.createElement(e,{...t}))}let a=(e,t,r,s,a)=>i(i=>{let{prefixCls:c,style:d}=i,u=o.useRef(null),[f,p]=o.useState(0),[h,m]=o.useState(0),[y,x]=(0,n.PW)(!1,i.open),{getPrefixCls:v}=o.useContext(l.QO),j=v(s||"select",c);o.useEffect(()=>{if(x(!0),"undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{let t=e[0].target;p(t.offsetHeight+8),m(t.offsetWidth)}),t=setInterval(()=>{let r=a?`.${a(j)}`:`.${j}-dropdown`,o=u.current?.querySelector(r);o&&(clearInterval(t),e.observe(o))},10);return()=>{clearInterval(t),e.disconnect()}}},[j]);let A={...i,style:{...d,margin:0},open:y,getPopupContainer:()=>u.current};return r&&(A=r(A)),t&&(A={...A,[t]:{overflow:{adjustX:!1,adjustY:!1}}}),o.createElement("div",{ref:u,style:{paddingBottom:f,position:"relative",minWidth:h}},o.createElement(e,{...A}))})}},e=>{e.O(0,[4260,7167,9382,8628,7576,4696,6985,636,6593,8792],()=>e(e.s=27549)),_N_E=e.O()}]);
|
package/.next/static/chunks/pages/system/{logs-37b0989401612947.js → logs-7a90a654d4931f5f.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3979],{6578:(e,n,t)=>{"use strict";async function o(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function a(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(n))}async function i(e){var n,t;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(t=e.limit)?t:50)),o("/api/kb/files?".concat(a))}async function 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 s(e,n,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function d(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 l(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 d(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 y(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function f(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function h(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function m(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function w(){return o("/api/kb/features")}async function S(e,n){var t,a,i,r,c;let s=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&s.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&s.set("category",n.category),(null==n?void 0:n.limit)&&s.set("limit",String(null!=(c=n.limit)?c:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&s.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(a=n.weights)?void 0:a.vector)!=null&&s.set("vectorWeight",String(n.weights.vector)),(null==n||null==(i=n.weights)?void 0:i.rewrite)!=null&&s.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(r=n.weights)?void 0:r.hybridBonus)!=null&&s.set("hybridBonus",String(n.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function T(){return o("/api/prompt")}async function b(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function j(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function x(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function C(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(){return o("/api/documents/specs")}async function N(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function k(){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 R(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function J(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 I(){return o("/api/documents/generated")}async function L(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function A(e,n){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function D(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function _(){return o("/api/assets/generated")}async function H(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 z(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 W(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 F(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),t=n.headers.get("content-type")||"",o=async()=>{let e=await n.text(),t=e||"导出失败";try{var o;let n=JSON.parse(e),a=null==(o=n.issues)?void 0:o.map(e=>e.message).filter(Boolean).slice(0,3).join(";");t=a?"".concat(n.error||"导出失败",":").concat(a):n.error||t}catch(e){}throw Error(t.length>300?"".concat(t.slice(0,300),"..."):t)};return n.ok||await o(),"pdf"!==e.format||t.includes("application/pdf")||await o(),"docx"!==e.format||t.includes("officedocument.wordprocessingml.document")||await o(),n.blob()}async function Q(){return o("/api/config/providers")}async function X(e,n){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function V(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function K(){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 G(){return o("/api/config/embedding")}async function M(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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return o("/api/system/logs?limit=".concat(e))}async function et(){return o("/api/system/logs",{method:"DELETE"})}async function eo(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function ea(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function ei(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function er(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ec(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function es(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ed(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>q,Bh:()=>ed,Dl:()=>k,E:()=>er,EK:()=>N,ER:()=>v,FC:()=>ee,FV:()=>x,H1:()=>g,H7:()=>y,HC:()=>c,HT:()=>i,II:()=>G,JU:()=>H,NR:()=>C,OX:()=>U,PH:()=>ei,QG:()=>D,QT:()=>p,Qx:()=>u,R1:()=>W,SJ:()=>h,UE:()=>F,VW:()=>w,W2:()=>S,X8:()=>m,Z3:()=>Q,_m:()=>X,a6:()=>A,aP:()=>Z,bV:()=>J,bZ:()=>Y,c1:()=>l,cQ:()=>I,dd:()=>M,dg:()=>j,dw:()=>E,dx:()=>T,f$:()=>_,h0:()=>R,h1:()=>V,hH:()=>et,hc:()=>a,hn:()=>eo,l2:()=>P,lv:()=>b,mx:()=>O,oH:()=>en,oS:()=>z,p:()=>ea,tn:()=>s,u6:()=>$,uc:()=>B,v7:()=>L,xC:()=>r,xq:()=>f,xw:()=>ec,zo:()=>es,zr:()=>K})},39214:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/system/logs",function(){return t(91698)}])},91698:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>S});var o=t(65321),a=t(97109),i=t(35292),r=t(9137),c=t(11702),s=t(33442),d=t(85114),l=t(26171),p=t(85493),u=t(68787),y=t(7576),f=t(59400),h=t(84253),m=t(6578);let{Text:g,Paragraph:w}=i.A;function S(){let[e,n]=(0,a.useState)([]),[t,i]=(0,a.useState)(!1),[S,T]=(0,a.useState)(""),b=async()=>{i(!0);try{let e=await (0,m.oH)(500);n(e.logs)}catch(e){r.Ay.error(e instanceof Error?e.message:"加载日志失败")}finally{i(!1)}};(0,a.useEffect)(()=>{b()},[]);let j=(0,a.useMemo)(()=>{let n=S.trim().toLowerCase();return n?e.filter(e=>[e.id,e.level,e.source,e.functionName,e.message,e.stack].filter(Boolean).some(e=>String(e).toLowerCase().includes(n))):e},[S,e]),x=[{title:"时间",dataIndex:"createdAt",width:180,render:e=>new Date(e).toLocaleString()},{title:"级别",dataIndex:"level",width:90,render:e=>(0,o.jsx)(c.A,{color:"error"===e?"error":"warn"===e?"warning":"blue",children:e})},{title:"来源",dataIndex:"source",width:220,render:e=>(0,o.jsx)(g,{code:!0,children:e})},{title:"函数",dataIndex:"functionName",width:180,render:e=>e?(0,o.jsx)(g,{code:!0,children:e}):(0,o.jsx)(g,{type:"secondary",children:"-"})},{title:"错误信息",dataIndex:"message",render:e=>(0,o.jsx)(w,{className:"mb-0",style:{maxWidth:520,overflowWrap:"anywhere",wordBreak:"break-all"},ellipsis:{rows:2,expandable:!0,symbol:"展开"},children:e})},{title:"Request ID",dataIndex:"id",width:210,render:e=>(0,o.jsx)(g,{copyable:!0,code:!0,children:e})}];return(0,o.jsxs)("div",{className:"space-y-4",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",children:"系统日志"}),(0,o.jsx)("p",{className:"pageDesc",children:"查看 API 异常、模型健康检查失败、PDF 降级等运行时问题。"})]}),(0,o.jsxs)(s.A,{wrap:!0,children:[(0,o.jsx)(d.Ay,{onClick:()=>void b(),loading:t,children:"刷新"}),(0,o.jsx)(l.A,{title:"确认清空所有错误日志?",onConfirm:()=>{(async()=>{await (0,m.hH)(),r.Ay.success("已清空"),await b()})()},children:(0,o.jsx)(d.Ay,{danger:!0,children:"清空日志"})})]})]}),(0,o.jsx)(p.A,{type:"info",showIcon:!0,message:"日志保存在本机 ~/.customize-agent/logs/errors.jsonl,最多读取最近 500 条。"}),(0,o.jsx)(u.A,{size:"small",children:(0,o.jsxs)(s.A,{direction:"vertical",className:"w-full",size:"middle",children:[(0,o.jsx)(y.A.Search,{allowClear:!0,placeholder:"搜索 requestId / source / function / message / stack",value:S,onChange:e=>T(e.target.value)}),(0,o.jsx)(f.A,{rowKey:"id",loading:t,dataSource:j,columns:x,locale:{emptyText:(0,o.jsx)(h.A,{description:"暂无错误日志"})},pagination:{pageSize:20,showSizeChanger:!0},expandable:{expandedRowRender:e=>(0,o.jsxs)(s.A,{direction:"vertical",className:"w-full",size:"small",children:[e.request&&(0,o.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:JSON.stringify(e.request,null,2)}),void 0!==e.meta&&(0,o.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:JSON.stringify(e.meta,null,2)}),e.stack&&(0,o.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:e.stack})]})}})]})})]})}}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,2700,5174,4696,6985,9400,5292,861,636,6593,8792],()=>e(e.s=39214)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3979],{6578:(e,n,t)=>{"use strict";async function o(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function a(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(n))}async function i(e){var n,t;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(t=e.limit)?t:50)),o("/api/kb/files?".concat(a))}async function 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 s(e,n,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function d(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 l(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 d(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 y(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function h(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function f(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function m(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function w(){return o("/api/kb/features")}async function S(e,n){var t,a,i,r,c;let s=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&s.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&s.set("category",n.category),(null==n?void 0:n.limit)&&s.set("limit",String(null!=(c=n.limit)?c:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&s.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(a=n.weights)?void 0:a.vector)!=null&&s.set("vectorWeight",String(n.weights.vector)),(null==n||null==(i=n.weights)?void 0:i.rewrite)!=null&&s.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(r=n.weights)?void 0:r.hybridBonus)!=null&&s.set("hybridBonus",String(n.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function T(){return o("/api/prompt")}async function b(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function j(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function x(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function C(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(){return o("/api/documents/specs")}async function N(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function k(){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 R(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function J(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 I(){return o("/api/documents/generated")}async function L(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function A(e,n){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function D(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function _(){return o("/api/assets/generated")}async function H(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 z(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 W(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 F(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),t=n.headers.get("content-type")||"",o=async()=>{let e=await n.text(),t=e||"导出失败";try{var o;let n=JSON.parse(e),a=null==(o=n.issues)?void 0:o.map(e=>e.message).filter(Boolean).slice(0,3).join(";");t=a?"".concat(n.error||"导出失败",":").concat(a):n.error||t}catch(e){}throw Error(t.length>300?"".concat(t.slice(0,300),"..."):t)};return n.ok||await o(),"pdf"!==e.format||t.includes("application/pdf")||await o(),"docx"!==e.format||t.includes("officedocument.wordprocessingml.document")||await o(),n.blob()}async function Q(){return o("/api/config/providers")}async function X(e,n){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function V(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function K(){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 G(){return o("/api/config/embedding")}async function M(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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return o("/api/system/logs?limit=".concat(e))}async function et(){return o("/api/system/logs",{method:"DELETE"})}async function eo(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function ea(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function ei(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function er(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ec(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function es(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ed(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>q,Bh:()=>ed,Dl:()=>k,E:()=>er,EK:()=>N,ER:()=>v,FC:()=>ee,FV:()=>x,H1:()=>g,H7:()=>y,HC:()=>c,HT:()=>i,II:()=>G,JU:()=>H,NR:()=>C,OX:()=>U,PH:()=>ei,QG:()=>D,QT:()=>p,Qx:()=>u,R1:()=>W,SJ:()=>f,UE:()=>F,VW:()=>w,W2:()=>S,X8:()=>m,Z3:()=>Q,_m:()=>X,a6:()=>A,aP:()=>Z,bV:()=>J,bZ:()=>Y,c1:()=>l,cQ:()=>I,dd:()=>M,dg:()=>j,dw:()=>E,dx:()=>T,f$:()=>_,h0:()=>R,h1:()=>V,hH:()=>et,hc:()=>a,hn:()=>eo,l2:()=>P,lv:()=>b,mx:()=>O,oH:()=>en,oS:()=>z,p:()=>ea,tn:()=>s,u6:()=>$,uc:()=>B,v7:()=>L,xC:()=>r,xq:()=>h,xw:()=>ec,zo:()=>es,zr:()=>K})},39214:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/system/logs",function(){return t(91698)}])},91698:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>S});var o=t(65321),a=t(97109),i=t(35292),r=t(9137),c=t(11702),s=t(33442),d=t(85114),l=t(26171),p=t(85493),u=t(68787),y=t(7576),h=t(59400),f=t(84253),m=t(6578);let{Text:g,Paragraph:w}=i.A;function S(){let[e,n]=(0,a.useState)([]),[t,i]=(0,a.useState)(!1),[S,T]=(0,a.useState)(""),b=async()=>{i(!0);try{let e=await (0,m.oH)(500);n(e.logs)}catch(e){r.Ay.error(e instanceof Error?e.message:"加载日志失败")}finally{i(!1)}};(0,a.useEffect)(()=>{b()},[]);let j=(0,a.useMemo)(()=>{let n=S.trim().toLowerCase();return n?e.filter(e=>[e.id,e.level,e.source,e.functionName,e.message,e.stack].filter(Boolean).some(e=>String(e).toLowerCase().includes(n))):e},[S,e]),x=[{title:"序号",key:"index",width:70,render:(e,n,t)=>t+1},{title:"时间",dataIndex:"createdAt",width:180,render:e=>new Date(e).toLocaleString()},{title:"级别",dataIndex:"level",width:90,render:e=>(0,o.jsx)(c.A,{color:"error"===e?"error":"warn"===e?"warning":"blue",children:e})},{title:"来源",dataIndex:"source",width:220,render:e=>(0,o.jsx)(g,{code:!0,children:e})},{title:"函数",dataIndex:"functionName",width:180,render:e=>e?(0,o.jsx)(g,{code:!0,children:e}):(0,o.jsx)(g,{type:"secondary",children:"-"})},{title:"错误信息",dataIndex:"message",render:e=>(0,o.jsx)(w,{className:"mb-0",style:{maxWidth:520,overflowWrap:"anywhere",wordBreak:"break-all"},ellipsis:{rows:2,expandable:!0,symbol:"展开"},children:e})},{title:"Request ID",dataIndex:"id",width:210,render:e=>(0,o.jsx)(g,{copyable:!0,code:!0,children:e})}];return(0,o.jsxs)("div",{className:"space-y-4",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",children:"系统日志"}),(0,o.jsx)("p",{className:"pageDesc",children:"查看 API 异常、模型健康检查失败、PDF 降级等运行时问题。"})]}),(0,o.jsxs)(s.A,{wrap:!0,children:[(0,o.jsx)(d.Ay,{onClick:()=>void b(),loading:t,children:"刷新"}),(0,o.jsx)(l.A,{title:"确认清空所有错误日志?",onConfirm:()=>{(async()=>{await (0,m.hH)(),r.Ay.success("已清空"),await b()})()},children:(0,o.jsx)(d.Ay,{danger:!0,children:"清空日志"})})]})]}),(0,o.jsx)(p.A,{type:"info",showIcon:!0,message:"日志保存在本机 ~/.customize-agent/logs/errors.jsonl,最多读取最近 500 条。"}),(0,o.jsx)(u.A,{size:"small",children:(0,o.jsxs)(s.A,{direction:"vertical",className:"w-full",size:"middle",children:[(0,o.jsx)(y.A.Search,{allowClear:!0,placeholder:"搜索 requestId / source / function / message / stack",value:S,onChange:e=>T(e.target.value)}),(0,o.jsx)(h.A,{rowKey:"id",loading:t,dataSource:j,columns:x,locale:{emptyText:(0,o.jsx)(f.A,{description:"暂无错误日志"})},pagination:{pageSize:20,showSizeChanger:!0},expandable:{expandedRowRender:e=>(0,o.jsxs)(s.A,{direction:"vertical",className:"w-full",size:"small",children:[e.request&&(0,o.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:JSON.stringify(e.request,null,2)}),void 0!==e.meta&&(0,o.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:JSON.stringify(e.meta,null,2)}),e.stack&&(0,o.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:e.stack})]})}})]})})]})}}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,2700,5174,4696,6985,9400,5292,861,636,6593,8792],()=>e(e.s=39214)),_N_E=e.O()}]);
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[893],{260:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>k});var n=s(65321),a=s(97109),r=s(64209),o=s(17807),c=s(11702),l=s(85114),i=s(26171),d=s(33442),m=s(7576),x=s(68787),u=s(54849),h=s(59400),j=s(25258),p=s(63455),A=s(99650),w=s(58209),y=s(30486),g=s(83374),f=s(8383),_=s(26619),v=s(53998),S=s(6578),C=s(45551);let z={project_fact:"项目知识",user_preference:"用户偏好",feedback:"历史纠偏",pattern:"解决方案"},N={high:"red",medium:"orange",low:"default"};function k(){let e=(0,r.Vr)(),{message:t}=o.A.useApp(),[s,k]=(0,a.useState)(!0),[I,E]=(0,a.useState)([]),[T,b]=(0,a.useState)({count:0,totalBytes:0}),[P,B]=(0,a.useState)(""),[D,O]=(0,a.useState)(!1),[H,L]=(0,a.useState)(null),[X,F]=(0,a.useState)(""),[K,M]=(0,a.useState)(""),[V,q]=(0,a.useState)(!1),G=async s=>{k(!0);try{let[e,t]=await Promise.all([(0,S.hn)("long_term",s),(0,S.p)("long_term")]);E(e),b(t)}catch(s){t.error(e("common.error"))}finally{k(!1)}};(0,a.useEffect)(()=>{G()},[]);let J=async s=>{try{await (0,S.xw)(s),t.success(e("common.success")),await G(P)}catch(s){t.error(e("common.error"))}},Q=async()=>{try{await (0,S.PH)("long_term"),t.success(e("common.success")),await G(P)}catch(s){t.error(e("common.error"))}},R=async()=>{try{await (0,S.E)("long_term"),t.success(e("common.success")),await G(P)}catch(s){t.error(e("common.error"))}},U=async()=>{if(H&&X.trim()){q(!0);try{await (0,S.zo)(H.id,{content:X.trim(),context:K||void 0}),t.success(e("common.success")),O(!1),await G(P)}catch(s){t.error(e("common.error"))}finally{q(!1)}}},W=[{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:"类型",dataIndex:"type",width:90,render:e=>(0,n.jsx)(c.A,{children:z[e]||e})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,n.jsx)(c.A,{color:N[e]||"default",children:"high"===e?"高":"medium"===e?"中":"低"})},{title:e("context.source"),dataIndex:"source",width:100,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,s)=>(0,n.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,n.jsx)(l.Ay,{size:"small",type:"text",icon:(0,n.jsx)(A.A,{}),onClick:()=>{L(s),F(s.content),M(""),O(!0)}}),(0,n.jsx)(i.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{J(s.id)},children:(0,n.jsx)(l.Ay,{size:"small",type:"text",danger:!0,icon:(0,n.jsx)(w.A,{})})})]})}];return(0,n.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:e("nav.longTermContext")}),(0,n.jsx)("p",{className:"pageDesc",children:e("context.longTermDesc")})]}),(0,n.jsxs)(d.A,{wrap:!0,children:[(0,n.jsx)(m.A,{prefix:(0,n.jsx)(y.A,{}),placeholder:e("common.search"),value:P,onChange:e=>B(e.target.value),onPressEnter:()=>{G(P)},allowClear:!0,style:{width:240}}),(0,n.jsx)(l.Ay,{icon:(0,n.jsx)(g.A,{}),onClick:()=>{Q()},children:"压缩"}),(0,n.jsx)(i.A,{title:"确定清除长期上下文吗?",onConfirm:()=>{R()},children:(0,n.jsx)(l.Ay,{danger:!0,icon:(0,n.jsx)(f.A,{}),children:"清除"})})]})]}),(0,n.jsx)(x.A,{size:"small",children:(0,n.jsx)(u.A,{title:"总上下文大小",value:(0,C.z3)(T.totalBytes),prefix:(0,n.jsx)(_.A,{}),suffix:" / ".concat(T.count," 条")})}),(0,n.jsxs)(x.A,{size:"small",children:[(0,n.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,n.jsx)(v.A,{})," ",e("context.longTermSource")]}),(0,n.jsx)(h.A,{rowKey:"id",columns:W,dataSource:I,loading:s,size:"small",pagination:{pageSize:15}})]}),(0,n.jsx)(j.A,{maskClosable:!1,title:e("models.editModel"),open:D,onCancel:()=>O(!1),onOk:()=>{U()},confirmLoading:V,children:(0,n.jsxs)(p.A,{layout:"vertical",size:"middle",children:[(0,n.jsx)(p.A.Item,{label:e("context.content"),children:(0,n.jsx)(m.A.TextArea,{rows:6,value:X,onChange:e=>F(e.target.value)})}),(0,n.jsx)(p.A.Item,{label:e("context.source"),children:(0,n.jsx)(m.A,{value:K,onChange:e=>M(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}},36382:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/long-term",function(){return s(260)}])}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,2700,5174,4696,6985,9400,288,257,9978,636,6593,8792],()=>e(e.s=36382)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6409],{19164:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/short-term",function(){return s(51162)}])},51162:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>N});var a=s(65321),r=s(97109),n=s(64209),o=s(17807),c=s(11702),l=s(85114),i=s(26171),d=s(33442),m=s(7576),x=s(68787),u=s(54849),h=s(59400),j=s(25258),p=s(63455),A=s(99650),w=s(58209),y=s(30486),f=s(83374),g=s(8383),v=s(26619),_=s(53998),S=s(6578),C=s(45551);let z={high:"red",medium:"orange",low:"default"};function N(){let e=(0,n.Vr)(),{message:t}=o.A.useApp(),[s,N]=(0,r.useState)(!0),[k,E]=(0,r.useState)([]),[I,T]=(0,r.useState)({count:0,totalBytes:0}),[b,P]=(0,r.useState)(""),[B,D]=(0,r.useState)(!1),[O,H]=(0,r.useState)(null),[L,X]=(0,r.useState)(""),[F,K]=(0,r.useState)(""),[M,V]=(0,r.useState)(!1),q=async s=>{N(!0);try{let[e,t]=await Promise.all([(0,S.hn)("short_term",s),(0,S.p)("short_term")]);E(e),T(t)}catch(s){t.error(e("common.error"))}finally{N(!1)}};(0,r.useEffect)(()=>{q()},[]);let G=async s=>{try{await (0,S.xw)(s),t.success(e("common.success")),await q(b)}catch(s){t.error(e("common.error"))}},J=async()=>{try{await (0,S.PH)("short_term"),t.success(e("common.success")),await q(b)}catch(s){t.error(e("common.error"))}},Q=async()=>{try{await (0,S.E)("short_term"),t.success(e("common.success")),await q(b)}catch(s){t.error(e("common.error"))}},R=async()=>{if(O&&L.trim()){V(!0);try{await (0,S.zo)(O.id,{content:L.trim(),context:F||void 0}),t.success(e("common.success")),D(!1),await q(b)}catch(s){t.error(e("common.error"))}finally{V(!1)}}},U=[{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,a.jsx)(c.A,{color:z[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,s)=>(0,a.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,a.jsx)(l.Ay,{size:"small",type:"text",icon:(0,a.jsx)(A.A,{}),onClick:()=>{H(s),X(s.content),K(""),D(!0)}}),(0,a.jsx)(i.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{G(s.id)},children:(0,a.jsx)(l.Ay,{size:"small",type:"text",danger:!0,icon:(0,a.jsx)(w.A,{})})})]})}];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("nav.shortTermContext")}),(0,a.jsx)("p",{className:"pageDesc",children:e("context.shortTermDesc")})]}),(0,a.jsxs)(d.A,{wrap:!0,children:[(0,a.jsx)(m.A,{prefix:(0,a.jsx)(y.A,{}),placeholder:e("common.search"),value:b,onChange:e=>P(e.target.value),onPressEnter:()=>{q(b)},allowClear:!0,style:{width:240}}),(0,a.jsx)(l.Ay,{icon:(0,a.jsx)(f.A,{}),onClick:()=>{J()},children:"压缩"}),(0,a.jsx)(i.A,{title:"确定清除短期上下文吗?",onConfirm:()=>{Q()},children:(0,a.jsx)(l.Ay,{danger:!0,icon:(0,a.jsx)(g.A,{}),children:"清除"})})]})]}),(0,a.jsx)(x.A,{size:"small",children:(0,a.jsx)(u.A,{title:"总上下文大小",value:(0,C.z3)(I.totalBytes),prefix:(0,a.jsx)(v.A,{}),suffix:" / ".concat(I.count," 条")})}),(0,a.jsxs)(x.A,{size:"small",children:[(0,a.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,a.jsx)(_.A,{})," ",e("context.shortTermSource")]}),(0,a.jsx)(h.A,{rowKey:"id",columns:U,dataSource:k,loading:s,size:"small",pagination:{pageSize:15}})]}),(0,a.jsx)(j.A,{maskClosable:!1,title:e("models.editModel"),open:B,onCancel:()=>D(!1),onOk:()=>{R()},confirmLoading:M,children:(0,a.jsxs)(p.A,{layout:"vertical",size:"middle",children:[(0,a.jsx)(p.A.Item,{label:e("context.content"),children:(0,a.jsx)(m.A.TextArea,{rows:6,value:L,onChange:e=>X(e.target.value)})}),(0,a.jsx)(p.A.Item,{label:e("context.source"),children:(0,a.jsx)(m.A,{value:F,onChange:e=>K(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,2700,5174,4696,6985,9400,288,257,9978,636,6593,8792],()=>e(e.s=19164)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4298],{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 o(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return s("/api/kb/stats".concat(t))}async function a(e){var t,n;let o=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&o.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&o.set("category",e.category),(null==e?void 0:e.page)&&o.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&o.set("limit",String(null!=(n=e.limit)?n:50)),s("/api/kb/files?".concat(o))}async function i(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),s("/api/kb/files/detail?".concat(n))}async function r(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 m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function f(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function y(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 x(){return s("/api/kb/features")}async function w(e,t){var n,o,a,i,r;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!=(r=t.limit)?r:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(o=t.weights)?void 0:o.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(a=t.weights)?void 0:a.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(i=t.weights)?void 0:i.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),s("/api/kb/search?".concat(c))}async function j(){return s("/api/prompt")}async function v(e){return s("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function b(e){return s("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function A(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 k(e){return s("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function I(){return s("/api/documents/specs")}async function T(e){return s("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e){return s("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return s("/api/documents/templates")}async function R(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 P(e){return s("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function O(e){return s("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(){return s("/api/documents/generated")}async function D(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)))}async function L(e,t){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function U(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function M(){return s("/api/assets/generated")}async function J(e){return s("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function W(e){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function F(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 B(e,t){return s("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function H(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json",Accept:"pdf"===e.format?"application/pdf":"*/*"},body:JSON.stringify(e)}),n=t.headers.get("content-type")||"",s=async()=>{let e=await t.text(),n=e||"导出失败";try{var s;let t=JSON.parse(e),o=null==(s=t.issues)?void 0:s.map(e=>e.message).filter(Boolean).slice(0,3).join(";");n=o?"".concat(t.error||"导出失败",":").concat(o):t.error||n}catch(e){}throw Error(n.length>300?"".concat(n.slice(0,300),"..."):n)};return t.ok||await s(),"pdf"!==e.format||n.includes("application/pdf")||await s(),"docx"!==e.format||n.includes("officedocument.wordprocessingml.document")||await s(),t.blob()}async function q(){return s("/api/config/providers")}async function G(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 V(e){return s("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function X(){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 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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;return s("/api/system/logs?limit=".concat(e))}async function en(){return s("/api/system/logs",{method:"DELETE"})}async function es(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return s("/api/context".concat(n))}async function eo(e){return s("/api/context?type=".concat(e,"&stats=1"))}async function ea(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ei(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 ec(e,t){return s("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function el(e){return s("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>B,Bh:()=>el,Dl:()=>E,E:()=>ei,EK:()=>T,ER:()=>C,FC:()=>ee,FV:()=>A,H1:()=>g,H7:()=>m,HC:()=>r,HT:()=>a,II:()=>X,JU:()=>J,NR:()=>S,OX:()=>O,PH:()=>ea,QG:()=>U,QT:()=>u,Qx:()=>p,R1:()=>z,SJ:()=>f,UE:()=>H,VW:()=>x,W2:()=>w,X8:()=>y,Z3:()=>q,_m:()=>G,a6:()=>L,aP:()=>V,bV:()=>P,bZ:()=>Y,c1:()=>d,cQ:()=>_,dd:()=>Z,dg:()=>b,dw:()=>k,dx:()=>j,f$:()=>M,h0:()=>N,h1:()=>K,hH:()=>en,hc:()=>o,hn:()=>es,l2:()=>R,lv:()=>v,mx:()=>I,oH:()=>et,oS:()=>F,p:()=>eo,tn:()=>c,u6:()=>$,uc:()=>W,v7:()=>D,xC:()=>i,xq:()=>h,xw:()=>er,zo:()=>ec,zr:()=>Q})},16403:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return n(19562)}])},19562:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>Q});var s=n(65321),o=n(97109),a=n(7576),i=n(35292),r=n(17807),c=n(63455),l=n(68787),d=n(85114),u=n(2256),p=n(38770),m=n(38332),h=n(84253),f=n(26171),y=n(33442),g=n(11702),x=n(57271),w=n(9730),j=n(58569),v=n(25258),b=n(26631),A=n(23216),S=n(26619),k=n(8263),I=n(16285),T=n(8579),C=n(75548),E=n(7851),R=n(84742),N=n(29071),P=n(63552),O=n(76830),_=n(83914),D=n(58209),L=n(54746),U=n(93051),M=n(99650),J=n(67547),W=n(99811),F=n(6578),z=n(64209);let{TextArea:B}=a.A,{Paragraph:H,Text:q}=i.A,G=null;function K(){null==G||G.listeners.forEach(e=>e())}function Q(){var e,t,n;let i=(0,z.Vr)(),{message:Q}=r.A.useApp(),[V]=c.A.useForm(),[X,Z]=(0,o.useState)([]),[$,Y]=(0,o.useState)("construction-organization-design"),[ee,et]=(0,o.useState)([]),[en,es]=(0,o.useState)([]),[eo,ea]=(0,o.useState)([]),[ei,er]=(0,o.useState)(!1),[ec,el]=(0,o.useState)(null),[ed,eu]=(0,o.useState)(""),[ep,em]=(0,o.useState)([]),[eh,ef]=(0,o.useState)(null),[ey,eg]=(0,o.useState)(!1),[ex,ew]=(0,o.useState)(null),[ej,ev]=(0,o.useState)(!1),[eb,eA]=(0,o.useState)([]),[eS,ek]=(0,o.useState)(null),eI=async()=>{try{em((await (0,F.cQ)()).documents)}catch(e){em([])}};(0,o.useEffect)(()=>{let e=()=>{G&&(eA(G.flowSteps),ek(G.activeFlowKey),er(G.loading),G.draft&&el(G.draft),void 0!==G.content&&eu(G.content))};return null==G||G.listeners.add(e),e(),()=>{null==G||G.listeners.delete(e)}},[]),(0,o.useEffect)(()=>{(0,F.Dl)().then(e=>{var t,n;Z(e.templates),Y(null!=(n=null==(t=e.templates[0])?void 0:t.id)?n:"construction-organization-design")}).catch(()=>Q.error(i("common.error"))),(0,F.lv)().then(e=>{et(e.roles),es(e.configs)}).catch(()=>{et([]),es([])}),(0,F.mx)().then(e=>ea(e.specs)).catch(()=>ea([])),eI()},[Q,i]);let eT=(0,o.useMemo)(()=>X.find(e=>e.id===$),[X,$]),eC=en.map(e=>({label:e.name,value:e.id})),eE=eo.map(e=>({label:e.name,value:e.id})),eR=Math.max(0,eb.findIndex(e=>e.key===eS)),eN=e=>e.map((e,t)=>({key:"sub-".concat(t),title:e,status:"wait"})),eP=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eT,t=eo.find(t=>t.id===(null==e?void 0:e.documentSpecId)),n=en.find(t=>t.id===(null==e?void 0:e.projectRoleConfigId)),o=((null==n?void 0:n.fileRoles)||[]).map(e=>{var t;return(null==(t=ee.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),a=((null==n?void 0:n.promptRoles)||[]).map(e=>{var t;return(null==(t=ee.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),r=(null==t?void 0:t.factFields.map(e=>e.name))||(null==e?void 0:e.chapters.flatMap(e=>e.requiredFacts))||[],c=(null==e?void 0:e.chapters.map(e=>e.title))||[],l=a.some(e=>/封面|图片|资源|cover|image/iu.test(e));return[{key:"prepare",title:i("documents.flowPrepare"),description:"读取“".concat((null==e?void 0:e.name)||"当前模板","”并创建后台生成任务"),status:"process",icon:(0,s.jsx)(b.A,{}),subSteps:eN(["读取模板参数",(null==e?void 0:e.documentSpecId)?"加载规范包:".concat((null==t?void 0:t.name)||e.documentSpecId):"未绑定规范包,使用模板章节要求","创建后台生成任务"])},{key:"role_binding",title:"动态角色配置绑定",description:"绑定 ".concat(o.length," 个文件角色、").concat(a.length," 个提示词角色"),status:"wait",icon:(0,s.jsx)(A.A,{}),subSteps:eN([...o.length?o.map(e=>"文件角色:".concat(e)):["没有文件角色,使用模板绑定文件"],...a.length?a.map(e=>"提示词角色:".concat(e)):["没有提示词角色,使用默认生成策略"]].slice(0,10))},{key:"knowledge_retrieval",title:"知识库证据检索",description:"按 ".concat(c.length," 个章节检索文本、文档、表格、图片、图纸和附件"),status:"wait",icon:(0,s.jsx)(S.A,{}),subSteps:eN(c.length?c.slice(0,10).map(e=>"检索章节:".concat(e)):["按模板标题检索证据"])},{key:"file_understanding",title:"多类型文件理解",description:"按文件角色处理文本、PDF/Word、表格、图片、图纸和附件",status:"wait",icon:(0,s.jsx)(k.A,{}),subSteps:eN(["识别文件类型和角色","构建结构化资源证据包","必要时调用多模态文件理解"])},{key:"fact_extraction",title:"动态 schema 事实抽取",description:"按 ".concat(r.length," 个规范/章节事实字段抽取并检测冲突"),status:"wait",icon:(0,s.jsx)(I.A,{}),subSteps:eN(r.length?r.slice(0,10).map(e=>"抽取事实:".concat(e)):["抽取模板要求的事实","合并来源和角色","检测事实冲突"])},{key:"chapter_generation",title:"章节生成",description:"按 ".concat(c.length," 个模板章节逐章生成"),status:"wait",icon:(0,s.jsx)(T.A,{}),subSteps:eN(c.length?c.slice(0,10).map(e=>"生成:".concat(e)):["构造章节提示词","等待 LLM 生成","整理章节证据"])},...l?[{key:"asset_generation",title:"生成资源处理",description:"根据资源/图片提示词生成或登记本地资源",status:"wait",icon:(0,s.jsx)(C.A,{}),subSteps:eN(["生成资源提示词","保存到 generatedDocuments/assets","登记资源元数据"])}]:[],{key:"validation",title:"规范包与门禁校验",description:t?"执行 ".concat(t.gateRules.length," 条门禁规则"):"执行模板基础校验",status:"wait",icon:(0,s.jsx)(E.A,{}),subSteps:eN([...(null==t?void 0:t.factFields.filter(e=>e.required).map(e=>"必填事实:".concat(e.name)))||[],...(null==t?void 0:t.gateRules.map(e=>"门禁:".concat(e.name)))||["检查章节证据","检查缺失项","检查导出门禁"]].slice(0,10))},{key:"formatting",title:i("documents.flowFormatting"),description:"整理标题、表格、图片、附件引用和正式 Markdown",status:"wait",icon:(0,s.jsx)(R.A,{}),subSteps:eN(["整理标题层级","整理多类型资源引用","生成正式 Markdown"])},{key:"llm_review",title:"LLM 审查优化",description:"再次使用动态 schema、角色和结构化证据审查优化初稿",status:"wait",icon:(0,s.jsx)(N.A,{}),subSteps:eN(["构造审查提示词","检查事实来源和冲突","回填优化后的 Markdown"])},{key:"export_ready",title:"导出就绪",description:"确认 Markdown/HTML/DOCX/PDF 可导出",status:"wait",icon:(0,s.jsx)(P.A,{}),subSteps:eN(["生成导出检查清单","确认阻断项","准备导出格式"])},{key:"done",title:i("documents.flowDone"),description:i("documents.flowDoneDesc"),status:"wait",icon:(0,s.jsx)(O.A,{}),subSteps:eN(["展示生成结果","允许编辑正文","允许导出文件"])}]},eO=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ei;(null==G?void 0:G.loading)&&(G.flowSteps=e,G.activeFlowKey=t,G.loading=n,K())},e_=(e,t)=>{if("wait"===t)return e.subSteps.map(e=>({...e,status:"wait"}));if("finish"===t)return e.subSteps.map(e=>({...e,status:"finish"}));if("error"===t)return e.subSteps.map((e,t)=>({...e,status:0===t?"error":e.status}));let n=e.subSteps.findIndex(e=>"wait"===e.status);return e.subSteps.map((e,t)=>t<n||-1===n?{...e,status:"finish"}:t===n?{...e,status:"process"}:e)},eD=(e,t,n)=>{ek(e),eA(s=>{let o=s.map(s=>s.key===e?{...s,status:t,description:n||s.description,subSteps:e_(s,t)}:s);return eO(o,e),o})};(0,o.useEffect)(()=>{if(!ei||!eS)return;let e=window.setInterval(()=>{eA(e=>{let t=e.map(e=>{if(e.key!==eS||"process"!==e.status)return e;let t=e.subSteps.findIndex(e=>"process"===e.status),n=t<0?0:Math.min(t+1,e.subSteps.length-1);return{...e,subSteps:e.subSteps.map((e,t)=>t<n?{...e,status:"finish"}:t===n?{...e,status:"process"}:{...e,status:"wait"})}});return eO(t,eS),t})},1400);return()=>window.clearInterval(e)},[eS,ei]);let eL=e=>{eA(t=>{let n=t.findIndex(t=>t.key===e),s=t.map((e,t)=>t<n&&"error"!==e.status?{...e,status:"finish",subSteps:e_(e,"finish")}:e);return eO(s,e),s})},eU=e=>{V.setFieldsValue(null!=e?e:{id:"custom-template-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,documentSpecId:void 0,chapters:[]}),ev(!0)},eM=async()=>{try{let e=await V.validateFields(),t=await (0,F.l2)(e);Z(t.templates),Y(t.template.id),ev(!1),await eI(),Q.success(i("common.success"))}catch(e){e instanceof Error&&Q.error(e.message)}},eJ=async e=>{try{let t=await (0,F.bV)(e);Z(t.templates),Y(t.template.id),Q.success(i("common.success"))}catch(e){Q.error(i("common.error"))}},eW=async e=>{try{var t,n;let s=await (0,F.h0)(e);Z(s.templates),Y(null!=(n=null==(t=s.templates[0])?void 0:t.id)?n:""),Q.success(i("common.success"))}catch(e){Q.error(i("common.error"))}},eF=async e=>{try{await (0,F.QG)(e),eh===e&&(ef(null),el(null),eu("")),await eI(),Q.success(i("common.success"))}catch(e){Q.error(i("common.error"))}},ez=async e=>{let t=[{key:"chapter_generation",message:"后台任务已创建,正在轮询等待 LLM 章节生成完成…"},{key:"asset_generation",message:"正在轮询等待封面和生成资源写入本地记录…"},{key:"validation",message:"正在轮询等待校验、导出门禁和格式化完成…"},{key:"llm_review",message:"正在轮询等待 LLM 审查优化完成…"}],n=0;for(;;){let{document:s}=await (0,F.v7)(e);if(("completed"===s.status||"warning"===s.status)&&s.draft)return s;if("failed"===s.status)throw Error(s.error||"生成失败");let o=t[Math.min(n,t.length-1)];eL(o.key),eD(o.key,"process",o.message),n+=1,await new Promise(e=>window.setTimeout(e,1500))}},eB=async()=>{if(!$)return;if(null==G?void 0:G.loading){eA(G.flowSteps),ek(G.activeFlowKey),er(!0);return}er(!0);let e=eP(X.find(e=>e.id===$)||eT),t=(0,F.OX)({templateId:$});G={id:Date.now(),templateId:$,loading:!0,flowSteps:e,activeFlowKey:"prepare",promise:t,listeners:new Set},eA(e),ek("prepare");let n=[{key:"role_binding",message:"正在读取模板、文件角色、提示词角色和文档规范包…"},{key:"knowledge_retrieval",message:"正在从知识库检索章节证据、表格、图片和附件…"},{key:"file_understanding",message:"正在准备多模态文件理解;如果模型支持图片/文件理解,会等待模型返回…"},{key:"fact_extraction",message:"正在等待 LLM 事实抽取和后续章节生成结果,请不要关闭页面…"}].map((e,t)=>window.setTimeout(()=>{eL(e.key),eD(e.key,"process",e.message)},600+900*t));try{let e=await t,s=e.documentId?await ez(e.documentId):void 0,o=e.draft||(null==s?void 0:s.draft);if(!o)throw Error("生成结果为空");(e.documentId||(null==s?void 0:s.id))&&ef(e.documentId||s.id),n.forEach(e=>window.clearTimeout(e)),eL("done"),el(o),eu((null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown),(null==G?void 0:G.promise)===t&&(G.draft=o,G.content=(null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown),eA(e=>{let t=e.map(e=>{let t=o.executionStages.find(t=>t.type===e.key);if("prepare"===e.key)return{...e,status:"finish",description:i("documents.flowPrepareDone"),subSteps:e_(e,"finish")};if("done"===e.key){var n;let t=o.validationIssues.some(e=>"error"===e.level||"warning"===e.level)||!o.exportGate.passed,s=t?"warning":"finish",a=null==(n=o.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message;return{...e,status:s,description:t?"生成完成,但需要复核:".concat(a||i("documents.flowGateFailed")):i("documents.flowDoneDesc"),subSteps:e_(e,s)}}if(!t)return"process"===e.status?{...e,status:"finish",subSteps:e_(e,"finish")}:e;let s="failed"===t.status?"error":"finish";return{...e,status:s,description:"".concat(t.status.toUpperCase(),":").concat(t.message||e.description),subSteps:e_(e,s)}});return eO(t,"done",!1),t}),ek("done"),(null==G?void 0:G.promise)===t&&(G.activeFlowKey="done",G.loading=!1,K()),await eI(),Q.success(i("common.success"))}catch(n){let e=n instanceof Error?n.message:i("common.error");eA(t=>{let n=t.map(t=>"process"===t.status?{...t,status:"error",description:e,subSteps:e_(t,"error")}:t);return eO(n,eS,!1),n}),(null==G?void 0:G.promise)===t&&(G.loading=!1,G.error=e,K()),Q.error(e)}finally{n.forEach(e=>window.clearTimeout(e)),er(!1),(null==G?void 0:G.promise)===t&&(G.loading=!1,K())}},eH=async e=>{if(ec){eg(!0);try{var t;let n="markdown"===e?"md":e,s=null==(t=eo.find(e=>e.id===(null==eT?void 0:eT.documentSpecId)))?void 0:t.wordTemplatePath,o=await (0,F.UE)({documentId:eh||void 0,title:ec.title,markdown:ed,format:e,enforceGate:!1,exportGate:ec.exportGate,wordTemplatePath:s});((e,t,n)=>{let s=new Blob([e],{type:n}),o=URL.createObjectURL(s),a=document.createElement("a");a.href=o,a.download=t,a.target="_self",a.rel="noopener",a.style.display="none",document.body.appendChild(a),a.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),a.remove(),window.setTimeout(()=>URL.revokeObjectURL(o),1e3)})(o,"".concat(ec.title,".").concat(n),{markdown:"text/markdown;charset=utf-8",html:"text/html;charset=utf-8",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}[e])}catch(e){Q.error(e instanceof Error?e.message:i("common.error"))}finally{eg(!1)}}},eq=async()=>{if(ec)try{if(eh)await (0,F.a6)(eh,{editedMarkdown:ed,markdown:ed});else{let e=await (0,F.Af)({...ec,markdown:ed});el(e.draft)}await eI(),Q.success(i("common.success"))}catch(e){Q.error(i("common.error"))}},eG=async e=>{if(ec){ew(e.id);try{var t;let n=await (0,F.R1)({templateId:ec.templateId,chapterId:e.id}),s=ec.chapters.map(t=>t.id===e.id?n.chapter:t);el({...ec,chapters:s}),t=n.chapter,eu(n=>n.includes(e.content)?n.replace(e.content,t.content):"".concat(n,"\n\n").concat(t.content)),Q.success(i("common.success"))}catch(e){Q.error(i("common.error"))}finally{ew(null)}}};return(0,s.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,s.jsx)(l.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"pageTitle mb-1",children:i("documents.title")}),(0,s.jsx)("p",{className:"pageDesc mb-0",children:i("documents.description")})]}),(0,s.jsx)(d.Ay,{type:"primary",size:"large",icon:(0,s.jsx)(L.A,{}),onClick:()=>eU(),children:i("documents.newTemplate")})]})}),(0,s.jsxs)(u.A,{gutter:[16,16],align:"top",children:[(0,s.jsxs)(p.A,{xs:24,lg:8,children:[(0,s.jsx)(l.A,{size:"small",title:i("documents.templateLibrary"),children:(0,s.jsx)(m.A,{dataSource:X,locale:{emptyText:(0,s.jsx)(h.A,{description:i("common.noData")})},renderItem:e=>(0,s.jsx)(m.A.Item,{onClick:()=>Y(e.id),className:"cursor-pointer",actions:[(0,s.jsx)(d.Ay,{size:"small",type:"text",icon:(0,s.jsx)(U.A,{}),onClick:t=>{t.stopPropagation(),eJ(e.id)}},"copy"),(0,s.jsx)(d.Ay,{size:"small",type:"text",icon:(0,s.jsx)(M.A,{}),disabled:e.builtIn,onClick:t=>{t.stopPropagation(),eU(e)}},"edit"),(0,s.jsx)(f.A,{title:i("documents.deleteTemplateConfirm"),disabled:e.builtIn,onConfirm:t=>{null==t||t.stopPropagation(),eW(e.id)},children:(0,s.jsx)(d.Ay,{size:"small",type:"text",danger:!0,icon:(0,s.jsx)(D.A,{}),disabled:e.builtIn,onClick:e=>e.stopPropagation()})},"delete")],children:(0,s.jsx)(m.A.Item.Meta,{avatar:(0,s.jsx)(b.A,{}),title:(0,s.jsxs)(y.A,{children:[(0,s.jsx)("span",{children:e.name}),e.builtIn&&(0,s.jsx)(g.A,{children:i("documents.builtIn")}),$===e.id&&(0,s.jsx)(g.A,{color:"blue",children:i("documents.selected")})]}),description:(0,s.jsxs)(y.A,{direction:"vertical",size:2,children:[(0,s.jsx)("span",{children:e.description}),(0,s.jsx)(g.A,{children:e.category})]})})})})}),(0,s.jsx)(l.A,{className:"mt-4",size:"small",title:i("documents.draftHistory"),children:0===ep.length?(0,s.jsx)(h.A,{description:i("common.noData")}):(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:ep.slice(0,8).map(e=>{var t,n,o;return(0,s.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>{(async()=>{ef(e.id),Y(e.templateId);let{document:t}=await (0,F.v7)(e.id);el(t.draft||null),eu(t.editedMarkdown||t.markdown)})()},onKeyDown:e=>{"Enter"===e.key&&e.currentTarget.click()},style:{display:"flex",gap:8,alignItems:"flex-start",justifyContent:"space-between",padding:"8px 0",borderBottom:"1px solid var(--colorBorderSecondary)",cursor:"pointer",minWidth:0},children:[(0,s.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:[(0,s.jsx)("span",{style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:600},children:e.title}),(0,s.jsx)(g.A,{style:{marginInlineEnd:0},color:"completed"===e.status?"success":"warning"===e.status?"warning":"failed"===e.status?"error":"processing",children:"warning"===e.status?"warning":e.status})]}),(0,s.jsxs)("div",{style:{marginTop:4,display:"flex",flexWrap:"wrap",gap:"4px 8px",color:"var(--colorTextSecondary)",fontSize:12},children:[(0,s.jsx)("span",{children:new Date(e.updatedAt).toLocaleString()}),(0,s.jsxs)("span",{children:["耗时:",(e=>{let t=Math.max(0,Math.round(((e.completedAt||e.updatedAt)-e.createdAt)/1e3));if(t<60)return"".concat(t," 秒");let n=Math.floor(t/60),s=t%60;if(n<60)return s?"".concat(n," 分 ").concat(s," 秒"):"".concat(n," 分");let o=Math.floor(n/60),a=n%60;return a?"".concat(o," 小时 ").concat(a," 分"):"".concat(o," 小时")})(e)]})]}),"warning"===e.status&&(0,s.jsx)("div",{style:{marginTop:4,color:"var(--colorWarning)",fontSize:12,overflowWrap:"anywhere",wordBreak:"break-all"},children:(null==(t=e.warningIssues)?void 0:t[0])||(null==(o=e.draft)||null==(n=o.validationIssues.find(e=>"error"===e.level||"warning"===e.level))?void 0:n.message)||"生成完成,但存在需要复核的问题"})]}),(0,s.jsx)(f.A,{title:"确认删除这条生成记录?",onConfirm:t=>{null==t||t.stopPropagation(),eF(e.id)},children:(0,s.jsx)(d.Ay,{size:"small",danger:!0,title:"删除记录","aria-label":"删除记录",icon:(0,s.jsx)(D.A,{}),onClick:e=>e.stopPropagation()})})]},e.id)})})})]}),(0,s.jsx)(p.A,{xs:24,lg:16,children:(0,s.jsx)(l.A,{size:"small",title:i("documents.workflow"),children:(0,s.jsxs)(y.A,{direction:"vertical",className:"w-full",size:"middle",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block mb-1",children:i("documents.template")}),(0,s.jsx)(x.A,{className:"w-full",value:$,onChange:Y,options:X.map(e=>({label:e.name,value:e.id}))})]}),eT&&(0,s.jsxs)(l.A,{size:"small",type:"inner",title:eT.outputTitle,children:[(0,s.jsx)(H,{children:eT.description}),(0,s.jsxs)(y.A,{wrap:!0,children:[eT.projectRoleConfigId?(0,s.jsx)(g.A,{color:"geekblue",children:(null==(e=en.find(e=>e.id===eT.projectRoleConfigId))?void 0:e.name)||eT.projectRoleConfigId}):(0,s.jsx)(g.A,{color:"warning",children:i("documents.noRoleConfig")}),eT.documentSpecId?(0,s.jsx)(g.A,{color:"cyan",children:(null==(t=eo.find(e=>e.id===eT.documentSpecId))?void 0:t.name)||eT.documentSpecId}):null]})]}),eT&&(0,s.jsx)(y.A,{direction:"vertical",size:4,children:(0,s.jsxs)("span",{children:[i("documents.projectRoleConfig"),": ",(null==(n=en.find(e=>e.id===eT.projectRoleConfigId))?void 0:n.name)||i("documents.noRoleConfig")]})}),(0,s.jsx)(d.Ay,{type:"primary",size:"large",block:!0,icon:(0,s.jsx)(N.A,{}),loading:ei,disabled:!(null==eT?void 0:eT.projectRoleConfigId),onClick:()=>{eB()},children:i("documents.generate")}),eb.length>0&&(0,s.jsx)(l.A,{size:"small",type:"inner",title:i("documents.executionStatus"),children:(0,s.jsx)(w.A,{direction:"vertical",size:"small",current:eR,items:eb.map(e=>{let t;return{title:e.title,description:(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{children:e.description}),(0,s.jsx)("div",{className:"space-y-0.5",children:e.subSteps.map(e=>{var t;return(0,s.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--colorTextSecondary)]",children:["process"===(t=e.status)?(0,s.jsx)(_.A,{}):"finish"===t?(0,s.jsx)(R.A,{}):"warning"===t?(0,s.jsx)(E.A,{className:"text-[var(--colorWarning)]"}):"error"===t?(0,s.jsx)(D.A,{}):(0,s.jsx)("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-[var(--colorTextTertiary)]"}),(0,s.jsx)("span",{children:e.title})]},e.key)})})]}),status:"warning"===(t=e.status)?"finish":t,icon:"process"===e.status?(0,s.jsx)(_.A,{}):"warning"===e.status?(0,s.jsx)(E.A,{className:"text-[var(--colorWarning)]"}):e.icon}})})})]})})})]}),(0,s.jsx)(l.A,{size:"small",title:i("documents.editor"),extra:(0,s.jsx)(y.A,{wrap:!0,children:ec&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Ay,{icon:(0,s.jsx)(J.A,{}),onClick:()=>{eq()},children:i("documents.saveDraft")}),(0,s.jsx)(d.Ay,{icon:(0,s.jsx)(O.A,{}),loading:ey,onClick:()=>{eH("markdown")},children:i("documents.downloadMarkdown")}),(0,s.jsx)(d.Ay,{loading:ey,onClick:()=>{eH("html")},children:i("documents.exportHtml")}),(0,s.jsx)(d.Ay,{loading:ey,onClick:()=>{eH("docx")},children:i("documents.exportDocx")}),(0,s.jsx)(d.Ay,{type:"primary",loading:ey,onClick:()=>{eH("pdf")},children:i("documents.exportPdf")})]})}),children:ec?(0,s.jsx)(j.A,{items:[{key:"edit",label:i("documents.edit"),children:(0,s.jsx)(B,{rows:26,value:ed,onChange:e=>eu(e.target.value)})},{key:"chapters",label:i("documents.chapters"),children:(0,s.jsx)(m.A,{dataSource:ec.chapters,renderItem:e=>(0,s.jsx)(m.A.Item,{actions:[(0,s.jsx)(d.Ay,{size:"small",icon:(0,s.jsx)(W.A,{}),loading:ex===e.id,onClick:()=>{eG(e)},children:i("documents.regenerateChapter")},"regen")],children:(0,s.jsx)(m.A.Item.Meta,{title:e.title,description:(0,s.jsxs)(y.A,{direction:"vertical",children:[(0,s.jsxs)("span",{children:[i("documents.evidenceCount"),": ",e.evidence.length]}),(0,s.jsxs)("span",{children:[i("documents.missingCount"),": ",e.missingFacts.length]})]})})})})},{key:"facts",label:i("documents.structuredFacts"),children:(0,s.jsx)(m.A,{dataSource:ec.structuredFacts,renderItem:e=>{var t;return(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)(m.A.Item.Meta,{title:"".concat(e.key,": ").concat(e.value),description:"".concat(e.sourceFile," \xb7 ").concat((null==(t=ee.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId)}),(0,s.jsx)(g.A,{children:e.confidence.toFixed(2)})]})}})},{key:"sources",label:i("documents.sources"),children:(0,s.jsx)(m.A,{dataSource:ec.sources,renderItem:e=>(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)("span",{children:e.filePath}),(0,s.jsx)(g.A,{children:e.count})]})})},{key:"missing",label:i("documents.missingItems"),children:0===ec.missingItems.length?(0,s.jsx)(h.A,{description:i("common.noData")}):(0,s.jsx)(m.A,{dataSource:ec.missingItems,renderItem:e=>(0,s.jsx)(m.A.Item,{children:e})})},{key:"validation",label:i("documents.validation"),children:0===ec.validationIssues.length?(0,s.jsx)(h.A,{description:i("common.noData")}):(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8,minWidth:0,maxWidth:"100%",overflow:"hidden"},children:ec.validationIssues.map(e=>(0,s.jsxs)("div",{style:{minWidth:0,maxWidth:"100%",overflow:"hidden",border:"1px solid var(--colorBorderSecondary)",borderRadius:8,padding:12,background:"var(--colorBgContainer)"},children:[(0,s.jsx)(g.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:e.level}),(0,s.jsx)("div",{style:{marginTop:6,maxWidth:"100%",whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.message}),e.suggestion&&(0,s.jsx)("div",{style:{marginTop:6,maxWidth:"100%",color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-all",lineHeight:1.6},children:e.suggestion})]},"".concat(e.level,"-").concat(e.message)))})},{key:"gate",label:i("documents.exportGate"),children:(0,s.jsx)(m.A,{dataSource:ec.exportGate.checklist,renderItem:e=>(0,s.jsxs)(m.A.Item,{className:"min-w-0",children:[(0,s.jsxs)(y.A,{direction:"vertical",size:2,className:"min-w-0 flex-1",children:[(0,s.jsx)(q,{className:"block max-w-full",style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.label}),e.message&&(0,s.jsx)(q,{type:"secondary",className:"block max-w-full",style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})]}),(0,s.jsx)(g.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})},{key:"stages",label:i("documents.executionStages"),children:(0,s.jsx)(m.A,{dataSource:ec.executionStages,renderItem:e=>{var t,n;return(0,s.jsxs)(m.A.Item,{className:"min-w-0",children:[(0,s.jsx)(m.A.Item.Meta,{avatar:(t=e.type,({role_binding:(0,s.jsx)(A.A,{}),knowledge_retrieval:(0,s.jsx)(S.A,{}),file_understanding:(0,s.jsx)(k.A,{}),fact_extraction:(0,s.jsx)(I.A,{}),chapter_generation:(0,s.jsx)(T.A,{}),asset_generation:(0,s.jsx)(C.A,{}),validation:(0,s.jsx)(E.A,{}),formatting:(0,s.jsx)(R.A,{}),llm_review:(0,s.jsx)(N.A,{}),export_ready:(0,s.jsx)(P.A,{}),reference:(0,s.jsx)(C.A,{})})[t]||(0,s.jsx)(b.A,{})),title:(0,s.jsx)(q,{className:"block max-w-full",style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:"".concat({role_binding:"角色配置绑定",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",asset_generation:"多模态资源生成",validation:"规则校验",formatting:"格式化排版",llm_review:"LLM 审查优化",export_ready:"导出就绪",reference:"参考资源处理"}[n=e.type]||n," \xb7 ").concat(e.roleId)}),description:(0,s.jsx)(q,{type:"secondary",className:"block max-w-full whitespace-pre-wrap",style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:e.message})}),(0,s.jsx)(g.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})}})}]}):(0,s.jsx)(h.A,{description:i("documents.noDraft")})}),(0,s.jsx)(v.A,{maskClosable:!1,title:i("documents.templateEditor"),open:ej,onOk:()=>{eM()},onCancel:()=>ev(!1),width:760,centered:!0,okText:i("common.save"),children:(0,s.jsxs)(c.A,{form:V,layout:"vertical",requiredMark:"optional",children:[(0,s.jsxs)(u.A,{gutter:12,children:[(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,s.jsx)(a.A,{disabled:!0})})}),(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"name",label:i("documents.templateName"),rules:[{required:!0}],children:(0,s.jsx)(a.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"category",label:i("documents.templateCategory"),children:(0,s.jsx)(a.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:12,children:(0,s.jsx)(c.A.Item,{name:"outputTitle",label:i("documents.outputTitle"),children:(0,s.jsx)(a.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:12,children:(0,s.jsx)(c.A.Item,{name:"description",label:i("documents.templateDescription"),children:(0,s.jsx)(a.A,{})})})]}),(0,s.jsx)(c.A.Item,{name:"projectRoleConfigId",label:i("documents.projectRoleConfig"),rules:[{required:!0,message:i("documents.projectRoleConfigRequired")}],children:(0,s.jsx)(x.A,{showSearch:!0,placeholder:i("documents.projectRoleConfigRequired"),options:eC})}),(0,s.jsx)(c.A.Item,{name:"documentSpecId",label:i("documents.documentSpec"),children:(0,s.jsx)(x.A,{allowClear:!0,showSearch:!0,placeholder:i("documents.documentSpecPlaceholder"),options:eE})})]})})]})}}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,2700,5174,4696,288,5292,8332,1054,6474,636,6593,8792],()=>e(e.s=16403)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3309],{1873:(e,t,l)=>{e.exports=l(91952)},4632:(e,t)=>{"use strict";function l(e){var t;let{config:l,src:r,width:i,quality:n}=e,a=n||(null==(t=l.qualities)?void 0:t.reduce((e,t)=>Math.abs(t-75)<Math.abs(e-75)?t:e))||75;return l.path+"?url="+encodeURIComponent(r)+"&w="+i+"&q="+a+(r.startsWith("/_next/static/media/"),"")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r}}),l.__next_img_default=!0;let r=l},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"}},37690:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return l(48200)}])},48200:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>M});var r=l(65321),i=l(97109),n=l(1873),a=l.n(n),s=l(43220),o=l.n(s),c=l(86109),d=l(35292),u=l(76506),h=l(33442),m=l(11702),p=l(9137),f=l(59400),g=l(68787),x=l(56985),y=l(49604),v=l(84253),j=l(42700),_=l(85493),w=l(85114),b=l(58569),S=l(7576),A=l(6578),C=l(45551),P=l(14569),k=l.n(P);let{Paragraph:R}=d.A;function z(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}function I(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).slice(0,30):[]}function N(e,t){let l=t.trim()?[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length):[];if(0===l.length)return e;let i=RegExp("(".concat(l.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(i).map((e,t)=>l.some(t=>t.toLowerCase()===e.toLowerCase())?(0,r.jsx)("mark",{children:e},t):e)}function O(e,t,l){return null==t||""===t||Array.isArray(t)&&0===t.length?null:(0,r.jsx)(u.A.Item,{label:e,children:Array.isArray(t)?(0,r.jsx)(h.A,{wrap:!0,children:t.map(e=>(0,r.jsx)(m.A,{className:"cursor-pointer",onClick:()=>null==l?void 0:l(String(e)),children:String(e)},String(e)))}):String(t)})}function E(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return e.map((e,l)=>({key:"".concat(t,"-").concat(l),name:e}))}function M(){var e,t,l,n,s,d,P,M,D,L;let T=(0,c.useRouter)(),F="string"==typeof T.query.relativePath?T.query.relativePath:"",[J,K]=(0,i.useState)(),[B,H]=(0,i.useState)(!1),[X,G]=(0,i.useState)(""),[V,q]=(0,i.useState)(!1),[W,U]=(0,i.useState)(""),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{F&&(H(!0),G(""),(0,A.xC)(F).then(K).catch(e=>{K(void 0),G(e instanceof Error?e.message:"文件详情加载失败")}).finally(()=>H(!1)))},[F]);let Z=(0,i.useMemo)(()=>(function(e){let t=z(null==e?void 0:e.file.metadataJson);return"object"==typeof t.extraction&&t.extraction?t.extraction:t})(J),[J]),Q=I(Z.layerNames);(0,i.useEffect)(()=>{Y(Q)},[null==J?void 0:J.file.relativePath,Q.join("|")]);let ee=W.trim().toLowerCase(),et=(0,i.useMemo)(()=>{var e;return J&&ee?J.chunks.filter(e=>{let t=z(e.metadataJson);return[e.content,e.sectionTitle,t.rowRange,t.chunkKind,t.parentId,JSON.stringify(t)].some(e=>String(null!=e?e:"").toLowerCase().includes(ee))}):null!=(e=null==J?void 0:J.chunks)?e:[]},[J,ee]),el=(0,i.useMemo)(()=>{var e;return J&&ee?J.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(ee))):null!=(e=null==J?void 0:J.parents)?e:[]},[J,ee]),er=async()=>{if(F){q(!0);try{let e=await (0,A.HC)(F);e.detail&&K(e.detail),p.Ay.success("文件索引已重建")}finally{q(!1)}}},ei=async e=>{e&&(await navigator.clipboard.writeText(e),p.Ay.success("已复制"))},en=async e=>{F&&(await (0,A.tn)(F,e),p.Ay.success("file"===e?"已请求打开文件":"已请求打开目录"))},ea=[{key:"table",label:"表格",children:(0,r.jsxs)(h.A,{direction:"vertical",className:"w-full",children:[(0,r.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[O("Sheet",I(Z.sheetNames),U),O("表头",I(Z.columnNames),U),O("行数",Z.rowCount),O("列数",Z.columnCount),O("公式数",Z.formulaCount),O("合并单元格",Z.mergeCount)]}),(0,r.jsx)(f.A,{size:"small",pagination:!1,rowKey:"key",dataSource:E(I(Z.columnNames),"column"),columns:[{title:"列名",dataIndex:"name",render:e=>(0,r.jsx)(m.A,{className:"cursor-pointer",onClick:()=>U(String(e)),children:String(e)})}]}),(0,r.jsx)(f.A,{size:"small",pagination:!1,rowKey:"key",dataSource:(null!=(P=null==J?void 0:J.chunks)?P:[]).map(e=>z(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,t)=>({key:"row-".concat(t),name:e})),columns:[{title:"行范围",dataIndex:"name",render:e=>(0,r.jsxs)(m.A,{color:"gold",className:"cursor-pointer",onClick:()=>U(String(e)),children:["行 ",String(e)]})}]}),(0,r.jsx)(f.A,{size:"small",rowKey:"key",dataSource:(null!=(M=null==J?void 0:J.chunks)?M:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>e.includes("|")).slice(0,80).map((e,t)=>({key:"grid-".concat(t),cells:e.split("|").map(e=>e.trim()).filter(Boolean)})),pagination:{pageSize:10},columns:[{title:"表格网格预览",dataIndex:"cells",render:e=>(0,r.jsx)(h.A,{wrap:!0,children:e.map((e,t)=>(0,r.jsx)(m.A,{children:e},"".concat(e,"-").concat(t)))})}]})]})},{key:"drawing",label:"图纸",children:(0,r.jsxs)(h.A,{direction:"vertical",className:"w-full",children:[(0,r.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[O("图层",I(Z.layerNames),U),O("块/符号",I(Z.blockNames),U),O("实体类型",I(Z.entityTypes),U),O("产品/零件",I(Z.productNames),U),O("材料",I(Z.materialNames),U),O("实体名称",I(Z.entityNames),U)]}),Q.length>0?(0,r.jsxs)(g.A,{size:"small",title:"图层开关 / 图纸预览",children:[(0,r.jsx)(x.A.Group,{value:$,options:Q.map(e=>({label:e,value:e})),onChange:e=>Y(e.map(String))}),(0,r.jsx)("div",{className:k().drawingPreview,children:$.map(e=>(0,r.jsx)(m.A,{color:"blue",children:e},e))})]}):null,(0,r.jsx)(f.A,{size:"small",pagination:!1,rowKey:"key",dataSource:[...E(Q,"layer").map(e=>({...e,type:"图层"})),...E(I(Z.entityTypes),"entity").map(e=>({...e,type:"实体类型"})),...E(I(Z.blockNames),"block").map(e=>({...e,type:"块/符号"}))],columns:[{title:"类型",dataIndex:"type",width:120},{title:"名称",dataIndex:"name",render:e=>(0,r.jsx)(m.A,{className:"cursor-pointer",onClick:()=>U(String(e)),children:String(e)})}]})]})},{key:"data",label:"数据路径",children:(0,r.jsxs)(h.A,{direction:"vertical",className:"w-full",children:[I(Z.dataPaths).length>0?(0,r.jsx)(y.A,{defaultExpandAll:!0,treeData:function(e){let t=new Map;for(let l of e){let e=t;for(let t of l.replace(/\[(\d+)\]/gu,".$1").split(".").filter(Boolean))e.has(t)||e.set(t,new Map),e=e.get(t)}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return[...e.entries()].map(e=>{let[r,i]=e;return{title:r,key:t?"".concat(t,".").concat(r):r,children:l(i,t?"".concat(t,".").concat(r):r)}})};return l(t)}(I(Z.dataPaths)),onSelect:e=>{var t;return U(String(null!=(t=e[0])?t:""))}}):(0,r.jsx)(v.A,{description:"暂无数据路径"}),(0,r.jsx)(f.A,{size:"small",rowKey:"key",dataSource:(null!=(D=null==J?void 0:J.chunks)?D:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>/^[\w.[\]-]+\s*[:=]/u.test(e)).slice(0,200).map((e,t)=>{var l,r,i,n;let a=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(t),path:null!=(i=null==a||null==(l=a[1])?void 0:l.trim())?i:e,value:null!=(n=null==a||null==(r=a[2])?void 0:r.trim())?n:""}}),pagination:{pageSize:20},columns:[{title:"Path",dataIndex:"path",width:260,render:e=>(0,r.jsx)(m.A,{className:"cursor-pointer",onClick:()=>U(String(e)),children:String(e)})},{title:"Value",dataIndex:"value",render:e=>(0,r.jsx)("span",{className:"break-all",children:String(e)})}]})]})},{key:"ocr",label:"OCR/PDF",children:(0,r.jsxs)(h.A,{direction:"vertical",className:"w-full",children:[(0,r.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[O("OCR 建议",Z.ocrRecommended),O("OCR 原因",Z.ocrReason),O("OCR 引擎",Z.ocrProvider),O("OCR 语言",Z.ocrLanguages),O("OCR 文本长度",Z.ocrTextLength),O("PDF 页面 OCR 支持",Z.pdfPageOcrSupported),O("PDF OCR 页数",Z.ocrPageCount),O("PDF OCR 页数上限",Z.pdfOcrPageLimit),O("PDF 渲染器",Z.pdfRenderer)]}),(null==J?void 0:J.file.format)==="pdf"?(0,r.jsx)("div",{className:k().pdfPreviewStrip,children:Array.from({length:Math.min(Number(null!=(e=Z.ocrPageCount)?e:1)||1,6)},(e,t)=>(0,r.jsx)(a(),{width:220,height:320,src:"/api/kb/files/preview-pdf-page?relativePath=".concat(encodeURIComponent(J.file.relativePath),"&page=").concat(t+1),alt:"PDF 第 ".concat(t+1," 页"),unoptimized:!0},t))}):null,(0,r.jsx)(f.A,{size:"small",rowKey:"key",dataSource:(null!=(L=null==J?void 0:J.chunks)?L:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,t,l,r)=>{var i,n,a;return l%2==0&&e.push({key:"page-".concat(t),page:t,text:null!=(a=null==(n=r[l+1])||null==(i=n.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:i.trim())?a:""}),e},[]),pagination:{pageSize:10},columns:[{title:"页码",dataIndex:"page",width:90},{title:"OCR 文本",dataIndex:"text",render:e=>(0,r.jsx)(R,{ellipsis:{rows:4,expandable:!0,symbol:"展开"},children:String(e)})}]})]})}],es=[{title:"#",dataIndex:"chunkIndex",width:70,render:e=>String(e)},{title:"类型",width:110,render:(e,t)=>{var l;return(0,r.jsx)(m.A,{children:String(null!=(l=z(t.metadataJson).chunkKind)?l:t.category)})}},{title:"章节/范围",width:220,render:(e,t)=>{let l=z(t.metadataJson),i="string"==typeof l.rowRange?l.rowRange:void 0;return(0,r.jsxs)(h.A,{wrap:!0,children:[t.sectionTitle?(0,r.jsx)(m.A,{color:"cyan",children:t.sectionTitle}):null,i?(0,r.jsxs)(m.A,{color:"gold",children:["行 ",i]}):null]})}},{title:"Token",dataIndex:"tokenCount",width:90},{title:"内容",render:(e,t)=>(0,r.jsx)(R,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:k().searchContent,children:N(t.content,W)})}],eo=[{title:"Parent",dataIndex:"parentId",width:260,render:e=>(0,r.jsx)("span",{className:"break-all",children:e})},{title:"切片数",dataIndex:"chunkCount",width:90},{title:"章节",dataIndex:"sectionTitle",width:220},{title:"内容",render:(e,t)=>(0,r.jsx)(R,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:k().searchContent,children:N(t.content,W)})}];return B?(0,r.jsx)(j.A,{}):X?(0,r.jsx)(_.A,{type:"error",showIcon:!0,message:"文件详情加载失败",description:X}):J?(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(o(),{href:"/knowledge/files",children:"返回文件列表"}),(0,r.jsxs)("div",{className:k().searchResultHeader,children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"pageTitle",children:"文件详情"}),(0,r.jsx)("p",{className:"pageDesc",children:"查看解析结果、图纸/表格/数据结构化字段、parent chunk 和 child chunk。"})]}),(0,r.jsxs)(h.A,{children:[(0,r.jsx)(w.Ay,{onClick:()=>{ei(null==J?void 0:J.absolutePath)},children:"复制原文件路径"}),(0,r.jsx)(w.Ay,{onClick:()=>{ei(null==J?void 0:J.directory)},children:"复制所在目录"}),(0,r.jsx)(w.Ay,{onClick:()=>{en("file")},children:"打开文件"}),(0,r.jsx)(w.Ay,{onClick:()=>{en("directory")},children:"打开目录"}),"pdf"===J.file.format?(0,r.jsx)(w.Ay,{loading:V,onClick:()=>{er()},children:"重新 OCR"}):null,(0,r.jsx)(w.Ay,{type:"primary",loading:V,onClick:()=>{er()},children:"重建该文件索引"})]})]})]}),(0,r.jsx)(g.A,{size:"small",title:"基础信息",children:(0,r.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[(0,r.jsx)(u.A.Item,{label:"路径",children:J.file.relativePath}),(0,r.jsx)(u.A.Item,{label:"原文件",children:null!=(t=J.absolutePath)?t:"-"}),(0,r.jsx)(u.A.Item,{label:"所在目录",children:null!=(l=J.directory)?l:"-"}),(0,r.jsxs)(u.A.Item,{label:"分类",children:[(0,r.jsx)(m.A,{children:(0,C.Jm)(J.file.category)})," ",(0,r.jsx)(m.A,{children:J.file.format})]}),(0,r.jsx)(u.A.Item,{label:"大小",children:(0,C.z3)(J.file.fileSize)}),(0,r.jsx)(u.A.Item,{label:"切片数",children:J.file.chunkCount}),(0,r.jsx)(u.A.Item,{label:"状态",children:J.file.status}),(0,r.jsx)(u.A.Item,{label:"解析模式",children:String(null!=(n=Z.extractionMode)?n:"-")}),(0,r.jsx)(u.A.Item,{label:"覆盖范围",children:String(null!=(s=Z.contentCoverage)?s:"-")}),(0,r.jsx)(u.A.Item,{label:"正文长度",children:String(null!=(d=Z.textLength)?d:"-")})]})}),(0,r.jsx)(g.A,{size:"small",title:"结构化信息",children:(0,r.jsx)(b.A,{items:ea})}),(0,r.jsx)(g.A,{size:"small",title:"详情筛选",children:(0,r.jsxs)(h.A,{direction:"vertical",className:"w-full",children:[(0,r.jsx)(S.A,{allowClear:!0,value:W,onChange:e=>U(e.target.value),placeholder:"筛选 rowRange、图层、实体、data path、section、chunk 内容"}),W?(0,r.jsxs)(h.A,{wrap:!0,children:[(0,r.jsxs)(m.A,{color:"blue",children:["Parent 命中 ",el.length]}),(0,r.jsxs)(m.A,{color:"green",children:["Child 命中 ",et.length]}),(0,r.jsxs)(m.A,{color:"purple",children:["筛选词 ",W]})]}):null]})}),(0,r.jsx)(g.A,{size:"small",title:"Parent Chunks (".concat(el.length,"/").concat(J.parents.length,")"),children:(0,r.jsx)(f.A,{rowKey:"id",columns:eo,dataSource:el,pagination:{pageSize:10},size:"small"})}),(0,r.jsx)(g.A,{size:"small",title:"Child Chunks (".concat(et.length,"/").concat(J.chunks.length,")"),children:(0,r.jsx)(f.A,{rowKey:"id",columns:es,dataSource:et,pagination:{pageSize:20},size:"small"})})]}):(0,r.jsx)(v.A,{description:"请选择文件"})}},49952:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return j}});let r=l(34007),i=l(26908),n=l(65321),a=i._(l(97109)),s=r._(l(61222)),o=r._(l(64041)),c=l(62956),d=l(83149),u=l(65059);l(28965);let h=l(99318),m=r._(l(4632)),p=l(47503),f={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function g(e,t,l,r,i,n,a){let s=null==e?void 0:e.src;e&&e["data-loaded-src"]!==s&&(e["data-loaded-src"]=s,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&i(!0),null==l?void 0:l.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let r=!1,i=!1;l.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>r,isPropagationStopped:()=>i,persist:()=>{},preventDefault:()=>{r=!0,t.preventDefault()},stopPropagation:()=>{i=!0,t.stopPropagation()}})}(null==r?void 0:r.current)&&r.current(e)}}))}function x(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}let y=(0,a.forwardRef)((e,t)=>{let{src:l,srcSet:r,sizes:i,height:s,width:o,decoding:c,className:d,style:u,fetchPriority:h,placeholder:m,loading:f,unoptimized:y,fill:v,onLoadRef:j,onLoadingCompleteRef:_,setBlurComplete:w,setShowAltText:b,sizesInput:S,onLoad:A,onError:C,...P}=e,k=(0,a.useCallback)(e=>{e&&(C&&(e.src=e.src),e.complete&&g(e,m,j,_,w,y,S))},[l,m,j,_,w,C,y,S]),R=(0,p.useMergedRef)(t,k);return(0,n.jsx)("img",{...P,...x(h),loading:f,width:o,height:s,decoding:c,"data-nimg":v?"fill":"1",className:d,style:u,sizes:i,srcSet:r,src:l,ref:R,onLoad:e=>{g(e.currentTarget,m,j,_,w,y,S)},onError:e=>{b(!0),"empty"!==m&&w(!0),C&&C(e)}})});function v(e){let{isAppRouter:t,imgAttributes:l}=e,r={as:"image",imageSrcSet:l.srcSet,imageSizes:l.sizes,crossOrigin:l.crossOrigin,referrerPolicy:l.referrerPolicy,...x(l.fetchPriority)};return t&&s.default.preload?(s.default.preload(l.src,r),null):(0,n.jsx)(o.default,{children:(0,n.jsx)("link",{rel:"preload",href:l.srcSet?void 0:l.src,...r},"__nimg-"+l.src+l.srcSet+l.sizes)})}let j=(0,a.forwardRef)((e,t)=>{let l=(0,a.useContext)(h.RouterContext),r=(0,a.useContext)(u.ImageConfigContext),i=(0,a.useMemo)(()=>{var e;let t=f||r||d.imageConfigDefault,l=[...t.deviceSizes,...t.imageSizes].sort((e,t)=>e-t),i=t.deviceSizes.sort((e,t)=>e-t),n=null==(e=t.qualities)?void 0:e.sort((e,t)=>e-t);return{...t,allSizes:l,deviceSizes:i,qualities:n}},[r]),{onLoad:s,onLoadingComplete:o}=e,p=(0,a.useRef)(s);(0,a.useEffect)(()=>{p.current=s},[s]);let g=(0,a.useRef)(o);(0,a.useEffect)(()=>{g.current=o},[o]);let[x,j]=(0,a.useState)(!1),[_,w]=(0,a.useState)(!1),{props:b,meta:S}=(0,c.getImgProps)(e,{defaultLoader:m.default,imgConf:i,blurComplete:x,showAltText:_});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(y,{...b,unoptimized:S.unoptimized,placeholder:S.placeholder,fill:S.fill,onLoadRef:p,onLoadingCompleteRef:g,setBlurComplete:j,setShowAltText:w,sizesInput:e.sizes,ref:t}),S.priority?(0,n.jsx)(v,{isAppRouter:!l,imgAttributes:b}):null]})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},62956:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return o}}),l(28965);let r=l(65545),i=l(83149),n=["-moz-initial","fill","none","scale-down",void 0];function a(e){return void 0!==e.default}function s(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function o(e,t){var l,o;let c,d,u,{src:h,sizes:m,unoptimized:p=!1,priority:f=!1,loading:g,className:x,quality:y,width:v,height:j,fill:_=!1,style:w,overrideSrc:b,onLoad:S,onLoadingComplete:A,placeholder:C="empty",blurDataURL:P,fetchPriority:k,decoding:R="async",layout:z,objectFit:I,objectPosition:N,lazyBoundary:O,lazyRoot:E,...M}=e,{imgConf:D,showAltText:L,blurComplete:T,defaultLoader:F}=t,J=D||i.imageConfigDefault;if("allSizes"in J)c=J;else{let e=[...J.deviceSizes,...J.imageSizes].sort((e,t)=>e-t),t=J.deviceSizes.sort((e,t)=>e-t),r=null==(l=J.qualities)?void 0:l.sort((e,t)=>e-t);c={...J,allSizes:e,deviceSizes:t,qualities:r}}if(void 0===F)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let K=M.loader||F;delete M.loader,delete M.srcSet;let B="__next_img_default"in K;if(B){if("custom"===c.loader)throw Object.defineProperty(Error('Image with src "'+h+'" is missing "loader" prop.\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader'),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=K;K=t=>{let{config:l,...r}=t;return e(r)}}if(z){"fill"===z&&(_=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[z];e&&(w={...w,...e});let t={responsive:"100vw",fill:"100vw"}[z];t&&!m&&(m=t)}let H="",X=s(v),G=s(j);if((o=h)&&"object"==typeof o&&(a(o)||void 0!==o.src)){let e=a(h)?h.default:h;if(!e.src)throw Object.defineProperty(Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received "+JSON.stringify(e)),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!e.height||!e.width)throw Object.defineProperty(Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received "+JSON.stringify(e)),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(d=e.blurWidth,u=e.blurHeight,P=P||e.blurDataURL,H=e.src,!_)if(X||G){if(X&&!G){let t=X/e.width;G=Math.round(e.height*t)}else if(!X&&G){let t=G/e.height;X=Math.round(e.width*t)}}else X=e.width,G=e.height}let V=!f&&("lazy"===g||void 0===g);(!(h="string"==typeof h?h:H)||h.startsWith("data:")||h.startsWith("blob:"))&&(p=!0,V=!1),c.unoptimized&&(p=!0),B&&!c.dangerouslyAllowSVG&&h.split("?",1)[0].endsWith(".svg")&&(p=!0);let q=s(y),W=Object.assign(_?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:I,objectPosition:N}:{},L?{}:{color:"transparent"},w),U=T||"empty"===C?null:"blur"===C?'url("data:image/svg+xml;charset=utf-8,'+(0,r.getImageBlurSvg)({widthInt:X,heightInt:G,blurWidth:d,blurHeight:u,blurDataURL:P||"",objectFit:W.objectFit})+'")':'url("'+C+'")',$=n.includes(W.objectFit)?"fill"===W.objectFit?"100% 100%":"cover":W.objectFit,Y=U?{backgroundSize:$,backgroundPosition:W.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:U}:{},Z=function(e){let{config:t,src:l,unoptimized:r,width:i,quality:n,sizes:a,loader:s}=e;if(r)return{src:l,srcSet:void 0,sizes:void 0};let{widths:o,kind:c}=function(e,t,l){let{deviceSizes:r,allSizes:i}=e;if(l){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let r;r=e.exec(l);)t.push(parseInt(r[2]));if(t.length){let e=.01*Math.min(...t);return{widths:i.filter(t=>t>=r[0]*e),kind:"w"}}return{widths:i,kind:"w"}}return"number"!=typeof t?{widths:r,kind:"w"}:{widths:[...new Set([t,2*t].map(e=>i.find(t=>t>=e)||i[i.length-1]))],kind:"x"}}(t,i,a),d=o.length-1;return{sizes:a||"w"!==c?a:"100vw",srcSet:o.map((e,r)=>s({config:t,src:l,quality:n,width:e})+" "+("w"===c?e:r+1)+c).join(", "),src:s({config:t,src:l,quality:n,width:o[d]})}}({config:c,src:h,unoptimized:p,width:X,quality:q,sizes:m,loader:K});return{props:{...M,loading:V?"lazy":g,fetchPriority:k,width:X,height:G,decoding:R,className:x,style:{...W,...Y},sizes:Z.sizes,srcSet:Z.srcSet,src:b||Z.src},meta:{unoptimized:p,priority:f,placeholder:C,fill:_}}}},65545:(e,t)=>{"use strict";function l(e){let{widthInt:t,heightInt:l,blurWidth:r,blurHeight:i,blurDataURL:n,objectFit:a}=e,s=r?40*r:t,o=i?40*i:l,c=s&&o?"viewBox='0 0 "+s+" "+o+"'":"";return"%3Csvg xmlns='http://www.w3.org/2000/svg' "+c+"%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='"+(c?"none":"contain"===a?"xMidYMid":"cover"===a?"xMidYMid slice":"none")+"' style='filter: url(%23b);' href='"+n+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return l}})},91952:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var l in t)Object.defineProperty(e,l,{enumerable:!0,get:t[l]})}(t,{default:function(){return o},getImageProps:function(){return s}});let r=l(34007),i=l(62956),n=l(49952),a=r._(l(4632));function s(e){let{props:t}=(0,i.getImgProps)(e,{defaultLoader:a.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,l]of Object.entries(t))void 0===l&&delete t[e];return{props:t}}let o=n.Image}},e=>{e.O(0,[4260,7167,9382,8628,7271,7576,2700,5174,6985,9400,5292,861,9969,9978,636,6593,8792],()=>e(e.s=37690)),_N_E=e.O()}]);
|