@customize-agent/server 3.0.4 → 3.0.6
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 +117 -92
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +6 -0
- package/.next/server/chunks/2583.js +1 -0
- package/.next/server/chunks/3445.js +3 -0
- package/.next/server/chunks/{76.js → 5076.js} +3 -3
- package/.next/server/chunks/6352.js +1 -0
- package/.next/server/chunks/8204.js +1 -0
- package/.next/server/chunks/{580.js → 9199.js} +1 -1
- package/.next/server/chunks/9270.js +1 -0
- package/.next/server/chunks/{301.js → 9301.js} +1 -1
- package/.next/server/chunks/9705.js +1 -0
- 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/_app.js +1 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js +1 -1
- package/.next/server/pages/_document.js.nft.json +1 -1
- package/.next/server/pages/_error.js +1 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/api/config/embedding/healthCheck.js +1 -0
- package/.next/server/pages/api/config/embedding/healthCheck.js.nft.json +1 -0
- package/.next/server/pages/api/config/embedding.js +1 -0
- package/.next/server/pages/api/config/embedding.js.nft.json +1 -0
- package/.next/server/pages/api/config/healthCheck.js +1 -1
- package/.next/server/pages/api/config/healthCheck.js.nft.json +1 -1
- package/.next/server/pages/api/config/models.js +1 -1
- package/.next/server/pages/api/config/models.js.nft.json +1 -1
- package/.next/server/pages/api/config/providers/[provider].js +1 -1
- package/.next/server/pages/api/config/providers/[provider].js.nft.json +1 -1
- package/.next/server/pages/api/config/providers.js +1 -1
- package/.next/server/pages/api/config/providers.js.nft.json +1 -1
- package/.next/server/pages/api/context.js +1 -1
- package/.next/server/pages/api/context.js.nft.json +1 -1
- package/.next/server/pages/api/documents/chapter/regenerate.js +1 -0
- package/.next/server/pages/api/documents/chapter/regenerate.js.nft.json +1 -0
- package/.next/server/pages/api/documents/drafts.js +1 -0
- package/.next/server/pages/api/documents/drafts.js.nft.json +1 -0
- package/.next/server/pages/api/documents/export.js +1 -0
- package/.next/server/pages/api/documents/export.js.nft.json +1 -0
- package/.next/server/pages/api/documents/generate.js +1 -0
- package/.next/server/pages/api/documents/generate.js.nft.json +1 -0
- package/.next/server/pages/api/documents/templates.js +1 -0
- package/.next/server/pages/api/documents/templates.js.nft.json +1 -0
- package/.next/server/pages/api/health.js +1 -1
- package/.next/server/pages/api/health.js.nft.json +1 -1
- package/.next/server/pages/api/kb/categories.js +1 -1
- package/.next/server/pages/api/kb/categories.js.nft.json +1 -1
- package/.next/server/pages/api/kb/duplicates.js +1 -1
- package/.next/server/pages/api/kb/duplicates.js.nft.json +1 -1
- package/.next/server/pages/api/kb/features.js +1 -1
- package/.next/server/pages/api/kb/features.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/detail.js +1 -1
- package/.next/server/pages/api/kb/files/detail.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/open.js +1 -1
- package/.next/server/pages/api/kb/files/open.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/preview-pdf-page.js +1 -1
- package/.next/server/pages/api/kb/files/preview-pdf-page.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/reindex.js +1 -1
- package/.next/server/pages/api/kb/files/reindex.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files.js +2 -2
- package/.next/server/pages/api/kb/files.js.nft.json +1 -1
- package/.next/server/pages/api/kb/ignore.js +1 -1
- package/.next/server/pages/api/kb/ignore.js.nft.json +1 -1
- package/.next/server/pages/api/kb/operations.js +2 -2
- package/.next/server/pages/api/kb/operations.js.nft.json +1 -1
- package/.next/server/pages/api/kb/reindex.js +1 -1
- package/.next/server/pages/api/kb/reindex.js.nft.json +1 -1
- package/.next/server/pages/api/kb/search.js +1 -1
- package/.next/server/pages/api/kb/search.js.nft.json +1 -1
- package/.next/server/pages/api/kb/stats.js +1 -1
- package/.next/server/pages/api/kb/stats.js.nft.json +1 -1
- package/.next/server/pages/api/kb/tags.js +1 -1
- package/.next/server/pages/api/kb/tags.js.nft.json +1 -1
- package/.next/server/pages/api/kb/upload/progress.js +1 -1
- package/.next/server/pages/api/kb/upload/progress.js.nft.json +1 -1
- package/.next/server/pages/api/kb/upload.js +2 -2
- package/.next/server/pages/api/kb/upload.js.nft.json +1 -1
- package/.next/server/pages/api/prompt.js +1 -1
- package/.next/server/pages/api/prompt.js.nft.json +1 -1
- package/.next/server/pages/api/system/stats.js +1 -1
- package/.next/server/pages/api/system/stats.js.nft.json +1 -1
- package/.next/server/pages/context/long-term.html +1 -1
- package/.next/server/pages/context/long-term.js.nft.json +1 -1
- package/.next/server/pages/context/short-term.html +1 -1
- package/.next/server/pages/context/short-term.js.nft.json +1 -1
- package/.next/server/pages/documents.html +1 -0
- package/.next/server/pages/documents.js.nft.json +1 -0
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/file-detail.js.nft.json +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/files.js.nft.json +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/manage.js.nft.json +1 -1
- package/.next/server/pages/knowledge/search.html +1 -1
- package/.next/server/pages/knowledge/search.js.nft.json +1 -1
- package/.next/server/pages/knowledge.html +1 -1
- package/.next/server/pages/knowledge.js.nft.json +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/models.js.nft.json +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages/overview.js.nft.json +1 -1
- package/.next/server/pages/prompt.html +1 -1
- package/.next/server/pages/prompt.js.nft.json +1 -1
- package/.next/server/pages/settings.html +1 -1
- package/.next/server/pages/settings.js.nft.json +1 -1
- package/.next/server/pages-manifest.json +20 -12
- package/.next/server/webpack-api-runtime.js +1 -1
- package/.next/server/webpack-runtime.js +1 -1
- package/.next/static/chunks/{15-fed70feebb38d5ae.js → 15-c0cd098235feea60.js} +2 -2
- package/.next/static/chunks/174-002febc1c103bc03.js +10 -0
- package/.next/static/chunks/{227-eb562f29334fcb34.js → 227-5d0e79ce4e00983e.js} +1 -1
- package/.next/static/chunks/{257-c71f52e4adae1e38.js → 257-43a44acbd7b6e330.js} +1 -1
- package/.next/static/chunks/{260-03f19eaee776f7fa.js → 260-b4f5be8cad9d5eb8.js} +4 -4
- package/.next/static/chunks/292-a1cc113f5092109b.js +16 -0
- package/.next/static/chunks/400-f85b695e54242828.js +78 -0
- package/.next/static/chunks/{425-feceb6e39a2b417d.js → 425-fe4960449c1faceb.js} +2 -2
- package/.next/static/chunks/{446-3bb2f94b52176cb1.js → 446-c2604ca982998533.js} +1 -1
- package/.next/static/chunks/455-3fed2dde34ca1eef.js +6 -0
- package/.next/static/chunks/{492-5245cad2f8d60d8d.js → 492-764fcf49f0c198bc.js} +1 -1
- package/.next/static/chunks/{544-fba84f8cd64c79ed.js → 544-b1e7fb125bd5ba92.js} +1 -1
- package/.next/static/chunks/{668-db7413b6a8481a6b.js → 668-ff3d8f8bff59e606.js} +2 -2
- package/.next/static/chunks/740-2d2619c22f2573ad.js +16 -0
- package/.next/static/chunks/883-76858084c93bf1c6.js +1 -0
- package/.next/static/chunks/{891-fde3ad128ccf30dc.js → 891-ff3efd43c148bd2c.js} +1 -1
- package/.next/static/chunks/{958-6f0cb200491b344e.js → 958-ed6bd7651b040ee8.js} +1 -1
- package/.next/static/chunks/969-7ca2307001c18a53.js +1 -0
- package/.next/static/chunks/992-52509d4b96af607f.js +1 -0
- package/.next/static/chunks/pages/{_app-52fa1fa291b60bee.js → _app-d9d9adbf0172510f.js} +9 -9
- package/.next/static/chunks/pages/context/long-term-60c9b8da1fd821a9.js +1 -0
- package/.next/static/chunks/pages/context/short-term-1067b9478401973f.js +1 -0
- package/.next/static/chunks/pages/documents-a5a4df40a6ff152d.js +1 -0
- package/.next/static/chunks/pages/knowledge/file-detail-761346f946ea02fd.js +1 -0
- package/.next/static/chunks/pages/knowledge/files-28f36c822a6efa78.js +1 -0
- package/.next/static/chunks/pages/knowledge/manage-3703b1829d1901da.js +1 -0
- package/.next/static/chunks/pages/knowledge/search-03f3c606937fd44e.js +1 -0
- package/.next/static/chunks/pages/knowledge-81fd1e907a6fcb84.js +1 -0
- package/.next/static/chunks/pages/models-0a223f1f7c826b49.js +1 -0
- package/.next/static/chunks/pages/overview-6088b235c99ccb83.js +1 -0
- package/.next/static/chunks/pages/{prompt-b3dd1eeaf8e1c72e.js → prompt-80e3d275c7f9d63b.js} +1 -1
- package/.next/static/chunks/pages/{settings-e6a894618727eec3.js → settings-daf6d46ceb1dbd41.js} +1 -1
- package/.next/static/css/d284a7454d6f6b06.css +1 -0
- package/.next/static/k4Jthqz4KZmSXtMBuRWer/_buildManifest.js +1 -0
- package/package.json +8 -3
- package/.next/server/chunks/204.js +0 -1
- package/.next/server/chunks/270.js +0 -1
- package/.next/server/chunks/352.js +0 -1
- package/.next/server/chunks/583.js +0 -1
- package/.next/server/chunks/705.js +0 -1
- package/.next/static/chunks/455-d2aca155a3032ee0.js +0 -6
- package/.next/static/chunks/584-ce8dbed7354f3644.js +0 -87
- package/.next/static/chunks/740-0a79dd7ac8c2c334.js +0 -16
- package/.next/static/chunks/840-717f0706d50fcb82.js +0 -16
- package/.next/static/chunks/992-6e67409e97fe9b6b.js +0 -1
- package/.next/static/chunks/pages/context/long-term-90d88a67527287ef.js +0 -1
- package/.next/static/chunks/pages/context/short-term-5a07a4e0ef35411a.js +0 -1
- package/.next/static/chunks/pages/knowledge/file-detail-f14cf891dcdf9193.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-10375b437ab57c71.js +0 -1
- package/.next/static/chunks/pages/knowledge/manage-a894b2e4cbba0cbd.js +0 -1
- package/.next/static/chunks/pages/knowledge/search-39d8e63e83c02003.js +0 -1
- package/.next/static/chunks/pages/knowledge-b3ef77e79801287c.js +0 -1
- package/.next/static/chunks/pages/models-1af65b8a7006b9a0.js +0 -1
- package/.next/static/chunks/pages/overview-5cfd3c00eb781cca.js +0 -1
- package/.next/static/css/a89ea06061dcfec7.css +0 -1
- package/.next/static/fyNvpV8n9azsoBsro3KYz/_buildManifest.js +0 -1
- /package/.next/static/{fyNvpV8n9azsoBsro3KYz → k4Jthqz4KZmSXtMBuRWer}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[893],{260:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>P});var o=n(5321),a=n(7109),i=n(6644),r=n(7807),c=n(1702),s=n(5114),l=n(6171),d=n(3442),u=n(4668),p=n(8787),h=n(4849),y=n(9400),m=n(5258),f=n(3455),g=n(9650),x=n(8209),w=n(486),S=n(3374),j=n(8383),T=n(6619),b=n(3998),C=n(6578),v=n(5551);let O={project_fact:"项目知识",user_preference:"用户偏好",feedback:"历史纠偏",pattern:"解决方案"},A={high:"red",medium:"orange",low:"default"};function P(){let e=(0,i.Vr)(),{message:t}=r.A.useApp(),[n,P]=(0,a.useState)(!0),[N,E]=(0,a.useState)([]),[k,R]=(0,a.useState)({count:0,totalBytes:0}),[J,U]=(0,a.useState)(""),[D,I]=(0,a.useState)(!1),[_,L]=(0,a.useState)(null),[z,B]=(0,a.useState)(""),[M,H]=(0,a.useState)(""),[W,F]=(0,a.useState)(!1),X=async n=>{P(!0);try{let[e,t]=await Promise.all([(0,C.hn)("long_term",n),(0,C.p)("long_term")]);E(e),R(t)}catch(n){t.error(e("common.error"))}finally{P(!1)}};(0,a.useEffect)(()=>{X()},[]);let q=async n=>{try{await (0,C.xw)(n),t.success(e("common.success")),await X(J)}catch(n){t.error(e("common.error"))}},V=async()=>{try{await (0,C.PH)("long_term"),t.success(e("common.success")),await X(J)}catch(n){t.error(e("common.error"))}},K=async()=>{try{await (0,C.E)("long_term"),t.success(e("common.success")),await X(J)}catch(n){t.error(e("common.error"))}},Q=async()=>{if(_&&z.trim()){F(!0);try{await (0,C.zo)(_.id,{content:z.trim(),context:M||void 0}),t.success(e("common.success")),I(!1),await X(J)}catch(n){t.error(e("common.error"))}finally{F(!1)}}},Z=[{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:"类型",dataIndex:"type",width:90,render:e=>(0,o.jsx)(c.A,{children:O[e]||e})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,o.jsx)(c.A,{color:A[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,n)=>(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,o.jsx)(s.Ay,{size:"small",type:"text",icon:(0,o.jsx)(g.A,{}),onClick:()=>{L(n),B(n.content),H(""),I(!0)}}),(0,o.jsx)(l.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{q(n.id)},children:(0,o.jsx)(s.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(x.A,{})})})]})}];return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.longTermContext")}),(0,o.jsx)("p",{className:"pageDesc",children:e("context.longTermDesc")})]}),(0,o.jsxs)(d.A,{wrap:!0,children:[(0,o.jsx)(u.A,{prefix:(0,o.jsx)(w.A,{}),placeholder:e("common.search"),value:J,onChange:e=>U(e.target.value),onPressEnter:()=>{X(J)},allowClear:!0,style:{width:240}}),(0,o.jsx)(s.Ay,{icon:(0,o.jsx)(S.A,{}),onClick:()=>{V()},children:"压缩"}),(0,o.jsx)(l.A,{title:"确定清除长期上下文吗?",onConfirm:()=>{K()},children:(0,o.jsx)(s.Ay,{danger:!0,icon:(0,o.jsx)(j.A,{}),children:"清除"})})]})]}),(0,o.jsx)(p.A,{size:"small",children:(0,o.jsx)(h.A,{title:"总上下文大小",value:(0,v.z3)(k.totalBytes),prefix:(0,o.jsx)(T.A,{}),suffix:" / ".concat(k.count," 条")})}),(0,o.jsxs)(p.A,{size:"small",children:[(0,o.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(b.A,{})," ",e("context.longTermSource")]}),(0,o.jsx)(y.A,{rowKey:"id",columns:Z,dataSource:N,loading:n,size:"small",pagination:{pageSize:15}})]}),(0,o.jsx)(m.A,{title:e("models.editModel"),open:D,onCancel:()=>I(!1),onOk:()=>{Q()},confirmLoading:W,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("context.content"),children:(0,o.jsx)(u.A.TextArea,{rows:6,value:z,onChange:e=>B(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(u.A,{value:M,onChange:e=>H(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}},5551:(e,t,n)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(n/60),a=Math.floor(o/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):o>0?"".concat(o,"h ago"):n>0?"".concat(n,"m ago"):"Just now":a>0?"".concat(a," 天前"):o>0?"".concat(o," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>c,fw:()=>a,z3:()=>o});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},r={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function c(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?r:i)[e])?t:e}},6382:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/long-term",function(){return n(260)}])},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 c(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 l(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function h(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function y(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function m(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return o("/api/kb/features")}async function w(e,t){var n,a,i,r,c;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!=(c=t.limit)?c: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 S(){return o("/api/prompt")}async function j(){return o("/api/documents/templates")}async function T(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function b(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function v(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function A(){return o("/api/documents/drafts")}async function P(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function N(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function E(){return o("/api/config/providers")}async function k(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function R(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function J(){return o("/api/config/models")}async function U(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function D(){return o("/api/config/embedding")}async function I(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 L(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function z(){return o("/api/system/stats")}async function B(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function M(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function H(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function W(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function F(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function X(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function q(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>P,Bh:()=>q,Dl:()=>j,E:()=>W,FC:()=>z,H1:()=>g,H7:()=>h,HC:()=>c,HT:()=>i,II:()=>D,OX:()=>v,PH:()=>H,QT:()=>u,Qx:()=>p,R1:()=>O,SJ:()=>m,UE:()=>N,VW:()=>x,W2:()=>w,X8:()=>f,Z3:()=>E,_m:()=>k,aP:()=>U,bV:()=>C,bZ:()=>L,c1:()=>d,dd:()=>I,dx:()=>S,h0:()=>b,h1:()=>R,hc:()=>a,hn:()=>B,l2:()=>T,p:()=>M,q7:()=>A,tn:()=>s,u6:()=>_,xC:()=>r,xq:()=>y,xw:()=>F,zo:()=>X,zr:()=>J})}},e=>{e.O(0,[260,544,425,668,227,740,174,446,400,492,455,257,636,593,792],()=>e(e.s=6382)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[409],{1162:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>P});var o=n(5321),a=n(7109),i=n(6644),r=n(7807),c=n(1702),s=n(5114),l=n(6171),d=n(3442),u=n(4668),p=n(8787),h=n(4849),y=n(9400),m=n(5258),f=n(3455),g=n(9650),x=n(8209),w=n(486),S=n(3374),j=n(8383),T=n(6619),b=n(3998),C=n(6578),v=n(5551);let O={high:"red",medium:"orange",low:"default"};function P(){let e=(0,i.Vr)(),{message:t}=r.A.useApp(),[n,P]=(0,a.useState)(!0),[A,N]=(0,a.useState)([]),[E,k]=(0,a.useState)({count:0,totalBytes:0}),[R,J]=(0,a.useState)(""),[U,D]=(0,a.useState)(!1),[I,_]=(0,a.useState)(null),[L,z]=(0,a.useState)(""),[B,M]=(0,a.useState)(""),[H,W]=(0,a.useState)(!1),F=async n=>{P(!0);try{let[e,t]=await Promise.all([(0,C.hn)("short_term",n),(0,C.p)("short_term")]);N(e),k(t)}catch(n){t.error(e("common.error"))}finally{P(!1)}};(0,a.useEffect)(()=>{F()},[]);let X=async n=>{try{await (0,C.xw)(n),t.success(e("common.success")),await F(R)}catch(n){t.error(e("common.error"))}},q=async()=>{try{await (0,C.PH)("short_term"),t.success(e("common.success")),await F(R)}catch(n){t.error(e("common.error"))}},V=async()=>{try{await (0,C.E)("short_term"),t.success(e("common.success")),await F(R)}catch(n){t.error(e("common.error"))}},K=async()=>{if(I&&L.trim()){W(!0);try{await (0,C.zo)(I.id,{content:L.trim(),context:B||void 0}),t.success(e("common.success")),D(!1),await F(R)}catch(n){t.error(e("common.error"))}finally{W(!1)}}},Q=[{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,o.jsx)(c.A,{color:O[e]||"default",children:"high"===e?"高":"medium"===e?"中":"低"})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.source"),dataIndex:"source",width:120,ellipsis:!0},{title:e("context.updatedAt"),dataIndex:"updated_at",width:140,render:e=>e?new Date(e).toLocaleString():"-"},{title:e("common.edit"),width:100,render:(t,n)=>(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,o.jsx)(s.Ay,{size:"small",type:"text",icon:(0,o.jsx)(g.A,{}),onClick:()=>{_(n),z(n.content),M(""),D(!0)}}),(0,o.jsx)(l.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{X(n.id)},children:(0,o.jsx)(s.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(x.A,{})})})]})}];return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.shortTermContext")}),(0,o.jsx)("p",{className:"pageDesc",children:e("context.shortTermDesc")})]}),(0,o.jsxs)(d.A,{wrap:!0,children:[(0,o.jsx)(u.A,{prefix:(0,o.jsx)(w.A,{}),placeholder:e("common.search"),value:R,onChange:e=>J(e.target.value),onPressEnter:()=>{F(R)},allowClear:!0,style:{width:240}}),(0,o.jsx)(s.Ay,{icon:(0,o.jsx)(S.A,{}),onClick:()=>{q()},children:"压缩"}),(0,o.jsx)(l.A,{title:"确定清除短期上下文吗?",onConfirm:()=>{V()},children:(0,o.jsx)(s.Ay,{danger:!0,icon:(0,o.jsx)(j.A,{}),children:"清除"})})]})]}),(0,o.jsx)(p.A,{size:"small",children:(0,o.jsx)(h.A,{title:"总上下文大小",value:(0,v.z3)(E.totalBytes),prefix:(0,o.jsx)(T.A,{}),suffix:" / ".concat(E.count," 条")})}),(0,o.jsxs)(p.A,{size:"small",children:[(0,o.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(b.A,{})," ",e("context.shortTermSource")]}),(0,o.jsx)(y.A,{rowKey:"id",columns:Q,dataSource:A,loading:n,size:"small",pagination:{pageSize:15}})]}),(0,o.jsx)(m.A,{title:e("models.editModel"),open:U,onCancel:()=>D(!1),onOk:()=>{K()},confirmLoading:H,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("context.content"),children:(0,o.jsx)(u.A.TextArea,{rows:6,value:L,onChange:e=>z(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(u.A,{value:B,onChange:e=>M(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}},5551:(e,t,n)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(n/60),a=Math.floor(o/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):o>0?"".concat(o,"h ago"):n>0?"".concat(n,"m ago"):"Just now":a>0?"".concat(a," 天前"):o>0?"".concat(o," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>c,fw:()=>a,z3:()=>o});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},r={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function c(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?r:i)[e])?t:e}},6578:(e,t,n)=>{"use strict";async function 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 c(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 l(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function h(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function y(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function m(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return o("/api/kb/features")}async function w(e,t){var n,a,i,r,c;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!=(c=t.limit)?c: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 S(){return o("/api/prompt")}async function j(){return o("/api/documents/templates")}async function T(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function b(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function v(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(){return o("/api/documents/drafts")}async function A(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function N(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function E(){return o("/api/config/providers")}async function k(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function R(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function J(){return o("/api/config/models")}async function U(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function D(){return o("/api/config/embedding")}async function I(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 L(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function z(){return o("/api/system/stats")}async function B(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function M(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function H(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function W(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function F(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function X(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function q(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>A,Bh:()=>q,Dl:()=>j,E:()=>W,FC:()=>z,H1:()=>g,H7:()=>h,HC:()=>c,HT:()=>i,II:()=>D,OX:()=>v,PH:()=>H,QT:()=>u,Qx:()=>p,R1:()=>O,SJ:()=>m,UE:()=>N,VW:()=>x,W2:()=>w,X8:()=>f,Z3:()=>E,_m:()=>k,aP:()=>U,bV:()=>C,bZ:()=>L,c1:()=>d,dd:()=>I,dx:()=>S,h0:()=>b,h1:()=>R,hc:()=>a,hn:()=>B,l2:()=>T,p:()=>M,q7:()=>P,tn:()=>s,u6:()=>_,xC:()=>r,xq:()=>y,xw:()=>F,zo:()=>X,zr:()=>J})},9164:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/short-term",function(){return n(1162)}])}},e=>{e.O(0,[260,544,425,668,227,740,174,446,400,492,455,257,636,593,792],()=>e(e.s=9164)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{6403:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return n(9562)}])},6578:(e,t,n)=>{"use strict";async function i(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function s(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return i("/api/kb/stats".concat(t))}async function o(e){var t,n;let s=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&s.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&s.set("category",e.category),(null==e?void 0:e.page)&&s.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&s.set("limit",String(null!=(n=e.limit)?n:50)),i("/api/kb/files?".concat(s))}async function a(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),i("/api/kb/files/detail?".concat(n))}async function r(e,t){return i("/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 i("/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 i=new FileReader;i.onload=()=>{let e=i.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},i.onerror=n,i.readAsDataURL(e)})}async function d(e,t,n){return i("/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 i("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function m(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),i("/api/kb/operations?".concat(t))}async function p(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),i("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return i("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return i("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function x(e){return i("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function j(e){return i("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function f(){return i("/api/kb/features")}async function g(e,t){var n,s,o,a,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==(s=t.weights)?void 0:s.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(o=t.weights)?void 0:o.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(a=t.weights)?void 0:a.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),i("/api/kb/search?".concat(c))}async function b(){return i("/api/prompt")}async function A(){return i("/api/documents/templates")}async function w(e){return i("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e){return i("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function S(e){return i("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function T(e){return i("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return i("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(){return i("/api/documents/drafts")}async function I(e,t){return i("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function P(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function N(){return i("/api/config/providers")}async function O(e,t){return i("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function E(e){return i("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(){return i("/api/config/models")}async function U(e){return i("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J(){return i("/api/config/embedding")}async function D(e){return i("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function z(){return i("/api/config/embedding/healthCheck",{method:"POST"})}async function L(e){return i("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function F(){return i("/api/system/stats")}async function q(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return i("/api/context".concat(n))}async function _(e){return i("/api/context?type=".concat(e,"&stats=1"))}async function H(e){return i("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function M(e){return i("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function V(e){return i("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function W(e,t){return i("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function X(e){return i("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>I,Bh:()=>X,Dl:()=>A,E:()=>M,FC:()=>F,H1:()=>j,H7:()=>p,HC:()=>r,HT:()=>o,II:()=>J,OX:()=>T,PH:()=>H,QT:()=>u,Qx:()=>m,R1:()=>k,SJ:()=>y,UE:()=>P,VW:()=>f,W2:()=>g,X8:()=>x,Z3:()=>N,_m:()=>O,aP:()=>U,bV:()=>S,bZ:()=>L,c1:()=>d,dd:()=>D,dx:()=>b,h0:()=>v,h1:()=>E,hc:()=>s,hn:()=>q,l2:()=>w,p:()=>_,q7:()=>C,tn:()=>c,u6:()=>z,xC:()=>a,xq:()=>h,xw:()=>V,zo:()=>W,zr:()=>R})},9562:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>U});var i=n(5321),s=n(7109),o=n(4668),a=n(5292),r=n(7807),c=n(3455),l=n(8787),d=n(5114),u=n(2256),m=n(8770),p=n(8332),h=n(4253),y=n(6171),x=n(3442),j=n(1702),f=n(7271),g=n(8569),b=n(5258),A=n(4746),w=n(3051),v=n(9650),S=n(8209),T=n(9012),k=n(9071),C=n(7547),I=n(6830),P=n(2192),N=n(6578),O=n(6644);let{TextArea:E}=o.A,{Paragraph:R}=a.A;function U(){var e,t,n,a,U,J,D,z;let L=(0,O.Vr)(),{message:F}=r.A.useApp(),[q]=c.A.useForm(),[_,H]=(0,s.useState)([]),[M,V]=(0,s.useState)("construction-organization-design"),[W,X]=(0,s.useState)([]),[B,Q]=(0,s.useState)([]),[Z,G]=(0,s.useState)(!1),[K,Y]=(0,s.useState)(null),[$,ee]=(0,s.useState)(""),[et,en]=(0,s.useState)([]),[ei,es]=(0,s.useState)(!1),[eo,ea]=(0,s.useState)(null),[er,ec]=(0,s.useState)(!1),el=async()=>{try{en((await (0,N.q7)()).drafts)}catch(e){en([])}};(0,s.useEffect)(()=>{(0,N.Dl)().then(e=>{var t,n;H(e.templates),V(null!=(n=null==(t=e.templates[0])?void 0:t.id)?n:"construction-organization-design")}).catch(()=>F.error(L("common.error"))),(0,N.dx)().then(X).catch(()=>X([])),(0,N.HT)().then(e=>Q(e.files)).catch(()=>Q([])),el()},[F,L]);let ed=(0,s.useMemo)(()=>_.find(e=>e.id===M),[_,M]),eu=e=>{q.setFieldsValue(null!=e?e:{id:"custom-template-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",promptIds:[],boundFilePaths:[],chapters:[]}),ec(!0)},em=async()=>{try{let e=await q.validateFields(),t=await (0,N.l2)(e);H(t.templates),V(t.template.id),ec(!1),F.success(L("common.success"))}catch(e){e instanceof Error&&F.error(e.message)}},ep=async e=>{try{let t=await (0,N.bV)(e);H(t.templates),V(t.template.id),F.success(L("common.success"))}catch(e){F.error(L("common.error"))}},eh=async e=>{try{var t,n;let i=await (0,N.h0)(e);H(i.templates),V(null!=(n=null==(t=i.templates[0])?void 0:t.id)?n:""),F.success(L("common.success"))}catch(e){F.error(L("common.error"))}},ey=async()=>{if(M){G(!0);try{let e=await (0,N.OX)({templateId:M});Y(e.draft),ee(e.draft.markdown),F.success(L("common.success"))}catch(e){F.error(e instanceof Error?e.message:L("common.error"))}finally{G(!1)}}},ex=async e=>{if(K){es(!0);try{var t=await (0,N.UE)({title:K.title,markdown:$,format:e}),n="".concat(K.title,".").concat("markdown"===e?"md":e);let i=URL.createObjectURL(t),s=document.createElement("a");s.href=i,s.download=n,s.click(),URL.revokeObjectURL(i)}catch(e){F.error(L("common.error"))}finally{es(!1)}}},ej=async()=>{if(K)try{let e=await (0,N.Af)({...K,markdown:$});Y(e.draft),await el(),F.success(L("common.success"))}catch(e){F.error(L("common.error"))}},ef=async e=>{if(K){ea(e.id);try{var t;let n=await (0,N.R1)({templateId:K.templateId,chapterId:e.id}),i=K.chapters.map(t=>t.id===e.id?n.chapter:t);Y({...K,chapters:i}),t=n.chapter,ee(n=>n.includes(e.content)?n.replace(e.content,t.content):"".concat(n,"\n\n").concat(t.content)),F.success(L("common.success"))}catch(e){F.error(L("common.error"))}finally{ea(null)}}};return(0,i.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,i.jsx)(l.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,i.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"pageTitle mb-1",children:L("documents.title")}),(0,i.jsx)("p",{className:"pageDesc mb-0",children:L("documents.description")})]}),(0,i.jsx)(d.Ay,{type:"primary",size:"large",icon:(0,i.jsx)(A.A,{}),onClick:()=>eu(),children:L("documents.newTemplate")})]})}),(0,i.jsxs)(u.A,{gutter:[16,16],align:"top",children:[(0,i.jsxs)(m.A,{xs:24,lg:8,children:[(0,i.jsx)(l.A,{size:"small",title:L("documents.templateLibrary"),children:(0,i.jsx)(p.A,{dataSource:_,locale:{emptyText:(0,i.jsx)(h.A,{description:L("common.noData")})},renderItem:e=>(0,i.jsx)(p.A.Item,{onClick:()=>V(e.id),className:"cursor-pointer",actions:[(0,i.jsx)(d.Ay,{size:"small",type:"text",icon:(0,i.jsx)(w.A,{}),onClick:t=>{t.stopPropagation(),ep(e.id)}},"copy"),(0,i.jsx)(d.Ay,{size:"small",type:"text",icon:(0,i.jsx)(v.A,{}),disabled:e.builtIn,onClick:t=>{t.stopPropagation(),eu(e)}},"edit"),(0,i.jsx)(y.A,{title:L("documents.deleteTemplateConfirm"),disabled:e.builtIn,onConfirm:t=>{null==t||t.stopPropagation(),eh(e.id)},children:(0,i.jsx)(d.Ay,{size:"small",type:"text",danger:!0,icon:(0,i.jsx)(S.A,{}),disabled:e.builtIn,onClick:e=>e.stopPropagation()})},"delete")],children:(0,i.jsx)(p.A.Item.Meta,{avatar:(0,i.jsx)(T.A,{}),title:(0,i.jsxs)(x.A,{children:[(0,i.jsx)("span",{children:e.name}),e.builtIn&&(0,i.jsx)(j.A,{children:L("documents.builtIn")}),M===e.id&&(0,i.jsx)(j.A,{color:"blue",children:L("documents.selected")})]}),description:(0,i.jsxs)(x.A,{direction:"vertical",size:2,children:[(0,i.jsx)("span",{children:e.description}),(0,i.jsx)(j.A,{children:e.category})]})})})})}),(0,i.jsx)(l.A,{className:"mt-4",size:"small",title:L("documents.draftHistory"),children:(0,i.jsx)(p.A,{size:"small",dataSource:et.slice(0,8),locale:{emptyText:(0,i.jsx)(h.A,{description:L("common.noData")})},renderItem:e=>(0,i.jsx)(p.A.Item,{onClick:()=>{Y(e),ee(e.markdown),V(e.templateId)},className:"cursor-pointer",children:(0,i.jsx)(p.A.Item.Meta,{title:e.title,description:new Date(e.updatedAt).toLocaleString()})})})})]}),(0,i.jsx)(m.A,{xs:24,lg:16,children:(0,i.jsx)(l.A,{size:"small",title:L("documents.workflow"),children:(0,i.jsxs)(x.A,{direction:"vertical",className:"w-full",size:"middle",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("span",{className:"block mb-1",children:L("documents.template")}),(0,i.jsx)(f.A,{className:"w-full",value:M,onChange:V,options:_.map(e=>({label:e.name,value:e.id}))})]}),ed&&(0,i.jsxs)(l.A,{size:"small",type:"inner",title:ed.outputTitle,children:[(0,i.jsx)(R,{children:ed.description}),(0,i.jsxs)(x.A,{wrap:!0,children:[null==(e=ed.promptIds)?void 0:e.map(e=>{var t;return(0,i.jsx)(j.A,{color:"purple",children:(null==(t=W.find(t=>t.id===e))?void 0:t.projectName)||e},e)}),null==(t=ed.boundFilePaths)?void 0:t.map(e=>(0,i.jsx)(j.A,{color:"blue",children:e},e))]})]}),ed&&(0,i.jsxs)(x.A,{direction:"vertical",size:4,children:[(0,i.jsxs)("span",{children:[L("documents.boundPrompts"),": ",null!=(D=null==(n=ed.promptIds)?void 0:n.length)?D:0]}),(0,i.jsxs)("span",{children:[L("documents.boundFiles"),": ",null!=(z=null==(a=ed.boundFilePaths)?void 0:a.length)?z:0]})]}),(0,i.jsx)(d.Ay,{type:"primary",size:"large",block:!0,icon:(0,i.jsx)(k.A,{}),loading:Z,disabled:!(null==ed||null==(U=ed.promptIds)?void 0:U.length)||!(null==ed||null==(J=ed.boundFilePaths)?void 0:J.length),onClick:()=>{ey()},children:L("documents.generate")})]})})})]}),(0,i.jsx)(l.A,{size:"small",title:L("documents.editor"),extra:(0,i.jsx)(x.A,{wrap:!0,children:K&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.Ay,{icon:(0,i.jsx)(C.A,{}),onClick:()=>{ej()},children:L("documents.saveDraft")}),(0,i.jsx)(d.Ay,{icon:(0,i.jsx)(I.A,{}),loading:ei,onClick:()=>{ex("markdown")},children:L("documents.downloadMarkdown")}),(0,i.jsx)(d.Ay,{loading:ei,onClick:()=>{ex("html")},children:L("documents.exportHtml")}),(0,i.jsx)(d.Ay,{type:"primary",loading:ei,onClick:()=>{ex("pdf")},children:L("documents.exportPdf")})]})}),children:K?(0,i.jsx)(g.A,{items:[{key:"edit",label:L("documents.edit"),children:(0,i.jsx)(E,{rows:26,value:$,onChange:e=>ee(e.target.value)})},{key:"chapters",label:L("documents.chapters"),children:(0,i.jsx)(p.A,{dataSource:K.chapters,renderItem:e=>(0,i.jsx)(p.A.Item,{actions:[(0,i.jsx)(d.Ay,{size:"small",icon:(0,i.jsx)(P.A,{}),loading:eo===e.id,onClick:()=>{ef(e)},children:L("documents.regenerateChapter")},"regen")],children:(0,i.jsx)(p.A.Item.Meta,{title:e.title,description:(0,i.jsxs)(x.A,{direction:"vertical",children:[(0,i.jsxs)("span",{children:[L("documents.evidenceCount"),": ",e.evidence.length]}),(0,i.jsxs)("span",{children:[L("documents.missingCount"),": ",e.missingFacts.length]})]})})})})},{key:"sources",label:L("documents.sources"),children:(0,i.jsx)(p.A,{dataSource:K.sources,renderItem:e=>(0,i.jsxs)(p.A.Item,{children:[(0,i.jsx)("span",{children:e.filePath}),(0,i.jsx)(j.A,{children:e.count})]})})},{key:"missing",label:L("documents.missingItems"),children:0===K.missingItems.length?(0,i.jsx)(h.A,{description:L("common.noData")}):(0,i.jsx)(p.A,{dataSource:K.missingItems,renderItem:e=>(0,i.jsx)(p.A.Item,{children:e})})},{key:"validation",label:L("documents.validation"),children:(0,i.jsxs)(x.A,{direction:"vertical",className:"w-full",children:[K.validation.warnings.map(e=>(0,i.jsx)(j.A,{color:"warning",children:e},e)),K.validation.errors.map(e=>(0,i.jsx)(j.A,{color:"error",children:e},e))]})}]}):(0,i.jsx)(h.A,{description:L("documents.noDraft")})}),(0,i.jsx)(b.A,{title:L("documents.templateEditor"),open:er,onOk:()=>{em()},onCancel:()=>ec(!1),width:760,centered:!0,okText:L("common.save"),children:(0,i.jsxs)(c.A,{form:q,layout:"vertical",requiredMark:"optional",children:[(0,i.jsxs)(u.A,{gutter:12,children:[(0,i.jsx)(m.A,{xs:24,md:8,children:(0,i.jsx)(c.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,i.jsx)(o.A,{disabled:!0})})}),(0,i.jsx)(m.A,{xs:24,md:8,children:(0,i.jsx)(c.A.Item,{name:"name",label:L("documents.templateName"),rules:[{required:!0}],children:(0,i.jsx)(o.A,{})})}),(0,i.jsx)(m.A,{xs:24,md:8,children:(0,i.jsx)(c.A.Item,{name:"category",label:L("documents.templateCategory"),children:(0,i.jsx)(o.A,{})})}),(0,i.jsx)(m.A,{xs:24,md:12,children:(0,i.jsx)(c.A.Item,{name:"outputTitle",label:L("documents.outputTitle"),children:(0,i.jsx)(o.A,{})})}),(0,i.jsx)(m.A,{xs:24,md:12,children:(0,i.jsx)(c.A.Item,{name:"description",label:L("documents.templateDescription"),children:(0,i.jsx)(o.A,{})})})]}),(0,i.jsx)(c.A.Item,{name:"promptIds",label:L("documents.boundPrompts"),rules:[{required:!0,message:L("documents.boundPromptsRequired")}],children:(0,i.jsx)(f.A,{mode:"multiple",showSearch:!0,placeholder:L("documents.boundPromptsRequired"),options:W.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})}),(0,i.jsx)(c.A.Item,{name:"boundFilePaths",label:L("documents.boundFiles"),rules:[{required:!0,message:L("documents.boundFilesRequired")}],children:(0,i.jsx)(f.A,{mode:"multiple",showSearch:!0,placeholder:L("documents.boundFilesRequired"),options:B.map(e=>({label:e.relativePath,value:e.relativePath}))})})]})})]})}}},e=>{e.O(0,[260,544,425,668,227,740,174,492,455,292,883,636,593,792],()=>e(e.s=6403)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[309],{4569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusPanel:"style_statusPanel__9arTu",statusPanelHeader:"style_statusPanelHeader__nKv1I",statusEmpty:"style_statusEmpty__8LWzH",statusList:"style_statusList__FpNgC",statusItem:"style_statusItem__uzO80",statusHeader:"style_statusHeader__o9q_b",statusDesc:"style_statusDesc__XiWFa",statusPath:"style_statusPath__Udxvv",statusMeta:"style_statusMeta__XukHt",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},5551:(e,t,n)=>{"use strict";function a(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),a=Math.floor(n/60),i=Math.floor(a/24);return i>30?new Date(e).toLocaleDateString(t):"en-US"===t?i>0?"".concat(i,"d ago"):a>0?"".concat(a,"h ago"):n>0?"".concat(n,"m ago"):"Just now":i>0?"".concat(i," 天前"):a>0?"".concat(a," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>o,fw:()=>i,z3:()=>a});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},l={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function o(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?l:r)[e])?t:e}},5819:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>E});var a=n(5321),i=n(7109),r=n(1873),l=n.n(r),o=n(3220),s=n.n(o),c=n(6109),d=n(5292),u=n(6506),p=n(3442),h=n(1702),m=n(9137),y=n(9400),f=n(8787),g=n(6985),x=n(3657),j=n(4253),w=n(2700),S=n(5114),b=n(8569),v=n(4668),C=n(6578),k=n(5551),A=n(4569),_=n.n(A);let{Paragraph:P}=d.A;function N(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}function T(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).slice(0,30):[]}function O(e,t){let n=t.trim()?[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length):[];if(0===n.length)return e;let i=RegExp("(".concat(n.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(i).map((e,t)=>n.some(t=>t.toLowerCase()===e.toLowerCase())?(0,a.jsx)("mark",{children:e},t):e)}function R(e,t,n){return null==t||""===t||Array.isArray(t)&&0===t.length?null:(0,a.jsx)(u.A.Item,{label:e,children:Array.isArray(t)?(0,a.jsx)(p.A,{wrap:!0,children:t.map(e=>(0,a.jsx)(h.A,{className:"cursor-pointer",onClick:()=>null==n?void 0:n(String(e)),children:String(e)},String(e)))}):String(t)})}function I(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return e.map((e,n)=>({key:"".concat(t,"-").concat(n),name:e}))}function E(){var e,t,n,r,o,d,A,E,J,z;let L=(0,c.useRouter)(),D="string"==typeof L.query.relativePath?L.query.relativePath:"",[U,M]=(0,i.useState)(),[H,F]=(0,i.useState)(!1),[B,K]=(0,i.useState)(!1),[X,V]=(0,i.useState)(""),[W,q]=(0,i.useState)([]);(0,i.useEffect)(()=>{D&&(F(!0),(0,C.xC)(D).then(M).finally(()=>F(!1)))},[D]);let $=(0,i.useMemo)(()=>(function(e){let t=N(null==e?void 0:e.file.metadataJson);return"object"==typeof t.extraction&&t.extraction?t.extraction:t})(U),[U]),G=T($.layerNames);(0,i.useEffect)(()=>{q(G)},[null==U?void 0:U.file.relativePath,G.join("|")]);let Z=X.trim().toLowerCase(),Q=(0,i.useMemo)(()=>{var e;return U&&Z?U.chunks.filter(e=>{let t=N(e.metadataJson);return[e.content,e.sectionTitle,t.rowRange,t.chunkKind,t.parentId,JSON.stringify(t)].some(e=>String(null!=e?e:"").toLowerCase().includes(Z))}):null!=(e=null==U?void 0:U.chunks)?e:[]},[U,Z]),Y=(0,i.useMemo)(()=>{var e;return U&&Z?U.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(Z))):null!=(e=null==U?void 0:U.parents)?e:[]},[U,Z]),ee=async()=>{if(D){K(!0);try{let e=await (0,C.HC)(D);e.detail&&M(e.detail),m.Ay.success("文件索引已重建")}finally{K(!1)}}},et=async e=>{e&&(await navigator.clipboard.writeText(e),m.Ay.success("已复制"))},en=async e=>{D&&(await (0,C.tn)(D,e),m.Ay.success("file"===e?"已请求打开文件":"已请求打开目录"))},ea=[{key:"table",label:"表格",children:(0,a.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[(0,a.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[R("Sheet",T($.sheetNames),V),R("表头",T($.columnNames),V),R("行数",$.rowCount),R("列数",$.columnCount),R("公式数",$.formulaCount),R("合并单元格",$.mergeCount)]}),(0,a.jsx)(y.A,{size:"small",pagination:!1,rowKey:"key",dataSource:I(T($.columnNames),"column"),columns:[{title:"列名",dataIndex:"name",render:e=>(0,a.jsx)(h.A,{className:"cursor-pointer",onClick:()=>V(String(e)),children:String(e)})}]}),(0,a.jsx)(y.A,{size:"small",pagination:!1,rowKey:"key",dataSource:(null!=(A=null==U?void 0:U.chunks)?A:[]).map(e=>N(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,t)=>({key:"row-".concat(t),name:e})),columns:[{title:"行范围",dataIndex:"name",render:e=>(0,a.jsxs)(h.A,{color:"gold",className:"cursor-pointer",onClick:()=>V(String(e)),children:["行 ",String(e)]})}]}),(0,a.jsx)(y.A,{size:"small",rowKey:"key",dataSource:(null!=(E=null==U?void 0:U.chunks)?E:[]).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,a.jsx)(p.A,{wrap:!0,children:e.map((e,t)=>(0,a.jsx)(h.A,{children:e},"".concat(e,"-").concat(t)))})}]})]})},{key:"drawing",label:"图纸",children:(0,a.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[(0,a.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[R("图层",T($.layerNames),V),R("块/符号",T($.blockNames),V),R("实体类型",T($.entityTypes),V),R("产品/零件",T($.productNames),V),R("材料",T($.materialNames),V),R("实体名称",T($.entityNames),V)]}),G.length>0?(0,a.jsxs)(f.A,{size:"small",title:"图层开关 / 图纸预览",children:[(0,a.jsx)(g.A.Group,{value:W,options:G.map(e=>({label:e,value:e})),onChange:e=>q(e.map(String))}),(0,a.jsx)("div",{className:_().drawingPreview,children:W.map(e=>(0,a.jsx)(h.A,{color:"blue",children:e},e))})]}):null,(0,a.jsx)(y.A,{size:"small",pagination:!1,rowKey:"key",dataSource:[...I(G,"layer").map(e=>({...e,type:"图层"})),...I(T($.entityTypes),"entity").map(e=>({...e,type:"实体类型"})),...I(T($.blockNames),"block").map(e=>({...e,type:"块/符号"}))],columns:[{title:"类型",dataIndex:"type",width:120},{title:"名称",dataIndex:"name",render:e=>(0,a.jsx)(h.A,{className:"cursor-pointer",onClick:()=>V(String(e)),children:String(e)})}]})]})},{key:"data",label:"数据路径",children:(0,a.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[T($.dataPaths).length>0?(0,a.jsx)(x.A,{defaultExpandAll:!0,treeData:function(e){let t=new Map;for(let n of e){let e=t;for(let t of n.replace(/\[(\d+)\]/gu,".$1").split(".").filter(Boolean))e.has(t)||e.set(t,new Map),e=e.get(t)}let n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return[...e.entries()].map(e=>{let[a,i]=e;return{title:a,key:t?"".concat(t,".").concat(a):a,children:n(i,t?"".concat(t,".").concat(a):a)}})};return n(t)}(T($.dataPaths)),onSelect:e=>{var t;return V(String(null!=(t=e[0])?t:""))}}):(0,a.jsx)(j.A,{description:"暂无数据路径"}),(0,a.jsx)(y.A,{size:"small",rowKey:"key",dataSource:(null!=(J=null==U?void 0:U.chunks)?J:[]).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 n,a,i,r;let l=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(t),path:null!=(i=null==l||null==(n=l[1])?void 0:n.trim())?i:e,value:null!=(r=null==l||null==(a=l[2])?void 0:a.trim())?r:""}}),pagination:{pageSize:20},columns:[{title:"Path",dataIndex:"path",width:260,render:e=>(0,a.jsx)(h.A,{className:"cursor-pointer",onClick:()=>V(String(e)),children:String(e)})},{title:"Value",dataIndex:"value",render:e=>(0,a.jsx)("span",{className:"break-all",children:String(e)})}]})]})},{key:"ocr",label:"OCR/PDF",children:(0,a.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[(0,a.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[R("OCR 建议",$.ocrRecommended),R("OCR 原因",$.ocrReason),R("OCR 引擎",$.ocrProvider),R("OCR 语言",$.ocrLanguages),R("OCR 文本长度",$.ocrTextLength),R("PDF 页面 OCR 支持",$.pdfPageOcrSupported),R("PDF OCR 页数",$.ocrPageCount),R("PDF OCR 页数上限",$.pdfOcrPageLimit),R("PDF 渲染器",$.pdfRenderer)]}),(null==U?void 0:U.file.format)==="pdf"?(0,a.jsx)("div",{className:_().pdfPreviewStrip,children:Array.from({length:Math.min(Number(null!=(e=$.ocrPageCount)?e:1)||1,6)},(e,t)=>(0,a.jsx)(l(),{width:220,height:320,src:"/api/kb/files/preview-pdf-page?relativePath=".concat(encodeURIComponent(U.file.relativePath),"&page=").concat(t+1),alt:"PDF 第 ".concat(t+1," 页"),unoptimized:!0},t))}):null,(0,a.jsx)(y.A,{size:"small",rowKey:"key",dataSource:(null!=(z=null==U?void 0:U.chunks)?z:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,t,n,a)=>{var i,r,l;return n%2==0&&e.push({key:"page-".concat(t),page:t,text:null!=(l=null==(r=a[n+1])||null==(i=r.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:i.trim())?l:""}),e},[]),pagination:{pageSize:10},columns:[{title:"页码",dataIndex:"page",width:90},{title:"OCR 文本",dataIndex:"text",render:e=>(0,a.jsx)(P,{ellipsis:{rows:4,expandable:!0,symbol:"展开"},children:String(e)})}]})]})}],ei=[{title:"#",dataIndex:"chunkIndex",width:70,render:e=>String(e)},{title:"类型",width:110,render:(e,t)=>{var n;return(0,a.jsx)(h.A,{children:String(null!=(n=N(t.metadataJson).chunkKind)?n:t.category)})}},{title:"章节/范围",width:220,render:(e,t)=>{let n=N(t.metadataJson),i="string"==typeof n.rowRange?n.rowRange:void 0;return(0,a.jsxs)(p.A,{wrap:!0,children:[t.sectionTitle?(0,a.jsx)(h.A,{color:"cyan",children:t.sectionTitle}):null,i?(0,a.jsxs)(h.A,{color:"gold",children:["行 ",i]}):null]})}},{title:"Token",dataIndex:"tokenCount",width:90},{title:"内容",render:(e,t)=>(0,a.jsx)(P,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:_().searchContent,children:O(t.content,X)})}],er=[{title:"Parent",dataIndex:"parentId",width:260,render:e=>(0,a.jsx)("span",{className:"break-all",children:e})},{title:"切片数",dataIndex:"chunkCount",width:90},{title:"章节",dataIndex:"sectionTitle",width:220},{title:"内容",render:(e,t)=>(0,a.jsx)(P,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:_().searchContent,children:O(t.content,X)})}];return H?(0,a.jsx)(w.A,{}):U?(0,a.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(s(),{href:"/knowledge/files",children:"返回文件列表"}),(0,a.jsxs)("div",{className:_().searchResultHeader,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle",children:"文件详情"}),(0,a.jsx)("p",{className:"pageDesc",children:"查看解析结果、图纸/表格/数据结构化字段、parent chunk 和 child chunk。"})]}),(0,a.jsxs)(p.A,{children:[(0,a.jsx)(S.Ay,{onClick:()=>{et(null==U?void 0:U.absolutePath)},children:"复制原文件路径"}),(0,a.jsx)(S.Ay,{onClick:()=>{et(null==U?void 0:U.directory)},children:"复制所在目录"}),(0,a.jsx)(S.Ay,{onClick:()=>{en("file")},children:"打开文件"}),(0,a.jsx)(S.Ay,{onClick:()=>{en("directory")},children:"打开目录"}),"pdf"===U.file.format?(0,a.jsx)(S.Ay,{loading:B,onClick:()=>{ee()},children:"重新 OCR"}):null,(0,a.jsx)(S.Ay,{type:"primary",loading:B,onClick:()=>{ee()},children:"重建该文件索引"})]})]})]}),(0,a.jsx)(f.A,{size:"small",title:"基础信息",children:(0,a.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[(0,a.jsx)(u.A.Item,{label:"路径",children:U.file.relativePath}),(0,a.jsx)(u.A.Item,{label:"原文件",children:null!=(t=U.absolutePath)?t:"-"}),(0,a.jsx)(u.A.Item,{label:"所在目录",children:null!=(n=U.directory)?n:"-"}),(0,a.jsxs)(u.A.Item,{label:"分类",children:[(0,a.jsx)(h.A,{children:(0,k.Jm)(U.file.category)})," ",(0,a.jsx)(h.A,{children:U.file.format})]}),(0,a.jsx)(u.A.Item,{label:"大小",children:(0,k.z3)(U.file.fileSize)}),(0,a.jsx)(u.A.Item,{label:"切片数",children:U.file.chunkCount}),(0,a.jsx)(u.A.Item,{label:"状态",children:U.file.status}),(0,a.jsx)(u.A.Item,{label:"解析模式",children:String(null!=(r=$.extractionMode)?r:"-")}),(0,a.jsx)(u.A.Item,{label:"覆盖范围",children:String(null!=(o=$.contentCoverage)?o:"-")}),(0,a.jsx)(u.A.Item,{label:"正文长度",children:String(null!=(d=$.textLength)?d:"-")})]})}),(0,a.jsx)(f.A,{size:"small",title:"结构化信息",children:(0,a.jsx)(b.A,{items:ea})}),(0,a.jsx)(f.A,{size:"small",title:"详情筛选",children:(0,a.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[(0,a.jsx)(v.A,{allowClear:!0,value:X,onChange:e=>V(e.target.value),placeholder:"筛选 rowRange、图层、实体、data path、section、chunk 内容"}),X?(0,a.jsxs)(p.A,{wrap:!0,children:[(0,a.jsxs)(h.A,{color:"blue",children:["Parent 命中 ",Y.length]}),(0,a.jsxs)(h.A,{color:"green",children:["Child 命中 ",Q.length]}),(0,a.jsxs)(h.A,{color:"purple",children:["筛选词 ",X]})]}):null]})}),(0,a.jsx)(f.A,{size:"small",title:"Parent Chunks (".concat(Y.length,"/").concat(U.parents.length,")"),children:(0,a.jsx)(y.A,{rowKey:"id",columns:er,dataSource:Y,pagination:{pageSize:10},size:"small"})}),(0,a.jsx)(f.A,{size:"small",title:"Child Chunks (".concat(Q.length,"/").concat(U.chunks.length,")"),children:(0,a.jsx)(y.A,{rowKey:"id",columns:ei,dataSource:Q,pagination:{pageSize:20},size:"small"})})]}):(0,a.jsx)(j.A,{description:"请选择文件"})}},6578:(e,t,n)=>{"use strict";async function a(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function i(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(t))}async function r(e){var t,n;let i=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&i.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&i.set("category",e.category),(null==e?void 0:e.page)&&i.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&i.set("limit",String(null!=(n=e.limit)?n:50)),a("/api/kb/files?".concat(i))}async function l(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),a("/api/kb/files/detail?".concat(n))}async function o(e,t){return a("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function s(e,t,n){return a("/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 a=new FileReader;a.onload=()=>{let e=a.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},a.onerror=n,a.readAsDataURL(e)})}async function d(e,t,n){return a("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await c(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return a("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t))}async function h(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t),{method:"DELETE"})}async function m(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return a("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return a("/api/kb/features")}async function j(e,t){var n,i,r,l,o;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!=(o=t.limit)?o:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&s.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(i=t.weights)?void 0:i.vector)!=null&&s.set("vectorWeight",String(t.weights.vector)),(null==t||null==(r=t.weights)?void 0:r.rewrite)!=null&&s.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(l=t.weights)?void 0:l.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),a("/api/kb/search?".concat(s))}async function w(){return a("/api/prompt")}async function S(){return a("/api/documents/templates")}async function b(e){return a("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e){return a("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(e){return a("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function k(e){return a("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function A(e){return a("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(){return a("/api/documents/drafts")}async function P(e,t){return a("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function N(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function T(){return a("/api/config/providers")}async function O(e,t){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function R(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function I(){return a("/api/config/models")}async function E(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J(){return a("/api/config/embedding")}async function z(e){return a("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function L(){return a("/api/config/embedding/healthCheck",{method:"POST"})}async function D(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function U(){return a("/api/system/stats")}async function M(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return a("/api/context".concat(n))}async function H(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function F(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function B(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function K(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function X(e,t){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function V(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>P,Bh:()=>V,Dl:()=>S,E:()=>B,FC:()=>U,H1:()=>g,H7:()=>h,HC:()=>o,HT:()=>r,II:()=>J,OX:()=>k,PH:()=>F,QT:()=>u,Qx:()=>p,R1:()=>A,SJ:()=>y,UE:()=>N,VW:()=>x,W2:()=>j,X8:()=>f,Z3:()=>T,_m:()=>O,aP:()=>E,bV:()=>C,bZ:()=>D,c1:()=>d,dd:()=>z,dx:()=>w,h0:()=>v,h1:()=>R,hc:()=>i,hn:()=>M,l2:()=>b,p:()=>H,q7:()=>_,tn:()=>s,u6:()=>L,xC:()=>l,xq:()=>m,xw:()=>K,zo:()=>X,zr:()=>I})},7690:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return n(5819)}])}},e=>{e.O(0,[260,544,425,668,227,740,174,446,400,292,969,517,636,593,792],()=>e(e.s=7690)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28],{426:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/files",function(){return n(6451)}])},2803:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"}},3793:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"}},4569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusPanel:"style_statusPanel__9arTu",statusPanelHeader:"style_statusPanelHeader__nKv1I",statusEmpty:"style_statusEmpty__8LWzH",statusList:"style_statusList__FpNgC",statusItem:"style_statusItem__uzO80",statusHeader:"style_statusHeader__o9q_b",statusDesc:"style_statusDesc__XiWFa",statusPath:"style_statusPath__Udxvv",statusMeta:"style_statusMeta__XukHt",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},5258:(e,t,n)=>{"use strict";n.d(t,{A:()=>w});var a=n(1541),r=n(1848),s=n(1249),i=n(7109),o=n(2658),c=n(3638),l=n(2162),d=n(2725),u=n(4567),p=n(632),h=n(9517),y=n(9412),f=n(9527);let g=(0,d.U)(e=>{let{prefixCls:t,className:n,closeIcon:a,closable:r,type:s,title:d,children:g,footer:m,classNames:x,styles:v,...w}=e,{getPrefixCls:b}=i.useContext(u.QO),{className:j,style:C,classNames:S,styles:_}=(0,u.TP)("modal"),k=b(),P=t||b("modal"),T=(0,p.A)(k),[A,O]=(0,f.Ay)(P,T),[N,E]=(0,l.AV)([S,x],[_,v],{props:e}),L=`${P}-confirm`,I={};return I=s?{closable:r??!1,title:"",footer:"",children:i.createElement(h.k,{...e,prefixCls:P,confirmPrefixCls:L,rootPrefixCls:k,content:g})}:{closable:r??!0,title:d,footer:null!==m&&i.createElement(y.w,{...e}),children:g},i.createElement(o.Z,{prefixCls:P,className:(0,c.$)(A,`${P}-pure-panel`,s&&L,s&&`${L}-${s}`,n,j,O,T,N.root),style:{...C,...E.root},...w,closeIcon:(0,y.O)(P,a),closable:r,classNames:N,styles:E,...I})});var m=n(9739);function x(e){return(0,a.Ay)((0,a.fp)(e))}let v=s.A;v.useModal=m.A,v.info=function(e){return(0,a.Ay)((0,a.$D)(e))},v.success=function(e){return(0,a.Ay)((0,a.Ej)(e))},v.error=function(e){return(0,a.Ay)((0,a.jT)(e))},v.warning=x,v.warn=x,v.confirm=function(e){return(0,a.Ay)((0,a.lr)(e))},v.destroyAll=function(){for(;r.A.length;){let e=r.A.pop();e&&e()}},v.config=a.FB,v._InternalPanelDoNotUseOrYouWillBeFired=g;let w=v},5551:(e,t,n)=>{"use strict";function a(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),a=Math.floor(n/60),r=Math.floor(a/24);return r>30?new Date(e).toLocaleDateString(t):"en-US"===t?r>0?"".concat(r,"d ago"):a>0?"".concat(a,"h ago"):n>0?"".concat(n,"m ago"):"Just now":r>0?"".concat(r," 天前"):a>0?"".concat(a," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>o,fw:()=>r,z3:()=>a});let s={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},i={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function o(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?i:s)[e])?t:e}},6451:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>E});var a=n(5321),r=n(7109),s=n(6644),i=n(3220),o=n.n(i),c=n(4986),l=n(7807),d=n(5258),u=n(3442),p=n(1702),h=n(5114),y=n(4668),f=n(7271),g=n(2551),m=n(9605),x=n(8787),v=n(9400),w=n(9012),b=n(8209),j=n(486),C=n(2803),S=n(8483);function _(){return(_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let k=r.forwardRef((e,t)=>r.createElement(S.A,_({},e,{ref:t,icon:C.A})));var P=n(6578),T=n(5551),A=n(4569),O=n.n(A);let N=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function E(){let e=(0,s.Vr)("knowledge"),{locale:t}=(0,s.x_)(),{message:n}=l.A.useApp(),i=(0,c.useSearchParams)().get("category")||"",[C,S]=(0,r.useState)([]),[_,A]=(0,r.useState)(!0),[E,L]=(0,r.useState)(""),[I,R]=(0,r.useState)(i),[J,M]=(0,r.useState)(!1),[D,U]=(0,r.useState)([]),[H,z]=(0,r.useState)([]),[B,V]=(0,r.useState)(1),F=(0,r.useRef)(I);(0,r.useEffect)(()=>{F.current=I},[I]);let X=(0,r.useCallback)(async e=>{let t=null!=e?e:F.current;A(!0);try{let e=await (0,P.HT)({category:t||void 0,limit:200});S(e.files||[])}catch(e){S([])}finally{A(!1)}},[]);(0,r.useEffect)(()=>{X(I)},[I,X]);let W=e=>({type:e.type,title:e.title,description:e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,textLength:e.textLength,extractionMode:e.extractionMode}),$=(0,r.useCallback)(async()=>{try{let e=await (0,P.Qx)();U(e.operations.map(W))}catch(e){}},[]);(0,r.useEffect)(()=>{$()},[$]);let q=async()=>{try{await (0,P.H7)(),U([]),n.success("任务状态已清空")}catch(e){n.error("清空任务状态失败")}},Q=async e=>{if(0===e.length)return;let t=1===e.length?e[0].name:"".concat(e.length," 个文件");M(!0),U(e=>[{type:"upload",title:"上传 ".concat(t),description:"等待上传、解析、切片和入库",status:"processing",percent:10},...e].slice(0,50));let a="".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2)),r=setInterval(()=>{(0,P.QT)(a).then(e=>{U(n=>[{type:"upload",title:"上传 ".concat(t),description:"".concat(e.message).concat(e.chunkCount?",".concat(e.chunkCount," 个切片"):""),status:"error"===e.stage?"warning":"processing",percent:e.percent},...n.filter(e=>e.title!=="上传 ".concat(t))].slice(0,50))}).catch(()=>void 0)},500);try{var s,i;let o=await (0,P.c1)(e,void 0,a);clearInterval(r),(null==(s=o.vectorStatus)?void 0:s.status)==="error"?n.info("文件已上传,正在后台入库"):n.success("上传成功"),L(""),R(""),z([]),V(1),F.current="";let c=null==(i=o.files)?void 0:i.find(e=>e.relativePath===o.relativePath),l=(e=>{if(!e)return{};let t={};try{t=e.metadataJson?JSON.parse(e.metadataJson):{}}catch(e){}let n="object"==typeof t.extraction&&t.extraction?t.extraction:t;return{textLength:"number"==typeof n.textLength?n.textLength:void 0,extractionMode:"string"==typeof n.extractionMode?n.extractionMode:void 0}})(c);await $(),U(e=>[{type:"upload",title:"上传完成 ".concat(t),description:"解析、分块和入库流程已完成",status:"success",filePath:null==c?void 0:c.relativePath,chunkCount:null==c?void 0:c.chunkCount,textLength:l.textLength,extractionMode:l.extractionMode},...e.filter(e=>e.title!=="上传 ".concat(t))].slice(0,50)),Array.isArray(o.files)?S(o.files):(await (0,P.H1)(),await X(""),await $())}catch(e){n.error("上传失败"),U(e=>[{type:"error",title:"上传失败 ".concat(t),description:"请重试或检查文件格式",status:"error"},...e].slice(0,50))}finally{clearInterval(r),M(!1)}},K=e=>{let t="selected"===e?H.map(String):"filtered"===e?Z.map(e=>e.relativePath):[];if("all"!==e&&0===t.length)return;let a="all"===e?"删除全部文件?":"filtered"===e?"删除当前筛选结果 ".concat(t.length," 个文件?"):"删除已选 ".concat(t.length," 个文件?");d.A.confirm({title:a,content:"将同时删除文件、切片、索引和向量记录。此操作不可撤销。",okText:"确认删除",cancelText:"取消",okButtonProps:{danger:!0},onOk:async()=>{U(e=>[{type:"delete",title:a,description:"正在批量删除文件和索引",status:"processing",percent:10},...e].slice(0,50));try{var r;let a=null!=(r=("all"===e?await (0,P.X8)():await (0,P.SJ)(t)).deleted)?r:t.length;n.success("已删除 ".concat(a," 个文件")),z([]),U(e=>[{type:"delete",title:"批量删除完成",description:"已删除 ".concat(a," 个文件、切片和索引"),status:"success"},...e].slice(0,50)),await X(),await $()}catch(e){n.error("批量删除失败"),U(e=>[{type:"error",title:"批量删除失败",description:"请重试",status:"error"},...e].slice(0,50))}}})},Z=E?C.filter(e=>e.relativePath.toLowerCase().includes(E.toLowerCase())):C,G=[{title:e("fileName"),dataIndex:"relativePath",key:"name",render:e=>(0,a.jsxs)(u.A,{children:[(0,a.jsx)(w.A,{}),(0,a.jsx)(o(),{className:"truncate max-w-[400px] inline-block",href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(e)),children:e})]})},{title:e("fileCategory"),dataIndex:"category",key:"cat",width:120,render:e=>(0,a.jsx)(p.A,{children:(0,T.Jm)(e,t)})},{title:e("fileSize"),dataIndex:"fileSize",key:"size",width:100,render:e=>(0,T.z3)(e)},{title:"切片",dataIndex:"chunkCount",key:"chunks",width:90,render:e=>(0,a.jsx)(p.A,{color:e>1?"green":"orange",children:e})},{title:"解析状态",dataIndex:"status",key:"status",width:110,render:(e,t)=>(0,a.jsx)(p.A,{color:"active"===e?"green":"red",children:t.errorMessage||e})},{title:e("fileDate"),dataIndex:"mtime",key:"date",width:140,render:e=>e?new Date(e).toLocaleDateString(t):"—"},{title:"",key:"act",width:60,render:(t,r)=>(0,a.jsx)(h.Ay,{type:"text",danger:!0,size:"small",icon:(0,a.jsx)(b.A,{}),onClick:()=>{d.A.confirm({title:e("delete"),content:e("deleteConfirm"),okText:"确认",cancelText:"取消",okButtonProps:{danger:!0},onOk:async()=>{U(e=>[{type:"delete",title:"删除 ".concat(r.relativePath),description:"正在删除文件记录",status:"processing"},...e].slice(0,50));try{await (0,P.xq)(r.relativePath),n.success("已删除"),U(e=>[{type:"delete",title:"删除完成 ".concat(r.relativePath),description:"文件和索引记录已移除",status:"success"},...e].slice(0,50)),z(e=>e.filter(e=>e!==r.relativePath)),await X(),await $()}catch(e){n.error("删除失败"),U(e=>[{type:"error",title:"删除失败 ".concat(r.relativePath),description:"请重试",status:"error"},...e].slice(0,50))}}})}})}];return(0,a.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,a.jsx)("h2",{className:"pageTitle",children:e("fileList")}),(0,a.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,a.jsx)(y.A,{placeholder:e("searchPlaceholder"),prefix:(0,a.jsx)(j.A,{}),value:E,onChange:e=>{L(e.target.value),V(1)},allowClear:!0,className:O().filterInput}),(0,a.jsx)(f.A,{value:I||void 0,onChange:e=>{R(e||""),V(1)},placeholder:e("filterCategory"),allowClear:!0,className:O().filterSelect,options:[{label:e("allCategories"),value:""},...N.map(e=>({label:(0,T.Jm)(e,t),value:e}))]}),(0,a.jsx)(h.Ay,{type:"primary",icon:(0,a.jsx)(k,{}),loading:J,onClick:()=>{var e;return null==(e=document.getElementById("kb-file-upload-input"))?void 0:e.click()},children:J?e("uploading"):e("upload")}),(0,a.jsx)(h.Ay,{icon:(0,a.jsx)(k,{}),loading:J,onClick:()=>{var e;return null==(e=document.getElementById("kb-folder-upload-input"))?void 0:e.click()},children:"上传文件夹"}),(0,a.jsxs)(h.Ay,{danger:!0,disabled:0===H.length,icon:(0,a.jsx)(b.A,{}),onClick:()=>K("selected"),children:["删除已选 ",H.length||""]}),(0,a.jsx)(h.Ay,{danger:!0,disabled:0===Z.length||!E&&!I,onClick:()=>K("filtered"),children:"删除筛选结果"}),(0,a.jsx)(h.Ay,{danger:!0,disabled:0===C.length,onClick:()=>K("all"),children:"删除全部"}),(0,a.jsx)("input",{id:"kb-file-upload-input",type:"file",multiple:!0,hidden:!0,onChange:e=>{var t;let n=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",Q(n)}}),(0,a.jsx)("input",{id:"kb-folder-upload-input",type:"file",multiple:!0,hidden:!0,webkitdirectory:"",onChange:e=>{var t;let n=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",Q(n)}})]}),(0,a.jsxs)("div",{className:O().statusPanel,children:[(0,a.jsxs)("div",{className:O().statusPanelHeader,children:[(0,a.jsxs)(u.A,{children:[(0,a.jsx)(w.A,{}),"文件任务状态"]}),(0,a.jsx)(h.Ay,{size:"small",type:"text",disabled:0===D.length,onClick:()=>void q(),children:"清空"})]}),0===D.length?(0,a.jsx)("div",{className:O().statusEmpty,children:"暂无文件任务。"}):(0,a.jsx)("div",{className:O().statusList,children:D.map((e,n)=>(0,a.jsxs)("div",{className:O().statusItem,children:[(0,a.jsxs)("div",{className:O().statusHeader,children:[(0,a.jsxs)(u.A,{size:8,wrap:!0,children:[(0,a.jsx)(p.A,{color:"success"===e.status?"green":"error"===e.status?"red":"warning"===e.status?"orange":"blue",children:"upload"===e.type?"上传":"delete"===e.type?"删除":"reindex"===e.type?"重建":"失败"}),(0,a.jsx)(g.A,{title:e.title,children:(0,a.jsx)("strong",{children:e.title})})]}),(0,a.jsx)(p.A,{color:"success"===e.status?"success":"processing"===e.status?"processing":"warning"===e.status?"warning":"error",children:"success"===e.status?"完成":"processing"===e.status?"处理中":"warning"===e.status?"需关注":"失败"})]}),(0,a.jsx)(g.A,{title:e.description,children:(0,a.jsx)("div",{className:O().statusDesc,children:e.description})}),e.filePath&&(0,a.jsx)(g.A,{title:e.filePath,children:(0,a.jsx)("div",{className:O().statusPath,children:e.filePath})}),(0,a.jsxs)("div",{className:O().statusMeta,children:["number"==typeof e.chunkCount&&(0,a.jsxs)("span",{children:["切片 ",(0,a.jsx)("b",{children:e.chunkCount})]}),"number"==typeof e.textLength&&(0,a.jsxs)("span",{children:["正文 ",(0,a.jsx)("b",{children:e.textLength.toLocaleString(t)})," 字符"]}),e.extractionMode&&(0,a.jsxs)("span",{children:["解析 ",(0,a.jsx)("b",{children:e.extractionMode})]})]}),"number"==typeof e.percent&&"processing"===e.status&&(0,a.jsx)(m.A,{percent:e.percent,size:"small"})]},"".concat(e.title,"-").concat(n)))})]}),(0,a.jsx)(x.A,{children:(0,a.jsx)(v.A,{rowKey:"relativePath",columns:G,dataSource:Z,loading:_,size:"middle",locale:{emptyText:E?e("emptySearch"):e("noFiles")},pagination:{current:B,pageSize:50,showSizeChanger:!1,onChange:V},rowSelection:{selectedRowKeys:H,onChange:z}})})]})}},6578:(e,t,n)=>{"use strict";async function a(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function r(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(t))}async function s(e){var t,n;let r=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&r.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&r.set("category",e.category),(null==e?void 0:e.page)&&r.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&r.set("limit",String(null!=(n=e.limit)?n:50)),a("/api/kb/files?".concat(r))}async function i(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),a("/api/kb/files/detail?".concat(n))}async function o(e,t){return a("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function c(e,t,n){return a("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let a=new FileReader;a.onload=()=>{let e=a.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},a.onerror=n,a.readAsDataURL(e)})}async function d(e,t,n){return a("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return a("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t))}async function h(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t),{method:"DELETE"})}async function y(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function f(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function g(e){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function m(e){return a("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return a("/api/kb/features")}async function v(e,t){var n,r,s,i,o;let c=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&c.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&c.set("category",t.category),(null==t?void 0:t.limit)&&c.set("limit",String(null!=(o=t.limit)?o:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(r=t.weights)?void 0:r.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(s=t.weights)?void 0:s.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(i=t.weights)?void 0:i.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),a("/api/kb/search?".concat(c))}async function w(){return a("/api/prompt")}async function b(){return a("/api/documents/templates")}async function j(e){return a("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e){return a("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function S(e){return a("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function _(e){return a("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return a("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(){return a("/api/documents/drafts")}async function T(e,t){return a("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function A(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function O(){return a("/api/config/providers")}async function N(e,t){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function E(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function L(){return a("/api/config/models")}async function I(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function R(){return a("/api/config/embedding")}async function J(e){return a("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function M(){return a("/api/config/embedding/healthCheck",{method:"POST"})}async function D(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function U(){return a("/api/system/stats")}async function H(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return a("/api/context".concat(n))}async function z(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function B(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function V(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function F(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function X(e,t){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function W(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>T,Bh:()=>W,Dl:()=>b,E:()=>V,FC:()=>U,H1:()=>m,H7:()=>h,HC:()=>o,HT:()=>s,II:()=>R,OX:()=>_,PH:()=>B,QT:()=>u,Qx:()=>p,R1:()=>k,SJ:()=>f,UE:()=>A,VW:()=>x,W2:()=>v,X8:()=>g,Z3:()=>O,_m:()=>N,aP:()=>I,bV:()=>S,bZ:()=>D,c1:()=>d,dd:()=>J,dx:()=>w,h0:()=>C,h1:()=>E,hc:()=>r,hn:()=>H,l2:()=>j,p:()=>z,q7:()=>P,tn:()=>c,u6:()=>M,xC:()=>i,xq:()=>y,xw:()=>F,zo:()=>X,zr:()=>L})},8209:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var a=n(7109),r=n(3793),s=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let o=a.forwardRef((e,t)=>a.createElement(s.A,i({},e,{ref:t,icon:r.A})))}},e=>{e.O(0,[260,544,425,668,227,740,174,446,400,15,636,593,792],()=>e(e.s=426)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[414],{423:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>O});var o=n(5321),a=n(7109),i=n(4986),r=n(6644),c=n(7807),s=n(3442),l=n(5114),d=n(2256),u=n(8770),p=n(8787),h=n(4849),f=n(6911),y=n(9400),g=n(1702),m=n(9606),w=n(486),b=n(2192),k=n(6768),S=n(6619),x=n(933),j=n(8740),v=n(6578),T=n(5551);let C=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function O(){var e,t,n;let O=(0,r.Vr)(),{locale:A}=(0,r.x_)(),E=(0,i.useRouter)(),{stats:N,loading:P,reload:R}=function(){let[e,t]=(0,a.useState)(null),[n,o]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{o(!0);try{t(await (0,v.hc)())}catch(e){}finally{o(!1)}},[]);return(0,a.useEffect)(()=>{i()},[i]),{stats:e,loading:n,reload:i}}(),D=function(){let[e,t]=(0,a.useState)(null);return(0,a.useEffect)(()=>{(0,v.VW)().then(t).catch(()=>{})},[]),e}(),{reindexing:J,reindex:U}=function(){let[e,t]=(0,a.useState)(!1);return{reindexing:e,reindex:(0,a.useCallback)(async()=>{t(!0);try{return await (0,v.H1)(),!0}catch(e){return!1}finally{t(!1)}},[])}}(),[z,I]=(0,a.useState)("document"),[L,_]=(0,a.useState)({count:0,totalSize:0}),{message:B}=c.A.useApp(),H=(0,a.useCallback)(async e=>{try{let t=await (0,v.HT)({category:e,limit:1e4}),n=0;if(Array.isArray(t.files))for(let e of t.files)n+=e.fileSize||0;_({count:t.total||0,totalSize:n})}catch(e){_({count:0,totalSize:0})}},[]);(0,a.useEffect)(()=>{H(z)},[z,H]);let M=async()=>{await U()?await Promise.all([R(),H(z)]):B.error(O("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:O("knowledge.manageTitle")}),(0,o.jsx)("p",{className:"pageDesc",children:O("knowledge.manageDesc")})]}),(0,o.jsxs)(s.A,{children:[(0,o.jsx)(l.Ay,{icon:(0,o.jsx)(m.A,{}),onClick:()=>E.push("/knowledge/files"),children:O("knowledge.files")}),(0,o.jsx)(l.Ay,{icon:(0,o.jsx)(w.A,{}),onClick:()=>E.push("/knowledge/search"),children:O("knowledge.search")}),(0,o.jsx)(l.Ay,{icon:(0,o.jsx)(b.A,{}),loading:J,onClick:()=>{M()},children:O("knowledge.reindex")})]})]}),(0,o.jsx)(d.A,{gutter:[16,16],children:[{icon:(0,o.jsx)(k.A,{}),label:O("knowledge.totalFiles"),value:null!=(e=null==N?void 0:N.fileCount)?e:0},{icon:(0,o.jsx)(S.A,{}),label:O("knowledge.totalChunks"),value:null!=(t=null==N?void 0:N.chunkCount)?t:0},{icon:(0,o.jsx)(x.A,{}),label:O("knowledge.totalSize"),value:(0,T.z3)(null!=(n=null==N?void 0:N.totalSizeBytes)?n:0)},{icon:(0,o.jsx)(j.A,{}),label:O("knowledge.lastIndexed"),value:(null==N?void 0:N.lastIndexedAt)?(0,T.fw)(N.lastIndexedAt,A):O("common.never")}].map((e,t)=>(0,o.jsx)(u.A,{xs:12,sm:6,children:(0,o.jsx)(p.A,{size:"small",loading:P&&!N,children:(0,o.jsx)(h.A,{title:e.label,value:e.value,prefix:e.icon})})},t))}),(0,o.jsxs)(p.A,{title:O("knowledge.categories"),size:"small",children:[(0,o.jsx)(f.A,{value:z,onChange:e=>I(String(e)),options:C.map(e=>({label:(0,T.Jm)(e,A),value:e})),className:"mb-4"}),(0,o.jsxs)(d.A,{gutter:[16,16],children:[(0,o.jsx)(u.A,{xs:12,sm:8,children:(0,o.jsx)(h.A,{title:O("knowledge.fileCount"),value:L.count,prefix:(0,o.jsx)(k.A,{})})}),(0,o.jsx)(u.A,{xs:12,sm:8,children:(0,o.jsx)(h.A,{title:O("knowledge.totalSize"),value:(0,T.z3)(L.totalSize),prefix:(0,o.jsx)(x.A,{})})})]})]}),D&&(0,o.jsx)(p.A,{title:O("knowledge.features"),size:"small",children:(0,o.jsx)(y.A,{dataSource:[{key:"vectorStore",label:"Vector Store",desc:O("knowledge.featureVectorStoreDesc"),value:D.vectorStore},{key:"embedding",label:"Embedding",desc:O("knowledge.featureEmbeddingDesc"),value:D.embeddingProvider},{key:"dedup",label:O("knowledge.featureDedup"),desc:O("knowledge.featureDedupDesc"),value:D.dedupEngine},{key:"chunker",label:O("knowledge.featureChunker"),desc:O("knowledge.featureChunkerDesc"),value:D.chunker}],columns:[{title:O("knowledge.featureName"),dataIndex:"label",key:"label",width:120},{title:O("knowledge.featureDesc"),dataIndex:"desc",key:"desc"},{title:O("knowledge.featureValue"),dataIndex:"value",key:"value",render:e=>(0,o.jsx)(g.A,{color:"blue",children:e})}],pagination:!1,size:"small"})})]})}},4178:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/manage",function(){return n(423)}])},5551:(e,t,n)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(n/60),a=Math.floor(o/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):o>0?"".concat(o,"h ago"):n>0?"".concat(n,"m ago"):"Just now":a>0?"".concat(a," 天前"):o>0?"".concat(o," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>c,fw:()=>a,z3:()=>o});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},r={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function c(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?r:i)[e])?t:e}},6578:(e,t,n)=>{"use strict";async function 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 c(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 l(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function h(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function f(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function g(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function m(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 b(e,t){var n,a,i,r,c;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!=(c=t.limit)?c: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 k(){return o("/api/prompt")}async function S(){return o("/api/documents/templates")}async function x(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function j(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function v(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function T(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(){return o("/api/documents/drafts")}async function A(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function E(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function N(){return o("/api/config/providers")}async function P(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function R(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function D(){return o("/api/config/models")}async function J(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function U(){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 I(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function L(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function _(){return o("/api/system/stats")}async function B(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function H(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function M(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function V(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function W(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function F(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function X(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>A,Bh:()=>X,Dl:()=>S,E:()=>V,FC:()=>_,H1:()=>m,H7:()=>h,HC:()=>c,HT:()=>i,II:()=>U,OX:()=>T,PH:()=>M,QT:()=>u,Qx:()=>p,R1:()=>C,SJ:()=>y,UE:()=>E,VW:()=>w,W2:()=>b,X8:()=>g,Z3:()=>N,_m:()=>P,aP:()=>J,bV:()=>v,bZ:()=>L,c1:()=>d,dd:()=>z,dx:()=>k,h0:()=>j,h1:()=>R,hc:()=>a,hn:()=>B,l2:()=>x,p:()=>H,q7:()=>O,tn:()=>s,u6:()=>I,xC:()=>r,xq:()=>f,xw:()=>W,zo:()=>F,zr:()=>D})}},e=>{e.O(0,[260,544,425,227,740,174,446,400,958,891,636,593,792],()=>e(e.s=4178)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[207],{470:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var s=n(7109),r=n(838),a=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}let o=s.forwardRef((e,t)=>s.createElement(a.A,i({},e,{ref:t,icon:r.A})))},838:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"}},4184:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>v});var s=n(5321),r=n(3220),a=n.n(r),i=n(7109),o=n(5292),c=n(8787),l=n(3442),d=n(4668),u=n(5114),p=n(4992),h=n(6506),y=n(1702),m=n(2700),f=n(4253),g=n(486),j=n(6578),b=n(4569),x=n.n(b);let{Paragraph:w}=o.A;function _(e){return"number"==typeof e?e.toFixed(2):"-"}function v(){var e,t,n;let[r,o]=(0,i.useState)(""),[b,v]=(0,i.useState)(!1),[S,T]=(0,i.useState)([]),[k,C]=(0,i.useState)(),[P,O]=(0,i.useState)(),[A,N]=(0,i.useState)({keyword:1,vector:.9,rewrite:.72,hybridBonus:.35}),R=async()=>{let e=r.trim();if(e){v(!0);try{let t=await (0,j.W2)(e,{limit:10,weights:A});T(t.results),C(t.queryTimeMs),O(t.debug)}finally{v(!1)}}};return(0,s.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"pageTitle",children:"知识库搜索"}),(0,s.jsx)("p",{className:"pageDesc",children:"查看 hybrid 检索、parent 回填、分块来源和评分明细。"})]}),(0,s.jsx)(c.A,{size:"small",children:(0,s.jsxs)(l.A.Compact,{className:"w-full",children:[(0,s.jsx)(d.A,{value:r,onChange:e=>o(e.target.value),onPressEnter:()=>{R()},placeholder:"输入要搜索的知识库内容"}),(0,s.jsx)(u.Ay,{type:"primary",icon:(0,s.jsx)(g.A,{}),loading:b,onClick:()=>{R()},children:"搜索"})]})}),(0,s.jsx)(c.A,{size:"small",title:"召回权重调节",children:(0,s.jsxs)(l.A,{wrap:!0,children:[(0,s.jsxs)("span",{children:["Keyword ",(0,s.jsx)(p.A,{min:0,max:5,step:.1,value:A.keyword,onChange:e=>N(t=>({...t,keyword:Number(null!=e?e:1)}))})]}),(0,s.jsxs)("span",{children:["Vector ",(0,s.jsx)(p.A,{min:0,max:5,step:.1,value:A.vector,onChange:e=>N(t=>({...t,vector:Number(null!=e?e:.9)}))})]}),(0,s.jsxs)("span",{children:["Rewrite ",(0,s.jsx)(p.A,{min:0,max:5,step:.1,value:A.rewrite,onChange:e=>N(t=>({...t,rewrite:Number(null!=e?e:.72)}))})]}),(0,s.jsxs)("span",{children:["Hybrid Bonus ",(0,s.jsx)(p.A,{min:0,max:2,step:.05,value:A.hybridBonus,onChange:e=>N(t=>({...t,hybridBonus:Number(null!=e?e:.35)}))})]})]})}),P&&(0,s.jsx)(c.A,{size:"small",title:"检索调试面板",children:(0,s.jsxs)(h.A,{size:"small",column:2,bordered:!0,children:[(0,s.jsx)(h.A.Item,{label:"原始查询",children:P.originalQuery}),(0,s.jsx)(h.A.Item,{label:"Reranker",children:P.reranker}),(0,s.jsx)(h.A.Item,{label:"查询改写",span:2,children:(0,s.jsx)(l.A,{wrap:!0,children:null==(e=P.rewrittenQueries)?void 0:e.map(e=>(0,s.jsx)(y.A,{children:e},e))})}),(0,s.jsx)(h.A.Item,{label:"召回数量",span:2,children:(0,s.jsx)(l.A,{wrap:!0,children:Object.entries(null!=(t=P.recallCounts)?t:{}).map(e=>{let[t,n]=e;return(0,s.jsxs)(y.A,{children:[t,": ",n]},t)})})}),(0,s.jsx)(h.A.Item,{label:"召回权重",span:2,children:(0,s.jsx)(l.A,{wrap:!0,children:Object.entries(null!=(n=P.weights)?n:{}).map(e=>{let[t,n]=e;return(0,s.jsxs)(y.A,{children:[t,": ",n]},t)})})})]})}),(0,s.jsx)(c.A,{size:"small",title:"搜索结果",extra:"number"==typeof k?"".concat(k," ms"):void 0,children:b?(0,s.jsx)(m.A,{}):0===S.length?(0,s.jsx)(f.A,{description:"暂无结果"}):(0,s.jsx)("div",{className:x().searchResultList,children:S.map(e=>{var t,n,i,o,c,d;return(0,s.jsxs)("div",{className:x().searchResultItem,children:[(0,s.jsxs)("div",{className:x().searchResultHeader,children:[(0,s.jsxs)(l.A,{size:8,wrap:!0,children:[(0,s.jsx)(y.A,{color:"hybrid"===e.source?"purple":"vector"===e.source?"blue":"green",children:null!=(d=e.source)?d:"keyword"}),(0,s.jsx)(y.A,{children:e.scope}),e.chunkKind&&(0,s.jsx)(y.A,{color:"geekblue",children:e.chunkKind}),e.rowRange&&(0,s.jsxs)(y.A,{color:"gold",children:["行 ",e.rowRange]}),e.sectionTitle&&(0,s.jsx)(y.A,{color:"cyan",children:e.sectionTitle})]}),(0,s.jsx)("strong",{children:_(e.score)})]}),(0,s.jsxs)("div",{className:x().statusPath,children:[(0,s.jsx)(a(),{href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(e.filePath)),children:e.filePath}),"number"==typeof e.chunkIndex?" #".concat(e.chunkIndex):""]}),(0,s.jsx)(w,{ellipsis:{rows:6,expandable:!0,symbol:"展开"},className:x().searchContent,children:function(e,t){let n=[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length);if(0===n.length)return e;let r=RegExp("(".concat(n.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(r).map((e,t)=>n.some(t=>t.toLowerCase()===e.toLowerCase())?(0,s.jsx)("mark",{children:e},t):e)}(e.content,r)}),e.facets&&Object.keys(e.facets).length>0&&(0,s.jsx)("div",{className:x().statusMeta,children:Object.entries(e.facets).slice(0,8).map(e=>{let[t,n]=e;return(0,s.jsxs)("span",{children:[t," ",(0,s.jsx)("b",{children:Array.isArray(n)?n.join(", "):String(n)})]},t)})}),(0,s.jsxs)("div",{className:x().statusMeta,children:[(0,s.jsxs)("span",{children:["keyword ",(0,s.jsx)("b",{children:_(null==(t=e.scoreDetails)?void 0:t.keywordScore)})]}),(0,s.jsxs)("span",{children:["bm25 ",(0,s.jsx)("b",{children:_(null==(n=e.scoreDetails)?void 0:n.bm25Score)})]}),(0,s.jsxs)("span",{children:["vector ",(0,s.jsx)("b",{children:_(null==(i=e.scoreDetails)?void 0:i.vectorScore)})]}),(0,s.jsxs)("span",{children:["rerank ",(0,s.jsx)("b",{children:_(null==(o=e.scoreDetails)?void 0:o.rerankBoost)})]}),(0,s.jsxs)("span",{children:["hybrid ",(0,s.jsx)("b",{children:_(null==(c=e.scoreDetails)?void 0:c.hybridScore)})]})]})]},e.id)})})})]})}},4569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusPanel:"style_statusPanel__9arTu",statusPanelHeader:"style_statusPanelHeader__nKv1I",statusEmpty:"style_statusEmpty__8LWzH",statusList:"style_statusList__FpNgC",statusItem:"style_statusItem__uzO80",statusHeader:"style_statusHeader__o9q_b",statusDesc:"style_statusDesc__XiWFa",statusPath:"style_statusPath__Udxvv",statusMeta:"style_statusMeta__XukHt",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},6578:(e,t,n)=>{"use strict";async function s(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function r(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return s("/api/kb/stats".concat(t))}async function a(e){var t,n;let r=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&r.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&r.set("category",e.category),(null==e?void 0:e.page)&&r.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&r.set("limit",String(null!=(n=e.limit)?n:50)),s("/api/kb/files?".concat(r))}async function i(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),s("/api/kb/files/detail?".concat(n))}async function o(e,t){return s("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function c(e,t,n){return s("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let s=new FileReader;s.onload=()=>{let e=s.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},s.onerror=n,s.readAsDataURL(e)})}async function d(e,t,n){return s("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return s("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t))}async function h(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t),{method:"DELETE"})}async function y(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function m(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return s("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function j(){return s("/api/kb/features")}async function b(e,t){var n,r,a,i,o;let c=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&c.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&c.set("category",t.category),(null==t?void 0:t.limit)&&c.set("limit",String(null!=(o=t.limit)?o:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(r=t.weights)?void 0:r.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(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 x(){return s("/api/prompt")}async function w(){return s("/api/documents/templates")}async function _(e){return s("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e){return s("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function S(e){return s("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function T(e){return s("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return s("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(){return s("/api/documents/drafts")}async function P(e,t){return s("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function O(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function A(){return s("/api/config/providers")}async function N(e,t){return s("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function R(e){return s("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return s("/api/config/models")}async function I(e){return s("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function L(){return s("/api/config/embedding")}async function J(e){return s("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function U(){return s("/api/config/embedding/healthCheck",{method:"POST"})}async function D(e){return s("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function H(){return s("/api/system/stats")}async function B(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return s("/api/context".concat(n))}async function z(e){return s("/api/context?type=".concat(e,"&stats=1"))}async function X(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function V(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function W(e){return s("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function F(e,t){return s("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function M(e){return s("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>P,Bh:()=>M,Dl:()=>w,E:()=>V,FC:()=>H,H1:()=>g,H7:()=>h,HC:()=>o,HT:()=>a,II:()=>L,OX:()=>T,PH:()=>X,QT:()=>u,Qx:()=>p,R1:()=>k,SJ:()=>m,UE:()=>O,VW:()=>j,W2:()=>b,X8:()=>f,Z3:()=>A,_m:()=>N,aP:()=>I,bV:()=>S,bZ:()=>D,c1:()=>d,dd:()=>J,dx:()=>x,h0:()=>v,h1:()=>R,hc:()=>r,hn:()=>B,l2:()=>_,p:()=>z,q7:()=>C,tn:()=>c,u6:()=>U,xC:()=>i,xq:()=>y,xw:()=>W,zo:()=>F,zr:()=>E})},9208:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/search",function(){return n(4184)}])}},e=>{e.O(0,[260,544,425,668,227,292,992,969,636,593,792],()=>e(e.s=9208)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[12],{4183:(e,n,u)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge",function(){return u(4973)}])},4973:(e,n,u)=>{"use strict";u.r(n),u.d(n,{default:()=>r});var _=u(7109),t=u(6109);function r(){let e=(0,t.useRouter)();return(0,_.useEffect)(()=>{e.replace("/knowledge/manage")},[e]),null}},6109:(e,n,u)=>{e.exports=u(7212)}},e=>{e.O(0,[636,593,792],()=>e(e.s=4183)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46],{69:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5L255.8 713.6l-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l110.3 111.2c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.1 304.1 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112m161.2 465.2C726.2 620.3 668.9 644 608 644s-118.2-23.7-161.2-66.8C403.7 534.2 380 476.9 380 416s23.7-118.2 66.8-161.2c43-43.1 100.3-66.8 161.2-66.8s118.2 23.7 161.2 66.8c43.1 43 66.8 100.3 66.8 161.2s-23.7 118.2-66.8 161.2"}}]},name:"key",theme:"outlined"}},289:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"}},2256:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=n(5341).A},2323:e=>{e.exports={cardMeta:"style_cardMeta__6KOa3",cardName:"style_cardName__WcLAf",cardAction:"style_cardAction__XUfPD",cardMain:"style_cardMain__qI1jU",providerCard:"style_providerCard__tLKGs",providerGrid:"style_providerGrid__Gx5GR",urlLine:"style_urlLine__DuMYs",tierDesc:"style_tierDesc__wOd6p",modelTags:"style_modelTags__nmMVj"}},3114:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var a=n(7109),o=n(5450),r=n(8483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let i=a.forwardRef((e,t)=>a.createElement(r.A,s({},e,{ref:t,icon:o.A})))},3214:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"}},4190:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var a=n(7109),o=n(3214),r=n(8483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let i=a.forwardRef((e,t)=>a.createElement(r.A,s({},e,{ref:t,icon:o.A})))},5450:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"}},6578:(e,t,n)=>{"use strict";async function a(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function o(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(t))}async function r(e){var t,n;let o=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&o.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&o.set("category",e.category),(null==e?void 0:e.page)&&o.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&o.set("limit",String(null!=(n=e.limit)?n:50)),a("/api/kb/files?".concat(o))}async function s(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),a("/api/kb/files/detail?".concat(n))}async function i(e,t){return a("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function l(e,t,n){return a("/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 a=new FileReader;a.onload=()=>{let e=a.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},a.onerror=n,a.readAsDataURL(e)})}async function d(e,t,n){return a("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await c(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function m(e){return a("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t))}async function u(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return a("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function v(){return a("/api/kb/features")}async function b(e,t){var n,o,r,s,i;let l=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&l.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&l.set("category",t.category),(null==t?void 0:t.limit)&&l.set("limit",String(null!=(i=t.limit)?i:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&l.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(o=t.weights)?void 0:o.vector)!=null&&l.set("vectorWeight",String(t.weights.vector)),(null==t||null==(r=t.weights)?void 0:r.rewrite)!=null&&l.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(s=t.weights)?void 0:s.hybridBonus)!=null&&l.set("hybridBonus",String(t.weights.hybridBonus)),a("/api/kb/search?".concat(l))}async function x(){return a("/api/prompt")}async function j(){return a("/api/documents/templates")}async function A(e){return a("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e){return a("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(e){return a("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function S(e){return a("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return a("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(){return a("/api/documents/drafts")}async function E(e,t){return a("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function P(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function T(){return a("/api/config/providers")}async function I(e,t){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function k(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(){return a("/api/config/models")}async function z(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function R(){return a("/api/config/embedding")}async function _(e){return a("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function L(){return a("/api/config/embedding/healthCheck",{method:"POST"})}async function M(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function U(){return a("/api/system/stats")}async function H(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return a("/api/context".concat(n))}async function D(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function K(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function J(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function B(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function V(e,t){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function F(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>E,Bh:()=>F,Dl:()=>j,E:()=>J,FC:()=>U,H1:()=>g,H7:()=>u,HC:()=>i,HT:()=>r,II:()=>R,OX:()=>S,PH:()=>K,QT:()=>m,Qx:()=>p,R1:()=>N,SJ:()=>y,UE:()=>P,VW:()=>v,W2:()=>b,X8:()=>f,Z3:()=>T,_m:()=>I,aP:()=>z,bV:()=>C,bZ:()=>M,c1:()=>d,dd:()=>_,dx:()=>x,h0:()=>w,h1:()=>k,hc:()=>o,hn:()=>H,l2:()=>A,p:()=>D,q7:()=>O,tn:()=>l,u6:()=>L,xC:()=>s,xq:()=>h,xw:()=>B,zo:()=>V,zr:()=>$})},7305:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return n(9526)}])},8770:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=n(1916).A},8847:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"}},9071:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var a=n(7109),o=n(8847),r=n(8483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let i=a.forwardRef((e,t)=>a.createElement(r.A,s({},e,{ref:t,icon:o.A})))},9526:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>el});var a=n(5321),o=n(7109),r=n(6644),s=n(7807),i=n(5114),l=n(8787),c=n(2256),d=n(8770),m=n(3442),p=n(6171),u=n(9188),h=n(4216),y=n(5042),f=n(7137),g=n(2188),v=n(7189),b=n(505),x=n(3638),j=n(2162),A=n(6047),w=n(4567),C=n(5561),S=n(7961),N=n(540);let O=(e,t,n)=>({background:e,[`${n}-icon`]:{color:t}}),E=(0,N.OF)("Alert",e=>[(e=>{let{componentCls:t,motionDurationSlow:n,marginXS:a,marginSM:o,fontSize:r,fontSizeLG:s,lineHeight:i,borderRadiusLG:l,motionEaseInOutCirc:c,withDescriptionIconSize:d,colorText:m,colorTextHeading:p,withDescriptionPadding:u,defaultPadding:h,lineWidth:y,lineType:f,colorSuccessBorder:g,colorWarningBorder:v,colorErrorBorder:b,colorInfoBorder:x}=e;return{[t]:{...(0,S.dF)(e),position:"relative",display:"flex",alignItems:"center",padding:h,wordWrap:"break-word",borderRadius:l,borderWidth:(0,C.zA)(y),borderStyle:f,[`&${t}-success`]:{borderColor:g},[`&${t}-info`]:{borderColor:x},[`&${t}-warning`]:{borderColor:v},[`&${t}-error`]:{borderColor:b},[`&${t}-filled`]:{borderColor:"transparent"},[`&${t}-rtl`]:{direction:"rtl"},[`${t}-section`]:{flex:1,minWidth:0},[`${t}-icon`]:{marginInlineEnd:a,lineHeight:0},"&-description":{display:"none",fontSize:r,lineHeight:i},"&-title":{color:p},[`&${t}-motion-leave`]:{overflow:"hidden",opacity:1,transition:["max-height","opacity","padding-top","padding-bottom","margin-bottom"].map(e=>`${e} ${n} ${c}`).join(", ")},[`&${t}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0},[`&${t}-with-description`]:{alignItems:"flex-start",padding:u,[`${t}-icon`]:{marginInlineEnd:o,fontSize:d,lineHeight:0},[`${t}-title`]:{display:"block",marginBottom:a,color:p,fontSize:s},[`${t}-description`]:{display:"block",color:m}},[`&${t}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}}})(e),(e=>{let{componentCls:t,colorSuccess:n,colorSuccessBg:a,colorWarning:o,colorWarningBg:r,colorError:s,colorErrorBg:i,colorInfo:l,colorInfoBg:c}=e;return{[t]:{"&-success":O(a,n,t),"&-info":O(c,l,t),"&-warning":O(r,o,t),"&-error":{...O(i,s,t),[`${t}-description > pre`]:{margin:0,padding:0}}}}})(e),(e=>{let{componentCls:t,iconCls:n,motionDurationMid:a,marginXS:o,fontSizeIcon:r,colorIcon:s,colorIconHover:i}=e;return{[t]:{[`${t}-actions`]:{marginInlineStart:o},[`${t}-close-icon`]:{marginInlineStart:o,padding:0,overflow:"hidden",fontSize:r,lineHeight:(0,C.zA)(r),backgroundColor:"transparent",border:"none",cursor:"pointer",...(0,S.K8)(e),[`${n}-close`]:{color:s,transition:`color ${a}`,"&:hover":{color:i}}},"&-close-text":{color:s,transition:`color ${a}`,"&:hover":{color:i}}}}})(e)],e=>({withDescriptionIconSize:e.fontSizeHeading3,defaultPadding:`${e.paddingContentVerticalSM}px 12px`,withDescriptionPadding:`${e.paddingMD}px ${e.paddingContentHorizontalLG}px`})),P=e=>{let{icon:t,type:n,className:a,style:r,successIcon:s,infoIcon:i,warningIcon:l,errorIcon:c}=e,d={success:s??o.createElement(u.A,null),info:i??o.createElement(g.A,null),error:c??o.createElement(h.A,null),warning:l??o.createElement(f.A,null)};return o.createElement("span",{className:a,style:r},t??d[n])},T=e=>{let{isClosable:t,prefixCls:n,closeIcon:a,handleClose:r,ariaProps:s,className:i,style:l}=e,c=!0===a||void 0===a?o.createElement(y.A,null):a;return t?o.createElement("button",{type:"button",onClick:r,className:(0,x.$)(`${n}-close-icon`,i),tabIndex:0,style:l,...s},c):null},I=o.forwardRef((e,t)=>{let{description:n,prefixCls:a,message:r,title:s,banner:i,className:l,rootClassName:c,style:d,onMouseEnter:m,onMouseLeave:p,onClick:u,afterClose:h,showIcon:y,closable:f,closeText:g,closeIcon:C,action:S,id:N,styles:O,classNames:I,...k}=e,$=s??r,[z,R]=o.useState(!1),_=o.useRef(null);o.useImperativeHandle(t,()=>({nativeElement:_.current}));let{getPrefixCls:L,direction:M,variant:U,closable:H,closeIcon:D,className:K,style:J,classNames:B,styles:V,successIcon:F,infoIcon:G,warningIcon:W,errorIcon:X}=(0,w.TP)("alert"),Q=L("alert",a),[q,Z]=E(Q),{onClose:Y,afterClose:ee}=(0,A.Qd)(f)?f:{},et=t=>{R(!0),(Y??e.onClose)?.(t)},en=o.useMemo(()=>void 0!==e.type?e.type:i?"warning":"info",[e.type,i]),ea=e.variant??U??"outlined",eo=o.useMemo(()=>!!(0,A.Qd)(f)&&!!f.closeIcon||!!g||("boolean"==typeof f?f:!!(!1!==C&&(0,A.R)(C))||!!H),[g,C,f,H]),er=!!i&&void 0===y||y,es={...e,prefixCls:Q,variant:ea,type:en,showIcon:er,closable:eo},ei=(0,j.XT)(J),el=(0,j.XT)(d),[ec,ed]=(0,j.AV)([B,I],[V,ei,O,el],{props:es}),em=(0,x.$)(Q,`${Q}-${en}`,`${Q}-${ea}`,{[`${Q}-with-description`]:!!n,[`${Q}-no-icon`]:!er,[`${Q}-banner`]:!!i,[`${Q}-rtl`]:"rtl"===M},K,l,c,ec.root,Z,q),ep=(0,b.KE)(k,{aria:!0,data:!0}),eu=o.useMemo(()=>(0,A.Qd)(f)&&f.closeIcon?f.closeIcon:g||(void 0!==C?C:(0,A.Qd)(H)&&H.closeIcon?H.closeIcon:D),[C,f,H,g,D]),eh=o.useMemo(()=>{let e=f??H;return(0,A.Qd)(e)?(0,b.KE)(e,{data:!0,aria:!0}):{}},[f,H]);return o.createElement(v.Ay,{visible:!z,motionName:`${Q}-motion`,motionAppear:!1,motionEnter:!1,onLeaveStart:e=>({maxHeight:e.offsetHeight}),onLeaveEnd:ee??h},({className:t,style:a},r)=>o.createElement("div",{id:N,ref:(0,b.K4)(_,r),"data-show":!z,className:(0,x.$)(em,t),style:{...ed.root,...a},onMouseEnter:m,onMouseLeave:p,onClick:u,role:"alert",...ep},er?o.createElement(P,{className:(0,x.$)(`${Q}-icon`,ec.icon),style:ed.icon,description:n,icon:e.icon,prefixCls:Q,type:en,successIcon:F,infoIcon:G,warningIcon:W,errorIcon:X}):null,o.createElement("div",{className:(0,x.$)(`${Q}-section`,ec.section),style:ed.section},$?o.createElement("div",{className:(0,x.$)(`${Q}-title`,ec.title),style:ed.title},$):null,n?o.createElement("div",{className:(0,x.$)(`${Q}-description`,ec.description),style:ed.description},n):null),S?o.createElement("div",{className:(0,x.$)(`${Q}-actions`,ec.actions),style:ed.actions},S):null,o.createElement(T,{className:ec.close,style:ed.close,isClosable:eo,prefixCls:Q,closeIcon:eu,handleClose:et,ariaProps:eh})))});var k=n(1113),$=n(9939),z=n(218),R=n(3076),_=n(3784),L=n(5472);let M=function(e){function t(){var e,n,a;return(0,k.A)(this,t),n=t,a=arguments,n=(0,z.A)(n),(e=(0,_.A)(this,(0,R.A)()?Reflect.construct(n,a||[],(0,z.A)(this).constructor):n.apply(this,a))).state={error:void 0,info:{}},e}return(0,L.A)(t,e),(0,$.A)(t,[{key:"componentDidCatch",value:function(e,t){this.setState({error:e,info:t})}},{key:"render",value:function(){let{message:e,title:t,description:n,id:a,children:r}=this.props,{error:s,info:i}=this.state,l=t??e,c=i?.componentStack||null,d=(0,A.R)(l)?l:s?.toString(),m=(0,A.R)(n)?n:c;return s?o.createElement(I,{id:a,type:"error",title:d,description:o.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},m)}):r}}])}(o.PureComponent);I.ErrorBoundary=M;var U=n(3455),H=n(7271),D=n(4668),K=n(4992),J=n(1702),B=n(5258),V=n(4746),F=n(9071),G=n(3114),W=n(9650),X=n(8209),Q=n(69),q=n(8483);function Z(){return(Z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let Y=o.forwardRef((e,t)=>o.createElement(q.A,Z({},e,{ref:t,icon:Q.A})));var ee=n(289);function et(){return(et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let en=o.forwardRef((e,t)=>o.createElement(q.A,et({},e,{ref:t,icon:ee.A})));var ea=n(6578),eo=n(2323),er=n.n(eo);let es=[{label:"OpenAI 兼容",value:"openai"},{label:"Anthropic",value:"anthropic"},{label:"Google",value:"google"},{label:"Ollama",value:"ollama"},{label:"OpenRouter",value:"openrouter"}],ei=[{key:"reader",labelKey:"models.tierReader",descKey:"models.tierReaderDesc"},{key:"reasoning",labelKey:"models.tierReasoning",descKey:"models.tierReasoningDesc"},{key:"action",labelKey:"models.tierAction",descKey:"models.tierActionDesc"}];function el(){let e=(0,r.Vr)(),{message:t}=s.A.useApp(),n=[{label:e("models.embeddingProviderHash"),value:"hash"},{label:e("models.embeddingProviderOpenAI"),value:"openai-compatible"}],[y,f]=(0,o.useState)(!0),[g,v]=(0,o.useState)([]),[b,x]=(0,o.useState)(null),[j,A]=(0,o.useState)({provider:"hash",dimensions:384}),[w,C]=(0,o.useState)(!1),[S,N]=(0,o.useState)(!1),[O,E]=(0,o.useState)(null),[P,T]=(0,o.useState)(!1),[k,$]=(0,o.useState)(""),[z,R]=(0,o.useState)(""),[_,L]=(0,o.useState)(""),[M,Q]=(0,o.useState)("openai"),[q,Z]=(0,o.useState)(!1),[ee,et]=(0,o.useState)(!1),[eo,el]=(0,o.useState)(""),[ec,ed]=(0,o.useState)(""),[em,ep]=(0,o.useState)(""),[eu,eh]=(0,o.useState)(""),[ey,ef]=(0,o.useState)("openai"),[eg,ev]=(0,o.useState)(!1),[eb,ex]=(0,o.useState)(null),[ej,eA]=(0,o.useState)({}),ew=async()=>{f(!0);try{let[e,t,n]=await Promise.all([(0,ea.Z3)().catch(()=>[]),(0,ea.zr)().catch(()=>null),(0,ea.II)().catch(()=>({provider:"hash",dimensions:384}))]);v(e),x(t),A(n)}catch(n){t.error(e("common.error"))}finally{f(!1)}};(0,o.useEffect)(()=>{ew()},[]);let eC=async()=>{if(k.trim()){Z(!0);try{await (0,ea._m)(k.trim(),{apiKey:z||void 0,baseUrl:_||void 0,protocol:M}),T(!1),$(""),R(""),L(""),Q("openai"),await ew(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{Z(!1)}}},eS=async n=>{try{await (0,ea.h1)(n),await ew(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}},eN=async e=>{el(e.name),ed(e.name),ep("");try{let t=await (0,ea.Bh)(e.name);ep(t.apiKey?"••••••••":""),eh(t.baseUrl||""),ef(t.protocol||t.detectedProtocol||"openai")}catch(t){eh(e.baseUrl||""),ef(e.protocol||e.detectedProtocol||"openai")}et(!0)},eO=async()=>{if(ec.trim()){ev(!0);try{let n=em.includes("•")?void 0:em||void 0;await (0,ea._m)(ec.trim(),{oldName:eo,apiKey:n,baseUrl:eu||void 0,protocol:ey}),et(!1),el(""),ed(""),ep(""),eh(""),ef("openai"),await ew(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{ev(!1)}}},eE=async n=>{ex(n);try{let a=await (0,ea.bZ)(n);eA(e=>({...e,[n]:a.success})),t[a.success?"success":"error"](a.success?e("models.connected"):e("models.connectionFailed"))}catch(e){eA(e=>({...e,[n]:!1}))}finally{ex(null)}},eP=async()=>{C(!0);try{let n=await (0,ea.dd)(j);A(n),E(null),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{C(!1)}},eT=async()=>{N(!0);try{let n=await (0,ea.u6)();E(n.success),t[n.success?"success":"error"](n.message||(n.success?e("models.connected"):e("models.connectionFailed")))}catch(n){E(!1),t.error(e("common.error"))}finally{N(!1)}},eI=async(n,a)=>{if(!b)return;let o={...b},r=o[n];if(!a){r.active="",x(o);try{await (0,ea.aP)(o)}catch(n){t.error(e("common.error"))}return}let s=a.indexOf(":"),i=s>=0?a.slice(0,s):a,l=s>=0?a.slice(s+1):a;r.active=l,r.list.some(e=>e.name===l&&e.provider===i)||r.list.push({name:l,provider:i}),x(o);try{await (0,ea.aP)(o)}catch(n){t.error(e("common.error"))}};return(0,a.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle",children:e("models.title")}),(0,a.jsx)("p",{className:"pageDesc",children:e("models.description")})]}),(0,a.jsx)(i.Ay,{type:"primary",icon:(0,a.jsx)(V.A,{}),onClick:()=>T(!0),children:e("models.addModel")})]}),(0,a.jsx)(l.A,{title:e("models.modelList"),size:"small",loading:y,children:0===g.length?(0,a.jsx)("span",{className:er().cardMeta,children:e("models.noProviders")}):(0,a.jsx)(c.A,{gutter:[12,12],align:"stretch",children:g.map(t=>(0,a.jsx)(d.A,{xs:24,sm:12,lg:8,xl:6,className:er().providerGrid,children:(0,a.jsxs)(l.A,{size:"small",className:er().providerCard,children:[(0,a.jsxs)("div",{className:er().cardAction,children:[(0,a.jsxs)("div",{className:er().cardMain,children:[(0,a.jsx)("div",{className:er().cardName,title:t.name,children:t.name}),(0,a.jsxs)("div",{className:er().cardMeta,children:[(0,a.jsx)(F.A,{})," ",t.protocol||t.detectedProtocol||"openai"]})]}),(0,a.jsxs)(m.A,{size:2,wrap:!1,children:[(0,a.jsx)(i.Ay,{size:"small",type:"text",loading:eb===t.name,onClick:()=>{eE(t.name)},icon:!0===ej[t.name]?(0,a.jsx)(u.A,{className:"text-[var(--colorOk)]"}):!1===ej[t.name]?(0,a.jsx)(h.A,{className:"text-[var(--colorDanger)]"}):(0,a.jsx)(G.A,{})}),(0,a.jsx)(i.Ay,{size:"small",type:"text",icon:(0,a.jsx)(W.A,{}),onClick:()=>{eN(t)}}),(0,a.jsx)(p.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{eS(t.name)},children:(0,a.jsx)(i.Ay,{size:"small",type:"text",danger:!0,icon:(0,a.jsx)(X.A,{})})})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,a.jsxs)("span",{className:"".concat(er().cardMeta," text-xs"),children:[(0,a.jsx)(Y,{})," ",t.hasApiKey?"••••••••":"—"]}),t.baseUrl&&(0,a.jsxs)("span",{className:"".concat(er().cardMeta," ").concat(er().urlLine," text-xs"),title:t.baseUrl,children:[(0,a.jsx)(en,{})," ",t.baseUrl]})]})]})},t.name))})}),(0,a.jsxs)(l.A,{title:e("models.embeddingConfig"),size:"small",loading:y,children:[(0,a.jsx)(I,{className:"mb-4",type:"info",showIcon:!0,message:e("models.embeddingHint")}),(0,a.jsxs)(U.A,{layout:"vertical",size:"middle",children:[(0,a.jsxs)(c.A,{gutter:[12,12],children:[(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(U.A.Item,{label:e("models.embeddingProvider"),children:(0,a.jsx)(H.A,{value:j.provider,options:n,onChange:e=>A(t=>({...t,provider:e,dimensions:"hash"===e?384:t.dimensions||1024}))})})}),"openai-compatible"===j.provider&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(U.A.Item,{label:"Base URL",children:(0,a.jsx)(D.A,{value:j.baseUrl,onChange:e=>A(t=>({...t,baseUrl:e.target.value})),placeholder:"http://localhost:11434/v1"})})}),(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(U.A.Item,{label:e("models.model"),children:(0,a.jsx)(D.A,{value:j.model,onChange:e=>A(t=>({...t,model:e.target.value})),placeholder:"bge-m3"})})}),(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(U.A.Item,{label:e("models.apiKey"),help:j.hasApiKey?e("models.embeddingApiKeyHint"):void 0,children:(0,a.jsx)(D.A.Password,{value:j.apiKey,onFocus:()=>{var e;(null==(e=j.apiKey)?void 0:e.includes("•"))&&A(e=>({...e,apiKey:""}))},onChange:e=>A(t=>({...t,apiKey:e.target.value})),placeholder:e("models.optional")})})})]}),(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(U.A.Item,{label:e("models.dimensions"),children:(0,a.jsx)(K.A,{className:"w-full",min:1,value:j.dimensions,onChange:e=>A(t=>({...t,dimensions:Number(e||("hash"===t.provider?384:1024))}))})})}),(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsx)(U.A.Item,{label:e("models.status"),children:(0,a.jsxs)(m.A,{children:[(0,a.jsx)(J.A,{color:"hash"===j.provider?"default":"blue",children:"hash"===j.provider?e("models.localHash"):e("models.openAICompatible")}),!0===O&&(0,a.jsx)(J.A,{color:"success",children:e("models.connected")}),!1===O&&(0,a.jsx)(J.A,{color:"error",children:e("models.connectionFailed")})]})})})]}),(0,a.jsxs)(m.A,{children:[(0,a.jsx)(i.Ay,{type:"primary",loading:w,onClick:()=>{eP()},children:e("models.saveEmbedding")}),(0,a.jsx)(i.Ay,{icon:(0,a.jsx)(G.A,{}),loading:S,onClick:()=>{eT()},children:e("models.testEmbedding")})]})]})]}),b&&(0,a.jsx)(l.A,{title:e("models.modelTiers"),size:"small",children:(0,a.jsx)(c.A,{gutter:[12,12],children:ei.map(n=>{var o;let{key:r,labelKey:s,descKey:i}=n,c=b[r],m=c.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),p=g.filter(e=>!c.list.some(t=>t.provider===e.name)).map(e=>({label:"".concat(e.name," / ").concat(e.name),value:"".concat(e.name,":").concat(e.name)}));return(0,a.jsx)(d.A,{xs:24,lg:8,children:(0,a.jsxs)(l.A,{size:"small",title:e(s),children:[(0,a.jsx)("span",{className:er().tierDesc,children:e(i)}),(0,a.jsx)(H.A,{value:c.active?"".concat((null==(o=c.list.find(e=>e.name===c.active))?void 0:o.provider)||"",":").concat(c.active):void 0,onChange:e=>{eI(r,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),className:"w-full",options:[...m,...p]}),c.list.length>0&&(0,a.jsx)("div",{className:er().modelTags,children:c.list.map(n=>(0,a.jsxs)(J.A,{color:n.name===c.active?"blue":void 0,closable:!0,onClose:()=>{var a,o;let s={...b},i=s[r];i.list=i.list.filter(e=>e.name!==n.name||e.provider!==n.provider),i.active===n.name&&(i.active=null!=(o=null==(a=i.list[0])?void 0:a.name)?o:""),x(s),(0,ea.aP)(s).catch(()=>t.error(e("common.error")))},children:[n.provider,"/",n.name]},"".concat(n.provider,":").concat(n.name)))})]})},r)})})}),(0,a.jsx)(B.A,{title:e("models.addModel"),open:P,onCancel:()=>{T(!1),$(""),R(""),L(""),Q("openai")},onOk:()=>{eC()},confirmLoading:q,children:(0,a.jsxs)(U.A,{layout:"vertical",size:"middle",children:[(0,a.jsx)(U.A.Item,{label:e("models.modelName"),children:(0,a.jsx)(D.A,{value:k,onChange:e=>$(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,a.jsx)(U.A.Item,{label:e("models.apiKey"),children:(0,a.jsx)(D.A.Password,{value:z,onChange:e=>R(e.target.value),placeholder:"sk-..."})}),(0,a.jsx)(U.A.Item,{label:e("models.baseUrl"),children:(0,a.jsx)(D.A,{value:_,onChange:e=>L(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,a.jsx)(U.A.Item,{label:e("models.protocol"),children:(0,a.jsx)(H.A,{value:M,onChange:Q,options:es})})]})}),(0,a.jsx)(B.A,{title:e("models.editModel"),open:ee,onCancel:()=>{et(!1),el(""),ed(""),ep(""),eh(""),ef("openai")},onOk:()=>{eO()},confirmLoading:eg,children:(0,a.jsxs)(U.A,{layout:"vertical",size:"middle",children:[(0,a.jsx)(U.A.Item,{label:e("models.modelName"),children:(0,a.jsx)(D.A,{value:ec,onChange:e=>ed(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,a.jsx)(U.A.Item,{label:e("models.apiKey"),help:e("models.apiKeyEditHint"),children:(0,a.jsx)(D.A.Password,{value:em,onFocus:()=>{em.includes("•")&&ep("")},onCopy:e=>e.preventDefault(),onChange:e=>ep(e.target.value),placeholder:e("models.apiKeyEditPlaceholder")})}),(0,a.jsx)(U.A.Item,{label:e("models.baseUrl"),children:(0,a.jsx)(D.A,{value:eu,onChange:e=>eh(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,a.jsx)(U.A.Item,{label:e("models.protocol"),children:(0,a.jsx)(H.A,{value:ey,onChange:ef,options:es})})]})})]})}}},e=>{e.O(0,[260,544,425,668,740,492,455,992,636,593,792],()=>e(e.s=7305)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[449],{3018:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-circle",theme:"outlined"}},3114:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(7109),o=n(5450),s=n(8483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(s.A,a({},e,{ref:t,icon:o.A})))},3139:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/overview",function(){return n(3502)}])},3502:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>z});var r=n(5321),o=n(7109),s=n(6644),a=n(2700),i=n(5114),c=n(2256),l=n(8770),d=n(8787),u=n(9605),p=n(4849),h=n(3442),y=n(1702),f=n(6109),m=n(2192),v=n(8200),g=n(8483);function x(){return(x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let j=o.forwardRef((e,t)=>o.createElement(g.A,x({},e,{ref:t,icon:v.A})));var b=n(933),w=n(3114),A=n(9071),O=n(9012),S=n(6374);function T(){return(T=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let k=o.forwardRef((e,t)=>o.createElement(g.A,T({},e,{ref:t,icon:S.A})));var C=n(3018);function P(){return(P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let E=o.forwardRef((e,t)=>o.createElement(g.A,P({},e,{ref:t,icon:C.A})));var N=n(6578);function z(){var e,t,n,v,g,x,S,T,C,P,z,R;let L=(0,s.Vr)(),J=(0,f.useRouter)(),[U,M]=(0,o.useState)(null),[D,H]=(0,o.useState)(!0),[B,I]=(0,o.useState)(0),_=(0,o.useCallback)(async()=>{H(!0);try{let[e,t]=await Promise.all([(0,N.FC)(),(0,N.Z3)().catch(()=>[])]);M(e),I(Array.isArray(t)?t.length:0)}catch(e){}finally{H(!1)}},[]);if((0,o.useEffect)(()=>{_();let e=setInterval(()=>{_()},1e4);return()=>clearInterval(e)},[_]),D&&!U)return(0,r.jsx)("div",{className:"flex justify-center py-16",children:(0,r.jsx)(a.A,{size:"large"})});let F=(null!=(t=null==U?void 0:U.cpu.usagePercent)?t:0)>80?"var(--colorDanger)":(null!=(n=null==U?void 0:U.cpu.usagePercent)?n:0)>50?"var(--colorWarning)":"var(--colorOk)",V=(null!=(v=null==U?void 0:U.memory.usagePercent)?v:0)>80?"var(--colorDanger)":(null!=(g=null==U?void 0:U.memory.usagePercent)?g:0)>50?"var(--colorWarning)":"var(--colorOk)",W=(null==U?void 0:U.tasks.total)?Math.round(U.tasks.success/U.tasks.total*100):0,q=null==U||null==(e=U.models)?void 0:e[0];return(0,r.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"pageTitle",children:L("overview.title")}),(0,r.jsx)("p",{className:"pageDesc",children:L("overview.description")})]}),(0,r.jsx)(i.Ay,{icon:(0,r.jsx)(m.A,{spin:D}),loading:D,onClick:()=>{_()},children:L("common.retry")})]}),(0,r.jsxs)(c.A,{gutter:[16,16],children:[(0,r.jsx)(l.A,{xs:24,sm:12,children:(0,r.jsx)(d.A,{size:"small",title:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(j,{})," CPU"]}),children:(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)(u.A,{type:"circle",percent:null!=(x=null==U?void 0:U.cpu.usagePercent)?x:0,size:120,strokeColor:F,format:e=>"".concat(null==e?void 0:e.toFixed(1),"%")}),(0,r.jsxs)("div",{className:"text-xs mt-2",style:{color:"var(--colorTextSecondary)"},children:[null!=(S=null==U?void 0:U.cpu.cores)?S:0," ",L("overview.cores")]})]})})}),(0,r.jsx)(l.A,{xs:24,sm:12,children:(0,r.jsx)(d.A,{size:"small",title:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b.A,{})," ",L("overview.memory")]}),children:(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)(u.A,{type:"circle",percent:null!=(T=null==U?void 0:U.memory.usagePercent)?T:0,size:120,strokeColor:V,format:e=>"".concat(e,"%")}),(0,r.jsxs)("div",{className:"text-xs mt-2",style:{color:"var(--colorTextSecondary)"},children:[null!=(C=null==U?void 0:U.memory.processMB)?C:0," MB / ",null!=(P=null==U?void 0:U.memory.totalMB)?P:0," MB"]})]})})})]}),(0,r.jsxs)(c.A,{gutter:[16,16],children:[(0,r.jsx)(l.A,{xs:12,sm:6,children:(0,r.jsx)(d.A,{size:"small",children:(0,r.jsx)(p.A,{title:L("overview.providersCount"),value:B,prefix:(0,r.jsx)(w.A,{})})})}),(0,r.jsx)(l.A,{xs:12,sm:6,children:(0,r.jsx)(d.A,{size:"small",children:(0,r.jsx)(p.A,{title:L("overview.tokensUsed"),value:null!=(z=null==U?void 0:U.tokens.total)?z:0,prefix:(0,r.jsx)(A.A,{})})})}),(0,r.jsx)(l.A,{xs:12,sm:6,children:(0,r.jsx)(d.A,{size:"small",children:(0,r.jsx)(p.A,{title:L("overview.tasksTotal"),value:null!=(R=null==U?void 0:U.tasks.total)?R:0,prefix:(0,r.jsx)(O.A,{})})})}),(0,r.jsx)(l.A,{xs:12,sm:6,children:(0,r.jsx)(d.A,{size:"small",children:(0,r.jsx)(p.A,{title:L("overview.successRate"),value:W,suffix:"%",prefix:W>80?(0,r.jsx)(k,{style:{color:"var(--colorOk)"}}):(0,r.jsx)(E,{style:{color:"var(--colorDanger)"}})})})})]}),(0,r.jsxs)(c.A,{gutter:[16,16],children:[(0,r.jsx)(l.A,{xs:24,sm:12,children:(0,r.jsx)(d.A,{size:"small",title:L("overview.topModel"),children:q?(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)(w.A,{style:{fontSize:24,color:"var(--colorAccent)"}}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-semibold",children:q.model}),(0,r.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["@",q.provider," — ",q.count," ",L("overview.calls")]})]})]}):(0,r.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:L("common.noData")})})}),(0,r.jsx)(l.A,{xs:24,sm:12,children:(0,r.jsx)(d.A,{size:"small",title:L("overview.taskTypes"),children:(null==U?void 0:U.tasks.types)&&Object.keys(U.tasks.types).length>0?(0,r.jsx)(h.A,{wrap:!0,children:Object.entries(U.tasks.types).map(e=>{let[t,n]=e;return(0,r.jsxs)(y.A,{children:[t.slice(0,30),": ",n]},t)})}):(0,r.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:L("common.noData")})})})]}),(0,r.jsx)(d.A,{title:L("overview.quickActions"),size:"small",children:(0,r.jsxs)(h.A,{wrap:!0,children:[(0,r.jsx)(i.Ay,{onClick:()=>{J.push("/knowledge/manage")},children:L("overview.goToKnowledge")}),(0,r.jsx)(i.Ay,{onClick:()=>{J.push("/models")},children:L("overview.goToModels")}),(0,r.jsx)(i.Ay,{onClick:()=>{J.push("/settings")},children:L("overview.goToSettings")}),(0,r.jsx)(i.Ay,{onClick:()=>{J.push("/prompt")},children:L("nav.promptManagement")}),(0,r.jsx)(i.Ay,{onClick:()=>{J.push("/context/long-term")},children:L("nav.contextEngineering")})]})})]})}},5450:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"}},6109:(e,t,n)=>{e.exports=n(7212)},6374:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"}},6578:(e,t,n)=>{"use strict";async function r(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function o(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return r("/api/kb/stats".concat(t))}async function s(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)),r("/api/kb/files?".concat(o))}async function a(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),r("/api/kb/files/detail?".concat(n))}async function i(e,t){return r("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function c(e,t,n){return r("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=r.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},r.onerror=n,r.readAsDataURL(e)})}async function d(e,t,n){return r("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return r("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),r("/api/kb/operations?".concat(t))}async function h(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),r("/api/kb/operations?".concat(t),{method:"DELETE"})}async function y(e,t){return r("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function f(e,t){return r("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function m(e){return r("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function v(e){return r("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function g(){return r("/api/kb/features")}async function x(e,t){var n,o,s,a,i;let c=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&c.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&c.set("category",t.category),(null==t?void 0:t.limit)&&c.set("limit",String(null!=(i=t.limit)?i:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(o=t.weights)?void 0:o.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(s=t.weights)?void 0:s.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(a=t.weights)?void 0:a.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),r("/api/kb/search?".concat(c))}async function j(){return r("/api/prompt")}async function b(){return r("/api/documents/templates")}async function w(e){return r("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function A(e){return r("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(e){return r("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function S(e){return r("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return r("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(){return r("/api/documents/drafts")}async function C(e,t){return r("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function P(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function E(){return r("/api/config/providers")}async function N(e,t){return r("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function z(e){return r("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(){return r("/api/config/models")}async function L(e){return r("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J(){return r("/api/config/embedding")}async function U(e){return r("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function M(){return r("/api/config/embedding/healthCheck",{method:"POST"})}async function D(e){return r("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function H(){return r("/api/system/stats")}async function B(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return r("/api/context".concat(n))}async function I(e){return r("/api/context?type=".concat(e,"&stats=1"))}async function _(e){return r("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function F(e){return r("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function V(e){return r("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function W(e,t){return r("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function q(e){return r("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>C,Bh:()=>q,Dl:()=>b,E:()=>F,FC:()=>H,H1:()=>v,H7:()=>h,HC:()=>i,HT:()=>s,II:()=>J,OX:()=>S,PH:()=>_,QT:()=>u,Qx:()=>p,R1:()=>T,SJ:()=>f,UE:()=>P,VW:()=>g,W2:()=>x,X8:()=>m,Z3:()=>E,_m:()=>N,aP:()=>L,bV:()=>O,bZ:()=>D,c1:()=>d,dd:()=>U,dx:()=>j,h0:()=>A,h1:()=>z,hc:()=>o,hn:()=>B,l2:()=>w,p:()=>I,q7:()=>k,tn:()=>c,u6:()=>M,xC:()=>a,xq:()=>y,xw:()=>V,zo:()=>W,zr:()=>R})},8200:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M704 446H320c-4.4 0-8 3.6-8 8v402c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8V454c0-4.4-3.6-8-8-8zm-328 64h272v117H376V510zm272 290H376V683h272v117z"}},{tag:"path",attrs:{d:"M424 748a32 32 0 1064 0 32 32 0 10-64 0zm0-178a32 32 0 1064 0 32 32 0 10-64 0z"}},{tag:"path",attrs:{d:"M811.4 368.9C765.6 248 648.9 162 512.2 162S258.8 247.9 213 368.8C126.9 391.5 63.5 470.2 64 563.6 64.6 668 145.6 752.9 247.6 762c4.7.4 8.7-3.3 8.7-8v-60.4c0-4-3-7.4-7-7.9-27-3.4-52.5-15.2-72.1-34.5-24-23.5-37.2-55.1-37.2-88.6 0-28 9.1-54.4 26.2-76.4 16.7-21.4 40.2-36.9 66.1-43.7l37.9-10 13.9-36.7c8.6-22.8 20.6-44.2 35.7-63.5 14.9-19.2 32.6-36 52.4-50 41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.3c19.9 14 37.5 30.8 52.4 50 15.1 19.3 27.1 40.7 35.7 63.5l13.8 36.6 37.8 10c54.2 14.4 92.1 63.7 92.1 120 0 33.6-13.2 65.1-37.2 88.6-19.5 19.2-44.9 31.1-71.9 34.5-4 .5-6.9 3.9-6.9 7.9V754c0 4.7 4.1 8.4 8.8 8 101.7-9.2 182.5-94 183.2-198.2.6-93.4-62.7-172.1-148.6-194.9z"}}]},name:"cloud-server",theme:"outlined"}},8847:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"}},9071:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(7109),o=n(8847),s=n(8483);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(s.A,a({},e,{ref:t,icon:o.A})))}},e=>{e.O(0,[260,544,227,15,958,636,593,792],()=>e(e.s=3139)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{2256:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(5341).A},2725:(e,t,r)=>{"use strict";r.d(t,{A:()=>i,U:()=>a});var o=r(7109),n=r(505),s=r(8921),c=r(4567);function a(e){return t=>o.createElement(s.Ay,{theme:{token:{motion:!1,zIndexPopupBase:0}}},o.createElement(e,{...t}))}let i=(e,t,r,s,i)=>a(a=>{let{prefixCls:l,style:d}=a,p=o.useRef(null),[h,m]=o.useState(0),[u,f]=o.useState(0),[y,j]=(0,n.PW)(!1,a.open),{getPrefixCls:x}=o.useContext(c.QO),v=x(s||"select",l);o.useEffect(()=>{if(j(!0),"undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{let t=e[0].target;m(t.offsetHeight+8),f(t.offsetWidth)}),t=setInterval(()=>{let r=i?`.${i(v)}`:`.${v}-dropdown`,o=p.current?.querySelector(r);o&&(clearInterval(t),e.observe(o))},10);return()=>{clearInterval(t),e.disconnect()}}},[v]);let g={...a,style:{...d,margin:0},open:y,getPopupContainer:()=>p.current};return r&&(g=r(g)),t&&(g={...g,[t]:{overflow:{adjustX:!1,adjustY:!1}}}),o.createElement("div",{ref:p,style:{paddingBottom:h,position:"relative",minWidth:u}},o.createElement(e,{...g}))})},2887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},4084:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"}},4508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>T});var o=r(5321),n=r(7109),s=r(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{2256:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(5341).A},2725:(e,t,r)=>{"use strict";r.d(t,{A:()=>i,U:()=>a});var o=r(7109),n=r(505),s=r(8921),c=r(4567);function a(e){return t=>o.createElement(s.Ay,{theme:{token:{motion:!1,zIndexPopupBase:0}}},o.createElement(e,{...t}))}let i=(e,t,r,s,i)=>a(a=>{let{prefixCls:l,style:d}=a,p=o.useRef(null),[h,m]=o.useState(0),[u,f]=o.useState(0),[y,j]=(0,n.PW)(!1,a.open),{getPrefixCls:x}=o.useContext(c.QO),v=x(s||"select",l);o.useEffect(()=>{if(j(!0),"undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{let t=e[0].target;m(t.offsetHeight+8),f(t.offsetWidth)}),t=setInterval(()=>{let r=i?`.${i(v)}`:`.${v}-dropdown`,o=p.current?.querySelector(r);o&&(clearInterval(t),e.observe(o))},10);return()=>{clearInterval(t),e.disconnect()}}},[v]);let g={...a,style:{...d,margin:0},open:y,getPopupContainer:()=>p.current};return r&&(g=r(g)),t&&(g={...g,[t]:{overflow:{adjustX:!1,adjustY:!1}}}),o.createElement("div",{ref:p,style:{paddingBottom:h,position:"relative",minWidth:u}},o.createElement(e,{...g}))})},2887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},4084:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"}},4508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>T});var o=r(5321),n=r(7109),s=r(6644),c=r(7807),a=r(5114),i=r(8787),l=r(1702),d=r(4253),p=r(2256),h=r(8770),m=r(6985),u=r(6171),f=r(3442),y=r(5258),j=r(4668),x=r(4746),v=r(9606),g=r(9012),A=r(9650),w=r(8209),S=r(8740);async function z(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function b(e,t){let r=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function C(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function E(){let e=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:"自定义提示词",content:"# 自定义提示词\n"})});if(!e.ok)throw Error("Failed");return e.json()}async function O(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"select",selectedIds:e})});if(!t.ok)throw Error("Failed");return t.json()}function T(){var e;let t=(0,s.Vr)(),{message:r}=c.A.useApp(),[T,k]=(0,n.useState)(!0),[F,N]=(0,n.useState)([]),[P,R]=(0,n.useState)(!1),[_,M]=(0,n.useState)(null),[B,H]=(0,n.useState)(""),[I,L]=(0,n.useState)(!1),J=async()=>{k(!0);try{N(await z())}catch(e){r.error(t("common.error"))}finally{k(!1)}};(0,n.useEffect)(()=>{J()},[]);let V=async()=>{if(_){L(!0);try{await b(_.customizePath,B),r.success(t("common.success")),R(!1),await J()}catch(e){r.error(t("common.error"))}finally{L(!1)}}},D=async e=>{try{(null==e?void 0:e.projectRoot)?await C(e.projectRoot):await E(),r.success(t("common.success")),await J()}catch(e){r.error(t("common.error"))}},U=async(e,o)=>{let n=o?Array.from(new Set([...F.filter(e=>e.selected).map(e=>e.id),e.id])):F.filter(t=>t.selected&&t.id!==e.id).map(e=>e.id);try{await O(n),N(e=>e.map(e=>({...e,selected:n.includes(e.id)})))}catch(e){r.error(t("common.error"))}},W=async e=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e.projectId,filePath:e.customizePath})})).ok)throw Error("Failed");r.success(t("common.success")),await J()}catch(e){r.error(t("common.error"))}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:t("nav.promptManagement")}),(0,o.jsx)("p",{className:"pageDesc",children:t("prompt.description")})]}),(0,o.jsx)(a.Ay,{type:"primary",icon:(0,o.jsx)(x.A,{}),onClick:()=>{D()},children:"创建提示词"})]}),F.find(e=>e.isCurrent)&&(0,o.jsx)(i.A,{size:"small",children:(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[(0,o.jsx)(l.A,{color:"green",style:{width:"fit-content"},children:"当前工作项目"}),(0,o.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,o.jsx)(v.A,{})," ",null==(e=F.find(e=>e.isCurrent))?void 0:e.projectRoot]})]})}),0!==F.length||T?null:(0,o.jsx)(d.A,{}),(0,o.jsx)(p.A,{gutter:[16,16],children:T?Array.from({length:3}).map((e,t)=>(0,o.jsx)(h.A,{xs:24,sm:12,lg:8,children:(0,o.jsx)(i.A,{loading:!0,size:"small"})},t)):F.map(e=>(0,o.jsx)(h.A,{xs:24,sm:12,lg:8,children:(0,o.jsxs)(i.A,{size:"small",title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g.A,{})," ",e.projectName]}),extra:(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[e.hasFile&&(0,o.jsx)(m.A,{checked:e.selected,onChange:t=>{U(e,t.target.checked)},children:"选中"}),!e.hasFile&&e.projectRoot&&(0,o.jsx)(a.Ay,{size:"small",type:"text",icon:(0,o.jsx)(x.A,{}),onClick:()=>{D(e)}}),e.hasFile&&(0,o.jsx)(a.Ay,{size:"small",type:"text",icon:(0,o.jsx)(A.A,{}),onClick:()=>{M(e),H(e.content||""),R(!0)}}),(0,o.jsx)(u.A,{title:"custom"===e.source?"删除自定义提示词?":"删除项目记录及其提示词文件?",onConfirm:()=>{W(e)},children:(0,o.jsx)(a.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(w.A,{})})})]}),children:[e.projectRoot&&(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:[(0,o.jsx)(v.A,{})," ",e.projectRoot]}),(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:[(0,o.jsx)(S.A,{})," ",e.mtime?new Date(e.mtime).toLocaleString():t("common.never")]}),(0,o.jsxs)(f.A,{wrap:!0,children:[e.isCurrent&&(0,o.jsx)(l.A,{color:"green",children:"当前项目"}),e.selected&&(0,o.jsx)(l.A,{color:"purple",children:"已选中"}),"custom"===e.source&&(0,o.jsx)(l.A,{color:"cyan",children:"自定义"}),e.hasFile?(0,o.jsx)(l.A,{color:"blue",children:t("prompt.hasFile")}):(0,o.jsx)(l.A,{color:"default",children:t("prompt.noFile")})]}),e.hasFile&&e.content&&(0,o.jsxs)("div",{style:{marginTop:8,padding:8,background:"var(--colorBgSecondary)",borderRadius:8,fontSize:12,maxHeight:80,overflow:"hidden",color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap"},children:[e.content.slice(0,200),e.content.length>200?"...":""]})]})},e.id))}),0===F.length&&(0,o.jsx)(i.A,{size:"small",children:(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:t("prompt.noProjects")})}),(0,o.jsxs)(y.A,{title:"".concat(t("common.edit")," — ").concat((null==_?void 0:_.projectName)||""),open:P,width:800,onCancel:()=>R(!1),onOk:()=>{V()},confirmLoading:I,children:[(0,o.jsx)("div",{style:{marginBottom:12,fontSize:12,color:"var(--colorTextSecondary)"},children:null==_?void 0:_.customizePath}),(0,o.jsx)(j.A.TextArea,{value:B,onChange:e=>H(e.target.value),rows:25,style:{fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13}})]})]})}},7549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(4508)}])},8740:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var o=r(7109),n=r(4084),s=r(8483);function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(s.A,c({},e,{ref:t,icon:n.A})))},8770:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(1916).A},9012:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var o=r(7109),n=r(2887),s=r(8483);function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(s.A,c({},e,{ref:t,icon:n.A})))}},e=>{e.O(0,[260,544,425,668,446,492,636,593,792],()=>e(e.s=7549)),_N_E=e.O()}]);
|
package/.next/static/chunks/pages/{settings-e6a894618727eec3.js → settings-daf6d46ceb1dbd41.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[199],{2290:e=>{e.exports={langIcon:"style_langIcon__TP4OY",dark:"style_dark__b9hWg",sectionTitle:"style_sectionTitle__kFQM6",sectionDesc:"style_sectionDesc__opDGs",metaText:"style_metaText__1_eoU",metaValue:"style_metaValue__uxkOj"}},4521:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>_});var l=t(5321),c=t(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[199],{2290:e=>{e.exports={langIcon:"style_langIcon__TP4OY",dark:"style_dark__b9hWg",sectionTitle:"style_sectionTitle__kFQM6",sectionDesc:"style_sectionDesc__opDGs",metaText:"style_metaText__1_eoU",metaValue:"style_metaValue__uxkOj"}},4521:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>_});var l=t(5321),c=t(6644),i=t(9759),a=t(8787),n=t(1702),d=t(3340),x=t(1278);let r=(0,x.A)("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);var m=t(6733),h=t(8300);let o=(0,x.A)("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var j=t(2290),N=t.n(j);function _(){let e=(0,c.Vr)("settings"),{theme:s,resolvedTheme:t,setTheme:x}=(0,i.D)(),{locale:j,setLocale:_}=(0,c.x_)(),p=e=>{_(e)},v="system"===s?"system":t,y=e=>"applePill".concat(e?" applePillActive":"");return(0,l.jsxs)("div",{className:"space-y-5 max-w-2xl animateFadeIn",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"pageTitle",children:e("title")}),(0,l.jsx)("p",{className:"pageDesc",children:e("description")})]}),(0,l.jsx)(a.A,{title:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"statItemIcon ".concat(N().langIcon),children:(0,l.jsx)(d.A,{size:16})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-sm font-semibold ".concat(N().sectionTitle),children:e("language")}),(0,l.jsx)("div",{className:"text-xs ".concat(N().sectionDesc),children:e("languageDesc")})]})]}),children:(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("button",{className:y("zh-CN"===j),onClick:()=>p("zh-CN"),children:"中文"}),(0,l.jsx)("button",{className:y("en-US"===j),onClick:()=>p("en-US"),children:"English"})]})}),(0,l.jsx)(a.A,{title:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"statItemIcon",children:(0,l.jsx)(r,{size:16})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-sm font-semibold ".concat(N().sectionTitle),children:e("theme")}),(0,l.jsx)("div",{className:"text-xs ".concat(N().sectionDesc),children:e("themeDesc")})]})]}),children:(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsxs)("button",{className:y("light"===v),onClick:()=>x("light"),children:[(0,l.jsx)(m.A,{size:14}),e("light")]}),(0,l.jsxs)("button",{className:y("dark"===v),onClick:()=>x("dark"),children:[(0,l.jsx)(h.A,{size:14}),e("dark")]}),(0,l.jsxs)("button",{className:y("system"===v),onClick:()=>x("system"),children:[(0,l.jsx)(r,{size:14}),e("system")]})]})}),(0,l.jsx)(a.A,{title:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"statItemIcon",children:(0,l.jsx)(o,{size:16})}),(0,l.jsx)("span",{className:"text-sm font-semibold ".concat(N().sectionTitle),children:e("about")})]}),children:(0,l.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:N().metaText,children:e("version")}),(0,l.jsx)(n.A,{color:"blue",children:"v0.1.0"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:N().metaText,children:e("port")}),(0,l.jsx)("span",{className:N().metaValue,children:"17321"})]})]})})]})}},8451:(e,s,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/settings",function(){return t(4521)}])}},e=>{e.O(0,[260,636,593,792],()=>e(e.s=8451)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.style_featureLabel__XFSTX{color:var(--colorTextSecondary)}.style_featureValue__I_wMP{color:var(--colorText)}.style_filterInput__4_Elu{width:260px}.style_filterSelect__vUBJ9{width:140px}.style_statusPanel__9arTu{border:1px solid var(--colorBorderSecondary);border-radius:12px;background:var(--colorBgContainer);padding:10px;box-shadow:0 6px 18px rgba(0,0,0,.03)}.style_statusPanelHeader__nKv1I{display:flex;align-items:center;justify-content:space-between;gap:4px;color:var(--colorTextSecondary);font-size:12px;padding:0 2px 6px}.style_statusEmpty__8LWzH{color:var(--colorTextSecondary);padding:4px 2px;font-size:12px}.style_statusList__FpNgC{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:8px;max-height:220px;overflow-y:auto;overscroll-behavior:contain;padding-right:4px}.style_statusItem__uzO80{min-width:0;border:1px solid var(--colorBorderSecondary);border-left:3px solid var(--colorPrimary);border-radius:10px;padding:8px 10px;background:var(--colorFillAlter)}.style_statusHeader__o9q_b{display:flex;align-items:flex-start;justify-content:space-between;gap:6px;margin-bottom:3px;min-width:0}.style_statusHeader__o9q_b strong{display:inline-block;max-width:210px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.style_statusDesc__XiWFa{color:var(--colorText);font-size:12px;margin-bottom:3px;display:-webkit-box;line-clamp:2;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.style_statusPath__Udxvv{color:var(--colorTextSecondary);font-size:12px;background:var(--colorBgContainer);border-radius:6px;padding:3px 6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-bottom:4px}.style_statusMeta__XukHt{display:flex;flex-wrap:wrap;gap:4px;color:var(--colorTextSecondary);font-size:12px}.style_statusMeta__XukHt span{background:var(--colorBgContainer);border:1px solid var(--colorBorderSecondary);border-radius:999px;padding:2px 8px}.style_searchResultList__cVKZg{display:grid;gap:12px}.style_searchResultItem__boj6D{border:1px solid var(--colorBorderSecondary);border-radius:12px;padding:14px;background:var(--colorFillAlter)}.style_searchResultHeader__meVdJ{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}.style_searchContent__XbUVk{margin:10px 0!important;white-space:pre-wrap}.style_pdfPreviewStrip__94_eG{display:flex;gap:12px;overflow-x:auto;padding:8px 0}.style_pdfPreviewStrip__94_eG img{width:220px;max-height:320px;object-fit:contain;border:1px solid var(--colorBorderSecondary);border-radius:8px;background:#fff}.style_drawingPreview__lkk_L{min-height:120px;margin-top:12px;padding:16px;border:1px dashed var(--colorBorderSecondary);border-radius:10px;background:linear-gradient(135deg,rgba(80,140,255,.08),rgba(80,255,180,.06))}
|