"use strict";(self.webpackChunk_mlflow_mlflow=self.webpackChunk_mlflow_mlflow||[]).push([[9011],{14429:function(e,t,n){n.d(t,{UY:function(){return m},VA:function(){return c},oy:function(){return d},vF:function(){return o}});var a=n(46709),i=n(91105),r=n(79444);const o="startTimeLabel",s="startTime",l="endTime",d="LAST_7_DAYS",c=()=>{var e;const t=(0,r.U)(),[n,c]=(0,i.ok)(),u=n.get(o)||d;let g=n.get(s)||void 0,T=null!==(e=n.get(l))&&void 0!==e?e:void 0;if("CUSTOM"!==u){const e=m(t.dateNow,{startTimeLabel:u});g=e.startTime,T=e.endTime}else{var f;g=n.get(s)||void 0,T=null!==(f=n.get(l))&&void 0!==f?f:void 0}const p=(0,a.useMemo)((()=>({startTimeLabel:u,startTime:g,endTime:T})),[u,g,T]),v=(0,a.useCallback)(((e,t=!1)=>{c((t=>(void 0===(null===e||void 0===e?void 0:e.startTime)?t.delete(s):"CUSTOM"===e.startTimeLabel&&t.set(s,e.startTime),void 0===(null===e||void 0===e?void 0:e.endTime)?t.delete(l):"CUSTOM"===e.startTimeLabel&&t.set(l,e.endTime),void 0===(null===e||void 0===e?void 0:e.startTimeLabel)?t.delete(o):t.set(o,e.startTimeLabel),t)),{replace:t})}),[c]);return[p,v]};function m(e,t){return t.startTimeLabel&&"CUSTOM"!==t.startTimeLabel?function(e,t){switch(t){case"LAST_HOUR":return{startTime:new Date(new Date(e).setUTCHours((new Date).getUTCHours()-1)).toISOString(),endTime:e.toISOString()};case"LAST_24_HOURS":return{startTime:new Date(new Date(e).setUTCDate((new Date).getUTCDate()-1)).toISOString(),endTime:e.toISOString()};case"LAST_7_DAYS":return{startTime:new Date(new Date(e).setUTCDate((new Date).getUTCDate()-7)).toISOString(),endTime:e.toISOString()};case"LAST_30_DAYS":return{startTime:new Date(new Date(e).setUTCDate((new Date).getUTCDate()-30)).toISOString(),endTime:e.toISOString()};case"LAST_YEAR":return{startTime:new Date(new Date(e).setUTCFullYear((new Date).getUTCFullYear()-1)).toISOString(),endTime:e.toISOString()};case"ALL":return{startTime:void 0,endTime:e.toISOString()};default:throw new Error(`Unexpected start time label: ${t}`)}}(e,t.startTimeLabel):{startTime:t.startTime,endTime:t.endTime}}},27462:function(e,t,n){n.d(t,{F:function(){return r}});var a=n(46709),i=n(40720);const r=({traceSearchLocations:e})=>{const t=(0,i.C)();return(0,a.useMemo)((()=>({deleteTraces:async(e,n)=>t.mutateAsync({experimentId:e,traceRequestIds:n})})),[t])}},28140:function(e,t,n){n.r(t),n.d(t,{default:function(){return D}});var a=n(86846),i=n(59930),r=n.n(i),o=n(91105),s=n(46709),l=n(18154),d=n(79444),c=n(14429),m=n(54741),u=n(48785),g=n(89949),T=n(27299),f=n(27757),p=n(40724),v=n(73408);var h={name:"1vfb318",styles:"flex:1;display:flex;align-items:center;justify-content:center"};const S=({error:e})=>{var t;return(0,v.Y)(T.PageWrapper,{css:h,children:(0,v.Y)(T.Empty,{"data-testid":"fallback",title:(0,v.Y)(p.A,{id:"QXLV8h",defaultMessage:"Error"}),description:null!==(t=null===e||void 0===e?void 0:e.message)&&void 0!==t?t:(0,v.Y)(p.A,{id:"D99bil",defaultMessage:"An error occurred while rendering chat sessions."}),image:(0,v.Y)(f.k,{})})})},b=({children:e})=>(0,v.Y)(g.tH,{fallback:(0,v.Y)(S,{}),children:e});var w=n(27462);var L={name:"l2hjmg",styles:"display:flex;flex-direction:column;flex:1;min-height:0"};const y=()=>{const{experimentId:e}=(0,o.g)(),[t,n]=(0,s.useState)("");r()(e,"Experiment ID must be defined");const[i]=(0,c.VA)(),g=(0,d.U)(),{loading:T}=(0,m.L)({experimentId:e,options:{fetchPolicy:"cache-only"}}),f=(0,s.useMemo)((()=>{const{startTime:e,endTime:t}=(0,c.UY)(g.dateNow,i);return{startTime:e?new Date(e).getTime().toString():void 0,endTime:t?new Date(t).getTime().toString():void 0}}),[g.dateNow,i]),p=(0,s.useMemo)((()=>[(0,l.$U)(e)]),[e]),h=(0,s.useMemo)((()=>(0,u._)({sessionId:null})),[]),{data:S,isLoading:b,isFetching:y}=(0,l.Zn)({locations:p,timeRange:f,filters:h,searchQuery:t,disabled:!1}),D={deleteTracesAction:(0,w.F)({traceSearchLocations:p})};return(0,v.FD)("div",{css:L,children:[(0,v.Y)(a.J,{viewState:"sessions"}),(0,v.Y)(l.sp,{experimentId:e,traces:null!==S&&void 0!==S?S:[],isLoading:b,searchQuery:t,setSearchQuery:n,traceActions:D})]})};var D=()=>(0,v.Y)(b,{children:(0,v.Y)(d.k,{children:(0,v.Y)(y,{})})})},40720:function(e,t,n){n.d(t,{C:function(){return s}});var a=n(39595),i=n(61060),r=n(12803),o=n(18154);const s=()=>{const e=(0,a.jE)();return(0,i.n)({mutationFn:async({experimentId:e,traceRequestIds:t})=>{const n=[];for(let i=0;i<t.length;i+=100)n.push(t.slice(i,i+100));const a=n.map((t=>r.x.deleteTracesV3(e,t)));return{traces_deleted:(await Promise.all(a)).reduce(((e,t)=>e+t.traces_deleted),0)}},onSuccess:()=>(0,o.BL)({queryClient:e})})}},48785:function(e,t,n){n.d(t,{_:function(){return r}});var a=n(18154),i=n(28189);const r=({sessionId:e})=>[{column:`${a.rc}:${i.n2}`,operator:e?a.tl.EQUALS:a.tl.CONTAINS,value:null!==e&&void 0!==e?e:""}]},54741:function(e,t,n){n.d(t,{L:function(){return r}});var a=n(81641);const i=a.J1`
  query MlflowGetExperimentQuery($input: MlflowGetExperimentInput!) @component(name: "MLflow.ExperimentRunTracking") {
    mlflowGetExperiment(input: $input) {
      apiError {
        code
        message
      }
      experiment {
        artifactLocation
        creationTime
        experimentId
        lastUpdateTime
        lifecycleStage
        name
        tags {
          key
          value
        }
      }
    }
  }
`,r=({experimentId:e,options:t={}})=>{var n;const{data:r,loading:o,error:s,refetch:l}=(0,a.IT)(i,{variables:{input:{experimentId:e}},skip:!e,...t});return{loading:o,data:null===r||void 0===r||null===(n=r.mlflowGetExperiment)||void 0===n?void 0:n.experiment,refetch:l,apolloError:s,apiError:(()=>{var e;return null===r||void 0===r||null===(e=r.mlflowGetExperiment)||void 0===e?void 0:e.apiError})()}}},76256:function(e,t,n){n.d(t,{L:function(){return i},S:function(){return r}});var a=n(43617);function i(e,t){return(0,a.N4)(t)}const r=a.N4},79444:function(e,t,n){n.d(t,{U:function(){return d},k:function(){return l}});var a=n(76118),i=n(46709),r=n(73408);const o=()=>({dateNow:new Date,lastRefreshTime:Date.now(),refresh:()=>{}}),s=(0,i.createContext)(o()),l=({config:e,children:t})=>{const n=o(),l=(0,a.merge)({},n,e),[d,c]=i.useState(l.lastRefreshTime),m=(0,i.useMemo)((()=>new Date(d)),[d]),u=(0,i.useCallback)((()=>{c(Date.now())}),[]);return(0,r.Y)(s.Provider,{value:{...l,dateNow:m,lastRefreshTime:d,refresh:u},children:t})},d=()=>{const e=(0,i.useContext)(s);return e||o()}},86846:function(e,t,n){n.d(t,{J:function(){return b}});var a=n(68248),i=n(27757),r=n(27299),o=n(16333),s=n(46709),l=n(79081),d=n(18154),c=n(42747),m=n(92338),u=n(14429),g=n(76118),T=n(16453),f=n(79444),p=n(39595),v=n(92388),h=n(73408);const S=s.memo((()=>{const e=(0,c.tz)(),{theme:t}=(0,i.u)(),n=(0,p.jE)(),o=(0,v.C)({queryKey:[d.TH]}),[S,b]=(0,u.VA)(),w=(0,s.useMemo)((()=>(0,m.p)(e)),[e]),L=e.formatMessage({id:"BJvcsS",defaultMessage:"Time Range"}),y=(0,f.U)();return(0,h.FD)("div",{css:(0,a.AH)({display:"flex",gap:t.spacing.sm,alignItems:"center"},""),children:[(0,h.FD)(r.DialogCombobox,{componentId:"mlflow.experiment-evaluation-monitoring.date-selector",label:L,value:S.startTimeLabel?[S.startTimeLabel]:[u.oy],children:[(0,h.Y)(r.DialogComboboxTrigger,{renderDisplayedValue:e=>{var t;return null===(t=w.find((t=>t.key===e)))||void 0===t?void 0:t.label},allowClear:!(0,g.isNil)(S.startTimeLabel)&&S.startTimeLabel!==u.oy,onClear:()=>{b({startTimeLabel:u.oy})},"data-testid":"time-range-select-dropdown"}),(0,h.Y)(r.DialogComboboxContent,{children:(0,h.Y)(r.DialogComboboxOptionList,{children:w.map((e=>(0,h.Y)(r.DialogComboboxOptionListSelectItem,{checked:S.startTimeLabel===e.key||e.key===u.oy&&(0,g.isNil)(S.startTimeLabel),title:e.label,"data-testid":`time-range-select-${e}`,value:e.key,onChange:()=>{b({...S,startTimeLabel:e.key})},children:e.label},e.key)))})})]}),"CUSTOM"===S.startTimeLabel&&(0,h.Y)(h.FK,{children:(0,h.Y)(T.cv,{id:"date-picker-range",includeTime:!0,selected:{from:new Date(S.startTime),to:S.endTime?new Date(S.endTime):y.dateNow},onChange:e=>{const t=e.target.value;b({...S,startTime:null!==t&&void 0!==t&&t.from?t.from.toISOString():void 0,endTime:null!==t&&void 0!==t&&t.to?t.to.toISOString():void 0})},startDatePickerProps:{componentId:"experiment-evaluation-monitoring-start-date-picker",datePickerProps:{disabled:{after:y.dateNow}},value:S.startTime?new Date(S.startTime):void 0},endDatePickerProps:{componentId:"experiment-evaluation-monitoring-end-date-picker",datePickerProps:{disabled:{after:y.dateNow}},value:S.endTime?new Date(S.endTime):void 0}})}),(0,h.Y)(l.T,{componentId:"mlflow.experiment-evaluation-monitoring.trace-info-hover-request-time",content:e.formatMessage({id:"Arvaod",defaultMessage:"Showing data up to {date}."},{date:y.dateNow.toLocaleString(navigator.language,{timeZoneName:"short"})}),children:(0,h.Y)(i.B,{type:"link",componentId:"mlflow.experiment-evaluation-monitoring.refresh-date-button",disabled:Boolean(o),onClick:()=>{y.refresh(),(0,d.BL)({queryClient:n})},children:(0,h.Y)(r.RefreshIcon,{})})})]})})),b=({viewState:e,sessionId:t})=>{const{theme:n}=(0,i.u)();return(0,h.FD)("div",{css:(0,a.AH)({display:"flex",alignItems:"center",width:"100%",borderBottom:`1px solid ${n.colors.grey100}`,paddingBottom:`${n.spacing.sm}px`},""),children:[!("single-chat-session"===e)&&(0,h.Y)(S,{}),"single-chat-session"===e&&(0,h.FD)("div",{css:(0,a.AH)({display:"flex",alignItems:"center",gap:n.spacing.sm},""),children:[(0,h.Y)(r.Tag,{color:"default",componentId:"mlflow.chat-sessions.session-header-label",css:(0,a.AH)({padding:n.spacing.xs+2,margin:0},""),children:(0,h.FD)("span",{css:(0,a.AH)({display:"flex",alignItems:"center",gap:n.spacing.sm},""),children:[(0,h.Y)(r.SpeechBubbleIcon,{}),(0,h.Y)(i.T.Text,{ellipsis:!0,bold:!0,children:(0,h.Y)(c.sA,{id:"EAf6xM",defaultMessage:"Session"})})]})}),(0,h.Y)(i.T.Title,{level:3,withoutMargins:!0,children:t}),t&&(0,h.Y)(o.ad,{copyText:t,componentId:"mlflow.chat-sessions.copy-session-id",buttonProps:{icon:void 0}})]})]})}},92338:function(e,t,n){function a(e){return[{key:"LAST_HOUR",label:e.formatMessage({id:"bjoGjg",defaultMessage:"Last hour"})},{key:"LAST_24_HOURS",label:e.formatMessage({id:"JChRnq",defaultMessage:"Last 24 hours"})},{key:"LAST_7_DAYS",label:e.formatMessage({id:"eQsXm7",defaultMessage:"Last 7 days"})},{key:"LAST_30_DAYS",label:e.formatMessage({id:"p1H1KR",defaultMessage:"Last 30 days"})},{key:"LAST_YEAR",label:e.formatMessage({id:"EI7moF",defaultMessage:"Last year"})},{key:"ALL",label:e.formatMessage({id:"HeNa8H",defaultMessage:"All"})},{key:"CUSTOM",label:e.formatMessage({id:"TpmJlu",defaultMessage:"Custom"})}]}n.d(t,{p:function(){return a}})}}]);