@shumai-one/shumai 0.6.4 → 0.6.5
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/bin/chunk-0e0g5c55.js +2 -0
- package/bin/{chunk-ajr1w3vq.js → chunk-0gcemkpv.js} +5 -5
- package/bin/{chunk-7yv7shad.js → chunk-13ty4xke.js} +1 -1
- package/bin/{chunk-wmrrapwv.js → chunk-1dm7f6hy.js} +1 -1
- package/bin/{chunk-zc7wzcvh.js → chunk-1nwkxgqh.js} +5 -5
- package/bin/{chunk-gqkjx7rz.js → chunk-1rdgrtnf.js} +2 -2
- package/bin/{chunk-a283dh05.js → chunk-1tme4nbm.js} +2 -2
- package/bin/{chunk-q5k72jz9.js → chunk-1vx92153.js} +2 -2
- package/bin/{chunk-apq2gvvp.js → chunk-2168vwre.js} +2 -2
- package/bin/{chunk-fb9dedm2.js → chunk-24yh3wse.js} +1 -1
- package/bin/{chunk-d3brvxh7.js → chunk-2as0w380.js} +2 -2
- package/bin/chunk-2hk5cb40.js +2 -0
- package/bin/{chunk-598x693h.js → chunk-2nhp70zw.js} +2 -2
- package/bin/{chunk-e2p4s2pj.js → chunk-2scr7dh6.js} +3 -3
- package/bin/{chunk-bkzaw9p8.js → chunk-31v0zy13.js} +1 -1
- package/bin/{chunk-0njsjy6x.js → chunk-37mc5a09.js} +4 -4
- package/bin/{chunk-yncmfr39.js → chunk-3rde6gkg.js} +2 -2
- package/bin/{chunk-2qzmh3ae.js → chunk-3w0w0a55.js} +4 -4
- package/bin/{chunk-6ty4tfmf.js → chunk-4abr8vgg.js} +1 -1
- package/bin/chunk-4jj26kmx.js +1 -0
- package/bin/chunk-4yen4chz.js +2 -0
- package/bin/{chunk-396tfwdx.js → chunk-56h2f6s6.js} +1 -1
- package/bin/{chunk-ehgrp0f9.js → chunk-56qqbtkr.js} +1 -1
- package/bin/{chunk-f5bhcjhw.js → chunk-5pfagexe.js} +1 -1
- package/bin/{chunk-47fmhzwv.js → chunk-5sbcajbb.js} +2 -2
- package/bin/{chunk-akafypge.js → chunk-67p46cwk.js} +34 -34
- package/bin/{chunk-6ke13k69.js → chunk-6g2gv3py.js} +1 -1
- package/bin/{chunk-zg0b902x.js → chunk-7tdq7apk.js} +1 -1
- package/bin/{chunk-6j3beg6n.js → chunk-8cqpyrbp.js} +2 -2
- package/bin/{chunk-vf9s8b5t.js → chunk-8xn2mfp0.js} +1 -1
- package/bin/{chunk-4rjy7ybr.js → chunk-8z3hdcaf.js} +8 -8
- package/bin/chunk-95ygezr5.js +1 -0
- package/bin/{chunk-w4gqg27w.js → chunk-99szdzq8.js} +2 -2
- package/bin/{chunk-pemmtd8q.js → chunk-9s35n63t.js} +1 -1
- package/bin/chunk-9tqrbttj.js +2 -0
- package/bin/{chunk-m6v8rb39.js → chunk-9xv33vgz.js} +7 -7
- package/bin/{chunk-zmnvskn7.js → chunk-9yj86mgf.js} +9 -9
- package/bin/{chunk-rjhczkh3.js → chunk-a3dtyc64.js} +2 -2
- package/bin/{chunk-ka40gv72.js → chunk-a4xq9f8p.js} +1 -1
- package/bin/{chunk-4b2x2qba.js → chunk-am7ssc4m.js} +6 -6
- package/bin/chunk-anjvapqf.js +2 -0
- package/bin/chunk-at55wjdn.js +1 -0
- package/bin/{chunk-wzrzc07t.js → chunk-b119q3jq.js} +1 -1
- package/bin/{chunk-65dh7x4c.js → chunk-b9z3hasx.js} +2 -2
- package/bin/{chunk-y6h885fs.js → chunk-bdze4wyd.js} +1 -1
- package/bin/{chunk-nsbbseff.js → chunk-bp9g1ryv.js} +2 -2
- package/bin/{chunk-8zcfgz9c.js → chunk-bq6ejr4g.js} +1 -1
- package/bin/{chunk-978rm9a9.js → chunk-cxqn0b0p.js} +2 -2
- package/bin/{chunk-xk0jmx4s.js → chunk-d5nfx4q4.js} +1 -1
- package/bin/{chunk-h7f5370s.js → chunk-d7kcj1qb.js} +1 -1
- package/bin/{chunk-vbe8wred.js → chunk-dbz6z4px.js} +1 -1
- package/bin/{chunk-45pb3kzz.js → chunk-djzt77c5.js} +2 -2
- package/bin/{chunk-c61g9hfa.js → chunk-dvmc5582.js} +1 -1
- package/bin/{chunk-ways29d1.js → chunk-e0q5yk34.js} +1 -1
- package/bin/chunk-e572r4hv.js +2 -0
- package/bin/{chunk-66e2vrky.js → chunk-efst3j5m.js} +1 -1
- package/bin/chunk-enkjvx7r.js +2 -0
- package/bin/chunk-f5xv3hp5.js +1 -0
- package/bin/chunk-f9v2qyv7.js +1 -0
- package/bin/chunk-fwwed2e7.js +1 -0
- package/bin/chunk-gm16qx23.js +2 -0
- package/bin/{chunk-pzrqnnpg.js → chunk-h21qqtcm.js} +1 -1
- package/bin/chunk-h329v9bx.js +1 -0
- package/bin/{chunk-s0wxbybf.js → chunk-hgz8t5vr.js} +1 -1
- package/bin/{chunk-2zm7czk6.js → chunk-j26g68k6.js} +1 -1
- package/bin/{chunk-13rq2gtr.js → chunk-jc8e55pe.js} +2 -2
- package/bin/{chunk-y545vfn0.js → chunk-jcrxmzdh.js} +1 -1
- package/bin/{chunk-ff0mh9p3.js → chunk-jd8sv7fn.js} +28 -28
- package/bin/chunk-jpeqvw4x.js +2 -0
- package/bin/{chunk-8a7ymmd4.js → chunk-k7r26qtq.js} +1 -1
- package/bin/chunk-kj7ntaz0.js +2 -0
- package/bin/{chunk-yxnz4ypt.js → chunk-kvf4grps.js} +6 -6
- package/bin/{chunk-2tt0b8ym.js → chunk-kxydqne9.js} +2 -2
- package/bin/{chunk-k9vjs21p.js → chunk-m37nbhsq.js} +1 -1
- package/bin/{chunk-955kf5kc.js → chunk-m5nn6eqe.js} +1 -1
- package/bin/chunk-mbe02vkx.js +2 -0
- package/bin/{chunk-n54ftsdx.js → chunk-mg64qh5j.js} +1 -1
- package/bin/{chunk-cdcgjh8k.js → chunk-mxgztw4q.js} +1 -1
- package/bin/{chunk-m8spagwp.js → chunk-n7skpwvd.js} +3 -3
- package/bin/{chunk-8ac9at5y.js → chunk-n8q8hv6c.js} +2 -2
- package/bin/chunk-ncdzf0ry.js +1 -0
- package/bin/{chunk-bssb9tar.js → chunk-nd3fd097.js} +3 -3
- package/bin/{chunk-0jnstdgf.js → chunk-p50y3e5b.js} +1 -1
- package/bin/{chunk-n7cvj15k.js → chunk-p7ccvw8m.js} +1 -1
- package/bin/{chunk-edfaqwaq.js → chunk-pjkvwhfj.js} +1 -1
- package/bin/{chunk-22jbsrka.js → chunk-qax7bbp9.js} +1 -1
- package/bin/{chunk-dcb1nzf1.js → chunk-qrx5txys.js} +1 -1
- package/bin/{chunk-szta50g1.js → chunk-r5gqxy70.js} +1 -1
- package/bin/{chunk-v7jzc3ye.js → chunk-r6jg9baj.js} +1 -1
- package/bin/chunk-ra209cbg.js +12 -0
- package/bin/{chunk-bywk8mbc.js → chunk-s3a5g11a.js} +2 -2
- package/bin/{chunk-7q4mgd5x.js → chunk-s4hy0ved.js} +1 -1
- package/bin/{chunk-q9fsxakd.js → chunk-s8ff3cb2.js} +2 -2
- package/bin/chunk-svr8n1ah.js +2 -0
- package/bin/{chunk-b6kmj34z.js → chunk-swtgq58j.js} +2 -2
- package/bin/chunk-sxfq2z7e.js +1 -0
- package/bin/{chunk-gd3b5akr.js → chunk-t3dwzd1a.js} +2 -2
- package/bin/{chunk-wesg7tg9.js → chunk-t96f1wsa.js} +1 -1
- package/bin/{chunk-wrb4xq9v.js → chunk-tanzerf7.js} +1 -1
- package/bin/{chunk-mfh7mg5b.js → chunk-tjkhapvh.js} +1 -1
- package/bin/{chunk-7e9ws6dh.js → chunk-tzn128yj.js} +27 -27
- package/bin/{chunk-dfbzatq9.js → chunk-v1fwt3x3.js} +2 -2
- package/bin/chunk-v4gtta3t.js +2 -0
- package/bin/{chunk-vm9bbk97.js → chunk-v9zvfvrc.js} +4 -4
- package/bin/{chunk-av2w1sez.js → chunk-va39tgjj.js} +2 -2
- package/bin/{chunk-t6cb99gp.js → chunk-vgxtr5nw.js} +2 -2
- package/bin/chunk-vnsz4x0d.js +1 -0
- package/bin/{chunk-km70p970.js → chunk-vqpycf0d.js} +1 -1
- package/bin/{chunk-q57m34h0.js → chunk-w0ada4tc.js} +3 -3
- package/bin/{chunk-qeypjv4f.css → chunk-w6mpqhh2.css} +1 -1
- package/bin/{chunk-jxm0gzmf.js → chunk-wgnef4mm.js} +2 -2
- package/bin/{chunk-vk3eqr65.js → chunk-wvf465g9.js} +1 -1
- package/bin/chunk-wzkyz0ex.js +2 -0
- package/bin/{chunk-1aqs9sdh.js → chunk-x144hpna.js} +2 -2
- package/bin/{chunk-3mx4trvh.js → chunk-x243v26y.js} +3 -3
- package/bin/{chunk-81b8rfv7.js → chunk-xak0x4rg.js} +2 -2
- package/bin/{chunk-w6ym7tsd.js → chunk-xge7jvp6.js} +3 -3
- package/bin/chunk-xhm4w6k2.js +2 -0
- package/bin/{chunk-d277evce.js → chunk-xhmcdf36.js} +4 -4
- package/bin/{chunk-s4hkcw24.js → chunk-xz2pzjse.js} +1 -1
- package/bin/{chunk-p35ztj2z.js → chunk-y4v4jnvv.js} +1 -1
- package/bin/{chunk-gm1fy3hm.js → chunk-y63cy80d.js} +2 -2
- package/bin/{chunk-v4nqx084.js → chunk-ym7pb5vn.js} +4 -4
- package/bin/chunk-yq06kytp.js +2 -0
- package/bin/{chunk-7mdddkfc.js → chunk-yw34c12n.js} +1 -1
- package/bin/{chunk-6rqakmg0.js → chunk-zeq831pz.js} +2 -2
- package/bin/{chunk-01vx2chc.js → chunk-zhhg6att.js} +2 -2
- package/bin/{chunk-xd1axsdv.js → chunk-zkq96hyx.js} +2 -2
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +137 -137
- package/package.json +7 -7
- package/bin/chunk-0epkrexd.js +0 -2
- package/bin/chunk-0h5239kt.js +0 -2
- package/bin/chunk-2qknebmd.js +0 -1
- package/bin/chunk-4awk4xhq.js +0 -2
- package/bin/chunk-5c7ztqs7.js +0 -1
- package/bin/chunk-aa2a06cc.js +0 -1
- package/bin/chunk-amk373q2.js +0 -2
- package/bin/chunk-bwvj1aqc.js +0 -1
- package/bin/chunk-e0bckx12.js +0 -2
- package/bin/chunk-e8zzg57c.js +0 -2
- package/bin/chunk-evs2aaav.js +0 -12
- package/bin/chunk-fpfby5tz.js +0 -1
- package/bin/chunk-hcyhsn8e.js +0 -2
- package/bin/chunk-n0cn0218.js +0 -2
- package/bin/chunk-na5fh7er.js +0 -2
- package/bin/chunk-neazdbxy.js +0 -1
- package/bin/chunk-nk24qw3m.js +0 -1
- package/bin/chunk-nseef85h.js +0 -1
- package/bin/chunk-pcjc9ygv.js +0 -2
- package/bin/chunk-qadpe0ct.js +0 -2
- package/bin/chunk-qw92z3wf.js +0 -2
- package/bin/chunk-r0byfq1t.js +0 -1
- package/bin/chunk-r0q88qw3.js +0 -2
- package/bin/chunk-tcr080b9.js +0 -1
- package/bin/chunk-wnwsjgj8.js +0 -2
- package/bin/chunk-zc1asygg.js +0 -2
- package/bin/chunk-zdvhh8mk.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{G,S,M,w,L,W,a,g,ae,ee,R,j,V,uo,Ht,Be,Mt,xr,Cr,Re,Ue,Ke,U,Mw,Ow,Lw,pE,vh,I_,HE,Px,sC,iC,Lr,my,Bh,$h,Dy,T1,D1,nk,Vy,bg,am,lO,SP,Fg,Lg,XP,to,Zg,Ie,Ft,cn,sn,Ca,Ye,Xe,et,tt,be,ls,qi,cr,kr}from"./chunk-akafypge.js";import{so}from"./chunk-d3brvxh7.js";import{hf,Qi}from"./chunk-3mx4trvh.js";import{cs}from"./chunk-vf9s8b5t.js";var Ce=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ne=j("brain",Ce);L();function Ra({projectId:m,contextAssetId:k,file:f,currentTime:ie,frameRate:C,startTimecode:K,formatTimestamp:D,onTyping:le,onSelectMessage:z,selectedMessageId:de}){let{isHistoryMode:p,setIsHistoryMode:A,currentSessionId:me,chatAssets:ce,removeAsset:ue,messages:h,historySessions:J,isStreaming:_,fetchHistorySessions:X,loadSession:pe,deleteSession:fe,startNewSession:Z,sendMessage:ge,abortActiveSession:xe,selectedAgentId:T,setSelectedAgentId:q,inputText:he,setInputText:ve}=kr(),{teamId:c,ensureTeamIdForProject:Y}=Ft(),{videoTimeDisplayMode:ye}=cr(),[I,E]=w(null);S(()=>{if(m)Y(m)},[m,Y]);let{data:we=[],isSuccess:te}=ee({queryKey:["chat-agents",m],queryFn:async()=>{if(!m)return[];let e=await R.api.projects[":projectId"]["chat-agents"].$get({param:{projectId:m}});if(!e.ok)throw Error("failed to fetch agents");return e.json()},enabled:!!m}),N=we.filter((e)=>e.type==="chat"&&e.enabled);S(()=>{if(!te)return;if(N.length>0){if(!N.some((t)=>t.id===T))q(N[0].id)}else if(T!==null)q(null)},[te,N,T,q]);let re=M(null),F=M(null),H=M(!0),O=M(!0);S(()=>{O.current=!0,H.current=!0},[m,k,p]),S(()=>{let e=F.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!e)return;let{scrollTop:t,isAtBottom:i}=kr.getState(),r=setTimeout(()=>{if(i)e.scrollTop=e.scrollHeight;else e.scrollTop=t;let d=setTimeout(()=>{O.current=!1},50);return()=>clearTimeout(d)},0);return()=>clearTimeout(r)},[m,k,p]),S(()=>{let e=F.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!e)return;let t=()=>{if(O.current)return;let i=e.scrollTop,r=e.scrollHeight-i-e.clientHeight<10;kr.getState().setScrollState(i,r)};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}},[m,k,p]);let{ref:ke,isDropTarget:Ne}=cn({id:"chatbot-sidebar",data:{type:"chatbot-sidebar"}});S(()=>{if(!p){let{isAtBottom:e}=kr.getState();if(e||_){let t=H.current?"auto":"smooth";re.current?.scrollIntoView({behavior:t})}H.current=!1}},[h,_,p]),S(()=>{if(p&&c)X(c)},[p,X,c]);let v=ae(),_e=G(()=>{v.invalidateQueries({queryKey:["search"]}),v.invalidateQueries({queryKey:["folders"]}),v.invalidateQueries({queryKey:["files"]}),v.invalidateQueries({queryKey:["file"]}),v.invalidateQueries({queryKey:["version_stacks"]}),v.invalidateQueries({queryKey:["projects"]})},[v]),P=(e)=>{if(typeof e==="string")return e;if(Array.isArray(e))return e.map((t)=>{if(typeof t==="string")return t;if(t&&typeof t==="object"&&"type"in t&&t.type==="text"&&"text"in t)return String(t.text);return""}).join("");return""},oe=(e)=>e.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:"),Se=(e)=>{switch(e.role){case"user":case"custom":{let t=e;if(e.role==="custom"&&t.customType==="context_display_info"){let d=t.details?.assets||[];if(d.length===0)return null;return g("div",{className:"text-xs text-muted-foreground bg-muted/40 p-2.5 rounded-lg border border-border/50 space-y-1 my-1",children:[a("div",{className:"font-semibold",children:Ow()}),a("ul",{className:"list-disc list-inside space-y-0.5",children:d.map((s)=>g("li",{className:"truncate",children:[s.name," ",g("span",{className:"text-muted-foreground/70",children:["(",s.type,")"]})]},s.id))})]},e.id)}if(e.role==="user"||t.customType==="shumai_message"){let r=t.details,d=r?.referencedAssets||[],s=r?.attachedFiles||[],n=r?.position,u=r?.annotation||r?.annotations&&r.annotations.length>0,l=!r?.currentAsset?.id||k&&r.currentAsset.id===k||f?.id&&r.currentAsset.id===f.id,x=de===e.id,y="";if(n?.type==="time")if(D)y=D(n.seconds);else if(C){let o=Math.round(n.seconds*C);y=so(o,C,ye,K)}else{let o=Math.floor(n.seconds/60),b=Math.floor(n.seconds%60);y=`${o.toString().padStart(2,"0")}:${b.toString().padStart(2,"0")}`}else if(n?.type==="page")y=Vy({page:n.page});let se=P(t.content),Te=s.length>0||d.length>0;return a("div",{onClick:()=>{if(l&&z)z(e)},className:U("flex flex-col items-end w-full group transition-all duration-150",l&&(u||n)&&"cursor-pointer"),children:g("div",{className:U("bg-primary text-primary-foreground rounded-lg px-3 py-2 text-sm whitespace-pre-wrap shadow-xs break-words transition-all border",Te?"w-full":"max-w-[85%]",x?"border-blue-500 dark:border-blue-400":"border-transparent"),children:[g("div",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words",children:[u&&a("span",{className:"inline-flex items-center align-middle mr-1.5 p-0.5 rounded bg-primary-foreground/20 text-primary-foreground",title:HE(),children:a(Ca,{className:"w-3.5 h-3.5"})}),n&&a("span",{className:"inline-flex items-center align-middle mr-1.5 px-1.5 py-0.5 rounded text-xs font-mono font-bold bg-primary-foreground/20 text-primary-foreground",children:y}),se&&a("span",{children:se})]}),s.length>0&&g("div",{className:"mt-2.5 w-full",children:[a("div",{className:"text-xs font-medium text-primary-foreground/70 mb-1",children:Lw()}),a("div",{className:"flex flex-col gap-1.5 w-full",children:s.map((o)=>{let b=o.name||"file",B=qi(b)||o.mediaType==="image"||o.mimeType?.startsWith("image/");return g("div",{className:U("group/att relative flex items-center w-full max-w-full rounded-lg border border-primary-foreground/15 bg-primary-foreground/10 hover:bg-primary-foreground/15 transition-colors overflow-hidden",B?"h-18 p-1.5 gap-2.5 cursor-pointer":"h-9 px-2.5 gap-2.5"),onClick:(Q)=>{if(Q.stopPropagation(),o.url)if(B)E({url:o.url,name:b});else window.open(o.url,"_blank","noreferrer")},children:[B&&o.url?a("div",{className:"h-full aspect-square rounded-md overflow-hidden bg-black/20 shrink-0",children:a("img",{src:o.url,alt:b,className:"w-full h-full object-cover group-hover/att:scale-105 transition-transform duration-200"})}):a(xr,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}),a("div",{className:"min-w-0 flex-1 overflow-hidden",children:a("p",{className:"text-xs font-medium text-primary-foreground truncate block w-full",title:b,children:b})}),o.url&&a("a",{href:o.url,target:"_blank",rel:"noreferrer",download:b,className:"p-1 text-primary-foreground/70 hover:text-primary-foreground shrink-0 rounded-md hover:bg-primary-foreground/20 transition-colors opacity-0 group-hover/att:opacity-100",onClick:(Q)=>Q.stopPropagation(),title:Lr(),children:a(Mt,{className:"w-3.5 h-3.5"})})]},o.id)})})]}),d.length>0&&g("div",{className:"mt-2.5 w-full",children:[a("div",{className:"text-xs font-medium text-primary-foreground/70 mb-1",children:Mw()}),a("div",{className:"flex flex-col gap-1.5 w-full",children:d.map((o)=>g("div",{className:"flex items-center justify-between w-full h-9 px-2.5 rounded-lg border border-primary-foreground/15 bg-primary-foreground/10 hover:bg-primary-foreground/15 transition-colors overflow-hidden",children:[g("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[o.type==="folder"?a(Cr,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}):a(xr,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}),a("span",{className:"text-xs font-medium truncate text-primary-foreground",title:o.name,children:o.name})]}),a("span",{className:"text-[10px] text-primary-foreground/60 uppercase shrink-0 font-mono ml-2",children:o.type})]},o.id))})]})]})},e.id)}let i=t.content||"";return a("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:P(i)},e.id)}case"assistant":{let i=e.content;if(!i)return null;let r=[];if(i.forEach((s,n)=>{if(!s||typeof s!=="object")return;let u=s;switch(u.type){case"text":{let l=u.text;if(typeof l!=="string"||!l.trim())return;r.push(a("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:a(ls,{components:{pre:({node:x,...y})=>a("pre",{className:"whitespace-pre-wrap break-all break-words bg-muted text-foreground p-4 rounded-md border border-border/50 font-mono text-sm",...y})},children:oe(l)})},`txt-${n}`));break}case"thinking":{let l=u.thinking;if(typeof l!=="string"||!l.trim())return;r.push(g("details",{className:"group border border-border/50 rounded-lg bg-muted/20 my-2 overflow-hidden",children:[g("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-medium text-muted-foreground select-none cursor-pointer hover:bg-muted/40 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[a(ne,{className:"h-3.5 w-3.5 text-primary/70 animate-pulse"}),a("span",{children:bg()||"Thinking"}),a(Be,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),a("div",{className:"p-3 pt-0 text-xs text-muted-foreground/90 border-t border-border/40 bg-muted/10 leading-relaxed prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-sans",children:a(ls,{children:oe(l)})})]},`think-${n}`));break}case"toolCall":{let l=String(u.name||u.toolName||to()),x=u.arguments||u.args;r.push(g("details",{className:"group border border-border/50 rounded-lg bg-violet-500/5 my-2 overflow-hidden",children:[g("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-semibold text-violet-600 dark:text-violet-400 select-none cursor-pointer hover:bg-violet-500/10 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[a(cs,{className:"h-3.5 w-3.5"}),a("span",{children:vh()}),a("span",{className:"font-mono bg-violet-500/10 px-1.5 py-0.5 rounded text-[11px] text-violet-700 dark:text-violet-300",children:l}),a(Be,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),!!x&&g("div",{className:"p-3 pt-0 text-[10px] text-muted-foreground/90 border-t border-border/40 bg-violet-500/5 font-sans",children:[a("div",{className:"text-[9px] text-muted-foreground/60 uppercase font-bold tracking-wider mb-1.5",children:Fg()||"Arguments"}),a("pre",{className:"font-mono bg-muted/30 p-2 rounded border border-border/30 overflow-x-auto max-h-32",children:JSON.stringify(x,null,2)})]})]},`tool-${n}`));break}case"image":{let l=String(u.mimeType||"image/png"),x=String(u.data||"");r.push(a("div",{className:"my-2 max-w-full",children:x?a("img",{src:x.startsWith("data:")?x:`data:${l};base64,${x}`,alt:"Attached asset",className:"max-h-60 rounded border border-border/50 object-contain shadow-xs"}):a("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:Bh()})},`img-${n}`));break}default:{let l=JSON.stringify(s,null,2);if(l==="{}")return;r.push(a("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:l},`other-${n}`))}}}),r.length===0)return null;let d=!1;if(i.length>0){let s=i[i.length-1];if(typeof s==="string"&&s.trim().length>0)d=!0;else if(s&&typeof s==="object"){let n=s;if(n.type==="text"&&typeof n.text==="string"&&n.text.trim().length>0)d=!0}}return g("div",{className:"flex flex-col w-full space-y-1",children:[a("div",{className:"space-y-2 w-full",children:r}),d&&a("div",{className:"text-[10px] text-muted-foreground self-start italic pt-1",children:Px()})]},e.id)}case"toolResult":return a("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 p-2 rounded-md border border-border/50",children:a("span",{className:"font-semibold",children:Lg({name:e.toolName||"tool"})})},e.id);case"thinking_level_change":{let i=e.content||"";return a("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:P(i)},e.id)}default:return null}};return g("div",{ref:ke,className:U("relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0"),children:[Ne&&a("div",{className:"absolute inset-0 bg-accent/30 border-2 border-primary z-50 pointer-events-none flex items-center justify-center p-6 text-center animate-in fade-in duration-150",children:g("div",{className:"bg-background/95 text-foreground px-4 py-3 rounded-xl border border-border/80 flex flex-col items-center gap-2 shadow-lg max-w-[80%] animate-in zoom-in-95 duration-150",children:[a(Ht,{className:"h-6 w-6 text-primary animate-bounce"}),a("span",{className:"text-sm font-semibold text-foreground",children:I_()})]})}),g("div",{className:"h-12 border-b border-border flex items-center justify-between px-4 flex-shrink-0 bg-background/50 backdrop-blur-sm",children:[g("div",{className:"flex items-center gap-2",children:[p&&a("button",{onClick:()=>A(!1),className:"p-1 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:pE(),children:a(hf,{className:"h-4 w-4"})}),a(Ht,{className:"h-5 w-5 text-primary"}),a("span",{className:"font-semibold text-sm",children:p?my():lO()})]}),a("div",{className:"flex items-center gap-1",children:!p?g(W,{children:[a("button",{onClick:Z,className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:Dy(),children:a(Re,{className:"h-4 w-4"})}),a("button",{onClick:()=>A(!0),className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:my(),children:a(uo,{className:"h-4 w-4"})})]}):g("button",{onClick:()=>{Z(),A(!1)},className:"flex items-center gap-1 text-xs bg-primary text-primary-foreground px-2.5 py-1 rounded-md hover:bg-primary/90 transition-colors shadow-xs cursor-pointer",children:[a(Re,{className:"h-3.5 w-3.5"}),a("span",{children:Dy()})]})})]}),p?a(Ie,{className:"flex-1 p-3",children:J.length===0?a("div",{className:"text-center text-xs text-muted-foreground py-8",children:D1()}):a("div",{className:"space-y-1",children:J.map((e)=>{let t=e.id===me;return g("div",{onClick:()=>{if(c)pe(c,e.id),A(!1)},className:U("group flex items-center justify-between p-2.5 rounded-lg text-xs cursor-pointer transition-all border border-transparent",t?"bg-accent/80 text-accent-foreground font-medium border-border/40":"hover:bg-muted/60 text-muted-foreground hover:text-foreground"),children:[g("div",{className:"flex flex-col min-w-0 pr-2",children:[a("span",{className:"truncate text-foreground font-medium text-xs",children:e.name||Zg()}),a("span",{className:"text-[10px] text-muted-foreground",children:sn(e.updatedAt)})]}),a("button",{onClick:(i)=>{if(i.stopPropagation(),c&&window.confirm(iC()))fe(c,e.id)},className:"opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-1 rounded hover:bg-muted cursor-pointer",title:sC(),children:a(Ue,{className:"h-4 w-4"})})]},e.id)})})}):g(W,{children:[a(Ie,{ref:F,className:"flex-1 p-4 min-h-0 [&>div>div]:!block",children:h.length===0?g("div",{className:"flex flex-col items-center justify-center h-48 border-2 border-dashed border-border rounded-lg text-muted-foreground p-4 text-center",children:[a(Ht,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),a("p",{className:"text-sm",children:I_()})]}):g("div",{className:"space-y-4 pb-4",children:[h.map(Se),_&&h.length>0&&(h[h.length-1].role==="user"||h[h.length-1].customType==="shumai_message")&&g("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground italic",children:[a(V,{className:"h-3 w-3 animate-spin text-primary"}),a("span",{children:SP()})]}),a("div",{ref:re})]})}),a("div",{className:"p-2 flex-shrink-0 bg-background",children:a(Qi,{projectId:m,value:he,onChangeText:ve,placeholder:XP(),disabled:!T||!c,isStreaming:_,onAbort:()=>{if(c)xe(c)},allowMentions:!1,allowAttachments:!0,workspaceAssets:ce,onRemoveWorkspaceAsset:ue,allowMarkup:!0,canMarkup:!!f&&["image","video","pdf"].includes(f.proxyType||""),markupDisabledTooltip:!f?nk():$h(),allowTimestamp:f?.proxyType==="video"||f?.proxyType==="pdf",currentTime:ie,frameRate:C||f?.media?.metadata?.frameRate||30,startTimecode:K||f?.media?.metadata?.startTimecode,formatTimestamp:D||(f?.proxyType==="pdf"?(e)=>Vy({page:Math.round(e)}):void 0),onTyping:le,onSendMessage:(e,t,i,r,d,s)=>{if(!c)return;ge(c,e,m,k,_e,t,i,d,s)},bottomLeftExtra:a("div",{className:"flex items-center gap-1.5 min-w-0 max-w-full",children:N.length>0?g(Ye,{value:T||"",onValueChange:(e)=>q(e),disabled:_,children:[a(et,{className:"h-8 border-none bg-transparent hover:bg-muted text-muted-foreground hover:text-foreground focus:ring-0 focus:ring-offset-0 px-2 py-0 gap-1.5 text-xs shrink-0 select-none shadow-none max-w-full cursor-pointer",children:a(Xe,{placeholder:am()})}),a(tt,{children:N.map((e)=>a(be,{value:e.id,className:"cursor-pointer",children:g("div",{className:"flex items-center gap-2",children:[e.avatar?a("img",{src:e.avatar,alt:e.name,className:"w-4 h-4 rounded-full object-cover"}):a(Ht,{className:"w-4 h-4 text-muted-foreground"}),a("span",{className:"text-xs",children:e.name})]})},e.id))})]}):a("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[11px] text-muted-foreground/60 italic select-none",children:a("span",{children:T1()})})})})})]}),I&&g("div",{className:"fixed inset-0 z-[100] bg-black/95 flex flex-col items-center justify-center p-4 animate-in fade-in duration-200",onClick:()=>E(null),children:[a("button",{className:"absolute top-4 right-4 text-white/70 hover:text-white hover:bg-white/20 rounded-full p-2 transition-colors z-50 cursor-pointer",children:a(Ke,{className:"w-8 h-8"})}),a("div",{className:"w-full h-full flex items-center justify-center p-2",children:a("img",{src:I.url,alt:I.name,className:"max-w-full max-h-[85vh] object-contain rounded shadow-2xl cursor-zoom-out",onClick:(e)=>{e.stopPropagation(),E(null)}})}),a("div",{className:"absolute bottom-6 text-white text-sm font-medium bg-black/50 px-4 py-2 rounded-full backdrop-blur-sm",children:I.name})]})]})}
|
|
1
|
+
import{G,S,M,w,L,W,a,g,ae,ee,R,j,V,fo,Ht,Be,Mt,xr,Cr,ke,Ue,Ke,U,Ow,Pw,Zw,mE,Eh,T_,QE,Dx,iC,aC,Lr,hy,jh,Gh,Ny,k1,N1,ok,Ky,xg,cm,cO,IP,Bg,Ug,eD,ro,zg,Ie,Ft,cn,sn,Ca,Ye,Xe,et,tt,be,ls,qi,cr,kr}from"./chunk-67p46cwk.js";import{io}from"./chunk-2as0w380.js";import{Af,Qi}from"./chunk-x243v26y.js";import{cs}from"./chunk-8xn2mfp0.js";var Ae=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ne=j("brain",Ae);L();function Ra({projectId:m,contextAssetId:k,file:f,currentTime:ie,frameRate:C,startTimecode:K,formatTimestamp:D,onTyping:le,onSelectMessage:z,selectedMessageId:de}){let{isHistoryMode:p,setIsHistoryMode:A,currentSessionId:me,chatAssets:ce,removeAsset:ue,messages:h,historySessions:J,isStreaming:_,fetchHistorySessions:X,loadSession:pe,deleteSession:fe,startNewSession:Z,sendMessage:ge,abortActiveSession:xe,selectedAgentId:T,setSelectedAgentId:q,inputText:he,setInputText:ve}=kr(),{teamId:c,ensureTeamIdForProject:Y}=Ft(),{videoTimeDisplayMode:ye}=cr(),[I,E]=w(null);S(()=>{if(m)Y(m)},[m,Y]);let{data:we=[],isSuccess:te}=ee({queryKey:["chat-agents",m],queryFn:async()=>{if(!m)return[];let e=await R.api.projects[":projectId"]["chat-agents"].$get({param:{projectId:m}});if(!e.ok)throw Error("failed to fetch agents");return e.json()},enabled:!!m}),N=we.filter((e)=>e.type==="chat"&&e.enabled);S(()=>{if(!te)return;if(N.length>0){if(!N.some((t)=>t.id===T))q(N[0].id)}else if(T!==null)q(null)},[te,N,T,q]);let re=M(null),F=M(null),H=M(!0),O=M(!0);S(()=>{O.current=!0,H.current=!0},[m,k,p]),S(()=>{let e=F.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!e)return;let{scrollTop:t,isAtBottom:i}=kr.getState(),r=setTimeout(()=>{if(i)e.scrollTop=e.scrollHeight;else e.scrollTop=t;let d=setTimeout(()=>{O.current=!1},50);return()=>clearTimeout(d)},0);return()=>clearTimeout(r)},[m,k,p]),S(()=>{let e=F.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!e)return;let t=()=>{if(O.current)return;let i=e.scrollTop,r=e.scrollHeight-i-e.clientHeight<10;kr.getState().setScrollState(i,r)};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}},[m,k,p]);let{ref:Ne,isDropTarget:_e}=cn({id:"chatbot-sidebar",data:{type:"chatbot-sidebar"}});S(()=>{if(!p){let{isAtBottom:e}=kr.getState();if(e||_){let t=H.current?"auto":"smooth";re.current?.scrollIntoView({behavior:t})}H.current=!1}},[h,_,p]),S(()=>{if(p&&c)X(c)},[p,X,c]);let v=ae(),Se=G(()=>{v.invalidateQueries({queryKey:["search"]}),v.invalidateQueries({queryKey:["folders"]}),v.invalidateQueries({queryKey:["files"]}),v.invalidateQueries({queryKey:["file"]}),v.invalidateQueries({queryKey:["version_stacks"]}),v.invalidateQueries({queryKey:["projects"]})},[v]),P=(e)=>{if(typeof e==="string")return e;if(Array.isArray(e))return e.map((t)=>{if(typeof t==="string")return t;if(t&&typeof t==="object"&&"type"in t&&t.type==="text"&&"text"in t)return String(t.text);return""}).join("");return""},oe=(e)=>e.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:"),Te=(e)=>{switch(e.role){case"user":case"custom":{let t=e;if(e.role==="custom"&&t.customType==="context_display_info"){let d=t.details?.assets||[];if(d.length===0)return null;return g("div",{className:"text-xs text-muted-foreground bg-muted/40 p-2.5 rounded-lg border border-border/50 space-y-1 my-1",children:[a("div",{className:"font-semibold",children:Pw()}),a("ul",{className:"list-disc list-inside space-y-0.5",children:d.map((s)=>g("li",{className:"truncate",children:[s.name," ",g("span",{className:"text-muted-foreground/70",children:["(",s.type,")"]})]},s.id))})]},e.id)}if(e.role==="user"||t.customType==="shumai_message"){let r=t.details,d=r?.referencedAssets||[],s=r?.attachedFiles||[],n=r?.position,u=r?.annotation||r?.annotations&&r.annotations.length>0,l=!r?.currentAsset?.id||k&&r.currentAsset.id===k||f?.id&&r.currentAsset.id===f.id,x=de===e.id,y="";if(n?.type==="time")if(D)y=D(n.seconds);else if(C){let o=Math.round(n.seconds*C);y=io(o,C,ye,K)}else{let o=Math.floor(n.seconds/60),b=Math.floor(n.seconds%60);y=`${o.toString().padStart(2,"0")}:${b.toString().padStart(2,"0")}`}else if(n?.type==="page")y=Ky({page:n.page});let se=P(t.content),Ce=s.length>0||d.length>0;return a("div",{onClick:()=>{if(l&&z)z(e)},className:U("flex flex-col items-end w-full group transition-all duration-150",l&&(u||n)&&"cursor-pointer"),children:g("div",{className:U("bg-primary text-primary-foreground rounded-lg px-3 py-2 text-sm whitespace-pre-wrap shadow-xs break-words transition-all border",Ce?"w-full":"max-w-[85%]",x?"border-blue-500 dark:border-blue-400":"border-transparent"),children:[g("div",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words",children:[u&&a("span",{className:"inline-flex items-center align-middle mr-1.5 p-0.5 rounded bg-primary-foreground/20 text-primary-foreground",title:QE(),children:a(Ca,{className:"w-3.5 h-3.5"})}),n&&a("span",{className:"inline-flex items-center align-middle mr-1.5 px-1.5 py-0.5 rounded text-xs font-mono font-bold bg-primary-foreground/20 text-primary-foreground",children:y}),se&&a("span",{children:se})]}),s.length>0&&g("div",{className:"mt-2.5 w-full",children:[a("div",{className:"text-xs font-medium text-primary-foreground/70 mb-1",children:Zw()}),a("div",{className:"flex flex-col gap-1.5 w-full",children:s.map((o)=>{let b=o.name||"file",B=qi(b)||o.mediaType==="image"||o.mimeType?.startsWith("image/");return g("div",{className:U("group/att relative flex items-center w-full max-w-full rounded-lg border border-primary-foreground/15 bg-primary-foreground/10 hover:bg-primary-foreground/15 transition-colors overflow-hidden",B?"h-18 p-1.5 gap-2.5 cursor-pointer":"h-9 px-2.5 gap-2.5"),onClick:(Q)=>{if(Q.stopPropagation(),o.url)if(B)E({url:o.url,name:b});else window.open(o.url,"_blank","noreferrer")},children:[B&&o.url?a("div",{className:"h-full aspect-square rounded-md overflow-hidden bg-black/20 shrink-0",children:a("img",{src:o.url,alt:b,className:"w-full h-full object-cover group-hover/att:scale-105 transition-transform duration-200"})}):a(xr,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}),a("div",{className:"min-w-0 flex-1 overflow-hidden",children:a("p",{className:"text-xs font-medium text-primary-foreground truncate block w-full",title:b,children:b})}),o.url&&a("a",{href:o.url,target:"_blank",rel:"noreferrer",download:b,className:"p-1 text-primary-foreground/70 hover:text-primary-foreground shrink-0 rounded-md hover:bg-primary-foreground/20 transition-colors opacity-0 group-hover/att:opacity-100",onClick:(Q)=>Q.stopPropagation(),title:Lr(),children:a(Mt,{className:"w-3.5 h-3.5"})})]},o.id)})})]}),d.length>0&&g("div",{className:"mt-2.5 w-full",children:[a("div",{className:"text-xs font-medium text-primary-foreground/70 mb-1",children:Ow()}),a("div",{className:"flex flex-col gap-1.5 w-full",children:d.map((o)=>g("div",{className:"flex items-center justify-between w-full h-9 px-2.5 rounded-lg border border-primary-foreground/15 bg-primary-foreground/10 hover:bg-primary-foreground/15 transition-colors overflow-hidden",children:[g("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[o.type==="folder"?a(Cr,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}):a(xr,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}),a("span",{className:"text-xs font-medium truncate text-primary-foreground",title:o.name,children:o.name})]}),a("span",{className:"text-[10px] text-primary-foreground/60 uppercase shrink-0 font-mono ml-2",children:o.type})]},o.id))})]})]})},e.id)}let i=t.content||"";return a("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:P(i)},e.id)}case"assistant":{let i=e.content;if(!i)return null;let r=[];if(i.forEach((s,n)=>{if(!s||typeof s!=="object")return;let u=s;switch(u.type){case"text":{let l=u.text;if(typeof l!=="string"||!l.trim())return;r.push(a("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:a(ls,{components:{pre:({node:x,...y})=>a("pre",{className:"whitespace-pre-wrap break-all break-words bg-muted text-foreground p-4 rounded-md border border-border/50 font-mono text-sm",...y})},children:oe(l)})},`txt-${n}`));break}case"thinking":{let l=u.thinking;if(typeof l!=="string"||!l.trim())return;r.push(g("details",{className:"group border border-border/50 rounded-lg bg-muted/20 my-2 overflow-hidden",children:[g("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-medium text-muted-foreground select-none cursor-pointer hover:bg-muted/40 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[a(ne,{className:"h-3.5 w-3.5 text-primary/70 animate-pulse"}),a("span",{children:xg()||"Thinking"}),a(Be,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),a("div",{className:"p-3 pt-0 text-xs text-muted-foreground/90 border-t border-border/40 bg-muted/10 leading-relaxed prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-sans",children:a(ls,{children:oe(l)})})]},`think-${n}`));break}case"toolCall":{let l=String(u.name||u.toolName||ro()),x=u.arguments||u.args;r.push(g("details",{className:"group border border-border/50 rounded-lg bg-violet-500/5 my-2 overflow-hidden",children:[g("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-semibold text-violet-600 dark:text-violet-400 select-none cursor-pointer hover:bg-violet-500/10 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[a(cs,{className:"h-3.5 w-3.5"}),a("span",{children:Eh()}),a("span",{className:"font-mono bg-violet-500/10 px-1.5 py-0.5 rounded text-[11px] text-violet-700 dark:text-violet-300",children:l}),a(Be,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),!!x&&g("div",{className:"p-3 pt-0 text-[10px] text-muted-foreground/90 border-t border-border/40 bg-violet-500/5 font-sans",children:[a("div",{className:"text-[9px] text-muted-foreground/60 uppercase font-bold tracking-wider mb-1.5",children:Bg()||"Arguments"}),a("pre",{className:"font-mono bg-muted/30 p-2 rounded border border-border/30 overflow-x-auto max-h-32",children:JSON.stringify(x,null,2)})]})]},`tool-${n}`));break}case"image":{let l=String(u.mimeType||"image/png"),x=String(u.data||"");r.push(a("div",{className:"my-2 max-w-full",children:x?a("img",{src:x.startsWith("data:")?x:`data:${l};base64,${x}`,alt:"Attached asset",className:"max-h-60 rounded border border-border/50 object-contain shadow-xs"}):a("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:jh()})},`img-${n}`));break}default:{let l=JSON.stringify(s,null,2);if(l==="{}")return;r.push(a("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:l},`other-${n}`))}}}),r.length===0)return null;let d=!1;if(i.length>0){let s=i[i.length-1];if(typeof s==="string"&&s.trim().length>0)d=!0;else if(s&&typeof s==="object"){let n=s;if(n.type==="text"&&typeof n.text==="string"&&n.text.trim().length>0)d=!0}}return g("div",{className:"flex flex-col w-full space-y-1",children:[a("div",{className:"space-y-2 w-full",children:r}),d&&a("div",{className:"text-[10px] text-muted-foreground self-start italic pt-1",children:Dx()})]},e.id)}case"toolResult":return a("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 p-2 rounded-md border border-border/50",children:a("span",{className:"font-semibold",children:Ug({name:e.toolName||"tool"})})},e.id);case"thinking_level_change":{let i=e.content||"";return a("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:P(i)},e.id)}default:return null}};return g("div",{ref:Ne,className:U("relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0"),children:[_e&&a("div",{className:"absolute inset-0 bg-accent/30 border-2 border-primary z-50 pointer-events-none flex items-center justify-center p-6 text-center animate-in fade-in duration-150",children:g("div",{className:"bg-background/95 text-foreground px-4 py-3 rounded-xl border border-border/80 flex flex-col items-center gap-2 shadow-lg max-w-[80%] animate-in zoom-in-95 duration-150",children:[a(Ht,{className:"h-6 w-6 text-primary animate-bounce"}),a("span",{className:"text-sm font-semibold text-foreground",children:T_()})]})}),g("div",{className:"h-12 border-b border-border flex items-center justify-between px-4 flex-shrink-0 bg-background/50 backdrop-blur-sm",children:[g("div",{className:"flex items-center gap-2",children:[p&&a("button",{onClick:()=>A(!1),className:"p-1 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:mE(),children:a(Af,{className:"h-4 w-4"})}),a(Ht,{className:"h-5 w-5 text-primary"}),a("span",{className:"font-semibold text-sm",children:p?hy():cO()})]}),a("div",{className:"flex items-center gap-1",children:!p?g(W,{children:[a("button",{onClick:Z,className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:Ny(),children:a(ke,{className:"h-4 w-4"})}),a("button",{onClick:()=>A(!0),className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:hy(),children:a(fo,{className:"h-4 w-4"})})]}):g("button",{onClick:()=>{Z(),A(!1)},className:"flex items-center gap-1 text-xs bg-primary text-primary-foreground px-2.5 py-1 rounded-md hover:bg-primary/90 transition-colors shadow-xs cursor-pointer",children:[a(ke,{className:"h-3.5 w-3.5"}),a("span",{children:Ny()})]})})]}),p?a(Ie,{className:"flex-1 p-3",children:J.length===0?a("div",{className:"text-center text-xs text-muted-foreground py-8",children:N1()}):a("div",{className:"space-y-1",children:J.map((e)=>{let t=e.id===me;return g("div",{onClick:()=>{if(c)pe(c,e.id),A(!1)},className:U("group flex items-center justify-between p-2.5 rounded-lg text-xs cursor-pointer transition-all border border-transparent",t?"bg-accent/80 text-accent-foreground font-medium border-border/40":"hover:bg-muted/60 text-muted-foreground hover:text-foreground"),children:[g("div",{className:"flex flex-col min-w-0 pr-2",children:[a("span",{className:"truncate text-foreground font-medium text-xs",children:e.name||zg()}),a("span",{className:"text-[10px] text-muted-foreground",children:sn(e.updatedAt)})]}),a("button",{onClick:(i)=>{if(i.stopPropagation(),c&&window.confirm(aC()))fe(c,e.id)},className:"opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-1 rounded hover:bg-muted cursor-pointer",title:iC(),children:a(Ue,{className:"h-4 w-4"})})]},e.id)})})}):g(W,{children:[a(Ie,{ref:F,className:"flex-1 p-4 min-h-0 [&>div>div]:!block",children:h.length===0?g("div",{className:"flex flex-col items-center justify-center h-48 border-2 border-dashed border-border rounded-lg text-muted-foreground p-4 text-center",children:[a(Ht,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),a("p",{className:"text-sm",children:T_()})]}):g("div",{className:"space-y-4 pb-4",children:[h.map(Te),_&&h.length>0&&(h[h.length-1].role==="user"||h[h.length-1].customType==="shumai_message")&&g("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground italic",children:[a(V,{className:"h-3 w-3 animate-spin text-primary"}),a("span",{children:IP()})]}),a("div",{ref:re})]})}),a("div",{className:"p-2 flex-shrink-0 bg-background",children:a(Qi,{projectId:m,value:he,onChangeText:ve,placeholder:eD(),disabled:!T||!c,isStreaming:_,onAbort:()=>{if(c)xe(c)},allowMentions:!1,allowAttachments:!0,workspaceAssets:ce,onRemoveWorkspaceAsset:ue,allowMarkup:!0,canMarkup:!!f&&["image","video","pdf"].includes(f.proxyType||""),markupDisabledTooltip:!f?ok():Gh(),allowTimestamp:f?.proxyType==="video"||f?.proxyType==="pdf",currentTime:ie,frameRate:C||f?.media?.metadata?.frameRate||30,startTimecode:K||f?.media?.metadata?.startTimecode,formatTimestamp:D||(f?.proxyType==="pdf"?(e)=>Ky({page:Math.round(e)}):void 0),onTyping:le,onSendMessage:(e,t,i,r,d,s)=>{if(!c)return;ge(c,e,m,k,Se,t,i,d,s)},bottomLeftExtra:a("div",{className:"flex items-center gap-1.5 min-w-0 max-w-full",children:N.length>0?g(Ye,{value:T||"",onValueChange:(e)=>q(e),disabled:_,children:[a(et,{className:"h-8 border-none bg-transparent hover:bg-muted text-muted-foreground hover:text-foreground focus:ring-0 focus:ring-offset-0 px-2 py-0 gap-1.5 text-xs shrink-0 select-none shadow-none max-w-full cursor-pointer",children:a(Xe,{placeholder:cm()})}),a(tt,{children:N.map((e)=>a(be,{value:e.id,className:"cursor-pointer",children:g("div",{className:"flex items-center gap-2",children:[e.avatar?a("img",{src:e.avatar,alt:e.name,className:"w-4 h-4 rounded-full object-cover"}):a(Ht,{className:"w-4 h-4 text-muted-foreground"}),a("span",{className:"text-xs",children:e.name})]})},e.id))})]}):a("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[11px] text-muted-foreground/60 italic select-none",children:a("span",{children:k1()})})})})})]}),I&&g("div",{className:"fixed inset-0 z-[100] bg-black/95 flex flex-col items-center justify-center p-4 animate-in fade-in duration-200",onClick:()=>E(null),children:[a("button",{className:"absolute top-4 right-4 text-white/70 hover:text-white hover:bg-white/20 rounded-full p-2 transition-colors z-50 cursor-pointer",children:a(Ke,{className:"w-8 h-8"})}),a("div",{className:"w-full h-full flex items-center justify-center p-2",children:a("img",{src:I.url,alt:I.name,className:"max-w-full max-h-[85vh] object-contain rounded shadow-2xl cursor-zoom-out",onClick:(e)=>{e.stopPropagation(),E(null)}})}),a("div",{className:"absolute bottom-6 text-white text-sm font-medium bg-black/50 px-4 py-2 rounded-full backdrop-blur-sm",children:I.name})]})]})}
|
|
2
2
|
export{Ra};
|