@customize-agent/server 3.0.11 → 3.0.12
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 +11 -10
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/chunks/3445.js +39 -6
- package/.next/server/chunks/8204.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/api/documents/roles.js +1 -1
- package/.next/server/pages/api/documents/specs.js +1 -1
- package/.next/server/pages/api/kb/categories.js +34 -1
- package/.next/server/pages/api/kb/duplicates.js +34 -1
- package/.next/server/pages/api/kb/files/detail.js +34 -1
- package/.next/server/pages/api/kb/files/open.js +34 -1
- package/.next/server/pages/api/kb/files/preview-pdf-page.js +34 -1
- package/.next/server/pages/api/kb/files/reindex.js +34 -1
- package/.next/server/pages/api/kb/files.js +34 -1
- package/.next/server/pages/api/kb/ignore.js +34 -1
- package/.next/server/pages/api/kb/operations.js +34 -1
- package/.next/server/pages/api/kb/reindex.js +34 -1
- package/.next/server/pages/api/kb/search.js +34 -1
- package/.next/server/pages/api/kb/stats.js +34 -1
- package/.next/server/pages/api/kb/tags.js +34 -1
- package/.next/server/pages/api/kb/upload.js +34 -1
- package/.next/server/pages/context/long-term.html +1 -1
- package/.next/server/pages/context/short-term.html +1 -1
- package/.next/server/pages/document-roles.html +1 -1
- package/.next/server/pages/document-specs.html +1 -1
- package/.next/server/pages/documents.html +1 -1
- package/.next/server/pages/guide.html +1 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/search.html +1 -1
- package/.next/server/pages/knowledge.html +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages/prompt.html +1 -1
- package/.next/server/pages/settings.html +1 -1
- package/.next/server/pages-manifest.json +21 -21
- package/.next/static/ZG2x_4BgDtQoIcW28iwgH/_buildManifest.js +1 -0
- package/.next/static/chunks/400-ba996d76e74a7368.js +78 -0
- package/.next/static/chunks/740-cd38299e151d3ffc.js +16 -0
- package/.next/static/chunks/746-120983153bceeea6.js +1 -0
- package/.next/static/chunks/804-b11aef99b57308a3.js +11 -0
- package/.next/static/chunks/958-0793922b6b146891.js +1 -0
- package/.next/static/chunks/pages/{_app-49c11d5b0712c7a5.js → _app-725afbb7d3371a13.js} +8 -8
- package/.next/static/chunks/pages/_error-49c333927e615faa.js +1 -0
- package/.next/static/chunks/pages/context/long-term-dba1d735f2b5e12b.js +1 -0
- package/.next/static/chunks/pages/context/short-term-7cc72881b42b74fb.js +1 -0
- package/.next/static/chunks/pages/document-roles-653f01136b58197b.js +1 -0
- package/.next/static/chunks/pages/document-specs-120681be3e183b9e.js +1 -0
- package/.next/static/chunks/pages/documents-93e638518deec9b5.js +1 -0
- package/.next/static/chunks/pages/documents-a72286e23487eaf7.js +1 -0
- package/.next/static/chunks/pages/guide-f6ad48fc4e564c1c.js +1 -0
- package/.next/static/chunks/pages/knowledge/manage-5d501503e54b4424.js +1 -0
- package/.next/static/chunks/pages/models-0fb086e70387dde1.js +1 -0
- package/.next/static/chunks/pages/overview-9fbf5907184af472.js +1 -0
- package/.next/static/chunks/pages/{prompt-654d82321a383233.js → prompt-d9996cf322de0125.js} +1 -1
- package/.next/static/he1VpXuNk12nGqt9mP7Jd/_buildManifest.js +1 -0
- package/.next/static/he1VpXuNk12nGqt9mP7Jd/_ssgManifest.js +1 -0
- package/package.json +2 -2
- package/.next/static/chunks/pages/context/long-term-710aaeb12e378258.js +0 -1
- package/.next/static/chunks/pages/context/short-term-e68f01478e7ed238.js +0 -1
- package/.next/static/chunks/pages/document-roles-caee7af42da4f792.js +0 -1
- package/.next/static/chunks/pages/document-specs-7085069b6dcdaee6.js +0 -1
- package/.next/static/chunks/pages/documents-b78988e17525927f.js +0 -1
- package/.next/static/chunks/pages/models-6131bc7596604158.js +0 -1
- package/.next/static/yEauW-YU8G-h4UdYFV8_d/_buildManifest.js +0 -1
- /package/.next/static/{yEauW-YU8G-h4UdYFV8_d → ZG2x_4BgDtQoIcW28iwgH}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{2256:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(5341).A},2725:(e,t,r)=>{"use strict";r.d(t,{A:()=>i,U:()=>a});var o=r(7109),n=r(2644),s=r(8921),c=r(4567);function a(e){return t=>o.createElement(s.Ay,{theme:{token:{motion:!1,zIndexPopupBase:0}}},o.createElement(e,{...t}))}let i=(e,t,r,s,i)=>a(a=>{let{prefixCls:l,style:d}=a,p=o.useRef(null),[h,m]=o.useState(0),[u,f]=o.useState(0),[y,j]=(0,n.PW)(!1,a.open),{getPrefixCls:x}=o.useContext(c.QO),v=x(s||"select",l);o.useEffect(()=>{if(j(!0),"undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{let t=e[0].target;m(t.offsetHeight+8),f(t.offsetWidth)}),t=setInterval(()=>{let r=i?`.${i(v)}`:`.${v}-dropdown`,o=p.current?.querySelector(r);o&&(clearInterval(t),e.observe(o))},10);return()=>{clearInterval(t),e.disconnect()}}},[v]);let g={...a,style:{...d,margin:0},open:y,getPopupContainer:()=>p.current};return r&&(g=r(g)),t&&(g={...g,[t]:{overflow:{adjustX:!1,adjustY:!1}}}),o.createElement("div",{ref:p,style:{paddingBottom:h,position:"relative",minWidth:u}},o.createElement(e,{...g}))})},2887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},4084:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"}},4508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>T});var o=r(5321),n=r(7109),s=r(3014),c=r(7807),a=r(5114),i=r(8787),l=r(1702),d=r(4253),p=r(2256),h=r(8770),m=r(6985),u=r(6171),f=r(3442),y=r(5258),j=r(4668),x=r(4746),v=r(9606),g=r(6631),A=r(9650),w=r(8209),S=r(8740);async function z(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function b(e,t){let r=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function C(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function E(){let e=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:"自定义提示词",content:"# 自定义提示词\n"})});if(!e.ok)throw Error("Failed");return e.json()}async function O(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"select",selectedIds:e})});if(!t.ok)throw Error("Failed");return t.json()}function T(){var e;let t=(0,s.Vr)(),{message:r}=c.A.useApp(),[T,k]=(0,n.useState)(!0),[F,N]=(0,n.useState)([]),[P,R]=(0,n.useState)(!1),[_,M]=(0,n.useState)(null),[B,H]=(0,n.useState)(""),[I,L]=(0,n.useState)(!1),J=async()=>{k(!0);try{N(await z())}catch(e){r.error(t("common.error"))}finally{k(!1)}};(0,n.useEffect)(()=>{J()},[]);let V=async()=>{if(_){L(!0);try{await b(_.customizePath,B),r.success(t("common.success")),R(!1),await J()}catch(e){r.error(t("common.error"))}finally{L(!1)}}},D=async e=>{try{(null==e?void 0:e.projectRoot)?await C(e.projectRoot):await E(),r.success(t("common.success")),await J()}catch(e){r.error(t("common.error"))}},U=async(e,o)=>{let n=o?Array.from(new Set([...F.filter(e=>e.selected).map(e=>e.id),e.id])):F.filter(t=>t.selected&&t.id!==e.id).map(e=>e.id);try{await O(n),N(e=>e.map(e=>({...e,selected:n.includes(e.id)})))}catch(e){r.error(t("common.error"))}},W=async e=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e.projectId,filePath:e.customizePath})})).ok)throw Error("Failed");r.success(t("common.success")),await J()}catch(e){r.error(t("common.error"))}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:t("nav.promptManagement")}),(0,o.jsx)("p",{className:"pageDesc",children:t("prompt.description")})]}),(0,o.jsx)(a.Ay,{type:"primary",icon:(0,o.jsx)(x.A,{}),onClick:()=>{D()},children:"创建提示词"})]}),F.find(e=>e.isCurrent)&&(0,o.jsx)(i.A,{size:"small",children:(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[(0,o.jsx)(l.A,{color:"green",style:{width:"fit-content"},children:"当前工作项目"}),(0,o.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,o.jsx)(v.A,{})," ",null==(e=F.find(e=>e.isCurrent))?void 0:e.projectRoot]})]})}),0!==F.length||T?null:(0,o.jsx)(d.A,{}),(0,o.jsx)(p.A,{gutter:[16,16],children:T?Array.from({length:3}).map((e,t)=>(0,o.jsx)(h.A,{xs:24,sm:12,lg:8,children:(0,o.jsx)(i.A,{loading:!0,size:"small"})},t)):F.map(e=>(0,o.jsx)(h.A,{xs:24,sm:12,lg:8,children:(0,o.jsxs)(i.A,{size:"small",title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g.A,{})," ",e.projectName]}),extra:(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[e.hasFile&&(0,o.jsx)(m.A,{checked:e.selected,onChange:t=>{U(e,t.target.checked)},children:"选中"}),!e.hasFile&&e.projectRoot&&(0,o.jsx)(a.Ay,{size:"small",type:"text",icon:(0,o.jsx)(x.A,{}),onClick:()=>{D(e)}}),e.hasFile&&(0,o.jsx)(a.Ay,{size:"small",type:"text",icon:(0,o.jsx)(A.A,{}),onClick:()=>{M(e),H(e.content||""),R(!0)}}),(0,o.jsx)(u.A,{title:"custom"===e.source?"删除自定义提示词?":"删除项目记录及其提示词文件?",onConfirm:()=>{W(e)},children:(0,o.jsx)(a.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(w.A,{})})})]}),children:[e.projectRoot&&(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:[(0,o.jsx)(v.A,{})," ",e.projectRoot]}),(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:[(0,o.jsx)(S.A,{})," ",e.mtime?new Date(e.mtime).toLocaleString():t("common.never")]}),(0,o.jsxs)(f.A,{wrap:!0,children:[e.isCurrent&&(0,o.jsx)(l.A,{color:"green",children:"当前项目"}),e.selected&&(0,o.jsx)(l.A,{color:"purple",children:"已选中"}),"custom"===e.source&&(0,o.jsx)(l.A,{color:"cyan",children:"自定义"}),e.hasFile?(0,o.jsx)(l.A,{color:"blue",children:t("prompt.hasFile")}):(0,o.jsx)(l.A,{color:"default",children:t("prompt.noFile")})]}),e.hasFile&&e.content&&(0,o.jsxs)("div",{style:{marginTop:8,padding:8,background:"var(--colorBgSecondary)",borderRadius:8,fontSize:12,maxHeight:80,overflow:"hidden",color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap"},children:[e.content.slice(0,200),e.content.length>200?"...":""]})]})},e.id))}),0===F.length&&(0,o.jsx)(i.A,{size:"small",children:(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:t("prompt.noProjects")})}),(0,o.jsxs)(y.A,{title:"".concat(t("common.edit")," — ").concat((null==_?void 0:_.projectName)||""),open:P,width:800,onCancel:()=>R(!1),onOk:()=>{V()},confirmLoading:I,children:[(0,o.jsx)("div",{style:{marginBottom:12,fontSize:12,color:"var(--colorTextSecondary)"},children:null==_?void 0:_.customizePath}),(0,o.jsx)(j.A.TextArea,{value:B,onChange:e=>H(e.target.value),rows:25,style:{fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13}})]})]})}},6631:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var o=r(7109),n=r(2887),s=r(8483);function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(s.A,c({},e,{ref:t,icon:n.A})))},7549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(4508)}])},8740:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var o=r(7109),n=r(4084),s=r(8483);function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(s.A,c({},e,{ref:t,icon:n.A})))},8770:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(1916).A}},e=>{e.O(0,[260,167,382,201,668,492,446,636,593,792],()=>e(e.s=7549)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{2256:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(5341).A},2725:(e,t,r)=>{"use strict";r.d(t,{A:()=>i,U:()=>a});var o=r(7109),n=r(2644),s=r(8921),c=r(4567);function a(e){return t=>o.createElement(s.Ay,{theme:{token:{motion:!1,zIndexPopupBase:0}}},o.createElement(e,{...t}))}let i=(e,t,r,s,i)=>a(a=>{let{prefixCls:l,style:d}=a,p=o.useRef(null),[h,m]=o.useState(0),[u,f]=o.useState(0),[y,j]=(0,n.PW)(!1,a.open),{getPrefixCls:x}=o.useContext(c.QO),v=x(s||"select",l);o.useEffect(()=>{if(j(!0),"undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{let t=e[0].target;m(t.offsetHeight+8),f(t.offsetWidth)}),t=setInterval(()=>{let r=i?`.${i(v)}`:`.${v}-dropdown`,o=p.current?.querySelector(r);o&&(clearInterval(t),e.observe(o))},10);return()=>{clearInterval(t),e.disconnect()}}},[v]);let g={...a,style:{...d,margin:0},open:y,getPopupContainer:()=>p.current};return r&&(g=r(g)),t&&(g={...g,[t]:{overflow:{adjustX:!1,adjustY:!1}}}),o.createElement("div",{ref:p,style:{paddingBottom:h,position:"relative",minWidth:u}},o.createElement(e,{...g}))})},2887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},4084:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"}},4508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>T});var o=r(5321),n=r(7109),s=r(3014),c=r(7807),a=r(5114),i=r(8787),l=r(1702),d=r(4253),p=r(2256),h=r(8770),m=r(6985),u=r(6171),f=r(3442),y=r(5258),j=r(4668),x=r(4746),v=r(9606),g=r(6631),A=r(9650),w=r(8209),S=r(8740);async function z(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function b(e,t){let r=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function C(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function E(){let e=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:"自定义提示词",content:"# 自定义提示词\n"})});if(!e.ok)throw Error("Failed");return e.json()}async function O(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"select",selectedIds:e})});if(!t.ok)throw Error("Failed");return t.json()}function T(){var e;let t=(0,s.Vr)(),{message:r}=c.A.useApp(),[T,k]=(0,n.useState)(!0),[F,N]=(0,n.useState)([]),[P,R]=(0,n.useState)(!1),[_,M]=(0,n.useState)(null),[B,H]=(0,n.useState)(""),[I,L]=(0,n.useState)(!1),J=async()=>{k(!0);try{N(await z())}catch(e){r.error(t("common.error"))}finally{k(!1)}};(0,n.useEffect)(()=>{J()},[]);let V=async()=>{if(_){L(!0);try{await b(_.customizePath,B),r.success(t("common.success")),R(!1),await J()}catch(e){r.error(t("common.error"))}finally{L(!1)}}},D=async e=>{try{(null==e?void 0:e.projectRoot)?await C(e.projectRoot):await E(),r.success(t("common.success")),await J()}catch(e){r.error(t("common.error"))}},U=async(e,o)=>{let n=o?Array.from(new Set([...F.filter(e=>e.selected).map(e=>e.id),e.id])):F.filter(t=>t.selected&&t.id!==e.id).map(e=>e.id);try{await O(n),N(e=>e.map(e=>({...e,selected:n.includes(e.id)})))}catch(e){r.error(t("common.error"))}},W=async e=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e.projectId,filePath:e.customizePath})})).ok)throw Error("Failed");r.success(t("common.success")),await J()}catch(e){r.error(t("common.error"))}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:t("nav.promptManagement")}),(0,o.jsx)("p",{className:"pageDesc",children:t("prompt.description")})]}),(0,o.jsx)(a.Ay,{type:"primary",icon:(0,o.jsx)(x.A,{}),onClick:()=>{D()},children:"创建提示词"})]}),F.find(e=>e.isCurrent)&&(0,o.jsx)(i.A,{size:"small",children:(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[(0,o.jsx)(l.A,{color:"green",style:{width:"fit-content"},children:"当前工作项目"}),(0,o.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,o.jsx)(v.A,{})," ",null==(e=F.find(e=>e.isCurrent))?void 0:e.projectRoot]})]})}),0!==F.length||T?null:(0,o.jsx)(d.A,{}),(0,o.jsx)(p.A,{gutter:[16,16],children:T?Array.from({length:3}).map((e,t)=>(0,o.jsx)(h.A,{xs:24,sm:12,lg:8,children:(0,o.jsx)(i.A,{loading:!0,size:"small"})},t)):F.map(e=>(0,o.jsx)(h.A,{xs:24,sm:12,lg:8,children:(0,o.jsxs)(i.A,{size:"small",title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g.A,{})," ",e.projectName]}),extra:(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[e.hasFile&&(0,o.jsx)(m.A,{checked:e.selected,onChange:t=>{U(e,t.target.checked)},children:"选中"}),!e.hasFile&&e.projectRoot&&(0,o.jsx)(a.Ay,{size:"small",type:"text",icon:(0,o.jsx)(x.A,{}),onClick:()=>{D(e)}}),e.hasFile&&(0,o.jsx)(a.Ay,{size:"small",type:"text",icon:(0,o.jsx)(A.A,{}),onClick:()=>{M(e),H(e.content||""),R(!0)}}),(0,o.jsx)(u.A,{title:"custom"===e.source?"删除自定义提示词?":"删除项目记录及其提示词文件?",onConfirm:()=>{W(e)},children:(0,o.jsx)(a.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(w.A,{})})})]}),children:[e.projectRoot&&(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:[(0,o.jsx)(v.A,{})," ",e.projectRoot]}),(0,o.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:[(0,o.jsx)(S.A,{})," ",e.mtime?new Date(e.mtime).toLocaleString():t("common.never")]}),(0,o.jsxs)(f.A,{wrap:!0,children:[e.isCurrent&&(0,o.jsx)(l.A,{color:"green",children:"当前项目"}),e.selected&&(0,o.jsx)(l.A,{color:"purple",children:"已选中"}),"custom"===e.source&&(0,o.jsx)(l.A,{color:"cyan",children:"自定义"}),e.hasFile?(0,o.jsx)(l.A,{color:"blue",children:t("prompt.hasFile")}):(0,o.jsx)(l.A,{color:"default",children:t("prompt.noFile")})]}),e.hasFile&&e.content&&(0,o.jsxs)("div",{style:{marginTop:8,padding:8,background:"var(--colorBgSecondary)",borderRadius:8,fontSize:12,maxHeight:80,overflow:"hidden",color:"var(--colorTextSecondary)",whiteSpace:"pre-wrap"},children:[e.content.slice(0,200),e.content.length>200?"...":""]})]})},e.id))}),0===F.length&&(0,o.jsx)(i.A,{size:"small",children:(0,o.jsx)("span",{style:{color:"var(--colorTextSecondary)"},children:t("prompt.noProjects")})}),(0,o.jsxs)(y.A,{maskClosable:!1,title:"".concat(t("common.edit")," — ").concat((null==_?void 0:_.projectName)||""),open:P,width:800,onCancel:()=>R(!1),onOk:()=>{V()},confirmLoading:I,children:[(0,o.jsx)("div",{style:{marginBottom:12,fontSize:12,color:"var(--colorTextSecondary)"},children:null==_?void 0:_.customizePath}),(0,o.jsx)(j.A.TextArea,{value:B,onChange:e=>H(e.target.value),rows:25,style:{fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13}})]})]})}},6631:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var o=r(7109),n=r(2887),s=r(8483);function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(s.A,c({},e,{ref:t,icon:n.A})))},7549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(4508)}])},8740:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var o=r(7109),n=r(4084),s=r(8483);function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(s.A,c({},e,{ref:t,icon:n.A})))},8770:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o=r(1916).A}},e=>{e.O(0,[260,167,382,201,668,492,446,636,593,792],()=>e(e.s=7549)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
self.__BUILD_MANIFEST=function(s,e,c,t,a,n,d,i,f,u,k,o,r,h,b,g,j,l,m,p,_,w,I,x){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:m,bitArray:[]},__routerFilterDynamic:{numItems:r,errorRate:1e-4,numBits:r,numHashes:m,bitArray:[]},"/":["static/chunks/pages/index-505bd438c95ec0e8.js"],"/_error":["static/chunks/pages/_error-49c333927e615faa.js"],"/context/long-term":[s,e,c,t,a,n,d,i,f,u,k,o,p,"static/chunks/pages/context/long-term-dba1d735f2b5e12b.js"],"/context/short-term":[s,e,c,t,a,n,d,i,f,u,k,o,p,"static/chunks/pages/context/short-term-7cc72881b42b74fb.js"],"/document-roles":[s,e,c,t,a,n,d,i,f,u,b,"static/chunks/pages/document-roles-653f01136b58197b.js"],"/document-specs":[s,e,c,t,a,n,d,i,f,u,g,b,"static/chunks/746-120983153bceeea6.js","static/chunks/pages/document-specs-120681be3e183b9e.js"],"/documents":[s,e,c,t,a,n,d,i,f,u,h,b,_,"static/chunks/pages/documents-a72286e23487eaf7.js"],"/guide":[s,e,c,h,_,"static/chunks/804-b11aef99b57308a3.js","static/chunks/pages/guide-f6ad48fc4e564c1c.js"],"/knowledge":["static/chunks/pages/knowledge-81fd1e907a6fcb84.js"],"/knowledge/file-detail":[s,e,c,t,a,n,d,i,k,o,h,w,"static/chunks/517-f43787133528ba48.js",j,"static/chunks/pages/knowledge/file-detail-793d12234ccddac1.js"],"/knowledge/files":[s,e,c,t,a,n,d,i,k,o,I,j,"static/chunks/pages/knowledge/files-a3a4bbc49c980b46.js"],"/knowledge/manage":[s,e,c,t,n,d,i,k,o,x,"static/chunks/891-b6a172e1df7ab8c1.js","static/chunks/pages/knowledge/manage-5d501503e54b4424.js"],"/knowledge/search":[s,e,c,t,a,n,h,g,w,j,"static/chunks/pages/knowledge/search-fe148477dfe05966.js"],"/models":[s,e,c,t,a,d,f,u,g,"static/css/0e153583d22cc52e.css","static/chunks/pages/models-0fb086e70387dde1.js"],"/overview":[s,e,n,I,x,"static/chunks/851-1190cb42a0630eef.js","static/chunks/pages/overview-9fbf5907184af472.js"],"/prompt":[s,e,c,t,a,f,k,"static/chunks/pages/prompt-d9996cf322de0125.js"],"/settings":[s,"static/css/82b6ddff0ef364fe.css","static/chunks/pages/settings-88f50b9cafc389e0.js"],sortedPages:["/","/_app","/_error","/context/long-term","/context/short-term","/document-roles","/document-specs","/documents","/guide","/knowledge","/knowledge/file-detail","/knowledge/files","/knowledge/manage","/knowledge/search","/models","/overview","/prompt","/settings"]}}("static/chunks/260-7a7a65a3ca8539ba.js","static/chunks/167-9f45623d7ea7ab43.js","static/chunks/382-dd7535429e16931b.js","static/chunks/201-b16b4788042ed1aa.js","static/chunks/668-662b7bc81e4ad48f.js","static/chunks/227-442963c7b630eade.js","static/chunks/740-cd38299e151d3ffc.js","static/chunks/174-e7df14600b457a5c.js","static/chunks/492-62671486700ed3f9.js","static/chunks/455-e31becaaf948f868.js","static/chunks/446-0591221372df7d49.js","static/chunks/400-ba996d76e74a7368.js",0,"static/chunks/292-c2888a94068fae74.js","static/chunks/846-fed995f7c83fc6c3.js","static/chunks/992-ea93dfa182a02a8e.js","static/css/d284a7454d6f6b06.css",1e-4,NaN,"static/chunks/257-ba16dfe16a27f417.js","static/chunks/730-727fe4b055c78dc2.js","static/chunks/969-8843874536e7fd83.js","static/chunks/15-289cb38b53bafa4a.js","static/chunks/958-0793922b6b146891.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
self.__SSG_MANIFEST=new Set,self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@customize-agent/server",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.12",
|
|
4
4
|
"description": "Customize Agent Web 管理控制台",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"react-dom": "^19.0.0",
|
|
47
47
|
"tesseract.js": "^7.0.0",
|
|
48
48
|
"xlsx": "^0.18.5",
|
|
49
|
-
"@customize-agent/knowledge": "^3.0.
|
|
49
|
+
"@customize-agent/knowledge": "^3.0.8",
|
|
50
50
|
"@customize-agent/runtime": "^3.0.5",
|
|
51
51
|
"@customize-agent/llm": "^3.0.3"
|
|
52
52
|
},
|
|
@@ -1 +0,0 @@
|
|
|
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(5321),a=n(7109),i=n(3014),c=n(7807),r=n(1702),s=n(5114),l=n(6171),d=n(3442),u=n(4668),p=n(8787),y=n(4849),m=n(9400),h=n(5258),f=n(3455),g=n(9650),x=n(8209),S=n(486),j=n(3374),w=n(8383),T=n(6619),b=n(3998),C=n(6578),v=n(5551);let E={project_fact:"项目知识",user_preference:"用户偏好",feedback:"历史纠偏",pattern:"解决方案"},O={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)([]),[k,R]=(0,a.useState)({count:0,totalBytes:0}),[J,U]=(0,a.useState)(""),[D,I]=(0,a.useState)(!1),[_,L]=(0,a.useState)(null),[z,B]=(0,a.useState)(""),[M,H]=(0,a.useState)(""),[W,F]=(0,a.useState)(!1),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),R(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(J)}catch(n){t.error(e("common.error"))}},q=async()=>{try{await (0,C.PH)("long_term"),t.success(e("common.success")),await V(J)}catch(n){t.error(e("common.error"))}},K=async()=>{try{await (0,C.E)("long_term"),t.success(e("common.success")),await V(J)}catch(n){t.error(e("common.error"))}},Q=async()=>{if(_&&z.trim()){F(!0);try{await (0,C.zo)(_.id,{content:z.trim(),context:M||void 0}),t.success(e("common.success")),I(!1),await V(J)}catch(n){t.error(e("common.error"))}finally{F(!1)}}},Z=[{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:"类型",dataIndex:"type",width:90,render:e=>(0,o.jsx)(r.A,{children:E[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:O[e]||"default",children:"high"===e?"高":"medium"===e?"中":"低"})},{title:e("context.source"),dataIndex:"source",width:100,ellipsis:!0},{title:e("context.updatedAt"),dataIndex:"updated_at",width:140,render:e=>e?new Date(e).toLocaleString():"-"},{title:e("common.edit"),width:100,render:(t,n)=>(0,o.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,o.jsx)(s.Ay,{size:"small",type:"text",icon:(0,o.jsx)(g.A,{}),onClick:()=>{L(n),B(n.content),H(""),I(!0)}}),(0,o.jsx)(l.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{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)(d.A,{wrap:!0,children:[(0,o.jsx)(u.A,{prefix:(0,o.jsx)(S.A,{}),placeholder:e("common.search"),value:J,onChange:e=>U(e.target.value),onPressEnter:()=>{V(J)},allowClear:!0,style:{width:240}}),(0,o.jsx)(s.Ay,{icon:(0,o.jsx)(j.A,{}),onClick:()=>{q()},children:"压缩"}),(0,o.jsx)(l.A,{title:"确定清除长期上下文吗?",onConfirm:()=>{K()},children:(0,o.jsx)(s.Ay,{danger:!0,icon:(0,o.jsx)(w.A,{}),children:"清除"})})]})]}),(0,o.jsx)(p.A,{size:"small",children:(0,o.jsx)(y.A,{title:"总上下文大小",value:(0,v.z3)(k.totalBytes),prefix:(0,o.jsx)(T.A,{}),suffix:" / ".concat(k.count," 条")})}),(0,o.jsxs)(p.A,{size:"small",children:[(0,o.jsxs)("div",{style:{marginBottom:12,color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(b.A,{})," ",e("context.longTermSource")]}),(0,o.jsx)(m.A,{rowKey:"id",columns:Z,dataSource:P,loading:n,size:"small",pagination:{pageSize:15}})]}),(0,o.jsx)(h.A,{title:e("models.editModel"),open:D,onCancel:()=>I(!1),onOk:()=>{Q()},confirmLoading:W,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("context.content"),children:(0,o.jsx)(u.A.TextArea,{rows:6,value:z,onChange:e=>B(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(u.A,{value:M,onChange:e=>H(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}},5551:(e,t,n)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(n/60),a=Math.floor(o/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):o>0?"".concat(o,"h ago"):n>0?"".concat(n,"m ago"):"Just now":a>0?"".concat(a," 天前"):o>0?"".concat(o," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>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}},6382:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/long-term",function(){return n(260)}])},6578:(e,t,n)=>{"use strict";async function o(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function a(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function i(e){var t,n;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(a))}async function 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 l(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function 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 j(){return o("/api/prompt")}async function w(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function T(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 E(){return o("/api/documents/specs")}async function O(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function 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 k(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function J(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function U(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function D(){return o("/api/documents/drafts")}async function I(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function _(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 L(){return o("/api/config/providers")}async function z(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function B(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function M(){return o("/api/config/models")}async function H(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function W(){return o("/api/config/embedding")}async function F(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function V(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function X(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function q(){return o("/api/system/stats")}async function K(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function Q(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function Z(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function G(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Y(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ee(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>I,Bh:()=>ee,Dl:()=>P,E:()=>G,EK:()=>O,ER:()=>N,FC:()=>q,FV:()=>b,H1:()=>g,H7:()=>y,HC:()=>r,HT:()=>i,II:()=>W,NR:()=>C,OX:()=>J,PH:()=>Z,QT:()=>u,Qx:()=>p,R1:()=>U,SJ:()=>h,UE:()=>_,VW:()=>x,W2:()=>S,X8:()=>f,Z3:()=>L,_m:()=>z,aP:()=>H,bV:()=>R,bZ:()=>X,c1:()=>d,dd:()=>F,dg:()=>T,dw:()=>v,dx:()=>j,h0:()=>k,h1:()=>B,hc:()=>a,hn:()=>K,l2:()=>A,lv:()=>w,mx:()=>E,p:()=>Q,q7:()=>D,tn:()=>s,u6:()=>V,xC:()=>c,xq:()=>m,xw:()=>Y,zo:()=>$,zr:()=>M})}},e=>{e.O(0,[260,167,382,201,668,227,740,174,492,455,446,400,257,636,593,792],()=>e(e.s=6382)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[409],{1162:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>O});var o=n(5321),a=n(7109),i=n(3014),r=n(7807),c=n(1702),s=n(5114),d=n(6171),l=n(3442),u=n(4668),p=n(8787),h=n(4849),m=n(9400),y=n(5258),f=n(3455),g=n(9650),x=n(8209),S=n(486),w=n(3374),j=n(8383),T=n(6619),b=n(3998),C=n(6578),v=n(5551);let E={high:"red",medium:"orange",low:"default"};function O(){let e=(0,i.Vr)(),{message:t}=r.A.useApp(),[n,O]=(0,a.useState)(!0),[N,P]=(0,a.useState)([]),[A,R]=(0,a.useState)({count:0,totalBytes:0}),[k,J]=(0,a.useState)(""),[U,D]=(0,a.useState)(!1),[I,L]=(0,a.useState)(null),[_,z]=(0,a.useState)(""),[B,M]=(0,a.useState)(""),[H,W]=(0,a.useState)(!1),F=async n=>{O(!0);try{let[e,t]=await Promise.all([(0,C.hn)("short_term",n),(0,C.p)("short_term")]);P(e),R(t)}catch(n){t.error(e("common.error"))}finally{O(!1)}};(0,a.useEffect)(()=>{F()},[]);let V=async n=>{try{await (0,C.xw)(n),t.success(e("common.success")),await F(k)}catch(n){t.error(e("common.error"))}},X=async()=>{try{await (0,C.PH)("short_term"),t.success(e("common.success")),await F(k)}catch(n){t.error(e("common.error"))}},q=async()=>{try{await (0,C.E)("short_term"),t.success(e("common.success")),await F(k)}catch(n){t.error(e("common.error"))}},K=async()=>{if(I&&_.trim()){W(!0);try{await (0,C.zo)(I.id,{content:_.trim(),context:B||void 0}),t.success(e("common.success")),D(!1),await F(k)}catch(n){t.error(e("common.error"))}finally{W(!1)}}},Q=[{title:e("models.modelName"),dataIndex:"title",ellipsis:!0,width:180},{title:e("context.importance"),dataIndex:"importance",width:80,render:e=>(0,o.jsx)(c.A,{color:E[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(""),D(!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:k,onChange:e=>J(e.target.value),onPressEnter:()=>{F(k)},allowClear:!0,style:{width:240}}),(0,o.jsx)(s.Ay,{icon:(0,o.jsx)(w.A,{}),onClick:()=>{X()},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)(h.A,{title:"总上下文大小",value:(0,v.z3)(A.totalBytes),prefix:(0,o.jsx)(T.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)(b.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)(y.A,{title:e("models.editModel"),open:U,onCancel:()=>D(!1),onOk:()=>{K()},confirmLoading:H,children:(0,o.jsxs)(f.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(f.A.Item,{label:e("context.content"),children:(0,o.jsx)(u.A.TextArea,{rows:6,value:_,onChange:e=>z(e.target.value)})}),(0,o.jsx)(f.A.Item,{label:e("context.source"),children:(0,o.jsx)(u.A,{value:B,onChange:e=>M(e.target.value),placeholder:e("context.sourceHint")})})]})})]})}},5551:(e,t,n)=>{"use strict";function o(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),n=e/Math.pow(1024,t);return"".concat(n.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let n=Math.floor(Math.floor((Date.now()-e)/1e3)/60),o=Math.floor(n/60),a=Math.floor(o/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):o>0?"".concat(o,"h ago"):n>0?"".concat(n,"m ago"):"Just now":a>0?"".concat(a," 天前"):o>0?"".concat(o," 小时前"):n>0?"".concat(n," 分钟前"):"刚刚"}n.d(t,{Jm:()=>c,fw:()=>a,z3:()=>o});let i={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},r={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function c(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===n?r:i)[e])?t:e}},6578:(e,t,n)=>{"use strict";async function o(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function a(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function i(e){var t,n;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(a))}async function r(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function c(e,t){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function s(e,t,n){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function 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 h(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 y(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,r,c;let s=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&s.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&s.set("category",t.category),(null==t?void 0:t.limit)&&s.set("limit",String(null!=(c=t.limit)?c:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&s.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(a=t.weights)?void 0:a.vector)!=null&&s.set("vectorWeight",String(t.weights.vector)),(null==t||null==(i=t.weights)?void 0:i.rewrite)!=null&&s.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(r=t.weights)?void 0:r.hybridBonus)!=null&&s.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(s))}async function w(){return o("/api/prompt")}async function j(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function T(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 E(){return o("/api/documents/specs")}async function O(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function 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 J(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function U(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function D(){return o("/api/documents/drafts")}async function I(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function L(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 _(){return o("/api/config/providers")}async function z(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function B(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function M(){return o("/api/config/models")}async function H(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function W(){return o("/api/config/embedding")}async function F(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function V(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function X(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function q(){return o("/api/system/stats")}async function K(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function Q(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function Z(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function G(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Y(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ee(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>I,Bh:()=>ee,Dl:()=>P,E:()=>G,EK:()=>O,ER:()=>N,FC:()=>q,FV:()=>b,H1:()=>g,H7:()=>h,HC:()=>c,HT:()=>i,II:()=>W,NR:()=>C,OX:()=>J,PH:()=>Z,QT:()=>u,Qx:()=>p,R1:()=>U,SJ:()=>y,UE:()=>L,VW:()=>x,W2:()=>S,X8:()=>f,Z3:()=>_,_m:()=>z,aP:()=>H,bV:()=>k,bZ:()=>X,c1:()=>l,dd:()=>F,dg:()=>T,dw:()=>v,dx:()=>w,h0:()=>R,h1:()=>B,hc:()=>a,hn:()=>K,l2:()=>A,lv:()=>j,mx:()=>E,p:()=>Q,q7:()=>D,tn:()=>s,u6:()=>V,xC:()=>r,xq:()=>m,xw:()=>Y,zo:()=>$,zr:()=>M})},9164:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/context/short-term",function(){return n(1162)}])}},e=>{e.O(0,[260,167,382,201,668,227,740,174,492,455,446,400,257,636,593,792],()=>e(e.s=9164)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[623],{3507:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return t(9889)}])},6578:(e,n,t)=>{"use strict";async function o(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function i(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(n))}async function r(e){var n,t;let i=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&i.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&i.set("category",e.category),(null==e?void 0:e.page)&&i.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&i.set("limit",String(null!=(t=e.limit)?t:50)),o("/api/kb/files?".concat(i))}async function 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 x(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function j(){return o("/api/kb/features")}async function g(e,n){var t,i,r,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==(i=n.weights)?void 0:i.vector)!=null&&l.set("vectorWeight",String(n.weights.vector)),(null==n||null==(r=n.weights)?void 0:r.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 A(){return o("/api/prompt")}async function b(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function T(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e,n){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function S(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function w(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function C(){return o("/api/documents/specs")}async function R(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 I(){return o("/api/documents/templates")}async function k(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function P(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function U(){return o("/api/documents/drafts")}async function D(e,n){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function F(e){let n=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw Error(await n.text());return n.blob()}async function L(){return o("/api/config/providers")}async function _(e,n){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function q(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function V(){return o("/api/config/models")}async function H(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function W(){return o("/api/config/embedding")}async function B(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function X(){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 G(){return o("/api/system/stats")}async function M(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return o("/api/context".concat(t))}async function Q(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function Z(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function K(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Y(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(e,n){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ee(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>D,Bh:()=>ee,Dl:()=>I,E:()=>K,EK:()=>R,ER:()=>E,FC:()=>G,FV:()=>v,H1:()=>x,H7:()=>m,HC:()=>a,HT:()=>r,II:()=>W,NR:()=>S,OX:()=>P,PH:()=>Z,QT:()=>p,Qx:()=>u,R1:()=>J,SJ:()=>h,UE:()=>F,VW:()=>j,W2:()=>g,X8:()=>f,Z3:()=>L,_m:()=>_,aP:()=>H,bV:()=>O,bZ:()=>z,c1:()=>d,dd:()=>B,dg:()=>T,dw:()=>w,dx:()=>A,h0:()=>N,h1:()=>q,hc:()=>i,hn:()=>M,l2:()=>k,lv:()=>b,mx:()=>C,p:()=>Q,q7:()=>U,tn:()=>l,u6:()=>X,xC:()=>s,xq:()=>y,xw:()=>Y,zo:()=>$,zr:()=>V})},9889:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>w});var o=t(5321),i=t(7109),r=t(7807),s=t(3455),a=t(8332),l=t(4253),c=t(5114),d=t(6171),p=t(3442),u=t(1702),m=t(8787),y=t(2256),h=t(8770),f=t(5258),x=t(7271),j=t(4668),g=t(8569),A=t(9650),b=t(8209),T=t(4746),v=t(6578),S=t(3014);function w(){let e=(0,S.Vr)(),{message:n}=r.A.useApp(),[t]=s.A.useForm(),[w]=s.A.useForm(),[C,R]=(0,i.useState)([]),[E,I]=(0,i.useState)([]),[k,N]=(0,i.useState)([]),[O,P]=(0,i.useState)([]),[J,U]=(0,i.useState)(!1),[D,F]=(0,i.useState)(!1),L=async()=>{let[e,n,t]=await Promise.all([(0,v.lv)(),(0,v.HT)(),(0,v.dx)()]);R(e.roles),I(e.configs),N(n.files),P(t)};(0,i.useEffect)(()=>{L().catch(()=>n.error(e("common.error")))},[n,e]);let _=C.filter(e=>"file"===e.type),q=C.filter(e=>"prompt"===e.type),V=async()=>{try{let o=await t.validateFields(),i=await (0,v.dg)(o);R(i.roles),I(i.configs),U(!1),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},H=async()=>{try{let t=await w.validateFields(),o=e=>(null!=e?e:[]).map((e,n)=>{var t;return{roleId:e.roleId,order:Number(null!=(t=e.order)?t:n)}}),i=await (0,v.NR)({...t,fileRoles:o(t.fileRoles),promptRoles:o(t.promptRoles)});R(i.roles),I(i.configs),F(!1),n.success(e("common.success"))}catch(t){n.error(e("common.error"))}},W=async e=>{let n=await (0,v.FV)(e.type,e.id);R(n.roles),I(n.configs)},B=async e=>{let n=await (0,v.dw)(e);R(n.roles),I(n.configs)},X=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";t.setFieldsValue(null!=e?e:{id:"role-".concat(Date.now()),name:"",description:"",type:n,executionType:"prompt"===n?"reference":void 0,processingType:"file"===n?"reference":void 0}),U(!0)},z=e=>{w.setFieldsValue(null!=e?e:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[]}),F(!0)},G=n=>(0,o.jsx)(a.A,{dataSource:C.filter(e=>e.type===n),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:()=>X(n)},"edit"),(0,o.jsx)(d.A,{title:e("common.confirm"),onConfirm:()=>{W(n)},children:(0,o.jsx)(c.Ay,{type:"text",danger:!0,icon:(0,o.jsx)(b.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:(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:n.resourceId||"-"})]})})})});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:()=>X(void 0,"file"),children:e("roles.newFileRole")}),(0,o.jsx)(c.Ay,{icon:(0,o.jsx)(T.A,{}),onClick:()=>X(void 0,"prompt"),children:e("roles.newPromptRole")}),(0,o.jsx)(c.Ay,{type:"primary",icon:(0,o.jsx)(T.A,{}),onClick:()=>z(),children:e("roles.newConfig")})]})]})}),(0,o.jsxs)(y.A,{gutter:[16,16],children:[(0,o.jsx)(h.A,{xs:24,lg:12,children:(0,o.jsx)(m.A,{title:e("roles.fileRoles"),children:G("file")})}),(0,o.jsx)(h.A,{xs:24,lg:12,children:(0,o.jsx)(m.A,{title:e("roles.promptRoles"),children:G("prompt")})}),(0,o.jsx)(h.A,{xs:24,children:(0,o.jsx)(m.A,{title:e("roles.configs"),children:(0,o.jsx)(a.A,{dataSource:E,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:()=>z(n)},"edit"),(0,o.jsx)(d.A,{title:e("common.confirm"),onConfirm:()=>{B(n.id)},children:(0,o.jsx)(c.Ay,{type:"text",danger:!0,icon:(0,o.jsx)(b.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)(f.A,{title:e("roles.roleEditor"),open:J,onOk:()=>{V()},onCancel:()=>U(!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}],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:"resourceId",label:e("roles.bindPrompt"),children:(0,o.jsx)(x.A,{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}],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:"resourceId",label:e("roles.bindFile"),children:(0,o.jsx)(x.A,{showSearch:!0,options:k.map(e=>({label:e.relativePath,value:e.relativePath}))})})]})}})]})}),(0,o.jsx)(f.A,{title:e("roles.configEditor"),open:D,onOk:()=>{H()},onCancel:()=>F(!1),width:820,centered:!0,okText:e("common.save"),children:(0,o.jsxs)(s.A,{form:w,layout:"vertical",children:[(0,o.jsxs)(y.A,{gutter:12,children:[(0,o.jsx)(h.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)(h.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)(h.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)(g.A,{items:[{key:"file",label:e("roles.fileRoles"),children:(0,o.jsx)(s.A.List,{name:"fileRoles",children:(n,t)=>{let{add:i,remove:r}=t;return(0,o.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[n.map((e,n)=>(0,o.jsxs)(y.A,{gutter:8,children:[(0,o.jsx)(h.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)(h.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)(h.A,{span:2,children:(0,o.jsx)(c.Ay,{danger:!0,onClick:()=>r(e.name),children:"-"})})]},e.key)),(0,o.jsx)(c.Ay,{onClick:()=>i({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:i,remove:r}=t;return(0,o.jsxs)(p.A,{direction:"vertical",className:"w-full",children:[n.map((e,n)=>(0,o.jsxs)(y.A,{gutter:8,children:[(0,o.jsx)(h.A,{span:16,children:(0,o.jsx)(s.A.Item,{name:[e.name,"roleId"],rules:[{required:!0}],children:(0,o.jsx)(x.A,{options:q.map(e=>({label:e.name,value:e.id}))})})}),(0,o.jsx)(h.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)(h.A,{span:2,children:(0,o.jsx)(c.Ay,{danger:!0,onClick:()=>r(e.name),children:"-"})})]},e.key)),(0,o.jsx)(c.Ay,{onClick:()=>i({order:n.length}),children:e("roles.addRole")})]})}})}]})]})})]})}}},e=>{e.O(0,[260,167,382,201,668,227,740,174,492,455,846,636,593,792],()=>e(e.s=3507)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[580],{1533:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>K});var i=t(5321),a=t(7109),r=t(7807),c=t(3455),s=t(8787),o=t(5114),l=t(8332),d=t(4253),p=t(6171),u=t(3442),m=t(1702),h=t(5258),y=t(2256),g=t(8770),f=t(4668),x=t(8569),j=t(7271),A=t(3914),b=t(3638),S=t(2565),I=t(9452);function w(){return(w=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}let $=a.forwardRef(({prefixCls:e="rc-switch",className:n,checked:t,defaultChecked:i,disabled:r,loadingIcon:c,checkedChildren:s,unCheckedChildren:o,onClick:l,onChange:d,onKeyDown:p,styles:u,classNames:m,...h},y)=>{let[g,f]=(0,S.A)(i??!1,t);function x(e,n){let t=g;return r||(f(t=e),d?.(t,n)),t}let j=(0,b.$)(e,n,{[`${e}-checked`]:g,[`${e}-disabled`]:r});return a.createElement("button",w({},h,{type:"button",role:"switch","aria-checked":g,disabled:r,className:j,ref:y,onKeyDown:function(e){e.which===I.A.LEFT?x(!1,e):e.which===I.A.RIGHT&&x(!0,e),p?.(e)},onClick:function(e){let n=x(!g,e);l?.(n,e)}}),c,a.createElement("span",{className:`${e}-inner`},a.createElement("span",{className:(0,b.$)(`${e}-inner-checked`,m?.content),style:u?.content},s),a.createElement("span",{className:(0,b.$)(`${e}-inner-unchecked`,m?.content),style:u?.content},o)))});$.displayName="Switch";var k=t(2644),T=t(2162),v=t(8862),E=t(4567),C=t(6831),N=t(7273),R=t(5561),O=t(7252),q=t(7961),P=t(6666),D=t(540),_=t(8403);let L=(0,D.OF)("Switch",e=>{let n=(0,_.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:i}=e;return{[n]:{...(0,q.dF)(e),position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:i,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,P.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:i,innerMinMargin:a,innerMaxMargin:r,handleSize:c,switchDuration:s,calc:o}=e,l=`${n}-inner`,d=(0,R.zA)(o(c).add(o(i).mul(2)).equal()),p=(0,R.zA)(o(r).mul(2).equal());return{[n]:{[l]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:r,paddingInlineEnd:a,transition:["padding-inline-start","padding-inline-end"].map(e=>`${e} ${s} ease-in-out`).join(", "),...(0,P.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} ${s} ease-in-out`).join(", "),...(0,P.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:a,paddingInlineEnd:r,[`${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(i).mul(2).equal(),marginInlineEnd:o(i).mul(-1).mul(2).equal()}},[`&${n}-checked ${l}`]:{[`${l}-checked`]:{marginInlineStart:o(i).mul(-1).mul(2).equal(),marginInlineEnd:o(i).mul(2).equal()}}}}}})(n),(e=>{let{componentCls:n,trackPadding:t,handleBg:i,handleShadow:a,handleSize:r,calc:c}=e,s=`${n}-handle`;return{[n]:{[s]:{position:"absolute",top:t,insetInlineStart:t,width:r,height:r,transition:`all ${e.switchDuration} ease-in-out`,...(0,P.V)(),"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:i,borderRadius:c(r).div(2).equal(),boxShadow:a,transition:`all ${e.switchDuration} ease-in-out`,content:'""',...(0,P.V)()}},[`&${n}-checked ${s}`]:{insetInlineStart:`calc(100% - ${(0,R.zA)(c(r).add(t).equal())})`},[`&:not(${n}-disabled):active`]:{[`${s}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${n}-checked ${s}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}})(n),(e=>{let{componentCls:n,handleSize:t,calc:i}=e;return{[n]:{[`${n}-loading-icon${e.iconCls}`]:{position:"relative",top:i(i(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:i,trackMinWidthSM:a,innerMinMarginSM:r,innerMaxMarginSM:c,handleSizeSM:s,calc:o}=e,l=`${n}-inner`,d=(0,R.zA)(o(s).add(o(i).mul(2)).equal()),p=(0,R.zA)(o(c).mul(2).equal());return{[n]:{[`&${n}-small`]:{minWidth:a,height:t,lineHeight:(0,R.zA)(t),[`${n}-inner`]:{paddingInlineStart:c,paddingInlineEnd:r,[`${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:s,height:s},[`${n}-loading-icon`]:{top:o(o(s).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${n}-checked`]:{[`${n}-inner`]:{paddingInlineStart:r,paddingInlineEnd:c,[`${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(s).add(i).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:i,colorWhite:a}=e,r=n*t,c=i/2,s=r-4,o=c-4;return{trackHeight:r,trackHeightSM:c,trackMinWidth:2*s+8,trackMinWidthSM:2*o+4,trackPadding:2,handleBg:a,handleSize:s,handleSizeSM:o,handleShadow:`0 2px 4px 0 ${new O.Y("#00230b").setA(.2).toRgbString()}`,innerMinMargin:s/2,innerMaxMargin:s+2+4,innerMinMarginSM:o/2,innerMaxMarginSM:o+2+4}}),H=a.forwardRef((e,n)=>{let{prefixCls:t,size:i,disabled:r,loading:c,className:s,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:S,direction:I,className:w,style:R,classNames:O,styles:q}=(0,E.TP)("switch"),P=a.useContext(C.A),D=(r??P)||c,_=S("switch",t),[H,J]=L(_),U=(0,N.A)(i),z={...e,size:U,disabled:D},F=(0,T.XT)(R),M=(0,T.XT)(l),[V,X]=(0,T.AV)([O,g],[q,F,y,M],{props:z}),W=a.createElement("div",{className:(0,b.$)(`${_}-handle`,V.indicator),style:X.indicator},c&&a.createElement(A.A,{className:`${_}-loading-icon`})),B=(0,b.$)(w,{[`${_}-small`]:"small"===U,[`${_}-loading`]:c,[`${_}-rtl`]:"rtl"===I},s,o,V.root,H,J);return a.createElement(v.A,{component:"Switch",disabled:D},a.createElement($,{...f,classNames:V,styles:X,checked:x,onChange:(...e)=>{j(e[0]),h?.(...e)},prefixCls:_,className:B,style:X.root,disabled:D,ref:n,loadingIcon:W}))});H.__ANT_SWITCH=!0;var J=t(4992),U=t(4746),z=t(9650),F=t(8209),M=t(6578),V=t(3014);let X=["text","number","date","table","list"].map(e=>({label:e,value:e})),W=["required_fact","required_chapter","required_file_role","required_prompt_role","source_required","forbidden_text","min_chapter_length","table_required"].map(e=>({label:e,value:e})),B=["error","warning","info"].map(e=>({label:e,value:e}));function K(){var e,n;let t=(0,V.Vr)(),{message:A}=r.A.useApp(),[b]=c.A.useForm(),[S,I]=(0,a.useState)([]),[w,$]=(0,a.useState)([]),[k,T]=(0,a.useState)(!1),v=async()=>{let[e,n]=await Promise.all([(0,M.mx)(),(0,M.lv)()]);I(e.specs),$(n.roles)};(0,a.useEffect)(()=>{v().catch(()=>A.error(t("common.error")))},[A,t]);let E=w.filter(e=>"file"===e.type).map(e=>({label:e.name,value:e.id})),C=w.filter(e=>"prompt"===e.type).map(e=>({label:e.name,value:e.id})),N=null!=(n=null==(e=c.A.useWatch("factFields",b))?void 0:e.map(e=>({label:e.name||e.id,value:e.id})))?n:[],R=e=>{b.setFieldsValue(null!=e?e:{id:"spec-".concat(Date.now()),name:"",description:"",factFields:[],chapterRules:[],gateRules:[]}),T(!0)},O=async()=>{try{let e=await b.validateFields(),n=await (0,M.EK)(e);I(n.specs),T(!1),A.success(t("common.success"))}catch(e){e instanceof Error&&A.error(e.message)}},q=async e=>{I((await (0,M.ER)(e)).specs)};return(0,i.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,i.jsx)(s.A,{className:"cardGlass",styles:{body:{padding:24}},children:(0,i.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"pageTitle mb-1",children:t("specs.title")}),(0,i.jsx)("p",{className:"pageDesc mb-0",children:t("specs.description")})]}),(0,i.jsx)(o.Ay,{type:"primary",icon:(0,i.jsx)(U.A,{}),onClick:()=>R(),children:t("specs.newSpec")})]})}),(0,i.jsx)(s.A,{title:t("specs.list"),children:(0,i.jsx)(l.A,{dataSource:S,locale:{emptyText:(0,i.jsx)(d.A,{description:t("common.noData")})},renderItem:e=>(0,i.jsx)(l.A.Item,{actions:[(0,i.jsx)(o.Ay,{type:"text",icon:(0,i.jsx)(z.A,{}),onClick:()=>R(e)},"edit"),(0,i.jsx)(p.A,{title:t("common.confirm"),onConfirm:()=>{q(e.id)},children:(0,i.jsx)(o.Ay,{type:"text",danger:!0,icon:(0,i.jsx)(F.A,{})})},"delete")],children:(0,i.jsx)(l.A.Item.Meta,{title:(0,i.jsxs)(u.A,{children:[e.name,(0,i.jsx)(m.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,i.jsx)(h.A,{title:t("specs.editor"),open:k,onOk:()=>{O()},onCancel:()=>T(!1),width:980,centered:!0,okText:t("common.save"),children:(0,i.jsxs)(c.A,{form:b,layout:"vertical",children:[(0,i.jsxs)(y.A,{gutter:12,children:[(0,i.jsx)(g.A,{span:8,children:(0,i.jsx)(c.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,i.jsx)(f.A,{disabled:!0})})}),(0,i.jsx)(g.A,{span:8,children:(0,i.jsx)(c.A.Item,{name:"name",label:t("specs.name"),rules:[{required:!0}],children:(0,i.jsx)(f.A,{})})}),(0,i.jsx)(g.A,{span:8,children:(0,i.jsx)(c.A.Item,{name:"wordTemplatePath",label:t("specs.wordTemplatePath"),children:(0,i.jsx)(f.A,{placeholder:"/path/to/template.docx"})})})]}),(0,i.jsx)(c.A.Item,{name:"description",label:t("specs.specDescription"),children:(0,i.jsx)(f.A,{})}),(0,i.jsx)(x.A,{items:[{key:"facts",label:t("specs.facts"),children:(0,i.jsx)(c.A.List,{name:"factFields",children:(e,n)=>{let{add:a,remove:r}=n;return(0,i.jsxs)(u.A,{direction:"vertical",className:"w-full",children:[e.map(e=>(0,i.jsxs)(s.A,{size:"small",children:[(0,i.jsxs)(y.A,{gutter:8,children:[(0,i.jsx)(g.A,{span:5,children:(0,i.jsx)(c.A.Item,{name:[e.name,"id"],label:"ID",initialValue:"fact-".concat(Date.now()),children:(0,i.jsx)(f.A,{disabled:!0})})}),(0,i.jsx)(g.A,{span:5,children:(0,i.jsx)(c.A.Item,{name:[e.name,"name"],label:t("specs.factName"),rules:[{required:!0}],children:(0,i.jsx)(f.A,{})})}),(0,i.jsx)(g.A,{span:4,children:(0,i.jsx)(c.A.Item,{name:[e.name,"type"],label:t("specs.factType"),initialValue:"text",children:(0,i.jsx)(j.A,{options:X})})}),(0,i.jsx)(g.A,{span:4,children:(0,i.jsx)(c.A.Item,{name:[e.name,"required"],label:t("specs.required"),valuePropName:"checked",children:(0,i.jsx)(H,{})})}),(0,i.jsx)(g.A,{span:5,children:(0,i.jsx)(c.A.Item,{name:[e.name,"sourceRoleIds"],label:t("specs.sourceRoles"),children:(0,i.jsx)(j.A,{mode:"multiple",options:E})})}),(0,i.jsx)(g.A,{span:1,children:(0,i.jsx)(o.Ay,{danger:!0,onClick:()=>r(e.name),children:"-"})})]}),(0,i.jsx)(c.A.Item,{name:[e.name,"extractionHint"],label:t("specs.extractionHint"),children:(0,i.jsx)(f.A,{})}),(0,i.jsx)(c.A.Item,{name:[e.name,"validationHint"],label:t("specs.validationHint"),children:(0,i.jsx)(f.A,{})})]},e.key)),(0,i.jsx)(o.Ay,{onClick:()=>a({id:"fact-".concat(Date.now()),type:"text",required:!0}),children:t("specs.addFact")})]})}})},{key:"chapters",label:t("specs.chapters"),children:(0,i.jsx)(c.A.List,{name:"chapterRules",children:(e,n)=>{let{add:a,remove:r}=n;return(0,i.jsxs)(u.A,{direction:"vertical",className:"w-full",children:[e.map((e,n)=>(0,i.jsxs)(s.A,{size:"small",children:[(0,i.jsxs)(y.A,{gutter:8,children:[(0,i.jsx)(g.A,{span:4,children:(0,i.jsx)(c.A.Item,{name:[e.name,"id"],label:"ID",initialValue:"chapter-".concat(Date.now()),children:(0,i.jsx)(f.A,{disabled:!0})})}),(0,i.jsx)(g.A,{span:5,children:(0,i.jsx)(c.A.Item,{name:[e.name,"title"],label:t("specs.chapterTitle"),rules:[{required:!0}],children:(0,i.jsx)(f.A,{})})}),(0,i.jsx)(g.A,{span:3,children:(0,i.jsx)(c.A.Item,{name:[e.name,"order"],label:t("specs.order"),initialValue:n,children:(0,i.jsx)(J.A,{className:"w-full"})})}),(0,i.jsx)(g.A,{span:3,children:(0,i.jsx)(c.A.Item,{name:[e.name,"minWords"],label:t("specs.minWords"),children:(0,i.jsx)(J.A,{className:"w-full"})})}),(0,i.jsx)(g.A,{span:3,children:(0,i.jsx)(c.A.Item,{name:[e.name,"required"],label:t("specs.required"),valuePropName:"checked",children:(0,i.jsx)(H,{})})}),(0,i.jsx)(g.A,{span:5,children:(0,i.jsx)(c.A.Item,{name:[e.name,"requiredFactIds"],label:t("specs.requiredFacts"),children:(0,i.jsx)(j.A,{mode:"multiple",options:N})})}),(0,i.jsx)(g.A,{span:1,children:(0,i.jsx)(o.Ay,{danger:!0,onClick:()=>r(e.name),children:"-"})})]}),(0,i.jsxs)(y.A,{gutter:8,children:[(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(c.A.Item,{name:[e.name,"requiredFileRoleIds"],label:t("specs.requiredFileRoles"),children:(0,i.jsx)(j.A,{mode:"multiple",options:E})})}),(0,i.jsx)(g.A,{span:12,children:(0,i.jsx)(c.A.Item,{name:[e.name,"requiredPromptRoleIds"],label:t("specs.requiredPromptRoles"),children:(0,i.jsx)(j.A,{mode:"multiple",options:C})})})]}),(0,i.jsx)(c.A.Item,{name:[e.name,"generationHint"],label:t("specs.generationHint"),children:(0,i.jsx)(f.A,{})})]},e.key)),(0,i.jsx)(o.Ay,{onClick:()=>a({id:"chapter-".concat(Date.now()),order:e.length,required:!0}),children:t("specs.addChapter")})]})}})},{key:"gates",label:t("specs.gates"),children:(0,i.jsx)(c.A.List,{name:"gateRules",children:(e,n)=>{let{add:a,remove:r}=n;return(0,i.jsxs)(u.A,{direction:"vertical",className:"w-full",children:[e.map(e=>(0,i.jsxs)(y.A,{gutter:8,children:[(0,i.jsx)(g.A,{span:4,children:(0,i.jsx)(c.A.Item,{name:[e.name,"id"],initialValue:"gate-".concat(Date.now()),children:(0,i.jsx)(f.A,{disabled:!0})})}),(0,i.jsx)(g.A,{span:5,children:(0,i.jsx)(c.A.Item,{name:[e.name,"name"],rules:[{required:!0}],children:(0,i.jsx)(f.A,{placeholder:t("specs.gateName")})})}),(0,i.jsx)(g.A,{span:5,children:(0,i.jsx)(c.A.Item,{name:[e.name,"type"],initialValue:"required_fact",children:(0,i.jsx)(j.A,{options:W})})}),(0,i.jsx)(g.A,{span:4,children:(0,i.jsx)(c.A.Item,{name:[e.name,"level"],initialValue:"error",children:(0,i.jsx)(j.A,{options:B})})}),(0,i.jsx)(g.A,{span:3,children:(0,i.jsx)(c.A.Item,{name:[e.name,"target"],children:(0,i.jsx)(f.A,{placeholder:"target"})})}),(0,i.jsx)(g.A,{span:2,children:(0,i.jsx)(c.A.Item,{name:[e.name,"value"],children:(0,i.jsx)(f.A,{placeholder:"value"})})}),(0,i.jsx)(g.A,{span:1,children:(0,i.jsx)(o.Ay,{danger:!0,onClick:()=>r(e.name),children:"-"})})]},e.key)),(0,i.jsx)(o.Ay,{onClick:()=>a({id:"gate-".concat(Date.now()),type:"required_fact",level:"error"}),children:t("specs.addGate")})]})}})}]})]})})]})}},4773:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-specs",function(){return t(1533)}])},6578:(e,n,t)=>{"use strict";async function i(e,n){let t=await fetch(e,n);if(!t.ok){let e=await t.text(),n=e||"HTTP ".concat(t.status);try{let t=JSON.parse(e);n=t.error||t.message||n}catch(e){}throw Error(n)}return t.json()}async function a(e){let n=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return i("/api/kb/stats".concat(n))}async function r(e){var n,t;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(n=e.page)?n:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(t=e.limit)?t:50)),i("/api/kb/files?".concat(a))}async function c(e,n){let t=new URLSearchParams({relativePath:e});return n&&t.set("projectRoot",n),i("/api/kb/files/detail?".concat(t))}async function s(e,n){return i("/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 i("/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 i=new FileReader;i.onload=()=>{let e=i.result,t=e.indexOf(",");n(t>=0?e.slice(t+1):e)},i.onerror=t,i.readAsDataURL(e)})}async function d(e,n,t){return i("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:n,uploadId:t})})}async function p(e){return i("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function u(e){let n=new URLSearchParams({limit:"50"});return e&&n.set("projectRoot",e),i("/api/kb/operations?".concat(n))}async function m(e){let n=new URLSearchParams;return e&&n.set("projectRoot",e),i("/api/kb/operations?".concat(n),{method:"DELETE"})}async function h(e,n){return i("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:n})})}async function y(e,n){return i("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:n})})}async function g(e){return i("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function f(e){return i("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return i("/api/kb/features")}async function j(e,n){var t,a,r,c,s;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!=(s=n.limit)?s:20)),(null==n||null==(t=n.weights)?void 0:t.keyword)!=null&&o.set("keywordWeight",String(n.weights.keyword)),(null==n||null==(a=n.weights)?void 0:a.vector)!=null&&o.set("vectorWeight",String(n.weights.vector)),(null==n||null==(r=n.weights)?void 0:r.rewrite)!=null&&o.set("rewriteWeight",String(n.weights.rewrite)),(null==n||null==(c=n.weights)?void 0:c.hybridBonus)!=null&&o.set("hybridBonus",String(n.weights.hybridBonus)),i("/api/kb/search?".concat(o))}async function A(){return i("/api/prompt")}async function b(e){return i("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function S(e){return i("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function I(e,n){return i("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(n)),{method:"DELETE"})}async function w(e){return i("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(e){return i("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function k(){return i("/api/documents/specs")}async function T(e){return i("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function v(e){return i("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function E(){return i("/api/documents/templates")}async function C(e){return i("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function N(e){return i("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function R(e){return i("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function O(e){return i("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q(e){return i("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function P(){return i("/api/documents/drafts")}async function D(e,n){return i("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:n})})}async function _(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 L(){return i("/api/config/providers")}async function H(e,n){return i("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...n})})}async function J(e){return i("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function U(){return i("/api/config/models")}async function z(e){return i("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function F(){return i("/api/config/embedding")}async function M(e){return i("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function V(){return i("/api/config/embedding/healthCheck",{method:"POST"})}async function X(e){return i("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function W(){return i("/api/system/stats")}async function B(e,n){let t=n?"?type=".concat(e,"&search=").concat(encodeURIComponent(n)):"?type=".concat(e);return i("/api/context".concat(t))}async function K(e){return i("/api/context?type=".concat(e,"&stats=1"))}async function G(e){return i("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function Q(e){return i("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Z(e){return i("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function Y(e,n){return i("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...n})})}async function ee(e){return i("/api/config/providers/".concat(encodeURIComponent(e)))}t.d(n,{Af:()=>D,Bh:()=>ee,Dl:()=>E,E:()=>Q,EK:()=>T,ER:()=>v,FC:()=>W,FV:()=>I,H1:()=>f,H7:()=>m,HC:()=>s,HT:()=>r,II:()=>F,NR:()=>w,OX:()=>O,PH:()=>G,QT:()=>p,Qx:()=>u,R1:()=>q,SJ:()=>y,UE:()=>_,VW:()=>x,W2:()=>j,X8:()=>g,Z3:()=>L,_m:()=>H,aP:()=>z,bV:()=>R,bZ:()=>X,c1:()=>d,dd:()=>M,dg:()=>S,dw:()=>$,dx:()=>A,h0:()=>N,h1:()=>J,hc:()=>a,hn:()=>B,l2:()=>C,lv:()=>b,mx:()=>k,p:()=>K,q7:()=>P,tn:()=>o,u6:()=>V,xC:()=>c,xq:()=>h,xw:()=>Z,zo:()=>Y,zr:()=>U})}},e=>{e.O(0,[260,167,382,201,668,227,740,174,492,455,992,846,636,593,792],()=>e(e.s=4773)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{1307:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"}},1699:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>M});var o=n(5321),s=n(7109),c=n(4668),i=n(5292),a=n(7807),r=n(3455),l=n(8787),d=n(5114),u=n(2256),p=n(8770),m=n(8332),h=n(4253),f=n(6171),y=n(3442),g=n(1702),x=n(7271),j=n(9730),A=n(8569),w=n(5258),v=n(4746),b=n(3051),S=n(9650),C=n(8209),k=n(6631),I=n(9071),T=n(1307),O=n(8483);function E(){return(E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let R=s.forwardRef((e,t)=>s.createElement(O.A,E({},e,{ref:t,icon:T.A})));var P=n(6398);function N(){return(N=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let z=s.forwardRef((e,t)=>s.createElement(O.A,N({},e,{ref:t,icon:P.A})));var D=n(9811),L=n(6578),U=n(3014);let{TextArea:J}=c.A,{Paragraph:H}=i.A;function M(){var e,t,n;let i=(0,U.Vr)(),{message:T}=a.A.useApp(),[O]=r.A.useForm(),[E,P]=(0,s.useState)([]),[N,M]=(0,s.useState)("construction-organization-design"),[V,F]=(0,s.useState)([]),[_,G]=(0,s.useState)([]),[q,B]=(0,s.useState)([]),[W,X]=(0,s.useState)(!1),[Q,Z]=(0,s.useState)(null),[K,Y]=(0,s.useState)(""),[$,ee]=(0,s.useState)([]),[et,en]=(0,s.useState)(!1),[eo,es]=(0,s.useState)(null),[ec,ei]=(0,s.useState)(!1),[ea,er]=(0,s.useState)([]),[el,ed]=(0,s.useState)(null),eu=async()=>{try{ee((await (0,L.q7)()).drafts)}catch(e){ee([])}};(0,s.useEffect)(()=>{(0,L.Dl)().then(e=>{var t,n;P(e.templates),M(null!=(n=null==(t=e.templates[0])?void 0:t.id)?n:"construction-organization-design")}).catch(()=>T.error(i("common.error"))),(0,L.lv)().then(e=>{F(e.roles),G(e.configs)}).catch(()=>{F([]),G([])}),(0,L.mx)().then(e=>B(e.specs)).catch(()=>B([])),eu()},[T,i]);let ep=(0,s.useMemo)(()=>E.find(e=>e.id===N),[E,N]),em=_.map(e=>({label:e.name,value:e.id})),eh=q.map(e=>({label:e.name,value:e.id})),ef=Math.max(0,ea.findIndex(e=>e.key===el)),ey=(e,t,n)=>{ed(e),er(o=>o.map(o=>o.key===e?{...o,status:t,description:n||o.description}:o))},eg=e=>{er(t=>{let n=t.findIndex(t=>t.key===e);return t.map((e,t)=>t<n&&"error"!==e.status?{...e,status:"finish"}:e)})},ex=e=>{O.setFieldsValue(null!=e?e:{id:"custom-template-".concat(Date.now()),name:"",description:"",category:"自定义",outputTitle:"",projectRoleConfigId:void 0,documentSpecId:void 0,chapters:[]}),ei(!0)},ej=async()=>{try{let e=await O.validateFields(),t=await (0,L.l2)(e);P(t.templates),M(t.template.id),ei(!1),T.success(i("common.success"))}catch(e){e instanceof Error&&T.error(e.message)}},eA=async e=>{try{let t=await (0,L.bV)(e);P(t.templates),M(t.template.id),T.success(i("common.success"))}catch(e){T.error(i("common.error"))}},ew=async e=>{try{var t,n;let o=await (0,L.h0)(e);P(o.templates),M(null!=(n=null==(t=o.templates[0])?void 0:t.id)?n:""),T.success(i("common.success"))}catch(e){T.error(i("common.error"))}},ev=async()=>{if(!N)return;X(!0),er([{key:"prepare",title:i("documents.flowPrepare"),description:i("documents.flowPrepareDesc"),status:"process"},{key:"fact_extraction",title:i("documents.flowFactExtraction"),description:i("documents.flowFactExtractionDesc"),status:"wait"},{key:"chapter_generation",title:i("documents.flowChapterGeneration"),description:i("documents.flowChapterGenerationDesc"),status:"wait"},{key:"validation",title:i("documents.flowValidation"),description:i("documents.flowValidationDesc"),status:"wait"},{key:"formatting",title:i("documents.flowFormatting"),description:i("documents.flowFormattingDesc"),status:"wait"},{key:"done",title:i("documents.flowDone"),description:i("documents.flowDoneDesc"),status:"wait"}]),ed("prepare");let e=[window.setTimeout(()=>{eg("fact_extraction"),ey("fact_extraction","process")},600),window.setTimeout(()=>{eg("chapter_generation"),ey("chapter_generation","process")},1800),window.setTimeout(()=>{eg("validation"),ey("validation","process")},3200),window.setTimeout(()=>{eg("formatting"),ey("formatting","process")},4600)];try{let e=await (0,L.OX)({templateId:N});Z(e.draft),Y(e.draft.markdown),er(t=>t.map(t=>{let n=e.draft.executionStages.find(e=>e.type===t.key);return"prepare"===t.key?{...t,status:"finish",description:i("documents.flowPrepareDone")}:"done"===t.key?{...t,status:e.draft.exportGate.passed?"finish":"error",description:e.draft.exportGate.passed?i("documents.flowDoneDesc"):i("documents.flowGateFailed")}:n?{...t,status:"failed"===n.status?"error":"finish",description:n.message||t.description}:"process"===t.status?{...t,status:"finish"}:t})),ed("done"),T.success(i("common.success"))}catch(e){er(t=>t.map(t=>"process"===t.status?{...t,status:"error",description:e instanceof Error?e.message:i("common.error")}:t)),T.error(e instanceof Error?e.message:i("common.error"))}finally{e.forEach(e=>window.clearTimeout(e)),X(!1)}},eb=async e=>{if(Q){en(!0);try{let s=null==(t=q.find(e=>e.id===(null==ep?void 0:ep.documentSpecId)))?void 0:t.wordTemplatePath;var t,n=await (0,L.UE)({title:Q.title,markdown:K,format:e,enforceGate:"pdf"===e||"docx"===e,exportGate:Q.exportGate,wordTemplatePath:s}),o="".concat(Q.title,".").concat("markdown"===e?"md":e);let c=URL.createObjectURL(n),i=document.createElement("a");i.href=c,i.download=o,i.click(),URL.revokeObjectURL(c)}catch(e){T.error(i("common.error"))}finally{en(!1)}}},eS=async()=>{if(Q)try{let e=await (0,L.Af)({...Q,markdown:K});Z(e.draft),await eu(),T.success(i("common.success"))}catch(e){T.error(i("common.error"))}},eC=async e=>{if(Q){es(e.id);try{var t;let n=await (0,L.R1)({templateId:Q.templateId,chapterId:e.id}),o=Q.chapters.map(t=>t.id===e.id?n.chapter:t);Z({...Q,chapters:o}),t=n.chapter,Y(n=>n.includes(e.content)?n.replace(e.content,t.content):"".concat(n,"\n\n").concat(t.content)),T.success(i("common.success"))}catch(e){T.error(i("common.error"))}finally{es(null)}}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsx)(l.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:i("documents.title")}),(0,o.jsx)("p",{className:"pageDesc mb-0",children:i("documents.description")})]}),(0,o.jsx)(d.Ay,{type:"primary",size:"large",icon:(0,o.jsx)(v.A,{}),onClick:()=>ex(),children:i("documents.newTemplate")})]})}),(0,o.jsxs)(u.A,{gutter:[16,16],align:"top",children:[(0,o.jsxs)(p.A,{xs:24,lg:8,children:[(0,o.jsx)(l.A,{size:"small",title:i("documents.templateLibrary"),children:(0,o.jsx)(m.A,{dataSource:E,locale:{emptyText:(0,o.jsx)(h.A,{description:i("common.noData")})},renderItem:e=>(0,o.jsx)(m.A.Item,{onClick:()=>M(e.id),className:"cursor-pointer",actions:[(0,o.jsx)(d.Ay,{size:"small",type:"text",icon:(0,o.jsx)(b.A,{}),onClick:t=>{t.stopPropagation(),eA(e.id)}},"copy"),(0,o.jsx)(d.Ay,{size:"small",type:"text",icon:(0,o.jsx)(S.A,{}),disabled:e.builtIn,onClick:t=>{t.stopPropagation(),ex(e)}},"edit"),(0,o.jsx)(f.A,{title:i("documents.deleteTemplateConfirm"),disabled:e.builtIn,onConfirm:t=>{null==t||t.stopPropagation(),ew(e.id)},children:(0,o.jsx)(d.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(C.A,{}),disabled:e.builtIn,onClick:e=>e.stopPropagation()})},"delete")],children:(0,o.jsx)(m.A.Item.Meta,{avatar:(0,o.jsx)(k.A,{}),title:(0,o.jsxs)(y.A,{children:[(0,o.jsx)("span",{children:e.name}),e.builtIn&&(0,o.jsx)(g.A,{children:i("documents.builtIn")}),N===e.id&&(0,o.jsx)(g.A,{color:"blue",children:i("documents.selected")})]}),description:(0,o.jsxs)(y.A,{direction:"vertical",size:2,children:[(0,o.jsx)("span",{children:e.description}),(0,o.jsx)(g.A,{children:e.category})]})})})})}),(0,o.jsx)(l.A,{className:"mt-4",size:"small",title:i("documents.draftHistory"),children:(0,o.jsx)(m.A,{size:"small",dataSource:$.slice(0,8),locale:{emptyText:(0,o.jsx)(h.A,{description:i("common.noData")})},renderItem:e=>(0,o.jsx)(m.A.Item,{onClick:()=>{Z(e),Y(e.markdown),M(e.templateId)},className:"cursor-pointer",children:(0,o.jsx)(m.A.Item.Meta,{title:e.title,description:new Date(e.updatedAt).toLocaleString()})})})})]}),(0,o.jsx)(p.A,{xs:24,lg:16,children:(0,o.jsx)(l.A,{size:"small",title:i("documents.workflow"),children:(0,o.jsxs)(y.A,{direction:"vertical",className:"w-full",size:"middle",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"block mb-1",children:i("documents.template")}),(0,o.jsx)(x.A,{className:"w-full",value:N,onChange:M,options:E.map(e=>({label:e.name,value:e.id}))})]}),ep&&(0,o.jsxs)(l.A,{size:"small",type:"inner",title:ep.outputTitle,children:[(0,o.jsx)(H,{children:ep.description}),(0,o.jsxs)(y.A,{wrap:!0,children:[ep.projectRoleConfigId?(0,o.jsx)(g.A,{color:"geekblue",children:(null==(e=_.find(e=>e.id===ep.projectRoleConfigId))?void 0:e.name)||ep.projectRoleConfigId}):(0,o.jsx)(g.A,{color:"warning",children:i("documents.noRoleConfig")}),ep.documentSpecId?(0,o.jsx)(g.A,{color:"cyan",children:(null==(t=q.find(e=>e.id===ep.documentSpecId))?void 0:t.name)||ep.documentSpecId}):null]})]}),ep&&(0,o.jsx)(y.A,{direction:"vertical",size:4,children:(0,o.jsxs)("span",{children:[i("documents.projectRoleConfig"),": ",(null==(n=_.find(e=>e.id===ep.projectRoleConfigId))?void 0:n.name)||i("documents.noRoleConfig")]})}),(0,o.jsx)(d.Ay,{type:"primary",size:"large",block:!0,icon:(0,o.jsx)(I.A,{}),loading:W,disabled:!(null==ep?void 0:ep.projectRoleConfigId),onClick:()=>{ev()},children:i("documents.generate")}),ea.length>0&&(0,o.jsx)(l.A,{size:"small",type:"inner",title:i("documents.executionStatus"),children:(0,o.jsx)(j.A,{direction:"vertical",size:"small",current:ef,items:ea.map(e=>({title:e.title,description:e.description,status:e.status}))})})]})})})]}),(0,o.jsx)(l.A,{size:"small",title:i("documents.editor"),extra:(0,o.jsx)(y.A,{wrap:!0,children:Q&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(R,{}),onClick:()=>{eS()},children:i("documents.saveDraft")}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(z,{}),loading:et,onClick:()=>{eb("markdown")},children:i("documents.downloadMarkdown")}),(0,o.jsx)(d.Ay,{loading:et,onClick:()=>{eb("html")},children:i("documents.exportHtml")}),(0,o.jsx)(d.Ay,{loading:et,onClick:()=>{eb("docx")},children:i("documents.exportDocx")}),(0,o.jsx)(d.Ay,{type:"primary",loading:et,onClick:()=>{eb("pdf")},children:i("documents.exportPdf")})]})}),children:Q?(0,o.jsx)(A.A,{items:[{key:"edit",label:i("documents.edit"),children:(0,o.jsx)(J,{rows:26,value:K,onChange:e=>Y(e.target.value)})},{key:"chapters",label:i("documents.chapters"),children:(0,o.jsx)(m.A,{dataSource:Q.chapters,renderItem:e=>(0,o.jsx)(m.A.Item,{actions:[(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(D.A,{}),loading:eo===e.id,onClick:()=>{eC(e)},children:i("documents.regenerateChapter")},"regen")],children:(0,o.jsx)(m.A.Item.Meta,{title:e.title,description:(0,o.jsxs)(y.A,{direction:"vertical",children:[(0,o.jsxs)("span",{children:[i("documents.evidenceCount"),": ",e.evidence.length]}),(0,o.jsxs)("span",{children:[i("documents.missingCount"),": ",e.missingFacts.length]})]})})})})},{key:"facts",label:i("documents.structuredFacts"),children:(0,o.jsx)(m.A,{dataSource:Q.structuredFacts,renderItem:e=>{var t;return(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)(m.A.Item.Meta,{title:"".concat(e.key,": ").concat(e.value),description:"".concat(e.sourceFile," \xb7 ").concat((null==(t=V.find(t=>t.id===e.roleId))?void 0:t.name)||e.roleId)}),(0,o.jsx)(g.A,{children:e.confidence.toFixed(2)})]})}})},{key:"sources",label:i("documents.sources"),children:(0,o.jsx)(m.A,{dataSource:Q.sources,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)("span",{children:e.filePath}),(0,o.jsx)(g.A,{children:e.count})]})})},{key:"missing",label:i("documents.missingItems"),children:0===Q.missingItems.length?(0,o.jsx)(h.A,{description:i("common.noData")}):(0,o.jsx)(m.A,{dataSource:Q.missingItems,renderItem:e=>(0,o.jsx)(m.A.Item,{children:e})})},{key:"validation",label:i("documents.validation"),children:(0,o.jsx)(y.A,{direction:"vertical",className:"w-full",children:Q.validationIssues.map(e=>(0,o.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:i("documents.exportGate"),children:(0,o.jsx)(m.A,{dataSource:Q.exportGate.checklist,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)("span",{children:e.label}),(0,o.jsx)(g.A,{color:e.passed?"success":"error",children:e.passed?"PASS":"FAIL"})]})})},{key:"stages",label:i("documents.executionStages"),children:(0,o.jsx)(m.A,{dataSource:Q.executionStages,renderItem:e=>(0,o.jsxs)(m.A.Item,{children:[(0,o.jsx)(m.A.Item.Meta,{title:"".concat(e.type," \xb7 ").concat(e.roleId),description:e.message}),(0,o.jsx)(g.A,{color:"success"===e.status?"success":"failed"===e.status?"error":"warning",children:e.status})]})})}]}):(0,o.jsx)(h.A,{description:i("documents.noDraft")})}),(0,o.jsx)(w.A,{title:i("documents.templateEditor"),open:ec,onOk:()=>{ej()},onCancel:()=>ei(!1),width:760,centered:!0,okText:i("common.save"),children:(0,o.jsxs)(r.A,{form:O,layout:"vertical",requiredMark:"optional",children:[(0,o.jsxs)(u.A,{gutter:12,children:[(0,o.jsx)(p.A,{xs:24,md:8,children:(0,o.jsx)(r.A.Item,{name:"id",label:"ID",rules:[{required:!0}],children:(0,o.jsx)(c.A,{disabled:!0})})}),(0,o.jsx)(p.A,{xs:24,md:8,children:(0,o.jsx)(r.A.Item,{name:"name",label:i("documents.templateName"),rules:[{required:!0}],children:(0,o.jsx)(c.A,{})})}),(0,o.jsx)(p.A,{xs:24,md:8,children:(0,o.jsx)(r.A.Item,{name:"category",label:i("documents.templateCategory"),children:(0,o.jsx)(c.A,{})})}),(0,o.jsx)(p.A,{xs:24,md:12,children:(0,o.jsx)(r.A.Item,{name:"outputTitle",label:i("documents.outputTitle"),children:(0,o.jsx)(c.A,{})})}),(0,o.jsx)(p.A,{xs:24,md:12,children:(0,o.jsx)(r.A.Item,{name:"description",label:i("documents.templateDescription"),children:(0,o.jsx)(c.A,{})})})]}),(0,o.jsx)(r.A.Item,{name:"projectRoleConfigId",label:i("documents.projectRoleConfig"),rules:[{required:!0,message:i("documents.projectRoleConfigRequired")}],children:(0,o.jsx)(x.A,{showSearch:!0,placeholder:i("documents.projectRoleConfigRequired"),options:em})}),(0,o.jsx)(r.A.Item,{name:"documentSpecId",label:i("documents.documentSpec"),children:(0,o.jsx)(x.A,{allowClear:!0,showSearch:!0,placeholder:i("documents.documentSpecPlaceholder"),options:eh})})]})})]})}},2887:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"}},4995:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"}},6398:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 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:"download",theme:"outlined"}},6403:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return n(1699)}])},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 s(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function c(e){var t,n;let s=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&s.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&s.set("category",e.category),(null==e?void 0:e.page)&&s.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&s.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(s))}async function i(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function a(e,t){return o("/api/kb/files/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function r(e,t,n){return o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function l(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await l(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function u(e){return o("/api/kb/upload/progress?id=".concat(encodeURIComponent(e)))}async function p(e){let t=new URLSearchParams({limit:"50"});return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t))}async function m(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function f(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePaths:e,projectRoot:t})})}async function y(e){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0,projectRoot:e})})}async function g(e){return o("/api/kb/reindex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:e})})}async function x(){return o("/api/kb/features")}async function j(e,t){var n,s,c,i,a;let r=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&r.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&r.set("category",t.category),(null==t?void 0:t.limit)&&r.set("limit",String(null!=(a=t.limit)?a:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&r.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(s=t.weights)?void 0:s.vector)!=null&&r.set("vectorWeight",String(t.weights.vector)),(null==t||null==(c=t.weights)?void 0:c.rewrite)!=null&&r.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(i=t.weights)?void 0:i.hybridBonus)!=null&&r.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(r))}async function A(){return o("/api/prompt")}async function w(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 b(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function S(e){return o("/api/documents/roles?mode=config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e){return o("/api/documents/roles?mode=config&id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function k(){return o("/api/documents/specs")}async function I(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function T(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function O(){return o("/api/documents/templates")}async function E(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function R(e){return o("/api/documents/templates?templateId=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function P(e){return o("/api/documents/templates",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:e})})}async function N(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function z(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function D(){return o("/api/documents/drafts")}async function L(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function U(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 J(){return o("/api/config/providers")}async function H(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function M(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function V(){return o("/api/config/models")}async function F(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function _(){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 q(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function B(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function W(){return o("/api/system/stats")}async function X(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function Q(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function Z(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function K(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Y(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function $(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ee(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>L,Bh:()=>ee,Dl:()=>O,E:()=>K,EK:()=>I,ER:()=>T,FC:()=>W,FV:()=>b,H1:()=>g,H7:()=>m,HC:()=>a,HT:()=>c,II:()=>_,NR:()=>S,OX:()=>N,PH:()=>Z,QT:()=>u,Qx:()=>p,R1:()=>z,SJ:()=>f,UE:()=>U,VW:()=>x,W2:()=>j,X8:()=>y,Z3:()=>J,_m:()=>H,aP:()=>F,bV:()=>P,bZ:()=>B,c1:()=>d,dd:()=>G,dg:()=>v,dw:()=>C,dx:()=>A,h0:()=>R,h1:()=>M,hc:()=>s,hn:()=>X,l2:()=>E,lv:()=>w,mx:()=>k,p:()=>Q,q7:()=>D,tn:()=>r,u6:()=>q,xC:()=>i,xq:()=>h,xw:()=>Y,zo:()=>$,zr:()=>V})},6631:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var o=n(7109),s=n(2887),c=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(c.A,i({},e,{ref:t,icon:s.A})))},8847:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"}},9071:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var o=n(7109),s=n(8847),c=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(c.A,i({},e,{ref:t,icon:s.A})))},9811:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var o=n(7109),s=n(4995),c=n(8483);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let a=o.forwardRef((e,t)=>o.createElement(c.A,i({},e,{ref:t,icon:s.A})))}},e=>{e.O(0,[260,167,382,201,668,227,740,174,492,455,292,846,730,636,593,792],()=>e(e.s=6403)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46],{69:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5L255.8 713.6l-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l110.3 111.2c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.1 304.1 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112m161.2 465.2C726.2 620.3 668.9 644 608 644s-118.2-23.7-161.2-66.8C403.7 534.2 380 476.9 380 416s23.7-118.2 66.8-161.2c43-43.1 100.3-66.8 161.2-66.8s118.2 23.7 161.2 66.8c43.1 43 66.8 100.3 66.8 161.2s-23.7 118.2-66.8 161.2"}}]},name:"key",theme:"outlined"}},289:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"}},2256:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});let o=n(5341).A},2323:e=>{e.exports={cardMeta:"style_cardMeta__6KOa3",cardName:"style_cardName__WcLAf",cardAction:"style_cardAction__XUfPD",cardMain:"style_cardMain__qI1jU",providerCard:"style_providerCard__tLKGs",providerGrid:"style_providerGrid__Gx5GR",urlLine:"style_urlLine__DuMYs",tierDesc:"style_tierDesc__wOd6p",modelTags:"style_modelTags__nmMVj"}},3114:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var o=n(7109),a=n(5450),r=n(8483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let i=o.forwardRef((e,t)=>o.createElement(r.A,s({},e,{ref:t,icon:a.A})))},3214:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"}},4190:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var o=n(7109),a=n(3214),r=n(8483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let i=o.forwardRef((e,t)=>o.createElement(r.A,s({},e,{ref:t,icon:a.A})))},5450:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"}},6578:(e,t,n)=>{"use strict";async function o(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.text(),t=e||"HTTP ".concat(n.status);try{let n=JSON.parse(e);t=n.error||n.message||t}catch(e){}throw Error(t)}return n.json()}async function a(e){let t=e?"?projectRoot=".concat(encodeURIComponent(e)):"";return o("/api/kb/stats".concat(t))}async function r(e){var t,n;let a=new URLSearchParams;return(null==e?void 0:e.projectRoot)&&a.set("projectRoot",e.projectRoot),(null==e?void 0:e.category)&&a.set("category",e.category),(null==e?void 0:e.page)&&a.set("page",String(null!=(t=e.page)?t:1)),(null==e?void 0:e.limit)&&a.set("limit",String(null!=(n=e.limit)?n:50)),o("/api/kb/files?".concat(a))}async function s(e,t){let n=new URLSearchParams({relativePath:e});return t&&n.set("projectRoot",t),o("/api/kb/files/detail?".concat(n))}async function i(e,t){return o("/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 o("/api/kb/files/open",{method:"POST",body:JSON.stringify({relativePath:e,target:t,projectRoot:n})})}async function c(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>{let e=o.result,n=e.indexOf(",");t(n>=0?e.slice(n+1):e)},o.onerror=n,o.readAsDataURL(e)})}async function d(e,t,n){return o("/api/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:await Promise.all(e.map(async e=>({fileName:e.name,fileData:await c(e),relativePath:e.webkitRelativePath||void 0}))),projectRoot:t,uploadId:n})})}async function m(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 u(e){let t=new URLSearchParams;return e&&t.set("projectRoot",e),o("/api/kb/operations?".concat(t),{method:"DELETE"})}async function h(e,t){return o("/api/kb/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:e,projectRoot:t})})}async function y(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 v(){return o("/api/kb/features")}async function b(e,t){var n,a,r,s,i;let l=new URLSearchParams({q:e});return(null==t?void 0:t.projectRoot)&&l.set("projectRoot",t.projectRoot),(null==t?void 0:t.category)&&l.set("category",t.category),(null==t?void 0:t.limit)&&l.set("limit",String(null!=(i=t.limit)?i:20)),(null==t||null==(n=t.weights)?void 0:n.keyword)!=null&&l.set("keywordWeight",String(t.weights.keyword)),(null==t||null==(a=t.weights)?void 0:a.vector)!=null&&l.set("vectorWeight",String(t.weights.vector)),(null==t||null==(r=t.weights)?void 0:r.rewrite)!=null&&l.set("rewriteWeight",String(t.weights.rewrite)),(null==t||null==(s=t.weights)?void 0:s.hybridBonus)!=null&&l.set("hybridBonus",String(t.weights.hybridBonus)),o("/api/kb/search?".concat(l))}async function x(){return o("/api/prompt")}async function j(e){return o("/api/documents/roles".concat(e?"?type=".concat(e):""))}async function A(e){return o("/api/documents/roles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function C(e,t){return o("/api/documents/roles?type=".concat(e,"&id=").concat(encodeURIComponent(t)),{method:"DELETE"})}async function w(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 E(){return o("/api/documents/specs")}async function N(e){return o("/api/documents/specs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function O(e){return o("/api/documents/specs?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function T(){return o("/api/documents/templates")}async function P(e){return o("/api/documents/templates",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function I(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 R(e){return o("/api/documents/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function $(e){return o("/api/documents/chapter/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function z(){return o("/api/documents/drafts")}async function L(e,t){return o("/api/documents/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,id:t})})}async function _(e){let t=await fetch("/api/documents/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());return t.blob()}async function M(){return o("/api/config/providers")}async function U(e,t){return o("/api/config/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})})}async function H(e){return o("/api/config/providers/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function D(){return o("/api/config/models")}async function K(e){return o("/api/config/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J(){return o("/api/config/embedding")}async function B(e){return o("/api/config/embedding",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function V(){return o("/api/config/embedding/healthCheck",{method:"POST"})}async function F(e){return o("/api/config/healthCheck",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e})})}async function G(){return o("/api/system/stats")}async function W(e,t){let n=t?"?type=".concat(e,"&search=").concat(encodeURIComponent(t)):"?type=".concat(e);return o("/api/context".concat(n))}async function X(e){return o("/api/context?type=".concat(e,"&stats=1"))}async function Q(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"compress",type:e})})}async function q(e){return o("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear",type:e})})}async function Z(e){return o("/api/context?id=".concat(encodeURIComponent(e)),{method:"DELETE"})}async function Y(e,t){return o("/api/context",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})}async function ee(e){return o("/api/config/providers/".concat(encodeURIComponent(e)))}n.d(t,{Af:()=>L,Bh:()=>ee,Dl:()=>T,E:()=>q,EK:()=>N,ER:()=>O,FC:()=>G,FV:()=>C,H1:()=>g,H7:()=>u,HC:()=>i,HT:()=>r,II:()=>J,NR:()=>w,OX:()=>R,PH:()=>Q,QT:()=>m,Qx:()=>p,R1:()=>$,SJ:()=>y,UE:()=>_,VW:()=>v,W2:()=>b,X8:()=>f,Z3:()=>M,_m:()=>U,aP:()=>K,bV:()=>k,bZ:()=>F,c1:()=>d,dd:()=>B,dg:()=>A,dw:()=>S,dx:()=>x,h0:()=>I,h1:()=>H,hc:()=>a,hn:()=>W,l2:()=>P,lv:()=>j,mx:()=>E,p:()=>X,q7:()=>z,tn:()=>l,u6:()=>V,xC:()=>s,xq:()=>h,xw:()=>Z,zo:()=>Y,zr:()=>D})},7305:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return n(9526)}])},8770:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});let o=n(1916).A},8847:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"}},9071:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var o=n(7109),a=n(8847),r=n(8483);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let i=o.forwardRef((e,t)=>o.createElement(r.A,s({},e,{ref:t,icon:a.A})))},9526:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>el});var o=n(5321),a=n(7109),r=n(3014),s=n(7807),i=n(5114),l=n(8787),c=n(2256),d=n(8770),m=n(3442),p=n(6171),u=n(9188),h=n(4216),y=n(5042),f=n(7137),g=n(2188),v=n(7189),b=n(2644),x=n(3638),j=n(2162),A=n(6047),C=n(4567),w=n(5561),S=n(7961),E=n(540);let N=(e,t,n)=>({background:e,[`${n}-icon`]:{color:t}}),O=(0,E.OF)("Alert",e=>[(e=>{let{componentCls:t,motionDurationSlow:n,marginXS:o,marginSM:a,fontSize:r,fontSizeLG:s,lineHeight:i,borderRadiusLG:l,motionEaseInOutCirc:c,withDescriptionIconSize:d,colorText:m,colorTextHeading:p,withDescriptionPadding:u,defaultPadding:h,lineWidth:y,lineType:f,colorSuccessBorder:g,colorWarningBorder:v,colorErrorBorder:b,colorInfoBorder:x}=e;return{[t]:{...(0,S.dF)(e),position:"relative",display:"flex",alignItems:"center",padding:h,wordWrap:"break-word",borderRadius:l,borderWidth:(0,w.zA)(y),borderStyle:f,[`&${t}-success`]:{borderColor:g},[`&${t}-info`]:{borderColor:x},[`&${t}-warning`]:{borderColor:v},[`&${t}-error`]:{borderColor:b},[`&${t}-filled`]:{borderColor:"transparent"},[`&${t}-rtl`]:{direction:"rtl"},[`${t}-section`]:{flex:1,minWidth:0},[`${t}-icon`]:{marginInlineEnd:o,lineHeight:0},"&-description":{display:"none",fontSize:r,lineHeight:i},"&-title":{color:p},[`&${t}-motion-leave`]:{overflow:"hidden",opacity:1,transition:["max-height","opacity","padding-top","padding-bottom","margin-bottom"].map(e=>`${e} ${n} ${c}`).join(", ")},[`&${t}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0},[`&${t}-with-description`]:{alignItems:"flex-start",padding:u,[`${t}-icon`]:{marginInlineEnd:a,fontSize:d,lineHeight:0},[`${t}-title`]:{display:"block",marginBottom:o,color:p,fontSize:s},[`${t}-description`]:{display:"block",color:m}},[`&${t}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}}})(e),(e=>{let{componentCls:t,colorSuccess:n,colorSuccessBg:o,colorWarning:a,colorWarningBg:r,colorError:s,colorErrorBg:i,colorInfo:l,colorInfoBg:c}=e;return{[t]:{"&-success":N(o,n,t),"&-info":N(c,l,t),"&-warning":N(r,a,t),"&-error":{...N(i,s,t),[`${t}-description > pre`]:{margin:0,padding:0}}}}})(e),(e=>{let{componentCls:t,iconCls:n,motionDurationMid:o,marginXS:a,fontSizeIcon:r,colorIcon:s,colorIconHover:i}=e;return{[t]:{[`${t}-actions`]:{marginInlineStart:a},[`${t}-close-icon`]:{marginInlineStart:a,padding:0,overflow:"hidden",fontSize:r,lineHeight:(0,w.zA)(r),backgroundColor:"transparent",border:"none",cursor:"pointer",...(0,S.K8)(e),[`${n}-close`]:{color:s,transition:`color ${o}`,"&:hover":{color:i}}},"&-close-text":{color:s,transition:`color ${o}`,"&:hover":{color:i}}}}})(e)],e=>({withDescriptionIconSize:e.fontSizeHeading3,defaultPadding:`${e.paddingContentVerticalSM}px 12px`,withDescriptionPadding:`${e.paddingMD}px ${e.paddingContentHorizontalLG}px`})),T=e=>{let{icon:t,type:n,className:o,style:r,successIcon:s,infoIcon:i,warningIcon:l,errorIcon:c}=e,d={success:s??a.createElement(u.A,null),info:i??a.createElement(g.A,null),error:c??a.createElement(h.A,null),warning:l??a.createElement(f.A,null)};return a.createElement("span",{className:o,style:r},t??d[n])},P=e=>{let{isClosable:t,prefixCls:n,closeIcon:o,handleClose:r,ariaProps:s,className:i,style:l}=e,c=!0===o||void 0===o?a.createElement(y.A,null):o;return t?a.createElement("button",{type:"button",onClick:r,className:(0,x.$)(`${n}-close-icon`,i),tabIndex:0,style:l,...s},c):null},I=a.forwardRef((e,t)=>{let{description:n,prefixCls:o,message:r,title:s,banner:i,className:l,rootClassName:c,style:d,onMouseEnter:m,onMouseLeave:p,onClick:u,afterClose:h,showIcon:y,closable:f,closeText:g,closeIcon:w,action:S,id:E,styles:N,classNames:I,...k}=e,R=s??r,[$,z]=a.useState(!1),L=a.useRef(null);a.useImperativeHandle(t,()=>({nativeElement:L.current}));let{getPrefixCls:_,direction:M,variant:U,closable:H,closeIcon:D,className:K,style:J,classNames:B,styles:V,successIcon:F,infoIcon:G,warningIcon:W,errorIcon:X}=(0,C.TP)("alert"),Q=_("alert",o),[q,Z]=O(Q),{onClose:Y,afterClose:ee}=(0,A.Qd)(f)?f:{},et=t=>{z(!0),(Y??e.onClose)?.(t)},en=a.useMemo(()=>void 0!==e.type?e.type:i?"warning":"info",[e.type,i]),eo=e.variant??U??"outlined",ea=a.useMemo(()=>!!(0,A.Qd)(f)&&!!f.closeIcon||!!g||("boolean"==typeof f?f:!!(!1!==w&&(0,A.R)(w))||!!H),[g,w,f,H]),er=!!i&&void 0===y||y,es={...e,prefixCls:Q,variant:eo,type:en,showIcon:er,closable:ea},ei=(0,j.XT)(J),el=(0,j.XT)(d),[ec,ed]=(0,j.AV)([B,I],[V,ei,N,el],{props:es}),em=(0,x.$)(Q,`${Q}-${en}`,`${Q}-${eo}`,{[`${Q}-with-description`]:!!n,[`${Q}-no-icon`]:!er,[`${Q}-banner`]:!!i,[`${Q}-rtl`]:"rtl"===M},K,l,c,ec.root,Z,q),ep=(0,b.KE)(k,{aria:!0,data:!0}),eu=a.useMemo(()=>(0,A.Qd)(f)&&f.closeIcon?f.closeIcon:g||(void 0!==w?w:(0,A.Qd)(H)&&H.closeIcon?H.closeIcon:D),[w,f,H,g,D]),eh=a.useMemo(()=>{let e=f??H;return(0,A.Qd)(e)?(0,b.KE)(e,{data:!0,aria:!0}):{}},[f,H]);return a.createElement(v.Ay,{visible:!$,motionName:`${Q}-motion`,motionAppear:!1,motionEnter:!1,onLeaveStart:e=>({maxHeight:e.offsetHeight}),onLeaveEnd:ee??h},({className:t,style:o},r)=>a.createElement("div",{id:E,ref:(0,b.K4)(L,r),"data-show":!$,className:(0,x.$)(em,t),style:{...ed.root,...o},onMouseEnter:m,onMouseLeave:p,onClick:u,role:"alert",...ep},er?a.createElement(T,{className:(0,x.$)(`${Q}-icon`,ec.icon),style:ed.icon,description:n,icon:e.icon,prefixCls:Q,type:en,successIcon:F,infoIcon:G,warningIcon:W,errorIcon:X}):null,a.createElement("div",{className:(0,x.$)(`${Q}-section`,ec.section),style:ed.section},R?a.createElement("div",{className:(0,x.$)(`${Q}-title`,ec.title),style:ed.title},R):null,n?a.createElement("div",{className:(0,x.$)(`${Q}-description`,ec.description),style:ed.description},n):null),S?a.createElement("div",{className:(0,x.$)(`${Q}-actions`,ec.actions),style:ed.actions},S):null,a.createElement(P,{className:ec.close,style:ed.close,isClosable:ea,prefixCls:Q,closeIcon:eu,handleClose:et,ariaProps:eh})))});var k=n(1113),R=n(9939),$=n(218),z=n(3076),L=n(3784),_=n(5472);let M=function(e){function t(){var e,n,o;return(0,k.A)(this,t),n=t,o=arguments,n=(0,$.A)(n),(e=(0,L.A)(this,(0,z.A)()?Reflect.construct(n,o||[],(0,$.A)(this).constructor):n.apply(this,o))).state={error:void 0,info:{}},e}return(0,_.A)(t,e),(0,R.A)(t,[{key:"componentDidCatch",value:function(e,t){this.setState({error:e,info:t})}},{key:"render",value:function(){let{message:e,title:t,description:n,id:o,children:r}=this.props,{error:s,info:i}=this.state,l=t??e,c=i?.componentStack||null,d=(0,A.R)(l)?l:s?.toString(),m=(0,A.R)(n)?n:c;return s?a.createElement(I,{id:o,type:"error",title:d,description:a.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},m)}):r}}])}(a.PureComponent);I.ErrorBoundary=M;var U=n(3455),H=n(7271),D=n(4668),K=n(4992),J=n(1702),B=n(5258),V=n(4746),F=n(9071),G=n(3114),W=n(9650),X=n(8209),Q=n(69),q=n(8483);function Z(){return(Z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let Y=a.forwardRef((e,t)=>a.createElement(q.A,Z({},e,{ref:t,icon:Q.A})));var ee=n(289);function et(){return(et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let en=a.forwardRef((e,t)=>a.createElement(q.A,et({},e,{ref:t,icon:ee.A})));var eo=n(6578),ea=n(2323),er=n.n(ea);let es=[{label:"OpenAI 兼容",value:"openai"},{label:"Anthropic",value:"anthropic"},{label:"Google",value:"google"},{label:"Ollama",value:"ollama"},{label:"OpenRouter",value:"openrouter"}],ei=[{key:"reader",labelKey:"models.tierReader",descKey:"models.tierReaderDesc"},{key:"reasoning",labelKey:"models.tierReasoning",descKey:"models.tierReasoningDesc"},{key:"action",labelKey:"models.tierAction",descKey:"models.tierActionDesc"}];function el(){let e=(0,r.Vr)(),{message:t}=s.A.useApp(),n=[{label:e("models.embeddingProviderHash"),value:"hash"},{label:e("models.embeddingProviderOpenAI"),value:"openai-compatible"}],[y,f]=(0,a.useState)(!0),[g,v]=(0,a.useState)([]),[b,x]=(0,a.useState)(null),[j,A]=(0,a.useState)({provider:"hash",dimensions:384}),[C,w]=(0,a.useState)(!1),[S,E]=(0,a.useState)(!1),[N,O]=(0,a.useState)(null),[T,P]=(0,a.useState)(!1),[k,R]=(0,a.useState)(""),[$,z]=(0,a.useState)(""),[L,_]=(0,a.useState)(""),[M,Q]=(0,a.useState)("openai"),[q,Z]=(0,a.useState)(!1),[ee,et]=(0,a.useState)(!1),[ea,el]=(0,a.useState)(""),[ec,ed]=(0,a.useState)(""),[em,ep]=(0,a.useState)(""),[eu,eh]=(0,a.useState)(""),[ey,ef]=(0,a.useState)("openai"),[eg,ev]=(0,a.useState)(!1),[eb,ex]=(0,a.useState)(null),[ej,eA]=(0,a.useState)({}),eC=async()=>{f(!0);try{let[e,t,n]=await Promise.all([(0,eo.Z3)().catch(()=>[]),(0,eo.zr)().catch(()=>null),(0,eo.II)().catch(()=>({provider:"hash",dimensions:384}))]);v(e),x(t),A(n)}catch(n){t.error(e("common.error"))}finally{f(!1)}};(0,a.useEffect)(()=>{eC()},[]);let ew=async()=>{if(k.trim()){Z(!0);try{await (0,eo._m)(k.trim(),{apiKey:$||void 0,baseUrl:L||void 0,protocol:M}),P(!1),R(""),z(""),_(""),Q("openai"),await eC(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{Z(!1)}}},eS=async n=>{try{await (0,eo.h1)(n),await eC(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}},eE=async e=>{el(e.name),ed(e.name),ep("");try{let t=await (0,eo.Bh)(e.name);ep(t.apiKey?"••••••••":""),eh(t.baseUrl||""),ef(t.protocol||t.detectedProtocol||"openai")}catch(t){eh(e.baseUrl||""),ef(e.protocol||e.detectedProtocol||"openai")}et(!0)},eN=async()=>{if(ec.trim()){ev(!0);try{let n=em.includes("•")?void 0:em||void 0;await (0,eo._m)(ec.trim(),{oldName:ea,apiKey:n,baseUrl:eu||void 0,protocol:ey}),et(!1),el(""),ed(""),ep(""),eh(""),ef("openai"),await eC(),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{ev(!1)}}},eO=async n=>{ex(n);try{let o=await (0,eo.bZ)(n);eA(e=>({...e,[n]:o.success})),t[o.success?"success":"error"](o.success?e("models.connected"):e("models.connectionFailed"))}catch(e){eA(e=>({...e,[n]:!1}))}finally{ex(null)}},eT=async()=>{w(!0);try{let n=await (0,eo.dd)(j);A(n),O(null),t.success(e("common.success"))}catch(n){t.error(e("common.error"))}finally{w(!1)}},eP=async()=>{E(!0);try{let n=await (0,eo.u6)();O(n.success),t[n.success?"success":"error"](n.message||(n.success?e("models.connected"):e("models.connectionFailed")))}catch(n){O(!1),t.error(e("common.error"))}finally{E(!1)}},eI=async(n,o)=>{if(!b)return;let a={...b},r=a[n];if(!o){r.active="",x(a);try{await (0,eo.aP)(a)}catch(n){t.error(e("common.error"))}return}let s=o.indexOf(":"),i=s>=0?o.slice(0,s):o,l=s>=0?o.slice(s+1):o;r.active=l,r.list.some(e=>e.name===l&&e.provider===i)||r.list.push({name:l,provider:i}),x(a);try{await (0,eo.aP)(a)}catch(n){t.error(e("common.error"))}};return(0,o.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("models.title")}),(0,o.jsx)("p",{className:"pageDesc",children:e("models.description")})]}),(0,o.jsx)(i.Ay,{type:"primary",icon:(0,o.jsx)(V.A,{}),onClick:()=>P(!0),children:e("models.addModel")})]}),(0,o.jsx)(l.A,{title:e("models.modelList"),size:"small",loading:y,children:0===g.length?(0,o.jsx)("span",{className:er().cardMeta,children:e("models.noProviders")}):(0,o.jsx)(c.A,{gutter:[12,12],align:"stretch",children:g.map(t=>(0,o.jsx)(d.A,{xs:24,sm:12,lg:8,xl:6,className:er().providerGrid,children:(0,o.jsxs)(l.A,{size:"small",className:er().providerCard,children:[(0,o.jsxs)("div",{className:er().cardAction,children:[(0,o.jsxs)("div",{className:er().cardMain,children:[(0,o.jsx)("div",{className:er().cardName,title:t.name,children:t.name}),(0,o.jsxs)("div",{className:er().cardMeta,children:[(0,o.jsx)(F.A,{})," ",t.protocol||t.detectedProtocol||"openai"]})]}),(0,o.jsxs)(m.A,{size:2,wrap:!1,children:[(0,o.jsx)(i.Ay,{size:"small",type:"text",loading:eb===t.name,onClick:()=>{eO(t.name)},icon:!0===ej[t.name]?(0,o.jsx)(u.A,{className:"text-[var(--colorOk)]"}):!1===ej[t.name]?(0,o.jsx)(h.A,{className:"text-[var(--colorDanger)]"}):(0,o.jsx)(G.A,{})}),(0,o.jsx)(i.Ay,{size:"small",type:"text",icon:(0,o.jsx)(W.A,{}),onClick:()=>{eE(t)}}),(0,o.jsx)(p.A,{title:e("models.deleteProviderConfirm"),onConfirm:()=>{eS(t.name)},children:(0,o.jsx)(i.Ay,{size:"small",type:"text",danger:!0,icon:(0,o.jsx)(X.A,{})})})]})]}),(0,o.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,o.jsxs)("span",{className:"".concat(er().cardMeta," text-xs"),children:[(0,o.jsx)(Y,{})," ",t.hasApiKey?"••••••••":"—"]}),t.baseUrl&&(0,o.jsxs)("span",{className:"".concat(er().cardMeta," ").concat(er().urlLine," text-xs"),title:t.baseUrl,children:[(0,o.jsx)(en,{})," ",t.baseUrl]})]})]})},t.name))})}),(0,o.jsxs)(l.A,{title:e("models.embeddingConfig"),size:"small",loading:y,children:[(0,o.jsx)(I,{className:"mb-4",type:"info",showIcon:!0,message:e("models.embeddingHint")}),(0,o.jsxs)(U.A,{layout:"vertical",size:"middle",children:[(0,o.jsxs)(c.A,{gutter:[12,12],children:[(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(U.A.Item,{label:e("models.embeddingProvider"),children:(0,o.jsx)(H.A,{value:j.provider,options:n,onChange:e=>A(t=>({...t,provider:e,dimensions:"hash"===e?384:t.dimensions||1024}))})})}),"openai-compatible"===j.provider&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(U.A.Item,{label:"Base URL",children:(0,o.jsx)(D.A,{value:j.baseUrl,onChange:e=>A(t=>({...t,baseUrl:e.target.value})),placeholder:"http://localhost:11434/v1"})})}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(U.A.Item,{label:e("models.model"),children:(0,o.jsx)(D.A,{value:j.model,onChange:e=>A(t=>({...t,model:e.target.value})),placeholder:"bge-m3"})})}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(U.A.Item,{label:e("models.apiKey"),help:j.hasApiKey?e("models.embeddingApiKeyHint"):void 0,children:(0,o.jsx)(D.A.Password,{value:j.apiKey,onFocus:()=>{var e;(null==(e=j.apiKey)?void 0:e.includes("•"))&&A(e=>({...e,apiKey:""}))},onChange:e=>A(t=>({...t,apiKey:e.target.value})),placeholder:e("models.optional")})})})]}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(U.A.Item,{label:e("models.dimensions"),children:(0,o.jsx)(K.A,{className:"w-full",min:1,value:j.dimensions,onChange:e=>A(t=>({...t,dimensions:Number(e||("hash"===t.provider?384:1024))}))})})}),(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsx)(U.A.Item,{label:e("models.status"),children:(0,o.jsxs)(m.A,{children:[(0,o.jsx)(J.A,{color:"hash"===j.provider?"default":"blue",children:"hash"===j.provider?e("models.localHash"):e("models.openAICompatible")}),!0===N&&(0,o.jsx)(J.A,{color:"success",children:e("models.connected")}),!1===N&&(0,o.jsx)(J.A,{color:"error",children:e("models.connectionFailed")})]})})})]}),(0,o.jsxs)(m.A,{children:[(0,o.jsx)(i.Ay,{type:"primary",loading:C,onClick:()=>{eT()},children:e("models.saveEmbedding")}),(0,o.jsx)(i.Ay,{icon:(0,o.jsx)(G.A,{}),loading:S,onClick:()=>{eP()},children:e("models.testEmbedding")})]})]})]}),b&&(0,o.jsx)(l.A,{title:e("models.modelTiers"),size:"small",children:(0,o.jsx)(c.A,{gutter:[12,12],children:ei.map(n=>{var a;let{key:r,labelKey:s,descKey:i}=n,c=b[r],m=c.list.map(e=>({label:"".concat(e.provider," / ").concat(e.name),value:"".concat(e.provider,":").concat(e.name)})),p=g.filter(e=>!c.list.some(t=>t.provider===e.name)).map(e=>({label:"".concat(e.name," / ").concat(e.name),value:"".concat(e.name,":").concat(e.name)}));return(0,o.jsx)(d.A,{xs:24,lg:8,children:(0,o.jsxs)(l.A,{size:"small",title:e(s),children:[(0,o.jsx)("span",{className:er().tierDesc,children:e(i)}),(0,o.jsx)(H.A,{value:c.active?"".concat((null==(a=c.list.find(e=>e.name===c.active))?void 0:a.provider)||"",":").concat(c.active):void 0,onChange:e=>{eI(r,e)},allowClear:!0,placeholder:e("models.selectModelPlaceholder"),className:"w-full",options:[...m,...p]}),c.list.length>0&&(0,o.jsx)("div",{className:er().modelTags,children:c.list.map(n=>(0,o.jsxs)(J.A,{color:n.name===c.active?"blue":void 0,closable:!0,onClose:()=>{var o,a;let s={...b},i=s[r];i.list=i.list.filter(e=>e.name!==n.name||e.provider!==n.provider),i.active===n.name&&(i.active=null!=(a=null==(o=i.list[0])?void 0:o.name)?a:""),x(s),(0,eo.aP)(s).catch(()=>t.error(e("common.error")))},children:[n.provider,"/",n.name]},"".concat(n.provider,":").concat(n.name)))})]})},r)})})}),(0,o.jsx)(B.A,{title:e("models.addModel"),open:T,onCancel:()=>{P(!1),R(""),z(""),_(""),Q("openai")},onOk:()=>{ew()},confirmLoading:q,children:(0,o.jsxs)(U.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(U.A.Item,{label:e("models.modelName"),children:(0,o.jsx)(D.A,{value:k,onChange:e=>R(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,o.jsx)(U.A.Item,{label:e("models.apiKey"),children:(0,o.jsx)(D.A.Password,{value:$,onChange:e=>z(e.target.value),placeholder:"sk-..."})}),(0,o.jsx)(U.A.Item,{label:e("models.baseUrl"),children:(0,o.jsx)(D.A,{value:L,onChange:e=>_(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,o.jsx)(U.A.Item,{label:e("models.protocol"),children:(0,o.jsx)(H.A,{value:M,onChange:Q,options:es})})]})}),(0,o.jsx)(B.A,{title:e("models.editModel"),open:ee,onCancel:()=>{et(!1),el(""),ed(""),ep(""),eh(""),ef("openai")},onOk:()=>{eN()},confirmLoading:eg,children:(0,o.jsxs)(U.A,{layout:"vertical",size:"middle",children:[(0,o.jsx)(U.A.Item,{label:e("models.modelName"),children:(0,o.jsx)(D.A,{value:ec,onChange:e=>ed(e.target.value),placeholder:e("models.modelNamePlaceholder")})}),(0,o.jsx)(U.A.Item,{label:e("models.apiKey"),help:e("models.apiKeyEditHint"),children:(0,o.jsx)(D.A.Password,{value:em,onFocus:()=>{em.includes("•")&&ep("")},onCopy:e=>e.preventDefault(),onChange:e=>ep(e.target.value),placeholder:e("models.apiKeyEditPlaceholder")})}),(0,o.jsx)(U.A.Item,{label:e("models.baseUrl"),children:(0,o.jsx)(D.A,{value:eu,onChange:e=>eh(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,o.jsx)(U.A.Item,{label:e("models.protocol"),children:(0,o.jsx)(H.A,{value:ey,onChange:ef,options:es})})]})})]})}}},e=>{e.O(0,[260,167,382,201,668,740,492,455,992,636,593,792],()=>e(e.s=7305)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,e,c,t,a,n,d,i,u,o,k,f,r,h,b,g,l,j,m,p,_,w,I,x){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:m,bitArray:[]},__routerFilterDynamic:{numItems:r,errorRate:1e-4,numBits:r,numHashes:m,bitArray:[]},"/":["static/chunks/pages/index-505bd438c95ec0e8.js"],"/_error":["static/chunks/pages/_error-18decb9cd478883d.js"],"/context/long-term":[s,e,c,t,a,n,d,i,u,o,k,f,p,"static/chunks/pages/context/long-term-710aaeb12e378258.js"],"/context/short-term":[s,e,c,t,a,n,d,i,u,o,k,f,p,"static/chunks/pages/context/short-term-e68f01478e7ed238.js"],"/document-roles":[s,e,c,t,a,n,d,i,u,o,b,"static/chunks/pages/document-roles-caee7af42da4f792.js"],"/document-specs":[s,e,c,t,a,n,d,i,u,o,g,b,"static/chunks/pages/document-specs-7085069b6dcdaee6.js"],"/documents":[s,e,c,t,a,n,d,i,u,o,h,b,_,"static/chunks/pages/documents-b78988e17525927f.js"],"/guide":[s,e,c,h,_,"static/chunks/804-e654a1589d9adc65.js","static/chunks/pages/guide-b495954d18d56b33.js"],"/knowledge":["static/chunks/pages/knowledge-81fd1e907a6fcb84.js"],"/knowledge/file-detail":[s,e,c,t,a,n,d,i,k,f,h,w,"static/chunks/517-f43787133528ba48.js",l,"static/chunks/pages/knowledge/file-detail-793d12234ccddac1.js"],"/knowledge/files":[s,e,c,t,a,n,d,i,k,f,I,l,"static/chunks/pages/knowledge/files-a3a4bbc49c980b46.js"],"/knowledge/manage":[s,e,c,t,n,d,i,k,f,x,"static/chunks/891-b6a172e1df7ab8c1.js","static/chunks/pages/knowledge/manage-64ad6cdce068edb1.js"],"/knowledge/search":[s,e,c,t,a,n,h,g,w,l,"static/chunks/pages/knowledge/search-fe148477dfe05966.js"],"/models":[s,e,c,t,a,d,u,o,g,"static/css/0e153583d22cc52e.css","static/chunks/pages/models-6131bc7596604158.js"],"/overview":[s,e,n,I,x,"static/chunks/851-1190cb42a0630eef.js","static/chunks/pages/overview-db5df4f0bec2a77c.js"],"/prompt":[s,e,c,t,a,u,k,"static/chunks/pages/prompt-654d82321a383233.js"],"/settings":[s,"static/css/82b6ddff0ef364fe.css","static/chunks/pages/settings-88f50b9cafc389e0.js"],sortedPages:["/","/_app","/_error","/context/long-term","/context/short-term","/document-roles","/document-specs","/documents","/guide","/knowledge","/knowledge/file-detail","/knowledge/files","/knowledge/manage","/knowledge/search","/models","/overview","/prompt","/settings"]}}("static/chunks/260-7a7a65a3ca8539ba.js","static/chunks/167-9f45623d7ea7ab43.js","static/chunks/382-dd7535429e16931b.js","static/chunks/201-b16b4788042ed1aa.js","static/chunks/668-662b7bc81e4ad48f.js","static/chunks/227-442963c7b630eade.js","static/chunks/740-2bcba39d841f2b16.js","static/chunks/174-e7df14600b457a5c.js","static/chunks/492-62671486700ed3f9.js","static/chunks/455-e31becaaf948f868.js","static/chunks/446-0591221372df7d49.js","static/chunks/400-f06f00619f22421e.js",0,"static/chunks/292-c2888a94068fae74.js","static/chunks/846-fed995f7c83fc6c3.js","static/chunks/992-ea93dfa182a02a8e.js","static/css/d284a7454d6f6b06.css",1e-4,NaN,"static/chunks/257-ba16dfe16a27f417.js","static/chunks/730-727fe4b055c78dc2.js","static/chunks/969-8843874536e7fd83.js","static/chunks/15-289cb38b53bafa4a.js","static/chunks/958-66e2dcf301fb3c3f.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
|
File without changes
|