@customize-agent/server 3.0.13 → 3.0.15
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 +210 -193
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.json +14 -0
- package/.next/routes-manifest.json +29 -14
- package/.next/server/chunks/3328.js +128 -0
- package/.next/server/chunks/3445.js +109 -61
- package/.next/server/chunks/{5076.js → 774.js} +25 -25
- package/.next/server/chunks/8204.js +1 -1
- package/.next/server/chunks/8645.js +1 -0
- package/.next/server/chunks/9199.js +2 -2
- package/.next/server/chunks/9270.js +1 -1
- package/.next/server/chunks/9301.js +2 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/_app.js +1 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js +1 -1
- package/.next/server/pages/_document.js.nft.json +1 -1
- package/.next/server/pages/_error.js +1 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/api/assets/generated/preview.js +1 -0
- package/.next/server/pages/api/assets/generated/preview.js.nft.json +1 -0
- package/.next/server/pages/api/assets/generated.js +1 -0
- package/.next/server/pages/api/assets/generated.js.nft.json +1 -0
- package/.next/server/pages/api/config/providers/[provider].js +1 -1
- package/.next/server/pages/api/config/providers.js +1 -1
- package/.next/server/pages/api/documents/chapter/regenerate.js +1 -1
- package/.next/server/pages/api/documents/chapter/regenerate.js.nft.json +1 -1
- package/.next/server/pages/api/documents/export.js +14 -1
- package/.next/server/pages/api/documents/export.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generate.js +1 -1
- package/.next/server/pages/api/documents/generate.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id].js +1 -0
- package/.next/server/pages/api/documents/generated/[id].js.nft.json +1 -0
- package/.next/server/pages/api/documents/generated.js +1 -0
- package/.next/server/pages/api/documents/generated.js.nft.json +1 -0
- package/.next/server/pages/api/documents/roles.js +1 -1
- package/.next/server/pages/api/documents/specs.js +1 -1
- package/.next/server/pages/api/documents/templates.js +1 -1
- package/.next/server/pages/api/documents/templates.js.nft.json +1 -1
- package/.next/server/pages/api/kb/categories.js +1 -56
- package/.next/server/pages/api/kb/categories.js.nft.json +1 -1
- package/.next/server/pages/api/kb/duplicates.js +1 -56
- package/.next/server/pages/api/kb/duplicates.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/detail.js +3 -56
- package/.next/server/pages/api/kb/files/detail.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/open.js +1 -56
- package/.next/server/pages/api/kb/files/open.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/preview-pdf-page.js +1 -56
- package/.next/server/pages/api/kb/files/preview-pdf-page.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files/reindex.js +1 -56
- package/.next/server/pages/api/kb/files/reindex.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files.js +1 -56
- package/.next/server/pages/api/kb/files.js.nft.json +1 -1
- package/.next/server/pages/api/kb/ignore.js +1 -56
- package/.next/server/pages/api/kb/ignore.js.nft.json +1 -1
- package/.next/server/pages/api/kb/operations.js +1 -56
- package/.next/server/pages/api/kb/operations.js.nft.json +1 -1
- package/.next/server/pages/api/kb/reindex.js +1 -56
- package/.next/server/pages/api/kb/reindex.js.nft.json +1 -1
- package/.next/server/pages/api/kb/search.js +1 -56
- package/.next/server/pages/api/kb/search.js.nft.json +1 -1
- package/.next/server/pages/api/kb/stats.js +1 -56
- package/.next/server/pages/api/kb/stats.js.nft.json +1 -1
- package/.next/server/pages/api/kb/tags.js +1 -56
- package/.next/server/pages/api/kb/tags.js.nft.json +1 -1
- package/.next/server/pages/api/kb/upload.js +1 -56
- package/.next/server/pages/api/kb/upload.js.nft.json +1 -1
- package/.next/server/pages/api/prompt.js +1 -1
- package/.next/server/pages/asset-library.html +1 -0
- package/.next/server/pages/asset-library.js.nft.json +1 -0
- 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-manifest.json +27 -22
- package/.next/static/chunks/15-4683808cb8db7005.js +4 -0
- package/.next/static/chunks/167-d4f384b289ecb70c.js +1 -0
- package/.next/static/chunks/174-51b6d64f21e9b976.js +10 -0
- package/.next/static/chunks/183-8da0232dd30cdc81.js +1 -0
- package/.next/static/chunks/20-8968ee2d4013a5b8.js +1 -0
- package/.next/static/chunks/224-9a7074031493793b.js +1 -0
- package/.next/static/chunks/232-813af4932a145fdc.js +6 -0
- package/.next/static/chunks/257-e4ebae17a8ee8412.js +1 -0
- package/.next/static/chunks/260-cec84dc6c353e104.js +28 -0
- package/.next/static/chunks/271-39045be4cdbd6af1.js +16 -0
- package/.next/static/chunks/292-f0a2c92861c304e6.js +16 -0
- package/.next/static/chunks/350-8c5e13c0577a38c3.js +1 -0
- package/.next/static/chunks/382-6ab5f41cd91edad0.js +25 -0
- package/.next/static/chunks/400-1fa1899b7c3f0bb4.js +78 -0
- package/.next/static/chunks/576-fd55b302cb0c9a48.js +4 -0
- package/.next/static/chunks/577-5b2691f0c8f17187.js +1 -0
- package/.next/static/chunks/617-68a9e848c380f9c3.js +1 -0
- package/.next/static/chunks/628-27424ba8ca9ca8ce.js +1 -0
- package/.next/static/chunks/700-5d29b0475311f590.js +1 -0
- package/.next/static/chunks/80-96429163e5c103a8.js +1 -0
- package/.next/static/chunks/858-5e6982e2b239d4b7.js +1 -0
- package/.next/static/chunks/881-a1eb917222b66f09.js +4 -0
- package/.next/static/chunks/935-daa0026982d7fa8d.js +1 -0
- package/.next/static/chunks/951-8ecf8af33ab36369.js +1 -0
- package/.next/static/chunks/969-5d5ff5a3ed74f52b.js +11 -0
- package/.next/static/chunks/985-4b4a3ed36ada16eb.js +4 -0
- package/.next/static/chunks/framework-161be364fd69a7ce.js +1 -0
- package/.next/static/chunks/main-ed4abb3bb200c815.js +1 -0
- package/.next/static/chunks/pages/_app-b1f31c6bbc0bb7b1.js +140 -0
- package/.next/static/chunks/pages/{_error-18decb9cd478883d.js → _error-282257fbdcc167b4.js} +1 -1
- package/.next/static/chunks/pages/asset-library-0f607b74fa016470.js +1 -0
- package/.next/static/chunks/pages/context/long-term-09e23b06634b08d9.js +1 -0
- package/.next/static/chunks/pages/context/short-term-2f5fd8531e87b5bd.js +1 -0
- package/.next/static/chunks/pages/document-roles-077fc7159c88e89e.js +1 -0
- package/.next/static/chunks/pages/document-specs-fb5b8a89cff6d1e3.js +1 -0
- package/.next/static/chunks/pages/documents-38320ae2fd50be35.js +1 -0
- package/.next/static/chunks/pages/guide-acf32d66a6df6e5a.js +1 -0
- package/.next/static/chunks/pages/index-c5e0758e6b31deee.js +1 -0
- package/.next/static/chunks/pages/knowledge/file-detail-ad1dc61c1413db0c.js +1 -0
- package/.next/static/chunks/pages/knowledge/files-896c058f2da5e907.js +1 -0
- package/.next/static/chunks/pages/knowledge/manage-6da10158f75718cf.js +1 -0
- package/.next/static/chunks/pages/knowledge/search-3fd704d2afa1af3e.js +1 -0
- package/.next/static/chunks/pages/knowledge-905248d8dcb15453.js +1 -0
- package/.next/static/chunks/pages/models-7bdf24068811ae91.js +1 -0
- package/.next/static/chunks/pages/overview-572bba4876e617f5.js +1 -0
- package/.next/static/chunks/pages/prompt-c9bc7884a44d3767.js +1 -0
- package/.next/static/chunks/pages/settings-68f0d05bf95d12da.js +1 -0
- package/.next/static/css/9af88fe8ee791d26.css +1 -0
- package/.next/static/customize-agent-dashboard/_buildManifest.js +1 -0
- package/README.md +18 -0
- package/next.config.ts +15 -6
- package/package.json +5 -5
- package/public/favicon.ico +1 -0
- package/.next/server/chunks/2583.js +0 -1
- package/.next/server/chunks/6352.js +0 -1
- package/.next/static/chunks/15-289cb38b53bafa4a.js +0 -4
- package/.next/static/chunks/167-9f45623d7ea7ab43.js +0 -1
- package/.next/static/chunks/174-e7df14600b457a5c.js +0 -10
- package/.next/static/chunks/201-b16b4788042ed1aa.js +0 -1
- package/.next/static/chunks/227-442963c7b630eade.js +0 -1
- package/.next/static/chunks/257-ba16dfe16a27f417.js +0 -1
- package/.next/static/chunks/260-7a7a65a3ca8539ba.js +0 -28
- package/.next/static/chunks/292-c2888a94068fae74.js +0 -16
- package/.next/static/chunks/382-dd7535429e16931b.js +0 -25
- package/.next/static/chunks/400-f06f00619f22421e.js +0 -78
- package/.next/static/chunks/446-0591221372df7d49.js +0 -4
- package/.next/static/chunks/455-e31becaaf948f868.js +0 -6
- package/.next/static/chunks/492-62671486700ed3f9.js +0 -1
- package/.next/static/chunks/517-f43787133528ba48.js +0 -1
- package/.next/static/chunks/668-662b7bc81e4ad48f.js +0 -4
- package/.next/static/chunks/730-727fe4b055c78dc2.js +0 -1
- package/.next/static/chunks/740-2bcba39d841f2b16.js +0 -16
- package/.next/static/chunks/746-120983153bceeea6.js +0 -1
- package/.next/static/chunks/804-e654a1589d9adc65.js +0 -11
- package/.next/static/chunks/846-fed995f7c83fc6c3.js +0 -1
- package/.next/static/chunks/851-1190cb42a0630eef.js +0 -1
- package/.next/static/chunks/891-b6a172e1df7ab8c1.js +0 -1
- package/.next/static/chunks/958-66e2dcf301fb3c3f.js +0 -1
- package/.next/static/chunks/969-8843874536e7fd83.js +0 -1
- package/.next/static/chunks/992-ea93dfa182a02a8e.js +0 -1
- package/.next/static/chunks/framework-b5223c1542334872.js +0 -1
- package/.next/static/chunks/main-1a03005b3754c708.js +0 -1
- package/.next/static/chunks/pages/_app-725afbb7d3371a13.js +0 -140
- package/.next/static/chunks/pages/context/long-term-dba1d735f2b5e12b.js +0 -1
- package/.next/static/chunks/pages/context/short-term-7cc72881b42b74fb.js +0 -1
- package/.next/static/chunks/pages/document-roles-0f24b162cfd49513.js +0 -1
- package/.next/static/chunks/pages/document-specs-991368925b27ceda.js +0 -1
- package/.next/static/chunks/pages/documents-93e638518deec9b5.js +0 -1
- package/.next/static/chunks/pages/guide-414134ce66270eb0.js +0 -1
- package/.next/static/chunks/pages/index-505bd438c95ec0e8.js +0 -1
- package/.next/static/chunks/pages/knowledge/file-detail-793d12234ccddac1.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-1662e995b81e79aa.js +0 -1
- package/.next/static/chunks/pages/knowledge/manage-64ad6cdce068edb1.js +0 -1
- package/.next/static/chunks/pages/knowledge/search-fe148477dfe05966.js +0 -1
- package/.next/static/chunks/pages/knowledge-81fd1e907a6fcb84.js +0 -1
- package/.next/static/chunks/pages/models-0fb086e70387dde1.js +0 -1
- package/.next/static/chunks/pages/overview-db5df4f0bec2a77c.js +0 -1
- package/.next/static/chunks/pages/prompt-aa556d7a438117f1.js +0 -1
- package/.next/static/chunks/pages/settings-88f50b9cafc389e0.js +0 -1
- package/.next/static/css/5237c5e3358f3282.css +0 -1
- package/.next/static/yL_ilPc9XJWtNmN2W4Njc/_buildManifest.js +0 -1
- /package/.next/static/{yL_ilPc9XJWtNmN2W4Njc → customize-agent-dashboard}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[731],{5122:(_,n,e)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_error",function(){return e(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[731],{5122:(_,n,e)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_error",function(){return e(75599)}])}},_=>{_.O(0,[636,593,792],()=>_(_.s=5122)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[958],{6578:(n,e,t)=>{"use strict";async function o(n,e){let t=await fetch(n,e);if(!t.ok){let n=await t.text(),e=n||"HTTP ".concat(t.status);try{let t=JSON.parse(n);e=t.error||t.message||e}catch(n){}throw Error(e)}return t.json()}async function i(n){let e=n?"?projectRoot=".concat(encodeURIComponent(n)):"";return o("/api/kb/stats".concat(e))}async function a(n){var e,t;let i=new URLSearchParams;return(null==n?void 0:n.projectRoot)&&i.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&i.set("category",n.category),(null==n?void 0:n.page)&&i.set("page",String(null!=(e=n.page)?e:1)),(null==n?void 0:n.limit)&&i.set("limit",String(null!=(t=n.limit)?t:50)),o("/api/kb/files?".concat(i))}async function c(n,e){let t=new URLSearchParams({relativePath:n});return e&&t.set("projectRoot",e),o("/api/kb/files/detail?".concat(t))}async function s(n,e){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:n,projectRoot:e})})}async function r(n,e,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:n,target:e,projectRoot:t})})}async function d(n){return new Promise((e,t)=>{let o=new FileReader;o.onload=()=>{let n=o.result,t=n.indexOf(",");e(t>=0?n.slice(t+1):n)},o.onerror=t,o.readAsDataURL(n)})}async function p(n,e,t){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(n.map(async n=>({fileName:n.name,fileData:await d(n),relativePath:n.webkitRelativePath||void 0}))),projectRoot:e,uploadId:t})})}async function l(n){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(n)))}async function u(n){let e=new URLSearchParams({limit:"50"});return n&&e.set("projectRoot",n),o("/api/kb/operations?".concat(e))}async function y(n){let e=new URLSearchParams;return n&&e.set("projectRoot",n),o("/api/kb/operations?".concat(e),{method:"DELETE"})}async function h(n,e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:n,projectRoot:e})})}async function f(n,e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:n,projectRoot:e})})}async function m(n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:n})})}async function g(n){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:n})})}async function j(){return o("/api/kb/features")}async function T(n,e){var t,i,a,c,s;let r=new URLSearchParams({q:n});return(null==e?void 0:e.projectRoot)&&r.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&r.set("category",e.category),(null==e?void 0:e.limit)&&r.set("limit",String(null!=(s=e.limit)?s:20)),(null==e||null==(t=e.weights)?void 0:t.keyword)!=null&&r.set("keywordWeight",String(e.weights.keyword)),(null==e||null==(i=e.weights)?void 0:i.vector)!=null&&r.set("vectorWeight",String(e.weights.vector)),(null==e||null==(a=e.weights)?void 0:a.rewrite)!=null&&r.set("rewriteWeight",String(e.weights.rewrite)),(null==e||null==(c=e.weights)?void 0:c.hybridBonus)!=null&&r.set("hybridBonus",String(e.weights.hybridBonus)),o("/api/kb/search?".concat(r))}async function x(){return o("/api/prompt")}async function S(n){return o("/api/documents/roles".concat(n?"?type=".concat(n):""))}async function b(n){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function C(n,e){return o("/api/documents/roles?type=".concat(n,"&id=").concat(encodeURIComponent(e)),{method:"DELETE"})}async function w(n){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function E(n){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function O(){return o("/api/documents/specs")}async function v(n){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function N(n){return o("/api/documents/specs?id=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function P(){return o("/api/documents/templates")}async function R(n){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function k(n){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function A(n){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:n})})}async function U(n){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function J(){return o("/api/documents/generated")}async function I(n){return o("/api/documents/generated/".concat(encodeURIComponent(n)))}async function D(n,e){return o("/api/documents/generated/".concat(encodeURIComponent(n)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function L(){return o("/api/assets/generated")}async function _(n){return o("/api/assets/generated?id=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function H(n){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n,action:"index"})})}async function F(n,e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n,action:"open",target:e})})}async function W(n){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function B(n,e){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:n,id:e})})}async function X(n){let e=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw Error(await e.text());return e.blob()}async function z(){return o("/api/config/providers")}async function Q(n,e){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n,...e})})}async function V(n){return o("/api/config/providers/".concat(encodeURIComponent(n)),{method:"DELETE"})}async function q(){return o("/api/config/models")}async function Z(n){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function $(){return o("/api/config/embedding")}async function K(n){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function M(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function G(n){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n})})}async function Y(){return o("/api/system/stats")}async function nn(n,e){let t=e?"?type=".concat(n,"&search=").concat(encodeURIComponent(e)):"?type=".concat(n);return o("/api/context".concat(t))}async function ne(n){return o("/api/context?type=".concat(n,"&stats=1"))}async function nt(n){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:n})})}async function no(n){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:n})})}async function ni(n){return o("/api/context?id=".concat(encodeURIComponent(n)),{method:"DELETE"})}async function na(n,e){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n,...e})})}async function nc(n){return o("/api/config/providers/".concat(encodeURIComponent(n)))}t.d(e,{Af:()=>B,Bh:()=>nc,Dl:()=>P,E:()=>no,EK:()=>v,ER:()=>N,FC:()=>Y,FV:()=>C,H1:()=>g,H7:()=>y,HC:()=>s,HT:()=>a,II:()=>$,JU:()=>_,NR:()=>w,OX:()=>U,PH:()=>nt,QT:()=>l,Qx:()=>u,R1:()=>W,SJ:()=>f,UE:()=>X,VW:()=>j,W2:()=>T,X8:()=>m,Z3:()=>z,_m:()=>Q,a6:()=>D,aP:()=>Z,bV:()=>A,bZ:()=>G,c1:()=>p,cQ:()=>J,dd:()=>K,dg:()=>b,dw:()=>E,dx:()=>x,f$:()=>L,h0:()=>k,h1:()=>V,hc:()=>i,hn:()=>nn,l2:()=>R,lv:()=>S,mx:()=>O,oS:()=>F,p:()=>ne,tn:()=>r,u6:()=>M,uc:()=>H,v7:()=>I,xC:()=>c,xq:()=>h,xw:()=>ni,zo:()=>na,zr:()=>q})},63806:(n,e,t)=>{"use strict";t.r(e),t.d(e,{default:()=>E});var o=t(65321),i=t(97109),a=t(35292),c=t(17807),s=t(68787),r=t(38332),d=t(84253),p=t(85114),l=t(26171),u=t(384),y=t(33442),h=t(11702),f=t(93051),m=t(81668),g=t(64254),j=t(26619),T=t(58209),x=t(75548),S=t(56768),b=t(6578);let{Text:C,Paragraph:w}=a.A;function E(){let{message:n}=c.A.useApp(),[e,t]=(0,i.useState)([]),[a,E]=(0,i.useState)(null),O=async()=>{try{t((await (0,b.f$)()).assets)}catch(n){t([])}};(0,i.useEffect)(()=>{O()},[]);let v=async e=>{var t;e&&(await (null==(t=navigator.clipboard)?void 0:t.writeText(e)),n.success("已复制路径"))},N=async(e,o)=>{E(e);try{"index"===o&&t((await (0,b.uc)(e)).assets),"openFile"===o&&await (0,b.oS)(e,"file"),"openDirectory"===o&&await (0,b.oS)(e,"directory"),"delete"===o&&t((await (0,b.JU)(e)).assets),"index"===o&&n.success("已加入知识库索引")}catch(e){n.error(e instanceof Error?e.message:"操作失败")}finally{E(null)}},P=n=>{var e;return"image"===n.type&&(null==(e=n.path)?void 0:e.startsWith("generatedDocuments/assets/"))?"/api/assets/generated/preview?id=".concat(encodeURIComponent(n.id)):void 0};return(0,o.jsxs)("div",{className:"page-shell",children:[(0,o.jsxs)("div",{className:"mb-4",children:[(0,o.jsx)("h1",{className:"text-2xl font-semibold",children:"生成资源"}),(0,o.jsx)("p",{className:"text-[var(--colorTextSecondary)]",children:"管理文档生成产生的本地资源。生成资源默认不进入知识库,可在后续操作中手动加入知识库。"})]}),(0,o.jsx)(s.A,{children:(0,o.jsx)(r.A,{dataSource:e,locale:{emptyText:(0,o.jsx)(d.A,{description:"暂无生成资源"})},renderItem:n=>(0,o.jsx)(r.A.Item,{actions:[n.path?(0,o.jsx)(p.Ay,{icon:(0,o.jsx)(f.A,{}),onClick:()=>{v(n.path)},children:"复制路径"},"copy"):null,n.path?(0,o.jsx)(p.Ay,{icon:(0,o.jsx)(m.A,{}),loading:a===n.id,onClick:()=>{N(n.id,"openFile")},children:"打开"},"open"):null,n.path?(0,o.jsx)(p.Ay,{icon:(0,o.jsx)(g.A,{}),loading:a===n.id,onClick:()=>{N(n.id,"openDirectory")},children:"目录"},"folder"):null,!n.indexed&&n.path?(0,o.jsx)(p.Ay,{icon:(0,o.jsx)(j.A,{}),loading:a===n.id,onClick:()=>{N(n.id,"index")},children:"加入知识库"},"index"):null,(0,o.jsx)(l.A,{title:"确认删除该生成资源记录?",onConfirm:()=>{N(n.id,"delete")},children:(0,o.jsx)(p.Ay,{danger:!0,icon:(0,o.jsx)(T.A,{}),loading:a===n.id,children:"删除"})},"delete")],children:(0,o.jsx)(r.A.Item.Meta,{avatar:P(n)?(0,o.jsx)(u.A,{width:64,height:40,src:P(n),alt:n.name,style:{objectFit:"cover"}}):"image"===n.type?(0,o.jsx)(x.A,{}):(0,o.jsx)(S.A,{}),title:(0,o.jsxs)(y.A,{wrap:!0,children:[(0,o.jsx)("span",{children:n.name}),(0,o.jsx)(h.A,{children:n.type}),(0,o.jsx)(h.A,{color:n.indexed?"success":"default",children:n.indexed?"已入库":"未入库"}),(0,o.jsx)(h.A,{color:"blue",children:n.role})]}),description:(0,o.jsxs)(y.A,{direction:"vertical",size:2,className:"w-full",children:[(0,o.jsxs)(C,{type:"secondary",children:["路径:",n.path||n.url||"—"]}),(0,o.jsxs)(C,{type:"secondary",children:["来源:",n.source," \xb7 使用文档:",n.usedByDocumentIds.length," \xb7 更新时间:",new Date(n.updatedAt).toLocaleString()]}),n.prompt&&(0,o.jsxs)(w,{ellipsis:{rows:2,expandable:!0},className:"!mb-0",children:["提示词:",n.prompt]})]})})})})})]})}},85015:(n,e,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/asset-library",function(){return t(63806)}])}},n=>{n.O(0,[260,167,382,628,271,700,174,183,292,951,881,636,593,792],()=>n(n.s=85015)),_N_E=n.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[893],{260:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>N});var o=n(65321),a=n(97109),i=n(13014),c=n(17807),r=n(11702),s=n(85114),d=n(26171),l=n(33442),u=n(7576),p=n(68787),y=n(54849),m=n(59400),h=n(25258),f=n(63455),g=n(99650),x=n(58209),S=n(30486),T=n(83374),j=n(8383),w=n(26619),b=n(53998),C=n(6578),v=n(45551);let O={project_fact:"项目知识",user_preference:"用户偏好",feedback:"历史纠偏",pattern:"解决方案"},E={high:"red",medium:"orange",low:"default"};function N(){let e=(0,i.Vr)(),{message:t}=c.A.useApp(),[n,N]=(0,a.useState)(!0),[P,A]=(0,a.useState)([]),[R,k]=(0,a.useState)({count:0,totalBytes:0}),[U,J]=(0,a.useState)(""),[I,D]=(0,a.useState)(!1),[L,_]=(0,a.useState)(null),[z,B]=(0,a.useState)(""),[M,H]=(0,a.useState)(""),[W,F]=(0,a.useState)(!1),V=async n=>{N(!0);try{let[e,t]=await Promise.all([(0,C.hn)("long_term",n),(0,C.p)("long_term")]);A(e),k(t)}catch(n){t.error(e("common.error"))}finally{N(!1)}};(0,a.useEffect)(()=>{V()},[]);let X=async n=>{try{await (0,C.xw)(n),t.success(e("common.success")),await V(U)}catch(n){t.error(e("common.error"))}},K=async()=>{try{await (0,C.PH)("long_term"),t.success(e("common.success")),await V(U)}catch(n){t.error(e("common.error"))}},Q=async()=>{try{await (0,C.E)("long_term"),t.success(e("common.success")),await V(U)}catch(n){t.error(e("common.error"))}},q=async()=>{if(L&&z.trim()){F(!0);try{await (0,C.zo)(L.id,{content:z.trim(),context:M||void 0}),t.success(e("common.success")),D(!1),await V(U)}catch(n){t.error(e("common.error"))}finally{F(!1)}}},Z=[{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:"类型",dataIndex:"type",width:90,render:e=>(0,o.jsx)(r.A,{children:O[e]||e})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,o.jsx)(r.A,{color:E[e]||"default",children:"high"===e?"高":"medium"===e?"中":"低"})},{title:e("context.source"),dataIndex:"source",width:100,ellipsis:!0},{title:e("context.updatedAt"),dataIndex:"updated_at",width:140,render:e=>e?new Date(e).toLocaleString():"-"},{title:e("common.edit"),width:100,render:(t,n)=>(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,o.jsx)(s.Ay,{size:"small",type:"text",icon:(0,o.jsx)(g.A,{}),onClick:()=>{_(n),B(n.content),H(""),D(!0)}}),(0,o.jsx)(d.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{X(n.id)},children:(0,o.jsx)(s.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(x.A,{})})})]})}];return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.longTermContext")}),(0,o.jsx)("p",{className:"pageDesc",children:e("context.longTermDesc")})]}),(0,o.jsxs)(l.A,{wrap:!0,children:[(0,o.jsx)(u.A,{prefix:(0,o.jsx)(S.A,{}),placeholder:e("common.search"),value:U,onChange:e=>J(e.target.value),onPressEnter:()=>{V(U)},allowClear:!0,style:{width:240}}),(0,o.jsx)(s.Ay,{icon:(0,o.jsx)(T.A,{}),onClick:()=>{K()},children:"压缩"}),(0,o.jsx)(d.A,{title:"确定清除长期上下文吗?",onConfirm:()=>{Q()},children:(0,o.jsx)(s.Ay,{danger:!0,icon:(0,o.jsx)(j.A,{}),children:"清除"})})]})]}),(0,o.jsx)(p.A,{size:"small",children:(0,o.jsx)(y.A,{title:"总上下文大小",value:(0,v.z3)(R.totalBytes),prefix:(0,o.jsx)(w.A,{}),suffix:" / ".concat(R.count," 条")})}),(0,o.jsxs)(p.A,{size:"small",children:[(0,o.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(b.A,{})," ",e("context.longTermSource")]}),(0,o.jsx)(m.A,{rowKey:"id",columns:Z,dataSource:P,loading:n,size:"small",pagination:{pageSize:15}})]}),(0,o.jsx)(h.A,{maskClosable:!1,title:e("models.editModel"),open:I,onCancel:()=>D(!1),onOk:()=>{q()},confirmLoading:W,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("context.content"),children:(0,o.jsx)(u.A.TextArea,{rows:6,value:z,onChange:e=>B(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(u.A,{value:M,onChange:e=>H(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}},6578:(e,t,n)=>{"use strict";async function o(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function a(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function i(e){var t,n;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(a))}async function c(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function r(e,t){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function s(e,t,n){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function d(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function l(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await d(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function y(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function m(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return o("/api/kb/features")}async function S(e,t){var n,a,i,c,r;let s=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&s.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&s.set("category",t.category),(null==t?void 0:t.limit)&&s.set("limit",String(null!=(r=t.limit)?r:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&s.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(a=t.weights)?void 0:a.vector)!=null&&s.set("vectorWeight",String(t.weights.vector)),(null==t||null==(i=t.weights)?void 0:i.rewrite)!=null&&s.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(c=t.weights)?void 0:c.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function T(){return o("/api/prompt")}async function j(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function w(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function b(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function C(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(){return o("/api/documents/specs")}async function E(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(){return o("/api/documents/templates")}async function A(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function R(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function k(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function U(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J(){return o("/api/documents/generated")}async function I(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,t){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function L(){return o("/api/assets/generated")}async function _(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function z(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function B(e,t){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function M(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function H(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function W(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function F(){return o("/api/config/providers")}async function V(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function X(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function K(){return o("/api/config/models")}async function Q(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(){return o("/api/config/embedding")}async function Z(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function G(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function $(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function Y(){return o("/api/system/stats")}async function ee(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function et(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function en(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function eo(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ea(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ei(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ec(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>H,Bh:()=>ec,Dl:()=>P,E:()=>eo,EK:()=>E,ER:()=>N,FC:()=>Y,FV:()=>b,H1:()=>g,H7:()=>y,HC:()=>r,HT:()=>i,II:()=>q,JU:()=>_,NR:()=>C,OX:()=>U,PH:()=>en,QT:()=>u,Qx:()=>p,R1:()=>M,SJ:()=>h,UE:()=>W,VW:()=>x,W2:()=>S,X8:()=>f,Z3:()=>F,_m:()=>V,a6:()=>D,aP:()=>Q,bV:()=>k,bZ:()=>$,c1:()=>l,cQ:()=>J,dd:()=>Z,dg:()=>w,dw:()=>v,dx:()=>T,f$:()=>L,h0:()=>R,h1:()=>X,hc:()=>a,hn:()=>ee,l2:()=>A,lv:()=>j,mx:()=>O,oS:()=>B,p:()=>et,tn:()=>s,u6:()=>G,uc:()=>z,v7:()=>I,xC:()=>c,xq:()=>m,xw:()=>ea,zo:()=>ei,zr:()=>K})},36382:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/long-term",function(){return n(260)}])},45551:(e,t,n)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(n/60),a=Math.floor(o/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):o>0?"".concat(o,"h ago"):n>0?"".concat(n,"m ago"):"Just now":a>0?"".concat(a," 天前"):o>0?"".concat(o," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>r,fw:()=>a,z3:()=>o});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},c={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function r(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?c:i)[e])?t:e}}},e=>{e.O(0,[260,167,382,628,271,576,700,174,183,985,232,400,257,636,593,792],()=>e(e.s=36382)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[409],{6578:(e,t,n)=>{"use strict";async function o(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function a(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function i(e){var t,n;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(a))}async function c(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function r(e,t){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function s(e,t,n){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function d(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function l(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await d(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function y(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function m(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return o("/api/kb/features")}async function S(e,t){var n,a,i,c,r;let s=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&s.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&s.set("category",t.category),(null==t?void 0:t.limit)&&s.set("limit",String(null!=(r=t.limit)?r:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&s.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(a=t.weights)?void 0:a.vector)!=null&&s.set("vectorWeight",String(t.weights.vector)),(null==t||null==(i=t.weights)?void 0:i.rewrite)!=null&&s.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(c=t.weights)?void 0:c.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function T(){return o("/api/prompt")}async function j(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function w(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function b(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(){return o("/api/documents/specs")}async function E(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(){return o("/api/documents/templates")}async function A(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function R(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function U(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function k(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J(){return o("/api/documents/generated")}async function I(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,t){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function L(){return o("/api/assets/generated")}async function _(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function z(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function B(e,t){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function M(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function H(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function W(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function F(){return o("/api/config/providers")}async function V(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function X(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function K(){return o("/api/config/models")}async function Q(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(){return o("/api/config/embedding")}async function Z(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function G(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function $(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function Y(){return o("/api/system/stats")}async function ee(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function et(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function en(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function eo(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ea(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ei(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ec(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>H,Bh:()=>ec,Dl:()=>P,E:()=>eo,EK:()=>E,ER:()=>N,FC:()=>Y,FV:()=>C,H1:()=>g,H7:()=>y,HC:()=>r,HT:()=>i,II:()=>q,JU:()=>_,NR:()=>b,OX:()=>k,PH:()=>en,QT:()=>u,Qx:()=>p,R1:()=>M,SJ:()=>h,UE:()=>W,VW:()=>x,W2:()=>S,X8:()=>f,Z3:()=>F,_m:()=>V,a6:()=>D,aP:()=>Q,bV:()=>U,bZ:()=>$,c1:()=>l,cQ:()=>J,dd:()=>Z,dg:()=>w,dw:()=>v,dx:()=>T,f$:()=>L,h0:()=>R,h1:()=>X,hc:()=>a,hn:()=>ee,l2:()=>A,lv:()=>j,mx:()=>O,oS:()=>B,p:()=>et,tn:()=>s,u6:()=>G,uc:()=>z,v7:()=>I,xC:()=>c,xq:()=>m,xw:()=>ea,zo:()=>ei,zr:()=>K})},19164:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/short-term",function(){return n(51162)}])},45551:(e,t,n)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(n/60),a=Math.floor(o/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):o>0?"".concat(o,"h ago"):n>0?"".concat(n,"m ago"):"Just now":a>0?"".concat(a," 天前"):o>0?"".concat(o," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>r,fw:()=>a,z3:()=>o});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},c={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function r(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?c:i)[e])?t:e}},51162:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>E});var o=n(65321),a=n(97109),i=n(13014),c=n(17807),r=n(11702),s=n(85114),d=n(26171),l=n(33442),u=n(7576),p=n(68787),y=n(54849),m=n(59400),h=n(25258),f=n(63455),g=n(99650),x=n(58209),S=n(30486),T=n(83374),j=n(8383),w=n(26619),C=n(53998),b=n(6578),v=n(45551);let O={high:"red",medium:"orange",low:"default"};function E(){let e=(0,i.Vr)(),{message:t}=c.A.useApp(),[n,E]=(0,a.useState)(!0),[N,P]=(0,a.useState)([]),[A,R]=(0,a.useState)({count:0,totalBytes:0}),[U,k]=(0,a.useState)(""),[J,I]=(0,a.useState)(!1),[D,L]=(0,a.useState)(null),[_,z]=(0,a.useState)(""),[B,M]=(0,a.useState)(""),[H,W]=(0,a.useState)(!1),F=async n=>{E(!0);try{let[e,t]=await Promise.all([(0,b.hn)("short_term",n),(0,b.p)("short_term")]);P(e),R(t)}catch(n){t.error(e("common.error"))}finally{E(!1)}};(0,a.useEffect)(()=>{F()},[]);let V=async n=>{try{await (0,b.xw)(n),t.success(e("common.success")),await F(U)}catch(n){t.error(e("common.error"))}},X=async()=>{try{await (0,b.PH)("short_term"),t.success(e("common.success")),await F(U)}catch(n){t.error(e("common.error"))}},K=async()=>{try{await (0,b.E)("short_term"),t.success(e("common.success")),await F(U)}catch(n){t.error(e("common.error"))}},Q=async()=>{if(D&&_.trim()){W(!0);try{await (0,b.zo)(D.id,{content:_.trim(),context:B||void 0}),t.success(e("common.success")),I(!1),await F(U)}catch(n){t.error(e("common.error"))}finally{W(!1)}}},q=[{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,o.jsx)(r.A,{color:O[e]||"default",children:"high"===e?"高":"medium"===e?"中":"低"})},{title:e("context.content"),dataIndex:"content",ellipsis:!0},{title:e("context.source"),dataIndex:"source",width:120,ellipsis:!0},{title:e("context.updatedAt"),dataIndex:"updated_at",width:140,render:e=>e?new Date(e).toLocaleString():"-"},{title:e("common.edit"),width:100,render:(t,n)=>(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,o.jsx)(s.Ay,{size:"small",type:"text",icon:(0,o.jsx)(g.A,{}),onClick:()=>{L(n),z(n.content),M(""),I(!0)}}),(0,o.jsx)(d.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{V(n.id)},children:(0,o.jsx)(s.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(x.A,{})})})]})}];return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.shortTermContext")}),(0,o.jsx)("p",{className:"pageDesc",children:e("context.shortTermDesc")})]}),(0,o.jsxs)(l.A,{wrap:!0,children:[(0,o.jsx)(u.A,{prefix:(0,o.jsx)(S.A,{}),placeholder:e("common.search"),value:U,onChange:e=>k(e.target.value),onPressEnter:()=>{F(U)},allowClear:!0,style:{width:240}}),(0,o.jsx)(s.Ay,{icon:(0,o.jsx)(T.A,{}),onClick:()=>{X()},children:"压缩"}),(0,o.jsx)(d.A,{title:"确定清除短期上下文吗?",onConfirm:()=>{K()},children:(0,o.jsx)(s.Ay,{danger:!0,icon:(0,o.jsx)(j.A,{}),children:"清除"})})]})]}),(0,o.jsx)(p.A,{size:"small",children:(0,o.jsx)(y.A,{title:"总上下文大小",value:(0,v.z3)(A.totalBytes),prefix:(0,o.jsx)(w.A,{}),suffix:" / ".concat(A.count," 条")})}),(0,o.jsxs)(p.A,{size:"small",children:[(0,o.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(C.A,{})," ",e("context.shortTermSource")]}),(0,o.jsx)(m.A,{rowKey:"id",columns:q,dataSource:N,loading:n,size:"small",pagination:{pageSize:15}})]}),(0,o.jsx)(h.A,{maskClosable:!1,title:e("models.editModel"),open:J,onCancel:()=>I(!1),onOk:()=>{Q()},confirmLoading:H,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("context.content"),children:(0,o.jsx)(u.A.TextArea,{rows:6,value:_,onChange:e=>z(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(u.A,{value:B,onChange:e=>M(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}}},e=>{e.O(0,[260,167,382,628,271,576,700,174,183,985,232,400,257,636,593,792],()=>e(e.s=19164)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[623],{2256:(e,n,t)=>{"use strict";t.d(n,{A:()=>o});let o=t(25341).A},6578:(e,n,t)=>{"use strict";async function o(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function r(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(n))}async function i(e){var n,t;let r=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&r.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&r.set("category",e.category),(null==e?void 0:e.page)&&r.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&r.set("limit",String(null!=(t=e.limit)?t:50)),o("/api/kb/files?".concat(r))}async function s(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),o("/api/kb/files/detail?".concat(t))}async function a(e,n){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function l(e,n,t){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function c(e){return new Promise((n,t)=>{let o=new FileReader;o.onload=()=>{let e=o.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},o.onerror=t,o.readAsDataURL(e)})}async function d(e,n,t){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await c(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function p(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n))}async function m(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),o("/api/kb/operations?".concat(n),{method:"DELETE"})}async function y(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function h(e,n){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function f(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return o("/api/kb/features")}async function j(e,n){var t,r,i,s,a;let l=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&l.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&l.set("category",n.category),(null==n?void 0:n.limit)&&l.set("limit",String(null!=(a=n.limit)?a:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&l.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(r=n.weights)?void 0:r.vector)!=null&&l.set("vectorWeight",String(n.weights.vector)),(null==n||null==(i=n.weights)?void 0:i.rewrite)!=null&&l.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(s=n.weights)?void 0:s.hybridBonus)!=null&&l.set("hybridBonus",String(n.weights.hybridBonus)),o("/api/kb/search?".concat(l))}async function b(){return o("/api/prompt")}async function A(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function v(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function I(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function S(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(){return o("/api/documents/specs")}async function w(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(){return o("/api/documents/templates")}async function N(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function O(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(){return o("/api/documents/generated")}async function U(e){return o("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,n){return o("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function J(){return o("/api/assets/generated")}async function F(e){return o("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function L(e){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function H(e,n){return o("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function _(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(e,n){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function z(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw Error(await n.text());return n.blob()}async function B(){return o("/api/config/providers")}async function V(e,n){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function M(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function Q(){return o("/api/config/models")}async function W(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function X(){return o("/api/config/embedding")}async function G(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function K(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function Z(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function Y(){return o("/api/system/stats")}async function ee(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function en(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function et(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function eo(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function er(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ei(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function es(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>q,Bh:()=>es,Dl:()=>R,E:()=>eo,EK:()=>w,ER:()=>E,FC:()=>Y,FV:()=>T,H1:()=>g,H7:()=>m,HC:()=>a,HT:()=>i,II:()=>X,JU:()=>F,NR:()=>I,OX:()=>O,PH:()=>et,QT:()=>p,Qx:()=>u,R1:()=>_,SJ:()=>h,UE:()=>z,VW:()=>x,W2:()=>j,X8:()=>f,Z3:()=>B,_m:()=>V,a6:()=>D,aP:()=>W,bV:()=>$,bZ:()=>Z,c1:()=>d,cQ:()=>P,dd:()=>G,dg:()=>v,dw:()=>S,dx:()=>b,f$:()=>J,h0:()=>k,h1:()=>M,hc:()=>r,hn:()=>ee,l2:()=>N,lv:()=>A,mx:()=>C,oS:()=>H,p:()=>en,tn:()=>l,u6:()=>K,uc:()=>L,v7:()=>U,xC:()=>s,xq:()=>y,xw:()=>er,zo:()=>ei,zr:()=>Q})},23507:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return t(59889)}])},38770:(e,n,t)=>{"use strict";t.d(n,{A:()=>o});let o=t(51916).A},59889:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>C});var o=t(65321),r=t(97109),i=t(17807),s=t(63455),a=t(38332),l=t(84253),c=t(85114),d=t(26171),p=t(33442),u=t(11702),m=t(68787),y=t(85493),h=t(2256),f=t(38770),g=t(25258),x=t(57271),j=t(7576),b=t(58569),A=t(99650),v=t(58209),T=t(54746),I=t(6578),S=t(13014);function C(){let e=(0,S.Vr)(),{message:n}=i.A.useApp(),[t]=s.A.useForm(),[C]=s.A.useForm(),[w,E]=(0,r.useState)([]),[R,N]=(0,r.useState)([]),[k,$]=(0,r.useState)([]),[O,P]=(0,r.useState)([]),[U,D]=(0,r.useState)(!1),[J,F]=(0,r.useState)(!1),L=async()=>{let[e,n,t]=await Promise.all([(0,I.lv)(),(0,I.HT)(),(0,I.dx)()]);E(e.roles),N(e.configs),$(n.files),P(t)};(0,r.useEffect)(()=>{L().catch(()=>n.error(e("common.error")))},[n,e]);let H=w.filter(e=>"file"===e.type),_=w.filter(e=>"prompt"===e.type),q=async()=>{try{let o=await t.validateFields(),r=await (0,I.dg)(o);E(r.roles),N(r.configs),D(!1),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},z=async()=>{try{let t=await C.validateFields(),o=e=>(null!=e?e:[]).map((e,n)=>{var t;return{roleId:e.roleId,order:Number(null!=(t=e.order)?t:n)}}),r=await (0,I.NR)({...t,fileRoles:o(t.fileRoles),promptRoles:o(t.promptRoles)});E(r.roles),N(r.configs),F(!1),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},B=async e=>{let n=await (0,I.FV)(e.type,e.id);E(n.roles),N(n.configs)},V=async e=>{let n=await (0,I.dw)(e);E(n.roles),N(n.configs)},M=function(e){var n;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";t.setFieldsValue(e?{...e,resourceIds:(null==(n=e.resourceIds)?void 0:n.length)?e.resourceIds:e.resourceId?[e.resourceId]:[]}:{id:"role-".concat(Date.now()),name:"",description:"",type:o,resourceIds:[],executionType:"prompt"===o?"reference":void 0,processingType:"file"===o?"reference":void 0}),D(!0)},Q=e=>{C.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[]}),F(!0)},W=n=>(0,o.jsx)(a.A,{dataSource:w.filter(e=>e.type===n),locale:{emptyText:(0,o.jsx)(l.A,{description:e("common.noData")})},renderItem:n=>{var t;return(0,o.jsx)(a.A.Item,{actions:[(0,o.jsx)(c.Ay,{type:"text",icon:(0,o.jsx)(A.A,{}),onClick:()=>M(n)},"edit"),(0,o.jsx)(d.A,{title:e("common.confirm"),disabled:n.builtIn,onConfirm:()=>{B(n)},children:(0,o.jsx)(c.Ay,{type:"text",danger:!0,icon:(0,o.jsx)(v.A,{}),disabled:n.builtIn})},"delete")],children:(0,o.jsx)(a.A.Item.Meta,{title:(0,o.jsxs)(p.A,{children:[(0,o.jsx)("span",{children:n.name}),n.builtIn&&(0,o.jsx)(u.A,{color:"gold",children:e("documents.builtIn")}),(0,o.jsx)(u.A,{children:n.id})]}),description:(0,o.jsxs)(p.A,{direction:"vertical",children:[(0,o.jsx)("span",{children:n.description}),(0,o.jsx)("span",{children:"prompt"===n.type?n.executionType:n.processingType}),(0,o.jsx)("span",{children:((null==(t=n.resourceIds)?void 0:t.length)?n.resourceIds:n.resourceId?[n.resourceId]:[]).join("、")||"-"})]})})})}});return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsx)(m.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,o.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle mb-1",children:e("roles.title")}),(0,o.jsx)("p",{className:"pageDesc mb-0",children:e("roles.description")})]}),(0,o.jsxs)(p.A,{children:[(0,o.jsx)(c.Ay,{icon:(0,o.jsx)(T.A,{}),onClick:()=>M(void 0,"file"),children:e("roles.newFileRole")}),(0,o.jsx)(c.Ay,{icon:(0,o.jsx)(T.A,{}),onClick:()=>M(void 0,"prompt"),children:e("roles.newPromptRole")}),(0,o.jsx)(c.Ay,{type:"primary",icon:(0,o.jsx)(T.A,{}),onClick:()=>Q(),children:e("roles.newConfig")})]})]})}),(0,o.jsx)(y.A,{type:"info",showIcon:!0,message:e("roles.plainGuideTitle"),description:e("roles.plainGuideDesc")}),(0,o.jsxs)(h.A,{gutter:[16,16],children:[(0,o.jsx)(f.A,{xs:24,lg:12,children:(0,o.jsx)(m.A,{title:e("roles.fileRoles"),children:W("file")})}),(0,o.jsx)(f.A,{xs:24,lg:12,children:(0,o.jsx)(m.A,{title:e("roles.promptRoles"),children:W("prompt")})}),(0,o.jsx)(f.A,{xs:24,children:(0,o.jsx)(m.A,{title:e("roles.configs"),children:(0,o.jsx)(a.A,{dataSource:R,locale:{emptyText:(0,o.jsx)(l.A,{description:e("common.noData")})},renderItem:n=>(0,o.jsx)(a.A.Item,{actions:[(0,o.jsx)(c.Ay,{type:"text",icon:(0,o.jsx)(A.A,{}),onClick:()=>Q(n)},"edit"),(0,o.jsx)(d.A,{title:e("common.confirm"),onConfirm:()=>{V(n.id)},children:(0,o.jsx)(c.Ay,{type:"text",danger:!0,icon:(0,o.jsx)(v.A,{})})},"delete")],children:(0,o.jsx)(a.A.Item.Meta,{title:(0,o.jsxs)(p.A,{children:[n.name,(0,o.jsx)(u.A,{children:n.id})]}),description:"".concat(e("roles.fileRoles"),": ").concat(n.fileRoles.length," \xb7 ").concat(e("roles.promptRoles"),": ").concat(n.promptRoles.length)})})})})})]}),(0,o.jsx)(g.A,{maskClosable:!1,title:e("roles.roleEditor"),open:U,onOk:()=>{q()},onCancel:()=>D(!1),centered:!0,okText:e("common.save"),children:(0,o.jsxs)(s.A,{form:t,layout:"vertical",children:[(0,o.jsx)(s.A.Item,{name:"type",label:e("roles.roleType"),rules:[{required:!0}],children:(0,o.jsx)(x.A,{options:[{label:e("roles.fileRole"),value:"file"},{label:e("roles.promptRole"),value:"prompt"}]})}),(0,o.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(j.A,{disabled:!0})}),(0,o.jsx)(s.A.Item,{name:"name",label:e("roles.roleName"),rules:[{required:!0}],children:(0,o.jsx)(j.A,{})}),(0,o.jsx)(s.A.Item,{name:"description",label:e("roles.roleDescription"),children:(0,o.jsx)(j.A,{})}),(0,o.jsx)(s.A.Item,{noStyle:!0,shouldUpdate:(e,n)=>e.type!==n.type,children:n=>{let{getFieldValue:t}=n;return"prompt"===t("type")?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.A.Item,{name:"executionType",label:e("roles.executionType"),rules:[{required:!0}],extra:e("roles.executionTypeHelp"),children:(0,o.jsx)(x.A,{options:[{label:e("roles.factExtraction"),value:"fact_extraction"},{label:e("roles.chapterGeneration"),value:"chapter_generation"},{label:e("roles.validation"),value:"validation"},{label:e("roles.formatting"),value:"formatting"},{label:e("roles.reference"),value:"reference"}]})}),(0,o.jsx)(s.A.Item,{name:"resourceIds",label:e("roles.bindPrompt"),extra:e("roles.multiBindPromptHelp"),children:(0,o.jsx)(x.A,{mode:"multiple",showSearch:!0,options:O.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.A.Item,{name:"processingType",label:e("roles.processingType"),rules:[{required:!0}],extra:e("roles.processingTypeHelp"),children:(0,o.jsx)(x.A,{options:[{label:e("roles.ruleFile"),value:"rule"},{label:e("roles.projectFactFile"),value:"project_fact"},{label:e("roles.tableFile"),value:"table"},{label:e("roles.drawingFile"),value:"drawing"},{label:e("roles.specificationFile"),value:"specification"},{label:e("roles.reference"),value:"reference"}]})}),(0,o.jsx)(s.A.Item,{name:"resourceIds",label:e("roles.bindFile"),extra:e("roles.multiBindFileHelp"),children:(0,o.jsx)(x.A,{mode:"multiple",showSearch:!0,options:k.map(e=>({label:e.relativePath,value:e.relativePath}))})})]})}})]})}),(0,o.jsx)(g.A,{maskClosable:!1,title:e("roles.configEditor"),open:J,onOk:()=>{z()},onCancel:()=>F(!1),width:820,centered:!0,okText:e("common.save"),children:(0,o.jsxs)(s.A,{form:C,layout:"vertical",children:[(0,o.jsxs)(h.A,{gutter:12,children:[(0,o.jsx)(f.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(j.A,{disabled:!0})})}),(0,o.jsx)(f.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"name",label:e("roles.configName"),rules:[{required:!0}],children:(0,o.jsx)(j.A,{})})}),(0,o.jsx)(f.A,{span:8,children:(0,o.jsx)(s.A.Item,{name:"description",label:e("roles.configDescription"),children:(0,o.jsx)(j.A,{})})})]}),(0,o.jsx)(b.A,{items:[{key:"file",label:e("roles.fileRoles"),children:(0,o.jsx)(s.A.List,{name:"fileRoles",children:(n,t)=>{let{add:r,remove:i}=t;return(0,o.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[n.map((e,n)=>(0,o.jsxs)(h.A,{gutter:8,children:[(0,o.jsx)(f.A,{span:16,children:(0,o.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],children:(0,o.jsx)(x.A,{options:H.map(e=>({label:e.name,value:e.id}))})})}),(0,o.jsx)(f.A,{span:6,children:(0,o.jsx)(s.A.Item,{name:[e.name,"order"],initialValue:n,children:(0,o.jsx)(j.A,{type:"number"})})}),(0,o.jsx)(f.A,{span:2,children:(0,o.jsx)(c.Ay,{danger:!0,onClick:()=>i(e.name),children:"-"})})]},e.key)),(0,o.jsx)(c.Ay,{onClick:()=>r({order:n.length}),children:e("roles.addRole")})]})}})},{key:"prompt",label:e("roles.promptRoles"),children:(0,o.jsx)(s.A.List,{name:"promptRoles",children:(n,t)=>{let{add:r,remove:i}=t;return(0,o.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[n.map((e,n)=>(0,o.jsxs)(h.A,{gutter:8,children:[(0,o.jsx)(f.A,{span:16,children:(0,o.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],children:(0,o.jsx)(x.A,{options:_.map(e=>({label:e.name,value:e.id}))})})}),(0,o.jsx)(f.A,{span:6,children:(0,o.jsx)(s.A.Item,{name:[e.name,"order"],initialValue:n,children:(0,o.jsx)(j.A,{type:"number"})})}),(0,o.jsx)(f.A,{span:2,children:(0,o.jsx)(c.Ay,{danger:!0,onClick:()=>i(e.name),children:"-"})})]},e.key)),(0,o.jsx)(c.Ay,{onClick:()=>r({order:n.length}),children:e("roles.addRole")})]})}})}]})]})})]})}},85493:(e,n,t)=>{"use strict";t.d(n,{A:()=>N});var o=t(97109),r=t(59188),i=t(4216),s=t(45042),a=t(97137),l=t(62188),c=t(67189),d=t(42644),p=t(3638),u=t(92162),m=t(26047),y=t(74567),h=t(15561),f=t(7961),g=t(10540);let x=(e,n,t)=>({background:e,[`${t}-icon`]:{color:n}}),j=(0,g.OF)("Alert",e=>[(e=>{let{componentCls:n,motionDurationSlow:t,marginXS:o,marginSM:r,fontSize:i,fontSizeLG:s,lineHeight:a,borderRadiusLG:l,motionEaseInOutCirc:c,withDescriptionIconSize:d,colorText:p,colorTextHeading:u,withDescriptionPadding:m,defaultPadding:y,lineWidth:g,lineType:x,colorSuccessBorder:j,colorWarningBorder:b,colorErrorBorder:A,colorInfoBorder:v}=e;return{[n]:{...(0,f.dF)(e),position:"relative",display:"flex",alignItems:"center",padding:y,wordWrap:"break-word",borderRadius:l,borderWidth:(0,h.zA)(g),borderStyle:x,[`&${n}-success`]:{borderColor:j},[`&${n}-info`]:{borderColor:v},[`&${n}-warning`]:{borderColor:b},[`&${n}-error`]:{borderColor:A},[`&${n}-filled`]:{borderColor:"transparent"},[`&${n}-rtl`]:{direction:"rtl"},[`${n}-section`]:{flex:1,minWidth:0},[`${n}-icon`]:{marginInlineEnd:o,lineHeight:0},"&-description":{display:"none",fontSize:i,lineHeight:a},"&-title":{color:u},[`&${n}-motion-leave`]:{overflow:"hidden",opacity:1,transition:["max-height","opacity","padding-top","padding-bottom","margin-bottom"].map(e=>`${e} ${t} ${c}`).join(", ")},[`&${n}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0},[`&${n}-with-description`]:{alignItems:"flex-start",padding:m,[`${n}-icon`]:{marginInlineEnd:r,fontSize:d,lineHeight:0},[`${n}-title`]:{display:"block",marginBottom:o,color:u,fontSize:s},[`${n}-description`]:{display:"block",color:p}},[`&${n}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}}})(e),(e=>{let{componentCls:n,colorSuccess:t,colorSuccessBg:o,colorWarning:r,colorWarningBg:i,colorError:s,colorErrorBg:a,colorInfo:l,colorInfoBg:c}=e;return{[n]:{"&-success":x(o,t,n),"&-info":x(c,l,n),"&-warning":x(i,r,n),"&-error":{...x(a,s,n),[`${n}-description > pre`]:{margin:0,padding:0}}}}})(e),(e=>{let{componentCls:n,iconCls:t,motionDurationMid:o,marginXS:r,fontSizeIcon:i,colorIcon:s,colorIconHover:a}=e;return{[n]:{[`${n}-actions`]:{marginInlineStart:r},[`${n}-close-icon`]:{marginInlineStart:r,padding:0,overflow:"hidden",fontSize:i,lineHeight:(0,h.zA)(i),backgroundColor:"transparent",border:"none",cursor:"pointer",...(0,f.K8)(e),[`${t}-close`]:{color:s,transition:`color ${o}`,"&:hover":{color:a}}},"&-close-text":{color:s,transition:`color ${o}`,"&:hover":{color:a}}}}})(e)],e=>({withDescriptionIconSize:e.fontSizeHeading3,defaultPadding:`${e.paddingContentVerticalSM}px 12px`,withDescriptionPadding:`${e.paddingMD}px ${e.paddingContentHorizontalLG}px`})),b=e=>{let{icon:n,type:t,className:s,style:c,successIcon:d,infoIcon:p,warningIcon:u,errorIcon:m}=e,y={success:d??o.createElement(r.A,null),info:p??o.createElement(l.A,null),error:m??o.createElement(i.A,null),warning:u??o.createElement(a.A,null)};return o.createElement("span",{className:s,style:c},n??y[t])},A=e=>{let{isClosable:n,prefixCls:t,closeIcon:r,handleClose:i,ariaProps:a,className:l,style:c}=e,d=!0===r||void 0===r?o.createElement(s.A,null):r;return n?o.createElement("button",{type:"button",onClick:i,className:(0,p.$)(`${t}-close-icon`,l),tabIndex:0,style:c,...a},d):null},v=o.forwardRef((e,n)=>{let{description:t,prefixCls:r,message:i,title:s,banner:a,className:l,rootClassName:h,style:f,onMouseEnter:g,onMouseLeave:x,onClick:v,afterClose:T,showIcon:I,closable:S,closeText:C,closeIcon:w,action:E,id:R,styles:N,classNames:k,...$}=e,O=s??i,[P,U]=o.useState(!1),D=o.useRef(null);o.useImperativeHandle(n,()=>({nativeElement:D.current}));let{getPrefixCls:J,direction:F,variant:L,closable:H,closeIcon:_,className:q,style:z,classNames:B,styles:V,successIcon:M,infoIcon:Q,warningIcon:W,errorIcon:X}=(0,y.TP)("alert"),G=J("alert",r),[K,Z]=j(G),{onClose:Y,afterClose:ee}=(0,m.Qd)(S)?S:{},en=n=>{U(!0),(Y??e.onClose)?.(n)},et=o.useMemo(()=>void 0!==e.type?e.type:a?"warning":"info",[e.type,a]),eo=e.variant??L??"outlined",er=o.useMemo(()=>!!(0,m.Qd)(S)&&!!S.closeIcon||!!C||("boolean"==typeof S?S:!!(!1!==w&&(0,m.R)(w))||!!H),[C,w,S,H]),ei=!!a&&void 0===I||I,es={...e,prefixCls:G,variant:eo,type:et,showIcon:ei,closable:er},ea=(0,u.XT)(z),el=(0,u.XT)(f),[ec,ed]=(0,u.AV)([B,k],[V,ea,N,el],{props:es}),ep=(0,p.$)(G,`${G}-${et}`,`${G}-${eo}`,{[`${G}-with-description`]:!!t,[`${G}-no-icon`]:!ei,[`${G}-banner`]:!!a,[`${G}-rtl`]:"rtl"===F},q,l,h,ec.root,Z,K),eu=(0,d.KE)($,{aria:!0,data:!0}),em=o.useMemo(()=>(0,m.Qd)(S)&&S.closeIcon?S.closeIcon:C||(void 0!==w?w:(0,m.Qd)(H)&&H.closeIcon?H.closeIcon:_),[w,S,H,C,_]),ey=o.useMemo(()=>{let e=S??H;return(0,m.Qd)(e)?(0,d.KE)(e,{data:!0,aria:!0}):{}},[S,H]);return o.createElement(c.Ay,{visible:!P,motionName:`${G}-motion`,motionAppear:!1,motionEnter:!1,onLeaveStart:e=>({maxHeight:e.offsetHeight}),onLeaveEnd:ee??T},({className:n,style:r},i)=>o.createElement("div",{id:R,ref:(0,d.K4)(D,i),"data-show":!P,className:(0,p.$)(ep,n),style:{...ed.root,...r},onMouseEnter:g,onMouseLeave:x,onClick:v,role:"alert",...eu},ei?o.createElement(b,{className:(0,p.$)(`${G}-icon`,ec.icon),style:ed.icon,description:t,icon:e.icon,prefixCls:G,type:et,successIcon:M,infoIcon:Q,warningIcon:W,errorIcon:X}):null,o.createElement("div",{className:(0,p.$)(`${G}-section`,ec.section),style:ed.section},O?o.createElement("div",{className:(0,p.$)(`${G}-title`,ec.title),style:ed.title},O):null,t?o.createElement("div",{className:(0,p.$)(`${G}-description`,ec.description),style:ed.description},t):null),E?o.createElement("div",{className:(0,p.$)(`${G}-actions`,ec.actions),style:ed.actions},E):null,o.createElement(A,{className:ec.close,style:ed.close,isClosable:er,prefixCls:G,closeIcon:em,handleClose:en,ariaProps:ey})))});var T=t(41113),I=t(49939),S=t(90218),C=t(13076),w=t(83784),E=t(15472);let R=function(e){function n(){var e,t,o;return(0,T.A)(this,n),t=n,o=arguments,t=(0,S.A)(t),(e=(0,w.A)(this,(0,C.A)()?Reflect.construct(t,o||[],(0,S.A)(this).constructor):t.apply(this,o))).state={error:void 0,info:{}},e}return(0,E.A)(n,e),(0,I.A)(n,[{key:"componentDidCatch",value:function(e,n){this.setState({error:e,info:n})}},{key:"render",value:function(){let{message:e,title:n,description:t,id:r,children:i}=this.props,{error:s,info:a}=this.state,l=n??e,c=a?.componentStack||null,d=(0,m.R)(l)?l:s?.toString(),p=(0,m.R)(t)?t:c;return s?o.createElement(v,{id:r,type:"error",title:d,description:o.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},p)}):i}}])}(o.PureComponent);v.ErrorBoundary=R;let N=v}},e=>{e.O(0,[260,167,382,628,271,576,700,174,183,232,951,636,593,792],()=>e(e.s=23507)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[580],{2256:(e,n,t)=>{"use strict";t.d(n,{A:()=>a});let a=t(25341).A},6578:(e,n,t)=>{"use strict";async function a(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function i(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(n))}async function c(e){var n,t;let i=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&i.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&i.set("category",e.category),(null==e?void 0:e.page)&&i.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&i.set("limit",String(null!=(t=e.limit)?t:50)),a("/api/kb/files?".concat(i))}async function s(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),a("/api/kb/files/detail?".concat(t))}async function r(e,n){return a("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function o(e,n,t){return a("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:n,projectRoot:t})})}async function l(e){return new Promise((n,t)=>{let a=new FileReader;a.onload=()=>{let e=a.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},a.onerror=t,a.readAsDataURL(e)})}async function d(e,n,t){return a("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function p(e){return a("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),a("/api/kb/operations?".concat(n))}async function m(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),a("/api/kb/operations?".concat(n),{method:"DELETE"})}async function h(e,n){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function y(e,n){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function g(e){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function f(e){return a("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return a("/api/kb/features")}async function j(e,n){var t,i,c,s,r;let o=new URLSearchParams({q:e});return(null==n?void 0:n.projectRoot)&&o.set("projectRoot",n.projectRoot),(null==n?void 0:n.category)&&o.set("category",n.category),(null==n?void 0:n.limit)&&o.set("limit",String(null!=(r=n.limit)?r:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&o.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(i=n.weights)?void 0:i.vector)!=null&&o.set("vectorWeight",String(n.weights.vector)),(null==n||null==(c=n.weights)?void 0:c.rewrite)!=null&&o.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(s=n.weights)?void 0:s.hybridBonus)!=null&&o.set("hybridBonus",String(n.weights.hybridBonus)),a("/api/kb/search?".concat(o))}async function b(){return a("/api/prompt")}async function A(e){return a("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function I(e){return a("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function S(e,n){return a("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function w(e){return a("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(e){return a("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function v(){return a("/api/documents/specs")}async function k(e){return a("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return a("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return a("/api/documents/templates")}async function C(e){return a("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return a("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(e){return a("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function R(e){return a("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(){return a("/api/documents/generated")}async function q(e){return a("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,n){return a("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function J(){return a("/api/assets/generated")}async function L(e){return a("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function U(e){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function _(e,n){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:n})})}async function H(e){return a("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function z(e,n){return a("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function F(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw Error(await n.text());return n.blob()}async function M(){return a("/api/config/providers")}async function V(e,n){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function X(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function W(){return a("/api/config/models")}async function B(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function G(){return a("/api/config/embedding")}async function K(e){return a("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Q(){return a("/api/config/embedding/healthCheck",{method:"POST"})}async function Z(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function Y(){return a("/api/system/stats")}async function ee(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return a("/api/context".concat(t))}async function en(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function et(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ea(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ei(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ec(e,n){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function es(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>z,Bh:()=>es,Dl:()=>E,E:()=>ea,EK:()=>k,ER:()=>T,FC:()=>Y,FV:()=>S,H1:()=>f,H7:()=>m,HC:()=>r,HT:()=>c,II:()=>G,JU:()=>L,NR:()=>w,OX:()=>R,PH:()=>et,QT:()=>p,Qx:()=>u,R1:()=>H,SJ:()=>y,UE:()=>F,VW:()=>x,W2:()=>j,X8:()=>g,Z3:()=>M,_m:()=>V,a6:()=>D,aP:()=>B,bV:()=>O,bZ:()=>Z,c1:()=>d,cQ:()=>P,dd:()=>K,dg:()=>I,dw:()=>$,dx:()=>b,f$:()=>J,h0:()=>N,h1:()=>X,hc:()=>i,hn:()=>ee,l2:()=>C,lv:()=>A,mx:()=>v,oS:()=>_,p:()=>en,tn:()=>o,u6:()=>Q,uc:()=>U,v7:()=>q,xC:()=>s,xq:()=>h,xw:()=>ei,zo:()=>ec,zr:()=>W})},38770:(e,n,t)=>{"use strict";t.d(n,{A:()=>a});let a=t(51916).A},51533:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>K});var a=t(65321),i=t(97109),c=t(17807),s=t(63455),r=t(68787),o=t(85114),l=t(85493),d=t(38332),p=t(84253),u=t(26171),m=t(33442),h=t(11702),y=t(25258),g=t(2256),f=t(38770),x=t(7576),j=t(58569),b=t(57271),A=t(83914),I=t(3638),S=t(32565),w=t(99452);function $(){return($=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let v=i.forwardRef(({prefixCls:e="rc-switch",className:n,checked:t,defaultChecked:a,disabled:c,loadingIcon:s,checkedChildren:r,unCheckedChildren:o,onClick:l,onChange:d,onKeyDown:p,styles:u,classNames:m,...h},y)=>{let[g,f]=(0,S.A)(a??!1,t);function x(e,n){let t=g;return c||(f(t=e),d?.(t,n)),t}let j=(0,I.$)(e,n,{[`${e}-checked`]:g,[`${e}-disabled`]:c});return i.createElement("button",$({},h,{type:"button",role:"switch","aria-checked":g,disabled:c,className:j,ref:y,onKeyDown:function(e){e.which===w.A.LEFT?x(!1,e):e.which===w.A.RIGHT&&x(!0,e),p?.(e)},onClick:function(e){let n=x(!g,e);l?.(n,e)}}),s,i.createElement("span",{className:`${e}-inner`},i.createElement("span",{className:(0,I.$)(`${e}-inner-checked`,m?.content),style:u?.content},r),i.createElement("span",{className:(0,I.$)(`${e}-inner-unchecked`,m?.content),style:u?.content},o)))});v.displayName="Switch";var k=t(42644),T=t(92162),E=t(38862),C=t(74567),N=t(6831),O=t(27273),R=t(15561),P=t(47252),q=t(7961),D=t(16666),J=t(10540),L=t(28403);let U=(0,J.OF)("Switch",e=>{let n=(0,L.oX)(e,{switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchLoadingIconSize:e.calc(e.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[(e=>{let{componentCls:n,trackHeight:t,trackMinWidth:a}=e;return{[n]:{...(0,q.dF)(e),position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:a,height:t,lineHeight:(0,R.zA)(t),verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",...(0,D.V)(),[`&:hover:not(${n}-disabled)`]:{background:e.colorTextTertiary},...(0,q.K8)(e),[`&${n}-checked`]:{background:e.switchColor,[`&:hover:not(${n}-disabled)`]:{background:e.colorPrimaryHover}},[`&${n}-loading, &${n}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${n}-rtl`]:{direction:"rtl"}}}})(n),(e=>{let{componentCls:n,trackHeight:t,trackPadding:a,innerMinMargin:i,innerMaxMargin:c,handleSize:s,switchDuration:r,calc:o}=e,l=`${n}-inner`,d=(0,R.zA)(o(s).add(o(a).mul(2)).equal()),p=(0,R.zA)(o(c).mul(2).equal());return{[n]:{[l]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:c,paddingInlineEnd:i,transition:["padding-inline-start","padding-inline-end"].map(e=>`${e} ${r} ease-in-out`).join(", "),...(0,D.V)(),[`${l}-checked, ${l}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,pointerEvents:"none",minHeight:t,transition:["margin-inline-start","margin-inline-end"].map(e=>`${e} ${r} ease-in-out`).join(", "),...(0,D.V)()},[`${l}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${p})`,marginInlineEnd:`calc(100% - ${d} + ${p})`},[`${l}-unchecked`]:{marginTop:o(t).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${n}-checked ${l}`]:{paddingInlineStart:i,paddingInlineEnd:c,[`${l}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${l}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${p})`,marginInlineEnd:`calc(-100% + ${d} - ${p})`}},[`&:not(${n}-disabled):active`]:{[`&:not(${n}-checked) ${l}`]:{[`${l}-unchecked`]:{marginInlineStart:o(a).mul(2).equal(),marginInlineEnd:o(a).mul(-1).mul(2).equal()}},[`&${n}-checked ${l}`]:{[`${l}-checked`]:{marginInlineStart:o(a).mul(-1).mul(2).equal(),marginInlineEnd:o(a).mul(2).equal()}}}}}})(n),(e=>{let{componentCls:n,trackPadding:t,handleBg:a,handleShadow:i,handleSize:c,calc:s}=e,r=`${n}-handle`;return{[n]:{[r]:{position:"absolute",top:t,insetInlineStart:t,width:c,height:c,transition:`all ${e.switchDuration} ease-in-out`,...(0,D.V)(),"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:a,borderRadius:s(c).div(2).equal(),boxShadow:i,transition:`all ${e.switchDuration} ease-in-out`,content:'""',...(0,D.V)()}},[`&${n}-checked ${r}`]:{insetInlineStart:`calc(100% - ${(0,R.zA)(s(c).add(t).equal())})`},[`&:not(${n}-disabled):active`]:{[`${r}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${n}-checked ${r}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}})(n),(e=>{let{componentCls:n,handleSize:t,calc:a}=e;return{[n]:{[`${n}-loading-icon${e.iconCls}`]:{position:"relative",top:a(a(t).sub(e.fontSize)).div(2).equal(),color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${n}-checked ${n}-loading-icon`]:{color:e.switchColor}}}})(n),(e=>{let{componentCls:n,trackHeightSM:t,trackPadding:a,trackMinWidthSM:i,innerMinMarginSM:c,innerMaxMarginSM:s,handleSizeSM:r,calc:o}=e,l=`${n}-inner`,d=(0,R.zA)(o(r).add(o(a).mul(2)).equal()),p=(0,R.zA)(o(s).mul(2).equal());return{[n]:{[`&${n}-small`]:{minWidth:i,height:t,lineHeight:(0,R.zA)(t),[`${n}-inner`]:{paddingInlineStart:s,paddingInlineEnd:c,[`${l}-checked, ${l}-unchecked`]:{minHeight:t},[`${l}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${p})`,marginInlineEnd:`calc(100% - ${d} + ${p})`},[`${l}-unchecked`]:{marginTop:o(t).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${n}-handle`]:{width:r,height:r},[`${n}-loading-icon`]:{top:o(o(r).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${n}-checked`]:{[`${n}-inner`]:{paddingInlineStart:c,paddingInlineEnd:s,[`${l}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${l}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${p})`,marginInlineEnd:`calc(-100% + ${d} - ${p})`}},[`${n}-handle`]:{insetInlineStart:`calc(100% - ${(0,R.zA)(o(r).add(a).equal())})`}},[`&:not(${n}-disabled):active`]:{[`&:not(${n}-checked) ${l}`]:{[`${l}-unchecked`]:{marginInlineStart:o(e.marginXXS).div(2).equal(),marginInlineEnd:o(e.marginXXS).mul(-1).div(2).equal()}},[`&${n}-checked ${l}`]:{[`${l}-checked`]:{marginInlineStart:o(e.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:o(e.marginXXS).div(2).equal()}}}}}}})(n)]},e=>{let{fontSize:n,lineHeight:t,controlHeight:a,colorWhite:i}=e,c=n*t,s=a/2,r=c-4,o=s-4;return{trackHeight:c,trackHeightSM:s,trackMinWidth:2*r+8,trackMinWidthSM:2*o+4,trackPadding:2,handleBg:i,handleSize:r,handleSizeSM:o,handleShadow:`0 2px 4px 0 ${new P.Y("#00230b").setA(.2).toRgbString()}`,innerMinMargin:r/2,innerMaxMargin:r+2+4,innerMinMarginSM:o/2,innerMaxMarginSM:o+2+4}}),_=i.forwardRef((e,n)=>{let{prefixCls:t,size:a,disabled:c,loading:s,className:r,rootClassName:o,style:l,checked:d,value:p,defaultChecked:u,defaultValue:m,onChange:h,styles:y,classNames:g,...f}=e,[x,j]=(0,k.PW)(u??m??!1,d??p),{getPrefixCls:b,direction:S,className:w,style:$,classNames:R,styles:P}=(0,C.TP)("switch"),q=i.useContext(N.A),D=(c??q)||s,J=b("switch",t),[L,_]=U(J),H=(0,O.A)(a),z={...e,size:H,disabled:D},F=(0,T.XT)($),M=(0,T.XT)(l),[V,X]=(0,T.AV)([R,g],[P,F,y,M],{props:z}),W=i.createElement("div",{className:(0,I.$)(`${J}-handle`,V.indicator),style:X.indicator},s&&i.createElement(A.A,{className:`${J}-loading-icon`})),B=(0,I.$)(w,{[`${J}-small`]:"small"===H,[`${J}-loading`]:s,[`${J}-rtl`]:"rtl"===S},r,o,V.root,L,_);return i.createElement(E.A,{component:"Switch",disabled:D},i.createElement(v,{...f,classNames:V,styles:X,checked:x,onChange:(...e)=>{j(e[0]),h?.(...e)},prefixCls:J,className:B,style:X.root,disabled:D,ref:n,loadingIcon:W}))});_.__ANT_SWITCH=!0;var H=t(94992),z=t(54746),F=t(99650),M=t(58209),V=t(6578),X=t(13014);let W=[{label:"文本",value:"text"},{label:"数字",value:"number"},{label:"日期",value:"date"},{label:"表格",value:"table"},{label:"列表",value:"list"}],B=[{label:"必需事实",value:"required_fact"},{label:"必需章节",value:"required_chapter"},{label:"必需文件角色",value:"required_file_role"},{label:"必需提示词角色",value:"required_prompt_role"},{label:"事实必须有来源",value:"source_required"},{label:"禁止出现文本",value:"forbidden_text"},{label:"章节最低字数",value:"min_chapter_length"},{label:"必须有表格",value:"table_required"}],G=[{label:"错误(阻断)",value:"error"},{label:"警告(提醒)",value:"warning"},{label:"信息(提示)",value:"info"}];function K(){var e,n;let t=(0,X.Vr)(),{message:A}=c.A.useApp(),[I]=s.A.useForm(),[S,w]=(0,i.useState)([]),[$,v]=(0,i.useState)([]),[k,T]=(0,i.useState)(!1),E=async()=>{let[e,n]=await Promise.all([(0,V.mx)(),(0,V.lv)()]);w(e.specs),v(n.roles)};(0,i.useEffect)(()=>{E().catch(()=>A.error(t("common.error")))},[A,t]);let C=$.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),N=$.filter(e=>"prompt"===e.type).map(e=>({label:e.name,value:e.id})),O=null!=(n=null==(e=s.A.useWatch("factFields",I))?void 0:e.map(e=>({label:e.name||e.id,value:e.id})))?n:[],R=e=>{I.setFieldsValue(null!=e?e:{id:"spec-".concat(Date.now()),name:"",description:"",factFields:[],chapterRules:[],gateRules:[]}),T(!0)},P=async()=>{try{let e=await I.validateFields(),n=await (0,V.EK)(e);w(n.specs),T(!1),A.success(t("common.success"))}catch(e){e instanceof Error&&A.error(e.message)}},q=async e=>{w((await (0,V.ER)(e)).specs)};return(0,a.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,a.jsx)(r.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle mb-1",children:t("specs.title")}),(0,a.jsx)("p",{className:"pageDesc mb-0",children:t("specs.description")})]}),(0,a.jsx)(o.Ay,{type:"primary",icon:(0,a.jsx)(z.A,{}),onClick:()=>R(),children:t("specs.newSpec")})]})}),(0,a.jsx)(l.A,{type:"info",showIcon:!0,message:t("specs.plainGuideTitle"),description:t("specs.plainGuideDesc")}),(0,a.jsx)(r.A,{title:t("specs.list"),children:(0,a.jsx)(d.A,{dataSource:S,locale:{emptyText:(0,a.jsx)(p.A,{description:t("common.noData")})},renderItem:e=>(0,a.jsx)(d.A.Item,{actions:[(0,a.jsx)(o.Ay,{type:"text",icon:(0,a.jsx)(F.A,{}),onClick:()=>R(e)},"edit"),(0,a.jsx)(u.A,{title:t("common.confirm"),disabled:e.builtIn,onConfirm:()=>{q(e.id)},children:(0,a.jsx)(o.Ay,{type:"text",danger:!0,icon:(0,a.jsx)(M.A,{}),disabled:e.builtIn})},"delete")],children:(0,a.jsx)(d.A.Item.Meta,{title:(0,a.jsxs)(m.A,{children:[(0,a.jsx)("span",{children:e.name}),e.builtIn&&(0,a.jsx)(h.A,{color:"gold",children:t("documents.builtIn")}),(0,a.jsx)(h.A,{children:e.id})]}),description:"".concat(e.description||"-"," \xb7 ").concat(t("specs.facts"),": ").concat(e.factFields.length," \xb7 ").concat(t("specs.chapters"),": ").concat(e.chapterRules.length," \xb7 ").concat(t("specs.gates"),": ").concat(e.gateRules.length)})})})}),(0,a.jsx)(y.A,{maskClosable:!1,title:t("specs.editor"),open:k,onOk:()=>{P()},onCancel:()=>T(!1),width:980,centered:!0,okText:t("common.save"),children:(0,a.jsxs)(s.A,{form:I,layout:"vertical",children:[(0,a.jsxs)(g.A,{gutter:12,children:[(0,a.jsx)(f.A,{span:8,children:(0,a.jsx)(s.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,a.jsx)(x.A,{disabled:!0})})}),(0,a.jsx)(f.A,{span:8,children:(0,a.jsx)(s.A.Item,{name:"name",label:t("specs.name"),rules:[{required:!0}],children:(0,a.jsx)(x.A,{})})}),(0,a.jsx)(f.A,{span:8,children:(0,a.jsx)(s.A.Item,{name:"wordTemplatePath",label:t("specs.wordTemplatePath"),children:(0,a.jsx)(x.A,{placeholder:"/path/to/template.docx"})})})]}),(0,a.jsx)(s.A.Item,{name:"description",label:t("specs.specDescription"),children:(0,a.jsx)(x.A,{})}),(0,a.jsx)(j.A,{items:[{key:"facts",label:t("specs.facts"),children:(0,a.jsx)(s.A.List,{name:"factFields",children:(e,n)=>{let{add:i,remove:c}=n;return(0,a.jsxs)(m.A,{direction:"vertical",className:"w-full",children:[e.map(e=>(0,a.jsxs)(r.A,{size:"small",children:[(0,a.jsxs)(g.A,{gutter:8,children:[(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"id"],label:"ID",initialValue:"fact-".concat(Date.now()),children:(0,a.jsx)(x.A,{disabled:!0})})}),(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"name"],label:t("specs.factName"),rules:[{required:!0}],children:(0,a.jsx)(x.A,{})})}),(0,a.jsx)(f.A,{span:4,children:(0,a.jsx)(s.A.Item,{name:[e.name,"type"],label:t("specs.factType"),initialValue:"text",children:(0,a.jsx)(b.A,{options:W})})}),(0,a.jsx)(f.A,{span:4,children:(0,a.jsx)(s.A.Item,{name:[e.name,"required"],label:t("specs.required"),valuePropName:"checked",children:(0,a.jsx)(_,{})})}),(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"sourceRoleIds"],label:t("specs.sourceRoles"),children:(0,a.jsx)(b.A,{mode:"multiple",options:C})})}),(0,a.jsx)(f.A,{span:1,children:(0,a.jsx)(o.Ay,{danger:!0,onClick:()=>c(e.name),children:"-"})})]}),(0,a.jsx)(s.A.Item,{name:[e.name,"extractionHint"],label:t("specs.extractionHint"),children:(0,a.jsx)(x.A,{})}),(0,a.jsx)(s.A.Item,{name:[e.name,"validationHint"],label:t("specs.validationHint"),children:(0,a.jsx)(x.A,{})})]},e.key)),(0,a.jsx)(o.Ay,{onClick:()=>i({id:"fact-".concat(Date.now()),type:"text",required:!0}),children:t("specs.addFact")})]})}})},{key:"chapters",label:t("specs.chapters"),children:(0,a.jsx)(s.A.List,{name:"chapterRules",children:(e,n)=>{let{add:i,remove:c}=n;return(0,a.jsxs)(m.A,{direction:"vertical",className:"w-full",children:[e.map((e,n)=>(0,a.jsxs)(r.A,{size:"small",children:[(0,a.jsxs)(g.A,{gutter:8,children:[(0,a.jsx)(f.A,{span:4,children:(0,a.jsx)(s.A.Item,{name:[e.name,"id"],label:"ID",initialValue:"chapter-".concat(Date.now()),children:(0,a.jsx)(x.A,{disabled:!0})})}),(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"title"],label:t("specs.chapterTitle"),rules:[{required:!0}],children:(0,a.jsx)(x.A,{})})}),(0,a.jsx)(f.A,{span:3,children:(0,a.jsx)(s.A.Item,{name:[e.name,"order"],label:t("specs.order"),initialValue:n,children:(0,a.jsx)(H.A,{className:"w-full"})})}),(0,a.jsx)(f.A,{span:3,children:(0,a.jsx)(s.A.Item,{name:[e.name,"minWords"],label:t("specs.minWords"),children:(0,a.jsx)(H.A,{className:"w-full"})})}),(0,a.jsx)(f.A,{span:3,children:(0,a.jsx)(s.A.Item,{name:[e.name,"required"],label:t("specs.required"),valuePropName:"checked",children:(0,a.jsx)(_,{})})}),(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"requiredFactIds"],label:t("specs.requiredFacts"),children:(0,a.jsx)(b.A,{mode:"multiple",options:O})})}),(0,a.jsx)(f.A,{span:1,children:(0,a.jsx)(o.Ay,{danger:!0,onClick:()=>c(e.name),children:"-"})})]}),(0,a.jsxs)(g.A,{gutter:8,children:[(0,a.jsx)(f.A,{span:12,children:(0,a.jsx)(s.A.Item,{name:[e.name,"requiredFileRoleIds"],label:t("specs.requiredFileRoles"),children:(0,a.jsx)(b.A,{mode:"multiple",options:C})})}),(0,a.jsx)(f.A,{span:12,children:(0,a.jsx)(s.A.Item,{name:[e.name,"requiredPromptRoleIds"],label:t("specs.requiredPromptRoles"),children:(0,a.jsx)(b.A,{mode:"multiple",options:N})})})]}),(0,a.jsx)(s.A.Item,{name:[e.name,"generationHint"],label:t("specs.generationHint"),children:(0,a.jsx)(x.A,{})})]},e.key)),(0,a.jsx)(o.Ay,{onClick:()=>i({id:"chapter-".concat(Date.now()),order:e.length,required:!0}),children:t("specs.addChapter")})]})}})},{key:"gates",label:t("specs.gates"),children:(0,a.jsx)(s.A.List,{name:"gateRules",children:(e,n)=>{let{add:i,remove:c}=n;return(0,a.jsxs)(m.A,{direction:"vertical",className:"w-full",children:[e.map(e=>(0,a.jsxs)(g.A,{gutter:8,children:[(0,a.jsx)(f.A,{span:4,children:(0,a.jsx)(s.A.Item,{name:[e.name,"id"],initialValue:"gate-".concat(Date.now()),children:(0,a.jsx)(x.A,{disabled:!0})})}),(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"name"],rules:[{required:!0}],children:(0,a.jsx)(x.A,{placeholder:t("specs.gateName")})})}),(0,a.jsx)(f.A,{span:5,children:(0,a.jsx)(s.A.Item,{name:[e.name,"type"],initialValue:"required_fact",children:(0,a.jsx)(b.A,{options:B})})}),(0,a.jsx)(f.A,{span:4,children:(0,a.jsx)(s.A.Item,{name:[e.name,"level"],initialValue:"error",children:(0,a.jsx)(b.A,{options:G})})}),(0,a.jsx)(f.A,{span:3,children:(0,a.jsx)(s.A.Item,{name:[e.name,"target"],children:(0,a.jsx)(x.A,{placeholder:"target"})})}),(0,a.jsx)(f.A,{span:2,children:(0,a.jsx)(s.A.Item,{name:[e.name,"value"],children:(0,a.jsx)(x.A,{placeholder:"value"})})}),(0,a.jsx)(f.A,{span:1,children:(0,a.jsx)(o.Ay,{danger:!0,onClick:()=>c(e.name),children:"-"})})]},e.key)),(0,a.jsx)(o.Ay,{onClick:()=>i({id:"gate-".concat(Date.now()),type:"required_fact",level:"error"}),children:t("specs.addGate")})]})}})}]})]})})]})}},94773:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-specs",function(){return t(51533)}])}},e=>{e.O(0,[260,167,382,628,271,576,700,174,183,232,951,20,636,593,792],()=>e(e.s=94773)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{6578:(e,t,n)=>{"use strict";async function s(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function o(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return s("/api/kb/stats".concat(t))}async function i(e){var t,n;let o=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&o.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&o.set("category",e.category),(null==e?void 0:e.page)&&o.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&o.set("limit",String(null!=(n=e.limit)?n:50)),s("/api/kb/files?".concat(o))}async function a(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),s("/api/kb/files/detail?".concat(n))}async function r(e,t){return s("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function c(e,t,n){return s("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let s=new FileReader;s.onload=()=>{let e=s.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},s.onerror=n,s.readAsDataURL(e)})}async function d(e,t,n){return s("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return s("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),s("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return s("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return s("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return s("/api/kb/features")}async function j(e,t){var n,o,i,a,r;let c=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&c.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&c.set("category",t.category),(null==t?void 0:t.limit)&&c.set("limit",String(null!=(r=t.limit)?r:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(o=t.weights)?void 0:o.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(i=t.weights)?void 0:i.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(a=t.weights)?void 0:a.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),s("/api/kb/search?".concat(c))}async function w(){return s("/api/prompt")}async function A(e){return s("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function v(e){return s("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function b(e,t){return s("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function S(e){return s("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return s("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function I(){return s("/api/documents/specs")}async function C(e){return s("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return s("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(){return s("/api/documents/templates")}async function E(e){return s("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(e){return s("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function N(e){return s("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function O(e){return s("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(){return s("/api/documents/generated")}async function L(e){return s("/api/documents/generated/".concat(encodeURIComponent(e)))}async function D(e,t){return s("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function U(){return s("/api/assets/generated")}async function J(e){return s("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function M(e){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function F(e,t){return s("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function z(e){return s("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(e,t){return s("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function H(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function G(){return s("/api/config/providers")}async function K(e,t){return s("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function V(e){return s("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function W(){return s("/api/config/models")}async function X(e){return s("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function B(){return s("/api/config/embedding")}async function Q(e){return s("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Z(){return s("/api/config/embedding/healthCheck",{method:"POST"})}async function $(e){return s("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function Y(){return s("/api/system/stats")}async function ee(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return s("/api/context".concat(n))}async function et(e){return s("/api/context?type=".concat(e,"&stats=1"))}async function en(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function es(e){return s("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function eo(e){return s("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function ei(e,t){return s("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ea(e){return s("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>q,Bh:()=>ea,Dl:()=>R,E:()=>es,EK:()=>C,ER:()=>T,FC:()=>Y,FV:()=>b,H1:()=>g,H7:()=>m,HC:()=>r,HT:()=>i,II:()=>B,JU:()=>J,NR:()=>S,OX:()=>O,PH:()=>en,QT:()=>u,Qx:()=>p,R1:()=>z,SJ:()=>y,UE:()=>H,VW:()=>x,W2:()=>j,X8:()=>f,Z3:()=>G,_m:()=>K,a6:()=>D,aP:()=>X,bV:()=>N,bZ:()=>$,c1:()=>d,cQ:()=>_,dd:()=>Q,dg:()=>v,dw:()=>k,dx:()=>w,f$:()=>U,h0:()=>P,h1:()=>V,hc:()=>o,hn:()=>ee,l2:()=>E,lv:()=>A,mx:()=>I,oS:()=>F,p:()=>et,tn:()=>c,u6:()=>Z,uc:()=>M,v7:()=>L,xC:()=>a,xq:()=>h,xw:()=>eo,zo:()=>ei,zr:()=>W})},16403:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return n(19562)}])},19562:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>W});var s=n(65321),o=n(97109),i=n(7576),a=n(35292),r=n(17807),c=n(63455),l=n(68787),d=n(85114),u=n(2256),p=n(38770),m=n(38332),h=n(84253),y=n(26171),f=n(33442),g=n(11702),x=n(57271),j=n(9730),w=n(58569),A=n(25258),v=n(26631),b=n(23216),S=n(26619),k=n(8263),I=n(16285),C=n(8579),T=n(75548),R=n(7851),E=n(84742),P=n(29071),N=n(63552),O=n(76830),_=n(83914),L=n(58209),D=n(54746),U=n(93051),J=n(99650),M=n(67547),F=n(99811),z=n(6578),q=n(13014);let{TextArea:H}=i.A,{Paragraph:G}=a.A,K=null;function V(){null==K||K.listeners.forEach(e=>e())}function W(){var e,t,n;let a=(0,q.Vr)(),{message:W}=r.A.useApp(),[X]=c.A.useForm(),[B,Q]=(0,o.useState)([]),[Z,$]=(0,o.useState)("construction-organization-design"),[Y,ee]=(0,o.useState)([]),[et,en]=(0,o.useState)([]),[es,eo]=(0,o.useState)([]),[ei,ea]=(0,o.useState)(!1),[er,ec]=(0,o.useState)(null),[el,ed]=(0,o.useState)(""),[eu,ep]=(0,o.useState)([]),[em,eh]=(0,o.useState)(null),[ey,ef]=(0,o.useState)(!1),[eg,ex]=(0,o.useState)(null),[ej,ew]=(0,o.useState)(!1),[eA,ev]=(0,o.useState)([]),[eb,eS]=(0,o.useState)(null),ek=async()=>{try{ep((await (0,z.cQ)()).documents)}catch(e){ep([])}};(0,o.useEffect)(()=>{let e=()=>{K&&(ev(K.flowSteps),eS(K.activeFlowKey),ea(K.loading),K.draft&&ec(K.draft),void 0!==K.content&&ed(K.content))};return null==K||K.listeners.add(e),e(),()=>{null==K||K.listeners.delete(e)}},[]),(0,o.useEffect)(()=>{(0,z.Dl)().then(e=>{var t,n;Q(e.templates),$(null!=(n=null==(t=e.templates[0])?void 0:t.id)?n:"construction-organization-design")}).catch(()=>W.error(a("common.error"))),(0,z.lv)().then(e=>{ee(e.roles),en(e.configs)}).catch(()=>{ee([]),en([])}),(0,z.mx)().then(e=>eo(e.specs)).catch(()=>eo([])),ek()},[W,a]);let eI=(0,o.useMemo)(()=>B.find(e=>e.id===Z),[B,Z]),eC=et.map(e=>({label:e.name,value:e.id})),eT=es.map(e=>({label:e.name,value:e.id})),eR=Math.max(0,eA.findIndex(e=>e.key===eb)),eE=e=>e.map((e,t)=>({key:"sub-".concat(t),title:e,status:"wait"})),eP=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eI,t=es.find(t=>t.id===(null==e?void 0:e.documentSpecId)),n=et.find(t=>t.id===(null==e?void 0:e.projectRoleConfigId)),o=((null==n?void 0:n.fileRoles)||[]).map(e=>{var t;return(null==(t=Y.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),i=((null==n?void 0:n.promptRoles)||[]).map(e=>{var t;return(null==(t=Y.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId}),r=(null==t?void 0:t.factFields.map(e=>e.name))||(null==e?void 0:e.chapters.flatMap(e=>e.requiredFacts))||[],c=(null==e?void 0:e.chapters.map(e=>e.title))||[],l=i.some(e=>/封面|图片|资源|cover|image/iu.test(e));return[{key:"prepare",title:a("documents.flowPrepare"),description:"读取“".concat((null==e?void 0:e.name)||"当前模板","”并创建后台生成任务"),status:"process",icon:(0,s.jsx)(v.A,{}),subSteps:eE(["读取模板参数",(null==e?void 0:e.documentSpecId)?"加载规范包:".concat((null==t?void 0:t.name)||e.documentSpecId):"未绑定规范包,使用模板章节要求","创建后台生成任务"])},{key:"role_binding",title:"动态角色配置绑定",description:"绑定 ".concat(o.length," 个文件角色、").concat(i.length," 个提示词角色"),status:"wait",icon:(0,s.jsx)(b.A,{}),subSteps:eE([...o.length?o.map(e=>"文件角色:".concat(e)):["没有文件角色,使用模板绑定文件"],...i.length?i.map(e=>"提示词角色:".concat(e)):["没有提示词角色,使用默认生成策略"]].slice(0,10))},{key:"knowledge_retrieval",title:"知识库证据检索",description:"按 ".concat(c.length," 个章节检索文本、文档、表格、图片、图纸和附件"),status:"wait",icon:(0,s.jsx)(S.A,{}),subSteps:eE(c.length?c.slice(0,10).map(e=>"检索章节:".concat(e)):["按模板标题检索证据"])},{key:"file_understanding",title:"多类型文件理解",description:"按文件角色处理文本、PDF/Word、表格、图片、图纸和附件",status:"wait",icon:(0,s.jsx)(k.A,{}),subSteps:eE(["识别文件类型和角色","构建结构化资源证据包","必要时调用多模态文件理解"])},{key:"fact_extraction",title:"动态 schema 事实抽取",description:"按 ".concat(r.length," 个规范/章节事实字段抽取并检测冲突"),status:"wait",icon:(0,s.jsx)(I.A,{}),subSteps:eE(r.length?r.slice(0,10).map(e=>"抽取事实:".concat(e)):["抽取模板要求的事实","合并来源和角色","检测事实冲突"])},{key:"chapter_generation",title:"章节生成",description:"按 ".concat(c.length," 个模板章节逐章生成"),status:"wait",icon:(0,s.jsx)(C.A,{}),subSteps:eE(c.length?c.slice(0,10).map(e=>"生成:".concat(e)):["构造章节提示词","等待 LLM 生成","整理章节证据"])},...l?[{key:"asset_generation",title:"生成资源处理",description:"根据资源/图片提示词生成或登记本地资源",status:"wait",icon:(0,s.jsx)(T.A,{}),subSteps:eE(["生成资源提示词","保存到 generatedDocuments/assets","登记资源元数据"])}]:[],{key:"validation",title:"规范包与门禁校验",description:t?"执行 ".concat(t.gateRules.length," 条门禁规则"):"执行模板基础校验",status:"wait",icon:(0,s.jsx)(R.A,{}),subSteps:eE([...(null==t?void 0:t.factFields.filter(e=>e.required).map(e=>"必填事实:".concat(e.name)))||[],...(null==t?void 0:t.gateRules.map(e=>"门禁:".concat(e.name)))||["检查章节证据","检查缺失项","检查导出门禁"]].slice(0,10))},{key:"formatting",title:a("documents.flowFormatting"),description:"整理标题、表格、图片、附件引用和正式 Markdown",status:"wait",icon:(0,s.jsx)(E.A,{}),subSteps:eE(["整理标题层级","整理多类型资源引用","生成正式 Markdown"])},{key:"llm_review",title:"LLM 审查优化",description:"再次使用动态 schema、角色和结构化证据审查优化初稿",status:"wait",icon:(0,s.jsx)(P.A,{}),subSteps:eE(["构造审查提示词","检查事实来源和冲突","回填优化后的 Markdown"])},{key:"export_ready",title:"导出就绪",description:"确认 Markdown/HTML/DOCX/PDF 可导出",status:"wait",icon:(0,s.jsx)(N.A,{}),subSteps:eE(["生成导出检查清单","确认阻断项","准备导出格式"])},{key:"done",title:a("documents.flowDone"),description:a("documents.flowDoneDesc"),status:"wait",icon:(0,s.jsx)(O.A,{}),subSteps:eE(["展示生成结果","允许编辑正文","允许导出文件"])}]},eN=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ei;(null==K?void 0:K.loading)&&(K.flowSteps=e,K.activeFlowKey=t,K.loading=n,V())},eO=(e,t)=>{if("wait"===t)return e.subSteps.map(e=>({...e,status:"wait"}));if("finish"===t)return e.subSteps.map(e=>({...e,status:"finish"}));if("error"===t)return e.subSteps.map((e,t)=>({...e,status:0===t?"error":e.status}));let n=e.subSteps.findIndex(e=>"wait"===e.status);return e.subSteps.map((e,t)=>t<n||-1===n?{...e,status:"finish"}:t===n?{...e,status:"process"}:e)},e_=(e,t,n)=>{eS(e),ev(s=>{let o=s.map(s=>s.key===e?{...s,status:t,description:n||s.description,subSteps:eO(s,t)}:s);return eN(o,e),o})};(0,o.useEffect)(()=>{if(!ei||!eb)return;let e=window.setInterval(()=>{ev(e=>{let t=e.map(e=>{if(e.key!==eb||"process"!==e.status)return e;let t=e.subSteps.findIndex(e=>"process"===e.status),n=t<0?0:Math.min(t+1,e.subSteps.length-1);return{...e,subSteps:e.subSteps.map((e,t)=>t<n?{...e,status:"finish"}:t===n?{...e,status:"process"}:{...e,status:"wait"})}});return eN(t,eb),t})},1400);return()=>window.clearInterval(e)},[eb,ei]);let eL=e=>{ev(t=>{let n=t.findIndex(t=>t.key===e),s=t.map((e,t)=>t<n&&"error"!==e.status?{...e,status:"finish",subSteps:eO(e,"finish")}:e);return eN(s,e),s})},eD=e=>{X.setFieldsValue(null!=e?e:{id:"custom-template-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,documentSpecId:void 0,chapters:[]}),ew(!0)},eU=async()=>{try{let e=await X.validateFields(),t=await (0,z.l2)(e);Q(t.templates),$(t.template.id),ew(!1),await ek(),W.success(a("common.success"))}catch(e){e instanceof Error&&W.error(e.message)}},eJ=async e=>{try{let t=await (0,z.bV)(e);Q(t.templates),$(t.template.id),W.success(a("common.success"))}catch(e){W.error(a("common.error"))}},eM=async e=>{try{var t,n;let s=await (0,z.h0)(e);Q(s.templates),$(null!=(n=null==(t=s.templates[0])?void 0:t.id)?n:""),W.success(a("common.success"))}catch(e){W.error(a("common.error"))}},eF=async e=>{let t=[{key:"chapter_generation",message:"后台任务已创建,正在轮询等待 LLM 章节生成完成…"},{key:"asset_generation",message:"正在轮询等待封面和生成资源写入本地记录…"},{key:"validation",message:"正在轮询等待校验、导出门禁和格式化完成…"},{key:"llm_review",message:"正在轮询等待 LLM 审查优化完成…"}],n=0;for(;;){let{document:s}=await (0,z.v7)(e);if("completed"===s.status&&s.draft)return s;if("failed"===s.status)throw Error(s.error||"生成失败");let o=t[Math.min(n,t.length-1)];eL(o.key),e_(o.key,"process",o.message),n+=1,await new Promise(e=>window.setTimeout(e,1500))}},ez=async()=>{if(!Z)return;if(null==K?void 0:K.loading){ev(K.flowSteps),eS(K.activeFlowKey),ea(!0);return}ea(!0);let e=eP(B.find(e=>e.id===Z)||eI),t=(0,z.OX)({templateId:Z});K={id:Date.now(),templateId:Z,loading:!0,flowSteps:e,activeFlowKey:"prepare",promise:t,listeners:new Set},ev(e),eS("prepare");let n=[{key:"role_binding",message:"正在读取模板、文件角色、提示词角色和文档规范包…"},{key:"knowledge_retrieval",message:"正在从知识库检索章节证据、表格、图片和附件…"},{key:"file_understanding",message:"正在准备多模态文件理解;如果模型支持图片/文件理解,会等待模型返回…"},{key:"fact_extraction",message:"正在等待 LLM 事实抽取和后续章节生成结果,请不要关闭页面…"}].map((e,t)=>window.setTimeout(()=>{eL(e.key),e_(e.key,"process",e.message)},600+900*t));try{let e=await t,s=e.documentId?await eF(e.documentId):void 0,o=e.draft||(null==s?void 0:s.draft);if(!o)throw Error("生成结果为空");(e.documentId||(null==s?void 0:s.id))&&eh(e.documentId||s.id),n.forEach(e=>window.clearTimeout(e)),eL("done"),ec(o),ed((null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown),(null==K?void 0:K.promise)===t&&(K.draft=o,K.content=(null==s?void 0:s.editedMarkdown)||(null==s?void 0:s.markdown)||o.markdown),ev(e=>{let t=e.map(e=>{let t=o.executionStages.find(t=>t.type===e.key);if("prepare"===e.key)return{...e,status:"finish",description:a("documents.flowPrepareDone"),subSteps:eO(e,"finish")};if("done"===e.key){let t=o.exportGate.passed?"finish":"error";return{...e,status:t,description:o.exportGate.passed?a("documents.flowDoneDesc"):a("documents.flowGateFailed"),subSteps:eO(e,t)}}if(!t)return"process"===e.status?{...e,status:"finish",subSteps:eO(e,"finish")}:e;let n="failed"===t.status?"error":"finish";return{...e,status:n,description:"".concat(t.status.toUpperCase(),":").concat(t.message||e.description),subSteps:eO(e,n)}});return eN(t,"done",!1),t}),eS("done"),(null==K?void 0:K.promise)===t&&(K.activeFlowKey="done",K.loading=!1,V()),await ek(),W.success(a("common.success"))}catch(n){let e=n instanceof Error?n.message:a("common.error");ev(t=>{let n=t.map(t=>"process"===t.status?{...t,status:"error",description:e,subSteps:eO(t,"error")}:t);return eN(n,eb,!1),n}),(null==K?void 0:K.promise)===t&&(K.loading=!1,K.error=e,V()),W.error(e)}finally{n.forEach(e=>window.clearTimeout(e)),ea(!1),(null==K?void 0:K.promise)===t&&(K.loading=!1,V())}},eq=async e=>{if(er){ef(!0);try{let o=null==(t=es.find(e=>e.id===(null==eI?void 0:eI.documentSpecId)))?void 0:t.wordTemplatePath;var t,n=await (0,z.UE)({documentId:em||void 0,title:er.title,markdown:el,format:e,enforceGate:"pdf"===e||"docx"===e,exportGate:er.exportGate,wordTemplatePath:o}),s="".concat(er.title,".").concat("markdown"===e?"md":e);let i=URL.createObjectURL(n),a=document.createElement("a");a.href=i,a.download=s,a.click(),URL.revokeObjectURL(i)}catch(e){W.error(a("common.error"))}finally{ef(!1)}}},eH=async()=>{if(er)try{if(em)await (0,z.a6)(em,{editedMarkdown:el,markdown:el});else{let e=await (0,z.Af)({...er,markdown:el});ec(e.draft)}await ek(),W.success(a("common.success"))}catch(e){W.error(a("common.error"))}},eG=async e=>{if(er){ex(e.id);try{var t;let n=await (0,z.R1)({templateId:er.templateId,chapterId:e.id}),s=er.chapters.map(t=>t.id===e.id?n.chapter:t);ec({...er,chapters:s}),t=n.chapter,ed(n=>n.includes(e.content)?n.replace(e.content,t.content):"".concat(n,"\n\n").concat(t.content)),W.success(a("common.success"))}catch(e){W.error(a("common.error"))}finally{ex(null)}}};return(0,s.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,s.jsx)(l.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"pageTitle mb-1",children:a("documents.title")}),(0,s.jsx)("p",{className:"pageDesc mb-0",children:a("documents.description")})]}),(0,s.jsx)(d.Ay,{type:"primary",size:"large",icon:(0,s.jsx)(D.A,{}),onClick:()=>eD(),children:a("documents.newTemplate")})]})}),(0,s.jsxs)(u.A,{gutter:[16,16],align:"top",children:[(0,s.jsxs)(p.A,{xs:24,lg:8,children:[(0,s.jsx)(l.A,{size:"small",title:a("documents.templateLibrary"),children:(0,s.jsx)(m.A,{dataSource:B,locale:{emptyText:(0,s.jsx)(h.A,{description:a("common.noData")})},renderItem:e=>(0,s.jsx)(m.A.Item,{onClick:()=>$(e.id),className:"cursor-pointer",actions:[(0,s.jsx)(d.Ay,{size:"small",type:"text",icon:(0,s.jsx)(U.A,{}),onClick:t=>{t.stopPropagation(),eJ(e.id)}},"copy"),(0,s.jsx)(d.Ay,{size:"small",type:"text",icon:(0,s.jsx)(J.A,{}),disabled:e.builtIn,onClick:t=>{t.stopPropagation(),eD(e)}},"edit"),(0,s.jsx)(y.A,{title:a("documents.deleteTemplateConfirm"),disabled:e.builtIn,onConfirm:t=>{null==t||t.stopPropagation(),eM(e.id)},children:(0,s.jsx)(d.Ay,{size:"small",type:"text",danger:!0,icon:(0,s.jsx)(L.A,{}),disabled:e.builtIn,onClick:e=>e.stopPropagation()})},"delete")],children:(0,s.jsx)(m.A.Item.Meta,{avatar:(0,s.jsx)(v.A,{}),title:(0,s.jsxs)(f.A,{children:[(0,s.jsx)("span",{children:e.name}),e.builtIn&&(0,s.jsx)(g.A,{children:a("documents.builtIn")}),Z===e.id&&(0,s.jsx)(g.A,{color:"blue",children:a("documents.selected")})]}),description:(0,s.jsxs)(f.A,{direction:"vertical",size:2,children:[(0,s.jsx)("span",{children:e.description}),(0,s.jsx)(g.A,{children:e.category})]})})})})}),(0,s.jsx)(l.A,{className:"mt-4",size:"small",title:a("documents.draftHistory"),children:(0,s.jsx)(m.A,{size:"small",dataSource:eu.slice(0,8),locale:{emptyText:(0,s.jsx)(h.A,{description:a("common.noData")})},renderItem:e=>(0,s.jsx)(m.A.Item,{onClick:()=>{(async()=>{eh(e.id),$(e.templateId);let{document:t}=await (0,z.v7)(e.id);ec(t.draft||null),ed(t.editedMarkdown||t.markdown)})()},className:"cursor-pointer",children:(0,s.jsx)(m.A.Item.Meta,{title:(0,s.jsxs)(f.A,{children:[(0,s.jsx)("span",{children:e.title}),(0,s.jsx)(g.A,{color:"completed"===e.status?"success":"failed"===e.status?"error":"processing",children:e.status})]}),description:new Date(e.updatedAt).toLocaleString()})})})})]}),(0,s.jsx)(p.A,{xs:24,lg:16,children:(0,s.jsx)(l.A,{size:"small",title:a("documents.workflow"),children:(0,s.jsxs)(f.A,{direction:"vertical",className:"w-full",size:"middle",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block mb-1",children:a("documents.template")}),(0,s.jsx)(x.A,{className:"w-full",value:Z,onChange:$,options:B.map(e=>({label:e.name,value:e.id}))})]}),eI&&(0,s.jsxs)(l.A,{size:"small",type:"inner",title:eI.outputTitle,children:[(0,s.jsx)(G,{children:eI.description}),(0,s.jsxs)(f.A,{wrap:!0,children:[eI.projectRoleConfigId?(0,s.jsx)(g.A,{color:"geekblue",children:(null==(e=et.find(e=>e.id===eI.projectRoleConfigId))?void 0:e.name)||eI.projectRoleConfigId}):(0,s.jsx)(g.A,{color:"warning",children:a("documents.noRoleConfig")}),eI.documentSpecId?(0,s.jsx)(g.A,{color:"cyan",children:(null==(t=es.find(e=>e.id===eI.documentSpecId))?void 0:t.name)||eI.documentSpecId}):null]})]}),eI&&(0,s.jsx)(f.A,{direction:"vertical",size:4,children:(0,s.jsxs)("span",{children:[a("documents.projectRoleConfig"),": ",(null==(n=et.find(e=>e.id===eI.projectRoleConfigId))?void 0:n.name)||a("documents.noRoleConfig")]})}),(0,s.jsx)(d.Ay,{type:"primary",size:"large",block:!0,icon:(0,s.jsx)(P.A,{}),loading:ei,disabled:!(null==eI?void 0:eI.projectRoleConfigId),onClick:()=>{ez()},children:a("documents.generate")}),eA.length>0&&(0,s.jsx)(l.A,{size:"small",type:"inner",title:a("documents.executionStatus"),children:(0,s.jsx)(j.A,{direction:"vertical",size:"small",current:eR,items:eA.map(e=>({title:e.title,description:(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{children:e.description}),(0,s.jsx)("div",{className:"space-y-0.5",children:e.subSteps.map(e=>{var t;return(0,s.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--colorTextSecondary)]",children:["process"===(t=e.status)?(0,s.jsx)(_.A,{}):"finish"===t?(0,s.jsx)(E.A,{}):"error"===t?(0,s.jsx)(L.A,{}):(0,s.jsx)("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-[var(--colorTextTertiary)]"}),(0,s.jsx)("span",{children:e.title})]},e.key)})})]}),status:e.status,icon:"process"===e.status?(0,s.jsx)(_.A,{}):e.icon}))})})]})})})]}),(0,s.jsx)(l.A,{size:"small",title:a("documents.editor"),extra:(0,s.jsx)(f.A,{wrap:!0,children:er&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Ay,{icon:(0,s.jsx)(M.A,{}),onClick:()=>{eH()},children:a("documents.saveDraft")}),(0,s.jsx)(d.Ay,{icon:(0,s.jsx)(O.A,{}),loading:ey,onClick:()=>{eq("markdown")},children:a("documents.downloadMarkdown")}),(0,s.jsx)(d.Ay,{loading:ey,onClick:()=>{eq("html")},children:a("documents.exportHtml")}),(0,s.jsx)(d.Ay,{loading:ey,onClick:()=>{eq("docx")},children:a("documents.exportDocx")}),(0,s.jsx)(d.Ay,{type:"primary",loading:ey,onClick:()=>{eq("pdf")},children:a("documents.exportPdf")})]})}),children:er?(0,s.jsx)(w.A,{items:[{key:"edit",label:a("documents.edit"),children:(0,s.jsx)(H,{rows:26,value:el,onChange:e=>ed(e.target.value)})},{key:"chapters",label:a("documents.chapters"),children:(0,s.jsx)(m.A,{dataSource:er.chapters,renderItem:e=>(0,s.jsx)(m.A.Item,{actions:[(0,s.jsx)(d.Ay,{size:"small",icon:(0,s.jsx)(F.A,{}),loading:eg===e.id,onClick:()=>{eG(e)},children:a("documents.regenerateChapter")},"regen")],children:(0,s.jsx)(m.A.Item.Meta,{title:e.title,description:(0,s.jsxs)(f.A,{direction:"vertical",children:[(0,s.jsxs)("span",{children:[a("documents.evidenceCount"),": ",e.evidence.length]}),(0,s.jsxs)("span",{children:[a("documents.missingCount"),": ",e.missingFacts.length]})]})})})})},{key:"facts",label:a("documents.structuredFacts"),children:(0,s.jsx)(m.A,{dataSource:er.structuredFacts,renderItem:e=>{var t;return(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)(m.A.Item.Meta,{title:"".concat(e.key,": ").concat(e.value),description:"".concat(e.sourceFile," \xb7 ").concat((null==(t=Y.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId)}),(0,s.jsx)(g.A,{children:e.confidence.toFixed(2)})]})}})},{key:"sources",label:a("documents.sources"),children:(0,s.jsx)(m.A,{dataSource:er.sources,renderItem:e=>(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)("span",{children:e.filePath}),(0,s.jsx)(g.A,{children:e.count})]})})},{key:"missing",label:a("documents.missingItems"),children:0===er.missingItems.length?(0,s.jsx)(h.A,{description:a("common.noData")}):(0,s.jsx)(m.A,{dataSource:er.missingItems,renderItem:e=>(0,s.jsx)(m.A.Item,{children:e})})},{key:"validation",label:a("documents.validation"),children:(0,s.jsx)(f.A,{direction:"vertical",className:"w-full",children:er.validationIssues.map(e=>(0,s.jsxs)(g.A,{color:"error"===e.level?"error":"warning"===e.level?"warning":"blue",children:[e.message,e.suggestion?":".concat(e.suggestion):""]},e.message))})},{key:"gate",label:a("documents.exportGate"),children:(0,s.jsx)(m.A,{dataSource:er.exportGate.checklist,renderItem:e=>(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)("span",{children:e.label}),(0,s.jsx)(g.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})},{key:"stages",label:a("documents.executionStages"),children:(0,s.jsx)(m.A,{dataSource:er.executionStages,renderItem:e=>{var t,n;return(0,s.jsxs)(m.A.Item,{children:[(0,s.jsx)(m.A.Item.Meta,{avatar:(t=e.type,({role_binding:(0,s.jsx)(b.A,{}),knowledge_retrieval:(0,s.jsx)(S.A,{}),file_understanding:(0,s.jsx)(k.A,{}),fact_extraction:(0,s.jsx)(I.A,{}),chapter_generation:(0,s.jsx)(C.A,{}),asset_generation:(0,s.jsx)(T.A,{}),validation:(0,s.jsx)(R.A,{}),formatting:(0,s.jsx)(E.A,{}),llm_review:(0,s.jsx)(P.A,{}),export_ready:(0,s.jsx)(N.A,{}),reference:(0,s.jsx)(T.A,{})})[t]||(0,s.jsx)(v.A,{})),title:"".concat({role_binding:"角色配置绑定",knowledge_retrieval:"知识库检索",file_understanding:"多模态文件理解",fact_extraction:"LLM 事实抽取",chapter_generation:"LLM 章节生成",asset_generation:"多模态资源生成",validation:"规则校验",formatting:"格式化排版",llm_review:"LLM 审查优化",export_ready:"导出就绪",reference:"参考资源处理"}[n=e.type]||n," \xb7 ").concat(e.roleId),description:e.message}),(0,s.jsx)(g.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"skipped"===e.status?"default":"warning",children:e.status})]})}})}]}):(0,s.jsx)(h.A,{description:a("documents.noDraft")})}),(0,s.jsx)(A.A,{maskClosable:!1,title:a("documents.templateEditor"),open:ej,onOk:()=>{eU()},onCancel:()=>ew(!1),width:760,centered:!0,okText:a("common.save"),children:(0,s.jsxs)(c.A,{form:X,layout:"vertical",requiredMark:"optional",children:[(0,s.jsxs)(u.A,{gutter:12,children:[(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,s.jsx)(i.A,{disabled:!0})})}),(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"name",label:a("documents.templateName"),rules:[{required:!0}],children:(0,s.jsx)(i.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:8,children:(0,s.jsx)(c.A.Item,{name:"category",label:a("documents.templateCategory"),children:(0,s.jsx)(i.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:12,children:(0,s.jsx)(c.A.Item,{name:"outputTitle",label:a("documents.outputTitle"),children:(0,s.jsx)(i.A,{})})}),(0,s.jsx)(p.A,{xs:24,md:12,children:(0,s.jsx)(c.A.Item,{name:"description",label:a("documents.templateDescription"),children:(0,s.jsx)(i.A,{})})})]}),(0,s.jsx)(c.A.Item,{name:"projectRoleConfigId",label:a("documents.projectRoleConfig"),rules:[{required:!0,message:a("documents.projectRoleConfigRequired")}],children:(0,s.jsx)(x.A,{showSearch:!0,placeholder:a("documents.projectRoleConfigRequired"),options:eC})}),(0,s.jsx)(c.A.Item,{name:"documentSpecId",label:a("documents.documentSpec"),children:(0,s.jsx)(x.A,{allowClear:!0,showSearch:!0,placeholder:a("documents.documentSpecPlaceholder"),options:eT})})]})})]})}}},e=>{e.O(0,[260,167,382,628,271,576,700,174,183,232,292,951,858,617,636,593,792],()=>e(e.s=16403)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[920],{2548:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>D});var i=l(65321),c=l(35292),t=l(68787),r=l(2256),d=l(38770),n=l(11702),h=l(9730),x=l(13399),a=l(55122),j=l(15622),o=l(71330),p=l(8579),m=l(66926),g=l(7851),A=l(84742),u=l(13014);let{Paragraph:N,Title:k,Text:f}=c.A,v=[{icon:(0,i.jsx)(o.A,{}),title:"准备阶段",color:"blue",items:["配置模型","上传知识库资料","创建提示词"]},{icon:(0,i.jsx)(p.A,{}),title:"编排阶段",color:"purple",items:["创建文件角色","创建提示词角色","创建项目角色配置并排序"]},{icon:(0,i.jsx)(m.A,{}),title:"生成阶段",color:"geekblue",items:["创建模板","后台生成轮询","动态执行状态"]},{icon:(0,i.jsx)(g.A,{}),title:"交付阶段",color:"green",items:["审查事实和来源","检查导出门禁","导出正式文件"]}],b=[{title:"第一步:配置模型",goal:"让系统具备 LLM JSON 事实抽取、章节生成和校验能力。",path:"左侧菜单 → 模型配置",steps:["点击新增供应商,选择 OpenAI、DeepSeek、OpenRouter、Ollama 或其他兼容 OpenAI 协议的服务。","填写 Base URL、API Key、供应商名称并保存。","添加模型名称,建议至少准备一个用于生成和推理的模型。","把模型设置为当前启用模型。","执行健康检查,确认模型可调用。"],checks:["模型健康检查通过","至少有一个启用模型","API Key 和 Base URL 正确"],tips:"如果模型不可用,系统会回退到本地确定性抽取,但事实抽取质量会下降。"},{title:"第二步:上传知识库资料",goal:"把项目资料放入系统,让后续文件角色可以绑定。",path:"左侧菜单 → 知识库 → 文件管理 / 管理",steps:["上传招标文件、工程概况、合同条件、技术要求等项目事实资料。","上传工程量清单、劳动力计划、机械设备计划、材料计划等表格资料。","上传图纸目录、图纸说明、设计说明等图纸类资料。","上传规范、规程、企业标准、评分办法、编制要求等规则类资料。","等待索引完成,并在知识库文件列表中确认文件可见。"],checks:["文件上传成功","索引完成","文件能在文件角色绑定下拉框中看到"],tips:"表格资料最好有清晰表头;图纸资料最好附带目录或文字说明。"},{title:"第三步:创建提示词",goal:"定义每个执行阶段的模型行为。",path:"左侧菜单 → 提示词管理",steps:["创建事实抽取提示词:要求只抽取资料中明确出现的事实,返回结构化 JSON,不允许编造。","创建章节生成提示词:定义文档类型、专业语气、章节风格、引用事实和禁止事项。","创建校验提示词:检查工程名称、工期、质量目标、数字、表格引用、章节完整性。","创建格式化提示词:定义封面、目录、编号、表格、分页和正式输出样式。","保存后确认提示词能在提示词角色绑定下拉框中看到。"],checks:["事实抽取提示词已创建","章节生成提示词已创建","校验或格式化提示词已创建"],tips:"提示词越明确,生成结果越稳定。建议明确写上“没有来源的数据不要写”。"},{title:"第四步:创建文件角色",goal:"告诉系统每个文件在生成流程中的用途。",path:"左侧菜单 → 角色配置 → 新建文件角色",steps:["填写角色名称,例如“招标文件事实源”“工程量清单表格”“图纸说明文件”。","选择处理类型:规则文件、项目事实文件、表格数据、图纸文件、规范文件或参考资料。","绑定对应知识库文件。","保存角色。","按文件用途创建多个文件角色,不建议把不同用途资料混在一个角色里。"],checks:["文件角色有名称","已选择处理类型","已绑定知识库文件"],tips:"处理类型很重要:系统会根据它决定是否进行表格解析、事实抽取、规则引用或来源追踪。"},{title:"第五步:创建提示词角色",goal:"告诉系统每条提示词在哪个执行阶段使用。",path:"左侧菜单 → 角色配置 → 新建提示词角色",steps:["填写角色名称,例如“施工组织设计事实抽取”“章节生成规则”“导出前校验规则”。","选择执行类型:事实抽取、章节生成、校验、格式化或参考。","绑定对应提示词。","保存角色。","一个执行阶段可以有多个提示词角色,后续在项目角色配置中排序。"],checks:["提示词角色有名称","已选择执行类型","已绑定提示词"],tips:"角色名称可以完全自定义,但执行类型必须选对。系统依赖执行类型驱动多阶段流程。"},{title:"第六步:创建项目角色配置并排序",goal:"把文件角色和提示词角色组合成一个可复用的项目生成方案。",path:"左侧菜单 → 角色配置 → 新建项目配置",steps:["填写配置名称,例如“某项目施工组织设计配置”。","添加文件角色,并设置顺序。推荐:规则文件 → 项目事实文件 → 表格数据 → 图纸文件 → 规范文件 → 参考资料。","添加提示词角色,并设置顺序。推荐:事实抽取 → 章节生成 → 校验 → 格式化 → 参考。","保存项目角色配置。","后续模板只绑定项目角色配置,不再重复绑定文件和提示词。"],checks:["至少包含一个文件角色","至少包含一个提示词角色","顺序符合业务流程"],tips:"排序决定系统读取资料和应用提示词的优先级,是生产级生成稳定性的关键。"},{title:"第七步:创建模板并绑定项目配置",goal:"定义要生成哪种文档,以及使用哪套项目角色配置。",path:"左侧菜单 → 生成编辑 → 新建模板",steps:["填写模板 ID。ID 由系统生成或保持唯一,不建议手动频繁修改。","填写模板名称,例如“施工组织设计”“技术标文件”“专项施工方案”。","填写分类、输出标题和模板说明。","选择第六步创建的项目角色配置。","保存模板。"],checks:["模板名称清晰","输出标题正确","已绑定项目角色配置"],tips:"模板负责文档入口;项目角色配置负责资料、提示词和顺序。两者分离后更容易复用。"},{title:"第八步:执行生成并查看状态",goal:"让用户明确知道生成流程进行到哪一步。",path:"左侧菜单 → 生成编辑 → 选择模板 → 点击生成",steps:["点击生成按钮后,页面会出现“执行状态”卡片。","执行状态会根据当前模板、文档规范包、文件角色、提示词角色和章节自动生成,不是固定工程流程。","当前执行节点会高亮显示,子状态会展示正在处理的章节、事实字段、文件角色或门禁规则。","生成任务在后台运行,页面通过 documentId 轮询;切换页面后回到生成编辑仍可恢复状态。","生成完成后,系统会用后端真实 executionStages 回填最终状态。","如果导出门禁未通过,生成完成节点会提示需要检查校验结果。"],checks:["执行状态 Card 出现","当前节点有高亮","生成完成后有执行阶段结果"],tips:"如果长时间停留在某一步,优先检查模型配置、知识库索引和文件角色绑定。"},{title:"第九步:审查结果并导出",goal:"确保文档可追溯、可校验、可交付。",path:"生成编辑 → 编辑器下方 Tabs → 导出按钮",steps:["查看“结构化事实”,确认事实字段是否按文档规范包动态 schema 抽取,并检查冲突提示。","查看“来源”,确认事实来自规范包要求的文件角色和绑定资料。","查看“缺失项”,补齐缺失资料或调整角色配置。","查看“严格校验”,处理 error 级问题。","查看“导出门禁”,全部通过后再导出 PDF。","可以先导出 HTML 预览排版,再导出 PDF。"],checks:["无阻断错误","关键事实有来源","章节有证据","导出门禁通过"],tips:"PDF 导出会强制门禁。门禁未通过时,系统会阻止导出,避免问题文档流出。"}];function D(){let e=(0,u.Vr)();return(0,i.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,i.jsxs)(t.A,{className:"cardGlass",styles:{body:{padding:24}},children:[(0,i.jsx)(k,{level:2,className:"mb-2",children:e("guide.title")}),(0,i.jsx)(N,{className:"pageDesc mb-0",children:e("guide.description")})]}),(0,i.jsx)(r.A,{gutter:[16,16],children:v.map(e=>(0,i.jsx)(d.A,{xs:24,md:12,xl:6,children:(0,i.jsx)(t.A,{className:"h-full",title:(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon,e.title]}),children:(0,i.jsx)("div",{className:"space-y-2",children:e.items.map(s=>(0,i.jsx)("div",{children:(0,i.jsx)(n.A,{color:e.color,children:s})},s))})})},e.title))}),(0,i.jsx)(t.A,{title:e("guide.fullFlow"),children:(0,i.jsx)(h.A,{direction:"vertical",items:b.map(e=>({title:e.title,description:"".concat(e.goal,"(入口:").concat(e.path,")")}))})}),(0,i.jsx)(t.A,{title:"详细步骤说明:照着做即可跑通",children:(0,i.jsx)(x.A,{mode:"left",items:b.map(e=>({dot:(0,i.jsx)(A.A,{}),children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(k,{level:4,className:"mb-0",children:e.title}),(0,i.jsxs)(N,{children:[(0,i.jsx)(f,{strong:!0,children:"目标:"}),e.goal]}),(0,i.jsxs)(N,{children:[(0,i.jsx)(f,{strong:!0,children:"入口:"}),e.path]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f,{strong:!0,children:"操作步骤:"}),(0,i.jsx)("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:e.steps.map(e=>(0,i.jsx)("li",{children:e},e))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f,{strong:!0,children:"完成检查:"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:e.checks.map(e=>(0,i.jsx)(n.A,{color:"success",children:e},e))})]}),(0,i.jsxs)(N,{children:[(0,i.jsx)(f,{strong:!0,children:"提示:"}),e.tips]}),(0,i.jsx)(a.A,{})]})}))})}),(0,i.jsxs)(r.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(t.A,{title:e("guide.roleDesign"),children:[(0,i.jsx)(N,{children:e("guide.roleDesignDesc")}),(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(n.A,{color:"blue",children:"file"}),(0,i.jsx)(f,{strong:!0,children:e("guide.fileRole")}),(0,i.jsx)(N,{children:e("guide.fileRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(n.A,{color:"purple",children:"prompt"}),(0,i.jsx)(f,{strong:!0,children:e("guide.promptRole")}),(0,i.jsx)(N,{children:e("guide.promptRoleDesc")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(n.A,{color:"geekblue",children:"config"}),(0,i.jsx)(f,{strong:!0,children:e("guide.projectConfig")}),(0,i.jsx)(N,{children:e("guide.projectConfigDesc")})]})]})]})}),(0,i.jsx)(d.A,{xs:24,lg:12,children:(0,i.jsxs)(t.A,{title:e("guide.generationEngine"),children:[(0,i.jsx)(N,{children:e("guide.generationEngineDesc")}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(n.A,{children:e("roles.factExtraction")}),(0,i.jsx)(n.A,{children:e("roles.chapterGeneration")}),(0,i.jsx)(n.A,{children:e("roles.validation")}),(0,i.jsx)(n.A,{children:e("roles.formatting")}),(0,i.jsx)(n.A,{children:e("documents.exportGate")})]})]})})]}),(0,i.jsx)(t.A,{title:"动态 schema、证据和执行状态说明",children:(0,i.jsxs)(r.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(t.A,{size:"small",title:"动态事实 schema",children:(0,i.jsx)(N,{children:"系统不会写死工程字段。文档规范包的事实字段、模板章节 requiredFacts、字段 sourceRoleIds 和 extractionHint 会共同组成抽取 schema,并驱动事实抽取、冲突检测和导出门禁。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(t.A,{size:"small",title:"结构化资源证据",children:(0,i.jsx)(N,{children:"文本、PDF/Word、Excel/CSV、图片、地图图纸和其他附件都会被整理成资源证据,包含文件角色、处理类型、正文用途、关联事实和证据片段,模型据此理解资料关系。"})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(t.A,{size:"small",title:"动态执行状态",children:(0,i.jsx)(N,{children:"生成编辑页的执行节点会随模板、规范包、文件角色、提示词角色、章节和门禁规则变化;用户生成不同项目文件时看到的是对应项目的流程,而不是固定示例流程。"})})})]})}),(0,i.jsx)(t.A,{title:"文件角色处理类型大白话说明",children:(0,i.jsxs)(r.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(t.A,{size:"small",title:"规则文件",children:(0,i.jsx)(N,{children:"用来告诉系统“必须怎么写、不能怎么写、按什么标准判断”。适合放评分办法、甲方编制要求、攻略写作要求、输出格式要求。生成时会优先作为约束使用。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(t.A,{size:"small",title:"项目事实文件",children:(0,i.jsx)(N,{children:"用来告诉系统“真实情况是什么”。适合放项目概况、合同摘要、招标文件关键信息、游戏角色资料、产品资料。事实字段通常从这里抽取。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(t.A,{size:"small",title:"表格数据",children:(0,i.jsx)(N,{children:"用来解析结构化数据。适合放 Excel、CSV、清单、计划表、评分表、推荐指数表。系统会读取 Sheet、表头、行列和来源范围。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(t.A,{size:"small",title:"图纸文件",children:(0,i.jsx)(N,{children:"用来表达空间关系、路线、结构、站位或设计说明。可以是图纸目录、设计说明、路线示意、阵型图说明。没有 CAD 时也可以用文字图纸说明。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(t.A,{size:"small",title:"规范文件",children:(0,i.jsx)(N,{children:"用来作为专业依据。适合放国家规范、行业标准、企业标准、攻略结构规范、质量标准。校验和生成时会把它当成依据。"})})}),(0,i.jsx)(d.A,{xs:24,md:12,children:(0,i.jsx)(t.A,{size:"small",title:"参考资料",children:(0,i.jsx)(N,{children:"只作为辅助阅读材料,不建议放关键事实。适合放图片来源、公开网页链接、背景资料、案例资料。系统可以参考,但不应把它当成强事实。"})})})]})}),(0,i.jsx)(t.A,{title:"推荐资料清单",children:(0,i.jsxs)(r.A,{gutter:[16,16],children:[(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(t.A,{size:"small",title:"必备资料",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"项目事实文件"}),(0,i.jsx)("li",{children:"招标或编制规则"}),(0,i.jsx)("li",{children:"章节生成提示词"})]})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(t.A,{size:"small",title:"强烈建议",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"表格数据"}),(0,i.jsx)("li",{children:"图纸说明"}),(0,i.jsx)("li",{children:"规范或企业标准"})]})})}),(0,i.jsx)(d.A,{xs:24,md:8,children:(0,i.jsx)(t.A,{size:"small",title:"导出前确认",children:(0,i.jsxs)("ul",{className:"list-disc pl-5",children:[(0,i.jsx)("li",{children:"无 error 校验"}),(0,i.jsx)("li",{children:"事实有来源"}),(0,i.jsx)("li",{children:"导出门禁通过"})]})})})]})}),(0,i.jsx)(j.A,{items:[{key:"prepare",label:e("guide.prepareTitle"),children:(0,i.jsx)(N,{children:e("guide.prepareContent")})},{key:"roles",label:e("guide.rolesTitle"),children:(0,i.jsx)(N,{children:e("guide.rolesContent")})},{key:"template",label:e("guide.templateTitle"),children:(0,i.jsx)(N,{children:e("guide.templateContent")})},{key:"generate",label:e("guide.generateTitle"),children:(0,i.jsx)(N,{children:e("guide.generateContent")})},{key:"qa",label:e("guide.qaTitle"),children:(0,i.jsx)(N,{children:e("guide.qaContent")})}]})]})}},34899:(e,s,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/guide",function(){return l(2548)}])}},e=>{e.O(0,[260,167,382,292,858,969,636,593,792],()=>e(e.s=34899)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[332],{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,593,792],()=>e(e.s=15766)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[309],{6578:(e,t,n)=>{"use strict";async function a(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function i(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(t))}async function r(e){var t,n;let i=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&i.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&i.set("category",e.category),(null==e?void 0:e.page)&&i.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&i.set("limit",String(null!=(n=e.limit)?n:50)),a("/api/kb/files?".concat(i))}async function o(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),a("/api/kb/files/detail?".concat(n))}async function s(e,t){return a("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function l(e,t,n){return a("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function c(e){return new Promise((t,n)=>{let a=new FileReader;a.onload=()=>{let e=a.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},a.onerror=n,a.readAsDataURL(e)})}async function d(e,t,n){return a("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await c(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return a("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t))}async function h(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t),{method:"DELETE"})}async function m(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function f(e){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return a("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return a("/api/kb/features")}async function j(e,t){var n,i,r,o,s;let l=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&l.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&l.set("category",t.category),(null==t?void 0:t.limit)&&l.set("limit",String(null!=(s=t.limit)?s:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&l.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(i=t.weights)?void 0:i.vector)!=null&&l.set("vectorWeight",String(t.weights.vector)),(null==t||null==(r=t.weights)?void 0:r.rewrite)!=null&&l.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(o=t.weights)?void 0:o.hybridBonus)!=null&&l.set("hybridBonus",String(t.weights.hybridBonus)),a("/api/kb/search?".concat(l))}async function S(){return a("/api/prompt")}async function w(e){return a("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function C(e){return a("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function b(e,t){return a("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function v(e){return a("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function k(e){return a("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function A(){return a("/api/documents/specs")}async function T(e){return a("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(e){return a("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function _(){return a("/api/documents/templates")}async function N(e){return a("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(e){return a("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return a("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function I(e){return a("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function E(){return a("/api/documents/generated")}async function J(e){return a("/api/documents/generated/".concat(encodeURIComponent(e)))}async function U(e,t){return a("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function L(){return a("/api/assets/generated")}async function D(e){return a("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function z(e){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function M(e,t){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function H(e){return a("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function F(e,t){return a("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function B(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function K(){return a("/api/config/providers")}async function V(e,t){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function X(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function W(){return a("/api/config/models")}async function q(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(){return a("/api/config/embedding")}async function G(e){return a("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Q(){return a("/api/config/embedding/healthCheck",{method:"POST"})}async function Z(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function Y(){return a("/api/system/stats")}async function ee(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return a("/api/context".concat(n))}async function et(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function en(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ea(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function ei(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function er(e,t){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function eo(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>F,Bh:()=>eo,Dl:()=>_,E:()=>ea,EK:()=>T,ER:()=>P,FC:()=>Y,FV:()=>b,H1:()=>g,H7:()=>h,HC:()=>s,HT:()=>r,II:()=>$,JU:()=>D,NR:()=>v,OX:()=>I,PH:()=>en,QT:()=>u,Qx:()=>p,R1:()=>H,SJ:()=>y,UE:()=>B,VW:()=>x,W2:()=>j,X8:()=>f,Z3:()=>K,_m:()=>V,a6:()=>U,aP:()=>q,bV:()=>R,bZ:()=>Z,c1:()=>d,cQ:()=>E,dd:()=>G,dg:()=>C,dw:()=>k,dx:()=>S,f$:()=>L,h0:()=>O,h1:()=>X,hc:()=>i,hn:()=>ee,l2:()=>N,lv:()=>w,mx:()=>A,oS:()=>M,p:()=>et,tn:()=>l,u6:()=>Q,uc:()=>z,v7:()=>J,xC:()=>o,xq:()=>m,xw:()=>ei,zo:()=>er,zr:()=>W})},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusPanel:"style_statusPanel__9arTu",statusPanelHeader:"style_statusPanelHeader__nKv1I",statusEmpty:"style_statusEmpty__8LWzH",statusList:"style_statusList__FpNgC",statusItem:"style_statusItem__uzO80",statusHeader:"style_statusHeader__o9q_b",statusDesc:"style_statusDesc__XiWFa",statusPath:"style_statusPath__Udxvv",statusMeta:"style_statusMeta__XukHt",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},37690:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return n(48200)}])},45551:(e,t,n)=>{"use strict";function a(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),a=Math.floor(n/60),i=Math.floor(a/24);return i>30?new Date(e).toLocaleDateString(t):"en-US"===t?i>0?"".concat(i,"d ago"):a>0?"".concat(a,"h ago"):n>0?"".concat(n,"m ago"):"Just now":i>0?"".concat(i," 天前"):a>0?"".concat(a," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>s,fw:()=>i,z3:()=>a});let r={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},o={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 n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?o:r)[e])?t:e}},48200:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>J});var a=n(65321),i=n(97109),r=n(1873),o=n.n(r),s=n(43220),l=n.n(s),c=n(86109),d=n(35292),u=n(76506),p=n(33442),h=n(11702),m=n(9137),y=n(59400),f=n(68787),g=n(56985),x=n(49604),j=n(84253),S=n(42700),w=n(85493),C=n(85114),b=n(58569),v=n(7576),k=n(6578),A=n(45551),T=n(14569),P=n.n(T);let{Paragraph:_}=d.A;function N(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}function O(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).slice(0,30):[]}function R(e,t){let n=t.trim()?[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length):[];if(0===n.length)return e;let i=RegExp("(".concat(n.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(i).map((e,t)=>n.some(t=>t.toLowerCase()===e.toLowerCase())?(0,a.jsx)("mark",{children:e},t):e)}function I(e,t,n){return null==t||""===t||Array.isArray(t)&&0===t.length?null:(0,a.jsx)(u.A.Item,{label:e,children:Array.isArray(t)?(0,a.jsx)(p.A,{wrap:!0,children:t.map(e=>(0,a.jsx)(h.A,{className:"cursor-pointer",onClick:()=>null==n?void 0:n(String(e)),children:String(e)},String(e)))}):String(t)})}function E(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return e.map((e,n)=>({key:"".concat(t,"-").concat(n),name:e}))}function J(){var e,t,n,r,s,d,T,J,U,L;let D=(0,c.useRouter)(),z="string"==typeof D.query.relativePath?D.query.relativePath:"",[M,H]=(0,i.useState)(),[F,B]=(0,i.useState)(!1),[K,V]=(0,i.useState)(""),[X,W]=(0,i.useState)(!1),[q,$]=(0,i.useState)(""),[G,Q]=(0,i.useState)([]);(0,i.useEffect)(()=>{z&&(B(!0),V(""),(0,k.xC)(z).then(H).catch(e=>{H(void 0),V(e instanceof Error?e.message:"文件详情加载失败")}).finally(()=>B(!1)))},[z]);let Z=(0,i.useMemo)(()=>(function(e){let t=N(null==e?void 0:e.file.metadataJson);return"object"==typeof t.extraction&&t.extraction?t.extraction:t})(M),[M]),Y=O(Z.layerNames);(0,i.useEffect)(()=>{Q(Y)},[null==M?void 0:M.file.relativePath,Y.join("|")]);let ee=q.trim().toLowerCase(),et=(0,i.useMemo)(()=>{var e;return M&&ee?M.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(ee))}):null!=(e=null==M?void 0:M.chunks)?e:[]},[M,ee]),en=(0,i.useMemo)(()=>{var e;return M&&ee?M.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(ee))):null!=(e=null==M?void 0:M.parents)?e:[]},[M,ee]),ea=async()=>{if(z){W(!0);try{let e=await (0,k.HC)(z);e.detail&&H(e.detail),m.Ay.success("文件索引已重建")}finally{W(!1)}}},ei=async e=>{e&&(await navigator.clipboard.writeText(e),m.Ay.success("已复制"))},er=async e=>{z&&(await (0,k.tn)(z,e),m.Ay.success("file"===e?"已请求打开文件":"已请求打开目录"))},eo=[{key:"table",label:"表格",children:(0,a.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[(0,a.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[I("Sheet",O(Z.sheetNames),$),I("表头",O(Z.columnNames),$),I("行数",Z.rowCount),I("列数",Z.columnCount),I("公式数",Z.formulaCount),I("合并单元格",Z.mergeCount)]}),(0,a.jsx)(y.A,{size:"small",pagination:!1,rowKey:"key",dataSource:E(O(Z.columnNames),"column"),columns:[{title:"列名",dataIndex:"name",render:e=>(0,a.jsx)(h.A,{className:"cursor-pointer",onClick:()=>$(String(e)),children:String(e)})}]}),(0,a.jsx)(y.A,{size:"small",pagination:!1,rowKey:"key",dataSource:(null!=(T=null==M?void 0:M.chunks)?T:[]).map(e=>N(e.metadataJson).rowRange).filter(e=>"string"==typeof e).map((e,t)=>({key:"row-".concat(t),name:e})),columns:[{title:"行范围",dataIndex:"name",render:e=>(0,a.jsxs)(h.A,{color:"gold",className:"cursor-pointer",onClick:()=>$(String(e)),children:["行 ",String(e)]})}]}),(0,a.jsx)(y.A,{size:"small",rowKey:"key",dataSource:(null!=(J=null==M?void 0:M.chunks)?J:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>e.includes("|")).slice(0,80).map((e,t)=>({key:"grid-".concat(t),cells:e.split("|").map(e=>e.trim()).filter(Boolean)})),pagination:{pageSize:10},columns:[{title:"表格网格预览",dataIndex:"cells",render:e=>(0,a.jsx)(p.A,{wrap:!0,children:e.map((e,t)=>(0,a.jsx)(h.A,{children:e},"".concat(e,"-").concat(t)))})}]})]})},{key:"drawing",label:"图纸",children:(0,a.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[(0,a.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[I("图层",O(Z.layerNames),$),I("块/符号",O(Z.blockNames),$),I("实体类型",O(Z.entityTypes),$),I("产品/零件",O(Z.productNames),$),I("材料",O(Z.materialNames),$),I("实体名称",O(Z.entityNames),$)]}),Y.length>0?(0,a.jsxs)(f.A,{size:"small",title:"图层开关 / 图纸预览",children:[(0,a.jsx)(g.A.Group,{value:G,options:Y.map(e=>({label:e,value:e})),onChange:e=>Q(e.map(String))}),(0,a.jsx)("div",{className:P().drawingPreview,children:G.map(e=>(0,a.jsx)(h.A,{color:"blue",children:e},e))})]}):null,(0,a.jsx)(y.A,{size:"small",pagination:!1,rowKey:"key",dataSource:[...E(Y,"layer").map(e=>({...e,type:"图层"})),...E(O(Z.entityTypes),"entity").map(e=>({...e,type:"实体类型"})),...E(O(Z.blockNames),"block").map(e=>({...e,type:"块/符号"}))],columns:[{title:"类型",dataIndex:"type",width:120},{title:"名称",dataIndex:"name",render:e=>(0,a.jsx)(h.A,{className:"cursor-pointer",onClick:()=>$(String(e)),children:String(e)})}]})]})},{key:"data",label:"数据路径",children:(0,a.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[O(Z.dataPaths).length>0?(0,a.jsx)(x.A,{defaultExpandAll:!0,treeData:function(e){let t=new Map;for(let n of e){let e=t;for(let t of n.replace(/\[(\d+)\]/gu,".$1").split(".").filter(Boolean))e.has(t)||e.set(t,new Map),e=e.get(t)}let n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return[...e.entries()].map(e=>{let[a,i]=e;return{title:a,key:t?"".concat(t,".").concat(a):a,children:n(i,t?"".concat(t,".").concat(a):a)}})};return n(t)}(O(Z.dataPaths)),onSelect:e=>{var t;return $(String(null!=(t=e[0])?t:""))}}):(0,a.jsx)(j.A,{description:"暂无数据路径"}),(0,a.jsx)(y.A,{size:"small",rowKey:"key",dataSource:(null!=(U=null==M?void 0:M.chunks)?U:[]).flatMap(e=>e.content.split(/\r?\n/u)).map(e=>e.trim()).filter(e=>/^[\w.[\]-]+\s*[:=]/u.test(e)).slice(0,200).map((e,t)=>{var n,a,i,r;let o=/^([^:=]+)\s*[:=]\s*(.*)$/u.exec(e);return{key:"data-".concat(t),path:null!=(i=null==o||null==(n=o[1])?void 0:n.trim())?i:e,value:null!=(r=null==o||null==(a=o[2])?void 0:a.trim())?r:""}}),pagination:{pageSize:20},columns:[{title:"Path",dataIndex:"path",width:260,render:e=>(0,a.jsx)(h.A,{className:"cursor-pointer",onClick:()=>$(String(e)),children:String(e)})},{title:"Value",dataIndex:"value",render:e=>(0,a.jsx)("span",{className:"break-all",children:String(e)})}]})]})},{key:"ocr",label:"OCR/PDF",children:(0,a.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[(0,a.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[I("OCR 建议",Z.ocrRecommended),I("OCR 原因",Z.ocrReason),I("OCR 引擎",Z.ocrProvider),I("OCR 语言",Z.ocrLanguages),I("OCR 文本长度",Z.ocrTextLength),I("PDF 页面 OCR 支持",Z.pdfPageOcrSupported),I("PDF OCR 页数",Z.ocrPageCount),I("PDF OCR 页数上限",Z.pdfOcrPageLimit),I("PDF 渲染器",Z.pdfRenderer)]}),(null==M?void 0:M.file.format)==="pdf"?(0,a.jsx)("div",{className:P().pdfPreviewStrip,children:Array.from({length:Math.min(Number(null!=(e=Z.ocrPageCount)?e:1)||1,6)},(e,t)=>(0,a.jsx)(o(),{width:220,height:320,src:"/api/kb/files/preview-pdf-page?relativePath=".concat(encodeURIComponent(M.file.relativePath),"&page=").concat(t+1),alt:"PDF 第 ".concat(t+1," 页"),unoptimized:!0},t))}):null,(0,a.jsx)(y.A,{size:"small",rowKey:"key",dataSource:(null!=(L=null==M?void 0:M.chunks)?L:[]).map(e=>e.content).join("\n\n").split(/PDF OCR 第\s*(\d+)\s*页[::]/u).slice(1).reduce((e,t,n,a)=>{var i,r,o;return n%2==0&&e.push({key:"page-".concat(t),page:t,text:null!=(o=null==(r=a[n+1])||null==(i=r.split(/PDF OCR 第\s*\d+\s*页[::]/u)[0])?void 0:i.trim())?o:""}),e},[]),pagination:{pageSize:10},columns:[{title:"页码",dataIndex:"page",width:90},{title:"OCR 文本",dataIndex:"text",render:e=>(0,a.jsx)(_,{ellipsis:{rows:4,expandable:!0,symbol:"展开"},children:String(e)})}]})]})}],es=[{title:"#",dataIndex:"chunkIndex",width:70,render:e=>String(e)},{title:"类型",width:110,render:(e,t)=>{var n;return(0,a.jsx)(h.A,{children:String(null!=(n=N(t.metadataJson).chunkKind)?n:t.category)})}},{title:"章节/范围",width:220,render:(e,t)=>{let n=N(t.metadataJson),i="string"==typeof n.rowRange?n.rowRange:void 0;return(0,a.jsxs)(p.A,{wrap:!0,children:[t.sectionTitle?(0,a.jsx)(h.A,{color:"cyan",children:t.sectionTitle}):null,i?(0,a.jsxs)(h.A,{color:"gold",children:["行 ",i]}):null]})}},{title:"Token",dataIndex:"tokenCount",width:90},{title:"内容",render:(e,t)=>(0,a.jsx)(_,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:P().searchContent,children:R(t.content,q)})}],el=[{title:"Parent",dataIndex:"parentId",width:260,render:e=>(0,a.jsx)("span",{className:"break-all",children:e})},{title:"切片数",dataIndex:"chunkCount",width:90},{title:"章节",dataIndex:"sectionTitle",width:220},{title:"内容",render:(e,t)=>(0,a.jsx)(_,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:P().searchContent,children:R(t.content,q)})}];return F?(0,a.jsx)(S.A,{}):K?(0,a.jsx)(w.A,{type:"error",showIcon:!0,message:"文件详情加载失败",description:K}):M?(0,a.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(l(),{href:"/knowledge/files",children:"返回文件列表"}),(0,a.jsxs)("div",{className:P().searchResultHeader,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"pageTitle",children:"文件详情"}),(0,a.jsx)("p",{className:"pageDesc",children:"查看解析结果、图纸/表格/数据结构化字段、parent chunk 和 child chunk。"})]}),(0,a.jsxs)(p.A,{children:[(0,a.jsx)(C.Ay,{onClick:()=>{ei(null==M?void 0:M.absolutePath)},children:"复制原文件路径"}),(0,a.jsx)(C.Ay,{onClick:()=>{ei(null==M?void 0:M.directory)},children:"复制所在目录"}),(0,a.jsx)(C.Ay,{onClick:()=>{er("file")},children:"打开文件"}),(0,a.jsx)(C.Ay,{onClick:()=>{er("directory")},children:"打开目录"}),"pdf"===M.file.format?(0,a.jsx)(C.Ay,{loading:X,onClick:()=>{ea()},children:"重新 OCR"}):null,(0,a.jsx)(C.Ay,{type:"primary",loading:X,onClick:()=>{ea()},children:"重建该文件索引"})]})]})]}),(0,a.jsx)(f.A,{size:"small",title:"基础信息",children:(0,a.jsxs)(u.A,{size:"small",column:2,bordered:!0,children:[(0,a.jsx)(u.A.Item,{label:"路径",children:M.file.relativePath}),(0,a.jsx)(u.A.Item,{label:"原文件",children:null!=(t=M.absolutePath)?t:"-"}),(0,a.jsx)(u.A.Item,{label:"所在目录",children:null!=(n=M.directory)?n:"-"}),(0,a.jsxs)(u.A.Item,{label:"分类",children:[(0,a.jsx)(h.A,{children:(0,A.Jm)(M.file.category)})," ",(0,a.jsx)(h.A,{children:M.file.format})]}),(0,a.jsx)(u.A.Item,{label:"大小",children:(0,A.z3)(M.file.fileSize)}),(0,a.jsx)(u.A.Item,{label:"切片数",children:M.file.chunkCount}),(0,a.jsx)(u.A.Item,{label:"状态",children:M.file.status}),(0,a.jsx)(u.A.Item,{label:"解析模式",children:String(null!=(r=Z.extractionMode)?r:"-")}),(0,a.jsx)(u.A.Item,{label:"覆盖范围",children:String(null!=(s=Z.contentCoverage)?s:"-")}),(0,a.jsx)(u.A.Item,{label:"正文长度",children:String(null!=(d=Z.textLength)?d:"-")})]})}),(0,a.jsx)(f.A,{size:"small",title:"结构化信息",children:(0,a.jsx)(b.A,{items:eo})}),(0,a.jsx)(f.A,{size:"small",title:"详情筛选",children:(0,a.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[(0,a.jsx)(v.A,{allowClear:!0,value:q,onChange:e=>$(e.target.value),placeholder:"筛选 rowRange、图层、实体、data path、section、chunk 内容"}),q?(0,a.jsxs)(p.A,{wrap:!0,children:[(0,a.jsxs)(h.A,{color:"blue",children:["Parent 命中 ",en.length]}),(0,a.jsxs)(h.A,{color:"green",children:["Child 命中 ",et.length]}),(0,a.jsxs)(h.A,{color:"purple",children:["筛选词 ",q]})]}):null]})}),(0,a.jsx)(f.A,{size:"small",title:"Parent Chunks (".concat(en.length,"/").concat(M.parents.length,")"),children:(0,a.jsx)(y.A,{rowKey:"id",columns:el,dataSource:en,pagination:{pageSize:10},size:"small"})}),(0,a.jsx)(f.A,{size:"small",title:"Child Chunks (".concat(et.length,"/").concat(M.chunks.length,")"),children:(0,a.jsx)(y.A,{rowKey:"id",columns:es,dataSource:et,pagination:{pageSize:20},size:"small"})})]}):(0,a.jsx)(j.A,{description:"请选择文件"})}}},e=>{e.O(0,[260,167,382,628,271,576,700,174,985,400,292,350,80,636,593,792],()=>e(e.s=37690)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28],{6578:(e,t,n)=>{"use strict";async function a(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function o(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return a("/api/kb/stats".concat(t))}async function r(e){var t,n;let o=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&o.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&o.set("category",e.category),(null==e?void 0:e.page)&&o.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&o.set("limit",String(null!=(n=e.limit)?n:50)),a("/api/kb/files?".concat(o))}async function i(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),a("/api/kb/files/detail?".concat(n))}async function s(e,t){return a("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function c(e,t,n){return a("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let a=new FileReader;a.onload=()=>{let e=a.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},a.onerror=n,a.readAsDataURL(e)})}async function d(e,t,n){return a("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return a("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t))}async function h(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),a("/api/kb/operations?".concat(t),{method:"DELETE"})}async function f(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(e,t){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function g(e){return a("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function m(e){return a("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function v(){return a("/api/kb/features")}async function w(e,t){var n,o,r,i,s;let c=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&c.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&c.set("category",t.category),(null==t?void 0:t.limit)&&c.set("limit",String(null!=(s=t.limit)?s:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&c.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(o=t.weights)?void 0:o.vector)!=null&&c.set("vectorWeight",String(t.weights.vector)),(null==t||null==(r=t.weights)?void 0:r.rewrite)!=null&&c.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(i=t.weights)?void 0:i.hybridBonus)!=null&&c.set("hybridBonus",String(t.weights.hybridBonus)),a("/api/kb/search?".concat(c))}async function x(){return a("/api/prompt")}async function b(e){return a("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function j(e){return a("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e,t){return a("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function S(e){return a("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return a("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function _(){return a("/api/documents/specs")}async function k(e){return a("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(e){return a("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function N(){return a("/api/documents/templates")}async function E(e){return a("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function A(e){return a("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(e){return a("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function R(e){return a("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function I(){return a("/api/documents/generated")}async function L(e){return a("/api/documents/generated/".concat(encodeURIComponent(e)))}async function M(e,t){return a("/api/documents/generated/".concat(encodeURIComponent(e)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function H(){return a("/api/assets/generated")}async function J(e){return a("/api/assets/generated?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function U(e){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"index"})})}async function D(e,t){return a("/api/assets/generated",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"open",target:t})})}async function B(e){return a("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function F(e,t){return a("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function W(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function z(){return a("/api/config/providers")}async function $(e,t){return a("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function V(e){return a("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function X(){return a("/api/config/models")}async function q(e){return a("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Q(){return a("/api/config/embedding")}async function K(e){return a("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Z(){return a("/api/config/embedding/healthCheck",{method:"POST"})}async function Y(e){return a("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function G(){return a("/api/system/stats")}async function ee(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return a("/api/context".concat(n))}async function et(e){return a("/api/context?type=".concat(e,"&stats=1"))}async function en(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function ea(e){return a("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function eo(e){return a("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function er(e,t){return a("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ei(e){return a("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>F,Bh:()=>ei,Dl:()=>N,E:()=>ea,EK:()=>k,ER:()=>P,FC:()=>G,FV:()=>C,H1:()=>m,H7:()=>h,HC:()=>s,HT:()=>r,II:()=>Q,JU:()=>J,NR:()=>S,OX:()=>R,PH:()=>en,QT:()=>u,Qx:()=>p,R1:()=>B,SJ:()=>y,UE:()=>W,VW:()=>v,W2:()=>w,X8:()=>g,Z3:()=>z,_m:()=>$,a6:()=>M,aP:()=>q,bV:()=>O,bZ:()=>Y,c1:()=>d,cQ:()=>I,dd:()=>K,dg:()=>j,dw:()=>T,dx:()=>x,f$:()=>H,h0:()=>A,h1:()=>V,hc:()=>o,hn:()=>ee,l2:()=>E,lv:()=>b,mx:()=>_,oS:()=>D,p:()=>et,tn:()=>c,u6:()=>Z,uc:()=>U,v7:()=>L,xC:()=>i,xq:()=>f,xw:()=>eo,zo:()=>er,zr:()=>X})},10218:(e,t,n)=>{"use strict";n.d(t,{A:()=>g,H:()=>f});var a=n(97109),o=n(4932),r=n(42644);let i=e=>"object"==typeof e&&null!=e&&1===e.nodeType,s=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,c=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return s(n.overflowY,t)||s(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},l=(e,t,n,a,o,r,i,s)=>r<e&&i>t||r>e&&i<t?0:r<=e&&s<=n||i>=t&&s>=n?r-e-a:i>t&&s<n||r<e&&s>n?i-t+o:0,d=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},u=(e,t)=>{var n,a,o,r;if("undefined"==typeof document)return[];let{scrollMode:s,block:u,inline:p,boundary:h,skipOverflowHiddenElements:f}=t,y="function"==typeof h?h:e=>e!==h;if(!i(e))throw TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,m=[],v=e;for(;i(v)&&y(v);){if((v=d(v))===g){m.push(v);break}null!=v&&v===document.body&&c(v)&&!c(document.documentElement)||null!=v&&c(v,f)&&m.push(v)}let w=null!=(a=null==(n=window.visualViewport)?void 0:n.width)?a:innerWidth,x=null!=(r=null==(o=window.visualViewport)?void 0:o.height)?r:innerHeight,{scrollX:b,scrollY:j}=window,{height:C,width:S,top:T,right:_,bottom:k,left:P}=e.getBoundingClientRect(),{top:N,right:E,bottom:A,left:O}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),R="start"===u||"nearest"===u?T-N:"end"===u?k+A:T+C/2-N+A,I="center"===p?P+S/2-O+E:"end"===p?_+E:P-O,L=[];for(let e=0;e<m.length;e++){let t=m[e],{height:n,width:a,top:o,right:r,bottom:i,left:d}=t.getBoundingClientRect();if("if-needed"===s&&T>=0&&P>=0&&k<=x&&_<=w&&(t===g&&!c(t)||T>=o&&k<=i&&P>=d&&_<=r))break;let h=getComputedStyle(t),f=parseInt(h.borderLeftWidth,10),y=parseInt(h.borderTopWidth,10),v=parseInt(h.borderRightWidth,10),N=parseInt(h.borderBottomWidth,10),E=0,A=0,O="offsetWidth"in t?t.offsetWidth-t.clientWidth-f-v:0,M="offsetHeight"in t?t.offsetHeight-t.clientHeight-y-N:0,H="offsetWidth"in t?0===t.offsetWidth?0:a/t.offsetWidth:0,J="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(g===t)E="start"===u?R:"end"===u?R-x:"nearest"===u?l(j,j+x,x,y,N,j+R,j+R+C,C):R-x/2,A="start"===p?I:"center"===p?I-w/2:"end"===p?I-w:l(b,b+w,w,f,v,b+I,b+I+S,S),E=Math.max(0,E+j),A=Math.max(0,A+b);else{E="start"===u?R-o-y:"end"===u?R-i+N+M:"nearest"===u?l(o,i,n,y,N+M,R,R+C,C):R-(o+n/2)+M/2,A="start"===p?I-d-f:"center"===p?I-(d+a/2)+O/2:"end"===p?I-r+v+O:l(d,r,a,f,v+O,I,I+S,S);let{scrollLeft:e,scrollTop:s}=t;E=0===J?0:Math.max(0,Math.min(s+E/J,t.scrollHeight-n/J+M)),A=0===H?0:Math.max(0,Math.min(e+A/H,t.scrollWidth-a/H+O)),R+=s-E,I+=e-A}L.push({el:t,top:E,left:A})}return L};var p=n(26047),h=n(44624);function f(e){return(0,h.$r)(e).join("_")}function y(e,t){let n=t.getFieldInstance(e),a=(0,r.rb)(n);if(a)return a;let o=(0,h.kV)((0,h.$r)(e),t.__INTERNAL__.name);if(o)return document.getElementById(o)}function g(e){let[t]=(0,o.mN)(),n=a.useRef({}),r=a.useMemo(()=>e??{...t,__INTERNAL__:{itemRef:e=>t=>{let a=f(e);t?n.current[a]=t:delete n.current[a]}},scrollToField:(e,t={})=>{let{focus:n,...a}=t,o=y(e,r);o&&(!function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let n=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(u(e,t));let a="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:o,top:r,left:i}of u(e,!1===t?{block:"end",inline:"nearest"}:t===Object(t)&&0!==Object.keys(t).length?t:{block:"start",inline:"nearest"})){let e=r-n.top+n.bottom,t=i-n.left+n.right;o.scroll({top:e,left:t,behavior:a})}}(o,{scrollMode:"if-needed",block:"nearest",...a}),n&&r.focusField(e))},focusField:e=>{let t=r.getFieldInstance(e);(0,p.Tn)(t?.focus)?t.focus():y(e,r)?.focus?.()},getFieldInstance:e=>{let t=f(e);return n.current[t]}},[e,t]);return[r]}},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusPanel:"style_statusPanel__9arTu",statusPanelHeader:"style_statusPanelHeader__nKv1I",statusEmpty:"style_statusEmpty__8LWzH",statusList:"style_statusList__FpNgC",statusItem:"style_statusItem__uzO80",statusHeader:"style_statusHeader__o9q_b",statusDesc:"style_statusDesc__XiWFa",statusPath:"style_statusPath__Udxvv",statusMeta:"style_statusMeta__XukHt",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}},15437:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=e=>{let{componentCls:t,antCls:n,motionDurationMid:a,motionEaseInOut:o}=e;return{[t]:{[`${n}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`${["height","opacity"].map(e=>`${e} ${a} ${o}`).join(", ")} !important`}},[`${n}-motion-collapse`]:{overflow:"hidden",transition:`${["height","opacity"].map(e=>`${e} ${a} ${o}`).join(", ")} !important`}}}}},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,n)=>{"use strict";n.d(t,{A:()=>x});var a=n(51541),o=n(61848),r=n(1249),i=n(97109),s=n(72658),c=n(3638),l=n(92162),d=n(82725),u=n(74567),p=n(632),h=n(49517),f=n(79412),y=n(19527);let g=(0,d.U)(e=>{let{prefixCls:t,className:n,closeIcon:a,closable:o,type:r,title:d,children:g,footer:m,classNames:v,styles:w,...x}=e,{getPrefixCls:b}=i.useContext(u.QO),{className:j,style:C,classNames:S,styles:T}=(0,u.TP)("modal"),_=b(),k=t||b("modal"),P=(0,p.A)(_),[N,E]=(0,y.Ay)(k,P),[A,O]=(0,l.AV)([S,v],[T,w],{props:e}),R=`${k}-confirm`,I={};return I=r?{closable:o??!1,title:"",footer:"",children:i.createElement(h.k,{...e,prefixCls:k,confirmPrefixCls:R,rootPrefixCls:_,content:g})}:{closable:o??!0,title:d,footer:null!==m&&i.createElement(f.w,{...e}),children:g},i.createElement(s.Z,{prefixCls:k,className:(0,c.$)(N,`${k}-pure-panel`,r&&R,r&&`${R}-${r}`,n,j,E,P,A.root),style:{...C,...O.root},...x,closeIcon:(0,f.O)(k,a),closable:o,classNames:A,styles:O,...I})});var m=n(99739);function v(e){return(0,a.Ay)((0,a.fp)(e))}let w=r.A;w.useModal=m.A,w.info=function(e){return(0,a.Ay)((0,a.$D)(e))},w.success=function(e){return(0,a.Ay)((0,a.Ej)(e))},w.error=function(e){return(0,a.Ay)((0,a.jT)(e))},w.warning=v,w.warn=v,w.confirm=function(e){return(0,a.Ay)((0,a.lr)(e))},w.destroyAll=function(){for(;o.A.length;){let e=o.A.pop();e&&e()}},w.config=a.FB,w._InternalPanelDoNotUseOrYouWillBeFired=g;let x=w},36451:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>O});var a=n(65321),o=n(97109),r=n(13014),i=n(43220),s=n.n(i),c=n(86109),l=n(17807),d=n(25258),u=n(33442),p=n(11702),h=n(85114),f=n(7576),y=n(57271),g=n(14932),m=n(99605),v=n(68787),w=n(59400),x=n(26631),b=n(58209),j=n(30486),C=n(92803),S=n(88483);function T(){return(T=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let _=o.forwardRef((e,t)=>o.createElement(S.A,T({},e,{ref:t,icon:C.A})));var k=n(6578),P=n(45551),N=n(14569),E=n.n(N);let A=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"];function O(){let e=(0,r.Vr)("knowledge"),{locale:t}=(0,r.x_)(),{message:n}=l.A.useApp(),i=(0,c.useRouter)(),C="string"==typeof i.query.category?i.query.category:"",[S,T]=(0,o.useState)([]),[N,O]=(0,o.useState)(!1),[R,I]=(0,o.useState)(""),[L,M]=(0,o.useState)(""),[H,J]=(0,o.useState)(C),[U,D]=(0,o.useState)(!1),[B,F]=(0,o.useState)([]),[W,z]=(0,o.useState)([]),[$,V]=(0,o.useState)(1),X=(0,o.useRef)(H);(0,o.useEffect)(()=>{X.current=H},[H]),(0,o.useEffect)(()=>{J("string"==typeof i.query.category?i.query.category:"")},[i.query.category]);let q=(0,o.useCallback)(async e=>{let t=null!=e?e:X.current;O(!0),I("");try{let e=await (0,k.HT)({category:t||void 0,limit:200});T(e.files||[]),e.initializing&&window.setTimeout(()=>{q(t)},1500)}catch(e){T([]),I(e instanceof Error?e.message:"文件列表加载失败")}finally{O(!1)}},[]);(0,o.useEffect)(()=>{q(H)},[H,q]);let Q=e=>({type:e.type,title:e.title,description:e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,textLength:e.textLength,extractionMode:e.extractionMode}),K=(0,o.useCallback)(async()=>{try{let e=await (0,k.Qx)();F(e.operations.map(Q))}catch(e){}},[]);(0,o.useEffect)(()=>{K()},[K]);let Z=async()=>{try{await (0,k.H7)(),F([]),n.success("任务状态已清空")}catch(e){n.error("清空任务状态失败")}},Y=async e=>{if(0===e.length)return;let t=1===e.length?e[0].name:"".concat(e.length," 个文件");D(!0),F(e=>[{type:"upload",title:"上传 ".concat(t),description:"等待上传、解析、切片和入库",status:"processing",percent:10},...e].slice(0,50));let a="".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2)),o=setInterval(()=>{(0,k.QT)(a).then(e=>{F(n=>[{type:"upload",title:"上传 ".concat(t),description:"".concat(e.message).concat(e.chunkCount?",".concat(e.chunkCount," 个切片"):""),status:"error"===e.stage?"warning":"processing",percent:e.percent},...n.filter(e=>e.title!=="上传 ".concat(t))].slice(0,50))}).catch(()=>void 0)},500);try{var r,i;let s=await (0,k.c1)(e,void 0,a);clearInterval(o),(null==(r=s.vectorStatus)?void 0:r.status)==="error"?n.info("文件已上传,正在后台入库"):n.success("上传成功"),M(""),J(""),z([]),V(1),X.current="";let c=null==(i=s.files)?void 0:i.find(e=>e.relativePath===s.relativePath),l=(e=>{if(!e)return{};let t={};try{t=e.metadataJson?JSON.parse(e.metadataJson):{}}catch(e){}let n="object"==typeof t.extraction&&t.extraction?t.extraction:t;return{textLength:"number"==typeof n.textLength?n.textLength:void 0,extractionMode:"string"==typeof n.extractionMode?n.extractionMode:void 0}})(c);await K(),F(e=>[{type:"upload",title:"上传完成 ".concat(t),description:"解析、分块和入库流程已完成",status:"success",filePath:null==c?void 0:c.relativePath,chunkCount:null==c?void 0:c.chunkCount,textLength:l.textLength,extractionMode:l.extractionMode},...e.filter(e=>e.title!=="上传 ".concat(t))].slice(0,50)),Array.isArray(s.files)?T(s.files):(await (0,k.H1)(),await q(""),await K())}catch(e){n.error("上传失败"),F(e=>[{type:"error",title:"上传失败 ".concat(t),description:"请重试或检查文件格式",status:"error"},...e].slice(0,50))}finally{clearInterval(o),D(!1)}},G=e=>{let t="selected"===e?W.map(String):"filtered"===e?ee.map(e=>e.relativePath):[];if("all"!==e&&0===t.length)return;let a="all"===e?"删除全部文件?":"filtered"===e?"删除当前筛选结果 ".concat(t.length," 个文件?"):"删除已选 ".concat(t.length," 个文件?");d.A.confirm({title:a,content:"将同时删除文件、切片、索引和向量记录。此操作不可撤销。",okText:"确认删除",cancelText:"取消",okButtonProps:{danger:!0},onOk:async()=>{F(e=>[{type:"delete",title:a,description:"正在批量删除文件和索引",status:"processing",percent:10},...e].slice(0,50));try{var o;let a=null!=(o=("all"===e?await (0,k.X8)():await (0,k.SJ)(t)).deleted)?o:t.length;n.success("已删除 ".concat(a," 个文件")),z([]),F(e=>[{type:"delete",title:"批量删除完成",description:"已删除 ".concat(a," 个文件、切片和索引"),status:"success"},...e].slice(0,50)),await q(),await K()}catch(e){n.error("批量删除失败"),F(e=>[{type:"error",title:"批量删除失败",description:"请重试",status:"error"},...e].slice(0,50))}}})},ee=L?S.filter(e=>e.relativePath.toLowerCase().includes(L.toLowerCase())):S,et=[{title:e("fileName"),dataIndex:"relativePath",key:"name",render:(e,t)=>(0,a.jsxs)(u.A,{children:[(0,a.jsx)(x.A,{}),t.builtIn&&(0,a.jsx)(p.A,{color:"gold",children:"内置"}),(0,a.jsx)(s(),{className:"truncate max-w-[400px] inline-block",href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(e)),children:e})]})},{title:e("fileCategory"),dataIndex:"category",key:"cat",width:120,render:e=>(0,a.jsx)(p.A,{children:(0,P.Jm)(e,t)})},{title:e("fileSize"),dataIndex:"fileSize",key:"size",width:100,render:e=>(0,P.z3)(e)},{title:"切片",dataIndex:"chunkCount",key:"chunks",width:90,render:e=>(0,a.jsx)(p.A,{color:e>1?"green":"orange",children:e})},{title:"解析状态",dataIndex:"status",key:"status",width:110,render:(e,t)=>(0,a.jsx)(p.A,{color:"active"===e?"green":"red",children:t.errorMessage||e})},{title:e("fileDate"),dataIndex:"mtime",key:"date",width:140,render:e=>e?new Date(e).toLocaleDateString(t):"—"},{title:"",key:"act",width:60,render:(t,o)=>(0,a.jsx)(h.Ay,{type:"text",danger:!0,size:"small",icon:(0,a.jsx)(b.A,{}),onClick:()=>{d.A.confirm({title:e("delete"),content:e("deleteConfirm"),okText:"确认",cancelText:"取消",okButtonProps:{danger:!0},onOk:async()=>{F(e=>[{type:"delete",title:"删除 ".concat(o.relativePath),description:"正在删除文件记录",status:"processing"},...e].slice(0,50));try{await (0,k.xq)(o.relativePath),n.success("已删除"),F(e=>[{type:"delete",title:"删除完成 ".concat(o.relativePath),description:"文件和索引记录已移除",status:"success"},...e].slice(0,50)),z(e=>e.filter(e=>e!==o.relativePath)),await q(),await K()}catch(e){n.error("删除失败"),F(e=>[{type:"error",title:"删除失败 ".concat(o.relativePath),description:"请重试",status:"error"},...e].slice(0,50))}}})}})}];return(0,a.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,a.jsx)("h2",{className:"pageTitle",children:e("fileList")}),(0,a.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,a.jsx)(f.A,{placeholder:e("searchPlaceholder"),prefix:(0,a.jsx)(j.A,{}),value:L,onChange:e=>{M(e.target.value),V(1)},allowClear:!0,className:E().filterInput}),(0,a.jsx)(y.A,{value:H||void 0,onChange:e=>{J(e||""),V(1)},placeholder:e("filterCategory"),allowClear:!0,className:E().filterSelect,options:[{label:e("allCategories"),value:""},...A.map(e=>({label:(0,P.Jm)(e,t),value:e}))]}),(0,a.jsx)(h.Ay,{type:"primary",icon:(0,a.jsx)(_,{}),loading:U,onClick:()=>{var e;return null==(e=document.getElementById("kb-file-upload-input"))?void 0:e.click()},children:U?e("uploading"):e("upload")}),(0,a.jsx)(h.Ay,{icon:(0,a.jsx)(_,{}),loading:U,onClick:()=>{var e;return null==(e=document.getElementById("kb-folder-upload-input"))?void 0:e.click()},children:"上传文件夹"}),(0,a.jsxs)(h.Ay,{danger:!0,disabled:0===W.length,icon:(0,a.jsx)(b.A,{}),onClick:()=>G("selected"),children:["删除已选 ",W.length||""]}),(0,a.jsx)(h.Ay,{danger:!0,disabled:0===ee.length||!L&&!H,onClick:()=>G("filtered"),children:"删除筛选结果"}),(0,a.jsx)(h.Ay,{danger:!0,disabled:0===S.length,onClick:()=>G("all"),children:"删除全部"}),(0,a.jsx)("input",{id:"kb-file-upload-input",type:"file",multiple:!0,hidden:!0,onChange:e=>{var t;let n=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",Y(n)}}),(0,a.jsx)("input",{id:"kb-folder-upload-input",type:"file",multiple:!0,hidden:!0,webkitdirectory:"",onChange:e=>{var t;let n=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",Y(n)}})]}),(0,a.jsxs)("div",{className:E().statusPanel,children:[(0,a.jsxs)("div",{className:E().statusPanelHeader,children:[(0,a.jsxs)(u.A,{children:[(0,a.jsx)(x.A,{}),"文件任务状态"]}),(0,a.jsx)(h.Ay,{size:"small",type:"text",disabled:0===B.length,onClick:()=>void Z(),children:"清空"})]}),0===B.length?(0,a.jsx)("div",{className:E().statusEmpty,children:"暂无文件任务。"}):(0,a.jsx)("div",{className:E().statusList,children:B.map((e,n)=>(0,a.jsxs)("div",{className:E().statusItem,children:[(0,a.jsxs)("div",{className:E().statusHeader,children:[(0,a.jsxs)(u.A,{size:8,wrap:!0,children:[(0,a.jsx)(p.A,{color:"success"===e.status?"green":"error"===e.status?"red":"warning"===e.status?"orange":"blue",children:"upload"===e.type?"上传":"delete"===e.type?"删除":"reindex"===e.type?"重建":"失败"}),(0,a.jsx)(g.A,{title:e.title,children:(0,a.jsx)("strong",{children:e.title})})]}),(0,a.jsx)(p.A,{color:"success"===e.status?"success":"processing"===e.status?"processing":"warning"===e.status?"warning":"error",children:"success"===e.status?"完成":"processing"===e.status?"处理中":"warning"===e.status?"需关注":"失败"})]}),(0,a.jsx)(g.A,{title:e.description,children:(0,a.jsx)("div",{className:E().statusDesc,children:e.description})}),e.filePath&&(0,a.jsx)(g.A,{title:e.filePath,children:(0,a.jsx)("div",{className:E().statusPath,children:e.filePath})}),(0,a.jsxs)("div",{className:E().statusMeta,children:["number"==typeof e.chunkCount&&(0,a.jsxs)("span",{children:["切片 ",(0,a.jsx)("b",{children:e.chunkCount})]}),"number"==typeof e.textLength&&(0,a.jsxs)("span",{children:["正文 ",(0,a.jsx)("b",{children:e.textLength.toLocaleString(t)})," 字符"]}),e.extractionMode&&(0,a.jsxs)("span",{children:["解析 ",(0,a.jsx)("b",{children:e.extractionMode})]})]}),"number"==typeof e.percent&&"processing"===e.status&&(0,a.jsx)(m.A,{percent:e.percent,size:"small"})]},"".concat(e.title,"-").concat(n)))})]}),(0,a.jsxs)(v.A,{children:[R&&(0,a.jsxs)("div",{className:E().statusEmpty,children:["文件列表加载失败:",R]}),(0,a.jsx)(w.A,{rowKey:"relativePath",columns:et,dataSource:ee,loading:N,size:"middle",locale:{emptyText:N?"正在加载文件列表...":L?e("emptySearch"):e("noFiles")},pagination:{current:$,pageSize:50,showSizeChanger:!1,onChange:V},rowSelection:{selectedRowKeys:W,onChange:z}})]})]})}},44624:(e,t,n)=>{"use strict";n.d(t,{$r:()=>o,BS:()=>i,kV:()=>r});let a=["parentNode"];function o(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function r(e,t){if(!e.length)return;let n=e.join("_");return t?`${t}_${n}`:a.includes(n)?`form_item_${n}`:n}function i(e,t,n,a,o,r){let i=a;return void 0!==r?i=r:n.validating?i="validating":e.length?i="error":t.length?i="warning":(n.touched||o&&n.validated)&&(i="success"),i}},45551:(e,t,n)=>{"use strict";function a(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),a=Math.floor(n/60),o=Math.floor(a/24);return o>30?new Date(e).toLocaleDateString(t):"en-US"===t?o>0?"".concat(o,"d ago"):a>0?"".concat(a,"h ago"):n>0?"".concat(n,"m ago"):"Just now":o>0?"".concat(o," 天前"):a>0?"".concat(a," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>s,fw:()=>o,z3:()=>a});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 n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?i:r)[e])?t:e}},58209:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var a=n(97109),o=n(23793),r=n(88483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let s=a.forwardRef((e,t)=>a.createElement(r.A,i({},e,{ref:t,icon:o.A})))},90426:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/files",function(){return n(36451)}])},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,[260,167,382,628,271,576,700,174,985,400,15,636,593,792],()=>e(e.s=90426)),_N_E=e.O()}]);
|