@bigduu/lotus 2026.6.16 → 2026.6.18
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-ByVdg3-E.js +247 -0
- package/dist/assets/{FeatureGuide-pqK-Gb1K.js → FeatureGuide-BBd5Ov96.js} +1 -1
- package/dist/assets/{MetricsService-B3MPZEfA.js → MetricsService-RerVfypG.js} +1 -1
- package/dist/assets/{SubAgentsPanel-Cv5BQdXg.js → SubAgentsPanel-C8_mrYx_.js} +2 -2
- package/dist/assets/{architectureDiagram-3BPJPVTR-CEwscXSP.js → architectureDiagram-3BPJPVTR-CtdI5C_N.js} +1 -1
- package/dist/assets/{blockDiagram-GPEHLZMM-DW5Yb8r-.js → blockDiagram-GPEHLZMM-CMXjfIN0.js} +1 -1
- package/dist/assets/{c4Diagram-AAUBKEIU-DcKzj8l0.js → c4Diagram-AAUBKEIU-DrB6-Aee.js} +1 -1
- package/dist/assets/{chunk-2J33WTMH-CVCrXOBM.js → chunk-2J33WTMH-DKmtm20J.js} +1 -1
- package/dist/assets/{chunk-4BX2VUAB-Bjf7ds0t.js → chunk-4BX2VUAB-BhgLLuP2.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-CjKnaow6.js → chunk-55IACEB6-DwkY2JGD.js} +1 -1
- package/dist/assets/{chunk-727SXJPM-MYGM3PcL.js → chunk-727SXJPM-CSsBkHQo.js} +1 -1
- package/dist/assets/{chunk-AQP2D5EJ-58nBRQ3s.js → chunk-AQP2D5EJ-BBrF8ywh.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-r8Ck2-cC.js → chunk-FMBD7UC4-DqoaD6If.js} +1 -1
- package/dist/assets/{chunk-ND2GUHAM-M6noLOM0.js → chunk-ND2GUHAM-C-QDeIbb.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-D6Wluw3g.js → chunk-QZHKN3VN-BJOjao__.js} +1 -1
- package/dist/assets/classDiagram-4FO5ZUOK-BbTF4DkK.js +1 -0
- package/dist/assets/classDiagram-v2-Q7XG4LA2-BbTF4DkK.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-BAIUuyQ8.js → cose-bilkent-S5V4N54A-O0n9jreS.js} +1 -1
- package/dist/assets/{dagre-BM42HDAG-DHs-IW5w.js → dagre-BM42HDAG-Ck6zQeMf.js} +1 -1
- package/dist/assets/{diagram-2AECGRRQ-BSi58Pmk.js → diagram-2AECGRRQ-FCOxErT-.js} +1 -1
- package/dist/assets/{diagram-5GNKFQAL-BP4IDK4A.js → diagram-5GNKFQAL-D0zWiZLg.js} +1 -1
- package/dist/assets/{diagram-KO2AKTUF-XVxhi7xd.js → diagram-KO2AKTUF-a5h-Bdgo.js} +1 -1
- package/dist/assets/{diagram-LMA3HP47-DPQbv9x7.js → diagram-LMA3HP47-CXfuZFEZ.js} +1 -1
- package/dist/assets/{diagram-OG6HWLK6-sQNvR1Rj.js → diagram-OG6HWLK6-CwfDYT_D.js} +1 -1
- package/dist/assets/en-US-CPOMr4oP.js +3 -0
- package/dist/assets/{erDiagram-TEJ5UH35-CPK4amZc.js → erDiagram-TEJ5UH35-BBwjJDjM.js} +1 -1
- package/dist/assets/{flowDiagram-I6XJVG4X-kExdgjMg.js → flowDiagram-I6XJVG4X-BswyzDkv.js} +1 -1
- package/dist/assets/{ganttDiagram-6RSMTGT7-DFIo8kTJ.js → ganttDiagram-6RSMTGT7-CrM3NdXk.js} +1 -1
- package/dist/assets/{gitGraphDiagram-PVQCEYII-Dr-TkknI.js → gitGraphDiagram-PVQCEYII-C_55vMLm.js} +1 -1
- package/dist/assets/index-BL6U2IJy.js +1 -0
- package/dist/assets/index-BRAbdKCp.js +1 -0
- package/dist/assets/{index-DTwjPw3W.js → index-BWYAJeFP.js} +1 -1
- package/dist/assets/index-Bp9c5Tzf.js +1 -0
- package/dist/assets/{index-BtKDULhw.js → index-CB9jZULW.js} +1 -1
- package/dist/assets/{index-DD799l9l.js → index-CKAGhJ4t.js} +2 -2
- package/dist/assets/index-CRvtbdzi.js +1 -0
- package/dist/assets/index-D1H01fvT.js +1 -0
- package/dist/assets/{index-IUnDhddK.js → index-DTYKAP0j.js} +1 -1
- package/dist/assets/{index-DZwtEBJ8.js → index-DU7eIuEG.js} +1 -1
- package/dist/assets/{index-DRR_PLI3.js → index-DzkUMBvQ.js} +1 -1
- package/dist/assets/index-dhm49pNj.js +22 -0
- package/dist/assets/index-fqLbeo9W.js +1 -0
- package/dist/assets/index-y73Vt8uy.js +1 -0
- package/dist/assets/{index.es-DiBjIJ4P.js → index.es-CkzW4Zmh.js} +1 -1
- package/dist/assets/{infoDiagram-5YYISTIA-TyFn1xMi.js → infoDiagram-5YYISTIA-CMIn9b-v.js} +1 -1
- package/dist/assets/{ishikawaDiagram-YF4QCWOH-B54awsuE.js → ishikawaDiagram-YF4QCWOH-DZhhW7NF.js} +1 -1
- package/dist/assets/{journeyDiagram-JHISSGLW-UG1dUbuf.js → journeyDiagram-JHISSGLW-DKat16ke.js} +1 -1
- package/dist/assets/{kanban-definition-UN3LZRKU-qhn1-_c6.js → kanban-definition-UN3LZRKU-C3Ra1Wtp.js} +1 -1
- package/dist/assets/{main-KJE6TlvG.js → main-C4wmVzw7.js} +3 -3
- package/dist/assets/{mindmap-definition-RKZ34NQL-DA3OZxUI.js → mindmap-definition-RKZ34NQL-h98UkYIr.js} +1 -1
- package/dist/assets/{pieDiagram-4H26LBE5-qK8s-crM.js → pieDiagram-4H26LBE5-Ca1mbxfG.js} +1 -1
- package/dist/assets/{quadrantDiagram-W4KKPZXB-JKpitOx9.js → quadrantDiagram-W4KKPZXB-Lye73YJ5.js} +1 -1
- package/dist/assets/{requirementDiagram-4Y6WPE33-isliGwvT.js → requirementDiagram-4Y6WPE33-BpctuKV3.js} +1 -1
- package/dist/assets/{sankeyDiagram-5OEKKPKP-t6847Rv0.js → sankeyDiagram-5OEKKPKP-2L2I86GH.js} +1 -1
- package/dist/assets/{sequenceDiagram-3UESZ5HK-W-7TqsM-.js → sequenceDiagram-3UESZ5HK-He2Uib8Z.js} +1 -1
- package/dist/assets/{stateDiagram-AJRCARHV-CIeR68vv.js → stateDiagram-AJRCARHV-0CmRZrKD.js} +1 -1
- package/dist/assets/stateDiagram-v2-BHNVJYJU-DtpVPE6y.js +1 -0
- package/dist/assets/{timeline-definition-PNZ67QCA-C6PN9QvV.js → timeline-definition-PNZ67QCA-BS-Gg4pR.js} +1 -1
- package/dist/assets/{vendor-antd-Ce-qhZOr.js → vendor-antd-qu012Od4.js} +83 -83
- package/dist/assets/{vendor-charts-BS4X3sTj.js → vendor-charts-DedjCauI.js} +1 -1
- package/dist/assets/{vendor-markdown-CgV5F7BD.js → vendor-markdown-teEfNS9t.js} +1 -1
- package/dist/assets/{vendor-mermaid-Di565VO4.js → vendor-mermaid-DvB2TuRQ.js} +4 -4
- package/dist/assets/{vendor-pdf-CAvJLb8d.js → vendor-pdf-EfagbHCQ.js} +4 -4
- package/dist/assets/{vennDiagram-CIIHVFJN-BaxoAqUJ.js → vennDiagram-CIIHVFJN-9-Ex40lP.js} +1 -1
- package/dist/assets/{wardley-L42UT6IY-BCek0J-6.js → wardley-L42UT6IY-C72bATqP.js} +1 -1
- package/dist/assets/{wardleyDiagram-YWT4CUSO-DsAawl1D.js → wardleyDiagram-YWT4CUSO-BvQAjPpP.js} +1 -1
- package/dist/assets/{xychartDiagram-2RQKCTM6-BJFU9Wh3.js → xychartDiagram-2RQKCTM6-10L-VeDd.js} +1 -1
- package/dist/assets/zh-CN-ocl6T5wf.js +3 -0
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/dist/assets/App-M_Enlqcv.js +0 -247
- package/dist/assets/classDiagram-4FO5ZUOK-Brm-FcnA.js +0 -1
- package/dist/assets/classDiagram-v2-Q7XG4LA2-Brm-FcnA.js +0 -1
- package/dist/assets/en-US-CZuXloGO.js +0 -3
- package/dist/assets/index-3D4SJ2Sq.js +0 -1
- package/dist/assets/index-BPzdRxWR.js +0 -22
- package/dist/assets/index-Cqta1ICV.js +0 -1
- package/dist/assets/index-DPB3OsNN.js +0 -1
- package/dist/assets/index-DeiR3zxI.js +0 -1
- package/dist/assets/index-Do83dUqx.js +0 -1
- package/dist/assets/index-Dx9gwpkf.js +0 -1
- package/dist/assets/stateDiagram-v2-BHNVJYJU-ypR04tU0.js +0 -1
- package/dist/assets/zh-CN-CcCq2fCo.js +0 -3
- /package/dist/assets/{index-8u7yjQhY.css → QuestionDialog-8u7yjQhY.css} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./vendor-markdown-
|
|
1
|
+
import{j as s}from"./vendor-markdown-teEfNS9t.js";import{u as M,a as S}from"./vendor-i18n-Dm-c3D_C.js";import{u as w,t as I,w as b,x as T,I as W}from"./App-ByVdg3-E.js";import{m as A}from"./MetricsService-RerVfypG.js";import{t as B,ai as D,ad as $,aj as R,X as _,D as v,ak as k,k as F,al as L,W as z,x as O}from"./vendor-antd-qu012Od4.js";import"./vendor-mermaid-DvB2TuRQ.js";import"./main-C4wmVzw7.js";const N=new Map,P=new Set(["Write","Edit","apply_patch","NotebookEdit"]),H=l=>{const n=l.match(/(?:file_path|Wrote file|Edited file)[:\s]*["']?([^\s"',]+)/i);if(n){const o=n[1];return o.split("/").pop()||o}return null},K=(l,n)=>{const o=n-l;if(o<0)return"";const e=Math.floor(o/1e3);if(e<60)return`${e}s`;const i=Math.floor(e/60);return i<60?`${i}m ${e%60}s`:`${Math.floor(i/60)}h ${i%60}m`},U=l=>{var p,j;let n=0,o=0,e=0,i=0,y=!1,x=0,d="";const h=new Set;let u=0,t=0;for(const a of l){const c=a.createdAt?new Date(a.createdAt).getTime():0;if(c>0&&(u===0||c<u)&&(u=c),c>t&&(t=c),a.isCompressed){y=!0,x++;continue}if(a.role==="user"&&!("type"in a&&a.type==="file_reference")&&n++,a.role==="assistant"){if("type"in a&&a.type==="tool_call"&&(e+=((p=a.toolCalls)==null?void 0:p.length)??0),"type"in a&&a.type==="tool_result"){const m=a;if(m.isError&&i++,P.has(m.toolName)){const f=H(((j=m.result)==null?void 0:j.result)??"");f&&h.add(f)}}if("type"in a&&a.type==="text"){o++;const m=a.content||"";m.length>0&&m.length>30&&(d=m.slice(0,300))}}}return{messageCount:l.length,userMessageCount:n,assistantMessageCount:o,toolCallCount:e,toolErrorCount:i,fileChanges:Array.from(h).slice(0,10),lastAssistantExcerpt:d,hasCompression:y,compressionCount:x,duration:u>0&&t>u?K(u,t):""}},Z=({sessionId:l,compact:n=!1})=>{const{t:o}=M(),{token:e}=B.useToken(),[i,y]=S.useState(!1),[x,d]=S.useState(()=>N.get(l)),h=w(I(l)),u=h==null?void 0:h.messages,t=S.useMemo(()=>!u||u.length===0?null:U(u),[u]);if(S.useEffect(()=>{let r=!1;const g=N.get(l);return g!==void 0?(d(g),()=>{r=!0}):(d(void 0),A.getSessionDetail(l).then(C=>{if(r)return;const E=(C==null?void 0:C.session)??null;N.set(l,E),d(E)},()=>{r||(N.set(l,null),d(null))}),()=>{r=!0})},[l]),!t||t.messageCount<3)return null;const p=t.fileChanges.length>0,j=t.lastAssistantExcerpt.length>0,a=n&&p?t.fileChanges:[],c=x==null?void 0:x.total_token_usage,m=c?b(c.total_tokens):null,f=c?s.jsxs("div",{style:{minWidth:180},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:4},children:o("sessionSummary.totalTokens","Total tokens")}),s.jsxs("div",{children:[o("sessionSummary.promptTokens","Prompt"),":"," ",T(c.prompt_tokens)]}),s.jsxs("div",{children:[o("sessionSummary.completionTokens","Completion"),":"," ",T(c.completion_tokens)]}),s.jsxs("div",{children:[o("sessionSummary.totalTokens","Total tokens"),":"," ",T(c.total_tokens)]})]}):null;return s.jsxs("div",{className:`lotus-session-summary ${n?"lotus-session-summary--compact":""}`,style:{borderColor:e.colorBorderSecondary,background:`${e.colorBgElevated}`},children:[s.jsxs("div",{className:"lotus-session-summary-header",onClick:()=>y(r=>!r),role:"button",tabIndex:0,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),y(g=>!g))},"aria-expanded":i,children:[s.jsx("span",{className:"lotus-session-summary-header-icon",style:{color:e.colorPrimary},children:s.jsx(D,{})}),s.jsx("span",{className:"lotus-session-summary-header-title",style:{color:e.colorText},children:o("sessionSummary.title","Session Summary")}),!i&&s.jsxs("span",{className:"lotus-session-summary-stats",children:[s.jsxs("span",{className:"lotus-session-summary-stat",style:{color:e.colorTextSecondary},children:[s.jsx($,{className:"lotus-session-summary-stat-icon"}),s.jsx("span",{className:"lotus-session-summary-stat-value",children:t.messageCount})]}),t.toolCallCount>0&&s.jsxs("span",{className:"lotus-session-summary-stat",style:{color:e.colorTextSecondary},children:[s.jsx(R,{className:"lotus-session-summary-stat-icon"}),s.jsx("span",{className:"lotus-session-summary-stat-value",children:t.toolCallCount})]}),p&&s.jsxs("span",{className:"lotus-session-summary-stat",style:{color:e.colorTextSecondary},children:[s.jsx(_,{className:"lotus-session-summary-stat-icon"}),s.jsx("span",{className:"lotus-session-summary-stat-value",children:t.fileChanges.length})]}),m&&s.jsx(v,{title:f,children:s.jsxs("span",{className:"lotus-session-summary-stat",style:{color:e.colorTextSecondary},children:[s.jsx(k,{className:"lotus-session-summary-stat-icon"}),s.jsx("span",{className:"lotus-session-summary-stat-value",children:m})]})})]}),s.jsx("span",{className:`lotus-session-summary-toggle ${i?"is-expanded":""}`,style:{color:e.colorTextTertiary},children:s.jsx(F,{})})]}),i&&s.jsxs("div",{className:"lotus-session-summary-body",children:[s.jsxs("div",{className:"lotus-session-summary-stats",children:[s.jsxs("span",{className:"lotus-session-summary-stat",style:{color:e.colorTextSecondary},children:[s.jsx($,{className:"lotus-session-summary-stat-icon"}),s.jsxs("span",{children:[s.jsx("span",{className:"lotus-session-summary-stat-value",children:t.messageCount})," ",o("sessionSummary.messages","messages")]})]}),s.jsxs("span",{className:"lotus-session-summary-stat",style:{color:e.colorTextSecondary},children:[s.jsx("span",{className:"lotus-session-summary-stat-icon",children:"👤"}),s.jsxs("span",{children:[s.jsx("span",{className:"lotus-session-summary-stat-value",children:t.userMessageCount})," ",o("sessionSummary.userTurns","user")]})]}),s.jsxs("span",{className:"lotus-session-summary-stat",style:{color:e.colorTextSecondary},children:[s.jsx("span",{className:"lotus-session-summary-stat-icon",children:"🤖"}),s.jsxs("span",{children:[s.jsx("span",{className:"lotus-session-summary-stat-value",children:t.assistantMessageCount})," ",o("sessionSummary.assistantTurns","assistant")]})]}),t.toolCallCount>0&&s.jsxs("span",{className:"lotus-session-summary-stat",style:{color:e.colorTextSecondary},children:[s.jsx(R,{className:"lotus-session-summary-stat-icon"}),s.jsxs("span",{children:[s.jsx("span",{className:"lotus-session-summary-stat-value",children:t.toolCallCount})," ",o("sessionSummary.toolCalls","tool calls")]})]}),t.toolErrorCount>0&&s.jsxs("span",{className:"lotus-session-summary-stat",style:{color:"#ff4d4f"},children:[s.jsx(L,{className:"lotus-session-summary-stat-icon"}),s.jsxs("span",{children:[s.jsx("span",{className:"lotus-session-summary-stat-value",children:t.toolErrorCount})," ",o("sessionSummary.errors","errors")]})]}),t.duration&&s.jsxs("span",{className:"lotus-session-summary-stat",style:{color:e.colorTextSecondary},children:[s.jsx(z,{className:"lotus-session-summary-stat-icon"}),s.jsx("span",{children:t.duration})]}),t.hasCompression&&s.jsxs("span",{className:"lotus-session-summary-stat",style:{color:e.colorTextSecondary},children:[s.jsx(k,{className:"lotus-session-summary-stat-icon"}),s.jsxs("span",{children:[s.jsx("span",{className:"lotus-session-summary-stat-value",children:t.compressionCount})," ",o("sessionSummary.compressions","compressions")]})]}),m&&s.jsx(v,{title:f,children:s.jsxs("span",{className:"lotus-session-summary-stat",style:{color:e.colorTextSecondary},children:[s.jsx(k,{className:"lotus-session-summary-stat-icon"}),s.jsxs("span",{children:[s.jsx("span",{className:"lotus-session-summary-stat-value",children:m})," ",o("sessionSummary.totalTokens","total tokens")]})]})})]}),p&&s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:n?10:11,fontWeight:600,color:e.colorTextSecondary,marginBottom:n?2:4,textTransform:"uppercase",letterSpacing:.3},children:o("sessionSummary.filesChanged","Files Changed")}),n?s.jsx(W,{items:a,style:{lineHeight:1.4,wordBreak:"break-word",whiteSpace:"normal"}}):s.jsx("div",{className:"lotus-session-summary-files",children:t.fileChanges.map(r=>s.jsx(v,{title:r,children:s.jsxs(O,{bordered:!1,className:"lotus-session-summary-file-tag",children:[s.jsx(_,{style:{marginRight:4}}),r]})},r))})]}),j&&s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:n?10:11,fontWeight:600,color:e.colorTextSecondary,marginBottom:n?2:4,textTransform:"uppercase",letterSpacing:.3},children:o("sessionSummary.lastResponse","Latest Response")}),s.jsx("div",{className:"lotus-session-summary-conclusion",style:{color:e.colorTextSecondary},children:t.lastAssistantExcerpt})]})]})]})};export{Z as SessionSummaryCard,Z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,M as E,r as F,h as H}from"./vendor-markdown-teEfNS9t.js";import{i as I,u as R,a as p}from"./vendor-i18n-Dm-c3D_C.js";import{o as y,B as v,U as X,j as B,J as Y,n as A,x as f,aq as q,ar as J,as as N,at as O,a5 as U,Y as K,N as Q,t as V}from"./vendor-antd-qu012Od4.js";import{D as W,u as z,F as Z}from"./App-ByVdg3-E.js";import"./vendor-mermaid-DvB2TuRQ.js";import"./main-C4wmVzw7.js";const _=({buttons:r,className:e,style:g,size:l="middle",align:n="right"})=>{const h={className:e,style:{width:"100%",justifyContent:n==="left"?"flex-start":n==="center"?"center":"flex-end",...g}};return t.jsx(y,{...h,children:r.map(a=>t.jsx(v,{type:a.type||"default",disabled:a.disabled,loading:a.loading,danger:a.danger,onClick:a.onClick,size:l,icon:a.icon,children:a.text},a.key))})},k=(r,e)=>({key:"cancel",text:e||I.t("common.cancel"),type:"default",onClick:r}),ee=(r,e)=>({key:"ok",text:(e==null?void 0:e.text)||I.t("common.ok"),type:"primary",disabled:e==null?void 0:e.disabled,loading:e==null?void 0:e.loading,onClick:r}),{Text:b,Paragraph:te}=B,re=({content:r,token:e,showGradient:g,onClick:l})=>t.jsx(X,{size:"small",style:{marginLeft:e.marginLG,marginTop:e.marginXS,backgroundColor:e.colorBgLayout,borderColor:e.colorBorderSecondary},styles:{body:{padding:e.paddingMD}},onClick:l,children:t.jsxs("div",{style:{maxHeight:"60vh",overflowY:"auto",position:"relative",paddingRight:e.paddingXS},children:[t.jsx(E,{remarkPlugins:[F],components:{p:({children:n})=>t.jsx(te,{style:{marginBottom:e.marginSM},children:n}),ol:({children:n})=>t.jsx("ol",{style:{marginBottom:e.marginSM,paddingLeft:e.paddingLG},children:n}),ul:({children:n})=>t.jsx("ul",{style:{marginBottom:e.marginSM,paddingLeft:e.paddingLG},children:n}),li:({children:n})=>t.jsx("li",{style:{marginBottom:e.marginXS},children:n}),h1:({children:n})=>t.jsx(b,{strong:!0,style:{fontSize:e.fontSizeHeading3,marginBottom:e.marginSM,display:"block"},children:n}),h2:({children:n})=>t.jsx(b,{strong:!0,style:{fontSize:e.fontSizeHeading4,marginBottom:e.marginSM,display:"block"},children:n}),code:({inline:n,className:h,children:a,...i})=>{const o=/language-(\w+)/.exec(h||"");return n?t.jsx("code",{className:h,style:{backgroundColor:e.colorFillTertiary,padding:"0 4px",borderRadius:e.borderRadiusSM,fontSize:e.fontSizeSM},...i,children:a}):t.jsx(H,{style:W,language:(o==null?void 0:o[1])||"text",PreTag:"div",wrapLongLines:!0,children:String(a).replace(/\n$/,"")})}},children:r||"No content available."}),g?t.jsx("div",{style:{position:"sticky",bottom:0,height:48,background:`linear-gradient(180deg, transparent, ${e.colorBgLayout})`,pointerEvents:"none",marginTop:-48}}):null]})}),{Text:L,Paragraph:se}=B,ne=({prompt:r,token:e,isSelected:g,isExpanded:l,onSelect:n,onToggleExpand:h,onCopy:a})=>{const{t:i}=R(),o=r.content||"",{nonEmptyLineCount:j,wordCount:u,characterCount:P,showGradient:x}=p.useMemo(()=>{const S=(o?o.split(/\r?\n/):[]).filter(w=>w.trim().length>0).length,C=o.trim()?o.trim().split(/\s+/).filter(Boolean).length:0,m=o.length;return{nonEmptyLineCount:S,wordCount:C,characterCount:m,showGradient:!l&&m>600}},[o,l]);return t.jsx(Y.Item,{style:{cursor:"pointer",padding:e.paddingMD,borderRadius:e.borderRadius,border:g?`2px solid ${e.colorPrimary}`:`1px solid ${e.colorBorderSecondary}`,marginBottom:e.marginXS,backgroundColor:g?e.colorPrimaryBg:e.colorBgContainer,transition:"all 0.2s ease"},onClick:()=>n(r.id),children:t.jsxs(y,{direction:"vertical",style:{width:"100%"},size:e.marginSM,children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",width:"100%",gap:e.marginSM},children:[t.jsxs(y,{align:"start",children:[t.jsx(A,{checked:g,onChange:()=>n(r.id),onClick:c=>c.stopPropagation()}),t.jsxs("div",{children:[t.jsx(L,{strong:!0,children:r.name||r.id}),t.jsx("div",{children:t.jsx(L,{code:!0,style:{fontSize:e.fontSizeSM,color:e.colorTextSecondary},children:r.id})})]}),r.isDefault?t.jsx(f,{color:"warning",children:i("chat.systemPromptSelector.defaultTag")}):null]}),t.jsxs(y,{size:"small",children:[t.jsx(v,{type:"text",size:"small",icon:l?t.jsx(q,{}):t.jsx(J,{}),onClick:c=>{c.stopPropagation(),h(r.id)},children:i(l?"chat.systemPromptSelector.hide":"chat.systemPromptSelector.preview")}),t.jsx(v,{type:"text",size:"small",icon:t.jsx(N,{}),onClick:c=>a(c,r),children:i("chat.systemPromptSelector.copy")})]})]}),r.description?t.jsx(L,{type:"secondary",style:{marginLeft:e.marginLG,fontSize:e.fontSizeSM},children:r.description}):null,t.jsxs(y,{size:"small",wrap:!0,style:{marginLeft:e.marginLG},children:[t.jsx(f,{color:"processing",children:i("chat.systemPromptSelector.lines",{count:j})}),t.jsx(f,{color:"purple",children:i("chat.systemPromptSelector.words",{count:u})}),t.jsx(f,{color:"success",children:i("chat.systemPromptSelector.chars",{count:P})})]}),l?t.jsx(re,{content:o,token:e,showGradient:x,onClick:c=>c.stopPropagation()}):t.jsx(se,{type:"secondary",ellipsis:{rows:3},style:{marginLeft:e.marginLG,marginBottom:0,color:e.colorTextSecondary},children:o||i("chat.systemPromptSelector.noContent")})]})},r.id)},{Text:ae}=B,{useToken:ie}=V,he=({open:r,onClose:e,onSelect:g,prompts:l,title:n,showCancelButton:h=!0})=>{const{t:a}=R(),{token:i}=ie(),[o,j]=O.useMessage(),u=z(s=>s.lastSelectedPromptId),P=z(s=>s.setLastSelectedPromptId),[x,c]=p.useState(null),[S,C]=p.useState(null),m=p.useMemo(()=>l.filter(s=>s.id&&s.id.trim()!==""),[l]),w=async(s,d)=>{s.stopPropagation();const M=d.content??"";try{await Z(M),o.success(a("success.promptCopied",{name:d.name}))}catch(D){console.error("[SystemPromptSelector] Failed to copy prompt:",D),o.error(a("error.copyPromptFailed"))}},G=n??a("chat.prompt.selectorTitle");p.useEffect(()=>{if(r){const s=m.find(M=>M.isDefault),d=u||(s==null?void 0:s.id)||(m.length>0?m[0].id:null);c(d)}},[r,u,m.length]);const $=s=>{c(s.id),P(s.id),g(s),e()},T=()=>{e()};return t.jsxs(t.Fragment,{children:[j,t.jsxs(U,{title:t.jsxs(y,{children:[t.jsx(Q,{}),G]}),open:r,onCancel:T,width:700,footer:t.jsx(_,{buttons:[...h?[k(T)]:[],ee(()=>{const s=m.find(d=>d.id===x);s&&$(s)},{text:a("chat.prompt.createButton"),disabled:!x})]}),styles:{body:{maxHeight:"70vh",overflowY:"auto",padding:i.paddingMD}},children:[t.jsx("div",{style:{marginBottom:i.marginMD},children:t.jsx(ae,{type:"secondary",style:{fontSize:i.fontSizeSM},children:a("chat.prompt.helperText")})}),m.length===0?t.jsx(K,{description:a("chat.prompt.emptyDescription"),style:{margin:i.marginLG}}):t.jsx("div",{children:m.map(s=>t.jsx(ne,{prompt:s,token:i,isSelected:x===s.id,isExpanded:S===s.id,onSelect:d=>c(d),onToggleExpand:d=>C(S===d?null:d),onCopy:w},s.id))})]})]})};export{he as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./vendor-markdown-
|
|
1
|
+
import{j as s}from"./vendor-markdown-teEfNS9t.js";import{u as g,a as c,i as m}from"./vendor-i18n-Dm-c3D_C.js";import{u as p,g as y,E as T}from"./App-ByVdg3-E.js";import{t as v,ag as S,ah as R,F as w,W as k,Z as A,ad as I,x as b,G as M}from"./vendor-antd-qu012Od4.js";import"./vendor-mermaid-DvB2TuRQ.js";import"./main-C4wmVzw7.js";const C=5,D=5,$=5,E=o=>{if(!o)return"";try{const n=Date.now()-new Date(o).getTime();if(n<0)return"";const t=Math.floor(n/1e3);if(t<60)return m.t("chat.home.justNow");const l=Math.floor(t/60);if(l<60)return m.t("chat.home.minutesAgo",{count:l});const i=Math.floor(l/60);if(i<24)return m.t("chat.home.hoursAgo",{count:i});const r=Math.floor(i/24);return r<30?m.t("chat.home.daysAgo",{count:r}):new Date(o).toLocaleDateString()}catch{return""}},P=(o,n)=>n?"is-running":o.lastRunStatus==="error"?"is-error":o.pinned?"is-pinned":"is-idle",x=({chat:o,onOpen:n,textSecondary:t})=>{const{t:l}=g(),i=p(y(o.id)),r=o.config.workspacePath?o.config.workspacePath.split("/").pop()||o.config.workspacePath:null;return s.jsxs("button",{type:"button",className:"lotus-home-session-item",onClick:()=>n(o.id),children:[s.jsx("span",{className:`lotus-home-session-status ${P(o,i)}`}),s.jsxs("span",{className:"lotus-home-session-content",children:[s.jsx("span",{className:"lotus-home-session-title",children:o.title}),s.jsxs("span",{className:"lotus-home-session-meta",style:{color:t},children:[s.jsx("span",{children:E(o.updatedAt)}),r?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lotus-home-session-meta-sep"}),s.jsxs("span",{children:[s.jsx(A,{style:{marginRight:3}}),r]})]}):null,o.messageCount!=null?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lotus-home-session-meta-sep"}),s.jsxs("span",{children:[s.jsx(I,{style:{marginRight:3}}),o.messageCount]})]}):null]})]}),i?s.jsx(b,{color:"green",bordered:!1,style:{margin:0,fontSize:11},children:l("chat.home.running")}):null,s.jsx(M,{className:"lotus-home-session-arrow"})]})},L=({onOpenSession:o})=>{const{t:n}=g(),{token:t}=v.useToken(),l=p(e=>e.chats),i=c.useCallback(e=>y(e)(p.getState()),[]),r=c.useMemo(()=>l.filter(e=>i(e.id)).slice(0,D),[l,i]),d=c.useMemo(()=>l.filter(e=>e.pinned&&!i(e.id)).slice(0,$),[l,i]),j=c.useMemo(()=>{const e=new Set(r.map(a=>a.id)),f=new Set(d.map(a=>a.id));return l.filter(a=>a.kind!=="child"&&!e.has(a.id)&&!f.has(a.id)).sort((a,h)=>{const N=a.updatedAt?new Date(a.updatedAt).getTime():a.createdAt;return(h.updatedAt?new Date(h.updatedAt).getTime():h.createdAt)-N}).slice(0,C)},[l,r,d]),u=c.useCallback(e=>{o(e)},[o]);return s.jsx("div",{className:"lotus-home-dashboard",children:s.jsxs("div",{className:"lotus-home-dashboard-inner",children:[s.jsxs("div",{className:"lotus-home-header",children:[s.jsx("span",{className:"lotus-home-header-icon",style:{background:`${t.colorPrimary}15`,color:t.colorPrimary},children:s.jsx(S,{})}),s.jsxs("div",{className:"lotus-home-header-text",children:[s.jsx("h2",{style:{color:t.colorText},children:n("home.title","Welcome to Bodhi")}),s.jsx("p",{style:{color:t.colorTextSecondary},children:n("home.subtitle","Here's an overview of your workspace.")})]})]}),s.jsx("div",{className:"lotus-home-launcher-shell","data-tour-id":"task-templates",children:s.jsx(T,{embedded:!0,layoutMode:"staggered"})}),s.jsxs("div",{className:"lotus-home-secondary-sections",children:[r.length>0?s.jsxs("div",{className:"lotus-home-section",children:[s.jsxs("div",{className:"lotus-home-section-title",style:{color:t.colorTextSecondary},children:[s.jsx(R,{className:"lotus-home-section-icon",style:{color:t.colorSuccess}}),s.jsx("span",{children:n("home.sections.running","Running Now")})]}),s.jsx("div",{className:"lotus-home-session-list",children:r.map(e=>s.jsx(x,{chat:e,onOpen:u,textSecondary:t.colorTextTertiary},e.id))})]}):null,d.length>0?s.jsxs("div",{className:"lotus-home-section",children:[s.jsxs("div",{className:"lotus-home-section-title",style:{color:t.colorTextSecondary},children:[s.jsx(w,{className:"lotus-home-section-icon",style:{color:"var(--lotus-gold)"}}),s.jsx("span",{children:n("home.sections.pinned","Pinned")})]}),s.jsx("div",{className:"lotus-home-session-list",children:d.map(e=>s.jsx(x,{chat:e,onOpen:u,textSecondary:t.colorTextTertiary},e.id))})]}):null,j.length>0?s.jsxs("div",{className:"lotus-home-section",children:[s.jsxs("div",{className:"lotus-home-section-title",style:{color:t.colorTextSecondary},children:[s.jsx(k,{className:"lotus-home-section-icon"}),s.jsx("span",{children:n("home.sections.recent","Recent Sessions")})]}),s.jsx("div",{className:"lotus-home-session-list",children:j.map(e=>s.jsx(x,{chat:e,onOpen:u,textSecondary:t.colorTextTertiary},e.id))})]}):null,l.length===0?s.jsx("div",{className:"lotus-home-empty-hint",style:{color:t.colorTextTertiary},children:n("home.empty","No sessions yet. Create one to get started!")}):null]})]})})};export{L as HomeDashboard,L as default};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{j as
|
|
1
|
+
import{j as i}from"./vendor-markdown-teEfNS9t.js";import{R as ye,u as ve,a as r}from"./vendor-i18n-Dm-c3D_C.js";import{u as T,b as xe,s as Ee,c as he,d as j,r as qe,e as Ce,f as Se,g as Re,a as Y,h as A,C as L}from"./App-ByVdg3-E.js";/* empty css */import{A as we,j as ke,B as Z,k as be,l as Te,n as F,o as ee,p as je,t as De}from"./vendor-antd-qu012Od4.js";import"./vendor-mermaid-DvB2TuRQ.js";import"./main-C4wmVzw7.js";const a={questionCard:"qd-questionCard",questionHeader:"qd-questionHeader",headerLeft:"qd-headerLeft",questionIcon:"qd-questionIcon",questionText:"qd-questionText",collapseBtn:"qd-collapseBtn",questionBody:"qd-questionBody",optionsGroup:"qd-optionsGroup",optionItem:"qd-optionItem",customHint:"qd-customHint",questionFooter:"qd-questionFooter"},{Text:D}=ke,{useToken:Ne}=De,Be=n=>{const f=(n||"").replace(/\\r\\n/g,`
|
|
2
2
|
`).replace(/\\n/g,`
|
|
3
3
|
`).replace(/\r\n?/g,`
|
|
4
4
|
`).trim();return f?f.includes(`
|
|
5
5
|
`)?f:f.replace(/\s+(?=\d+[).]\s)/g,`
|
|
6
6
|
`).replace(/\s+(?=[一二三四五六七八九十]+[、.]\s)/g,`
|
|
7
7
|
`).replace(/\s+(?=[-*•]\s)/g,`
|
|
8
|
-
`):""};const te=({sessionId:n,onResponseSubmitted:f,onQuestionAppeared:H})=>{const{t:x}=ve(),{token:E}=Ne(),{message:N}=we.useApp(),[g,q]=r.useState(null),[B,z]=r.useState(!1),[ne,_]=r.useState(!0),[w,k]=r.useState(!1),u=r.useRef(0),p=r.useRef(0),m=r.useRef(null),c=r.useRef(null),h=r.useRef(0),b=r.useRef(H);b.current=H;const C=r.useCallback(()=>{h.current+=1,h.current},[n]),[P,oe]=r.useState(()=>typeof document>"u"?!0:!document.hidden),{markRespondStart:re,markSettleTimeout:G,applyExecutionStarted:le,setPendingQuestion:M,clearPendingQuestion:S,sessionModelRef:y,sessionReasoningEffort:
|
|
8
|
+
`):""};const te=({sessionId:n,onResponseSubmitted:f,onQuestionAppeared:H})=>{const{t:x}=ve(),{token:E}=Ne(),{message:N}=we.useApp(),[g,q]=r.useState(null),[B,z]=r.useState(!1),[ne,_]=r.useState(!0),[w,k]=r.useState(!1),u=r.useRef(0),p=r.useRef(0),m=r.useRef(null),c=r.useRef(null),h=r.useRef(0),b=r.useRef(H);b.current=H;const C=r.useCallback(()=>{h.current+=1,h.current},[n]),[P,oe]=r.useState(()=>typeof document>"u"?!0:!document.hidden),{markRespondStart:re,markSettleTimeout:G,applyExecutionStarted:le,setPendingQuestion:M,clearPendingQuestion:S,sessionModelRef:y,sessionReasoningEffort:ie,inputReasoningEffort:se,isCurrentSession:I}=T(xe(e=>{var l,s,d,X;const t=n?e.chats.find(ge=>ge.id===n)??null:null;return{markRespondStart:e.markRespondStart,markSettleTimeout:e.markSettleTimeout,applyExecutionStarted:e.applyExecutionStarted,setPendingQuestion:e.setPendingQuestion,clearPendingQuestion:e.clearPendingQuestion,sessionModelRef:((l=t==null?void 0:t.config)==null?void 0:l.model_ref)??null,sessionReasoningEffort:((s=t==null?void 0:t.config)==null?void 0:s.reasoningEffort)??null,inputReasoningEffort:n?((X=(d=e.inputStates)==null?void 0:d[n])==null?void 0:X.reasoningEffort)??null:null,isCurrentSession:e.currentSessionId===n}})),o=T(Ee(n)),R=he(y),O=j(e=>e.currentProvider),V=j(e=>e.providerConfig),$=j(e=>e.providerInstances),ue=r.useMemo(()=>qe(V,R,(y==null?void 0:y.provider)??O,$),[R,y==null?void 0:y.provider,V,O,$]),ae=r.useMemo(()=>n?Ce(n):void 0,[n]),ce=Se({sessionEffort:ie,inputEffort:se,persistedEffort:ae,providerDefault:ue}),v=r.useCallback(()=>{var t,l;const e=(t=T.getState().executionBySession)==null?void 0:t[n];return e?{phase:e.phase,generation:e.generation,backendRunId:e.backendRunId??null,backendIsRunning:e.backend.isRunning,hasPendingQuestion:e.interaction.pendingQuestion!=null,pendingQuestionToolCallId:((l=e.interaction.pendingQuestion)==null?void 0:l.toolCallId)??null,tokenCount:e.stream.tokenCount,hasTokens:e.stream.hasTokens,activeReasons:e.activeReasons}:null},[n]),K=T(Re(n)),U=r.useCallback(async()=>{const e=h.current;try{const t=await Y.get(`respond/${n}/pending`);if(e!==h.current)return;if(t.has_pending_question){const l={question:t.question??"",options:t.options??[],allowCustom:t.allow_custom??!0,toolCallId:t.tool_call_id??null},s=A({sessionId:n,...l});if(c.current===s){u.current=0,p.current=0;return}c.current=null,M(n,l),u.current=0,p.current=0}else c.current=null,S(n),m.current=null,u.current+=1,u.current>=6?p.current=2:u.current>=2&&(p.current=1)}catch(t){if(e!==h.current)return;if(t instanceof Error&&t.message.includes("404")){c.current=null,S(n),m.current=null,u.current+=1;return}c.current=null,S(n),m.current=null,u.current+=1,u.current>=6?p.current=2:u.current>=2&&(p.current=1),console.error("Failed to fetch pending question:",t)}finally{if(e!==h.current)return;_(!1)}},[n,M,S]);r.useEffect(()=>{C(),u.current=0,p.current=0,m.current=null,c.current=null,_(!0),q(null),k(!1)},[n,C]),r.useEffect(()=>{if(typeof document>"u")return;const e=()=>{oe(!document.hidden)};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),r.useEffect(()=>{var e;if(o){const t=A({sessionId:n,question:o.question,options:o.options,allowCustom:o.allowCustom,toolCallId:o.toolCallId});m.current===t||(q(null),k(!1),(e=b.current)==null||e.call(b)),m.current=t,c.current!==null&&c.current!==t&&(c.current=null)}else m.current=null},[n,o,o==null?void 0:o.allowCustom,o==null?void 0:o.options,o==null?void 0:o.question,o==null?void 0:o.toolCallId]);const W=r.useCallback(()=>{if(o)return null;if(K)return I?P?5e3:15e3:null;if(!I||!P)return null;const e=p.current;return e===0?3e4:e===1?6e4:12e4},[o,K,I,P]);r.useEffect(()=>{if(o){_(!1);return}let e=!1,t=null;const l=async()=>{if(e||B||(await U(),e))return;const s=W();s!==null&&(t=setTimeout(l,s))};return l(),()=>{e=!0,t&&clearTimeout(t)}},[o,U,W,B]),r.useEffect(()=>{if(typeof window>"u")return;const e=t=>{var d;const s=((d=t.detail)==null?void 0:d.sessionId)??null;!s||s!==n||(v(),C(),q(null),m.current=null,u.current=0)};return window.addEventListener(L,e),()=>{window.removeEventListener(L,e)}},[n,C,v]);const de=r.useCallback(e=>{q(e)},[]),fe=async()=>{if(!g||g==="custom"){N.warning(x("components.questionDialog.selectOptionWarning"));return}z(!0),o==null||o.toolCallId,v(),C();const e=re(n,(o==null?void 0:o.toolCallId)??null);v(),await new Promise(t=>setTimeout(t,0));try{const t={};j.getState().isProviderModelRefEnabled()&&R&&(t.model_ref=R,t.provider=R.provider);const l=await Y.post(`respond/${n}`,{response:g,reasoning_effort:ce,...t});v(),N.success(x("components.questionDialog.responseSubmitted")),c.current=o?A({sessionId:n,question:o.question,options:o.options,allowCustom:o.allowCustom,toolCallId:o.toolCallId}):null,q(null),u.current=0,S(n),typeof window<"u"&&window.dispatchEvent(new CustomEvent(L,{detail:{sessionId:n}}));const s=l==null?void 0:l.auto_resume_status,d=l==null?void 0:l.run_id;v(),s==="started"||s==="already_running"?(le(n,d??"",e),v(),void 0):(s==="error"||!s)&&(console.error("[QuestionDialog] Failed to auto-resume agent execution"),G(n)),f==null||f()}catch(t){console.error("Failed to submit response:",t),N.error(t instanceof Error?t.message:x("components.questionDialog.submitFailed")),G(n)}finally{z(!1)}};if(ne||!o)return null;const{question:pe,options:Q,allowCustom:me}=o,J=Be(pe);return i.jsxs("div",{className:a.questionCard,style:{background:E.colorBgContainer,borderColor:E.colorBorderSecondary,border:`1px solid ${E.colorBorderSecondary}`},children:[i.jsxs("div",{className:a.questionHeader,"data-collapsed":w?"true":"false",onClick:()=>k(e=>!e),role:"button",tabIndex:0,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&k(t=>!t)},children:[i.jsxs("span",{className:a.headerLeft,children:[i.jsx("span",{className:a.questionIcon,children:"🤔"}),i.jsx(D,{strong:!0,className:a.questionText,style:{color:E.colorPrimary,whiteSpace:"pre-wrap"},title:w?J:void 0,children:J})]}),i.jsx(Z,{type:"text",size:"small",icon:w?i.jsx(be,{}):i.jsx(Te,{}),className:a.collapseBtn,tabIndex:-1})]}),!w&&i.jsxs("div",{className:a.questionBody,children:[i.jsx(F.Group,{className:a.optionsGroup,value:g,onChange:e=>de(e.target.value),children:i.jsxs(ee,{direction:"vertical",size:4,style:{width:"100%"},children:[Q==null?void 0:Q.map(e=>i.jsx(F,{value:e,className:a.optionItem,children:i.jsx(D,{style:{color:E.colorText},children:e})},e)),me&&i.jsx(F,{value:"custom",className:a.optionItem,children:i.jsxs(ee,{size:4,children:[i.jsx(je,{}),i.jsx(D,{style:{color:E.colorText},children:x("components.questionDialog.otherTypeBelow")})]})})]})}),g==="custom"&&i.jsx("div",{className:a.customHint,children:i.jsx(D,{type:"secondary",style:{fontSize:12},children:x("components.questionDialog.customAnswerTip")})}),g&&g!=="custom"&&i.jsx("div",{className:a.questionFooter,children:i.jsx(Z,{type:"primary",size:"small",onClick:fe,loading:B,children:x("components.questionDialog.confirm")})})]})]})};te.displayName="QuestionDialog";const _e=ye.memo(te);_e.displayName="QuestionDialog";export{_e as QuestionDialog,_e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"./vendor-markdown-teEfNS9t.js";import{u as b,a as x}from"./vendor-i18n-Dm-c3D_C.js";import{u as i}from"./App-ByVdg3-E.js";import{A as w,a1 as n,B as l,a2 as T,J as c,x as R,p as k,a3 as v,a4 as C,a5 as E,a6 as d}from"./vendor-antd-qu012Od4.js";import"./vendor-mermaid-DvB2TuRQ.js";import"./main-C4wmVzw7.js";const V=()=>{const{t:s}=b(),{message:a}=w.useApp(),f=i(e=>e.systemPrompts),P=i(e=>e.addSystemPrompt),j=i(e=>e.updateSystemPrompt),M=i(e=>e.deleteSystemPrompt),[h,u]=x.useState(!1),[r,p]=x.useState(null),[o]=n.useForm(),g=(e=null)=>{if(e!=null&&e.isDefault){a.warning(s("settings.systemPromptManager.defaultPromptLocked"));return}p(e),o.setFieldsValue(e||{name:"",description:"",content:""}),u(!0)},y=()=>{u(!1),p(null),o.resetFields()},S=async()=>{if(r!=null&&r.isDefault){a.warning(s("settings.systemPromptManager.defaultPromptLocked"));return}try{const e=await o.validateFields();r?(await j({...r,...e}),a.success(s("settings.systemPromptManager.updateSuccess"))):(await P(e),a.success(s("settings.systemPromptManager.addSuccess"))),y()}catch(e){console.error("Failed to save prompt:",e),a.error(e instanceof Error?e.message:s("settings.systemPromptManager.saveError"))}},I=async e=>{try{await M(e),a.success(s("settings.systemPromptManager.deleteSuccess"))}catch(m){console.error("Failed to delete prompt:",m),a.error(m instanceof Error?m.message:s("settings.systemPromptManager.deleteError"))}};return t.jsxs("div",{children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[t.jsx("h2",{children:s("settings.systemPromptManager.title")}),t.jsx(l,{type:"primary",icon:t.jsx(T,{}),onClick:()=>g(),children:s("settings.systemPromptManager.addButton")})]}),t.jsx(c,{itemLayout:"horizontal",dataSource:f,renderItem:e=>t.jsxs(c.Item,{actions:[e.isDefault?null:t.jsx(l,{type:"text",icon:t.jsx(k,{}),onClick:()=>g(e)}),e.isDefault?null:t.jsx(v,{title:s("settings.systemPromptManager.deleteConfirm"),onConfirm:()=>I(e.id),okText:s("common.yes"),cancelText:s("common.no"),children:t.jsx(l,{type:"text",danger:!0,icon:t.jsx(C,{}),"aria-label":s("common.delete")})})],children:[t.jsx(c.Item.Meta,{title:e.name,description:e.description||e.content.substring(0,200)+(e.content.length>200?"...":"")}),e.isDefault&&t.jsx(R,{children:s("settings.systemPromptManager.defaultTag")})]})}),t.jsx(E,{title:s(r?"settings.systemPromptManager.editTitle":"settings.systemPromptManager.addTitle"),open:h,onOk:S,onCancel:y,width:"60%",forceRender:!0,children:t.jsxs(n,{form:o,layout:"vertical",name:"system_prompt_form",children:[t.jsx(n.Item,{name:"name",label:s("settings.systemPromptManager.nameLabel"),rules:[{required:!0,message:s("settings.systemPromptManager.nameRequired")}],children:t.jsx(d,{})}),t.jsx(n.Item,{name:"description",label:s("settings.systemPromptManager.descriptionLabel"),rules:[{required:!1,message:s("settings.systemPromptManager.descriptionRequired")}],children:t.jsx(d.TextArea,{rows:3})}),t.jsx(n.Item,{name:"content",label:s("settings.systemPromptManager.contentLabel"),rules:[{required:!0,message:s("settings.systemPromptManager.contentRequired")}],children:t.jsx(d.TextArea,{rows:10})})]})})]})};export{V as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./vendor-markdown-teEfNS9t.js";import{R as S,u as A,a as N}from"./vendor-i18n-Dm-c3D_C.js";import{u as q,i as T,j as B}from"./App-ByVdg3-E.js";/* empty css */import{A as w,j as b,o as I,B as g,q as D,u as F,t as k}from"./vendor-antd-qu012Od4.js";import"./vendor-mermaid-DvB2TuRQ.js";import"./main-C4wmVzw7.js";const s={questionCard:"qd-questionCard",questionHeader:"qd-questionHeader",headerLeft:"qd-headerLeft",questionIcon:"qd-questionIcon",questionText:"qd-questionText",questionBody:"qd-questionBody",questionFooter:"qd-questionFooter"},{Text:a}=b,{useToken:R}=k,x=({sessionId:i})=>{const{t:o}=A(),{token:r}=R(),{message:l}=w.useApp(),[c,d]=N.useState(!1),p=q(T(i)),y=q(t=>t.clearPendingChildApproval);if(!p)return null;const{childSessionId:v,requestId:j,toolName:u,permission:f,resource:C}=p,m=async t=>{d(!0);try{(await B.respondToChildApproval(v,j,t)).delivered||l.warning(o("components.questionDialog.submitFailed"))}catch(n){console.error("Failed to respond to child approval:",n),l.error(n instanceof Error?n.message:o("components.questionDialog.submitFailed"))}finally{y(i),d(!1)}},h=[u?`${o("components.approval.toolName")}: ${u}`:null,f,C].filter(Boolean).join(" · ");return e.jsxs("div",{className:s.questionCard,style:{background:r.colorBgContainer,borderColor:r.colorBorderSecondary,border:`1px solid ${r.colorBorderSecondary}`},children:[e.jsx("div",{className:s.questionHeader,children:e.jsxs("span",{className:s.headerLeft,children:[e.jsx("span",{className:s.questionIcon,children:"🛡️"}),e.jsx(a,{strong:!0,className:s.questionText,style:{color:r.colorPrimary,whiteSpace:"pre-wrap"},children:o("components.approval.childTitle")})]})}),e.jsxs("div",{className:s.questionBody,children:[e.jsx(a,{style:{color:r.colorText,whiteSpace:"pre-wrap"},children:o("components.approval.childQuestion")}),h&&e.jsx("div",{style:{marginTop:r.marginXXS},children:e.jsx(a,{type:"secondary",style:{fontSize:12,whiteSpace:"pre-wrap"},children:h})}),e.jsx("div",{className:s.questionFooter,children:e.jsxs(I,{size:8,children:[e.jsx(g,{type:"primary",size:"small",icon:e.jsx(D,{}),onClick:()=>void m(!0),loading:c,children:o("components.approval.approve")}),e.jsx(g,{danger:!0,size:"small",icon:e.jsx(F,{}),onClick:()=>void m(!1),loading:c,children:o("components.approval.deny")})]})})]})]})};x.displayName="ChildApprovalDialog";const z=S.memo(x);z.displayName="ChildApprovalDialog";export{z as ChildApprovalDialog,z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o}from"./vendor-markdown-
|
|
1
|
+
import{j as o}from"./vendor-markdown-teEfNS9t.js";import{u as O,R as Q,a as B}from"./vendor-i18n-Dm-c3D_C.js";import{u as y,I as w}from"./App-ByVdg3-E.js";import{t as G,o as h,v as J,j as U,w as v,x as f,y as V,z as F,D as I,E as q,F as Y,G as Z,k as oo,H as X,I as so,P as eo,J as E,N as to,O as no,Q as ro,U as lo,V as io,W as ao}from"./vendor-antd-qu012Od4.js";import"./vendor-mermaid-DvB2TuRQ.js";import"./main-C4wmVzw7.js";const{Text:p}=U,co=a=>({pending:{icon:o.jsx(ao,{}),color:a.colorTextTertiary,textKey:"components.todoList.status.pending",tagColor:"default"},in_progress:{icon:o.jsx(v,{spin:!0}),color:a.colorPrimary,textKey:"components.todoList.status.inProgress",tagColor:"processing"},completed:{icon:o.jsx(F,{}),color:a.colorSuccess,textKey:"components.todoList.status.completed",tagColor:"success"},blocked:{icon:o.jsx(io,{}),color:a.colorError,textKey:"components.todoList.status.blocked",tagColor:"error"}}),fo=({sessionId:a,initialCollapsed:K=!0,compact:t=!1})=>{const{t:n}=O(),{token:e}=G.useToken(),W=Q.useMemo(()=>co(e),[e]),g=y(s=>s.chats.find(c=>c.id===a)),j=(g==null?void 0:g.kind)==="child"&&(g.parentSessionId||g.rootSessionId)||a,l=y(s=>s.taskLists[j]),H=y(s=>s.activeItems[j]),x=y(s=>s.evaluationStates[j]),[r,R]=B.useState(K),[i,A]=B.useState(!1),m=(x==null?void 0:x.isEvaluating)||!1,S=(x==null?void 0:x.reasoning)||null,T=l?{session_id:l.session_id,title:l.title,items:l.items,progress:{completed:l.items.filter(s=>s.status==="completed").length,total:l.items.length,percentage:l.items.length>0?Math.round(l.items.filter(s=>s.status==="completed").length/l.items.length*100):0}}:null;if(!T)return null;const C=()=>{i||R(!r)},D=s=>{s.stopPropagation(),A(!i),i||R(!1)},{title:M,items:N,progress:d}=T,L=d.percentage===100,_=o.jsxs(h,{onClick:C,style:{cursor:"pointer",width:"100%"},size:t?6:8,children:[o.jsx(J,{style:{color:e.colorPrimary}}),o.jsx(p,{strong:!0,style:{fontSize:t?14:15},children:M||n("components.todoList.title")}),m&&(t?o.jsx(w,{nowrap:!0,items:[o.jsxs(o.Fragment,{children:[o.jsx(v,{spin:!0,style:{color:e.colorPrimary,marginRight:4}}),n("components.todoList.evaluating")]})]}):o.jsx(f,{icon:o.jsx(v,{spin:!0}),color:"processing",children:n("components.todoList.evaluating")})),!r&&d.total>0&&o.jsx(V,{count:`${d.completed}/${d.total}`,style:{backgroundColor:L?e.colorSuccess:e.colorPrimary}})]}),k=o.jsxs(h,{size:t?6:8,children:[d.total>0&&r&&o.jsxs(p,{type:"secondary",style:{fontSize:t?12:13},children:[d.completed,"/",d.total,L&&o.jsx(F,{style:{color:e.colorSuccess,marginLeft:4}})]}),o.jsx(I,{title:n(i?"components.todoList.unpin":"components.todoList.pin"),children:o.jsx("span",{onClick:D,style:{cursor:"pointer",color:i?e.colorPrimary:e.colorTextSecondary,fontSize:t?14:16},children:i?o.jsx(q,{}):o.jsx(Y,{})})}),!i&&o.jsx("span",{onClick:C,style:{cursor:"pointer",color:e.colorTextSecondary,fontSize:12,transform:r?"rotate(-90deg)":void 0,transition:"transform 0.2s"},children:r?o.jsx(Z,{}):o.jsx(oo,{})})]}),b=r?null:o.jsxs(o.Fragment,{children:[S?t?o.jsxs(p,{type:"secondary",style:{display:"block",marginBottom:e.marginXS,fontSize:12,paddingLeft:e.paddingXS,borderLeft:`2px solid ${e.colorPrimaryBorder}`,lineHeight:1.45},children:[o.jsx(X,{style:{marginRight:6}}),S]}):o.jsx(so,{icon:o.jsx(X,{}),message:n("components.todoList.llmEvaluation"),description:S,type:"info",showIcon:!0,style:{marginBottom:16}}):null,d.total>0&&o.jsx("div",{style:{marginBottom:t?e.marginXS:16},children:o.jsx(eo,{percent:d.percentage,size:"small",status:L?"success":"active",format:s=>o.jsxs(p,{type:"secondary",children:[s,"%"]})})}),o.jsx(E,{size:"small",split:!1,dataSource:N,renderItem:s=>{var z,P;const c=W[s.status],u=H===s.id,$=n(c.textKey);return o.jsx(E.Item,{style:{padding:t?"6px 0":"12px 0",borderLeft:u?`3px solid ${e.colorPrimary}`:"3px solid transparent",paddingLeft:u?t?8:12:t?10:15,backgroundColor:t?"transparent":u?e.colorPrimaryBg:"transparent",borderRadius:t?0:4,marginBottom:t?0:4},children:o.jsx("div",{style:{width:"100%"},children:o.jsxs(h,{align:"start",style:{width:"100%"},size:t?6:8,children:[o.jsx(I,{title:$,children:o.jsx("span",{style:{color:c.color,fontSize:t?14:16},children:c.icon})}),o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx(p,{style:{textDecoration:s.status==="completed"?"line-through":"none",color:s.status==="completed"?e.colorTextSecondary:e.colorText,fontWeight:u?500:400,fontSize:t?13:void 0},children:s.description}),o.jsx("div",{style:{marginTop:t?3:4},children:t?o.jsx(w,{block:!0,items:[o.jsx("span",{style:{color:c.color},children:$}),s.tool_calls_count!==void 0&&s.tool_calls_count>0?`${s.tool_calls_count} ${n("components.todoList.tools")}`:null,((z=s.depends_on)==null?void 0:z.length)>0?`${s.depends_on.length} ${n("components.todoList.dependencies")}`:null]}):o.jsxs(h,{size:t?6:8,wrap:!0,children:[o.jsx(f,{color:c.tagColor,children:$}),s.tool_calls_count!==void 0&&s.tool_calls_count>0&&o.jsxs(f,{icon:o.jsx(to,{}),color:"processing",children:[s.tool_calls_count," ",n("components.todoList.tools")]}),((P=s.depends_on)==null?void 0:P.length)>0&&o.jsx(I,{title:n("components.todoList.dependsOn",{deps:s.depends_on.join(", ")}),children:o.jsxs(f,{icon:o.jsx(no,{}),children:[s.depends_on.length," ",n("components.todoList.dependencies")]})})]})}),s.status==="completed"&&s.summary&&o.jsx(p,{type:"secondary",style:t?{display:"block",marginTop:4,fontSize:12,paddingLeft:e.paddingXS,borderLeft:`2px solid ${e.colorSuccessBorder}`,color:e.colorSuccess,lineHeight:1.45}:{display:"block",marginTop:6,fontSize:12,padding:"4px 8px",backgroundColor:e.colorSuccessBg,borderRadius:4,color:e.colorSuccess},children:s.summary}),s.notes&&o.jsx(p,{type:"secondary",style:t?{display:"block",marginTop:4,fontSize:12,paddingLeft:e.paddingXS,borderLeft:`2px solid ${e.colorBorderSecondary}`,lineHeight:1.45}:{display:"block",marginTop:6,fontSize:12,padding:"4px 8px",backgroundColor:e.colorFillQuaternary,borderRadius:4},children:s.notes})]})]})})})}})]});return t?o.jsxs("section",{"data-testid":"todo-list-panel",style:{width:"100%",minWidth:0,marginBottom:e.marginXS,overflow:"hidden",opacity:r&&!i?.9:1},children:[o.jsxs(ro,{align:"center",justify:"space-between",gap:e.marginXS,style:{padding:`${e.paddingXXS??2}px 0 ${e.paddingXS}px`,borderBottom:r?void 0:`1px solid ${m?e.colorPrimaryBorder:e.colorBorderSecondary}`},children:[o.jsx("div",{style:{flex:1,minWidth:0},children:_}),o.jsx("div",{style:{flex:"0 0 auto"},children:k})]}),b?o.jsx("div",{style:{padding:`0 0 ${e.paddingXS}px`},children:b}):null]}):o.jsx(lo,{size:"small",className:"lotus-settings-card",style:{marginBottom:16,borderRadius:8,boxShadow:m?`0 0 0 2px ${e.colorPrimaryBorder}`:"0 2px 8px rgba(0, 0, 0, 0.06)",opacity:r&&!i?.9:1},styles:{body:{padding:r?"12px 16px":16}},title:_,extra:k,children:b})};export{fo as TodoList,fo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-markdown-
|
|
1
|
+
import{j as e}from"./vendor-markdown-teEfNS9t.js";import{u as N,a as j}from"./vendor-i18n-Dm-c3D_C.js";import{u as T,t as P,x as k,w as V}from"./App-ByVdg3-E.js";import{Q as v,D as n,x as c,Z as C,am as w,ak as I,an as R,ah as S,t as $}from"./vendor-antd-qu012Od4.js";import"./vendor-mermaid-DvB2TuRQ.js";import"./main-C4wmVzw7.js";const{useToken:E}=$,F=r=>{const o=r.replace(/\/$/,"").split("/").filter(Boolean);return o.length<=2?r:`~/${o.slice(-2).join("/")}`},q=({sessionId:r})=>{const{t:o}=N(),{token:x}=E(),t=T(P(r)),f=T(a=>a.systemPrompts),l=t==null?void 0:t.config.workspacePath,i=t==null?void 0:t.config.systemPromptId,s=t==null?void 0:t.config.tokenUsage,y=(t==null?void 0:t.config.compressionEvents)??[],m=j.useMemo(()=>{if(!i)return null;const a=f.find(B=>B.id===i);return(a==null?void 0:a.name)||i},[i,f]),p=j.useMemo(()=>t!=null&&t.messages?t.messages.filter(a=>a.role==="user"&&"type"in a&&a.type==="file_reference").length:0,[t==null?void 0:t.messages]);if(!t)return null;const h=(s==null?void 0:s.summaryTokens)??0,g=y.length,d=(s==null?void 0:s.promptCachedToolOutputs)??0,u=(s==null?void 0:s.promptCachedToolTokensSaved)??0,b=h>0||g>0,_=d>0||u>0;return l||m||p>0||b||_?e.jsx("div",{className:"lotus-context-bar",style:{borderBottomColor:x.colorBorderSecondary,backgroundColor:x.colorBgContainer},children:e.jsxs(v,{align:"center",gap:6,wrap:"wrap",className:"lotus-context-bar__content",children:[l&&e.jsx(n,{title:o("chat.contextBar.workspaceTooltip",{path:l,defaultValue:"Workspace context: {{path}}"}),children:e.jsxs(c,{className:"lotus-context-bar__tag",icon:e.jsx(C,{}),bordered:!1,children:[e.jsx("span",{className:"lotus-context-bar__tag-label",children:o("chat.contextBar.workspace",{defaultValue:"Workspace"})}),F(l)]})}),p>0&&e.jsx(n,{title:o("chat.contextBar.fileRefsTooltip",{count:p,defaultValue:"{{count}} file reference(s) in this session"}),children:e.jsxs(c,{className:"lotus-context-bar__tag",icon:e.jsx(w,{}),bordered:!1,children:[e.jsx("span",{className:"lotus-context-bar__tag-label",children:o("chat.contextBar.files",{defaultValue:"Files"})}),p]})}),m&&e.jsx(n,{title:o("chat.contextBar.promptTooltip",{name:m,defaultValue:"System prompt: {{name}}"}),children:e.jsxs(c,{className:"lotus-context-bar__tag",icon:e.jsx(I,{}),bordered:!1,children:[e.jsx("span",{className:"lotus-context-bar__tag-label",children:o("chat.contextBar.prompt",{defaultValue:"Prompt"})}),m]})}),b&&e.jsx(n,{title:o("chat.contextBar.summaryTooltip",{tokens:k(h),count:g,defaultValue:"Conversation summary contributes {{tokens}} tokens. {{count}} compression event(s) archived older messages."}),children:e.jsx(c,{className:"lotus-context-bar__tag lotus-context-bar__tag--signal",icon:e.jsx(R,{}),bordered:!1,color:"gold",children:o("chat.contextBar.summary",{defaultValue:"Summary"})})}),_&&e.jsx(n,{title:o("chat.contextBar.promptCacheTooltip",{count:d,tokens:k(u),defaultValue:"{{count}} tool output(s) were compacted into prompt-side cache notes, saving {{tokens}} tokens."}),children:e.jsxs(c,{className:"lotus-context-bar__tag lotus-context-bar__tag--signal",icon:e.jsx(S,{}),bordered:!1,color:"green",children:[e.jsx("span",{className:"lotus-context-bar__tag-label",children:o("chat.contextBar.promptCache",{defaultValue:"Prompt cache"})}),u>0?V(u):d]})})]})}):null};export{q as ContextBar,q as default};
|
|
@@ -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-CgV5F7BD.js";import{u as C,a as o,i as U}from"./vendor-i18n-Dm-c3D_C.js";import{Q as L,D as ae}from"./App-M_Enlqcv.js";import{X as O,t as J,l as V,a2 as N,j as k,N as T,ax as Z,ay as re,az as ie,aA as Y,G as ne,W as Q,Q as W,z as B,U as E,F as M,aB as K,aC as ce,p as oe,H as le,A as $,a3 as de,aD as he}from"./vendor-antd-Ce-qhZOr.js";import"./main-KJE6TlvG.js";import"./vendor-mermaid-Di565VO4.js";const pe=({visible:i,onClose:t,onSelect:s})=>{const{t:c}=C(),{message:r}=O.useApp(),{token:a}=J.useToken(),{Text:n}=V,[u,j]=o.useState(!1),[l,m]=o.useState(""),[g,b]=o.useState(),[v,w]=o.useState([]),[I,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),b(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([...I,l]),y(d.path)},z=()=>{g&&(f(I.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 F=S().slice(0,d+1).join("/"),H=(l.startsWith("/"),F);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:z,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(Y,{children:S().map((d,p)=>e.jsx(Y.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:v.length===0&&!u?e.jsx(W,{image:W.PRESENTED_IMAGE_SIMPLE,description:e.jsx(n,{type:"secondary",children:c("chat.folderBrowser.emptyFolder")})}):e.jsx(B,{dataSource:v,style:{maxHeight:400,overflowY:"auto"},renderItem:d=>e.jsx(B.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:U.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:U.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,b]=o.useState([]),[v,w]=o.useState(!1),[I,f]=o.useState([]),[y,x]=o.useState(!1),[z,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();b(h.slice(0,5))}catch(h){console.error("Failed to load recent workspaces:",h),b([])}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,A=S.current;return()=>{h&&h.abort(),A&&A()}},[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(),A=>{m({isValidating:!1,result:A}),r&&r(A)})):(m({isValidating:!1,result:null}),r&&r(null))},[t,r]),F=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:I,isLoadingRecent:y,isLoadingSuggestions:z,folderBrowserVisible:v,setFolderBrowserVisible:w,handlePathChange:p,handleBrowseClick:F,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(W,{description:a("chat.workspace.noRecentWorkspaces"),image:W.PRESENTED_IMAGE_SIMPLE,style:{padding:r.paddingSM}}):e.jsx(B,{size:"small",dataSource:s,style:{paddingInline:r.paddingSM},renderItem:n=>e.jsx(B.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(W,{description:a("chat.workspace.noSuggestions"),image:W.PRESENTED_IMAGE_SIMPLE,style:{padding:r.paddingSM}}):e.jsx(B,{size:"small",dataSource:s,style:{paddingInline:r.paddingSM},renderItem:n=>e.jsx(B.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:q}=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(q,{type:"secondary",children:["(",i.workspace_name,")"]}),i.file_count!==void 0&&e.jsx(q,{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}=J.useToken(),b=s??m("chat.workspace.placeholder"),{path:v,validationStatus:w,recentWorkspaces:I,suggestions:f,isLoadingRecent:y,isLoadingSuggestions:x,folderBrowserVisible:z,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:v,onChange:p=>P(p.target.value),placeholder:b,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:I,onSelect:d,token:g}),e.jsx(ye,{show:n,isLoading:x,suggestions:f,onSelect:d,token:g})]}),e.jsx(pe,{visible:z,onClose:()=>R(!1),onSelect:_})]})},{Title:be}=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,b]=o.useState(!1);o.useEffect(()=>{i&&(j(t),m(null))},[i,t]);const v=x=>{j(x)},w=x=>{m(x)},I=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()=>{b(!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{b(!1)}},y=!u.trim()||s||g;return e.jsx(N,{open:i,title:e.jsx(k,{children:e.jsx(be,{level:4,style:{margin:0},children:a("chat.workspace.modalTitle")})}),okText:a("common.save"),cancelText:a("common.cancel"),onOk:I,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:v,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-teEfNS9t.js";import{u as C,a as o,i as q}from"./vendor-i18n-Dm-c3D_C.js";import{R as L,G as ae}from"./App-ByVdg3-E.js";import{A as O,t as U,j as V,a5 as Z,o as k,B as T,ay as N,az as re,q as ie,aA as J,U as ne,a0 as Y,Y as B,J as W,Z as E,Q as M,aB as K,aC as ce,z as oe,V as le,I as $,a6 as de,aD as he}from"./vendor-antd-qu012Od4.js";import"./main-C4wmVzw7.js";import"./vendor-mermaid-DvB2TuRQ.js";const pe=({visible:i,onClose:t,onSelect:s})=>{const{t:c}=C(),{message:r}=O.useApp(),{token:a}=U.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)},z=()=>{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 F=S().slice(0,d+1).join("/"),H=(l.startsWith("/"),F);y(H)};return e.jsx(Z,{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(N,{}),onClick:R,size:"small",children:c("common.home")}),e.jsx(T,{icon:e.jsx(re,{}),onClick:z,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(J,{children:S().map((d,p)=>e.jsx(J.Item,{children:e.jsx(T,{type:"link",size:"small",onClick:()=>_(p),style:{padding:0},children:d==="/"?e.jsx(N,{}):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(Y,{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:q.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:q.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),[z,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,A=S.current;return()=>{h&&h.abort(),A&&A()}},[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(),A=>{m({isValidating:!1,result:A}),r&&r(A)})):(m({isValidating:!1,result:null}),r&&r(null))},[t,r]),F=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:z,folderBrowserVisible:b,setFolderBrowserVisible:w,handlePathChange:p,handleBrowseClick:F,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(Y,{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(N,{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(Y,{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:Q}=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(Q,{type:"secondary",children:["(",i.workspace_name,")"]}),i.file_count!==void 0&&e.jsx(Q,{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}=U.useToken(),I=s??m("chat.workspace.placeholder"),{path:b,validationStatus:w,recentWorkspaces:v,suggestions:f,isLoadingRecent:y,isLoadingSuggestions:x,folderBrowserVisible:z,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:z,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?Z.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(Z,{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};
|