@customize-agent/server 4.0.5 → 4.0.7
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 +176 -271
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +8 -0
- package/.next/server/chunks/1936.js +385 -0
- package/.next/server/chunks/8204.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/_app.js +1 -1
- package/.next/server/pages/_app.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/models.js +1 -1
- package/.next/server/pages/api/jobs/[id].js +2 -0
- package/.next/server/pages/api/jobs/[id].js.nft.json +1 -0
- package/.next/server/pages/api/jobs.js +2 -0
- package/.next/server/pages/api/jobs.js.nft.json +1 -0
- package/.next/server/pages/api/kb/files/open.js +1 -1
- package/.next/server/pages/api/kb/files.js +2 -2
- package/.next/server/pages/api/kb/operations.js +2 -2
- package/.next/server/pages/api/kb/reindex.js +2 -2
- package/.next/server/pages/api/kb/reindex.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/asset-library.html +1 -1
- package/.next/server/pages/asset-library.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/document-roles.html +1 -1
- package/.next/server/pages/document-roles.js.nft.json +1 -1
- package/.next/server/pages/document-specs.html +1 -1
- package/.next/server/pages/document-specs.js.nft.json +1 -1
- package/.next/server/pages/documents.html +1 -1
- package/.next/server/pages/documents.js.nft.json +1 -1
- package/.next/server/pages/guide.html +1 -1
- package/.next/server/pages/guide.js.nft.json +1 -1
- 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/system/logs.html +1 -1
- package/.next/server/pages/system/logs.js.nft.json +1 -1
- package/.next/server/pages-manifest.json +27 -25
- package/.next/static/2m64hom9a1sJPcvcwOlZ5/_buildManifest.js +1 -0
- package/.next/static/chunks/131-ad10d55ed64e627e.js +1 -0
- package/.next/static/chunks/{7150-123ff059dd0e2eb9.js → 150-57173312c2b70e98.js} +4 -4
- package/.next/static/chunks/195-9f2e4c67a9deff05.js +1 -0
- package/.next/static/chunks/20-23d24b40b69faf0f.js +8 -0
- package/.next/static/chunks/265-c3a46cef96364aac.js +1 -0
- package/.next/static/chunks/{1289-c788c44e65e9dc64.js → 289-36c210992d5009d5.js} +1 -1
- package/.next/static/chunks/412-03a4cc00655c0ec0.js +1 -0
- package/.next/static/chunks/433-ef3d7675b81826a9.js +1 -0
- package/.next/static/chunks/447-772df02993a8609b.js +1 -0
- package/.next/static/chunks/455-9e1e1c7e96845347.js +6 -0
- package/.next/static/chunks/506-b97aadd3e451b379.js +1 -0
- package/.next/static/chunks/512-e2813c7e9454d53c.js +1 -0
- package/.next/static/chunks/576-679ab6348b33b960.js +1 -0
- package/.next/static/chunks/698-0599729ce14a2e49.js +1 -0
- package/.next/static/chunks/749-dcb0cd85d1455f34.js +1 -0
- package/.next/static/chunks/{8787-c8bea0f25cbd3cf0.js → 787-196a2bed7b11745a.js} +1 -1
- package/.next/static/chunks/788-7de94bb44b70fb19.js +1 -0
- package/.next/static/chunks/932-823e1ae10dd43b8b.js +1 -0
- package/.next/static/chunks/938-0063785681203bb5.js +1 -0
- package/.next/static/chunks/985-da0b1f68e59d1e76.js +4 -0
- package/.next/static/chunks/framework-161be364fd69a7ce.js +1 -0
- package/.next/static/chunks/main-91fb767ebd74c9c1.js +1 -0
- package/.next/static/chunks/pages/_app-15da9e1394f6eaca.js +212 -0
- package/.next/static/chunks/pages/_error-282257fbdcc167b4.js +1 -0
- package/.next/static/chunks/pages/asset-library-e9ddfe1cbaac42d9.js +1 -0
- package/.next/static/chunks/pages/context/{long-term-820cba5f1ae3a6cd.js → long-term-2e6a30a8f879df47.js} +1 -1
- package/.next/static/chunks/pages/context/short-term-730211234fa3add6.js +1 -0
- package/.next/static/chunks/pages/{document-roles-ab6dfead3fd99a2c.js → document-roles-fb9e3ce4719fda9b.js} +1 -1
- package/.next/static/chunks/pages/document-specs-033d848b03b54df3.js +1 -0
- package/.next/static/chunks/pages/{documents-471786ecea050f17.js → documents-a21e4c98480b1a95.js} +1 -1
- package/.next/static/chunks/pages/{guide-2a3ec07403e02e1f.js → guide-6c680688d15f6200.js} +1 -1
- package/.next/static/chunks/pages/index-c5e0758e6b31deee.js +1 -0
- package/.next/static/chunks/pages/knowledge/file-detail-0a5e267f77f4e8b3.js +1 -0
- package/.next/static/chunks/pages/knowledge/files-4d2754cc303c2a70.js +1 -0
- package/.next/static/chunks/pages/knowledge/manage-25eb1a993b155450.js +1 -0
- package/.next/static/chunks/pages/knowledge/search-2cee4e8b8792170c.js +1 -0
- package/.next/static/chunks/pages/knowledge-905248d8dcb15453.js +1 -0
- package/.next/static/chunks/pages/models-b5f68c4c70257495.js +1 -0
- package/.next/static/chunks/pages/{overview-5235c02260509635.js → overview-37f93a823b4750f3.js} +1 -1
- package/.next/static/chunks/pages/prompt-4cf07545f8388d85.js +1 -0
- package/.next/static/chunks/pages/settings-fa9d6a56898ba678.js +1 -0
- package/.next/static/chunks/pages/system/logs-f4e222140dc7b30c.js +1 -0
- package/.next/static/chunks/{webpack-689755a4ff6d1f93.js → webpack-77d10b4726f13aa5.js} +1 -1
- package/package.json +3 -3
- package/scripts/kb-index-worker.cjs +128 -0
- package/.next/server/chunks/1547.js +0 -385
- package/.next/server/chunks/550.js +0 -1
- package/.next/server/chunks/9270.js +0 -1
- package/.next/static/IWuWLSb2ffDzvKo6MD3cy/_buildManifest.js +0 -1
- package/.next/static/chunks/1515-051d4383493143c9.js +0 -1
- package/.next/static/chunks/2073-244191fe7cc6e330.js +0 -4
- package/.next/static/chunks/2225-a90b5cc9338c63fa.js +0 -1
- package/.next/static/chunks/261-8a5ce39d74fc746e.js +0 -1
- package/.next/static/chunks/2884-b2944538a4a0d9b2.js +0 -1
- package/.next/static/chunks/3057-9eda004e07594513.js +0 -1
- package/.next/static/chunks/3455-c73ce4738620db20.js +0 -6
- package/.next/static/chunks/347-62c74776c299477d.js +0 -4
- package/.next/static/chunks/4052-9caaaa494d67a7e0.js +0 -1
- package/.next/static/chunks/4277-ba039fcf8f4e9cdc.js +0 -1
- package/.next/static/chunks/4427-302c5267a1f8493e.js +0 -1
- package/.next/static/chunks/4833-bf56f1203e2daffa.js +0 -28
- package/.next/static/chunks/5292-e65eab4f54b9f7ff.js +0 -16
- package/.next/static/chunks/5938-da5d441b981ec422.js +0 -1
- package/.next/static/chunks/6506-9d3cdc1ea816d7c4.js +0 -1
- package/.next/static/chunks/6578-6422ce4e29eb07d4.js +0 -1
- package/.next/static/chunks/6985-29200efa04920cb3.js +0 -4
- package/.next/static/chunks/7223-58376fd8a1d62df4.js +0 -1
- package/.next/static/chunks/7271-587c30b66ea4e619.js +0 -16
- package/.next/static/chunks/7576-b34ccf53f6efc388.js +0 -1
- package/.next/static/chunks/7889-8531b79751a71e39.js +0 -1
- package/.next/static/chunks/8326-b79c7555af5866e7.js +0 -8
- package/.next/static/chunks/861-dd60ef688592115e.js +0 -1
- package/.next/static/chunks/8676-5982391f15ea1190.js +0 -1
- package/.next/static/chunks/8732-69ffc27ed6c68f6f.js +0 -4
- package/.next/static/chunks/8932-e1bb3137986c259a.js +0 -1
- package/.next/static/chunks/9144-51689069a3d341e5.js +0 -1
- package/.next/static/chunks/9189-03f286defdb92816.js +0 -10
- package/.next/static/chunks/9773-53116cd0bf4b961a.js +0 -1
- package/.next/static/chunks/framework-fbc6f575b16f07d7.js +0 -1
- package/.next/static/chunks/main-105db6ecf7f64ff3.js +0 -1
- package/.next/static/chunks/pages/_app-03f3204a695aa8bc.js +0 -140
- package/.next/static/chunks/pages/_error-c01b6fb772028676.js +0 -1
- package/.next/static/chunks/pages/asset-library-634d18652eb7507d.js +0 -1
- package/.next/static/chunks/pages/context/short-term-3332ffb90b3b58a9.js +0 -1
- package/.next/static/chunks/pages/document-specs-565cf77237fce3d5.js +0 -1
- package/.next/static/chunks/pages/index-cc55686ed0309a22.js +0 -1
- package/.next/static/chunks/pages/knowledge/file-detail-f5e8f9bc35ebb92d.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-88aba3534bd722f9.js +0 -1
- package/.next/static/chunks/pages/knowledge/manage-5629ccce14402b99.js +0 -1
- package/.next/static/chunks/pages/knowledge/search-ad678d4bc8137cb5.js +0 -1
- package/.next/static/chunks/pages/knowledge-55e4c53985e79449.js +0 -1
- package/.next/static/chunks/pages/models-1788b9741155e3ce.js +0 -1
- package/.next/static/chunks/pages/prompt-0184d79af09db7e1.js +0 -1
- package/.next/static/chunks/pages/settings-fd31c9ef833cf0af.js +0 -1
- package/.next/static/chunks/pages/system/logs-8040fb1e0c814a0c.js +0 -1
- /package/.next/static/{IWuWLSb2ffDzvKo6MD3cy → 2m64hom9a1sJPcvcwOlZ5}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2731],{5122:(_,n,e)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_error",function(){return e(75599)}])}},_=>{_.O(0,[636,6593,8792],()=>_(_.s=5122)),_N_E=_.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2958],{63806:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>I});var n=i(65321),l=i(97109),a=i(17807),s=i(25258),r=i(88762),o=i(2256),c=i(38770),d=i(68787),p=i(33442),x=i(85114),h=i(84253),g=i(71102),y=i(384),m=i(11702),f=i(58209),u=i(93051),j=i(81668),w=i(64254),v=i(26619),A=i(85855),b=i(75548),k=i(56768),S=i(32620),z=i(6578);let C={knowledge_base:"知识库",generated:"AI生成",uploaded:"上传",external_url:"外部URL"},_={cover:"magenta",reference:"blue",generated:"purple",attachment:"cyan",map:"orange",operator:"geekblue"};function I(){let e=(0,S.Vr)(),{message:t}=a.A.useApp(),[i,I]=(0,l.useState)([]),[N,T]=(0,l.useState)(new Set),[E,F]=(0,l.useState)(!0),P=async()=>{try{I((await (0,z.f$)()).assets)}catch(e){I([])}};(0,l.useEffect)(()=>{F(!0),P().finally(()=>F(!1))},[]);let B=async e=>{var i;e&&(await (null==(i=navigator.clipboard)?void 0:i.writeText(e)),t.success("已复制路径"))},D=async(e,i)=>{try{"index"===i?(I((await (0,z.uc)(e)).assets),t.success("已加入知识库索引")):"openFile"===i?await (0,z.oS)(e,"file"):"openDirectory"===i?await (0,z.oS)(e,"directory"):"delete"===i&&(I((await (0,z.JU)(e)).assets),T(t=>{let i=new Set(t);return i.delete(e),i}))}catch(e){t.error(e instanceof Error?e.message:"操作失败")}},R=n=>{let l="selected"===n?[...N]:i.map(e=>e.id);0!==l.length&&s.A.confirm({title:"all"===n?"删除全部资源?":"删除已选 ".concat(l.length," 个资源?"),content:"此操作不可撤销。",okText:e("common.confirm"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{F(!0);try{await Promise.all(l.map(e=>(0,z.JU)(e))),await P(),T(new Set),t.success("已删除 ".concat(l.length," 个资源"))}catch(e){t.error("批量删除失败")}finally{F(!1)}}})},W=e=>{T(t=>{let i=new Set(t);return i.has(e)?i.delete(e):i.add(e),i})};return E?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(r.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,n.jsx)(o.A,{gutter:[12,12],children:Array.from({length:6}).map((e,t)=>(0,n.jsx)(c.A,{xs:24,sm:12,md:8,xl:6,children:(0,n.jsx)(d.A,{size:"small",children:(0,n.jsx)(r.A,{active:!0,paragraph:{rows:3}})})},t))})]}):(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:e("nav.assetLibrary")}),(0,n.jsx)("p",{className:"pageDesc",children:"管理文档生成产生的本地资源。生成完成后资源会自动回流知识库,后续文档可继续检索复用。"})]}),(0,n.jsxs)(p.A,{size:8,children:[(0,n.jsxs)("span",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["共 ",i.length," 个资源"]}),(0,n.jsxs)(x.Ay,{danger:!0,size:"small",disabled:0===N.size,icon:(0,n.jsx)(f.A,{}),onClick:()=>R("selected"),children:["删除已选 ",N.size||""]}),(0,n.jsx)(x.Ay,{danger:!0,size:"small",disabled:0===i.length,onClick:()=>R("all"),children:"删除全部"})]})]}),0===i.length?(0,n.jsx)(h.A,{description:"暂无生成资源"}):(0,n.jsx)(o.A,{gutter:[12,12],children:i.map((t,i)=>{let l="image"===t.type&&t.path?"/api/assets/generated/preview?id=".concat(encodeURIComponent(t.id)):void 0,a=N.has(t.id),s=[...t.path?[{key:"copy",icon:(0,n.jsx)(u.A,{}),label:"复制路径",onClick:()=>{B(t.path)}}]:[],...t.path?[{key:"open",icon:(0,n.jsx)(j.A,{}),label:"打开文件",onClick:()=>{D(t.id,"openFile")}}]:[],...t.path?[{key:"folder",icon:(0,n.jsx)(w.A,{}),label:"打开目录",onClick:()=>{D(t.id,"openDirectory")}}]:[],...!t.indexed&&t.path?[{key:"index",icon:(0,n.jsx)(v.A,{}),label:"加入知识库",onClick:()=>{D(t.id,"index")}}]:[],{type:"divider"},{key:"delete",icon:(0,n.jsx)(f.A,{}),label:e("common.delete"),danger:!0,onClick:()=>{D(t.id,"delete")}}];return(0,n.jsx)(c.A,{xs:24,sm:12,md:8,xl:6,children:(0,n.jsxs)(d.A,{size:"small",hoverable:!0,styles:{body:{padding:12}},style:{border:a?"2px solid #1677ff":void 0,cursor:"pointer",position:"relative"},onClick:()=>W(t.id),children:[(0,n.jsx)("div",{onClick:e=>{e.stopPropagation(),W(t.id)},style:{position:"absolute",top:8,left:8,zIndex:2,width:22,height:22,borderRadius:5,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.15s",background:a?"#1677ff":"rgba(0,0,0,0.6)",color:"#fff",fontSize:12,fontWeight:700},children:a?"✓":""}),(0,n.jsx)(g.A,{menu:{items:s},trigger:["click"],placement:"bottomRight",children:(0,n.jsx)(x.Ay,{type:"text",size:"small",icon:(0,n.jsx)(A.A,{}),style:{position:"absolute",top:6,right:6,zIndex:2,width:24,height:24,padding:0,background:"var(--colorBgContainer)",borderRadius:6,boxShadow:"0 1px 3px rgba(0,0,0,0.08)"},onClick:e=>e.stopPropagation()})}),l&&(0,n.jsx)("div",{style:{margin:"-12px -12px 10px -12px",borderRadius:"10px 10px 0 0",overflow:"hidden",height:140,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--colorFillAlter)"},children:(0,n.jsx)(y.A,{src:l,alt:t.name,style:{width:"100%",height:"100%",objectFit:"cover"},onClick:e=>e.stopPropagation()})}),(0,n.jsx)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,marginBottom:6},children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,flex:1},children:[!l&&("image"===t.type?(0,n.jsx)(b.A,{style:{color:"var(--colorWarning)",fontSize:15,flexShrink:0}}):(0,n.jsx)(k.A,{style:{color:"var(--colorAccent)",fontSize:15,flexShrink:0}})),(0,n.jsx)("span",{style:{fontWeight:600,fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name})]})}),(0,n.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:[(0,n.jsx)(m.A,{color:t.indexed?"success":"default",style:{margin:0,fontSize:10,lineHeight:"16px"},children:t.indexed?"已入库":"未入库"}),(0,n.jsx)(m.A,{color:_[t.role]||"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:t.role}),(0,n.jsx)(m.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:t.type})]}),(0,n.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",lineHeight:1.5,marginBottom:6},children:[t.path&&(0,n.jsx)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:11},children:t.path}),(0,n.jsxs)("div",{children:[C[t.source]||t.source," \xb7 ",t.usedByDocumentIds.length," 个文档 \xb7 ",new Date(t.updatedAt).toLocaleDateString()]})]})]})},t.id)})})]})}},85015:(e,t,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/asset-library",function(){return i(63806)}])}},e=>{e.O(0,[347,8787,4277,7889,7150,2073,6578,636,6593,8792],()=>e(e.s=85015)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6409],{19164:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/short-term",function(){return a(51162)}])},45551:(e,t,a)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),a=e/Math.pow(1024,t);return"".concat(a.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let a=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(a/60),n=Math.floor(o/24);return n>30?new Date(e).toLocaleDateString(t):"en-US"===t?n>0?"".concat(n,"d ago"):o>0?"".concat(o,"h ago"):a>0?"".concat(a,"m ago"):"Just now":n>0?"".concat(n," 天前"):o>0?"".concat(o," 小时前"):a>0?"".concat(a," 分钟前"):"刚刚"}a.d(t,{Jm:()=>s,fw:()=>n,z3:()=>o});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},c={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===a?c:r)[e])?t:e}},51162:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>N});var o=a(65321),n=a(97109),r=a(32620),c=a(17807),s=a(11702),i=a(85114),l=a(26171),d=a(33442),m=a(7576),h=a(68787),u=a(54849),x=a(21289),w=a(25258),f=a(63455),p=a(99650),g=a(58209),j=a(30486),A=a(83374),y=a(8383),v=a(26619),S=a(53998),C=a(6578),_=a(45551);let z={high:"red",medium:"orange",low:"default"};function N(){let e=(0,r.Vr)(),{message:t}=c.A.useApp(),[a,N]=(0,n.useState)(!0),[T,k]=(0,n.useState)([]),[D,M]=(0,n.useState)({count:0,totalBytes:0}),[b,B]=(0,n.useState)(""),[I,E]=(0,n.useState)(!1),[P,O]=(0,n.useState)(null),[L,U]=(0,n.useState)(""),[F,H]=(0,n.useState)(""),[J,K]=(0,n.useState)(!1),X=async a=>{N(!0);try{let[e,t]=await Promise.all([(0,C.hn)("short_term",a),(0,C.p)("short_term")]);k(e),M(t)}catch(a){t.error(e("common.error"))}finally{N(!1)}};(0,n.useEffect)(()=>{X()},[]);let G=async a=>{try{await (0,C.xw)(a),t.success(e("common.success")),await X(b)}catch(a){t.error(e("common.error"))}},V=async()=>{try{await (0,C.PH)("short_term"),t.success(e("common.success")),await X(b)}catch(a){t.error(e("common.error"))}},W=async()=>{try{await (0,C.E)("short_term"),t.success(e("common.success")),await X(b)}catch(a){t.error(e("common.error"))}},q=async()=>{if(P&&L.trim()){K(!0);try{await (0,C.zo)(P.id,{content:L.trim(),context:F||void 0}),t.success(e("common.success")),E(!1),await X(b)}catch(a){t.error(e("common.error"))}finally{K(!1)}}},Q=[{title:"序号",key:"index",width:70,render:(e,t,a)=>a+1},{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,o.jsx)(s.A,{color:z[e]||"default",children:"high"===e?"高":"medium"===e?"中":"低"})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.source"),dataIndex:"source",width:120,ellipsis:!0},{title:e("context.updatedAt"),dataIndex:"updated_at",width:140,render:e=>e?new Date(e).toLocaleString():"-"},{title:e("common.edit"),width:100,render:(t,a)=>(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,o.jsx)(i.Ay,{size:"small",type:"text",icon:(0,o.jsx)(p.A,{}),onClick:()=>{O(a),U(a.content),H(""),E(!0)}}),(0,o.jsx)(l.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{G(a.id)},children:(0,o.jsx)(i.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(g.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)(m.A,{prefix:(0,o.jsx)(j.A,{}),placeholder:e("common.search"),value:b,onChange:e=>B(e.target.value),onPressEnter:()=>{X(b)},allowClear:!0,style:{width:240}}),(0,o.jsx)(i.Ay,{icon:(0,o.jsx)(A.A,{}),onClick:()=>{V()},children:"压缩"}),(0,o.jsx)(l.A,{title:"确定清除短期上下文吗?",onConfirm:()=>{W()},children:(0,o.jsx)(i.Ay,{danger:!0,icon:(0,o.jsx)(y.A,{}),children:"清除"})})]})]}),(0,o.jsx)(h.A,{size:"small",children:(0,o.jsx)(u.A,{title:"总上下文大小",value:(0,_.z3)(D.totalBytes),prefix:(0,o.jsx)(v.A,{}),suffix:" / ".concat(D.count," 条")})}),(0,o.jsxs)(h.A,{size:"small",children:[(0,o.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(S.A,{})," ",e("context.shortTermSource")]}),(0,o.jsx)(x.A,{rowKey:"id",columns:Q,dataSource:T,loading:a,size:"small",pagination:{pageSize:15}})]}),(0,o.jsx)(w.A,{maskClosable:!1,title:e("models.editModel"),open:I,onCancel:()=>E(!1),onOk:()=>{q()},confirmLoading:J,okText:e("common.save"),cancelText:e("common.cancel"),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)(m.A.TextArea,{rows:6,value:L,onChange:e=>U(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(m.A,{value:F,onChange:e=>H(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,2884,9144,9189,6985,7150,3455,1289,8932,6578,636,6593,8792],()=>e(e.s=19164)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7580],{2256:(e,l,n)=>{"use strict";n.d(l,{A:()=>i});let i=n(25341).A},38770:(e,l,n)=>{"use strict";n.d(l,{A:()=>i});let i=n(51916).A},51533:(e,l,n)=>{"use strict";n.r(l),n.d(l,{default:()=>el});var i=n(65321),a=n(97109),t=n(11702),s=n(17807),r=n(63455),o=n(33442),c=n(57271),d=n(85114),m=n(85493),u=n(68787),h=n(58569),x=n(84253),p=n(38332),g=n(26171),j=n(34052),A=n(2256),b=n(7576),y=n(38770),v=n(83914),I=n(3638),f=n(32565),S=n(99452);function $(){return($=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var n=arguments[l];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}let k=a.forwardRef(({prefixCls:e="rc-switch",className:l,checked:n,defaultChecked:i,disabled:t,loadingIcon:s,checkedChildren:r,unCheckedChildren:o,onClick:c,onChange:d,onKeyDown:m,styles:u,classNames:h,...x},p)=>{let[g,j]=(0,f.A)(i??!1,n);function A(e,l){let n=g;return t||(j(n=e),d?.(n,l)),n}let b=(0,I.$)(e,l,{[`${e}-checked`]:g,[`${e}-disabled`]:t});return a.createElement("button",$({},x,{type:"button",role:"switch","aria-checked":g,disabled:t,className:b,ref:p,onKeyDown:function(e){e.which===S.A.LEFT?A(!1,e):e.which===S.A.RIGHT&&A(!0,e),m?.(e)},onClick:function(e){let l=A(!g,e);c?.(l,e)}}),s,a.createElement("span",{className:`${e}-inner`},a.createElement("span",{className:(0,I.$)(`${e}-inner-checked`,h?.content),style:u?.content},r),a.createElement("span",{className:(0,I.$)(`${e}-inner-unchecked`,h?.content),style:u?.content},o)))});k.displayName="Switch";var w=n(82813),z=n(92162),q=n(38862),C=n(74567),E=n(6831),T=n(27273),B=n(15561),R=n(47252),F=n(7961),_=n(16666),N=n(10540),H=n(28403);let D=(0,N.OF)("Switch",e=>{let l=(0,H.oX)(e,{switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchLoadingIconSize:e.calc(e.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[(e=>{let{componentCls:l,trackHeight:n,trackMinWidth:i}=e;return{[l]:{...(0,F.dF)(e),position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:i,height:n,lineHeight:(0,B.zA)(n),verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",...(0,_.V)(),[`&:hover:not(${l}-disabled)`]:{background:e.colorTextTertiary},...(0,F.K8)(e),[`&${l}-checked`]:{background:e.switchColor,[`&:hover:not(${l}-disabled)`]:{background:e.colorPrimaryHover}},[`&${l}-loading, &${l}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${l}-rtl`]:{direction:"rtl"}}}})(l),(e=>{let{componentCls:l,trackHeight:n,trackPadding:i,innerMinMargin:a,innerMaxMargin:t,handleSize:s,switchDuration:r,calc:o}=e,c=`${l}-inner`,d=(0,B.zA)(o(s).add(o(i).mul(2)).equal()),m=(0,B.zA)(o(t).mul(2).equal());return{[l]:{[c]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:t,paddingInlineEnd:a,transition:["padding-inline-start","padding-inline-end"].map(e=>`${e} ${r} ease-in-out`).join(", "),...(0,_.V)(),[`${c}-checked, ${c}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,pointerEvents:"none",minHeight:n,transition:["margin-inline-start","margin-inline-end"].map(e=>`${e} ${r} ease-in-out`).join(", "),...(0,_.V)()},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${m})`,marginInlineEnd:`calc(100% - ${d} + ${m})`},[`${c}-unchecked`]:{marginTop:o(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${l}-checked ${c}`]:{paddingInlineStart:a,paddingInlineEnd:t,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${m})`,marginInlineEnd:`calc(-100% + ${d} - ${m})`}},[`&:not(${l}-disabled):active`]:{[`&:not(${l}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:o(i).mul(2).equal(),marginInlineEnd:o(i).mul(-1).mul(2).equal()}},[`&${l}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:o(i).mul(-1).mul(2).equal(),marginInlineEnd:o(i).mul(2).equal()}}}}}})(l),(e=>{let{componentCls:l,trackPadding:n,handleBg:i,handleShadow:a,handleSize:t,calc:s}=e,r=`${l}-handle`;return{[l]:{[r]:{position:"absolute",top:n,insetInlineStart:n,width:t,height:t,transition:`all ${e.switchDuration} ease-in-out`,...(0,_.V)(),"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:i,borderRadius:s(t).div(2).equal(),boxShadow:a,transition:`all ${e.switchDuration} ease-in-out`,content:'""',...(0,_.V)()}},[`&${l}-checked ${r}`]:{insetInlineStart:`calc(100% - ${(0,B.zA)(s(t).add(n).equal())})`},[`&:not(${l}-disabled):active`]:{[`${r}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${l}-checked ${r}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}})(l),(e=>{let{componentCls:l,handleSize:n,calc:i}=e;return{[l]:{[`${l}-loading-icon${e.iconCls}`]:{position:"relative",top:i(i(n).sub(e.fontSize)).div(2).equal(),color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${l}-checked ${l}-loading-icon`]:{color:e.switchColor}}}})(l),(e=>{let{componentCls:l,trackHeightSM:n,trackPadding:i,trackMinWidthSM:a,innerMinMarginSM:t,innerMaxMarginSM:s,handleSizeSM:r,calc:o}=e,c=`${l}-inner`,d=(0,B.zA)(o(r).add(o(i).mul(2)).equal()),m=(0,B.zA)(o(s).mul(2).equal());return{[l]:{[`&${l}-small`]:{minWidth:a,height:n,lineHeight:(0,B.zA)(n),[`${l}-inner`]:{paddingInlineStart:s,paddingInlineEnd:t,[`${c}-checked, ${c}-unchecked`]:{minHeight:n},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${m})`,marginInlineEnd:`calc(100% - ${d} + ${m})`},[`${c}-unchecked`]:{marginTop:o(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${l}-handle`]:{width:r,height:r},[`${l}-loading-icon`]:{top:o(o(r).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${l}-checked`]:{[`${l}-inner`]:{paddingInlineStart:t,paddingInlineEnd:s,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${m})`,marginInlineEnd:`calc(-100% + ${d} - ${m})`}},[`${l}-handle`]:{insetInlineStart:`calc(100% - ${(0,B.zA)(o(r).add(i).equal())})`}},[`&:not(${l}-disabled):active`]:{[`&:not(${l}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:o(e.marginXXS).div(2).equal(),marginInlineEnd:o(e.marginXXS).mul(-1).div(2).equal()}},[`&${l}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:o(e.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:o(e.marginXXS).div(2).equal()}}}}}}})(l)]},e=>{let{fontSize:l,lineHeight:n,controlHeight:i,colorWhite:a}=e,t=l*n,s=i/2,r=t-4,o=s-4;return{trackHeight:t,trackHeightSM:s,trackMinWidth:2*r+8,trackMinWidthSM:2*o+4,trackPadding:2,handleBg:a,handleSize:r,handleSizeSM:o,handleShadow:`0 2px 4px 0 ${new R.Y("#00230b").setA(.2).toRgbString()}`,innerMinMargin:r/2,innerMaxMargin:r+2+4,innerMinMarginSM:o/2,innerMaxMarginSM:o+2+4}}),W=a.forwardRef((e,l)=>{let{prefixCls:n,size:i,disabled:t,loading:s,className:r,rootClassName:o,style:c,checked:d,value:m,defaultChecked:u,defaultValue:h,onChange:x,styles:p,classNames:g,...j}=e,[A,b]=(0,w.PW)(u??h??!1,d??m),{getPrefixCls:y,direction:f,className:S,style:$,classNames:B,styles:R}=(0,C.TP)("switch"),F=a.useContext(E.A),_=(t??F)||s,N=y("switch",n),[H,W]=D(N),M=(0,T.A)(i),V={...e,size:M,disabled:_},P=(0,z.XT)($),L=(0,z.XT)(c),[X,O]=(0,z.AV)([B,g],[R,P,p,L],{props:V}),G=a.createElement("div",{className:(0,I.$)(`${N}-handle`,X.indicator),style:O.indicator},s&&a.createElement(v.A,{className:`${N}-loading-icon`})),K=(0,I.$)(S,{[`${N}-small`]:"small"===M,[`${N}-loading`]:s,[`${N}-rtl`]:"rtl"===f},r,o,X.root,H,W);return a.createElement(q.A,{component:"Switch",disabled:_},a.createElement(k,{...j,classNames:X,styles:O,checked:A,onChange:(...e)=>{b(e[0]),x?.(...e)},prefixCls:N,className:K,style:O.root,disabled:_,ref:l,loadingIcon:G}))});W.__ANT_SWITCH=!0;var M=n(48318),V=n(25258),P=n(54746),L=n(96651),X=n(60470),O=n(99650),G=n(58209),K=n(6578),Q=n(32620);let Y=[{label:"文本",value:"text"},{label:"数字",value:"number"},{label:"日期",value:"date"},{label:"表格",value:"table"},{label:"列表",value:"list"}],J=[{label:"错误(阻断)",value:"error"},{label:"警告(提醒)",value:"warning"},{label:"信息(提示)",value:"info"}],U=[{label:"全文",value:"document"},{label:"章节",value:"chapter"},{label:"事实字段",value:"fact"},{label:"文件角色",value:"file_role"},{label:"提示词角色",value:"prompt_role"},{label:"表格",value:"table"},{label:"图片",value:"image"},{label:"来源",value:"source"}],Z=[{label:"必须存在",value:"exists"},{label:"必须包含",value:"contains"},{label:"禁止包含",value:"not_contains"},{label:"正则必须匹配",value:"regex_match"},{label:"正则禁止匹配",value:"regex_not_match"},{label:"数量至少为 N",value:"min_count"},{label:"字数至少为 N",value:"min_length"},{label:"全部必须有来源",value:"all_have_source"},{label:"图片必须有说明",value:"image_caption_required"},{label:"表格必须有说明",value:"table_explanation_required"}],ee=e=>{let{label:l,closable:n,onClose:a}=e;return(0,i.jsx)(t.A,{closable:n,onClose:a,color:"blue",style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:l})};function el(){var e,l,n,v;let I=(0,Q.Vr)(),{message:f}=s.A.useApp(),[S]=r.A.useForm(),[$]=r.A.useForm(),[k,w]=(0,a.useState)([]),[z,q]=(0,a.useState)([]),[C,E]=(0,a.useState)([]),[T,B]=(0,a.useState)(!1),[R,F]=(0,a.useState)(!1),[_,N]=(0,a.useState)(null),[H,D]=(0,a.useState)(!1),[el,en]=(0,a.useState)("custom"),[ei,ea]=(0,a.useState)("specs"),et=async()=>{let[e,l]=await Promise.all([(0,K.mx)(),(0,K.lv)()]);w(e.specs),q(e.gateTypes),E(l.roles)};(0,a.useEffect)(()=>{et().catch(()=>f.error(I("common.error")))},[f,I]);let es=C.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),er=C.filter(e=>"prompt"===e.type).map(e=>({label:e.name,value:e.id})),eo=k.filter(e=>!e.builtIn),ec=k.filter(e=>e.builtIn),ed="all"===el?k:"builtIn"===el?ec:eo,em=z.filter(e=>!e.builtIn),eu=z.filter(e=>e.builtIn),eh="all"===el?z:"builtIn"===el?eu:em,ex=[{label:"系统门禁类型",options:z.filter(e=>e.builtIn).map(e=>({label:e.name,value:e.id}))},{label:"我的门禁类型",options:z.filter(e=>!e.builtIn).map(e=>({label:e.name,value:e.id}))}],[ep,eg]=(0,a.useState)(0),[ej,eA]=(0,a.useState)(0),[eb,ey]=(0,a.useState)(0),ev=()=>{var e,l,n;eg((null!=(e=S.getFieldValue("factFields"))?e:[]).length),eA((null!=(l=S.getFieldValue("chapterRules"))?l:[]).length),ey((null!=(n=S.getFieldValue("gateRules"))?n:[]).length)},eI=(null!=(v=r.A.useWatch("factFields",S))?v:[]).filter(e=>e.id&&e.name).map(e=>({label:"".concat(e.name,"(").concat(e.id,")"),value:e.id})),ef=e=>{let l=(null==e?void 0:e.builtIn)?{...e,id:"".concat(e.id,"-copy-").concat(Date.now()),name:"".concat(e.name," Copy"),builtIn:!1}:e;(null==e?void 0:e.builtIn)&&f.info("内置规范包不可直接编辑,已为你创建副本"),S.setFieldsValue(null!=l?l:{id:"spec-".concat(Date.now()),name:"",description:"",factFields:[{id:"document-goal",name:"文档目标",type:"text",required:!0},{id:"target-audience",name:"目标读者",type:"text",required:!1},{id:"key-conclusion",name:"关键结论",type:"list",required:!0}],chapterRules:[],gateRules:[]}),B(!0),window.setTimeout(()=>ev(),50)},eS=async()=>{try{let e=await S.validateFields(),l=await (0,K.EK)(e);w(l.specs),q(l.gateTypes),B(!1),f.success(I("common.success"))}catch(e){e instanceof Error&&f.error(e.message)}},e$=async e=>{let l=await (0,K.ER)(e);w(l.specs),q(l.gateTypes)},ek=e=>{var l;if(null==e?void 0:e.builtIn){$.setFieldsValue(e),N(e.id),F(!0);return}N(null!=(l=null==e?void 0:e.id)?l:null),$.setFieldsValue(null!=e?e:{id:"gate-type-".concat(Date.now()),name:"",defaultLevel:"error",evaluator:{subject:"document",operator:"contains"}}),F(!0)},ew=async()=>{try{var e;let l=await $.validateFields();if(null==(e=z.find(e=>e.id===l.id))?void 0:e.builtIn)return;let n=await (0,K.uD)(l);q(n.gateTypes),F(!1),N(null),$.resetFields(),f.success(I("common.success"))}catch(e){e instanceof Error&&f.error(e.message)}},ez=async e=>{q((await (0,K.ug)(e)).gateTypes)};return(0,i.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"pageTitle",children:I("specs.title")}),(0,i.jsx)("p",{className:"pageDesc",children:I("specs.description")})]}),(0,i.jsxs)(o.A,{wrap:!0,children:[(0,i.jsx)(c.A,{value:el,onChange:en,style:{width:160},options:[{label:"我的 (".concat(eo.length+em.length,")"),value:"custom"},{label:"内置示例 (".concat(ec.length+eu.length,")"),value:"builtIn"},{label:"全部来源 (".concat(k.length+z.length,")"),value:"all"}]}),"gateTypes"===ei&&(0,i.jsx)(d.Ay,{onClick:()=>ek(),children:"新建门禁类型"}),"specs"===ei&&(0,i.jsx)(d.Ay,{type:"primary",icon:(0,i.jsx)(P.A,{}),onClick:()=>ef(),children:I("specs.newSpec")})]})]}),(0,i.jsx)(m.A,{type:"info",showIcon:!0,message:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)("span",{children:I("specs.plainGuideTitle")}),(0,i.jsx)(d.Ay,{type:"link",size:"small",icon:H?(0,i.jsx)(L.A,{}):(0,i.jsx)(X.A,{}),onClick:()=>D(!H),style:{padding:"0 4px"},children:H?"收起说明":"展开说明"})]}),description:H?I("specs.plainGuideDesc"):void 0}),(0,i.jsx)(u.A,{size:"small",children:(0,i.jsx)(h.A,{activeKey:ei,onChange:e=>ea(e),items:[{key:"specs",label:"规范包列表 (".concat(ed.length,")"),children:0===ed.length?(0,i.jsx)(x.A,{description:I("common.noData")}):(0,i.jsx)(p.A,{dataSource:ed,renderItem:(e,l)=>(0,i.jsx)(p.A.Item,{style:{padding:"10px 0"},actions:[(0,i.jsx)(d.Ay,{size:"small",icon:(0,i.jsx)(O.A,{}),onClick:()=>ef(e),children:e.builtIn?"复制":"编辑"},"edit"),(0,i.jsx)(g.A,{title:I("common.confirm"),disabled:e.builtIn,onConfirm:()=>{e$(e.id)},children:(0,i.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(G.A,{}),disabled:e.builtIn})},"del")],children:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[(0,i.jsx)("div",{style:{width:28,height:28,borderRadius:8,background:"var(--colorFillSecondary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:700,color:"var(--colorTextSecondary)",flexShrink:0},children:l+1}),(0,i.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,i.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),e.builtIn?(0,i.jsx)(t.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"内置示例"}):(0,i.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px",flexShrink:0},children:"我的规范包"})]}),(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.description&&(0,i.jsx)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:e.description}),(0,i.jsxs)(o.A,{size:4,children:[(0,i.jsxs)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:["事实 ",e.factFields.length]}),(0,i.jsxs)(t.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:["章节 ",e.chapterRules.length]}),(0,i.jsxs)(t.A,{color:"orange",style:{margin:0,fontSize:10,lineHeight:"16px"},children:["门禁 ",e.gateRules.length]})]})]})]})]})})})},{key:"gateTypes",label:"门禁类型列表 (".concat(eh.length,")"),children:0===eh.length?(0,i.jsx)(x.A,{description:I("common.noData")}):(0,i.jsx)(p.A,{dataSource:eh,renderItem:(e,l)=>{var n,a;return(0,i.jsx)(p.A.Item,{style:{padding:"10px 0"},actions:[(0,i.jsx)(d.Ay,{size:"small",icon:(0,i.jsx)(O.A,{}),onClick:()=>ek(e),children:e.builtIn?"查看":"编辑"},"edit"),(0,i.jsx)(g.A,{title:I("common.confirm"),disabled:e.builtIn,onConfirm:()=>{ez(e.id)},children:(0,i.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,i.jsx)(G.A,{}),disabled:e.builtIn})},"del")],children:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,minWidth:0,flex:1},children:[(0,i.jsx)("div",{style:{width:28,height:28,borderRadius:8,background:"var(--colorFillSecondary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:700,color:"var(--colorTextSecondary)",flexShrink:0},children:l+1}),(0,i.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,i.jsx)("span",{style:{fontWeight:600},children:e.name}),e.builtIn?(0,i.jsx)(t.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"系统门禁"}):(0,i.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的门禁"})]}),(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.description&&(0,i.jsx)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:e.description}),(0,i.jsxs)(o.A,{size:4,children:[(0,i.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:null==(n=U.find(l=>l.value===e.evaluator.subject))?void 0:n.label}),(0,i.jsx)(t.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:null==(a=Z.find(l=>l.value===e.evaluator.operator))?void 0:a.label})]})]})]})]})})}})}]})}),(0,i.jsx)(j.A,{title:I("specs.editor"),open:T,onClose:()=>B(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,i.jsx)(d.Ay,{type:"primary",onClick:()=>{eS()},children:I("common.save")}),children:(0,i.jsxs)(r.A,{form:S,layout:"vertical",onValuesChange:()=>ev(),children:[(0,i.jsxs)(A.A,{gutter:12,children:[(0,i.jsx)(r.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(b.A,{})}),(0,i.jsx)(y.A,{xs:24,md:12,children:(0,i.jsx)(r.A.Item,{name:"name",label:I("specs.name"),rules:[{required:!0}],children:(0,i.jsx)(b.A,{})})}),(0,i.jsx)(y.A,{xs:24,md:12,children:(0,i.jsx)(r.A.Item,{name:"description",label:I("specs.specDescription"),children:(0,i.jsx)(b.A,{})})})]}),(0,i.jsx)(h.A,{destroyInactiveTabPane:!1,items:[{key:"facts",label:"".concat(I("specs.facts")," (").concat(ep,")"),children:(0,i.jsx)(r.A.List,{name:"factFields",children:(e,l)=>{let{add:n,remove:a}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.map((e,l)=>(0,i.jsxs)(u.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsx)(d.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(G.A,{}),onClick:()=>a(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsx)(r.A.Item,{name:[e.name,"id"],hidden:!0,children:(0,i.jsx)(b.A,{})}),(0,i.jsxs)(A.A,{gutter:[14,8],children:[(0,i.jsx)(y.A,{xs:24,sm:7,children:(0,i.jsx)(r.A.Item,{name:[e.name,"name"],label:I("specs.factName"),rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(b.A,{size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:5,children:(0,i.jsx)(r.A.Item,{name:[e.name,"type"],label:I("specs.factType"),style:{marginBottom:0},children:(0,i.jsx)(c.A,{options:Y,size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:4,children:(0,i.jsx)(r.A.Item,{name:[e.name,"required"],label:I("specs.required"),valuePropName:"checked",style:{marginBottom:0},children:(0,i.jsx)(W,{})})}),(0,i.jsx)(y.A,{xs:24,sm:8,children:(0,i.jsx)(r.A.Item,{name:[e.name,"sourceRoleIds"],label:I("specs.sourceRoles"),style:{marginBottom:0},children:(0,i.jsx)(c.A,{mode:"multiple",showSearch:!0,options:es,tagRender:ee,placeholder:"选择文件角色",size:"small"})})}),(0,i.jsx)(y.A,{xs:24,sm:12,children:(0,i.jsx)(r.A.Item,{name:[e.name,"extractionHint"],label:I("specs.extractionHint"),style:{marginBottom:0},children:(0,i.jsx)(b.A,{size:"small"})})}),(0,i.jsx)(y.A,{xs:24,sm:12,children:(0,i.jsx)(r.A.Item,{name:[e.name,"validationHint"],label:I("specs.validationHint"),style:{marginBottom:0},children:(0,i.jsx)(b.A,{size:"small"})})})]})]},e.key)),(0,i.jsx)(d.Ay,{icon:(0,i.jsx)(P.A,{}),onClick:()=>n({id:"fact-".concat(Date.now()),type:"text",required:!0}),children:I("specs.addFact")})]})}})},{key:"chapters",label:"".concat(I("specs.chapters")," (").concat(ej,")"),children:(0,i.jsx)(r.A.List,{name:"chapterRules",children:(e,l)=>{let{add:n,remove:a}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.map((e,l)=>(0,i.jsxs)(u.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsx)(d.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(G.A,{}),onClick:()=>a(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsx)(r.A.Item,{name:[e.name,"id"],hidden:!0,children:(0,i.jsx)(b.A,{})}),(0,i.jsxs)(A.A,{gutter:[14,8],children:[(0,i.jsx)(y.A,{xs:24,sm:7,children:(0,i.jsx)(r.A.Item,{name:[e.name,"title"],label:I("specs.chapterTitle"),rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(b.A,{size:"small"})})}),(0,i.jsx)(y.A,{xs:8,sm:3,children:(0,i.jsx)(r.A.Item,{name:[e.name,"order"],label:I("specs.order"),initialValue:l,style:{marginBottom:0},children:(0,i.jsx)(M.A,{size:"small",style:{width:"100%"}})})}),(0,i.jsx)(y.A,{xs:8,sm:3,children:(0,i.jsx)(r.A.Item,{name:[e.name,"minWords"],label:I("specs.minWords"),style:{marginBottom:0},children:(0,i.jsx)(M.A,{size:"small",style:{width:"100%"}})})}),(0,i.jsx)(y.A,{xs:8,sm:3,children:(0,i.jsx)(r.A.Item,{name:[e.name,"required"],label:I("specs.required"),valuePropName:"checked",style:{marginBottom:0},children:(0,i.jsx)(W,{})})}),(0,i.jsx)(y.A,{xs:24,sm:8,children:(0,i.jsx)(r.A.Item,{name:[e.name,"requiredFactIds"],label:I("specs.requiredFacts"),style:{marginBottom:0},children:(0,i.jsx)(c.A,{mode:"multiple",showSearch:!0,optionFilterProp:"label",placeholder:"选择事实字段",options:eI,tagRender:ee,size:"small"})})}),(0,i.jsx)(y.A,{xs:24,sm:12,children:(0,i.jsx)(r.A.Item,{name:[e.name,"requiredFileRoleIds"],label:I("specs.requiredFileRoles"),style:{marginBottom:0},children:(0,i.jsx)(c.A,{mode:"multiple",showSearch:!0,options:es,tagRender:ee,placeholder:"选择文件角色",size:"small"})})}),(0,i.jsx)(y.A,{xs:24,sm:12,children:(0,i.jsx)(r.A.Item,{name:[e.name,"requiredPromptRoleIds"],label:I("specs.requiredPromptRoles"),style:{marginBottom:0},children:(0,i.jsx)(c.A,{mode:"multiple",showSearch:!0,options:er,tagRender:ee,placeholder:"选择提示词角色",size:"small"})})}),(0,i.jsx)(y.A,{xs:24,children:(0,i.jsx)(r.A.Item,{name:[e.name,"generationHint"],label:I("specs.generationHint"),style:{marginBottom:0},children:(0,i.jsx)(b.A,{size:"small"})})})]})]},e.key)),(0,i.jsx)(d.Ay,{icon:(0,i.jsx)(P.A,{}),onClick:()=>n({id:"chapter-".concat(Date.now()),order:e.length,required:!0}),children:I("specs.addChapter")})]})}})},{key:"gates",label:"".concat(I("specs.gates")," (").concat(eb,")"),children:(0,i.jsx)(r.A.List,{name:"gateRules",children:(e,l)=>{let{add:n,remove:a}=l;return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.map((e,l)=>(0,i.jsxs)(u.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,i.jsx)(d.Ay,{danger:!0,size:"small",icon:(0,i.jsx)(G.A,{}),onClick:()=>a(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,i.jsx)(r.A.Item,{name:[e.name,"id"],hidden:!0,children:(0,i.jsx)(b.A,{})}),(0,i.jsxs)(A.A,{gutter:[12,8],align:"middle",children:[(0,i.jsx)(y.A,{xs:24,sm:6,children:(0,i.jsx)(r.A.Item,{name:[e.name,"name"],label:"名称",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(b.A,{placeholder:I("specs.gateName"),size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:6,children:(0,i.jsx)(r.A.Item,{name:[e.name,"type"],label:"类型",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(c.A,{options:ex,size:"small",onChange:e=>((e,l)=>{var n,i,a,t,s;let r=z.find(e=>e.id===l);if(!r)return;let o=[...null!=(s=S.getFieldValue("gateRules"))?s:[]];o[e]={...o[e],type:r.id,level:(null==(n=o[e])?void 0:n.level)||r.defaultLevel,name:(null==(i=o[e])?void 0:i.name)||r.name,evaluator:{...r.evaluator},target:(null==(a=o[e])?void 0:a.target)||r.evaluator.target||"",value:(null==(t=o[e])?void 0:t.value)||r.evaluator.value||""},S.setFieldValue("gateRules",o)})(l,e)})})}),(0,i.jsx)(y.A,{xs:12,sm:3,children:(0,i.jsx)(r.A.Item,{name:[e.name,"level"],label:"级别",style:{marginBottom:0},children:(0,i.jsx)(c.A,{options:J,size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:4,children:(0,i.jsx)(r.A.Item,{name:[e.name,"target"],label:"目标",style:{marginBottom:0},children:(0,i.jsx)(b.A,{placeholder:"章节/事实/角色",size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:5,children:(0,i.jsx)(r.A.Item,{name:[e.name,"value"],label:"值",style:{marginBottom:0},children:(0,i.jsx)(b.A,{placeholder:"关键词/正则/数值",size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:5,children:(0,i.jsx)(r.A.Item,{name:[e.name,"evaluator","subject"],label:"校验对象",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(c.A,{options:U,size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:6,children:(0,i.jsx)(r.A.Item,{name:[e.name,"evaluator","operator"],label:"校验方式",rules:[{required:!0}],style:{marginBottom:0},children:(0,i.jsx)(c.A,{options:Z,size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:5,children:(0,i.jsx)(r.A.Item,{name:[e.name,"evaluator","target"],label:"执行目标",style:{marginBottom:0},children:(0,i.jsx)(b.A,{placeholder:"默认取目标",size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:5,children:(0,i.jsx)(r.A.Item,{name:[e.name,"evaluator","value"],label:"执行值",style:{marginBottom:0},children:(0,i.jsx)(b.A,{placeholder:"默认取值",size:"small"})})}),(0,i.jsx)(y.A,{xs:12,sm:3,children:(0,i.jsx)(r.A.Item,{name:[e.name,"evaluator","min"],label:"N",style:{marginBottom:0},children:(0,i.jsx)(M.A,{min:1,size:"small",style:{width:"100%"}})})})]})]},e.key)),(0,i.jsx)(d.Ay,{icon:(0,i.jsx)(P.A,{}),onClick:()=>n({id:"gate-".concat(Date.now()),type:"required_fact",level:"error",evaluator:{subject:"fact",operator:"exists"}}),children:I("specs.addGate")})]})}})}]})]})}),(0,i.jsx)(V.A,{title:(null==(e=z.find(e=>e.id===_))?void 0:e.builtIn)?"查看系统门禁类型":_?"编辑门禁类型":"新建门禁类型",open:R,onOk:()=>{ew()},onCancel:()=>{F(!1),N(null)},okText:I("common.save"),cancelText:I("common.cancel"),okButtonProps:{disabled:!!(null==(l=z.find(e=>e.id===_))?void 0:l.builtIn)},children:(0,i.jsx)(r.A,{form:$,layout:"vertical",disabled:!!(null==(n=z.find(e=>e.id===_))?void 0:n.builtIn),children:(0,i.jsxs)(A.A,{gutter:12,children:[(0,i.jsx)(r.A.Item,{name:"id",hidden:!0,children:(0,i.jsx)(b.A,{})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:"name",label:"类型名称",rules:[{required:!0}],children:(0,i.jsx)(b.A,{placeholder:"必须包含风险提示"})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:"description",label:"说明",children:(0,i.jsx)(b.A,{placeholder:"告诉用户这类门禁检查什么"})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:"defaultLevel",label:"默认级别",rules:[{required:!0}],children:(0,i.jsx)(c.A,{options:J})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:["evaluator","subject"],label:"校验对象",rules:[{required:!0}],children:(0,i.jsx)(c.A,{options:U})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:["evaluator","operator"],label:"校验方式",rules:[{required:!0}],children:(0,i.jsx)(c.A,{options:Z})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:["evaluator","target"],label:"默认目标",children:(0,i.jsx)(b.A,{placeholder:"章节/事实/角色,可为空"})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:["evaluator","value"],label:"默认值",children:(0,i.jsx)(b.A,{placeholder:"关键词/正则,可为空"})})}),(0,i.jsx)(y.A,{span:12,children:(0,i.jsx)(r.A.Item,{name:["evaluator","min"],label:"默认 N",children:(0,i.jsx)(M.A,{min:1,style:{width:"100%"}})})})]})})})]})}},94773:(e,l,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-specs",function(){return n(51533)}])}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,2884,9144,9189,3455,4052,5938,3057,6578,636,6593,8792],()=>e(e.s=94773)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3332],{15766:(e,u,_)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return _(76933)}])},76933:(e,u,_)=>{"use strict";_.r(u),_.d(u,{default:()=>t});var n=_(97109),r=_(86109);function t(){let e=(0,r.useRouter)();return(0,n.useEffect)(()=>{e.replace("/overview")},[e]),null}}},e=>{e.O(0,[636,6593,8792],()=>e(e.s=15766)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3309],{14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},37690:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return l(48200)}])},45551:(e,t,l)=>{"use strict";function n(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),l=e/Math.pow(1024,t);return"".concat(l.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 l=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(l/60),a=Math.floor(n/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):n>0?"".concat(n,"h ago"):l>0?"".concat(l,"m ago"):"Just now":a>0?"".concat(a," 天前"):n>0?"".concat(n," 小时前"):l>0?"".concat(l," 分钟前"):"刚刚"}l.d(t,{Jm:()=>s,fw:()=>a,z3:()=>n});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},i={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function s(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===l?i:r)[e])?t:e}},48200:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>L});var n=l(65321),a=l(97109),r=l(1873),i=l.n(r),s=l(86109),o=l(35292),c=l(76506),d=l(33442),u=l(11702),h=l(9137),m=l(21289),p=l(68787),g=l(56985),x=l(49604),y=l(88762),_=l(85493),f=l(84253),w=l(85114),j=l(58569),A=l(7576),k=l(47210),v=l(6578),C=l(32620),S=l(45551),b=l(14569),I=l.n(b);let{Paragraph:P}=o.A;function N(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}function R(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).slice(0,30):[]}function z(e,t){let l=t.trim()?[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length):[];if(0===l.length)return e;let a=RegExp("(".concat(l.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(a).map((e,t)=>l.some(t=>t.toLowerCase()===e.toLowerCase())?(0,n.jsx)("mark",{children:e},t):e)}function M(e,t,l){return null==t||""===t||Array.isArray(t)&&0===t.length?null:(0,n.jsx)(c.A.Item,{label:e,children:Array.isArray(t)?(0,n.jsx)(d.A,{wrap:!0,children:t.map(e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>null==l?void 0:l(String(e)),children:String(e)},String(e)))}):String(t)})}function O(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return e.map((e,l)=>({key:"".concat(t,"-").concat(l),name:e}))}function L(){var e,t,l,r,o;let b=(0,C.Vr)(),L=(0,s.useRouter)(),T="string"==typeof L.query.relativePath?L.query.relativePath:"",[D,E]=(0,a.useState)(),[F,B]=(0,a.useState)(!1),[J,K]=(0,a.useState)(""),[V,H]=(0,a.useState)(!1),[U,W]=(0,a.useState)(""),[X,G]=(0,a.useState)([]);(0,a.useEffect)(()=>{T&&(B(!0),K(""),(0,v.xC)(T).then(E).catch(e=>{E(void 0),K(e instanceof Error?e.message:"文件详情加载失败")}).finally(()=>B(!1)))},[T]);let $=(0,a.useMemo)(()=>(function(e){let t=N(null==e?void 0:e.file.metadataJson);return"object"==typeof t.extraction&&t.extraction?t.extraction:t})(D),[D]),q=R($.layerNames);(0,a.useEffect)(()=>{G(q)},[null==D?void 0:D.file.relativePath,q.join("|")]);let Z=U.trim().toLowerCase(),Q=(0,a.useMemo)(()=>{var e;return D&&Z?D.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==D?void 0:D.chunks)?e:[]},[D,Z]),Y=(0,a.useMemo)(()=>{var e;return D&&Z?D.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(Z))):null!=(e=null==D?void 0:D.parents)?e:[]},[D,Z]),ee=async()=>{if(T){H(!0);try{let e=await (0,v.HC)(T);e.detail&&E(e.detail),h.Ay.success("文件索引已重建")}finally{H(!1)}}},et=async e=>{e&&(await navigator.clipboard.writeText(e),h.Ay.success("已复制"))},el=async e=>{T&&(await (0,v.tn)(T,e),h.Ay.success("file"===e?"已请求打开文件":"已请求打开目录"))},en=(0,a.useMemo)(()=>{var e,t,l,a,r;let s=[],o=R($.sheetNames),h=R($.columnNames),y=R($.layerNames),_=R($.blockNames),f=R($.entityTypes),w=R($.productNames),j=R($.materialNames),A=R($.entityNames),k=R($.dataPaths),v=o.length>0||h.length>0||null!=$.rowCount||null!=$.columnCount||null!=$.formulaCount||null!=$.mergeCount,C=O(h,"column"),S=(null!=(e=null==D?void 0:D.chunks)?e:[]).map(e=>N(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,t)=>({key:"row-".concat(t),name:e})),b=(null!=(t=null==D?void 0:D.chunks)?t:[]).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)}));(v||C.length>0||S.length>0||b.length>0)&&s.push({key:"table",label:"表格",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[v&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[M("Sheet",o,W),M("表头",h,W),M("行数",$.rowCount),M("列数",$.columnCount),M("公式数",$.formulaCount),M("合并单元格",$.mergeCount)]}),C.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:C,columns:[{title:"列名",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})}]}),S.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:S,columns:[{title:"行范围",dataIndex:"name",render:e=>(0,n.jsxs)(u.A,{color:"gold",className:"cursor-pointer",onClick:()=>W(String(e)),children:["行 ",String(e)]})}]}),b.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:b,pagination:{pageSize:10},columns:[{title:"表格网格预览",dataIndex:"cells",render:e=>(0,n.jsx)(d.A,{wrap:!0,children:e.map((e,t)=>(0,n.jsx)(u.A,{children:e},"".concat(e,"-").concat(t)))})}]})]})});let z=y.length>0||_.length>0||f.length>0||w.length>0||j.length>0||A.length>0,L=[...O(y,"layer").map(e=>({...e,type:"图层"})),...O(f,"entity").map(e=>({...e,type:"实体类型"})),...O(_,"block").map(e=>({...e,type:"块/符号"}))];(z||y.length>0||L.length>0)&&s.push({key:"drawing",label:"图纸",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[z&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[M("图层",y,W),M("块/符号",_,W),M("实体类型",f,W),M("产品/零件",w,W),M("材料",j,W),M("实体名称",A,W)]}),y.length>0&&(0,n.jsxs)(p.A,{size:"small",title:"图层开关 / 图纸预览",children:[(0,n.jsx)(g.A.Group,{value:X,options:y.map(e=>({label:e,value:e})),onChange:e=>G(e.map(String))}),(0,n.jsx)("div",{className:I().drawingPreview,children:X.map(e=>(0,n.jsx)(u.A,{color:"blue",children:e},e))})]}),L.length>0&&(0,n.jsx)(m.A,{size:"small",pagination:!1,rowKey:"key",dataSource:L,columns:[{title:"类型",dataIndex:"type",width:120},{title:"名称",dataIndex:"name",render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})}]})]})});let T=(null!=(l=null==D?void 0:D.chunks)?l:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>/^[\w.[\]-]+\s*[:=]/u.test(e)).slice(0,200).map((e,t)=>{var l,n,a,r;let i=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(t),path:null!=(a=null==i||null==(l=i[1])?void 0:l.trim())?a:e,value:null!=(r=null==i||null==(n=i[2])?void 0:n.trim())?r:""}});(k.length>0||T.length>0)&&s.push({key:"data",label:"数据路径",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[k.length>0&&(0,n.jsx)(x.A,{defaultExpandAll:!0,treeData:function(e){let t=new Map;for(let l of e){let e=t;for(let t of l.replace(/\[(\d+)\]/gu,".$1").split(".").filter(Boolean))e.has(t)||e.set(t,new Map),e=e.get(t)}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return[...e.entries()].map(e=>{let[n,a]=e;return{title:n,key:t?"".concat(t,".").concat(n):n,children:l(a,t?"".concat(t,".").concat(n):n)}})};return l(t)}(k),onSelect:e=>{var t;return W(String(null!=(t=e[0])?t:""))}}),T.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:T,pagination:{pageSize:20},columns:[{title:"Path",dataIndex:"path",width:260,render:e=>(0,n.jsx)(u.A,{className:"cursor-pointer",onClick:()=>W(String(e)),children:String(e)})},{title:"Value",dataIndex:"value",render:e=>(0,n.jsx)("span",{className:"break-all",children:String(e)})}]})]})});let E=null!=$.ocrRecommended||null!=$.ocrReason||null!=$.ocrProvider||null!=$.ocrLanguages||null!=$.ocrTextLength||null!=$.pdfPageOcrSupported||null!=$.ocrPageCount||null!=$.pdfOcrPageLimit||null!=$.pdfRenderer,F=(null!=(a=null==D?void 0:D.chunks)?a:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,t,l,n)=>{var a,r,i;return l%2==0&&e.push({key:"page-".concat(t),page:t,text:null!=(i=null==(r=n[l+1])||null==(a=r.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:a.trim())?i:""}),e},[]),B=(null==D?void 0:D.file.format)==="pdf";return(E||B||F.length>0)&&s.push({key:"ocr",label:"OCR/PDF",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[E&&(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[M("OCR 建议",$.ocrRecommended),M("OCR 原因",$.ocrReason),M("OCR 引擎",$.ocrProvider),M("OCR 语言",$.ocrLanguages),M("OCR 文本长度",$.ocrTextLength),M("PDF 页面 OCR 支持",$.pdfPageOcrSupported),M("PDF OCR 页数",$.ocrPageCount),M("PDF OCR 页数上限",$.pdfOcrPageLimit),M("PDF 渲染器",$.pdfRenderer)]}),B&&(0,n.jsx)("div",{className:I().pdfPreviewStrip,children:Array.from({length:Math.min(Number(null!=(r=$.ocrPageCount)?r:1)||1,6)},(e,t)=>(0,n.jsx)(i(),{width:220,height:320,src:"/api/kb/files/preview-pdf-page?relativePath=".concat(encodeURIComponent(D.file.relativePath),"&page=").concat(t+1),alt:"PDF 第 ".concat(t+1," 页"),unoptimized:!0},t))}),F.length>0&&(0,n.jsx)(m.A,{size:"small",rowKey:"key",dataSource:F,pagination:{pageSize:10},columns:[{title:"页码",dataIndex:"page",width:90},{title:"OCR 文本",dataIndex:"text",render:e=>(0,n.jsx)(P,{ellipsis:{rows:4,expandable:!0,symbol:"展开"},children:String(e)})}]})]})}),s},[$,D,X]),ea=[{title:"序号",key:"index",width:70,render:(e,t,l)=>l+1},{title:b("knowledge.chunkIndex"),dataIndex:"chunkIndex",width:90,render:e=>String(e)},{title:b("knowledge.chunkType"),width:110,render:(e,t)=>{var l;return(0,n.jsx)(u.A,{children:String(null!=(l=N(t.metadataJson).chunkKind)?l:t.category)})}},{title:b("knowledge.sectionOrRange"),width:220,render:(e,t)=>{let l=N(t.metadataJson),a="string"==typeof l.rowRange?l.rowRange:void 0;return(0,n.jsxs)(d.A,{wrap:!0,children:[t.sectionTitle?(0,n.jsx)(u.A,{color:"cyan",children:t.sectionTitle}):null,a?(0,n.jsxs)(u.A,{color:"gold",children:["行 ",a]}):null]})}},{title:"Token",dataIndex:"tokenCount",width:90},{title:b("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(P,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:I().searchContent,children:z(t.content,U)})}],er=[{title:"序号",key:"index",width:70,render:(e,t,l)=>l+1},{title:b("knowledge.parentChunkId"),dataIndex:"parentId",width:260,render:e=>(0,n.jsx)("span",{className:"break-all",children:e})},{title:"切片数",dataIndex:"chunkCount",width:90},{title:"章节",dataIndex:"sectionTitle",width:220},{title:b("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(P,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:I().searchContent,children:z(t.content,U)})}];return F?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(y.A,{active:!0,paragraph:{rows:1}}),(0,n.jsx)(p.A,{size:"small",children:(0,n.jsx)(y.A,{active:!0,paragraph:{rows:6}})}),(0,n.jsx)(p.A,{size:"small",children:(0,n.jsx)(y.A,{active:!0,paragraph:{rows:4}})})]}):J?(0,n.jsx)(_.A,{type:"error",showIcon:!0,message:"文件详情加载失败",description:J}):D?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(w.Ay,{icon:(0,n.jsx)(k.A,{}),href:"/knowledge/files",size:"small",style:{marginBottom:12},children:"返回文件列表"}),(0,n.jsxs)("div",{className:I().searchResultHeader,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:"文件详情"}),(0,n.jsx)("p",{className:"pageDesc",children:"查看解析结果、图纸/表格/数据结构化字段、parent chunk 和 child chunk。"})]}),(0,n.jsxs)(d.A,{children:[(0,n.jsx)(w.Ay,{onClick:()=>{et(null==D?void 0:D.absolutePath)},children:"复制原文件路径"}),(0,n.jsx)(w.Ay,{onClick:()=>{et(null==D?void 0:D.directory)},children:"复制所在目录"}),(0,n.jsx)(w.Ay,{onClick:()=>{el("file")},children:"打开文件"}),(0,n.jsx)(w.Ay,{onClick:()=>{el("directory")},children:"打开目录"}),"pdf"===D.file.format?(0,n.jsx)(w.Ay,{loading:V,onClick:()=>{ee()},children:"重新 OCR"}):null,(0,n.jsx)(w.Ay,{type:"primary",loading:V,onClick:()=>{ee()},children:"重建该文件索引"})]})]})]}),(0,n.jsx)(p.A,{size:"small",title:"基础信息",children:(0,n.jsxs)(c.A,{size:"small",column:2,bordered:!0,children:[(0,n.jsx)(c.A.Item,{label:"路径",children:D.file.relativePath}),(0,n.jsx)(c.A.Item,{label:"原文件",children:null!=(e=D.absolutePath)?e:"-"}),(0,n.jsx)(c.A.Item,{label:"所在目录",children:null!=(t=D.directory)?t:"-"}),(0,n.jsxs)(c.A.Item,{label:"分类",children:[(0,n.jsx)(u.A,{children:(0,S.Jm)(D.file.category)})," ",(0,n.jsx)(u.A,{children:D.file.format})]}),(0,n.jsx)(c.A.Item,{label:"大小",children:(0,S.z3)(D.file.fileSize)}),(0,n.jsx)(c.A.Item,{label:"切片数",children:D.file.chunkCount}),(0,n.jsx)(c.A.Item,{label:"状态",children:D.file.status}),(0,n.jsx)(c.A.Item,{label:"解析模式",children:String(null!=(l=$.extractionMode)?l:"-")}),(0,n.jsx)(c.A.Item,{label:"覆盖范围",children:String(null!=(r=$.contentCoverage)?r:"-")}),(0,n.jsx)(c.A.Item,{label:"正文长度",children:String(null!=(o=$.textLength)?o:"-")})]})}),en.length>0&&(0,n.jsx)(p.A,{size:"small",title:"结构化信息",children:(0,n.jsx)(j.A,{items:en})}),(0,n.jsx)(p.A,{size:"small",title:"详情筛选",children:(0,n.jsxs)(d.A,{direction:"vertical",className:"w-full",children:[(0,n.jsx)(A.A,{allowClear:!0,value:U,onChange:e=>W(e.target.value),placeholder:"筛选 rowRange、图层、实体、data path、section、chunk 内容"}),U?(0,n.jsxs)(d.A,{wrap:!0,children:[(0,n.jsxs)(u.A,{color:"blue",children:[b("knowledge.parentMatches")," ",Y.length]}),(0,n.jsxs)(u.A,{color:"green",children:[b("knowledge.childMatches")," ",Q.length]}),(0,n.jsxs)(u.A,{color:"purple",children:[b("knowledge.filterTerm")," ",U]})]}):null]})}),(0,n.jsxs)(p.A,{size:"small",title:"".concat(b("knowledge.parentChunks")," (").concat(Y.length,"/").concat(D.parents.length,")"),children:[(0,n.jsx)(_.A,{type:"info",showIcon:!0,message:b("knowledge.parentChunkHint"),style:{marginBottom:12}}),(0,n.jsx)(m.A,{rowKey:"id",columns:er,dataSource:Y,pagination:{pageSize:10},size:"small"})]}),(0,n.jsx)(p.A,{size:"small",title:"".concat(b("knowledge.childChunks")," (").concat(Q.length,"/").concat(D.chunks.length,")"),children:(0,n.jsx)(m.A,{rowKey:"id",columns:ea,dataSource:Q,pagination:{pageSize:20},size:"small"})})]}):(0,n.jsx)(f.A,{description:"请选择文件"})}}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,2884,9189,6985,7150,5292,1289,6506,861,1515,6578,636,6593,8792],()=>e(e.s=37690)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9028],{1611:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"database",theme:"outlined"}},13067:(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 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0010.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 00-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"}}]},name:"file-excel",theme:"outlined"}},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",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"}},21349:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 01755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 01512.1 856a342.24 342.24 0 01-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 00-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 00-8-8.2z"}}]},name:"sync",theme:"outlined"}},23793:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"}},25258:(e,t,l)=>{"use strict";l.d(t,{A:()=>j});var r=l(51541),a=l(61848),s=l(5669),n=l(97109),i=l(72658),c=l(3638),o=l(92162),u=l(82725),d=l(74567),h=l(632),f=l(49517),m=l(79412),p=l(19527);let g=(0,u.U)(e=>{let{prefixCls:t,className:l,closeIcon:r,closable:a,type:s,title:u,children:g,footer:y,classNames:v,styles:x,...j}=e,{getPrefixCls:w}=n.useContext(d.QO),{className:_,style:A,classNames:b,styles:C}=(0,d.TP)("modal"),z=w(),k=t||w("modal"),S=(0,h.A)(z),[P,M]=(0,p.Ay)(k,S),[N,I]=(0,o.AV)([b,v],[C,x],{props:e}),E=`${k}-confirm`,O={};return O=s?{closable:a??!1,title:"",footer:"",children:n.createElement(f.k,{...e,prefixCls:k,confirmPrefixCls:E,rootPrefixCls:z,content:g})}:{closable:a??!0,title:u,footer:null!==y&&n.createElement(m.w,{...e}),children:g},n.createElement(i.Z,{prefixCls:k,className:(0,c.$)(P,`${k}-pure-panel`,s&&E,s&&`${E}-${s}`,l,_,M,S,N.root),style:{...A,...I.root},...j,closeIcon:(0,m.O)(k,r),closable:a,classNames:N,styles:I,...O})});var y=l(99739);function v(e){return(0,r.Ay)((0,r.fp)(e))}let x=s.A;x.useModal=y.A,x.info=function(e){return(0,r.Ay)((0,r.$D)(e))},x.success=function(e){return(0,r.Ay)((0,r.Ej)(e))},x.error=function(e){return(0,r.Ay)((0,r.jT)(e))},x.warning=v,x.warn=v,x.confirm=function(e){return(0,r.Ay)((0,r.lr)(e))},x.destroyAll=function(){for(;a.A.length;){let e=a.A.pop();e&&e()}},x.config=r.FB,x._InternalPanelDoNotUseOrYouWillBeFired=g;let j=x},26619:(e,t,l)=>{"use strict";l.d(t,{A:()=>i});var r=l(97109),a=l(1611),s=l(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(s.A,n({},e,{ref:t,icon:a.A})))},30289:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"}},45551:(e,t,l)=>{"use strict";function r(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),l=e/Math.pow(1024,t);return"".concat(l.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 l=Math.floor(Math.floor((Date.now()-e)/1e3)/60),r=Math.floor(l/60),a=Math.floor(r/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):r>0?"".concat(r,"h ago"):l>0?"".concat(l,"m ago"):"Just now":a>0?"".concat(a," 天前"):r>0?"".concat(r," 小时前"):l>0?"".concat(l," 分钟前"):"刚刚"}l.d(t,{Jm:()=>i,fw:()=>a,z3:()=>r});let s={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},n={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function i(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===l?n:s)[e])?t:e}},48893:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M553.1 509.1l-77.8 99.2-41.1-52.4a8 8 0 00-12.6 0l-99.8 127.2a7.98 7.98 0 006.3 12.9H696c6.7 0 10.4-7.7 6.3-12.9l-136.5-174a8.1 8.1 0 00-12.7 0zM360 442a40 40 0 1080 0 40 40 0 10-80 0zm494.6-153.4L639.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 42h216v494z"}}]},name:"file-image",theme:"outlined"}},58209:(e,t,l)=>{"use strict";l.d(t,{A:()=>i});var r=l(97109),a=l(23793),s=l(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(s.A,n({},e,{ref:t,icon:a.A})))},58520:(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 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 00-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 00-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z"}}]},name:"file-word",theme:"outlined"}},61825:(e,t,l)=>{"use strict";l.d(t,{A:()=>i});var r=l(97109),a=l(30289),s=l(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(s.A,n({},e,{ref:t,icon:a.A})))},64629:(e,t,l)=>{"use strict";l.d(t,{A:()=>i});var r=l(97109),a=l(21349),s=l(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let i=r.forwardRef((e,t)=>r.createElement(s.A,n({},e,{ref:t,icon:a.A})))},82738:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>ee});var r=l(65321),a=l(97109),s=l(32620),n=l(43220),i=l.n(n),c=l(86109),o=l(17807),u=l(25258),d=l(11702),h=l(85114),f=l(7576),m=l(57271),p=l(68787),g=l(33442),y=l(99605),v=l(14932),x=l(21289),j=l(56768),w=l(48893),_=l(88483);function A(){return(A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let b=a.forwardRef((e,t)=>a.createElement(_.A,A({},e,{ref:t,icon:w.A})));var C=l(13067);function z(){return(z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let k=a.forwardRef((e,t)=>a.createElement(_.A,z({},e,{ref:t,icon:C.A})));var S=l(58520);function P(){return(P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let M=a.forwardRef((e,t)=>a.createElement(_.A,P({},e,{ref:t,icon:S.A})));var N=l(90939);function I(){return(I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let E=a.forwardRef((e,t)=>a.createElement(_.A,I({},e,{ref:t,icon:N.A})));var O=l(93314),H=l(61825),F=l(26619),V=l(29606),T=l(26631),B=l(64254),L=l(58209),R=l(30486),D=l(92803);function U(){return(U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}let J=a.forwardRef((e,t)=>a.createElement(_.A,U({},e,{ref:t,icon:D.A})));var Q=l(64629),W=l(84742),q=l(38762),X=l(6578),$=l(45551),G=l(14569),K=l.n(G);let Z=["document","spreadsheet","image","cad","code","data","web","diagram","other"],Y=/\.(zip|jar|war|apk|tar|gz|tgz|bz2|rar|7z)$/iu;function ee(){let e=(0,s.Vr)("knowledge"),{locale:t}=(0,s.x_)(),{message:l}=o.A.useApp(),n=(0,c.useRouter)(),w="string"==typeof n.query.category?n.query.category:"",[_,A]=(0,a.useState)([]),[C,z]=(0,a.useState)(!1),[S,P]=(0,a.useState)(""),[N,I]=(0,a.useState)(""),[D,U]=(0,a.useState)(w),[G,ee]=(0,a.useState)(!1),[et,el]=(0,a.useState)(!1),[er,ea]=(0,a.useState)([]),[es,en]=(0,a.useState)([]),[ei,ec]=(0,a.useState)(new Set),[eo,eu]=(0,a.useState)("all"),[ed,eh]=(0,a.useState)("user"),[ef,em]=(0,a.useState)(!0),[ep,eg]=(0,a.useState)([]),ey=(0,a.useRef)(D);(0,a.useEffect)(()=>{ey.current=D},[D]),(0,a.useEffect)(()=>{U("string"==typeof n.query.category?n.query.category:"")},[n.query.category]);let ev=(0,a.useCallback)(async e=>{let t=null!=e?e:ey.current;z(!0),P("");try{let e=await (0,X.HT)({category:t||void 0,limit:200});A(e.files||[]),e.initializing&&window.setTimeout(()=>{ev(t)},1500)}catch(e){A([]),P(e instanceof Error?e.message:"文件列表加载失败")}finally{z(!1)}},[]);(0,a.useEffect)(()=>{ev(D)},[D,ev]);let ex=e=>({id:e.id,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,error:e.error,createdAt:e.createdAt}),ej=(0,a.useCallback)(async()=>{try{let e=(await (0,X.Qx)()).operations.map(ex);ea(t=>{let l=new Set(e.map(e=>e.id).filter(Boolean)),r=t.filter(e=>e.id&&!l.has(e.id)&&"processing"===e.status);return[...e,...r].slice(0,50)})}catch(e){}},[]),ew=(0,a.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];ea(l=>{let r=l.findIndex(l=>e.id&&l.id===e.id||t.includes(l.title));if(r>=0){var a;let t=[...l];return t[r]={...l[r],...e,createdAt:null!=(a=l[r].createdAt)?a:e.createdAt},t}return[e,...l].slice(0,50)})},[]);(0,a.useEffect)(()=>{ej()},[ej]);let e_=async()=>{try{await (0,X.H7)(),ea([]),l.success("任务状态已清空")}catch(e){l.error("清空任务状态失败")}},eA=async(e,t)=>{if(t.stopPropagation(),e.id)try{await (0,X.CU)(e.id)}catch(e){}ea(t=>t.filter(t=>t!==e))},eb=(0,a.useMemo)(()=>{let e=0,t=0,l=0;for(let r of er)"processing"===r.status?e++:"success"===r.status?t++:("error"===r.status||"warning"===r.status)&&l++;return{processing:e,success:t,error:l}},[er]);(0,a.useEffect)(()=>{eb.processing>0&&em(!1)},[eb.processing]),(0,a.useEffect)(()=>{if(0===eb.processing)return;let e=window.setInterval(()=>{ej()},1e3);return()=>window.clearInterval(e)},[ej,eb.processing]);let eC="all"===eo?er:er.filter(e=>"processing"===eo?"processing"===e.status:"success"===eo?"success"===e.status:"error"!==eo||"error"===e.status||"warning"===e.status),ez=async e=>{let t=e.filter(e=>!Y.test(e.name)),r=e.length-t.length;if(r>0&&l.warning("已跳过 ".concat(r," 个压缩包,请解压后上传内部文件")),0===t.length)return;let a=1===t.length?t[0].name:"".concat(t.length," 个文件");ee(!0);let s="".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2));ew({id:s,type:"upload",title:"上传 ".concat(a),description:"等待上传、解析、切片和入库",status:"processing",percent:5});let n=!1,i=0,c=async()=>{let e=await (0,X.QT)(s);i=0;let t="error"===e.stage?"error":"done"===e.stage?"success":"processing";return ew({id:s,type:"error"===t?"error":"upload",title:"success"===t?"上传完成 ".concat(a):"上传 ".concat(a),description:"".concat(e.message).concat(e.chunkCount?",".concat(e.chunkCount," 个切片"):""),status:t,percent:e.percent}),("done"===e.stage||"error"===e.stage)&&(n=!0),e},o=e=>{if((i+=1)>=5){n=!0;let t=e instanceof Error?e.message:"进度查询失败";ew({id:s,type:"error",title:"上传失败 ".concat(a),description:t,status:"error",percent:100})}},u=setInterval(()=>{c().catch(o)},700);try{await (0,X.c1)(t,void 0,s),l.info("文件已上传,正在后台解析、切片和入库");for(let e=0;e<240&&!n;e++)await new Promise(e=>setTimeout(e,500)),await c().catch(o);I(""),U(""),en([]),ey.current="",await ev(),await ej(),n&&l.success("上传索引流程已完成")}catch(t){let e=t instanceof Error?t.message:"请重试或检查文件格式";l.error(e||"上传失败"),ew({id:s,type:"error",title:"上传失败 ".concat(a),description:e,status:"error",percent:100})}finally{clearInterval(u),ee(!1)}},ek=async()=>{el(!0);let e="reindex-ui-".concat(Date.now());ew({id:e,type:"reindex",title:"重新解析入库",description:"已提交全量重新解析、切片和入库任务",status:"processing",percent:10});try{let t=await (0,X.H1)(),r=t.operationId||e;l.success("已提交重新解析入库任务"),ew({id:r,type:"reindex",title:"重新解析入库",description:"后台将重新扫描文件、解析、切片并重建索引",status:"processing",percent:20},["重新解析入库"]);for(let e=0;e<180;e++){let e=(await (0,X.Qx)()).operations.find(e=>e.id===t.operationId);if(e&&(ew({id:r,type:"error"===e.status?"error":"reindex",title:"success"===e.status?"重新解析入库完成":"error"===e.status?"重新解析入库失败":"重新解析入库",description:e.message,status:e.status,percent:e.percent}),"success"===e.status||"error"===e.status))break;await new Promise(e=>setTimeout(e,1e3))}await ev(),await ej()}catch(r){let t=r instanceof Error?r.message:"重新解析入库失败";l.error(t),ew({id:e,type:"error",title:"重新解析入库失败",description:t,status:"error",percent:100},["重新解析入库","重新解析入库完成","重新解析入库失败"])}finally{el(!1)}},eS=t=>{let r="selected"===t?eR:"filtered"===t?eM.filter(e=>!e.builtIn).map(e=>e.relativePath):[],a=_.filter(e=>!e.builtIn).length;if("all"!==t&&0===r.length||"all"===t&&0===a)return void l.info("没有可删除的用户文件");let s="all"===t?"删除全部用户文件 ".concat(a," 个?"):"filtered"===t?"删除当前筛选结果中的用户文件 ".concat(r.length," 个?"):"删除已选用户文件 ".concat(r.length," 个?");u.A.confirm({title:s,content:"将同时删除文件、切片、索引和向量记录。此操作不可撤销。",okText:e("common.delete"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{ea(e=>[{type:"delete",title:s,description:"正在批量删除文件和索引",status:"processing",percent:10},...e].slice(0,50));try{var e;let s=null!=(e=("all"===t?await (0,X.X8)():"selected"===t?await (0,X.tZ)(eL,eB):await (0,X.SJ)(r)).deleted)?e:"all"===t?a:r.length;l.success("已删除 ".concat(s," 个文件")),en([]),ea(e=>[{type:"delete",title:"批量删除完成",description:"已删除 ".concat(s," 个文件、切片和索引"),status:"success"},...e].slice(0,50)),await ev(),await ej()}catch(e){l.error("批量删除失败"),ea(e=>[{type:"error",title:"批量删除失败",description:"请重试",status:"error"},...e].slice(0,50))}}})},eP=(0,a.useMemo)(()=>"all"===ed?_:_.filter(e=>"builtIn"===ed?e.builtIn:!e.builtIn),[_,ed]),eM=(0,a.useMemo)(()=>N?eP.filter(e=>e.relativePath.toLowerCase().includes(N.toLowerCase())):eP,[N,eP]),eN=(0,a.useMemo)(()=>_.filter(e=>!e.builtIn),[_]),eI=(0,a.useMemo)(()=>_.filter(e=>e.builtIn),[_]),eE=(0,a.useMemo)(()=>eM.filter(e=>!e.builtIn),[eM]),eO=(0,a.useMemo)(()=>eM.filter(e=>e.builtIn),[eM]),eH=(0,a.useMemo)(()=>new Set(eM.map(e=>e.relativePath)),[eM]),eF=(0,a.useMemo)(()=>{let e={};for(let l of[...eM].sort((e,t)=>e.relativePath.localeCompare(t.relativePath))){let r=l.relativePath.split("/"),a="";for(let s=0;s<r.length;s++){let n=r[s],i=a;a=a?"".concat(a,"/").concat(n):n;let c=s===r.length-1;if(e[a])c||e[a].isFolder?c&&(e[a].isFolder=!1,e[a].file=l,e[a].fileCount=1,e[a].userFileCount=+!l.builtIn,e[a].totalSize=l.fileSize,e[a].totalChunks=l.chunkCount):(e[a].isFolder=!0,e[a].children=[],e[a].fileCount=0,e[a].userFileCount=0,e[a].totalSize=0,e[a].totalChunks=0);else{var t;e[a]={key:a,name:n,isFolder:!c,...c?{file:l,fileCount:1,userFileCount:+!l.builtIn,totalSize:l.fileSize,totalChunks:l.chunkCount}:{children:[],fileCount:0,userFileCount:0,totalSize:0,totalChunks:0}},i&&(null==(t=e[i])?void 0:t.children)&&e[i].children.push(e[a])}}}let l=e=>{for(let n of e)if(n.children){l(n.children);let e=0,i=0,c=0,o=0;for(let l of n.children){var t,r,a,s;e+=null!=(t=l.fileCount)?t:0,i+=null!=(r=l.userFileCount)?r:0,c+=null!=(a=l.totalSize)?a:0,o+=null!=(s=l.totalChunks)?s:0}n.fileCount=e,n.userFileCount=i,n.totalSize=c,n.totalChunks=o}},r=e=>e.map(e=>e.children?{...e,children:r(e.children)}:e).filter(e=>{var t,l,r;return!e.isFolder||(null!=(l=e.fileCount)?l:0)>0&&(null!=(r=null==(t=e.children)?void 0:t.length)?r:0)>0}),a=Object.values(e).filter(e=>!e.key.includes("/"));return l(a),r(a)},[eM]),eV=(0,a.useMemo)(()=>{let e=[],t=l=>{for(let r of l)e.push(r.key),r.children&&t(r.children)};return t(eF),e},[eF]),eT=(0,a.useMemo)(()=>new Set([...eH,...eV]),[eV,eH]),eB=(0,a.useMemo)(()=>es.map(String).filter(e=>!eH.has(e)&&eV.includes(e)),[eV,es,eH]),eL=(0,a.useMemo)(()=>es.map(String).filter(e=>eH.has(e)),[es,eH]),eR=(0,a.useMemo)(()=>{let e=new Set;for(let t of eL){let l=_.find(e=>e.relativePath===t);l&&!l.builtIn&&e.add(l.relativePath)}for(let t of eB){let l="".concat(t,"/");for(let t of _)!t.builtIn&&t.relativePath.startsWith(l)&&e.add(t.relativePath)}return Array.from(e)},[_,eL,eB]),eD=eR.length;(0,a.useEffect)(()=>{en(e=>e.filter(e=>eT.has(String(e))))},[eT]);let eU=(0,a.useMemo)(()=>N?eV:eF.map(e=>e.key),[N,eV,eF]);(0,a.useEffect)(()=>{eg(eU)},[eU]);let eJ=(e,t)=>{eg(l=>e?[...l,t.key]:l.filter(e=>e!==t.key))},eQ=[{title:e("fileName"),dataIndex:"name",key:"name",render:(e,t)=>{var l;return(0,r.jsxs)("span",{className:K().fileNameCell,children:[t.isFolder?(0,r.jsx)("span",{style:{cursor:"pointer"},onClick:e=>{e.stopPropagation(),eJ(!ep.includes(t.key),t)},children:(e=>{let t=e.children;return t&&0!==t.length?(0,r.jsx)(B.A,{style:{color:"#fa8c16",fontSize:15}}):(0,r.jsx)(V.A,{style:{color:"#fa8c16",fontSize:15}})})(t)}):(e=>{if(!e)return(0,r.jsx)(j.A,{style:{fontSize:15}});let t=e.category;return"image"===t?(0,r.jsx)(b,{style:{color:"#eb2f96",fontSize:15}}):"spreadsheet"===t?(0,r.jsx)(k,{style:{color:"#52c41a",fontSize:15}}):"document"===t?(0,r.jsx)(M,{style:{color:"#1677ff",fontSize:15}}):"code"===t?(0,r.jsx)(E,{style:{color:"#fa8c16",fontSize:15}}):"archive"===t?(0,r.jsx)(O.A,{style:{color:"#8c8c8c",fontSize:15}}):"web"===t?(0,r.jsx)(H.A,{style:{color:"#13c2c2",fontSize:15}}):"data"===t?(0,r.jsx)(F.A,{style:{color:"#722ed1",fontSize:15}}):"cad"===t?(0,r.jsx)(V.A,{style:{color:"#fa541c",fontSize:15}}):"diagram"===t?(0,r.jsx)(b,{style:{color:"#a0d911",fontSize:15}}):(0,r.jsx)(T.A,{style:{fontSize:15}})})(t.file),t.isFolder?(0,r.jsx)("span",{className:K().folderName,onClick:e=>{e.stopPropagation(),eJ(!ep.includes(t.key),t)},children:t.name}):(0,r.jsxs)(r.Fragment,{children:[(null==(l=t.file)?void 0:l.builtIn)&&(0,r.jsx)(d.A,{color:"gold",style:{fontSize:11,lineHeight:"18px"},children:"内置"}),(0,r.jsx)(i(),{className:"truncate max-w-[380px] inline-block",href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(t.key)),children:t.name})]})]})}},{title:e("fileCategory"),dataIndex:"category",key:"cat",width:110,render:(e,l)=>{var a,s;return l.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,r.jsx)(d.A,{children:(0,$.Jm)(null!=(s=null==(a=l.file)?void 0:a.category)?s:"",t)})}},{title:e("fileSize"),dataIndex:"fileSize",key:"size",width:90,render:(e,t)=>{var l,r,a;return(0,$.z3)(t.isFolder?null!=(r=t.totalSize)?r:0:null!=(a=null==(l=t.file)?void 0:l.fileSize)?a:0)}},{title:"切片",dataIndex:"chunkCount",key:"chunks",width:80,render:(e,t)=>{var l,a,s;let n=t.isFolder?null!=(a=t.totalChunks)?a:0:null!=(s=null==(l=t.file)?void 0:l.chunkCount)?s:0;return(0,r.jsx)(d.A,{color:n>1?"green":"orange",children:n})}},{title:"解析状态",dataIndex:"status",key:"status",width:100,render:(e,t)=>{var l,a,s;return t.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,r.jsx)(d.A,{color:(null==(l=t.file)?void 0:l.status)==="active"?"green":"red",children:(null==(a=t.file)?void 0:a.errorMessage)||(null==(s=t.file)?void 0:s.status)||"—"})}},{title:e("fileDate"),dataIndex:"mtime",key:"date",width:130,render:(e,l)=>{var a;return l.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(null==(a=l.file)?void 0:a.mtime)?new Date(l.file.mtime).toLocaleDateString(t):"—"}},{title:"来源",key:"source",width:100,render:(e,t)=>{var l;return t.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(null==(l=t.file)?void 0:l.builtIn)?(0,r.jsx)(d.A,{color:"gold",children:"内置示例"}):(0,r.jsx)(d.A,{color:"cyan",children:"我的文件"})}},{title:"",key:"act",width:50,render:(t,a)=>{var s;return a.isFolder?null:(0,r.jsx)(h.Ay,{type:"text",danger:!0,size:"small",disabled:null==(s=a.file)?void 0:s.builtIn,icon:(0,r.jsx)(L.A,{}),onClick:()=>(t=>{if(t.builtIn)return void l.info("内置示例资料不可删除");u.A.confirm({title:e("delete"),content:e("deleteConfirm"),okText:e("common.confirm"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{ea(e=>[{type:"delete",title:"删除 ".concat(t.relativePath),description:"正在删除文件记录",status:"processing"},...e].slice(0,50));try{await (0,X.xq)(t.relativePath),l.success("已删除"),ea(e=>[{type:"delete",title:"删除完成 ".concat(t.relativePath),description:"文件和索引记录已移除",status:"success"},...e].slice(0,50)),en(e=>e.filter(e=>e!==t.relativePath)),await ev(),await ej()}catch(e){l.error("删除失败"),ea(e=>[{type:"error",title:"删除失败 ".concat(t.relativePath),description:"请重试",status:"error"},...e].slice(0,50))}}})})(a.file)})}}];return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsx)("h2",{className:"pageTitle",children:e("files")}),(0,r.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,r.jsx)(f.A,{placeholder:e("searchPlaceholder"),prefix:(0,r.jsx)(R.A,{}),value:N,onChange:e=>{I(e.target.value)},allowClear:!0,className:K().filterInput}),(0,r.jsx)(m.A,{value:D||void 0,onChange:e=>{U(e||"")},placeholder:e("filterCategory"),allowClear:!0,className:K().filterSelect,options:[{label:e("allCategories"),value:""},...Z.map(e=>({label:(0,$.Jm)(e,t),value:e}))]}),(0,r.jsx)(m.A,{value:ed,onChange:eh,className:K().filterSelect,options:[{label:"全部来源 (".concat(_.length,")"),value:"all"},{label:"我的文件 (".concat(eN.length,")"),value:"user"},{label:"内置示例 (".concat(eI.length,")"),value:"builtIn"}]}),(0,r.jsx)(h.Ay,{type:"primary",icon:(0,r.jsx)(J,{}),loading:G,onClick:()=>{var e;return null==(e=document.getElementById("kb-file-upload-input"))?void 0:e.click()},children:G?e("uploading"):e("upload")}),(0,r.jsx)(h.Ay,{icon:(0,r.jsx)(J,{}),loading:G,onClick:()=>{var e;return null==(e=document.getElementById("kb-folder-upload-input"))?void 0:e.click()},children:"上传文件夹"}),(0,r.jsx)(h.Ay,{icon:(0,r.jsx)(Q.A,{}),loading:et,onClick:()=>{ek()},children:"重新解析入库"}),(0,r.jsx)("input",{id:"kb-file-upload-input",type:"file",multiple:!0,hidden:!0,accept:".pdf,.doc,.docx,.txt,.md,.csv,.tsv,.xls,.xlsx,.png,.jpg,.jpeg,.webp,.svg,.dwg,.dxf,.step,.stp,.iges,.igs,.js,.ts,.tsx,.jsx,.py,.go,.java,.cs,.cpp,.c,.h,.json,.jsonl,.yaml,.yml,.xml,.html,.htm,.drawio,.dio,.vsdx,.vdx,.puml,.plantuml,.mmd,.mermaid,.excalidraw",onChange:e=>{var t;let l=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",ez(l)}}),(0,r.jsx)("input",{id:"kb-folder-upload-input",type:"file",multiple:!0,hidden:!0,webkitdirectory:"",onChange:e=>{var t;let l=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",ez(l)}})]}),(0,r.jsxs)(p.A,{size:"small",className:K().statusCard,styles:{body:{padding:0}},children:[(0,r.jsxs)("div",{className:K().statusSummary,onClick:()=>em(!ef),children:[(0,r.jsx)("span",{className:K().statusSummaryText,children:0===er.length?"暂无文件任务":(0,r.jsxs)(g.A,{size:6,children:[eb.processing>0&&(0,r.jsxs)(d.A,{color:"processing",style:{margin:0},icon:(0,r.jsx)(Q.A,{spin:!0}),children:["处理中 ",eb.processing]}),(0,r.jsxs)(d.A,{color:"success",style:{margin:0},icon:(0,r.jsx)(W.A,{}),children:["已完成 ",eb.success]}),(0,r.jsxs)(d.A,{color:"error",style:{margin:0},icon:(0,r.jsx)(q.A,{}),children:["失败 ",eb.error]})]})}),er.length>0&&(0,r.jsxs)(g.A,{size:6,children:[(0,r.jsx)(h.Ay,{size:"small",className:K().statusClearBtn,onClick:e=>{e.stopPropagation(),e_()},children:"清空"}),(0,r.jsx)(h.Ay,{size:"small",className:K().statusExpandBtn,onClick:e=>{e.stopPropagation(),em(!ef)},children:ef?"展开":"收起"})]})]}),!ef&&er.length>0&&(0,r.jsxs)("div",{className:K().statusPanel,children:[(0,r.jsxs)("div",{className:K().statusFilters,children:[(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("all"===eo?K().filterPillActive:""),style:"all"===eo?{color:"#1677ff"}:void 0,onClick:()=>eu("all"),children:["全部 ",(0,r.jsx)("b",{children:er.length})]}),(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("processing"===eo?K().filterPillActive:""),style:"processing"===eo?{color:"#1677ff"}:void 0,onClick:()=>eu("processing"),children:[(0,r.jsx)(Q.A,{spin:eb.processing>0})," 处理中 ",(0,r.jsx)("b",{children:eb.processing})]}),(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("success"===eo?K().filterPillActive:""),style:"success"===eo?{color:"#52c41a"}:void 0,onClick:()=>eu("success"),children:[(0,r.jsx)(W.A,{})," 已完成 ",(0,r.jsx)("b",{children:eb.success})]}),(0,r.jsxs)("span",{className:"".concat(K().filterPill," ").concat("error"===eo?K().filterPillActive:""),style:"error"===eo?{color:"#ff4d4f"}:void 0,onClick:()=>eu("error"),children:[(0,r.jsx)(q.A,{})," 失败 ",(0,r.jsx)("b",{children:eb.error})]})]}),(0,r.jsx)("div",{className:K().timelineList,children:0===eC.length?(0,r.jsx)("div",{className:K().statusEmpty,children:"没有匹配的任务"}):eC.map((e,l)=>{var a;let s=e.id||"".concat(e.type,"-").concat(null!=(a=e.createdAt)?a:e.title,"-").concat(l),n=ei.has(s);return(0,r.jsxs)("div",{className:K().timelineItem,children:[(0,r.jsxs)("div",{className:K().timelineRow,onClick:()=>{ec(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},children:[(0,r.jsx)("span",{className:K().timelineStatusIcon,children:"success"===e.status?(0,r.jsx)(W.A,{style:{color:"#52c41a"}}):"processing"===e.status?(0,r.jsx)(Q.A,{spin:!0,style:{color:"#1677ff"}}):"error"===e.status?(0,r.jsx)(q.A,{style:{color:"#ff4d4f"}}):(0,r.jsx)("span",{style:{color:"#fa8c16",fontWeight:700},children:"!"})}),(0,r.jsx)("span",{className:K().timelineTitle,children:e.title}),"number"==typeof e.percent&&"processing"===e.status&&(0,r.jsxs)("span",{className:K().timelinePercent,children:[e.percent,"%"]}),(0,r.jsx)(h.Ay,{type:"text",size:"small",danger:!0,icon:(0,r.jsx)(L.A,{}),style:{width:22,height:22,padding:0,fontSize:12},onClick:t=>{eA(e,t)}})]}),n&&(0,r.jsxs)("div",{className:K().timelineDetail,children:["number"==typeof e.percent&&"processing"===e.status&&(0,r.jsx)(y.A,{percent:e.percent,size:"small",strokeColor:"#1677ff"}),e.description&&(0,r.jsx)("div",{className:K().timelineDesc,children:e.description}),e.error&&(0,r.jsx)("div",{style:{color:"var(--colorError)",fontSize:12,wordBreak:"break-word"},children:e.error}),e.filePath&&(0,r.jsx)(v.A,{title:e.filePath,children:(0,r.jsx)("div",{className:K().timelinePath,children:e.filePath})}),(0,r.jsxs)("div",{className:K().timelineMeta,children:["number"==typeof e.chunkCount&&(0,r.jsxs)("span",{className:K().timelineMetaTag,children:["切片 ",(0,r.jsx)("b",{children:e.chunkCount})]}),"number"==typeof e.textLength&&(0,r.jsxs)("span",{className:K().timelineMetaTag,children:["正文 ",(0,r.jsx)("b",{children:e.textLength.toLocaleString(t)})," 字符"]}),e.extractionMode&&(0,r.jsxs)("span",{className:K().timelineMetaTag,children:["解析 ",(0,r.jsx)("b",{children:e.extractionMode})]})]}),"error"===e.status&&(0,r.jsx)("div",{style:{color:"var(--colorError)",fontSize:12},children:"此任务失败,请重新上传文件或重试操作"})]})]},s)})})]})]}),(0,r.jsxs)(p.A,{title:"文件列表",extra:(0,r.jsxs)(g.A,{size:8,children:[(0,r.jsxs)(h.Ay,{danger:!0,size:"small",disabled:0===eD,icon:(0,r.jsx)(L.A,{}),onClick:()=>eS("selected"),children:["删除已选 ",eD||""]}),(0,r.jsx)(h.Ay,{danger:!0,size:"small",disabled:0===eN.length,onClick:()=>eS("all"),children:"删除全部用户文件"})]}),children:[S&&(0,r.jsxs)("div",{className:K().statusEmpty,children:["文件列表加载失败:",S]}),(0,r.jsx)(x.A,{rowKey:"key",columns:eQ,dataSource:eF,loading:C,size:"middle",expandable:{expandedRowKeys:ep,onExpand:eJ,childrenColumnName:"children"},locale:{emptyText:C?"正在加载文件列表...":N?e("emptySearch"):e("noFiles")},pagination:!1,rowClassName:e=>e.isFolder?K().folderRow:"",rowSelection:{selectedRowKeys:es,onChange:en,checkStrictly:!1,getCheckboxProps:e=>{var t,l;return{disabled:e.isFolder?(null!=(l=e.userFileCount)?l:0)===0:!!(null==(t=e.file)?void 0:t.builtIn)}}},footer:()=>(0,r.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:["当前展示 ",eM.length," 个文件,其中我的文件 ",eE.length," 个、内置示例 ",eO.length," 个;全部我的文件 ",eN.length," 个、内置示例 ",eI.length," 个;",eF.length," 个顶层目录"]})})]})]})}},90426:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/files",function(){return l(82738)}])},90939:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"}},92803:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"}}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,2884,9189,6985,7150,1289,8732,6578,636,6593,8792],()=>e(e.s=90426)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3414],{45551:(e,l,t)=>{"use strict";function n(e){if(0===e)return"0 B";let l=Math.floor(Math.log(e)/Math.log(1024)),t=e/Math.pow(1024,l);return"".concat(t.toFixed(+(0!==l))," ").concat(["B","KB","MB","GB","TB"][l])}function a(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===l?"Never":"从未";let t=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(t/60),a=Math.floor(n/24);return a>30?new Date(e).toLocaleDateString(l):"en-US"===l?a>0?"".concat(a,"d ago"):n>0?"".concat(n,"h ago"):t>0?"".concat(t,"m ago"):"Just now":a>0?"".concat(a," 天前"):n>0?"".concat(n," 小时前"):t>0?"".concat(t," 分钟前"):"刚刚"}t.d(l,{Jm:()=>o,fw:()=>a,z3:()=>n});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},s={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function o(e){var l;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(l=("en-US"===t?s:r)[e])?l:e}},50423:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>E});var n=t(65321),a=t(97109),r=t(34986),s=t(32620),o=t(17807),c=t(33442),i=t(85114),d=t(2256),u=t(38770),h=t(68787),x=t(54849),g=t(57271),m=t(76506),j=t(11702),A=t(29606),f=t(30486),w=t(99811),v=t(56768),k=t(26619),p=t(93314),y=t(58740),b=t(35459),C=t(23216),S=t(63663),z=t(49484),D=t(6578),N=t(45551);let _=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function E(){var e,l,t,E;let I=(0,s.Vr)(),{locale:T}=(0,s.x_)(),M=(0,r.useRouter)(),{stats:B,loading:F,reload:R}=function(){let[e,l]=(0,a.useState)(null),[t,n]=(0,a.useState)(!1),r=(0,a.useCallback)(async()=>{n(!0);try{l(await (0,D.hc)())}catch(e){}finally{n(!1)}},[]);return(0,a.useEffect)(()=>{r()},[r]),{stats:e,loading:t,reload:r}}(),O=function(){let[e,l]=(0,a.useState)(null);return(0,a.useEffect)(()=>{(0,D.VW)().then(l).catch(()=>{})},[]),e}(),{reindexing:P,reindex:J}=function(){let[e,l]=(0,a.useState)(!1);return{reindexing:e,reindex:(0,a.useCallback)(async()=>{l(!0);try{return await (0,D.H1)(),!0}catch(e){return!1}finally{l(!1)}},[])}}(),[U,V]=(0,a.useState)("document"),[W,H]=(0,a.useState)({count:0,totalSize:0,totalChunks:0}),{message:X}=o.A.useApp(),G=(0,a.useCallback)(async e=>{try{let l=await (0,D.HT)({category:e,limit:1e4}),t=0,n=0;if(Array.isArray(l.files))for(let e of l.files)t+=e.fileSize||0,n+=e.chunkCount||0;H({count:l.total||0,totalSize:t,totalChunks:n})}catch(e){H({count:0,totalSize:0,totalChunks:0})}},[]);(0,a.useEffect)(()=>{G(U)},[U,G]);let K=async()=>{await J()?await Promise.all([R(),G(U)]):X.error(I("common.error"))};return(0,n.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"pageTitle",children:I("knowledge.manageTitle")}),(0,n.jsx)("p",{className:"pageDesc",children:I("knowledge.manageDesc")})]}),(0,n.jsxs)(c.A,{children:[(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(A.A,{}),onClick:()=>M.push("/knowledge/files"),children:I("knowledge.files")}),(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(f.A,{}),onClick:()=>M.push("/knowledge/search"),children:I("knowledge.search")}),(0,n.jsx)(i.Ay,{icon:(0,n.jsx)(w.A,{}),loading:P,onClick:()=>{K()},children:I("knowledge.reindex")})]})]}),(0,n.jsx)(d.A,{gutter:[16,16],children:[{icon:(0,n.jsx)(v.A,{}),label:I("knowledge.totalFiles"),value:null!=(l=null==B?void 0:B.fileCount)?l:0},{icon:(0,n.jsx)(k.A,{}),label:I("knowledge.totalChunks"),value:null!=(t=null==B?void 0:B.chunkCount)?t:0},{icon:(0,n.jsx)(p.A,{}),label:I("knowledge.totalSize"),value:(0,N.z3)(null!=(E=null==B?void 0:B.totalSizeBytes)?E:0)},{icon:(0,n.jsx)(y.A,{}),label:I("knowledge.lastIndexed"),value:(null==B?void 0:B.lastIndexedAt)?(0,N.fw)(B.lastIndexedAt,T):I("common.never")}].map((e,l)=>(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(h.A,{size:"small",loading:F&&!B,children:(0,n.jsx)(x.A,{title:e.label,value:e.value,prefix:e.icon})})},l))}),(0,n.jsxs)(h.A,{title:I("knowledge.categories"),size:"small",children:[(0,n.jsx)(g.A,{value:U,onChange:e=>V(e),options:_.map(e=>({label:(0,N.Jm)(e,T),value:e})),style:{width:160,marginBottom:16}}),(0,n.jsxs)(d.A,{gutter:[16,16],children:[(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.fileCount"),value:W.count,prefix:(0,n.jsx)(v.A,{style:{color:"var(--colorAccent)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:I("knowledge.totalSize"),value:(0,N.z3)(W.totalSize),prefix:(0,n.jsx)(p.A,{style:{color:"var(--colorWarning)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:"切片数",value:W.totalChunks,prefix:(0,n.jsx)(b.A,{style:{color:"var(--colorOk)"}})})}),(0,n.jsx)(u.A,{xs:12,sm:6,children:(0,n.jsx)(x.A,{title:"平均大小",value:W.count>0?(0,N.z3)(W.totalSize/W.count):"—",prefix:(0,n.jsx)(k.A,{style:{color:"var(--colorDanger)"}})})})]})]}),O&&(0,n.jsx)(h.A,{title:I("knowledge.features"),size:"small",children:(0,n.jsxs)(m.A,{size:"small",column:{xs:1,sm:2},bordered:!0,children:[(0,n.jsx)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(C.A,{style:{marginRight:4}}),"Vector Store"]}),children:(0,n.jsx)(j.A,{color:"blue",children:O.vectorStore})}),(0,n.jsx)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b.A,{style:{marginRight:4}}),"Embedding"]}),children:(0,n.jsx)(j.A,{color:"purple",children:O.embeddingProvider})}),(0,n.jsxs)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(S.A,{style:{marginRight:4}}),I("knowledge.featureDedup")]}),children:[(0,n.jsx)(j.A,{color:"green",children:O.dedupEngine}),(0,n.jsx)("div",{className:"text-xs",style:{color:"var(--colorTextSecondary)",marginTop:2},children:I("knowledge.featureDedupDesc")})]}),(0,n.jsxs)(m.A.Item,{label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z.A,{style:{marginRight:4}}),I("knowledge.featureChunker")]}),children:[(0,n.jsx)(j.A,{color:"orange",children:O.chunker}),(0,n.jsx)("div",{className:"text-xs",style:{color:"var(--colorTextSecondary)",marginTop:2},children:I("knowledge.featureChunkerDesc")})]}),(null==(e=O.externalExtractors)?void 0:e.length)>0&&(0,n.jsx)(m.A.Item,{label:"外部提取器",span:2,children:(0,n.jsx)(c.A,{wrap:!0,children:O.externalExtractors.map(e=>(0,n.jsx)(j.A,{color:"cyan",children:e},e))})})]})})]})}},54178:(e,l,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/manage",function(){return t(50423)}])}},e=>{e.O(0,[347,8787,7889,7271,6506,7223,6578,636,6593,8792],()=>e(e.s=54178)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5207],{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,s)=>{"use strict";s.r(t),s.d(t,{default:()=>E});var r=s(65321),l=s(43220),a=s.n(l),i=s(97109),n=s(35292),c=s(17807),o=s(85114),u=s(85493),d=s(68787),h=s(33442),_=s(7576),m=s(48318),p=s(76506),y=s(11702),x=s(42700),j=s(84253),f=s(30486),w=s(32620),g=s(6578),A=s(14569),b=s.n(A);let{Paragraph:v}=n.A,C=["keyword","vector","rewrite","hybridBonus"],S=["keywordScore","bm25Score","vectorScore","rerankBoost","hybridScore"];function P(e){return"number"==typeof e?e.toFixed(2):"-"}function k(e,t,s){let r=e(t);return r===t?s:r}function E(){var e,t,s;let{message:l}=c.A.useApp(),n=(0,w.Vr)("knowledge"),[A,E]=(0,i.useState)(""),[I,R]=(0,i.useState)(!1),[N,L]=(0,i.useState)([]),[O,T]=(0,i.useState)(),[z,B]=(0,i.useState)(),[M,F]=(0,i.useState)(""),[D,V]=(0,i.useState)({keyword:1,vector:.9,rewrite:.72,hybridBonus:.35}),H=async e=>{await navigator.clipboard.writeText(e),l.success(n("copyPriorityEvidenceSuccess"))},W=async()=>{let e=A.trim();if(e){R(!0),F("");try{let t=await (0,g.W2)(e,{limit:10,weights:D});L(t.results),T(t.queryTimeMs),B(t.debug)}catch(e){L([]),F(e instanceof Error?e.message:n("searchFailed"))}finally{R(!1)}}};return(0,r.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"pageTitle",children:n("searchTitle")}),(0,r.jsx)("p",{className:"pageDesc",children:n("searchDesc")})]}),(0,r.jsx)(a(),{href:"/documents",children:(0,r.jsx)(o.Ay,{children:n("goToDocuments")})})]}),(0,r.jsx)(u.A,{type:"info",showIcon:!0,message:n("autoSearchFirst"),description:n("autoSearchFirstDesc")}),(0,r.jsx)(d.A,{size:"small",children:(0,r.jsxs)(h.A.Compact,{className:"w-full",children:[(0,r.jsx)(_.A,{value:A,onChange:e=>E(e.target.value),onPressEnter:()=>{W()},placeholder:n("searchContentPlaceholder")}),(0,r.jsx)(o.Ay,{type:"primary",icon:(0,r.jsx)(f.A,{}),loading:I,onClick:()=>{W()},children:n("searchAction")})]})}),(0,r.jsx)(d.A,{size:"small",title:n("recallWeightTuning"),children:(0,r.jsx)(h.A,{wrap:!0,children:C.map(e=>(0,r.jsxs)("span",{children:[k(n,"weights.".concat(e),e)," ",(0,r.jsx)(m.A,{min:0,max:"hybridBonus"===e?2:5,step:"hybridBonus"===e?.05:.1,value:D[e],onChange:t=>V(s=>({...s,[e]:Number(null!=t?t:s[e])}))})]},e))})}),z&&(0,r.jsx)(d.A,{size:"small",title:n("debugPanel"),children:(0,r.jsxs)(p.A,{size:"small",column:2,bordered:!0,children:[(0,r.jsx)(p.A.Item,{label:n("originalQuery"),children:z.originalQuery}),(0,r.jsx)(p.A.Item,{label:n("reranker"),children:z.reranker}),(0,r.jsx)(p.A.Item,{label:n("rewrittenQueries"),span:2,children:(0,r.jsx)(h.A,{wrap:!0,children:null==(e=z.rewrittenQueries)?void 0:e.map(e=>(0,r.jsx)(y.A,{children:e},e))})}),(0,r.jsx)(p.A.Item,{label:n("recallCounts"),span:2,children:(0,r.jsx)(h.A,{wrap:!0,children:Object.entries(null!=(t=z.recallCounts)?t:{}).map(e=>{let[t,s]=e;return(0,r.jsxs)(y.A,{children:[k(n,"recallSources.".concat(t),t),": ",s]},t)})})}),(0,r.jsx)(p.A.Item,{label:n("recallWeights"),span:2,children:(0,r.jsx)(h.A,{wrap:!0,children:Object.entries(null!=(s=z.weights)?s:{}).map(e=>{let[t,s]=e;return(0,r.jsxs)(y.A,{children:[k(n,"weights.".concat(t),t),": ",s]},t)})})})]})}),(0,r.jsxs)(d.A,{size:"small",title:n("searchResults"),extra:"number"==typeof O?"".concat(O," ms"):void 0,children:[M?(0,r.jsx)(u.A,{type:"error",showIcon:!0,message:n("searchFailed"),description:M,className:"mb-4"}):null,I?(0,r.jsx)(x.A,{}):0===N.length?(0,r.jsx)(j.A,{description:n("noSearchResults")}):(0,r.jsx)("div",{className:b().searchResultList,children:N.map((e,t)=>{var s,l;return(0,r.jsxs)("div",{className:b().searchResultItem,children:[(0,r.jsxs)("div",{className:b().searchResultHeader,children:[(0,r.jsxs)(h.A,{size:8,wrap:!0,children:[(0,r.jsxs)(y.A,{children:[n("resultIndex")," ",t+1]}),(0,r.jsx)(y.A,{color:"hybrid"===e.source?"purple":"vector"===e.source?"blue":"green",children:k(n,"recallSources.".concat(null!=(s=e.source)?s:"keyword"),null!=(l=e.source)?l:"keyword")}),(0,r.jsx)(y.A,{children:k(n,"scopes.".concat(e.scope),e.scope)}),e.chunkKind&&(0,r.jsx)(y.A,{color:"geekblue",children:e.chunkKind}),e.rowRange&&(0,r.jsxs)(y.A,{color:"gold",children:[n("rowRange")," ",e.rowRange]}),e.sectionTitle&&(0,r.jsx)(y.A,{color:"cyan",children:e.sectionTitle})]}),(0,r.jsx)("strong",{children:P(e.score)})]}),(0,r.jsx)("div",{className:b().statusPath,children:(0,r.jsxs)(h.A,{size:8,wrap:!0,children:[(0,r.jsx)(a(),{href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(e.filePath)),children:e.filePath}),"number"==typeof e.chunkIndex?" #".concat(e.chunkIndex):"",(0,r.jsx)(o.Ay,{size:"small",onClick:()=>{H(e.filePath)},children:n("copyAsPriorityEvidence")})]})}),(0,r.jsx)(v,{ellipsis:{rows:6,expandable:!0,symbol:n("expand")},className:b().searchContent,children:function(e,t){let s=[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length);if(0===s.length)return e;let l=RegExp("(".concat(s.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(l).map((e,t)=>s.some(t=>t.toLowerCase()===e.toLowerCase())?(0,r.jsx)("mark",{children:e},t):e)}(e.content,A)}),e.facets&&Object.keys(e.facets).length>0&&(0,r.jsx)("div",{className:b().statusMeta,children:Object.entries(e.facets).slice(0,8).map(e=>{let[t,s]=e;return(0,r.jsxs)("span",{children:[t," ",(0,r.jsx)("b",{children:Array.isArray(s)?s.join(", "):String(s)})]},t)})}),(0,r.jsx)("div",{className:b().statusMeta,children:S.map(t=>{var s;return(0,r.jsxs)("span",{children:[k(n,"scoreDetails.".concat(t),t)," ",(0,r.jsx)("b",{children:P(null==(s=e.scoreDetails)?void 0:s[t])})]},t)})})]},e.id)})})]})]})}},9208:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/search",function(){return s(4184)}])},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",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"}},30486:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(97109),l=s(58758),a=s(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e}).apply(this,arguments)}let n=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:l.A})))},58758:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"}},60470:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(97109),l=s(838),a=s(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e}).apply(this,arguments)}let n=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:l.A})))},73458:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"}}]},name:"edit",theme:"outlined"}},99650:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(97109),l=s(73458),a=s(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e}).apply(this,arguments)}let n=r.forwardRef((e,t)=>r.createElement(a.A,i({},e,{ref:t,icon:l.A})))}},e=>{e.O(0,[347,8787,4277,7889,4833,7576,2884,5292,6506,5938,6578,636,6593,8792],()=>e(e.s=9208)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6012],{29735:(e,n,u)=>{"use strict";u.r(n),u.d(n,{default:()=>l});var _=u(97109),t=u(86109);function l(){let e=(0,t.useRouter)();return(0,_.useEffect)(()=>{e.replace("/knowledge/manage")},[e]),null}},74183:(e,n,u)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge",function(){return u(29735)}])}},e=>{e.O(0,[636,6593,8792],()=>e(e.s=74183)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4046],{22708:(e,l,s)=>{"use strict";s.r(l),s.d(l,{default:()=>U});var o=s(65321),a=s(97109),r=s(32620),i=s(17807),t=s(88762),n=s(68787),c=s(85114),d=s(2256),m=s(38770),h=s(33442),p=s(26171),x=s(11702),y=s(85493),v=s(57271),u=s(7576),j=s(48318),g=s(34052),A=s(63455),f=s(56985),b=s(54746),S=s(29071),w=s(59188),z=s(4216),k=s(13114),C=s(99650),B=s(58209),I=s(76981),T=s(61825),K=s(6578);let P=[{label:"OpenAI 兼容",value:"openai"},{label:"Anthropic",value:"anthropic"},{label:"Google",value:"google"},{label:"Ollama",value:"ollama"},{label:"OpenRouter",value:"openrouter"}],E=[{key:"reader",labelKey:"models.tierReader",descKey:"models.tierReaderDesc"},{key:"reasoning",labelKey:"models.tierReasoning",descKey:"models.tierReasoningDesc"},{key:"action",labelKey:"models.tierAction",descKey:"models.tierActionDesc"}],N=[{key:"imageGeneration",label:"图片生成"},{key:"imageUnderstanding",label:"图片理解"},{key:"fileUnderstanding",label:"文件理解"},{key:"audio",label:"音频能力"},{key:"video",label:"视频能力"}];function U(){let e=(0,r.Vr)(),{message:l}=i.A.useApp(),[s,U]=(0,a.useState)(!0),[_,O]=(0,a.useState)([]),[R,F]=(0,a.useState)(null),[H,D]=(0,a.useState)({provider:"transformers-local",model:"BAAI/bge-small-zh-v1.5",dimensions:512}),[W,M]=(0,a.useState)(!1),[G,L]=(0,a.useState)(!1),[X,Z]=(0,a.useState)(null),[V,q]=(0,a.useState)(null),[J,Q]=(0,a.useState)({}),[Y,$]=(0,a.useState)(!1),[ee,el]=(0,a.useState)(!1),[es,eo]=(0,a.useState)(""),[ea,er]=(0,a.useState)(""),[ei,et]=(0,a.useState)(""),[en,ec]=(0,a.useState)(""),[ed,em]=(0,a.useState)("openai"),[eh,ep]=(0,a.useState)(!1),[ex,ey]=(0,a.useState)({}),[ev,eu]=(0,a.useState)(!1),ej=async()=>{U(!0);try{let[e,l,s]=await Promise.all([(0,K.Z3)().catch(()=>[]),(0,K.zr)().catch(()=>null),(0,K.II)().catch(()=>({provider:"transformers-local",model:"BAAI/bge-small-zh-v1.5",dimensions:512}))]);O(e),F(l),D(s)}catch(s){l.error(e("common.error"))}finally{U(!1)}};(0,a.useEffect)(()=>{ej()},[]);let eg=async e=>{el(!0),eo(e.name),er(e.name),et(""),ec(e.baseUrl||""),em(e.protocol||e.detectedProtocol||"openai"),ey(e.capabilities||{});try{let l=await (0,K.Bh)(e.name);et(l.apiKey?"••••••••":""),ec(l.baseUrl||""),ey(l.capabilities||{})}catch(e){}$(!0)},eA=async()=>{if(ea.trim()){eu(!0);try{let s=ee&&ei.includes("•")?void 0:ei||void 0;await (0,K._m)(ea.trim(),{oldName:ee?es:void 0,apiKey:s,baseUrl:en||void 0,protocol:ed,directEndpoint:eh,capabilities:ex}),$(!1),await ej(),l.success(e("common.success"))}catch(s){l.error(e("common.error"))}finally{eu(!1)}}},ef=async s=>{try{await (0,K.h1)(s),await ej(),l.success(e("common.success"))}catch(s){l.error(e("common.error"))}},eb=async s=>{q(s);try{let o=await (0,K.bZ)(s);Q(e=>({...e,[s]:o.success})),l[o.success?"success":"error"](o.success?e("models.connected"):e("models.connectionFailed"))}catch(e){Q(e=>({...e,[s]:!1}))}finally{q(null)}},eS=async(s,o)=>{if(!R)return;let a={...R},r=a[s];if(!o){r.active="",F(a);try{await (0,K.aP)(a)}catch(s){l.error(e("common.error"))}return}let[i,t]=o.includes(":")?o.split(":"):[o,o];r.active=t,r.list.some(e=>e.name===t&&e.provider===i)||r.list.push({name:t,provider:i}),F(a);try{await (0,K.aP)(a)}catch(s){l.error(e("common.error"))}},ew=async()=>{M(!0);try{let s=await (0,K.dd)(H);D(s),Z(null),l.success(e("common.success"))}catch(s){l.error(e("common.error"))}finally{M(!1)}},ez=async()=>{L(!0);try{let s=await (0,K.u6)();Z(s.success),l[s.success?"success":"error"](s.message||(s.success?e("models.connected"):e("models.connectionFailed")))}catch(e){Z(!1)}finally{L(!1)}};return s?(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsx)(t.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,o.jsx)(n.A,{size:"small",children:(0,o.jsx)(t.A,{active:!0,paragraph:{rows:6}})}),(0,o.jsx)(n.A,{size:"small",children:(0,o.jsx)(t.A,{active:!0,paragraph:{rows:4}})}),(0,o.jsx)(n.A,{size:"small",children:(0,o.jsx)(t.A,{active:!0,paragraph:{rows:3}})})]}):(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("models.title")}),(0,o.jsx)("p",{className:"pageDesc",children:e("models.description")})]}),(0,o.jsx)(c.Ay,{type:"primary",icon:(0,o.jsx)(b.A,{}),onClick:()=>{el(!1),eo(""),er(""),et(""),ec(""),em("openai"),ep(!1),ey({}),$(!0)},children:e("models.addModel")})]}),(0,o.jsx)(n.A,{size:"small",title:"".concat(e("models.modelList")," (").concat(_.length,")"),children:0===_.length?(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:e("models.noProviders")}):(0,o.jsx)(d.A,{gutter:[12,12],children:_.map((l,s)=>(0,o.jsx)(m.A,{xs:24,sm:12,lg:8,xl:6,children:(0,o.jsxs)(n.A,{size:"small",hoverable:!0,style:{height:"100%"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:8,minWidth:0},children:[(0,o.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,o.jsx)("div",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.name}),(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,o.jsx)(S.A,{})," ",l.protocol||l.detectedProtocol||"openai"]})]}),(0,o.jsxs)(h.A,{size:2,children:[(0,o.jsx)(c.Ay,{size:"small",loading:V===l.name,onClick:()=>{eb(l.name)},icon:!0===J[l.name]?(0,o.jsx)(w.A,{style:{color:"var(--colorOk)"}}):!1===J[l.name]?(0,o.jsx)(z.A,{style:{color:"var(--colorDanger)"}}):(0,o.jsx)(k.A,{})}),(0,o.jsx)(c.Ay,{size:"small",icon:(0,o.jsx)(C.A,{}),onClick:()=>{eg(l)}}),(0,o.jsx)(p.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{ef(l.name)},children:(0,o.jsx)(c.Ay,{size:"small",danger:!0,icon:(0,o.jsx)(B.A,{})})})]})]}),(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,o.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,o.jsx)(I.A,{})," ",l.hasApiKey?"••••••••":"—"]}),l.baseUrl&&(0,o.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:l.baseUrl,children:[(0,o.jsx)(T.A,{})," ",l.baseUrl]}),(0,o.jsx)(h.A,{size:4,wrap:!0,children:N.filter(e=>{var s;return null==(s=l.capabilities)?void 0:s[e.key]}).map(e=>(0,o.jsx)(x.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.label},e.key))})]})]})},l.name))})}),(0,o.jsxs)(n.A,{size:"small",title:e("models.embeddingConfig"),children:[(0,o.jsx)(y.A,{type:"info",showIcon:!0,message:e("models.embeddingHint"),style:{marginBottom:16}}),(0,o.jsxs)(d.A,{gutter:[12,12],children:[(0,o.jsxs)(m.A,{xs:24,sm:8,children:[(0,o.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:e("models.embeddingProvider")}),(0,o.jsx)(v.A,{value:H.provider,style:{width:"100%"},options:[{label:"本地语义模型(推荐)",value:"transformers-local"},{label:"外部 Embedding(高级)",value:"openai-compatible"}],onChange:e=>D(l=>({...l,provider:e,model:"transformers-local"===e?l.model||"BAAI/bge-small-zh-v1.5":l.model,dimensions:"transformers-local"===e?512:l.dimensions||1024}))})]}),"openai-compatible"===H.provider&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(m.A,{xs:24,sm:8,children:[(0,o.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:"Base URL"}),(0,o.jsx)(u.A,{value:H.baseUrl,onChange:e=>D(l=>({...l,baseUrl:e.target.value})),placeholder:"http://localhost:11434/v1"})]}),(0,o.jsxs)(m.A,{xs:24,sm:8,children:[(0,o.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:e("models.model")}),(0,o.jsx)(u.A,{value:H.model,onChange:e=>D(l=>({...l,model:e.target.value})),placeholder:"bge-m3"})]}),(0,o.jsxs)(m.A,{xs:24,sm:8,children:[(0,o.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:e("models.apiKey")}),(0,o.jsx)(u.A.Password,{value:H.apiKey,onFocus:()=>{var e;(null==(e=H.apiKey)?void 0:e.includes("•"))&&D(e=>({...e,apiKey:""}))},onChange:e=>D(l=>({...l,apiKey:e.target.value})),placeholder:e("models.optional")}),H.hasApiKey&&(0,o.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginTop:4},children:e("models.embeddingApiKeyHint")})]})]}),"transformers-local"===H.provider&&(0,o.jsxs)(m.A,{xs:24,sm:8,children:[(0,o.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:e("models.model")}),(0,o.jsx)(u.A,{value:H.model,onChange:e=>D(l=>({...l,model:e.target.value})),placeholder:"BAAI/bge-small-zh-v1.5"})]}),(0,o.jsxs)(m.A,{xs:24,sm:8,children:[(0,o.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:e("models.dimensions")}),(0,o.jsx)(j.A,{style:{width:"100%"},min:1,value:H.dimensions,onChange:e=>D(l=>({...l,dimensions:Number(e||("transformers-local"===l.provider?512:1024))}))})]}),(0,o.jsxs)(m.A,{xs:24,sm:8,children:[(0,o.jsx)("div",{style:{fontSize:12,marginBottom:4,color:"var(--colorTextSecondary)"},children:e("models.status")}),(0,o.jsxs)(h.A,{children:[(0,o.jsx)(x.A,{color:"blue",children:"transformers-local"===H.provider?"本地语义模型":e("models.openAICompatible")}),!0===X&&(0,o.jsx)(x.A,{color:"success",children:e("models.connected")}),!1===X&&(0,o.jsx)(x.A,{color:"error",children:e("models.connectionFailed")})]})]})]}),(0,o.jsxs)(h.A,{style:{marginTop:16},children:[(0,o.jsx)(c.Ay,{type:"primary",loading:W,onClick:()=>{ew()},children:e("models.saveEmbedding")}),(0,o.jsx)(c.Ay,{loading:G,onClick:()=>{ez()},children:e("models.testEmbedding")})]})]}),R&&(0,o.jsx)(n.A,{size:"small",title:e("models.modelTiers"),children:(0,o.jsx)(d.A,{gutter:[12,12],children:E.map(l=>{let{key:s,labelKey:a,descKey:r}=l,i=R[s],t=i.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),c=_.filter(e=>!i.list.some(l=>l.provider===e.name)).map(e=>({label:e.name,value:"".concat(e.name,":").concat(e.name)})),d=i.active?i.list.find(e=>e.name===i.active):null;return(0,o.jsx)(m.A,{xs:24,lg:8,children:(0,o.jsxs)(n.A,{size:"small",title:(0,o.jsx)("span",{style:{fontSize:14},children:e(a)}),style:{height:"100%"},children:[(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8,lineHeight:1.5},children:e(r)}),(0,o.jsx)(v.A,{value:i.active?"".concat((null==d?void 0:d.provider)||"",":").concat(i.active):void 0,onChange:e=>{eS(s,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),style:{width:"100%"},options:[...t,...c]}),d&&(()=>{let e=_.find(e=>e.name===d.provider);return(0,o.jsxs)("div",{style:{marginTop:12,padding:"8px 12px",background:"var(--colorBgElevated)",borderRadius:6,border:"1px solid var(--colorBorderSecondary)",display:"flex",alignItems:"center",gap:8},children:[(0,o.jsx)(k.A,{style:{color:"var(--colorAccent)",fontSize:14,flexShrink:0}}),(0,o.jsx)("span",{style:{fontSize:12,fontWeight:500,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.provider}),(null==e?void 0:e.capabilities)&&N.filter(l=>e.capabilities[l.key]).length>0&&(0,o.jsx)(h.A,{size:4,wrap:!0,style:{flexShrink:0},children:N.filter(l=>e.capabilities[l.key]).slice(0,2).map(e=>(0,o.jsx)(x.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.label},e.key))}),(0,o.jsx)(x.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"18px",flexShrink:0},children:"激活"})]})})()]})},s)})})}),(0,o.jsx)(g.A,{title:ee?e("models.editModel"):e("models.addModel"),open:Y,onClose:()=>$(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,o.jsx)(c.Ay,{type:"primary",loading:ev,onClick:()=>{eA()},children:e("common.save")}),children:(0,o.jsxs)(A.A,{layout:"vertical",children:[(0,o.jsx)(A.A.Item,{label:e("models.modelName"),children:(0,o.jsx)(u.A,{value:ea,onChange:e=>er(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,o.jsx)(A.A.Item,{label:e("models.apiKey"),help:ee?e("models.apiKeyEditHint"):void 0,children:(0,o.jsx)(u.A.Password,{value:ei,onFocus:()=>{ee&&ei.includes("•")&&et("")},onChange:e=>et(e.target.value),placeholder:ee?e("models.apiKeyEditPlaceholder"):"sk-..."})}),(0,o.jsx)(A.A.Item,{label:e("models.baseUrl"),children:(0,o.jsx)(u.A,{value:en,onChange:e=>ec(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,o.jsx)(A.A.Item,{label:e("models.protocol"),children:(0,o.jsx)(v.A,{value:ed,onChange:em,options:P})}),(0,o.jsx)(A.A.Item,{label:"直连端点",children:(0,o.jsx)(f.A,{checked:eh,onChange:e=>ep(e.target.checked),children:"Base URL 是完整接口地址"})}),(0,o.jsx)(A.A.Item,{label:"多模态能力",children:(0,o.jsx)(f.A.Group,{value:N.filter(e=>ex[e.key]).map(e=>e.key),options:N.map(e=>({label:e.label,value:e.key})),onChange:e=>ey(Object.fromEntries(N.map(l=>[l.key,e.includes(l.key)])))})})]})})]})}},77305:(e,l,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return s(22708)}])}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,9144,6985,3455,4052,5938,9773,6578,636,6593,8792],()=>e(e.s=77305)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1026],{12887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},23830:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z"}}]},name:"folder",theme:"outlined"}},26631:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var o=r(97109),i=r(12887),n=r(88483);function a(){return(a=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 l=o.forwardRef((e,t)=>o.createElement(n.A,a({},e,{ref:t,icon:i.A})))},27549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(34508)}])},29606:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var o=r(97109),i=r(23830),n=r(88483);function a(){return(a=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 l=o.forwardRef((e,t)=>o.createElement(n.A,a({},e,{ref:t,icon:i.A})))},34508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>H});var o=r(65321),i=r(97109),n=r(32620),a=r(17807),l=r(88762),s=r(68787),c=r(33442),d=r(11702),p=r(57271),h=r(85114),m=r(84253),u=r(56985),f=r(26171),y=r(34052),x=r(7576),g=r(29606),j=r(54746),v=r(26631),w=r(99650),A=r(58209);async function S(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function b(e,t,r){let o=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t,name:r})});if(!o.ok)throw Error("Failed");return o.json()}async function z(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function C(e,t){let r=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function T(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 O(e){return e.id.startsWith("builtin:")}function k(e){return e.id.startsWith("custom:")}function H(){let e=(0,n.Vr)(),{message:t}=a.A.useApp(),[r,H]=(0,i.useState)(!0),[N,E]=(0,i.useState)([]),[F,P]=(0,i.useState)(!1),[R,_]=(0,i.useState)(null),[B,M]=(0,i.useState)(""),[I,V]=(0,i.useState)(""),[W,J]=(0,i.useState)(!1),[L,D]=(0,i.useState)(!1),[U,X]=(0,i.useState)("custom"),Z=async()=>{H(!0);try{E(await S())}catch(r){t.error(e("common.error"))}finally{H(!1)}};(0,i.useEffect)(()=>{Z()},[]);let $=r=>{if(null==r?void 0:r.projectRoot)return void z(r.projectRoot).then(()=>{t.success(e("common.success")),Z()}).catch(()=>t.error(e("common.error")));_(null),D(!0),V(""),M(""),P(!0)},q=async()=>{if(!I.trim())return void t.error("请输入名称");J(!0);try{R?await b(R.customizePath,B,k(R)?I.trim():void 0):await C(I.trim(),B||"# ".concat(I.trim(),"\n")),t.success(e("common.success")),P(!1),await Z()}catch(r){t.error(e("common.error"))}finally{J(!1)}},G=async(r,o)=>{let i=o?Array.from(new Set([...N.filter(e=>e.selected).map(e=>e.id),r.id])):N.filter(e=>e.selected&&e.id!==r.id).map(e=>e.id);try{await T(i),E(e=>e.map(e=>({...e,selected:i.includes(e.id)})))}catch(r){t.error(e("common.error"))}},K=async r=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:r.projectId,filePath:r.customizePath})})).ok)throw Error("Failed");t.success(e("common.success")),await Z()}catch(r){t.error(e("common.error"))}},Q=N.find(e=>e.isCurrent),Y=N.filter(O),ee=N.filter(k),et=N.filter(e=>!O(e)&&!k(e)),er="all"===U?N:"builtin"===U?Y:"custom"===U?ee:et;return r?(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsx)(l.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:Array.from({length:4}).map((e,t)=>(0,o.jsx)(s.A,{size:"small",children:(0,o.jsx)(l.A,{active:!0,paragraph:{rows:4}})},t))})]}):(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.promptManagement")}),(0,o.jsx)("p",{className:"pageDesc",children:e("prompt.description")})]}),(0,o.jsxs)(c.A,{children:[Q&&(0,o.jsxs)(d.A,{color:"green",style:{lineHeight:"22px"},children:[(0,o.jsx)(g.A,{})," ",Q.projectRoot]}),(0,o.jsx)(p.A,{value:U,onChange:X,style:{width:160},options:[{label:"全部 (".concat(N.length,")"),value:"all"},{label:"我的提示词 (".concat(ee.length,")"),value:"custom"},{label:"项目提示词 (".concat(et.length,")"),value:"project"},{label:"内置示例 (".concat(Y.length,")"),value:"builtin"}]}),(0,o.jsx)(h.Ay,{type:"primary",icon:(0,o.jsx)(j.A,{}),onClick:()=>$(),children:"创建提示词"})]})]}),0===er.length?(0,o.jsx)(m.A,{description:e("prompt.noProjects")}):(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:er.map(e=>{let r=e.hasFile&&e.content?e.content.replace(/^#.*$/gm,"").replace(/\n{3,}/g,"\n\n").trim():"";return(0,o.jsxs)(s.A,{size:"small",hoverable:!0,styles:{body:{display:"flex",flexDirection:"column",height:"100%"}},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[(0,o.jsx)(v.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)",fontSize:14,flexShrink:0}}),(0,o.jsx)("span",{style:{fontWeight:600,fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.projectName}),!e.hasFile&&e.projectRoot&&(0,o.jsx)(h.Ay,{size:"small",icon:(0,o.jsx)(j.A,{}),onClick:()=>$(e)})]}),e.projectRoot&&(0,o.jsxs)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:6,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[(0,o.jsx)(g.A,{style:{marginRight:4}}),e.projectRoot]}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:[e.isCurrent&&(0,o.jsx)(d.A,{color:"green",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"当前项目"}),O(e)&&(0,o.jsx)(d.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"内置示例"}),k(e)&&(0,o.jsx)(d.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的提示词"}),!O(e)&&!k(e)&&(0,o.jsx)(d.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"项目提示词"}),e.selected&&(0,o.jsx)(d.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"已选中"}),e.hasFile?(0,o.jsx)(d.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"有文件"}):(0,o.jsx)(d.A,{color:"default",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"无文件"})]}),r&&(0,o.jsxs)("div",{style:{padding:8,background:"var(--colorFillAlter)",borderRadius:6,fontSize:11,maxHeight:80,overflow:"hidden",color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap",fontFamily:"monospace",marginBottom:8,lineHeight:1.5},children:[r.slice(0,180),r.length>180?"...":""]}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,paddingTop:8,borderTop:"1px solid var(--colorBorderSecondary)",marginTop:"auto"},children:[e.hasFile?(0,o.jsx)(u.A,{checked:e.selected,onChange:t=>{G(e,t.target.checked)},style:{fontSize:12},children:"选中"}):(0,o.jsx)("span",{}),(0,o.jsx)("div",{style:{flex:1}}),e.hasFile&&(0,o.jsx)(h.Ay,{size:"small",icon:(0,o.jsx)(w.A,{}),onClick:()=>(e=>{if(O(e)){_(null),D(!0),V(e.projectName.replace(/^内置|/,"")+" Copy"),M(e.content||""),P(!0),t.info("内置提示词不可直接编辑,已为你创建副本");return}_(e),D(!1),V(e.projectName),M(e.content||""),P(!0)})(e),children:O(e)?"复制":"编辑"}),(0,o.jsx)(f.A,{title:O(e)?"删除内置提示词?":k(e)?"删除自定义提示词?":"删除项目记录及文件?",disabled:O(e),onConfirm:()=>{K(e)},children:(0,o.jsx)(h.Ay,{size:"small",danger:!0,icon:(0,o.jsx)(A.A,{}),disabled:O(e)})})]})]},e.id)})}),(0,o.jsxs)(y.A,{title:L?"创建提示词":R&&k(R)?"编辑我的提示词 — ".concat(I||R.projectName):"编辑项目提示词 — ".concat((null==R?void 0:R.projectName)||""),open:F,onClose:()=>P(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,o.jsxs)(c.A,{children:[(0,o.jsx)(h.Ay,{onClick:()=>P(!1),children:e("common.cancel")}),(0,o.jsx)(h.Ay,{type:"primary",loading:W,onClick:()=>{q()},children:e("common.save")})]}),children:[(0,o.jsx)("div",{style:{marginBottom:12},children:L||R&&k(R)?(0,o.jsxs)(c.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,o.jsx)(x.A,{placeholder:"提示词名称",value:I,onChange:e=>V(e.target.value),style:{maxWidth:400}}),!L&&(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==R?void 0:R.customizePath})]}):(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==R?void 0:R.customizePath})}),(0,o.jsx)(x.A.TextArea,{value:B,onChange:e=>M(e.target.value),rows:25,style:{fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13}})]})]})}}},e=>{e.O(0,[347,8787,4277,7889,4833,7271,7576,9144,6985,4052,636,6593,8792],()=>e(e.s=27549)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[199],{2256:(e,l,t)=>{"use strict";t.d(l,{A:()=>s});let s=t(25341).A},7368:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>$});var s=t(65321),r=t(97109),i=t(32620),n=t(49759),o=t(88762),d=t(2256),a=t(38770),c=t(68787),x=t(11702),h=t(73340),u=t(1278);let y=(0,u.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 f=t(56733),p=t(38300);let v=(0,u.A)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);var g=t(87824);let m=(0,u.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(6578);let A=(e,l,t)=>(0,s.jsx)("div",{style:{width:32,height:32,borderRadius:8,background:l,display:"flex",alignItems:"center",justifyContent:"center",color:t,flexShrink:0},children:e});function $(){var e,l;let t=(0,i.Vr)("settings"),{theme:u,resolvedTheme:$,setTheme:b}=(0,n.D)(),{locale:S,setLocale:z}=(0,i.x_)(),[k,w]=(0,r.useState)(null),[E,C]=(0,r.useState)(null),[T,N]=(0,r.useState)(null),[M,B]=(0,r.useState)(!0);(0,r.useEffect)(()=>{B(!0),Promise.all([(0,j.FC)().catch(()=>null),(0,j.le)().catch(()=>null),(0,j.II)().catch(()=>null)]).then(e=>{let[l,t,s]=e;w(l),C(t),N(s)}).finally(()=>B(!1))},[]);let R="system"===u?"system":$,F=e=>"applePill".concat(e?" applePillActive":"");return M?(0,s.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,s.jsx)(o.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,s.jsxs)(d.A,{gutter:[16,16],children:[Array.from({length:4}).map((e,l)=>(0,s.jsx)(a.A,{xs:24,md:12,children:(0,s.jsx)(c.A,{size:"small",children:(0,s.jsx)(o.A,{active:!0,paragraph:{rows:2}})})},l)),(0,s.jsx)(a.A,{xs:24,children:(0,s.jsx)(c.A,{size:"small",children:(0,s.jsx)(o.A,{active:!0,paragraph:{rows:4}})})})]})]}):(0,s.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"pageTitle",children:t("title")}),(0,s.jsx)("p",{className:"pageDesc",children:t("description")})]}),(0,s.jsxs)(d.A,{gutter:[16,16],children:[(0,s.jsx)(a.A,{xs:24,md:12,style:{display:"flex"},children:(0,s.jsxs)(c.A,{size:"small",style:{flex:1},styles:{body:{padding:"14px 18px"}},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:14},children:[A((0,s.jsx)(h.A,{size:16}),"rgba(88,86,214,0.1)","#5856d6"),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontWeight:600,fontSize:14},children:t("language")}),(0,s.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:t("languageDesc")})]})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,s.jsx)("button",{className:F("zh-CN"===S),onClick:()=>z("zh-CN"),children:"中文"}),(0,s.jsx)("button",{className:F("en-US"===S),onClick:()=>z("en-US"),children:"English"})]})]})}),(0,s.jsx)(a.A,{xs:24,md:12,style:{display:"flex"},children:(0,s.jsxs)(c.A,{size:"small",style:{flex:1},styles:{body:{padding:"14px 18px"}},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:14},children:[A((0,s.jsx)(y,{size:16}),"rgba(250,140,22,0.1)","#fa8c16"),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontWeight:600,fontSize:14},children:t("theme")}),(0,s.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:t("themeDesc")})]})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,s.jsxs)("button",{className:F("light"===R),onClick:()=>b("light"),children:[(0,s.jsx)(f.A,{size:14}),t("light")]}),(0,s.jsxs)("button",{className:F("dark"===R),onClick:()=>b("dark"),children:[(0,s.jsx)(p.A,{size:14}),t("dark")]}),(0,s.jsxs)("button",{className:F("system"===R),onClick:()=>b("system"),children:[(0,s.jsx)(y,{size:14}),t("system")]})]})]})}),(0,s.jsx)(a.A,{xs:24,md:12,style:{display:"flex"},children:(0,s.jsxs)(c.A,{size:"small",style:{flex:1},styles:{body:{padding:"14px 18px"}},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:14},children:[A((0,s.jsx)(v,{size:16}),"rgba(22,119,255,0.1)","#1677ff"),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontWeight:600,fontSize:14},children:"服务运行状态"}),(0,s.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:"查看当前服务是否正常,以及本机资源占用情况。"})]})]}),(0,s.jsxs)(d.A,{gutter:[12,12],children:[(0,s.jsx)(a.A,{span:12,children:(0,s.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,s.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"状态"}),(0,s.jsx)(x.A,{color:(null==E?void 0:E.status)==="ok"?"success":"error",style:{margin:0},children:(null==E?void 0:E.status)==="ok"?"运行中":"—"})]})}),(0,s.jsx)(a.A,{span:12,children:(0,s.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,s.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"运行时间"}),(0,s.jsx)("div",{style:{fontSize:14,fontWeight:600},children:E?(e=>{let l=Math.floor(e/86400),t=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return l>0?"".concat(l," 天 ").concat(t," 小时"):t>0?"".concat(t," 小时 ").concat(s," 分"):"".concat(s," 分")})(E.uptime):"—"})]})}),(0,s.jsx)(a.A,{span:12,children:(0,s.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,s.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"CPU"}),(0,s.jsx)("div",{style:{fontSize:14,fontWeight:600},children:k?"".concat(k.cpu.usagePercent.toFixed(1),"%"):"—"}),(0,s.jsxs)("div",{style:{fontSize:10,color:"var(--colorTextSecondary)"},children:[null!=(e=null==k?void 0:k.cpu.cores)?e:0," 核"]})]})}),(0,s.jsx)(a.A,{span:12,children:(0,s.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,s.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"内存"}),(0,s.jsx)("div",{style:{fontSize:14,fontWeight:600},children:k?"".concat(k.memory.processMB," MB"):"—"}),(0,s.jsxs)("div",{style:{fontSize:10,color:"var(--colorTextSecondary)"},children:["/ ",null!=(l=null==k?void 0:k.memory.totalMB)?l:0," MB"]})]})})]})]})}),(0,s.jsx)(a.A,{xs:24,md:12,style:{display:"flex"},children:(0,s.jsxs)(c.A,{size:"small",style:{flex:1},styles:{body:{padding:"14px 18px"}},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:14},children:[A((0,s.jsx)(g.A,{size:16}),"rgba(82,196,26,0.1)","#52c41a"),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontWeight:600,fontSize:14},children:"知识库向量配置"}),(0,s.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:"用于知识库检索。修改模型或维度后,建议重新索引知识库。"})]})]}),(0,s.jsxs)(d.A,{gutter:[12,12],children:[(0,s.jsx)(a.A,{span:12,children:(0,s.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,s.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"供应商"}),(0,s.jsx)(x.A,{color:"blue",style:{margin:0},children:(null==T?void 0:T.provider)||"—"})]})}),(0,s.jsx)(a.A,{span:12,children:(0,s.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,s.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"密钥状态"}),(null==T?void 0:T.hasApiKey)?(0,s.jsx)(x.A,{color:"success",style:{margin:0},children:"已配置"}):(0,s.jsx)(x.A,{color:"default",style:{margin:0},children:"未配置"})]})}),(0,s.jsx)(a.A,{span:12,children:(0,s.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,s.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"模型"}),(0,s.jsx)("div",{style:{fontSize:12,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(null==T?void 0:T.model)||"—"})]})}),(0,s.jsx)(a.A,{span:12,children:(0,s.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"10px 12px",textAlign:"left"},children:[(0,s.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:4},children:"维度"}),(0,s.jsx)("div",{style:{fontSize:14,fontWeight:600},children:(null==T?void 0:T.dimensions)?"".concat(T.dimensions):"—"})]})})]})]})}),(0,s.jsx)(a.A,{xs:24,children:(0,s.jsxs)(c.A,{size:"small",styles:{body:{padding:"14px 18px"}},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:14},children:[A((0,s.jsx)(m,{size:16}),"rgba(114,46,209,0.1)","#722ed1"),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontWeight:600,fontSize:14},children:"本地数据与使用概况"}),(0,s.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:"用户数据保存在本机,包含知识库、提示词、角色配置、规范包、生成记录和日志。"})]})]}),(0,s.jsx)(d.A,{gutter:[8,8],children:[{label:"用户数据目录",value:"~/.customize-agent/",mono:!0},{label:"知识库数据",value:"本地索引与向量库"},{label:"生成记录",value:"草稿、导出和资源"},{label:"配置数据",value:"提示词、角色、规范包"},{label:"累计任务",value:k?k.tasks.total.toLocaleString():"—"},{label:"Token 用量",value:k?k.tokens.total.toLocaleString():"—"},{label:"日志",value:"本地运行日志"},{label:"数据范围",value:"仅保存在本机"}].map(e=>(0,s.jsx)(a.A,{xs:12,sm:6,children:(0,s.jsxs)("div",{style:{background:"var(--colorFillAlter)",borderRadius:8,padding:"8px 12px"},children:[(0,s.jsx)("div",{style:{fontSize:11,color:"var(--colorTextSecondary)",marginBottom:2},children:e.label}),(0,s.jsx)("div",{style:{fontSize:13,fontWeight:600,fontFamily:e.mono?"monospace":void 0},children:e.value})]})},e.label))})]})})]})]})}},15033:(e,l,t)=>{"use strict";t.d(l,{A:()=>s});let s=(0,t(97109).createContext)({})},19013:(e,l,t)=>{"use strict";t.d(l,{C:()=>r});var s=t(97109);let r=()=>s.useReducer(e=>e+1,0)},19135:(e,l,t)=>{"use strict";t.d(l,{Ay:()=>a,Gl:()=>o,ko:()=>d,ye:()=>n});var s=t(97109),r=t(7709),i=t(26047);let n=["xxxl","xxl","xl","lg","md","sm","xs"],o=[].concat(n).reverse(),d=(e,l)=>{if(l){for(let t of n)if(e[t]&&l?.[t]!==void 0)return l[t]}},a=()=>{let[,e]=(0,r.Ay)(),l=(e=>({xs:`(max-width: ${e.screenXSMax}px)`,sm:`(min-width: ${e.screenSM}px)`,md:`(min-width: ${e.screenMD}px)`,lg:`(min-width: ${e.screenLG}px)`,xl:`(min-width: ${e.screenXL}px)`,xxl:`(min-width: ${e.screenXXL}px)`,xxxl:`(min-width: ${e.screenXXXL}px)`}))((e=>{let l=[].concat(n).reverse();return l.forEach((t,s)=>{let r=t.toUpperCase(),i=`screen${r}Min`,n=`screen${r}`;if(!(e[i]<=e[n]))throw Error(`${i}<=${n} fails : !(${e[i]}<=${e[n]})`);if(s<l.length-1){let t=`screen${r}Max`;if(!(e[n]<=e[t]))throw Error(`${n}<=${t} fails : !(${e[n]}<=${e[t]})`);let i=l[s+1].toUpperCase(),o=`screen${i}Min`;if(!(e[t]<=e[o]))throw Error(`${t}<=${o} fails : !(${e[t]}<=${e[o]})`)}}),e})(e));return s.useMemo(()=>{let e=new Map,t=-1,s={};return{responsiveMap:l,matchHandlers:{},dispatch:l=>(s=l,e.forEach(e=>{e(s)}),e.size>=1),subscribe(l){return e.size||this.register(),t+=1,e.set(t,l),l(s),t},unsubscribe(l){e.delete(l),e.size||this.unregister()},register(){Object.entries(l).forEach(([e,l])=>{let t=({matches:l})=>{this.dispatch({...s,[e]:l})},r=window.matchMedia(l);(0,i.Tn)(r.addEventListener)&&r.addEventListener("change",t),this.matchHandlers[l]={mql:r,listener:t},t(r)})},unregister(){Object.values(l).forEach(e=>{let l=this.matchHandlers[e];(0,i.Tn)(l?.mql.removeEventListener)&&l.mql.removeEventListener("change",l?.listener)}),e.clear()}}},[l])}},25341:(e,l,t)=>{"use strict";t.d(l,{A:()=>h});var s=t(97109),r=t(3638),i=t(26047),n=t(19135),o=t(74567),d=t(59609),a=t(15033),c=t(84060);let x=(e,l)=>{let[t,r]=s.useState(()=>(0,i.Kg)(e)?e:"");return s.useEffect(()=>{(()=>{if((0,i.Kg)(e)&&r(e),(0,i.Qd)(e))for(let t=0;t<n.ye.length;t++){let s=n.ye[t];if(!l||!l[s])continue;let i=e[s];if(void 0!==i)return void r(i)}})()},[JSON.stringify(e),l]),t},h=s.forwardRef((e,l)=>{let{prefixCls:t,justify:h,align:u,className:y,style:f,children:p,gutter:v=0,wrap:g,...m}=e,{getPrefixCls:j,direction:A}=s.useContext(o.QO),$=(0,d.A)(!0,null),b=x(u,$),S=x(h,$),z=j("row",t),[k,w]=(0,c.L3)(z),E=function(e,l){let t=[void 0,void 0],s=Array.isArray(e)?e:[e,void 0],r=l||{xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0,xxxl:!0};return s.forEach((e,l)=>{if((0,i.Qd)(e))for(let s=0;s<n.ye.length;s++){let i=n.ye[s];if(r[i]&&void 0!==e[i]){t[l]=e[i];break}}else t[l]=e}),t}(v,$),C=(0,r.$)(z,{[`${z}-no-wrap`]:!1===g,[`${z}-${S}`]:S,[`${z}-${b}`]:b,[`${z}-rtl`]:"rtl"===A},y,k,w),T={};E?.[0]&&(T.marginInline=(0,i.Et)(E[0])?`${-(E[0]/2)}px`:`calc(${E[0]} / -2)`);let[N,M]=E;T.rowGap=M;let B=s.useMemo(()=>({gutter:[N,M],wrap:g}),[N,M,g]);return s.createElement(a.A.Provider,{value:B},s.createElement("div",{...m,className:C,style:{...T,...f},ref:l},p))})},38770:(e,l,t)=>{"use strict";t.d(l,{A:()=>s});let s=t(51916).A},51916:(e,l,t)=>{"use strict";t.d(l,{A:()=>h});var s=t(97109),r=t(3638),i=t(26047),n=t(19135),o=t(74567),d=t(10540),a=t(15033),c=t(84060);function x(e){return"auto"===e?"1 1 auto":(0,i.Et)(e)?`${e} ${e} auto`:/^\d+(\.\d+)?(px|em|rem|%)$/.test(e)?`0 0 ${e}`:e}let h=s.forwardRef((e,l)=>{let{getPrefixCls:t,direction:h}=s.useContext(o.QO),{gutter:u,wrap:y}=s.useContext(a.A),{prefixCls:f,span:p,order:v,offset:g,push:m,pull:j,className:A,children:$,flex:b,style:S,...z}=e,k=t("col",f),w=t(),[E,C]=(0,c.xV)(k),[T]=(0,d.PN)(w,"col"),N={},M={};n.Gl.forEach(l=>{let t={},s=e[l];(0,i.Et)(s)?t.span=s:(0,i.Qd)(s)&&(t=s||{}),delete z[l],M={...M,[`${k}-${l}-${t.span}`]:(0,i.R)(t.span),[`${k}-${l}-order-${t.order}`]:t.order||0===t.order,[`${k}-${l}-offset-${t.offset}`]:t.offset||0===t.offset,[`${k}-${l}-push-${t.push}`]:t.push||0===t.push,[`${k}-${l}-pull-${t.pull}`]:t.pull||0===t.pull,[`${k}-rtl`]:"rtl"===h},t.flex&&(M[`${k}-${l}-flex`]=!0,N[T(`${l}-flex`)]=x(t.flex))});let B=(0,r.$)(k,{[`${k}-${p}`]:void 0!==p,[`${k}-order-${v}`]:v,[`${k}-offset-${g}`]:g,[`${k}-push-${m}`]:m,[`${k}-pull-${j}`]:j},A,M,E,C),R={};return u?.[0]&&(R.paddingInline=(0,i.Et)(u[0])?`${u[0]/2}px`:`calc(${u[0]} / 2)`),b&&(R.flex=x(b),!1!==y||R.minWidth||(R.minWidth=0)),s.createElement("div",{...z,style:{...R,...S,...N},className:B,ref:l},$)})},58451:(e,l,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/settings",function(){return t(7368)}])},59609:(e,l,t)=>{"use strict";t.d(l,{A:()=>o});var s=t(97109),r=t(82813),i=t(19013),n=t(19135);let o=function(e=!0,l={}){let t=(0,s.useRef)(l),[,o]=(0,i.C)(),d=(0,n.Ay)();return(0,r.Nf)(()=>{let l=d.subscribe(l=>{t.current=l,e&&o()});return()=>d.unsubscribe(l)},[]),t.current}}},e=>{e.O(0,[347,8787,6578,636,6593,8792],()=>e(e.s=58451)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3979],{14995:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"}},39214:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/system/logs",function(){return r(91698)}])},91698:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>k});var a=r(65321),s=r(97109),i=r(35292),n=r(9137),l=r(11702),o=r(88762),c=r(33442),d=r(85114),h=r(26171),p=r(85493),g=r(7576),u=r(21289),x=r(84253),f=r(99811),y=r(58209),m=r(96651),w=r(60470),j=r(32620),v=r(6578);let{Text:A,Paragraph:b}=i.A;function k(){let e=(0,j.Vr)(),[t,r]=(0,s.useState)([]),[i,k]=(0,s.useState)(!0),[S,z]=(0,s.useState)(""),[I,C]=(0,s.useState)(!1),N=async()=>{k(!0);try{r((await (0,v.oH)(500)).logs)}catch(e){n.Ay.error(e instanceof Error?e.message:"加载日志失败")}finally{k(!1)}};(0,s.useEffect)(()=>{N()},[]);let B=(0,s.useMemo)(()=>{let e=S.trim().toLowerCase();return e?t.filter(t=>[t.id,t.level,t.source,t.functionName,t.message,t.stack].filter(Boolean).some(t=>String(t).toLowerCase().includes(e))):t},[S,t]),O=[{title:"序号",key:"index",width:70,render:(e,t,r)=>r+1},{title:"时间",dataIndex:"createdAt",width:170,render:e=>new Date(e).toLocaleString()},{title:"级别",dataIndex:"level",width:80,render:e=>(0,a.jsx)(l.A,{color:"error"===e?"error":"warn"===e?"warning":"blue",style:{margin:0},children:e})},{title:"来源",dataIndex:"source",width:200,render:e=>(0,a.jsx)(A,{code:!0,style:{fontSize:12},children:e})},{title:"函数",dataIndex:"functionName",width:160,render:e=>e?(0,a.jsx)(A,{code:!0,style:{fontSize:12},children:e}):(0,a.jsx)(A,{type:"secondary",children:"-"})},{title:"错误信息",dataIndex:"message",render:e=>(0,a.jsx)(b,{style:{maxWidth:480,overflowWrap:"anywhere",wordBreak:"break-all",marginBottom:0,fontSize:12},ellipsis:{rows:2,expandable:!0,symbol:"展开"},children:e})},{title:"Request ID",dataIndex:"id",width:200,render:e=>(0,a.jsx)(A,{copyable:!0,code:!0,style:{fontSize:12},children:e.slice(0,8)})}];return i&&0===t.length?(0,a.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,a.jsx)(o.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,a.jsx)(o.A,{active:!0,paragraph:{rows:12}})]}):(0,a.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle",children:e("nav.systemLogs")}),(0,a.jsx)("p",{className:"pageDesc",children:"查看 API 异常、模型健康检查失败、PDF 降级等运行时问题。"})]}),(0,a.jsxs)(c.A,{children:[(0,a.jsx)(d.Ay,{icon:(0,a.jsx)(f.A,{}),loading:i,onClick:()=>void N(),children:"刷新"}),(0,a.jsx)(h.A,{title:"确认清空所有错误日志?",onConfirm:()=>{(async()=>{await (0,v.hH)(),n.Ay.success("已清空"),await N()})()},children:(0,a.jsx)(d.Ay,{danger:!0,icon:(0,a.jsx)(y.A,{}),children:"清空日志"})})]})]}),(0,a.jsx)(p.A,{type:"info",showIcon:!0,message:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,a.jsx)("span",{children:"日志保存在本机 ~/.customize-agent/logs/errors.jsonl,最多读取最近 500 条。"}),(0,a.jsx)(d.Ay,{type:"link",size:"small",icon:I?(0,a.jsx)(m.A,{}):(0,a.jsx)(w.A,{}),onClick:()=>C(!I),style:{padding:"0 4px"},children:I?"收起":"展开"})]}),description:I?"系统自动记录未捕获的异常、API 错误、模型健康检查失败等运行时问题。日志文件超过 2MB 会自动轮转。":void 0}),(0,a.jsx)(g.A.Search,{allowClear:!0,placeholder:"搜索 requestId / source / function / message / stack",value:S,onChange:e=>z(e.target.value),style:{maxWidth:480}}),(0,a.jsx)(u.A,{rowKey:"id",loading:i,dataSource:B,columns:O,size:"middle",locale:{emptyText:(0,a.jsx)(x.A,{description:"暂无错误日志"})},pagination:{pageSize:20,showSizeChanger:!0,showTotal:e=>"共 ".concat(e," 条")},expandable:{expandedRowRender:e=>(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:"8px 0"},children:[e.request&&(0,a.jsxs)("div",{children:[(0,a.jsx)(A,{strong:!0,style:{fontSize:12,marginBottom:4,display:"block"},children:"Request"}),(0,a.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0,padding:10,background:"var(--colorFillAlter)",borderRadius:8,fontSize:12,lineHeight:1.5},children:JSON.stringify(e.request,null,2)})]}),void 0!==e.meta&&(0,a.jsxs)("div",{children:[(0,a.jsx)(A,{strong:!0,style:{fontSize:12,marginBottom:4,display:"block"},children:"Meta"}),(0,a.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0,padding:10,background:"var(--colorFillAlter)",borderRadius:8,fontSize:12,lineHeight:1.5},children:JSON.stringify(e.meta,null,2)})]}),e.stack&&(0,a.jsxs)("div",{children:[(0,a.jsx)(A,{strong:!0,style:{fontSize:12,marginBottom:4,display:"block"},children:"Stack"}),(0,a.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0,padding:10,background:"var(--colorFillAlter)",borderRadius:8,fontSize:12,lineHeight:1.5,maxHeight:300,overflow:"auto"},children:e.stack})]})]})}})]})}},92123:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"}},96651:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var a=r(97109),s=r(92123),i=r(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}let l=a.forwardRef((e,t)=>a.createElement(i.A,n({},e,{ref:t,icon:s.A})))},99811:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var a=r(97109),s=r(14995),i=r(88483);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}let l=a.forwardRef((e,t)=>a.createElement(i.A,n({},e,{ref:t,icon:s.A})))}},e=>{e.O(0,[347,4277,7889,4833,7271,7576,2884,9144,9189,6985,7150,5292,1289,861,6578,636,6593,8792],()=>e(e.s=39214)),_N_E=e.O()}]);
|
|
File without changes
|