Files
proxy_web_site/static/js/1283-5f006781ced80196.js

1 line
63 KiB
JavaScript
Raw Permalink Normal View History

2025-07-12 15:34:14 +08:00
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1283],{3586:(e,t,r)=>{"use strict";r.d(t,{C:()=>m,J:()=>u});var n=r(13368),s=r(5772),i=r(7620),a=r(24578),o=r(25316);let l=(0,o.createServerReference)("408eee4ac3d79d94417304c41179663415f055b2fc",o.callServer,void 0,o.findSourceMapURL,"streamAIChatResponse");var c=r(62574);let d=n.v(e=>({state:{opened:!1,responseId:null,messages:[],followUpSuggestions:[],loading:!1,error:!1},setState:t=>e(e=>({state:{...e.state,...t(e.state)}}))}));function u(){return n.P(d,e=>e.state)}function m(){let e=function(){let e=function(){let e=(0,c.aP)();return i.useMemo(()=>({location:e?{spaceId:e.spaceId,pageId:e.pageId}:void 0}),[e])}(),t=i.useRef(e);return i.useEffect(()=>{t.current=e},[e]),t}(),t=n.P(d,e=>e.setState),r=(0,a.jt)();return i.useMemo(()=>({open:()=>t(e=>({...e,opened:!0})),close:()=>t(e=>({...e,opened:!1})),clear:()=>t(e=>({opened:e.opened,loading:!1,messages:[],followUpSuggestions:[],responseId:null,error:!1})),postMessage:async n=>{r({type:"ask_question",query:n.message}),t(e=>({...e,messages:[...e.messages,{role:s.W7.User,content:n.message},{role:s.W7.Assistant,content:null}],followUpSuggestions:[],loading:!0,error:!1}));try{var i;for await(let r of(await l({message:n.message,messageContext:e.current,previousResponseId:null!=(i=d.getState().state.responseId)?i:void 0}))){if(!r)continue;let e=r.event;switch(e.type){case"response_finish":t(t=>({...t,responseId:e.responseId,loading:!1,error:!1}));break;case"response_followup_suggestion":t(t=>({...t,followUpSuggestions:[...t.followUpSuggestions,...e.suggestions]}))}t(e=>({...e,messages:[...e.messages.slice(0,-1),{role:s.W7.Assistant,content:r.content}]}))}t(e=>({...e,loading:!1,error:!1}))}catch(e){t(e=>({...e,loading:!1,error:!0}))}}}),[e,t,r])}},4093:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DropdownButton:()=>u,DropdownChevron:()=>d,DropdownMenu:()=>c,DropdownMenuItem:()=>m,DropdownSubMenu:()=>h});var n=r(54568),s=r(86424),i=r(7620),a=r(98743),o=r(6878),l=r(54217);function c(e){let{button:t,children:r,className:s,openOnHover:l=!1}=e,[c,d]=(0,i.useState)(!1),[u,m]=(0,i.useState)(!1);return(0,n.jsxs)(o.bL,{modal:!1,open:l?u||c:u,onOpenChange:m,children:[(0,n.jsx)(o.l9,{asChild:!0,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:()=>l?m(!u):null,className:"group/dropdown",children:t}),(0,n.jsx)(o.ZL,{children:(0,n.jsx)(o.UC,{"data-testid":"dropdown-menu",hideWhenDetached:!0,collisionPadding:8,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),align:"start",className:"z-40 animate-scaleIn pt-2",children:(0,n.jsx)("div",{className:(0,a.P)("flex max-h-80 min-w-40 max-w-[40vw] flex-col gap-1 overflow-auto rounded-lg straight-corners:rounded-sm bg-tint-base p-2 shadow-lg ring-1 ring-tint-subtle sm:min-w-52 sm:max-w-80",s),children:r})})})]})}function d(){return(0,n.jsx)(s.In,{icon:"chevron-down",className:(0,a.P)("shrink-0","opacity-6","size-3","ms-1","transition-all","group-hover/dropdown:opacity-11","group-data-[state=open]/dropdown:opacity-11","group-data-[state=open]/dropdown:rotate-180")})}function u(e){let{children:t,className:r}=e;return(0,n.jsxs)("div",{className:(0,a.P)("group/dropdown","flex","items-center",r),children:[t,(0,n.jsx)(d,{})]})}function m(e){let{children:t,active:r=!1,href:s,className:i,insights:c,...d}=e,u=(0,a.P)("rounded straight-corners:rounded-sm px-3 py-1 text-sm flex gap-2 items-center",r?"bg-primary text-primary-strong data-[highlighted]:bg-primary-hover":"data-[highlighted]:bg-tint-hover","focus:outline-none",e.disabled?"opacity-7 cursor-not-allowed":"cursor-pointer",i);return s?(0,n.jsx)(o.q7,{...d,asChild:!0,children:(0,n.jsx)(l.N_,{href:s,insights:c,className:u,children:t})}):(0,n.jsx)(o.q7,{...d,className:(0,a.P)("px-3 py-1",u,i),children:t})}function h(e){let{children:t,label:r}=e;return(0,n.jsxs)(o.Pb,{children:[(0,n.jsxs)(o.ZP,{className:"flex cursor-pointer items-center justify-between rounded straight-corners:rounded-sm px-3 py-1 text-sm focus:outline-none data-[highlighted]:bg-tint-hover",children:[r,(0,n.jsx)(s.In,{icon:"chevron-right",className:"size-3 shrink-0 opacity-6"})]}),(0,n.j