1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[966],{50966:function(e,r,o){o.r(r),o.d(r,{default:function(){return w}});var n=o(57437),s=o(21183),i=o(98314),l=o(40006),a=o(25112),t=o(60373),c=o(61832),x=o(70857),d=o(39292),p=o(73036),g=o(72940),h=o(45652),u=o(8906),j=o(26440),S=o(2265),f=o(85323),b=o(1908),m=o(41714),v=o(93913),y=o(29716),z=o(25954),k=o(63150);function w(e){let{simulationId:r}=e,[o,w]=(0,S.useState)(1),[T,C]=(0,S.useState)(""),[B,I]=(0,S.useState)(null),[R,H]=(0,S.useState)({}),N=new URLSearchParams({page:o,limit:10});T&&N.set("personaId",T);let{data:W,isLoading:P}=(0,f.ZP)("/api/lab/simulations/".concat(r,"/conversations?").concat(N.toString()),b._i),_=(null==W?void 0:W.conversations)||[],A=(null==W?void 0:W.total)||0,F=null==W?void 0:W.hasMore,D=(null==W?void 0:W.personaBreakdown)||[],V=async e=>{if(B===e.id){I(null);return}if(I(e.id),!R[e.id])try{var o;let n=await fetch("/api/lab/simulations/".concat(r,"/conversations?page=1&limit=50&detail=1").concat(e.personaId?"&personaId=".concat(e.personaId):"")),s=await n.json(),i=null===(o=s.conversations)||void 0===o?void 0:o.find(r=>r.id===e.id);i&&H(r=>({...r,[e.id]:i}))}catch(e){}},E=_.reduce((e,r)=>(r.personaId&&!e.find(e=>e.id===r.personaId)&&e.push({id:r.personaId,name:r.personaName||r.personaId}),e),[]),M=e=>e>=75?"green":e>=55?"yellow":"red";return(0,n.jsxs)(s.Box,{p:"5",borderRadius:"xl",border:"1px solid",borderColor:"gray.200",bg:"white",mb:"6",children:[(0,n.jsxs)(i.Flex,{align:"center",justify:"space-between",mb:"4",flexWrap:"wrap",gap:"2",children:[(0,n.jsxs)(l.HStack,{spacing:"2",children:[(0,n.jsx)(a.Icon,{as:m.t,color:"purple.500",boxSize:"5"}),(0,n.jsx)(t.Text,{fontWeight:"600",fontSize:"15px",color:"gray.800",children:"Synthetic Conversations"}),A>0&&(0,n.jsx)(c.Badge,{colorScheme:"purple",borderRadius:"full",px:"2",fontSize:"10px",children:A})]}),E.length>1&&(0,n.jsxs)(x.Select,{size:"xs",maxW:"180px",borderRadius:"lg",value:T,onChange:e=>{C(e.target.value),w(1)},children:[(0,n.jsx)("option",{value:"",children:"All Personas"}),E.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),!T&&D.length>1&&(0,n.jsxs)(s.Box,{mb:"5",p:"4",bg:"gray.50",borderRadius:"xl",border:"1px solid",borderColor:"gray.100",children:[(0,n.jsxs)(l.HStack,{spacing:"2",mb:"3",children:[(0,n.jsx)(a.Icon,{as:k.T,color:"gray.500",boxSize:"4"}),(0,n.jsx)(t.Text,{fontSize:"12px",fontWeight:"600",color:"gray.600",textTransform:"uppercase",letterSpacing:"0.06em",children:"Persona Breakdown"})]}),(0,n.jsx)(d.VStack,{spacing:"2.5",align:"stretch",children:D.map(e=>(0,n.jsxs)(s.Box,{children:[(0,n.jsxs)(i.Flex,{align:"center",justify:"space-between",mb:"1",children:[(0,n.jsx)(t.Text,{fontSize:"12px",color:"gray.700",children:e.personaName}),(0,n.jsxs)(l.HStack,{spacing:"2",children:[(0,n.jsxs)(t.Text,{fontSize:"11px",color:"gray.400",children:[e.count," conv",1!==e.count?"s":""]}),null!=e.avgScore&&(0,n.jsxs)(t.Text,{fontSize:"12px",fontWeight:"600",color:e.avgScore>=75?"green.600":e.avgScore>=55?"yellow.600":"red.600",children:[e.avgScore,"/100"]})]})]}),null!=e.avgScore&&(0,n.jsx)(p.Progress,{value:e.avgScore,max:100,size:"xs",borderRadius:"full",colorScheme:e.avgScore>=75?"green":e.avgScore>=55?"yellow":"red"})]},e.personaId||e.personaName))})]}),P&&(0,n.jsx)(i.Flex,{justify:"center",py:"8",children:(0,n.jsx)(g.Spinner,{size:"sm",color:"purple.400"})}),!P&&0===_.length&&(0,n.jsx)(t.Text,{fontSize:"13px",color:"gray.400",textAlign:"center",py:"6",children:"No conversations recorded for this simulation."}),!P&&_.length>0&&(0,n.jsx)(d.VStack,{spacing:"2",align:"stretch",children:_.map((e,r)=>{let o=B===e.id,x=R[e.id],p=null!=e.overallScore?Math.round(e.overallScore):null;return(0,n.jsxs)(s.Box,{border:"1px solid",borderColor:o?"purple.200":"gray.100",borderRadius:"xl",overflow:"hidden",transition:"border-color 0.15s",children:[(0,n.jsxs)(i.Flex,{align:"center",justify:"space-between",px:"4",py:"3",cursor:"pointer",bg:o?"purple.50":"white",_hover:{bg:o?"purple.50":"gray.50"},onClick:()=>V(e),children:[(0,n.jsxs)(l.HStack,{spacing:"3",children:[(0,n.jsx)(h.Avatar,{name:e.personaName||"Conversation ".concat(r+1),size:"xs",bg
1:"purple.100",color:"purple.700"}),(0,n.jsxs)(s.Box,{children:[(0,n.jsx)(t.Text,{fontSize:"13px",fontWeight:"600",color:"gray.800",children:e.personaName||"Conversation ".concat(r+1)}),(0,n.jsxs)(t.Text,{fontSize:"11px",color:"gray.400",children:[e.turnCount," turn",1!==e.turnCount?"s":""]})]})]}),(0,n.jsxs)(l.HStack,{spacing:"3",children:[null!=p&&(0,n.jsxs)(c.Badge,{colorScheme:M(p),borderRadius:"full",px:"2",fontSize:"11px",children:[p,"/100"]}),(0,n.jsx)(a.Icon,{as:z.k,boxSize:"4",color:"gray.400",transform:o?"rotate(180deg)":"none",transition:"transform 0.15s"})]})]}),o&&(0,n.jsxs)(s.Box,{px:"4",pb:"4",pt:"2",borderTop:"1px solid",borderTopColor:"gray.100",children:[!x&&(0,n.jsx)(i.Flex,{justify:"center",py:"4",children:(0,n.jsx)(g.Spinner,{size:"xs",color:"purple.400"})}),(null==x?void 0:x.messages)&&(0,n.jsx)(d.VStack,{spacing:"3",align:"stretch",mt:"2",children:x.messages.map((e,r)=>(0,n.jsxs)(s.Box,{children:[(0,n.jsxs)(l.HStack,{spacing:"2",align:"flex-start",mb:"2",children:[(0,n.jsx)(a.Icon,{as:v.H,boxSize:"4",color:"gray.400",mt:"0.5",flexShrink:0}),(0,n.jsxs)(s.Box,{flex:"1",bg:"gray.50",borderRadius:"lg",px:"3",py:"2",children:[(0,n.jsx)(t.Text,{fontSize:"11px",fontWeight:"600",color:"gray.500",mb:"0.5",children:"Customer"}),(0,n.jsx)(t.Text,{fontSize:"13px",color:"gray.700",whiteSpace:"pre-wrap",children:e.question})]})]}),(0,n.jsxs)(l.HStack,{spacing:"2",align:"flex-start",children:[(0,n.jsx)(a.Icon,{as:y.h,boxSize:"4",color:"purple.400",mt:"0.5",flexShrink:0}),(0,n.jsxs)(s.Box,{flex:"1",bg:"purple.50",borderRadius:"lg",px:"3",py:"2",children:[(0,n.jsx)(t.Text,{fontSize:"11px",fontWeight:"600",color:"purple.500",mb:"0.5",children:"AI Agent"}),(0,n.jsx)(t.Text,{fontSize:"13px",color:"gray.700",whiteSpace:"pre-wrap",children:e.response})]})]}),r<x.messages.length-1&&(0,n.jsx)(u.Divider,{mt:"3"})]},r))})]})]},e.id)})}),(o>1||F)&&(0,n.jsxs)(l.HStack,{justify:"center",mt:"4",spacing:"2",children:[(0,n.jsx)(j.Button,{size:"xs",variant:"ghost",isDisabled:1===o,onClick:()=>w(e=>e-1),children:"Previous"}),(0,n.jsxs)(t.Text,{fontSize:"12px",color:"gray.500",children:["Page ",o]}),(0,n.jsx)(j.Button,{size:"xs",variant:"ghost",isDisabled:!F,onClick:()=>w(e=>e+1),children:"Next"})]})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.