@bigduu/lotus 2026.7.3 → 2026.7.4
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/dist/assets/{App-DW-ByUgm.js → App-4fU-kHUd.js} +9 -9
- package/dist/assets/{MetricsService-D63Zza5C.js → MetricsService-BpNiyy6I.js} +1 -1
- package/dist/assets/{SubAgentsPanel-CZhnNgxT.js → SubAgentsPanel-CsxecJ9n.js} +1 -1
- package/dist/assets/{architectureDiagram-3BPJPVTR-C7XWwQAi.js → architectureDiagram-3BPJPVTR-BAU4oCet.js} +1 -1
- package/dist/assets/{blockDiagram-GPEHLZMM-CCOktwea.js → blockDiagram-GPEHLZMM-lLSzShbw.js} +1 -1
- package/dist/assets/{c4Diagram-AAUBKEIU-BVaEsKBH.js → c4Diagram-AAUBKEIU-avrokizu.js} +1 -1
- package/dist/assets/{chunk-2J33WTMH-DmzuAQat.js → chunk-2J33WTMH-CKbpaWng.js} +1 -1
- package/dist/assets/{chunk-4BX2VUAB-B0okCNMB.js → chunk-4BX2VUAB-iiSyzKa3.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-BwCx18JN.js → chunk-55IACEB6-Cvj69ITN.js} +1 -1
- package/dist/assets/{chunk-727SXJPM-DxthRDyj.js → chunk-727SXJPM-pSz5mJJv.js} +1 -1
- package/dist/assets/{chunk-AQP2D5EJ-ulOelrW9.js → chunk-AQP2D5EJ-c3hDsSQl.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-DeFG1oAT.js → chunk-FMBD7UC4-7V8N-Bvj.js} +1 -1
- package/dist/assets/{chunk-ND2GUHAM-KPRpmJC0.js → chunk-ND2GUHAM-DkBtLwC-.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-W4deE-xA.js → chunk-QZHKN3VN-MauNKCSB.js} +1 -1
- package/dist/assets/classDiagram-4FO5ZUOK-BkD0Yrlq.js +1 -0
- package/dist/assets/classDiagram-v2-Q7XG4LA2-BkD0Yrlq.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-_L8q3uFE.js → cose-bilkent-S5V4N54A-BJR0PzLI.js} +1 -1
- package/dist/assets/{dagre-BM42HDAG-DHDKzg0D.js → dagre-BM42HDAG-B0bXBef5.js} +1 -1
- package/dist/assets/{diagram-2AECGRRQ-CFLinFQ_.js → diagram-2AECGRRQ-rlD89-xl.js} +1 -1
- package/dist/assets/{diagram-5GNKFQAL-UiVEYnOq.js → diagram-5GNKFQAL-DLiI0D2Q.js} +1 -1
- package/dist/assets/{diagram-KO2AKTUF-CFTryxU8.js → diagram-KO2AKTUF-BzuBVQbz.js} +1 -1
- package/dist/assets/{diagram-LMA3HP47-C45YYy3d.js → diagram-LMA3HP47-C8MUjUqp.js} +1 -1
- package/dist/assets/{diagram-OG6HWLK6-C799mxQp.js → diagram-OG6HWLK6-CcZkvWxs.js} +1 -1
- package/dist/assets/{erDiagram-TEJ5UH35-YBuz6GtD.js → erDiagram-TEJ5UH35-D64d2VfK.js} +1 -1
- package/dist/assets/{flowDiagram-I6XJVG4X-D55Gci30.js → flowDiagram-I6XJVG4X-1EOZ_GAk.js} +1 -1
- package/dist/assets/{ganttDiagram-6RSMTGT7-Dwm5bIOz.js → ganttDiagram-6RSMTGT7-WRtjuLX1.js} +1 -1
- package/dist/assets/{gitGraphDiagram-PVQCEYII-DR_pWvxr.js → gitGraphDiagram-PVQCEYII-098wvAID.js} +1 -1
- package/dist/assets/{index-CbSNa33p.js → index-BFpSJbZi.js} +1 -1
- package/dist/assets/{index-B6C5m_oW.js → index-BFqFK9mW.js} +1 -1
- package/dist/assets/{index-w7kwGoFa.js → index-BcnWQfG3.js} +1 -1
- package/dist/assets/{index-VxcoHsXN.js → index-CBf_aPf0.js} +1 -1
- package/dist/assets/{index-RP5yv5vn.js → index-Cb7zjxC0.js} +1 -1
- package/dist/assets/{index-B-UPfrxI.js → index-Ckib79dI.js} +1 -1
- package/dist/assets/{index-s-bcD8Bc.js → index-CvBP85Fd.js} +1 -1
- package/dist/assets/{index-u_FbBkME.js → index-D6AvLrCJ.js} +1 -1
- package/dist/assets/{index-Cr2r2Wjw.js → index-DEp5u-uT.js} +3 -3
- package/dist/assets/{index-BcBBegvu.js → index-Dnp1t4CF.js} +1 -1
- package/dist/assets/{index-cQC5yRX7.js → index-DqbS0IEX.js} +1 -1
- package/dist/assets/{index-C4TnWGEn.js → index-DyrMGCWu.js} +1 -1
- package/dist/assets/{infoDiagram-5YYISTIA-CX1i-3TC.js → infoDiagram-5YYISTIA-B1abEuB0.js} +1 -1
- package/dist/assets/{ishikawaDiagram-YF4QCWOH--8eJ5UdF.js → ishikawaDiagram-YF4QCWOH-DYLMJ5LJ.js} +1 -1
- package/dist/assets/{journeyDiagram-JHISSGLW-BknaY-wl.js → journeyDiagram-JHISSGLW-DxQWxIBX.js} +1 -1
- package/dist/assets/{kanban-definition-UN3LZRKU-BcENBmGc.js → kanban-definition-UN3LZRKU-DBHyhIEZ.js} +1 -1
- package/dist/assets/{main-B_YKxH3I.js → main-CKaJQsPs.js} +3 -3
- package/dist/assets/{mindmap-definition-RKZ34NQL-DeA9c1-m.js → mindmap-definition-RKZ34NQL-DInH84fZ.js} +1 -1
- package/dist/assets/{pieDiagram-4H26LBE5-CzFWAIEb.js → pieDiagram-4H26LBE5-B92pWeJj.js} +1 -1
- package/dist/assets/{quadrantDiagram-W4KKPZXB-CA2aBjUh.js → quadrantDiagram-W4KKPZXB-DorNY_YU.js} +1 -1
- package/dist/assets/{requirementDiagram-4Y6WPE33-DNnU6EHI.js → requirementDiagram-4Y6WPE33-Bo_KiBEw.js} +1 -1
- package/dist/assets/{sankeyDiagram-5OEKKPKP-KsvuP8ha.js → sankeyDiagram-5OEKKPKP-C5oR4AWB.js} +1 -1
- package/dist/assets/{sequenceDiagram-3UESZ5HK-BoVZeFo8.js → sequenceDiagram-3UESZ5HK-C5smmjyb.js} +1 -1
- package/dist/assets/{stateDiagram-AJRCARHV-D_2cnNS0.js → stateDiagram-AJRCARHV-DzTexjGt.js} +1 -1
- package/dist/assets/{stateDiagram-v2-BHNVJYJU-CUzENX_-.js → stateDiagram-v2-BHNVJYJU-jb4mAJYK.js} +1 -1
- package/dist/assets/{timeline-definition-PNZ67QCA-4Ujz3UGH.js → timeline-definition-PNZ67QCA-Bj5sbbYL.js} +1 -1
- package/dist/assets/{vendor-charts-BlZASaPu.js → vendor-charts-Dn52GOJg.js} +1 -1
- package/dist/assets/{vendor-mermaid-B3Eo7MWs.js → vendor-mermaid-ClcSc_uI.js} +3 -3
- package/dist/assets/{vendor-pdf--2VPMcLQ.js → vendor-pdf-D_TR_Yp2.js} +3 -3
- package/dist/assets/{vennDiagram-CIIHVFJN-DHqJ8wc5.js → vennDiagram-CIIHVFJN-B5VJyCbS.js} +1 -1
- package/dist/assets/{wardley-L42UT6IY-CIhyN8lQ.js → wardley-L42UT6IY-DFcnndz8.js} +1 -1
- package/dist/assets/{wardleyDiagram-YWT4CUSO-D1VTByQK.js → wardleyDiagram-YWT4CUSO-CUQwRPeI.js} +1 -1
- package/dist/assets/{xychartDiagram-2RQKCTM6-B3_7zDqk.js → xychartDiagram-2RQKCTM6-CB4y3uep.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/classDiagram-4FO5ZUOK-Mc3AJwNM.js +0 -1
- package/dist/assets/classDiagram-v2-Q7XG4LA2-Mc3AJwNM.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var te=Object.defineProperty;var se=(i,t,s)=>t in i?te(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s;var D=(i,t,s)=>se(i,typeof t!="symbol"?t+"":t,s);import{j as e}from"./vendor-markdown-CARODNj-.js";import{u as C,a as o,i as J}from"./vendor-i18n-Dm-c3D_C.js";import{S as L,H as ae}from"./App-DW-ByUgm.js";import{A as O,t as Y,j as V,a8 as N,o as k,B as T,aB as Z,aC as re,q as ie,aD as Q,U as ne,a3 as q,a0 as B,J as W,a1 as E,Q as M,aE as K,aF as ce,z as oe,V as le,I as $,a9 as de,aG as he}from"./vendor-antd-C-pjKgeW.js";import"./main-B_YKxH3I.js";import"./vendor-mermaid-B3Eo7MWs.js";const pe=({visible:i,onClose:t,onSelect:s})=>{const{t:c}=C(),{message:r}=O.useApp(),{token:a}=Y.useToken(),{Text:n}=V,[u,j]=o.useState(!1),[l,m]=o.useState(""),[g,I]=o.useState(),[b,w]=o.useState([]),[v,f]=o.useState([]);o.useEffect(()=>{i&&y()},[i]);const y=async d=>{j(!0);try{const p=await L.browseFolder(d);m(p.current_path),I(p.parent_path),w(p.folders)}catch(p){console.error(c("chat.folderBrowser.readFolderError"),p),r.error(c("chat.folderBrowser.readFolderError"))}finally{j(!1)}},x=d=>{f([...v,l]),y(d.path)},F=()=>{g&&(f(v.slice(0,-1)),y(g))},R=()=>{f([]),y()},P=()=>{s(l),t()},S=()=>{if(!l)return[];const d=l.split(/[/\\]/).filter(Boolean);return l.startsWith("/")&&d.unshift("/"),d},_=d=>{const A=S().slice(0,d+1).join("/"),H=(l.startsWith("/"),A);y(H)};return e.jsx(N,{title:c("chat.folderBrowser.title"),open:i,onCancel:t,width:700,footer:null,children:e.jsxs(k,{direction:"vertical",size:"middle",style:{width:"100%"},children:[e.jsxs(k,{children:[e.jsx(T,{icon:e.jsx(Z,{}),onClick:R,size:"small",children:c("common.home")}),e.jsx(T,{icon:e.jsx(re,{}),onClick:F,disabled:!g,size:"small",children:c("common.parentDirectory")}),e.jsx(T,{type:"primary",icon:e.jsx(ie,{}),onClick:P,size:"small",children:c("chat.folderBrowser.selectCurrent")})]}),e.jsx(Q,{children:S().map((d,p)=>e.jsx(Q.Item,{children:e.jsx(T,{type:"link",size:"small",onClick:()=>_(p),style:{padding:0},children:d==="/"?e.jsx(Z,{}):d})},S().slice(0,p+1).join("/")))}),e.jsxs(ne,{size:"small",styles:{body:{padding:a.paddingXS}},children:[e.jsx(n,{type:"secondary",style:{fontSize:12},children:c("common.currentPath")})," ",e.jsx(n,{code:!0,children:l})]}),e.jsx(q,{spinning:u,children:b.length===0&&!u?e.jsx(B,{image:B.PRESENTED_IMAGE_SIMPLE,description:e.jsx(n,{type:"secondary",children:c("chat.folderBrowser.emptyFolder")})}):e.jsx(W,{dataSource:b,style:{maxHeight:400,overflowY:"auto"},renderItem:d=>e.jsx(W.Item,{style:{padding:0},children:e.jsx(T,{type:"text",icon:e.jsx(E,{}),onClick:()=>x(d),style:{width:"100%",textAlign:"left",padding:`${a.paddingXS}px ${a.paddingSM}px`},children:d.name})})})}),e.jsx(n,{type:"secondary",style:{fontSize:12},children:c("chat.folderBrowser.tip")})]})})};class ue{constructor(t={}){D(this,"cache",new Map);D(this,"pendingValidations",new Map);D(this,"options");this.options={debounceMs:t.debounceMs??300,cacheTimeoutMs:t.cacheTimeoutMs??5*60*1e3,maxRetries:t.maxRetries??3}}async validateWorkspace(t){if(!t||t.trim().length===0)return{path:"",is_valid:!1,error_message:J.t("chat.workspace.errorEnterPath")};const s=t.trim(),c=this.getCachedResult(s);if(c)return c;const r=this.pendingValidations.get(s);if(r)return r;const a=this.performValidation(s);this.pendingValidations.set(s,a);try{const n=await a;return this.setCachedResult(s,n),n}finally{this.pendingValidations.delete(s)}}validateWorkspaceDebounced(t,s){const r=setTimeout(async()=>{try{const a=await this.validateWorkspace(t);s(a)}catch(a){const n={path:t,is_valid:!1,error_message:a instanceof Error?a.message:J.t("chat.workspace.checkDescription")};s(n)}},this.options.debounceMs);return()=>{clearTimeout(r)}}clearCache(){this.cache.clear()}getCachedResult(t){const s=this.cache.get(t);return s?Date.now()-s.timestamp>this.options.cacheTimeoutMs?(this.cache.delete(t),null):s.result:null}setCachedResult(t,s){this.cache.set(t,{result:s,timestamp:Date.now()})}async performValidation(t,s=0){try{return await ae.post("workspace/validate",{path:t})}catch(c){if(s<this.options.maxRetries&&this.isRetryableError(c))return await this.delay(Math.pow(2,s)*1e3),this.performValidation(t,s+1);throw c}}isRetryableError(t){return t instanceof Error?t.message.includes("Failed to fetch")||t.message.includes("HTTP error! status: 5"):!1}delay(t){return new Promise(s=>setTimeout(s,t))}async validateMultiplePaths(t){const c=[];for(let r=0;r<t.length;r+=5){const a=t.slice(r,r+5),n=await Promise.all(a.map(u=>this.validateWorkspace(u)));c.push(...n),r+5<t.length&&await this.delay(100)}return c}}const ge=new ue,me=({value:i="",onChange:t,showRecentWorkspaces:s,showSuggestions:c,onValidationChange:r})=>{const{message:a}=O.useApp(),{t:n}=C(),[u,j]=o.useState(i),[l,m]=o.useState({isValidating:!1,result:null}),[g,I]=o.useState([]),[b,w]=o.useState(!1),[v,f]=o.useState([]),[y,x]=o.useState(!1),[F,R]=o.useState(!1),P=o.useRef(null),S=o.useRef(null);o.useEffect(()=>{j(i)},[i]);const _=o.useCallback(async()=>{x(!0);try{const h=await L.getRecentWorkspaces();I(h.slice(0,5))}catch(h){console.error("Failed to load recent workspaces:",h),I([])}finally{x(!1)}},[]),d=o.useCallback(async()=>{R(!0);try{const h=await L.getPathSuggestions();f(h.suggestions.slice(0,8))}catch(h){console.error("Failed to load suggestions:",h),f([])}finally{R(!1)}},[]);o.useEffect(()=>{s&&_(),c&&d();const h=P.current,z=S.current;return()=>{h&&h.abort(),z&&z()}},[s,c,_,d]);const p=o.useCallback(h=>{j(h),t&&t(h),P.current&&P.current.abort(),S.current&&S.current(),h.trim()?(m({isValidating:!0,result:null}),S.current=ge.validateWorkspaceDebounced(h.trim(),z=>{m({isValidating:!1,result:z}),r&&r(z)})):(m({isValidating:!1,result:null}),r&&r(null))},[t,r]),A=o.useCallback(()=>{w(!0)},[]),H=o.useCallback(h=>{p(h),a.success(n("chat.workspace.folderSelected"))},[p,a,n]),ee=o.useCallback(h=>{p(h)},[p]);return{path:u,validationStatus:l,recentWorkspaces:g,suggestions:v,isLoadingRecent:y,isLoadingSuggestions:F,folderBrowserVisible:b,setFolderBrowserVisible:w,handlePathChange:p,handleBrowseClick:A,handleFolderSelect:H,handleWorkspaceSelect:ee}},{Text:X}=V,xe=({show:i,isLoading:t,recentWorkspaces:s,onSelect:c,token:r})=>{const{t:a}=C();return i?e.jsxs(M,{vertical:!0,gap:r.marginXS,style:{marginTop:r.marginMD},children:[e.jsxs(k,{style:{paddingInline:r.paddingSM},children:[e.jsx(K,{}),e.jsx(X,{strong:!0,children:a("chat.workspace.recentTitle")})]}),t?e.jsx(M,{justify:"center",style:{padding:r.paddingSM},children:e.jsx(q,{size:"small"})}):s.length===0?e.jsx(B,{description:a("chat.workspace.noRecentWorkspaces"),image:B.PRESENTED_IMAGE_SIMPLE,style:{padding:r.paddingSM}}):e.jsx(W,{size:"small",dataSource:s,style:{paddingInline:r.paddingSM},renderItem:n=>e.jsx(W.Item,{style:{padding:0},children:e.jsx(T,{type:"text",onClick:()=>c(n.path),style:{width:"100%",textAlign:"left",padding:`${r.paddingXS}px 0`,height:"auto"},children:e.jsxs(M,{justify:"space-between",align:"center",style:{width:"100%"},children:[e.jsxs(k,{children:[e.jsx(E,{style:{color:r.colorWarning}}),e.jsx(X,{strong:!0,children:n.workspace_name||n.path.split("/").pop()||a("chat.workspace.defaultWorkspaceName")})]}),e.jsx(X,{type:"secondary",ellipsis:{tooltip:n.path},style:{fontSize:12,maxWidth:"55%",textAlign:"right"},children:n.path})]})})})})]}):null},{Text:G}=V,fe=(i,t)=>{switch(i.suggestion_type){case"home":return e.jsx(Z,{style:{color:t.colorPrimary}});case"documents":case"desktop":case"downloads":return e.jsx(E,{style:{color:t.colorSuccess}});case"recent":return e.jsx(K,{style:{color:t.colorWarning}});default:return e.jsx(E,{})}},ye=({show:i,isLoading:t,suggestions:s,onSelect:c,token:r})=>{const{t:a}=C();return i?e.jsxs(M,{vertical:!0,gap:r.marginXS,style:{marginTop:r.marginMD},children:[e.jsxs(k,{style:{paddingInline:r.paddingSM},children:[e.jsx(E,{}),e.jsx(G,{strong:!0,children:a("chat.workspace.suggestedTitle")})]}),t?e.jsx(M,{justify:"center",style:{padding:r.paddingSM},children:e.jsx(q,{size:"small"})}):s.length===0?e.jsx(B,{description:a("chat.workspace.noSuggestions"),image:B.PRESENTED_IMAGE_SIMPLE,style:{padding:r.paddingSM}}):e.jsx(W,{size:"small",dataSource:s,style:{paddingInline:r.paddingSM},renderItem:n=>e.jsx(W.Item,{style:{padding:0},children:e.jsx(T,{type:"text",onClick:()=>c(n.path),style:{width:"100%",textAlign:"left",padding:`${r.paddingXS}px 0`,height:"auto"},children:e.jsxs(M,{justify:"space-between",align:"center",style:{width:"100%"},children:[e.jsxs(k,{children:[fe(n,r),e.jsx(G,{strong:!0,children:n.name})]}),e.jsx(G,{type:"secondary",ellipsis:{tooltip:n.path},style:{fontSize:12,maxWidth:"55%",textAlign:"right"},children:n.path})]})})})})]}):null},je=({isValidating:i,result:t,token:s})=>i?e.jsx(ce,{style:{color:s.colorPrimary}}):t?t.is_valid?e.jsx(oe,{style:{color:s.colorSuccess}}):e.jsx(le,{style:{color:s.colorError}}):null,{Text:U}=V,we=({result:i,token:t})=>{const{t:s}=C();return i?e.jsx("div",{style:{marginTop:t.marginXS},children:i.is_valid?e.jsx($,{type:"success",message:e.jsxs(k,{children:[e.jsx("span",{children:s("chat.workspace.validWorkspace")}),i.workspace_name&&e.jsxs(U,{type:"secondary",children:["(",i.workspace_name,")"]}),i.file_count!==void 0&&e.jsx(U,{type:"secondary",children:s("chat.workspace.fileCount",{count:i.file_count})})]}),showIcon:!0}):e.jsx($,{type:"error",message:i.error_message||s("validation.invalidPath"),showIcon:!0})}):null},{Text:Se}=V,ke=({value:i="",onChange:t,placeholder:s,disabled:c=!1,allowBrowse:r=!0,showRecentWorkspaces:a=!0,showSuggestions:n=!0,onValidationChange:u,className:j,style:l})=>{const{t:m}=C(),{token:g}=Y.useToken(),I=s??m("chat.workspace.placeholder"),{path:b,validationStatus:w,recentWorkspaces:v,suggestions:f,isLoadingRecent:y,isLoadingSuggestions:x,folderBrowserVisible:F,setFolderBrowserVisible:R,handlePathChange:P,handleBrowseClick:S,handleFolderSelect:_,handleWorkspaceSelect:d}=me({value:i,onChange:t,showRecentWorkspaces:a,showSuggestions:n,onValidationChange:u});return e.jsxs("div",{className:j,style:l,children:[e.jsx(de,{value:b,onChange:p=>P(p.target.value),placeholder:I,disabled:c,size:"middle",style:{width:"100%"},suffix:e.jsx(je,{isValidating:w.isValidating,result:w.result,token:g}),addonBefore:e.jsxs(k,{children:[e.jsx(E,{}),e.jsx(Se,{children:m("chat.workspace.label")})]}),addonAfter:r?e.jsx(T,{"aria-label":m("chat.workspace.browseFolder"),title:m("chat.workspace.browseFolder"),icon:e.jsx(E,{}),onClick:S,disabled:c,type:"text",size:"middle",style:{display:"inline-flex",alignItems:"center"}}):void 0}),e.jsx(we,{result:w.result,token:g}),(a||n)&&e.jsxs(e.Fragment,{children:[e.jsx(he,{style:{margin:"16px 0 12px 0"}}),e.jsx(xe,{show:a,isLoading:y,recentWorkspaces:v,onSelect:d,token:g}),e.jsx(ye,{show:n,isLoading:x,suggestions:f,onSelect:d,token:g})]}),e.jsx(pe,{visible:F,onClose:()=>R(!1),onSelect:_})]})},{Title:Ie}=V,_e=({open:i,initialPath:t="",loading:s=!1,onSubmit:c,onCancel:r})=>{const{t:a}=C(),{message:n}=O.useApp(),[u,j]=o.useState(t),[l,m]=o.useState(null),[g,I]=o.useState(!1);o.useEffect(()=>{i&&(j(t),m(null))},[i,t]);const b=x=>{j(x)},w=x=>{m(x)},v=async()=>{if(!u.trim()){n.error(a("chat.workspace.errorEnterPath"));return}l&&!l.is_valid?N.confirm({title:a("chat.workspace.invalidTitle"),content:e.jsxs("div",{children:[e.jsx("p",{children:a("chat.workspace.issuesDetected")}),e.jsx("p",{children:l.error_message||a("chat.workspace.invalidTitle")}),e.jsx("p",{children:a("chat.workspace.confirmSaveInvalid")})]}),okText:a("common.saveAnyway"),cancelText:a("common.cancel"),onOk:()=>f()}):f()},f=async()=>{I(!0);try{l!=null&&l.is_valid&&await L.addRecentWorkspace(u.trim(),{workspace_name:l.workspace_name}),c(u.trim())}catch(x){console.error("Failed to save workspace path:",x),n.error(a("chat.workspace.errorSaveFailed"))}finally{I(!1)}},y=!u.trim()||s||g;return e.jsx(N,{open:i,title:e.jsx(k,{children:e.jsx(Ie,{level:4,style:{margin:0},children:a("chat.workspace.modalTitle")})}),okText:a("common.save"),cancelText:a("common.cancel"),onOk:v,onCancel:r,okButtonProps:{disabled:y,loading:g||s},width:600,destroyOnClose:!0,children:e.jsxs(k,{direction:"vertical",size:"middle",style:{width:"100%"},children:[e.jsx($,{message:a("chat.workspace.descriptionTitle"),description:e.jsxs("div",{children:[e.jsx("p",{children:a("chat.workspace.descriptionP1")}),e.jsx("p",{children:a("chat.workspace.descriptionP2")})]}),type:"info",showIcon:!0}),e.jsx(ke,{value:u,onChange:b,onValidationChange:w,placeholder:a("chat.workspace.placeholder"),disabled:g,allowBrowse:!0,showRecentWorkspaces:!0,showSuggestions:!0}),l&&!l.is_valid&&e.jsx($,{message:a("chat.workspace.checkTitle"),description:l.error_message||a("chat.workspace.checkDescription"),type:"warning",showIcon:!0})]})})};export{_e as default};
|
|
1
|
+
var te=Object.defineProperty;var se=(i,t,s)=>t in i?te(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s;var D=(i,t,s)=>se(i,typeof t!="symbol"?t+"":t,s);import{j as e}from"./vendor-markdown-CARODNj-.js";import{u as C,a as o,i as J}from"./vendor-i18n-Dm-c3D_C.js";import{S as L,H as ae}from"./App-4fU-kHUd.js";import{A as O,t as Y,j as V,a8 as N,o as k,B as T,aB as Z,aC as re,q as ie,aD as Q,U as ne,a3 as q,a0 as B,J as W,a1 as E,Q as M,aE as K,aF as ce,z as oe,V as le,I as $,a9 as de,aG as he}from"./vendor-antd-C-pjKgeW.js";import"./main-CKaJQsPs.js";import"./vendor-mermaid-ClcSc_uI.js";const pe=({visible:i,onClose:t,onSelect:s})=>{const{t:c}=C(),{message:r}=O.useApp(),{token:a}=Y.useToken(),{Text:n}=V,[u,j]=o.useState(!1),[l,m]=o.useState(""),[g,I]=o.useState(),[b,w]=o.useState([]),[v,f]=o.useState([]);o.useEffect(()=>{i&&y()},[i]);const y=async d=>{j(!0);try{const p=await L.browseFolder(d);m(p.current_path),I(p.parent_path),w(p.folders)}catch(p){console.error(c("chat.folderBrowser.readFolderError"),p),r.error(c("chat.folderBrowser.readFolderError"))}finally{j(!1)}},x=d=>{f([...v,l]),y(d.path)},F=()=>{g&&(f(v.slice(0,-1)),y(g))},R=()=>{f([]),y()},P=()=>{s(l),t()},S=()=>{if(!l)return[];const d=l.split(/[/\\]/).filter(Boolean);return l.startsWith("/")&&d.unshift("/"),d},_=d=>{const A=S().slice(0,d+1).join("/"),H=(l.startsWith("/"),A);y(H)};return e.jsx(N,{title:c("chat.folderBrowser.title"),open:i,onCancel:t,width:700,footer:null,children:e.jsxs(k,{direction:"vertical",size:"middle",style:{width:"100%"},children:[e.jsxs(k,{children:[e.jsx(T,{icon:e.jsx(Z,{}),onClick:R,size:"small",children:c("common.home")}),e.jsx(T,{icon:e.jsx(re,{}),onClick:F,disabled:!g,size:"small",children:c("common.parentDirectory")}),e.jsx(T,{type:"primary",icon:e.jsx(ie,{}),onClick:P,size:"small",children:c("chat.folderBrowser.selectCurrent")})]}),e.jsx(Q,{children:S().map((d,p)=>e.jsx(Q.Item,{children:e.jsx(T,{type:"link",size:"small",onClick:()=>_(p),style:{padding:0},children:d==="/"?e.jsx(Z,{}):d})},S().slice(0,p+1).join("/")))}),e.jsxs(ne,{size:"small",styles:{body:{padding:a.paddingXS}},children:[e.jsx(n,{type:"secondary",style:{fontSize:12},children:c("common.currentPath")})," ",e.jsx(n,{code:!0,children:l})]}),e.jsx(q,{spinning:u,children:b.length===0&&!u?e.jsx(B,{image:B.PRESENTED_IMAGE_SIMPLE,description:e.jsx(n,{type:"secondary",children:c("chat.folderBrowser.emptyFolder")})}):e.jsx(W,{dataSource:b,style:{maxHeight:400,overflowY:"auto"},renderItem:d=>e.jsx(W.Item,{style:{padding:0},children:e.jsx(T,{type:"text",icon:e.jsx(E,{}),onClick:()=>x(d),style:{width:"100%",textAlign:"left",padding:`${a.paddingXS}px ${a.paddingSM}px`},children:d.name})})})}),e.jsx(n,{type:"secondary",style:{fontSize:12},children:c("chat.folderBrowser.tip")})]})})};class ue{constructor(t={}){D(this,"cache",new Map);D(this,"pendingValidations",new Map);D(this,"options");this.options={debounceMs:t.debounceMs??300,cacheTimeoutMs:t.cacheTimeoutMs??5*60*1e3,maxRetries:t.maxRetries??3}}async validateWorkspace(t){if(!t||t.trim().length===0)return{path:"",is_valid:!1,error_message:J.t("chat.workspace.errorEnterPath")};const s=t.trim(),c=this.getCachedResult(s);if(c)return c;const r=this.pendingValidations.get(s);if(r)return r;const a=this.performValidation(s);this.pendingValidations.set(s,a);try{const n=await a;return this.setCachedResult(s,n),n}finally{this.pendingValidations.delete(s)}}validateWorkspaceDebounced(t,s){const r=setTimeout(async()=>{try{const a=await this.validateWorkspace(t);s(a)}catch(a){const n={path:t,is_valid:!1,error_message:a instanceof Error?a.message:J.t("chat.workspace.checkDescription")};s(n)}},this.options.debounceMs);return()=>{clearTimeout(r)}}clearCache(){this.cache.clear()}getCachedResult(t){const s=this.cache.get(t);return s?Date.now()-s.timestamp>this.options.cacheTimeoutMs?(this.cache.delete(t),null):s.result:null}setCachedResult(t,s){this.cache.set(t,{result:s,timestamp:Date.now()})}async performValidation(t,s=0){try{return await ae.post("workspace/validate",{path:t})}catch(c){if(s<this.options.maxRetries&&this.isRetryableError(c))return await this.delay(Math.pow(2,s)*1e3),this.performValidation(t,s+1);throw c}}isRetryableError(t){return t instanceof Error?t.message.includes("Failed to fetch")||t.message.includes("HTTP error! status: 5"):!1}delay(t){return new Promise(s=>setTimeout(s,t))}async validateMultiplePaths(t){const c=[];for(let r=0;r<t.length;r+=5){const a=t.slice(r,r+5),n=await Promise.all(a.map(u=>this.validateWorkspace(u)));c.push(...n),r+5<t.length&&await this.delay(100)}return c}}const ge=new ue,me=({value:i="",onChange:t,showRecentWorkspaces:s,showSuggestions:c,onValidationChange:r})=>{const{message:a}=O.useApp(),{t:n}=C(),[u,j]=o.useState(i),[l,m]=o.useState({isValidating:!1,result:null}),[g,I]=o.useState([]),[b,w]=o.useState(!1),[v,f]=o.useState([]),[y,x]=o.useState(!1),[F,R]=o.useState(!1),P=o.useRef(null),S=o.useRef(null);o.useEffect(()=>{j(i)},[i]);const _=o.useCallback(async()=>{x(!0);try{const h=await L.getRecentWorkspaces();I(h.slice(0,5))}catch(h){console.error("Failed to load recent workspaces:",h),I([])}finally{x(!1)}},[]),d=o.useCallback(async()=>{R(!0);try{const h=await L.getPathSuggestions();f(h.suggestions.slice(0,8))}catch(h){console.error("Failed to load suggestions:",h),f([])}finally{R(!1)}},[]);o.useEffect(()=>{s&&_(),c&&d();const h=P.current,z=S.current;return()=>{h&&h.abort(),z&&z()}},[s,c,_,d]);const p=o.useCallback(h=>{j(h),t&&t(h),P.current&&P.current.abort(),S.current&&S.current(),h.trim()?(m({isValidating:!0,result:null}),S.current=ge.validateWorkspaceDebounced(h.trim(),z=>{m({isValidating:!1,result:z}),r&&r(z)})):(m({isValidating:!1,result:null}),r&&r(null))},[t,r]),A=o.useCallback(()=>{w(!0)},[]),H=o.useCallback(h=>{p(h),a.success(n("chat.workspace.folderSelected"))},[p,a,n]),ee=o.useCallback(h=>{p(h)},[p]);return{path:u,validationStatus:l,recentWorkspaces:g,suggestions:v,isLoadingRecent:y,isLoadingSuggestions:F,folderBrowserVisible:b,setFolderBrowserVisible:w,handlePathChange:p,handleBrowseClick:A,handleFolderSelect:H,handleWorkspaceSelect:ee}},{Text:X}=V,xe=({show:i,isLoading:t,recentWorkspaces:s,onSelect:c,token:r})=>{const{t:a}=C();return i?e.jsxs(M,{vertical:!0,gap:r.marginXS,style:{marginTop:r.marginMD},children:[e.jsxs(k,{style:{paddingInline:r.paddingSM},children:[e.jsx(K,{}),e.jsx(X,{strong:!0,children:a("chat.workspace.recentTitle")})]}),t?e.jsx(M,{justify:"center",style:{padding:r.paddingSM},children:e.jsx(q,{size:"small"})}):s.length===0?e.jsx(B,{description:a("chat.workspace.noRecentWorkspaces"),image:B.PRESENTED_IMAGE_SIMPLE,style:{padding:r.paddingSM}}):e.jsx(W,{size:"small",dataSource:s,style:{paddingInline:r.paddingSM},renderItem:n=>e.jsx(W.Item,{style:{padding:0},children:e.jsx(T,{type:"text",onClick:()=>c(n.path),style:{width:"100%",textAlign:"left",padding:`${r.paddingXS}px 0`,height:"auto"},children:e.jsxs(M,{justify:"space-between",align:"center",style:{width:"100%"},children:[e.jsxs(k,{children:[e.jsx(E,{style:{color:r.colorWarning}}),e.jsx(X,{strong:!0,children:n.workspace_name||n.path.split("/").pop()||a("chat.workspace.defaultWorkspaceName")})]}),e.jsx(X,{type:"secondary",ellipsis:{tooltip:n.path},style:{fontSize:12,maxWidth:"55%",textAlign:"right"},children:n.path})]})})})})]}):null},{Text:G}=V,fe=(i,t)=>{switch(i.suggestion_type){case"home":return e.jsx(Z,{style:{color:t.colorPrimary}});case"documents":case"desktop":case"downloads":return e.jsx(E,{style:{color:t.colorSuccess}});case"recent":return e.jsx(K,{style:{color:t.colorWarning}});default:return e.jsx(E,{})}},ye=({show:i,isLoading:t,suggestions:s,onSelect:c,token:r})=>{const{t:a}=C();return i?e.jsxs(M,{vertical:!0,gap:r.marginXS,style:{marginTop:r.marginMD},children:[e.jsxs(k,{style:{paddingInline:r.paddingSM},children:[e.jsx(E,{}),e.jsx(G,{strong:!0,children:a("chat.workspace.suggestedTitle")})]}),t?e.jsx(M,{justify:"center",style:{padding:r.paddingSM},children:e.jsx(q,{size:"small"})}):s.length===0?e.jsx(B,{description:a("chat.workspace.noSuggestions"),image:B.PRESENTED_IMAGE_SIMPLE,style:{padding:r.paddingSM}}):e.jsx(W,{size:"small",dataSource:s,style:{paddingInline:r.paddingSM},renderItem:n=>e.jsx(W.Item,{style:{padding:0},children:e.jsx(T,{type:"text",onClick:()=>c(n.path),style:{width:"100%",textAlign:"left",padding:`${r.paddingXS}px 0`,height:"auto"},children:e.jsxs(M,{justify:"space-between",align:"center",style:{width:"100%"},children:[e.jsxs(k,{children:[fe(n,r),e.jsx(G,{strong:!0,children:n.name})]}),e.jsx(G,{type:"secondary",ellipsis:{tooltip:n.path},style:{fontSize:12,maxWidth:"55%",textAlign:"right"},children:n.path})]})})})})]}):null},je=({isValidating:i,result:t,token:s})=>i?e.jsx(ce,{style:{color:s.colorPrimary}}):t?t.is_valid?e.jsx(oe,{style:{color:s.colorSuccess}}):e.jsx(le,{style:{color:s.colorError}}):null,{Text:U}=V,we=({result:i,token:t})=>{const{t:s}=C();return i?e.jsx("div",{style:{marginTop:t.marginXS},children:i.is_valid?e.jsx($,{type:"success",message:e.jsxs(k,{children:[e.jsx("span",{children:s("chat.workspace.validWorkspace")}),i.workspace_name&&e.jsxs(U,{type:"secondary",children:["(",i.workspace_name,")"]}),i.file_count!==void 0&&e.jsx(U,{type:"secondary",children:s("chat.workspace.fileCount",{count:i.file_count})})]}),showIcon:!0}):e.jsx($,{type:"error",message:i.error_message||s("validation.invalidPath"),showIcon:!0})}):null},{Text:Se}=V,ke=({value:i="",onChange:t,placeholder:s,disabled:c=!1,allowBrowse:r=!0,showRecentWorkspaces:a=!0,showSuggestions:n=!0,onValidationChange:u,className:j,style:l})=>{const{t:m}=C(),{token:g}=Y.useToken(),I=s??m("chat.workspace.placeholder"),{path:b,validationStatus:w,recentWorkspaces:v,suggestions:f,isLoadingRecent:y,isLoadingSuggestions:x,folderBrowserVisible:F,setFolderBrowserVisible:R,handlePathChange:P,handleBrowseClick:S,handleFolderSelect:_,handleWorkspaceSelect:d}=me({value:i,onChange:t,showRecentWorkspaces:a,showSuggestions:n,onValidationChange:u});return e.jsxs("div",{className:j,style:l,children:[e.jsx(de,{value:b,onChange:p=>P(p.target.value),placeholder:I,disabled:c,size:"middle",style:{width:"100%"},suffix:e.jsx(je,{isValidating:w.isValidating,result:w.result,token:g}),addonBefore:e.jsxs(k,{children:[e.jsx(E,{}),e.jsx(Se,{children:m("chat.workspace.label")})]}),addonAfter:r?e.jsx(T,{"aria-label":m("chat.workspace.browseFolder"),title:m("chat.workspace.browseFolder"),icon:e.jsx(E,{}),onClick:S,disabled:c,type:"text",size:"middle",style:{display:"inline-flex",alignItems:"center"}}):void 0}),e.jsx(we,{result:w.result,token:g}),(a||n)&&e.jsxs(e.Fragment,{children:[e.jsx(he,{style:{margin:"16px 0 12px 0"}}),e.jsx(xe,{show:a,isLoading:y,recentWorkspaces:v,onSelect:d,token:g}),e.jsx(ye,{show:n,isLoading:x,suggestions:f,onSelect:d,token:g})]}),e.jsx(pe,{visible:F,onClose:()=>R(!1),onSelect:_})]})},{Title:Ie}=V,_e=({open:i,initialPath:t="",loading:s=!1,onSubmit:c,onCancel:r})=>{const{t:a}=C(),{message:n}=O.useApp(),[u,j]=o.useState(t),[l,m]=o.useState(null),[g,I]=o.useState(!1);o.useEffect(()=>{i&&(j(t),m(null))},[i,t]);const b=x=>{j(x)},w=x=>{m(x)},v=async()=>{if(!u.trim()){n.error(a("chat.workspace.errorEnterPath"));return}l&&!l.is_valid?N.confirm({title:a("chat.workspace.invalidTitle"),content:e.jsxs("div",{children:[e.jsx("p",{children:a("chat.workspace.issuesDetected")}),e.jsx("p",{children:l.error_message||a("chat.workspace.invalidTitle")}),e.jsx("p",{children:a("chat.workspace.confirmSaveInvalid")})]}),okText:a("common.saveAnyway"),cancelText:a("common.cancel"),onOk:()=>f()}):f()},f=async()=>{I(!0);try{l!=null&&l.is_valid&&await L.addRecentWorkspace(u.trim(),{workspace_name:l.workspace_name}),c(u.trim())}catch(x){console.error("Failed to save workspace path:",x),n.error(a("chat.workspace.errorSaveFailed"))}finally{I(!1)}},y=!u.trim()||s||g;return e.jsx(N,{open:i,title:e.jsx(k,{children:e.jsx(Ie,{level:4,style:{margin:0},children:a("chat.workspace.modalTitle")})}),okText:a("common.save"),cancelText:a("common.cancel"),onOk:v,onCancel:r,okButtonProps:{disabled:y,loading:g||s},width:600,destroyOnClose:!0,children:e.jsxs(k,{direction:"vertical",size:"middle",style:{width:"100%"},children:[e.jsx($,{message:a("chat.workspace.descriptionTitle"),description:e.jsxs("div",{children:[e.jsx("p",{children:a("chat.workspace.descriptionP1")}),e.jsx("p",{children:a("chat.workspace.descriptionP2")})]}),type:"info",showIcon:!0}),e.jsx(ke,{value:u,onChange:b,onValidationChange:w,placeholder:a("chat.workspace.placeholder"),disabled:g,allowBrowse:!0,showRecentWorkspaces:!0,showSuggestions:!0}),l&&!l.is_valid&&e.jsx($,{message:a("chat.workspace.checkTitle"),description:l.error_message||a("chat.workspace.checkDescription"),type:"warning",showIcon:!0})]})})};export{_e as default};
|