"use strict";(self.webpackChunk_mlflow_mlflow=self.webpackChunk_mlflow_mlflow||[]).push([[989],{14429:function(e,t,n){n.d(t,{UY:function(){return c},VA:function(){return m},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",m=()=>{var e;const t=(0,r.U)(),[n,m]=(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=c(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)=>{m((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})}),[m]);return[p,v]};function c(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}}},40989:function(e,t,n){n.r(t);var a=n(42747),i=n(31655),r=n(43979),o=n(59930),s=n.n(o),l=n(91105),d=n(46709),m=n(83887),c=n(79444),u=n(14429),g=n(54741),T=n(48785),f=n(89949),p=n(73408);var v={name:"l2hjmg",styles:"display:flex;flex-direction:column;flex:1;min-height:0"};const S=()=>{const{experimentId:e}=(0,l.g)();s()(e,"Experiment ID must be defined");const[t]=(0,u.VA)(),n=(0,c.U)(),{loading:a}=(0,g.L)({experimentId:e,options:{fetchPolicy:"cache-only"}}),o=(0,d.useMemo)((()=>{const{startTime:e,endTime:a}=(0,u.UY)(n.dateNow,t);return{startTime:e?new Date(e).getTime().toString():void 0,endTime:a?new Date(a).getTime().toString():void 0}}),[n.dateNow,t]),f=(0,d.useMemo)((()=>[(0,m.$U)(e)]),[e]),S=(0,d.useMemo)((()=>(0,T._)({sessionId:null})),[]),{data:w,isLoading:b}=(0,m.Zn)({locations:f,timeRange:o,filters:S,disabled:!1});return(0,i.$F)()?(0,p.FD)("div",{css:v,children:[(0,p.Y)(r.J,{viewState:"sessions"}),(0,p.Y)(m.sp,{experimentId:e,traces:null!==w&&void 0!==w?w:[],isLoading:b})]}):(0,p.Y)("div",{})};t.default=()=>(0,p.Y)(f.tH,{fallback:(0,p.Y)(a.sA,{id:"bJpL0f",defaultMessage:"An error occurred while rendering chat sessions."}),children:(0,p.Y)(c.k,{children:(0,p.Y)(S,{})})})},43979:function(e,t,n){n.d(t,{J:function(){return d}});var a=n(68248),i=n(27757),r=n(74060),o=n(84411),s=n(42747),l=n(73408);const d=({viewState:e,sessionId:t})=>{const{theme:n}=(0,i.u)();return(0,l.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,l.Y)(o.$,{}),"single-chat-session"===e&&(0,l.FD)("div",{css:(0,a.AH)({display:"flex",alignItems:"center",gap:n.spacing.sm},""),children:[(0,l.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,l.FD)("span",{css:(0,a.AH)({display:"flex",alignItems:"center",gap:n.spacing.sm},""),children:[(0,l.Y)(r.SpeechBubbleIcon,{}),(0,l.Y)(i.T.Text,{ellipsis:!0,bold:!0,children:(0,l.Y)(s.sA,{id:"EAf6xM",defaultMessage:"Session"})})]})}),(0,l.Y)(i.T.Title,{level:3,withoutMargins:!0,children:t})]})]})}},48785:function(e,t,n){n.d(t,{_:function(){return r}});var a=n(83887),i=n(23125);const r=({sessionId:e})=>[{column:`${a.rc}:${i.SESSION_ID_METADATA_KEY}`,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(34794);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})()}}},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,m]=i.useState(l.lastRefreshTime),c=(0,i.useMemo)((()=>new Date(d)),[d]),u=(0,i.useCallback)((()=>{m(Date.now())}),[]);return(0,r.Y)(s.Provider,{value:{...l,dateNow:c,lastRefreshTime:d,refresh:u},children:t})},d=()=>{const e=(0,i.useContext)(s);return e||o()}},84411:function(e,t,n){n.d(t,{$:function(){return S}});var a=n(68248),i=n(46709),r=n(27757),o=n(74060),s=n(79081),l=n(83887),d=n(42747),m=n(92338),c=n(14429),u=n(76118),g=n(16453),T=n(79444),f=n(39595),p=n(92388),v=n(73408);const S=i.memo((()=>{const e=(0,d.tz)(),{theme:t}=(0,r.u)(),n=(0,f.jE)(),S=(0,p.C)({queryKey:[l.TH]}),[w,b]=(0,c.VA)(),h=(0,i.useMemo)((()=>(0,m.p)(e)),[e]),D=e.formatMessage({id:"BJvcsS",defaultMessage:"Time Range"}),L=(0,T.U)();return(0,v.FD)("div",{css:(0,a.AH)({display:"flex",gap:t.spacing.sm,alignItems:"center"},""),children:[(0,v.FD)(o.DialogCombobox,{componentId:"mlflow.experiment-evaluation-monitoring.date-selector",label:D,value:w.startTimeLabel?[w.startTimeLabel]:[c.oy],children:[(0,v.Y)(o.DialogComboboxTrigger,{renderDisplayedValue:e=>{var t;return null===(t=h.find((t=>t.key===e)))||void 0===t?void 0:t.label},allowClear:!(0,u.isNil)(w.startTimeLabel)&&w.startTimeLabel!==c.oy,onClear:()=>{b({startTimeLabel:c.oy})},"data-testid":"time-range-select-dropdown"}),(0,v.Y)(o.DialogComboboxContent,{children:(0,v.Y)(o.DialogComboboxOptionList,{children:h.map((e=>(0,v.Y)(o.DialogComboboxOptionListSelectItem,{checked:w.startTimeLabel===e.key||e.key===c.oy&&(0,u.isNil)(w.startTimeLabel),title:e.label,"data-testid":`time-range-select-${e}`,value:e.key,onChange:()=>{b({...w,startTimeLabel:e.key})},children:e.label},e.key)))})})]}),"CUSTOM"===w.startTimeLabel&&(0,v.Y)(v.FK,{children:(0,v.Y)(g.cv,{id:"date-picker-range",includeTime:!0,selected:{from:new Date(w.startTime),to:w.endTime?new Date(w.endTime):L.dateNow},onChange:e=>{const t=e.target.value;b({...w,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:L.dateNow}},value:w.startTime?new Date(w.startTime):void 0},endDatePickerProps:{componentId:"experiment-evaluation-monitoring-end-date-picker",datePickerProps:{disabled:{after:L.dateNow}},value:w.endTime?new Date(w.endTime):void 0}})}),(0,v.Y)(s.T,{componentId:"mlflow.experiment-evaluation-monitoring.trace-info-hover-request-time",content:e.formatMessage({id:"Arvaod",defaultMessage:"Showing data up to {date}."},{date:L.dateNow.toLocaleString(navigator.language,{timeZoneName:"short"})}),children:(0,v.Y)(r.B,{type:"link",componentId:"mlflow.experiment-evaluation-monitoring.refresh-date-button",disabled:Boolean(S),onClick:()=>{L.refresh(),(0,l.BL)({queryClient:n})},children:(0,v.Y)(o.RefreshIcon,{})})})]})}))},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}})}}]);