promptfoo 0.72.0 → 0.72.1
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/LICENSE +1 -1
- package/dist/package.json +2 -2
- package/dist/src/commands/generate/redteam.d.ts +43 -13
- package/dist/src/commands/generate/redteam.d.ts.map +1 -1
- package/dist/src/commands/generate/redteam.js +63 -22
- package/dist/src/commands/generate/redteam.js.map +1 -1
- package/dist/src/commands/redteam.d.ts +0 -7
- package/dist/src/commands/redteam.d.ts.map +1 -1
- package/dist/src/commands/redteam.js +72 -89
- package/dist/src/commands/redteam.js.map +1 -1
- package/dist/src/commands/share.d.ts.map +1 -1
- package/dist/src/commands/share.js +4 -1
- package/dist/src/commands/share.js.map +1 -1
- package/dist/src/database.d.ts +1129 -3
- package/dist/src/database.d.ts.map +1 -1
- package/dist/src/onboarding.d.ts.map +1 -1
- package/dist/src/onboarding.js +23 -36
- package/dist/src/onboarding.js.map +1 -1
- package/dist/src/providers/bedrock.js +1 -1
- package/dist/src/providers/bedrock.js.map +1 -1
- package/dist/src/providers/manualInput.d.ts.map +1 -1
- package/dist/src/providers/manualInput.js +3 -22
- package/dist/src/providers/manualInput.js.map +1 -1
- package/dist/src/providers.d.ts.map +1 -1
- package/dist/src/providers.js +4 -5
- package/dist/src/providers.js.map +1 -1
- package/dist/src/redteam/constants.d.ts +2 -2
- package/dist/src/redteam/constants.d.ts.map +1 -1
- package/dist/src/redteam/constants.js +1 -1
- package/dist/src/redteam/constants.js.map +1 -1
- package/dist/src/redteam/index.d.ts +2 -6
- package/dist/src/redteam/index.d.ts.map +1 -1
- package/dist/src/redteam/index.js +7 -16
- package/dist/src/redteam/index.js.map +1 -1
- package/dist/src/redteam/methods/injections.d.ts.map +1 -1
- package/dist/src/redteam/methods/injections.js +10 -0
- package/dist/src/redteam/methods/injections.js.map +1 -1
- package/dist/src/types.d.ts +30597 -174
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +242 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/util/index.d.ts +520 -2
- package/dist/src/util/index.d.ts.map +1 -1
- package/dist/src/web/nextui/404/index.html +1 -1
- package/dist/src/web/nextui/404.html +1 -1
- package/dist/src/web/nextui/_next/static/chunks/737-538f50dc31cc8c49.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/auth/login/{page-2e6452987650f232.js → page-2e2c0c725127ea2d.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/app/auth/signup/{page-d81a6cfb22f8b8a2.js → page-ccdb1f6890601666.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/app/datasets/page-642db4f4a8e8ba40.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/not-found-ce320e6d1e6d1d23.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/{page-81aa116b34ef4a6b.js → page-0a39d3450aa09dda.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/page-32eaa14d2384c5b0.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/{layout-ed6af4caf66026a5.js → layout-4282b1d33566e258.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/app/{page-122e9cfa52eb218a.js → page-5650318e57510b6c.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/app/progress/{page-aa447776a6487d50.js → page-462526776efd6fd6.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/app/prompts/{page-ac63288a243a9872.js → page-0ae78bc0bf7c56bc.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/app/report/{page-be70065fb1472831.js → page-e4f7851d41eb0f92.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/app/setup/{page-b19fc52e084a3efe.js → page-6cde750ec428cd75.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/{main-app-7a1376166cb8b72e.js → main-app-929a26b3c8cd3f7a.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/{webpack-8a9bc9ee0defb756.js → webpack-c9f728822666f852.js} +1 -1
- package/dist/src/web/nextui/_next/static/css/5bd2f45de1f3ba83.css +1 -0
- package/dist/src/web/nextui/auth/login/index.html +1 -1
- package/dist/src/web/nextui/auth/login/index.txt +6 -6
- package/dist/src/web/nextui/auth/signup/index.html +1 -1
- package/dist/src/web/nextui/auth/signup/index.txt +6 -6
- package/dist/src/web/nextui/datasets/index.html +1 -1
- package/dist/src/web/nextui/datasets/index.txt +6 -6
- package/dist/src/web/nextui/eval/index.html +1 -1
- package/dist/src/web/nextui/eval/index.txt +6 -6
- package/dist/src/web/nextui/index.html +1 -1
- package/dist/src/web/nextui/index.txt +5 -5
- package/dist/src/web/nextui/progress/index.html +1 -1
- package/dist/src/web/nextui/progress/index.txt +6 -6
- package/dist/src/web/nextui/prompts/index.html +1 -1
- package/dist/src/web/nextui/prompts/index.txt +6 -6
- package/dist/src/web/nextui/report/index.html +1 -1
- package/dist/src/web/nextui/report/index.txt +6 -6
- package/dist/src/web/nextui/setup/index.html +1 -1
- package/dist/src/web/nextui/setup/index.txt +7 -7
- package/package.json +2 -2
- package/dist/src/web/nextui/_next/static/chunks/737-dbd25d447fbc5006.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/datasets/page-73b93abb6a46ca0e.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/not-found-fe10d5df88bc44ef.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/page-56e122e6f2a64557.js +0 -1
- package/dist/src/web/nextui/_next/static/css/106779eb64615639.css +0 -1
- /package/dist/src/web/nextui/_next/static/{9oVNcJw_yPT1Zu44NMAgc → 8E4q0Tmu22G1wENZyXEq0}/_buildManifest.js +0 -0
- /package/dist/src/web/nextui/_next/static/{9oVNcJw_yPT1Zu44NMAgc → 8E4q0Tmu22G1wENZyXEq0}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[737],{49532:function(e,t,n){"use strict";let s,l;async function a(){if(s||(l||(l=fetch("/api/config").then(e=>e.json()).then(e=>s=e.apiBaseUrl)),await l),void 0===s)throw Error("API base URL is undefined");return s}n.d(t,{b:function(){return a}})},15737:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return tl}});var s=n(24004),l=n(14978),a=n(77580);let r=a.env.NEXT_PUBLIC_PROMPTFOO_REMOTE_API_BASE_URL||a.env.NEXT_PUBLIC_PROMPTFOO_BASE_URL||a.env.PROMPTFOO_REMOTE_API_BASE_URL||"https://api.promptfoo.dev",i=a.env.NEXT_PUBLIC_PROMPTFOO_BASE_URL||a.env.PROMPTFOO_REMOTE_APP_BASE_URL||"https://app.promptfoo.dev";a?.stdout?.columns&&a?.stdout?.columns>10&&a?.stdout?.columns;var o=n(49532);let c=(0,l.createContext)(void 0),d=e=>{let{children:t}=e,[n,a]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let e=e=>{"Shift"===e.key&&a(!0)},t=e=>{"Shift"===e.key&&a(!1)};return window.addEventListener("keydown",e),window.addEventListener("keyup",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t)}},[]),(0,s.jsx)(c.Provider,{value:n,children:t})};var u=n(42671),h=n(6363);let p=(0,l.createContext)(void 0),m=()=>{let e=(0,l.useContext)(p);if(!e)throw Error("useToast must be used within a ToastProvider");return e},x=e=>{let{children:t}=e,[n,a]=(0,l.useState)({message:"",severity:"info",open:!1}),r=()=>{a(e=>({...e,open:!1}))};return(0,s.jsxs)(p.Provider,{value:{showToast:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info";a({message:e,severity:t,open:!0})}},children:[t,(0,s.jsx)(u.Z,{open:n.open,autoHideDuration:6e3,onClose:r,children:(0,s.jsx)(h.Z,{onClose:r,severity:n.severity,children:n.message})})]})};var g=n(52428),v=n(11615),j=n(12594),f=n(28891),b=n(74997),y=n(93179),Z=n(47887),w=n(43205),C=n(5592),k=n(14931),S=n(75307),R=n(17178),I=n(42610),N=n(49567),E=n(40982),P=n(24362),F=n(885),T=n(39813),D=n(1852),M=n(57027),O=n(94941),L=n(36273),A=n(96976),U=n(8508),W=n(34304),z=n(32414),_=n(67339),V=n(65969),B=n(63147),J=n(14059),H=n(23223),K=n(94068),G=n(29794),X=n(22701),q=n(51956),Y=n(82669),$=n(37803),Q=n(65068),ee=n(70417),et=n(21303),en=n(61451),es=n(26485),el=n(30021),ea=n(32162),er=n.n(ea),ei=e=>{let{open:t,onClose:n,recentEvals:a,onRecentEvalSelected:r,title:i,description:o}=e,[c,d]=(0,l.useState)(""),[u,h]=(0,l.useState)(-1),p=l.useRef(null),m=l.useRef(null),x=()=>{n(),d(""),h(-1)},g=a.filter(e=>er()(c.toLowerCase(),e.label.toLowerCase())||"string"==typeof e.description&&er()(c.toLowerCase(),e.description.toLowerCase())),v=e=>{r(e),x()},j=l.useCallback(()=>{if(u>=0&&m.current){let e=m.current.querySelectorAll("tbody tr"),t=Math.min(u+3,e.length-1);e[t]&&e[t].scrollIntoView({behavior:"smooth",block:"nearest"})}},[u]);l.useEffect(()=>{j()},[j]),l.useEffect(()=>{t&&(h(0),setTimeout(()=>{var e;null===(e=p.current)||void 0===e||e.focus()},0))},[t]);let f=l.useId();return(0,s.jsxs)(G.Z,{open:t,onClose:x,maxWidth:"md",fullWidth:!0,children:[i?(0,s.jsx)(Y.Z,{children:i}):null,(0,s.jsxs)(q.Z,{children:[o?(0,s.jsx)(N.Z,{sx:{mb:4},children:o}):null,(0,s.jsxs)(N.Z,{sx:{width:"100%",mt:2},children:[(0,s.jsx)(_.Z,{fullWidth:!0,variant:"outlined",placeholder:"Search",value:c,onChange:e=>{d(e.target.value),h(0)},onKeyDown:e=>{if(e.stopPropagation(),t)switch(e.key){case"ArrowDown":e.preventDefault(),h(e=>Math.min(e+1,g.length-1));break;case"ArrowUp":e.preventDefault(),h(e=>Math.max(e-1,0));break;case"Enter":e.preventDefault(),u>=0&&u<g.length?v(g[u].evalId):g.length>0&&v(g[0].evalId);break;case"Escape":e.preventDefault(),x()}},sx:{mb:2},inputRef:p,id:"eval-selector-search-".concat(f)}),(0,s.jsx)(en.Z,{component:$.Z,sx:{height:"600px",overflow:"auto"},ref:m,children:(0,s.jsxs)(Q.Z,{stickyHeader:!0,children:[(0,s.jsx)(es.Z,{children:(0,s.jsxs)(el.Z,{children:[(0,s.jsx)(et.Z,{children:"Created"}),(0,s.jsx)(et.Z,{children:"Description"}),(0,s.jsx)(et.Z,{children:"# Tests"})]})}),(0,s.jsx)(ee.Z,{children:g.length>0?g.map((e,t)=>(0,s.jsxs)(el.Z,{hover:!0,onClick:()=>v(e.evalId),sx:{cursor:"pointer",backgroundColor:t===u?"rgba(255, 255, 0, 0.1)":"inherit"},children:[(0,s.jsx)(et.Z,{children:new Date(e.createdAt).toLocaleString()}),(0,s.jsx)(et.Z,{children:e.description||e.label}),(0,s.jsx)(et.Z,{children:e.numTests})]},e.evalId)):(0,s.jsx)(el.Z,{children:(0,s.jsx)(et.Z,{colSpan:3,align:"center",sx:{py:4},children:(0,s.jsxs)(N.Z,{sx:{textAlign:"center",color:"text.secondary"},children:[(0,s.jsx)(N.Z,{sx:{fontSize:"3rem",mb:2},children:"\uD83D\uDD0D"}),(0,s.jsx)(B.Z,{variant:"h6",gutterBottom:!0,children:"No evaluations found"}),(0,s.jsx)(B.Z,{variant:"body2",children:"Try adjusting your search or create a new evaluation"})]})})})})]})})]})]}),(0,s.jsx)(X.Z,{children:(0,s.jsx)(E.Z,{onClick:x,children:"Cancel"})})]})},eo=n(37204),ec=n(79685),ed=n(74595);let eu={getItem:async e=>await (0,eo.U2)(e)||null,setItem:async(e,t)=>{await (0,eo.t8)(e,t)},removeItem:async e=>{await (0,eo.IV)(e)}},eh=(0,ec.Ue)()((0,ed.tJ)((e,t)=>({evalId:null,setEvalId:t=>e(()=>({evalId:t})),author:null,setAuthor:t=>e(()=>({author:t})),table:null,setTable:t=>e(()=>({table:t})),config:null,setConfig:t=>e(()=>({config:t})),maxTextLength:250,setMaxTextLength:t=>e(()=>({maxTextLength:t})),wordBreak:"break-word",setWordBreak:t=>e(()=>({wordBreak:t})),showInferenceDetails:!0,setShowInferenceDetails:t=>e(()=>({showInferenceDetails:t})),renderMarkdown:!1,setRenderMarkdown:t=>e(()=>({renderMarkdown:t})),prettifyJson:!1,setPrettifyJson:t=>e(()=>({prettifyJson:t})),showPrompts:!1,setShowPrompts:t=>e(()=>({showPrompts:t})),showPassFail:!0,setShowPassFail:t=>e(()=>({showPassFail:t})),inComparisonMode:!1,setInComparisonMode:t=>e(()=>({inComparisonMode:t}))}),{name:"ResultsViewStorage",storage:(0,ed.FL)(()=>eu)}));var ep=function(e){let{initialEvals:t,onComparisonEvalSelected:n}=e,{evalId:a}=eh(),[r,i]=(0,l.useState)(!1),[c,d]=(0,l.useState)(t),u=async()=>{try{let e=await (0,o.b)(),n=a||t[0].evalId,s=await fetch("".concat(e,"/api/results/").concat(n),{cache:"no-store"}),l=await s.json(),r=l.data.datasetId;if(!r){console.error("No datasetId found for current eval "+n);return}let i=await fetch("".concat(e,"/api/results?datasetId=").concat(r),{cache:"no-store"}),c=await i.json();d(c.data.filter(e=>e.evalId!==n))}catch(e){console.error("Error fetching recent evals:",e)}},h=()=>{i(!1)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(V.Z,{title:"Combine this eval with another eval run",placement:"left",children:(0,s.jsxs)(A.Z,{onClick:()=>{u(),i(!0)},children:[(0,s.jsx)(M.Z,{children:(0,s.jsx)(K.Z,{fontSize:"small"})}),(0,s.jsx)(O.Z,{children:"Compare with another eval"})]})}),(0,s.jsx)(ei,{open:r,onClose:h,recentEvals:c,onRecentEvalSelected:e=>{n(e),h()},title:"Select an eval to compare",description:"Only evals with the same dataset can be compared."})]})},em=n(26110),ex=n(48931),eg=n(99645),ev=n(77656);function ej(e){let{open:t,onClose:a}=e,{config:r}=eh(),i=l.useRef(null),[o,c]=l.useState(!1),[d,u]=l.useState("");l.useEffect(()=>{t&&(async()=>{let{default:e}=await Promise.resolve().then(n.bind(n,34235));u(e.dump(r))})()},[t,r]);let h=()=>{c(!1),a()};return(0,s.jsxs)(G.Z,{open:t,onClose:h,"aria-labelledby":"config-dialog-title",maxWidth:"md",fullWidth:!0,children:[(0,s.jsx)(Y.Z,{id:"config-dialog-title",children:(0,s.jsxs)(N.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,s.jsx)(B.Z,{variant:"h6",style:{flexGrow:1},children:"Config"}),(0,s.jsxs)(N.Z,{children:[(0,s.jsx)(V.Z,{title:"Copy to clipboard",children:(0,s.jsx)(ev.Z,{onClick:()=>{i.current&&(i.current.select(),document.execCommand("copy"),c(!0))},children:o?(0,s.jsx)(em.Z,{}):(0,s.jsx)(eg.Z,{})})}),(0,s.jsx)(V.Z,{title:"Download .yaml",children:(0,s.jsx)(ev.Z,{onClick:()=>{let e=new Blob([d],{type:"text/yaml;charset=utf-8"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download="config.yaml",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},children:(0,s.jsx)(ex.Z,{})})})]})]})}),(0,s.jsx)(q.Z,{children:(0,s.jsx)(B.Z,{variant:"body1",component:"div",children:(0,s.jsx)("textarea",{ref:i,readOnly:!0,value:d,style:{width:"100%",minHeight:"400px",fontFamily:"monospace",border:"1px solid #ccc"}})})}),(0,s.jsx)(X.Z,{children:(0,s.jsx)(E.Z,{onClick:h,color:"primary",children:"Close"})})]})}var ef=n(79715),eb=n(34235),ey=function(){let{table:e,config:t,evalId:n}=eh(),[a,r]=l.useState(!1),i=(e,t)=>{let n=URL.createObjectURL(e),s=document.createElement("a");s.href=n,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(n)},o=()=>{r(!1)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(A.Z,{onClick:()=>{r(!0)},children:[(0,s.jsx)(M.Z,{children:(0,s.jsx)(ex.Z,{fontSize:"small"})}),(0,s.jsx)(O.Z,{children:"Download"})]}),(0,s.jsx)(G.Z,{onClose:o,open:a,children:(0,s.jsx)(q.Z,{children:(0,s.jsxs)(z.Z,{direction:"column",spacing:2,sx:{width:"100%"},children:[(0,s.jsx)(E.Z,{onClick:()=>{let e=eb.default.dump(t),n=new Blob([e],{type:"text/yaml;charset=utf-8"});i(n,"promptfooconfig.yaml"),o()},startIcon:(0,s.jsx)(ex.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download YAML Config"}),(0,s.jsx)(E.Z,{onClick:()=>{if(!e){alert("No table data");return}let t=[],s=[...e.head.vars,...e.head.prompts.map(e=>"[".concat(e.provider,"] ").concat(e.label))];t.push(s),e.body.forEach(e=>{let n=[...e.vars,...e.outputs.map(e=>{let{pass:t,text:n}=e;return(t?"[PASS] ":"[FAIL] ")+n})];t.push(n)});let l=(0,ef.P)(t),a=new Blob([l],{type:"text/csv;charset=utf-8;"});i(a,"".concat(n,"-table.csv")),o()},startIcon:(0,s.jsx)(ex.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download Table CSV"}),(0,s.jsx)(E.Z,{onClick:()=>{if(!e){alert("No table data");return}let t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"});i(t,"".concat(n,"-table.json")),o()},startIcon:(0,s.jsx)(ex.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download Table JSON"}),(0,s.jsx)(E.Z,{onClick:()=>{if(!e){alert("No table data");return}let t=e.body.map((t,n)=>({chosen:t.outputs.filter(e=>e.pass).map(e=>e.text),rejected:t.outputs.filter(e=>!e.pass).map(e=>e.text),vars:t.test.vars,providers:e.head.prompts.map(e=>e.provider),prompts:e.head.prompts.map(e=>e.label||e.display||e.raw)})),s=new Blob([JSON.stringify(t,null,2)],{type:"application/json"});i(s,"".concat(n,"-dpo.json")),o()},startIcon:(0,s.jsx)(ex.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download DPO JSON"})]})})})]})},eZ=n(49653),ew=e=>{let{recentEvals:t,onRecentEvalSelected:n,currentEval:a}=e,[r,i]=(0,l.useState)(!1),o="undefined"!=typeof navigator&&-1!==navigator.platform.toUpperCase().indexOf("MAC"),c=()=>{i(!0)};return l.useEffect(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),c())};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(V.Z,{title:o?"Search for Evals (⌘ + K)":"Search for Evals (Ctrl + K)",arrow:!0,children:(0,s.jsx)(ev.Z,{onClick:c,color:"primary",size:"small",children:(0,s.jsx)(eZ.Z,{})})}),(0,s.jsx)(ei,{title:"Open an Eval",open:r,onClose:()=>{i(!1)},recentEvals:t,onRecentEvalSelected:n})]})},eC=n(69179),ek=n(92715),eS=n(92863),eR=n(36001);let eI=["#fd7f6f","#7eb0d5","#b2e061","#bd7ebe","#ffb55a","#ffee65","#beb9db","#fdcce5","#8bd3c7"];function eN(e){let{table:t}=e,n=(0,l.useRef)(null),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!n.current)return;a.current&&a.current.destroy();let e=t.body.flatMap(e=>e.outputs.map(e=>e.score)),s=Math.min(...e),l=(Math.ceil(Math.max(...e))-Math.floor(s))/10,r=Array.from({length:11},(e,t)=>parseFloat((Math.floor(s)+t*l).toFixed(2))),i=t.head.prompts.map((e,n)=>{let s=t.body.flatMap(e=>e.outputs[n].score),a=r.map(e=>s.filter(t=>t>=e&&t<e+l).length);return{label:"Column ".concat(n+1),data:a,backgroundColor:eI[n%eI.length]}});a.current=new eR.kL(n.current,{type:"bar",data:{labels:r,datasets:i},options:{animation:!1,plugins:{title:{display:!0,text:"Score Distribution"},legend:{display:!1},tooltip:{callbacks:{title:function(e){let t=e[0].datasetIndex;return"Column ".concat(t+1)},label:function(e){let t=e.dataIndex,n=r[t],s=r[t+1];return s?"".concat(n," <= score < ").concat(s):"".concat(n," <= score")}}}}}})},[t]),(0,s.jsx)("canvas",{ref:n,style:{maxHeight:"300px"}})}function eE(e){let{table:t}=e,n=(0,l.useRef)(null),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!n.current)return;a.current&&a.current.destroy();let e=t.head.prompts.map((e,n)=>{let s=t.body.flatMap(e=>e.outputs[n]),l=s.filter(e=>e.pass).length,a=l/s.length*100;return{label:"Column ".concat(n+1),data:[a],backgroundColor:eI[n%eI.length]}});a.current=new eR.kL(n.current,{type:"bar",data:{labels:["Pass Rate (%)"],datasets:e},options:{animation:!1,plugins:{title:{display:!0,text:"Pass rate"},legend:{display:!0}}}})},[t]),(0,s.jsx)("canvas",{ref:n,style:{maxHeight:"300px"}})}function eP(e){let{table:t}=e,n=(0,l.useRef)(null),a=(0,l.useRef)(null),[r,i]=(0,l.useState)(0),[o,c]=(0,l.useState)(1),[d,u]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(!n.current)return;a.current&&a.current.destroy();let e=t.body.flatMap(e=>e.outputs.map(e=>e.score)),s=Math.min(...e),l=Math.max(...e),i=t.body.map(e=>{let t=e.outputs[r].score,n=e.outputs[o].score;return{x:t,y:n,backgroundColor:n>t?"green":n<t?"red":"gray"}});a.current=new eR.kL(n.current,{type:"scatter",data:{datasets:[{data:i,backgroundColor:i.map(e=>e.backgroundColor)},{type:"line",data:[{x:s,y:s},{x:l,y:l}],borderColor:"gray",borderWidth:1,borderDash:[5,5],pointRadius:0}]},options:{animation:!1,plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(e){let n=t.body[e.dataIndex],s=n.outputs[0].text,l=n.outputs[1].text;return s.length>30&&(s=s.substring(0,30)+"..."),l.length>30&&(l=l.substring(0,30)+"..."),"Output 1: ".concat(s,"\nOutput 2: ").concat(l)}}}},scales:{x:{title:{display:!0,text:"Prompt ".concat(r+1," Score")},ticks:{callback:function(e,t,n){let s=String(Math.round(100*Number(e)));return t===n.length-1&&(s+="%"),s}}},y:{title:{display:!0,text:"Prompt ".concat(o+1," Score")},ticks:{callback:function(e,t,n){let s=String(Math.round(100*Number(e)));return t===n.length-1&&(s+="%"),s}}}}}})},[t,r,o]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(G.Z,{open:d,onClose:()=>u(!1),children:[(0,s.jsx)(Y.Z,{children:"Compare prompt outputs"}),(0,s.jsxs)(q.Z,{children:[(0,s.jsx)(T.Z,{sx:{m:1,minWidth:120},children:(0,s.jsx)(W.Z,{value:r,onChange:e=>i(Number(e.target.value)),children:t.head.prompts.map((e,t)=>(0,s.jsxs)(A.Z,{value:t,children:["Prompt ",t+1]},t))})}),(0,s.jsx)(T.Z,{sx:{m:1,minWidth:120},children:(0,s.jsx)(W.Z,{value:o,onChange:e=>c(Number(e.target.value)),children:t.head.prompts.map((e,t)=>(0,s.jsxs)(A.Z,{value:t,children:["Prompt ",t+1]},t))})})]})]}),(0,s.jsx)("canvas",{ref:n,style:{maxHeight:"300px",cursor:"pointer"},onClick:()=>u(!0)})]})}function eF(e){let{table:t}=e,n=(0,l.useRef)(null),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{var e;if(!n.current)return;a.current&&a.current.destroy();let s=Object.keys((null===(e=t.head.prompts[0].metrics)||void 0===e?void 0:e.namedScores)||{}),l=t.head.prompts.map((e,n)=>{let l=s.map(n=>{var s;let l=(null===(s=e.metrics)||void 0===s?void 0:s.namedScores[n])||0,a=Math.max(...t.head.prompts.map(e=>{var t;return(null===(t=e.metrics)||void 0===t?void 0:t.namedScores[n])||0}));return l/a});return{label:"".concat(t.head.prompts[n].provider),data:l,backgroundColor:eI[n%eI.length]}});a.current=new eR.kL(n.current,{type:"bar",data:{labels:s,datasets:l},options:{scales:{x:{grid:{display:!1}},y:{ticks:{callback:function(e,t,n){let s=String(Math.round(100*Number(e)));return t===n.length-1&&(s+="%"),s}}}},plugins:{tooltip:{callbacks:{title:function(e){return e[0].dataset.label},label:function(e){let t=e.parsed.y;return"".concat(s[e.dataIndex],": ").concat((100*t).toFixed(2),"% pass rate")}}}}}})},[t]),(0,s.jsx)("canvas",{ref:n,style:{maxHeight:"300px"}})}eR.kL.register(eR.vn,eR.ST,eR.ho,eR.uw,eR.f$,eR.ZL,eR.jn,eR.od,eR.u,eR.wL);var eT=l.memo(function(e){var t;let{columnVisibility:n}=e,a=(0,eS.Z)();eR.kL.defaults.color="dark"===a.palette.mode?"#aaa":"#666";let[r,i]=(0,l.useState)(!0),{table:o}=eh();if(!o||!r||o.head.prompts.length<2)return null;let c=o.body.flatMap(e=>e.outputs.map(e=>e.score)),d=new Set(c);return 1===d.size?null:(0,s.jsx)(eC.SV,{fallback:null,children:(0,s.jsxs)($.Z,{style:{position:"relative",padding:a.spacing(3)},children:[(0,s.jsx)(ev.Z,{style:{position:"absolute",right:0,top:0},onClick:()=>i(!1),children:(0,s.jsx)(ek.Z,{})}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[(0,s.jsx)("div",{style:{width:"33%"},children:(0,s.jsx)(eE,{table:o})}),(0,s.jsx)("div",{style:{width:"33%"},children:d.size<=3&&Object.keys((null===(t=o.head.prompts[0].metrics)||void 0===t?void 0:t.namedScores)||{}).length>1?(0,s.jsx)(eF,{table:o}):(0,s.jsx)(eN,{table:o})}),(0,s.jsx)("div",{style:{width:"33%"},children:(0,s.jsx)(eP,{table:o})})]})]})})}),eD=n(36128),eM=n(9317),eO=n(20286);n(55974);var eL=e=>{let{lookup:t,metricTotals:n,onSearchTextChange:l}=e;return t&&Object.keys(t).length?(0,s.jsx)("div",{className:"custom-metric-container",children:Object.entries(t).map(e=>{let[t,a]=e;return t&&void 0!==a?(0,s.jsxs)("span",{onClick:()=>l&&l("metric=".concat(t,":")),className:l?"clickable":"",children:[t,":"," ",n&&n[t]?(0,s.jsxs)(s.Fragment,{children:[(a/n[t]*100).toFixed(2),"% (",a,"/",n[t],")"]}):a]},t):null})}):null},eA=n(35185),eU=n(613);function eW(e){let{gradingResults:t}=e;return t?(0,s.jsxs)(N.Z,{mt:2,children:[(0,s.jsx)(B.Z,{variant:"subtitle1",children:"Assertions"}),(0,s.jsx)(en.Z,{children:(0,s.jsxs)(Q.Z,{children:[(0,s.jsx)(es.Z,{children:(0,s.jsxs)(el.Z,{children:[(0,s.jsx)(et.Z,{style:{fontWeight:"bold"},children:"Pass"}),(0,s.jsx)(et.Z,{style:{fontWeight:"bold"},children:"Score"}),(0,s.jsx)(et.Z,{style:{fontWeight:"bold"},children:"Type"}),(0,s.jsx)(et.Z,{style:{fontWeight:"bold"},children:"Value"}),(0,s.jsx)(et.Z,{style:{fontWeight:"bold"},children:"Reason"})]})}),(0,s.jsx)(ee.Z,{children:t.map((e,t)=>{var n,l,a;return e?(0,s.jsxs)(el.Z,{children:[(0,s.jsx)(et.Z,{children:e.pass?"✅":"❌"}),(0,s.jsx)(et.Z,{children:null===(n=e.score)||void 0===n?void 0:n.toFixed(2)}),(0,s.jsx)(et.Z,{children:(null===(l=e.assertion)||void 0===l?void 0:l.type)||""}),(0,s.jsx)(et.Z,{style:{whiteSpace:"pre-wrap"},children:(null===(a=e.assertion)||void 0===a?void 0:a.value)?String(e.assertion.value):"-"}),(0,s.jsx)(et.Z,{style:{whiteSpace:"pre-wrap"},children:e.reason})]},t):null})})]})})]}):null}function ez(e){let{open:t,onClose:n,prompt:a,provider:r,output:i,gradingResults:o,metadata:c}=e,[d,u]=(0,l.useState)(!1);(0,l.useEffect)(()=>{u(!1)},[a]);let h=async e=>{await navigator.clipboard.writeText(e),u(!0)};return(0,s.jsxs)(G.Z,{open:t,onClose:n,fullWidth:!0,maxWidth:"lg",children:[(0,s.jsxs)(Y.Z,{children:["Details",r&&": ".concat(r)]}),(0,s.jsxs)(q.Z,{children:[(0,s.jsxs)(N.Z,{mb:2,children:[(0,s.jsx)(B.Z,{variant:"subtitle1",style:{marginBottom:"1rem"},children:"Prompt"}),(0,s.jsx)(eU.u,{readOnly:!0,value:a,style:{width:"100%",padding:"0.75rem"},maxRows:20}),(0,s.jsx)(ev.Z,{onClick:()=>h(a),style:{position:"absolute",right:"10px",top:"10px"},children:d?(0,s.jsx)(em.Z,{}):(0,s.jsx)(eA.Z,{})})]}),(null==c?void 0:c.redteamFinalPrompt)&&(0,s.jsxs)(N.Z,{my:2,children:[(0,s.jsx)(B.Z,{variant:"subtitle1",style:{marginBottom:"1rem",marginTop:"1rem"},children:"Modified User Input (Red Team)"}),(0,s.jsx)(eU.u,{readOnly:!0,maxRows:20,value:c.redteamFinalPrompt,style:{width:"100%",padding:"0.75rem"}})]}),i&&(0,s.jsxs)(N.Z,{my:2,children:[(0,s.jsx)(B.Z,{variant:"subtitle1",style:{marginBottom:"1rem",marginTop:"1rem"},children:"Output"}),(0,s.jsx)(eU.u,{readOnly:!0,maxRows:20,value:i,style:{width:"100%",padding:"0.75rem"}})]}),(0,s.jsx)(eW,{gradingResults:o})]}),(0,s.jsx)(X.Z,{children:(0,s.jsx)(E.Z,{onClick:n,children:"Close"})})]})}var e_=n(12431),eV=n(8541),eB=function(){let e=(0,eS.Z)(),[t,n]=l.useState(!1),a=()=>{n(!1)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{style:{textAlign:"center",marginTop:20,marginBottom:40},children:(0,s.jsx)(E.Z,{variant:"text",color:"primary",startIcon:(0,s.jsx)(e_.Z,{}),onClick:()=>{n(!0)},children:"Generate test cases"})}),(0,s.jsxs)(G.Z,{open:t,onClose:a,children:[(0,s.jsx)(Y.Z,{children:"Run on Command Line"}),(0,s.jsx)(q.Z,{children:(0,s.jsxs)(eV.Z,{children:[(0,s.jsx)("p",{children:"This feature is in beta. UI coming soon."}),(0,s.jsxs)("p",{children:["Run"," ",(0,s.jsx)(N.Z,{component:"code",sx:{backgroundColor:"dark"===e.palette.mode?"#424242":"#f0f0f0",padding:"2px 4px",borderRadius:"4px"},children:"promptfoo generate dataset"}),"to generate test cases on the command line."]})]})}),(0,s.jsx)(X.Z,{children:(0,s.jsx)(E.Z,{onClick:a,color:"primary",children:"Close"})})]})]})};function eJ(e){return"string"==typeof e||"number"==typeof e?e.toString().length:Array.isArray(e)?e.reduce((e,t)=>e+eJ(t),0):l.isValidElement(e)&&e.props.children?l.Children.toArray(e.props.children).reduce((e,t)=>e+eJ(t),0):0}let eH=l.memo(function(e){let t,{text:n,maxLength:a}=e,[r,i]=l.useState(!0),o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if("string"==typeof e||"number"==typeof e){let n=e.toString();return n.slice(0,a-t)}if(Array.isArray(e)){let n=[],s=t;for(let t of e){let e=eJ(t);if(s+e>a){n.push(o(t,s));break}n.push(t),s+=e}return n}if(l.isValidElement(e)&&e.props.children){let n=eJ(e.props.children);if(n>a-t)return l.cloneElement(e,{...e.props,children:o(e.props.children,t)})}return e};t=l.isValidElement(n)||"string"==typeof n?n:JSON.stringify(n);let c=r?o(t):t,d=eJ(t)>a;return(0,s.jsxs)("div",{style:{cursor:d?"pointer":"normal"},onClick:()=>{i(!r)},children:[c,r&&eJ(t)>a&&(0,s.jsx)("span",{children:"..."})]})});var eK=n(59682),eG=n(62268),eX=n(38640),eq=n.n(eX),eY=n(33352),e$=n(73490),eQ=n(24495);n(16658);var e0=e=>{let{failReasons:t}=e,[n,a]=(0,l.useState)(0);return t.length<1?null:(0,s.jsxs)("div",{className:"fail-reason",children:[t.length>1&&(0,s.jsxs)("span",{className:"fail-reason-carousel-controls",children:[(0,s.jsx)(ev.Z,{onClick:()=>{a(e=>e>0?e-1:t.length-1)},children:(0,s.jsx)(e$.Z,{sx:{fontSize:12}})}),(0,s.jsxs)("span",{children:[n+1,"/",t.length]}),(0,s.jsx)(ev.Z,{onClick:()=>{a(e=>e<t.length-1?e+1:0)},children:(0,s.jsx)(eQ.Z,{sx:{fontSize:12}})})]}),t[n].trim().split("\n").map((e,t)=>(0,s.jsxs)(l.Fragment,{children:[e,(0,s.jsx)("br",{})]},t))]})},e1=e=>{let{open:t,contextText:n,commentText:l,onClose:a,onSave:r,onChange:i}=e;return(0,s.jsxs)(G.Z,{open:t,onClose:a,fullWidth:!0,maxWidth:"sm",children:[(0,s.jsx)(Y.Z,{children:"Edit Comment"}),(0,s.jsxs)(q.Z,{children:[(0,s.jsx)(N.Z,{sx:{backgroundColor:"#f0f0f0",padding:2,marginBottom:2},children:n}),(0,s.jsx)(_.Z,{autoFocus:!0,margin:"dense",type:"text",fullWidth:!0,multiline:!0,rows:4,value:l,onChange:e=>i(e.target.value)})]}),(0,s.jsxs)(X.Z,{children:[(0,s.jsx)(E.Z,{onClick:r,color:"primary",variant:"contained",children:"Save"}),(0,s.jsx)(E.Z,{onClick:a,color:"primary",children:"Cancel"})]})]})};let e2=()=>{let e=(0,l.useContext)(c);if(void 0===e)throw Error("useShiftKey must be used within a ShiftKeyProvider");return e};var e3=n(19116);let e5=l.memo(function(e){var t,n,a,r,i,o,c,d,u,h,p,m,x;let g,v,j,f,b,y,{output:Z,maxTextLength:w,rowIndex:C,promptIndex:k,onRating:S,firstOutput:R,showDiffs:I,searchText:N,showStats:E}=e,{renderMarkdown:P,prettifyJson:F,showPrompts:T,showPassFail:D,inComparisonMode:M}=eh(),[O,L]=l.useState(!1),[A,U]=l.useState(!1),[W,z]=l.useState(null),_=e=>{z(e||null),U(!A)},[B,J]=l.useState(!1),[H,K]=l.useState((null===(t=Z.gradingResult)||void 0===t?void 0:t.comment)||""),G=()=>{J(!0)},X="string"==typeof Z.text?Z.text:JSON.stringify(Z.text),q=[];if(!Z.pass&&X.includes("---")&&(q=((null===(h=Z.gradingResult)||void 0===h?void 0:h.componentResults)||[]).filter(e=>!!e&&!e.pass).map(e=>e.reason),X=X.split("---").slice(1).join("---")),I&&R){let e,t="string"==typeof R.text?R.text:JSON.stringify(R.text);t.includes("---")&&(t=t.split("---").slice(1).join("---"));try{JSON.parse(t),JSON.parse(X),e=(0,e3.CT)(t,X)}catch(n){e=t.includes(". ")&&X.includes(". ")?(0,e3.SY)(t,X):(0,e3.NV)(t,X)}g=(0,s.jsx)(s.Fragment,{children:e.map((e,t)=>e.added?(0,s.jsx)("ins",{children:e.value},t):e.removed?(0,s.jsx)("del",{children:e.value},t):(0,s.jsx)("span",{children:e.value},t))})}if(N)try{let e;let t=RegExp(N,"gi"),n=[];for(;null!==(e=t.exec(X));)n.push({start:e.index,end:t.lastIndex});g=(0,s.jsx)(s.Fragment,{children:n.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{children:X.substring(0,n[0].start)},"text-before"),n.map((e,t)=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"search-highlight",children:X.substring(e.start,e.end)},"match-"+t),(0,s.jsx)("span",{children:X.substring(e.end,n[t+1]?n[t+1].start:X.length)},"text-after-"+t)]}))]}):(0,s.jsx)("span",{children:X},"no-match")})}catch(e){console.error("Invalid regular expression:",e.message)}else if(P&&!I)g=(0,s.jsx)(eO.U,{remarkPlugins:[eY.Z],components:{img:e=>{let{src:t,alt:n}=e;return(0,s.jsx)("img",{loading:"lazy",src:t,alt:n,onClick:()=>_(t),style:{cursor:"pointer"}})}},children:X});else if(F)try{g=(0,s.jsx)("pre",{children:JSON.stringify(JSON.parse(X),null,2)})}catch(e){}let Y=l.useCallback(e=>{var t;S(e,void 0,null===(t=Z.gradingResult)||void 0===t?void 0:t.comment)},[S,null===(n=Z.gradingResult)||void 0===n?void 0:n.comment]),$=l.useCallback(()=>{let e=prompt("Set test score (0.0 - 1.0):",String(Z.score));if(null!==e){let n=parseFloat(e);if(!isNaN(n)&&n>=0&&n<=1){var t;S(void 0,n,null===(t=Z.gradingResult)||void 0===t?void 0:t.comment)}else alert("Invalid score. Please enter a value between 0.0 and 1.0.")}},[S,Z.score,null===(a=Z.gradingResult)||void 0===a?void 0:a.comment]),[Q,ee]=l.useState(!1),et=l.useCallback(()=>{navigator.clipboard.writeText(Z.text),ee(!0)},[Z.text]);if(Z.latencyMs&&(j=(0,s.jsxs)("span",{children:[Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Z.latencyMs)," ms"]})),null===(r=Z.tokenUsage)||void 0===r?void 0:r.completion){let e=Z.tokenUsage.completion/(Z.latencyMs/1e3);f=(0,s.jsx)("span",{children:Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e)})}if(Z.cost&&(b=(0,s.jsxs)("span",{children:["$",Z.cost.toPrecision(2)]})),null===(i=Z.tokenUsage)||void 0===i?void 0:i.cached)v=(0,s.jsxs)("span",{children:[Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Z.tokenUsage.cached)," ","(cached)"]});else if(null===(o=Z.tokenUsage)||void 0===o?void 0:o.total){let e=Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(null!==(p=Z.tokenUsage.prompt)&&void 0!==p?p:0),t=Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(null!==(m=Z.tokenUsage.completion)&&void 0!==m?m:0),n=Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Z.tokenUsage.total);v=(0,s.jsx)(V.Z,{title:"".concat(e," prompt tokens + ").concat(t," completion tokens = ").concat(n," total"),children:(0,s.jsxs)("span",{children:[n,("0"!==e||"0"!==t)&&" (".concat(e,"+").concat(t,")")]})})}let en=(null===(c=Z.gradingResult)||void 0===c?void 0:c.comment)&&"!highlight"!==Z.gradingResult.comment?(0,s.jsx)("div",{className:"comment",onClick:G,children:Z.gradingResult.comment}):null,es=E?(0,s.jsxs)("div",{className:"cell-detail",children:[v&&(0,s.jsxs)("div",{className:"stat-item",children:[(0,s.jsx)("strong",{children:"Tokens:"})," ",v]}),j&&(0,s.jsxs)("div",{className:"stat-item",children:[(0,s.jsx)("strong",{children:"Latency:"})," ",j]}),f&&(0,s.jsxs)("div",{className:"stat-item",children:[(0,s.jsx)("strong",{children:"Tokens/Sec:"})," ",f]}),b&&(0,s.jsxs)("div",{className:"stat-item",children:[(0,s.jsx)("strong",{children:"Cost:"})," ",b]})]}):null,el=e2(),ea=(0,s.jsxs)("div",{className:"cell-actions",children:[el&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"action",onClick:et,onMouseDown:e=>e.preventDefault(),children:(0,s.jsx)(V.Z,{title:"Copy output to clipboard",children:(0,s.jsx)("span",{children:Q?"✅":"\uD83D\uDCCB"})})}),(0,s.jsx)("span",{className:"action",onClick:()=>{let e;H.startsWith("!highlight")?S(void 0,void 0,e=H.slice(10).trim()):S(void 0,void 0,e=("!highlight "+H).trim()),K(e)},onMouseDown:e=>e.preventDefault(),children:(0,s.jsx)(V.Z,{title:"Toggle test highlight",children:(0,s.jsx)("span",{children:"\uD83C\uDF1F"})})})]}),Z.prompt&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"action",onClick:()=>{L(!0)},children:(0,s.jsx)(V.Z,{title:"View output and test details",children:(0,s.jsx)("span",{children:"\uD83D\uDD0E"})})}),(0,s.jsx)(ez,{open:O,onClose:()=>{L(!1)},prompt:Z.prompt,provider:Z.provider,gradingResults:null===(d=Z.gradingResult)||void 0===d?void 0:d.componentResults,output:X,metadata:Z.metadata})]}),(0,s.jsx)("span",{className:"action",onClick:()=>Y(!0),children:(0,s.jsx)(V.Z,{title:"Mark test passed (score 1.0)",children:(0,s.jsx)("span",{children:"\uD83D\uDC4D"})})}),(0,s.jsx)("span",{className:"action",onClick:()=>Y(!1),children:(0,s.jsx)(V.Z,{title:"Mark test failed (score 0.0)",children:(0,s.jsx)("span",{children:"\uD83D\uDC4E"})})}),(0,s.jsx)("span",{className:"action",onClick:$,children:(0,s.jsx)(V.Z,{title:"Set test score",children:(0,s.jsx)("span",{children:"\uD83D\uDD22"})})}),(0,s.jsx)("span",{className:"action",onClick:G,children:(0,s.jsx)(V.Z,{title:"Edit comment",children:(0,s.jsx)("span",{children:"✏️"})})})]}),er={};(null===(u=Z.gradingResult)||void 0===u?void 0:u.comment)==="!highlight"&&(er.backgroundColor="#ffffeb");let ei=0,eo=0,ec=Z.gradingResult;if(ec?ec.componentResults?ec.componentResults.forEach(e=>{(null==e?void 0:e.pass)?ei++:eo++}):(ei=ec.pass?1:0,eo=ec.pass?0:1):Z.pass?ei=1:Z.pass||(eo=1),1===eo&&1===ei)y=(0,s.jsxs)(s.Fragment,{children:["".concat(eo," FAIL")," ","".concat(ei," PASS")]});else{let e="";eo>1||ei>1&&eo>0?e="".concat(eo," FAIL"):1===eo&&(e="FAIL");let t="";ei>1||eo>1&&ei>0?t="".concat(ei," PASS"):1===ei&&0===eo&&(t="PASS");let n=e&&t?" ":"";y=(0,s.jsxs)(s.Fragment,{children:[e,n,t]})}let ed=null===(x=Z.score)||0===x||1===x?"":"(".concat(x.toFixed(2),")");return(0,s.jsxs)("div",{className:"cell",style:er,children:[D&&(0,s.jsx)(s.Fragment,{children:Z.pass?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"status pass",children:[(0,s.jsxs)("div",{className:"pill",children:[y,ed&&(0,s.jsxs)("span",{className:"score",children:[" ",ed]})]}),(0,s.jsx)(eL,{lookup:Z.namedScores})]})}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"status fail",children:[(0,s.jsxs)("div",{className:"pill",children:[y,ed&&(0,s.jsxs)("span",{className:"score",children:[" ",ed]})]}),(0,s.jsx)(eL,{lookup:Z.namedScores}),(0,s.jsx)("span",{className:"fail-reason",children:(0,s.jsx)(e0,{failReasons:q})})]})})}),T&&R.prompt&&(0,s.jsxs)("div",{className:"prompt",children:[(0,s.jsx)("span",{className:"pill",children:"Prompt"}),Z.prompt]}),(0,s.jsx)(eH,{text:g||X,maxLength:w}),en,es,ea,A&&W&&(0,s.jsx)("div",{className:"lightbox",onClick:()=>_(),children:(0,s.jsx)("img",{src:W,alt:"Lightbox"})}),(0,s.jsx)(e1,{open:B,contextText:Z.text,commentText:H,onClose:()=>{J(!1)},onSave:()=>{S(void 0,void 0,H),J(!1)},onChange:K})]})});function e4(e){let{text:t,maxLength:n,expandedText:a,resourceId:r,className:i}=e,[o,c]=l.useState(!1);return(0,s.jsxs)("div",{className:"".concat(i||""),children:[(0,s.jsx)(eH,{text:t,maxLength:n}),a&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(V.Z,{title:"View prompt",children:(0,s.jsx)("span",{className:"action",onClick:()=>{c(!0)},children:"\uD83D\uDD0E"})}),(0,s.jsx)(ez,{open:o,onClose:()=>{c(!1)},prompt:a}),r&&(0,s.jsx)(V.Z,{title:"View other evals and datasets for this prompt",children:(0,s.jsx)("span",{className:"action",children:(0,s.jsx)(eq(),{href:"/prompts/?id=".concat(r),target:"_blank",children:(0,s.jsx)(eK.Z,{fontSize:"small"})})})})]})]})}n(93207);var e7=l.memo(function(e){let{maxTextLength:t,columnVisibility:n,wordBreak:a,filterMode:r,failureFilter:i,searchText:c,showStats:d,onFailureFilterToggle:u,onSearchTextChange:h}=e,{evalId:p,table:x,setTable:g,inComparisonMode:v}=eh(),{showToast:j}=m();(0,y.Z)(x,"Table should be defined");let{head:f,body:b}=x,Z=l.useCallback(async(e,t,n,s,l)=>{var a,r;let i=[...b],c={...i[e]},d=[...c.outputs],u=null!=n?n:d[t].pass,h=void 0===s?n?1:0:s||0;d[t].pass=u,d[t].score=h;let m=(null===(a=d[t].gradingResult)||void 0===a?void 0:a.componentResults)||[];if(void 0!==n){let e=m.findIndex(e=>{var t;return(null===(t=e.assertion)||void 0===t?void 0:t.type)==="human"}),t={pass:u,score:h,reason:"Manual result (overrides all other grading results)",comment:l,assertion:{type:"human"}};-1!==e?m[e]=t:m.push(t)}let x={...d[t].gradingResult||{},pass:u,score:h,reason:"Manual result (overrides all other grading results)",comment:l,assertion:(null===(r=d[t].gradingResult)||void 0===r?void 0:r.assertion)||null,componentResults:m};d[t].gradingResult=x,c.outputs=d,i[e]=c;let y={head:f,body:i};if(g(y),v)j("Ratings are not saved in comparison mode","warning");else try{let e=await fetch("".concat(await (0,o.b)(),"/api/eval/").concat(p),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:y})});if(!e.ok)throw Error("Network response was not ok")}catch(e){console.error("Failed to update table:",e)}},[b,f,g,p,v,j]),w=Object.keys(n).length>0,C=l.useMemo(()=>{try{return RegExp(c,"i")}catch(e){return console.error("Invalid regular expression:",e.message),null}},[c]),k=l.useMemo(()=>{try{return b.map((e,t)=>({...e,outputs:e.outputs.map((e,n)=>({...e,originalRowIndex:t,originalPromptIndex:n}))})).filter(e=>{let t=!0;return"failures"===r?t=e.outputs.some((e,t)=>{let s="Prompt ".concat(t+1);return i[s]&&!e.pass&&(!w||n[s])}):"different"===r?t=!e.outputs.every(t=>t.text===e.outputs[0].text):"highlights"===r&&(console.log(e.outputs[0].text),t=e.outputs.some(e=>{var t,n;return null===(n=e.gradingResult)||void 0===n?void 0:null===(t=n.comment)||void 0===t?void 0:t.startsWith("!highlight")})),!!t&&(!c||!C||e.outputs.some(t=>{var n,s;let l=e.vars.map(e=>"var=".concat(e)).join(" "),a="".concat(t.text," ").concat(Object.keys(t.namedScores).map(e=>"metric=".concat(e,":").concat(t.namedScores[e])).join(" ")," ").concat((null===(n=t.gradingResult)||void 0===n?void 0:n.reason)||""," ").concat((null===(s=t.gradingResult)||void 0===s?void 0:s.comment)||""),r="".concat(l," ").concat(a);return C.test(r)}))})}catch(e){return console.error("Invalid regular expression:",e.message),b}},[b,i,r,c,n,w,C]),[S,R]=l.useState({pageIndex:0,pageSize:50});l.useEffect(()=>{R(e=>({...e,pageIndex:0}))},[i,r,c]);let I=l.useMemo(()=>f.prompts.map((e,t)=>b.reduce((e,n)=>e+(n.outputs[t].pass?1:0),0)),[f.prompts,b]),F=l.useMemo(()=>f.prompts.map((e,t)=>b.reduce((e,n)=>{var s,l;return e+((null===(l=n.outputs[t].gradingResult)||void 0===l?void 0:null===(s=l.componentResults)||void 0===s?void 0:s.length)||0)},0)),[f.prompts,b]),T=l.useMemo(()=>f.prompts.map((e,t)=>b.reduce((e,n)=>{var s;let l=null===(s=n.outputs[t].gradingResult)||void 0===s?void 0:s.componentResults;return e+(l?l.filter(e=>null==e?void 0:e.pass).length:0)},0)),[f.prompts,b]),D=l.useMemo(()=>I.reduce((e,t,n,s)=>t>s[e]?n:e,0),[I]),M=I[D],O=l.useMemo(()=>(0,eD.Cl)(),[]),{renderMarkdown:L}=eh(),U=l.useMemo(()=>f.vars.length>0?[O.group({id:"vars",header:()=>(0,s.jsx)("span",{className:"font-bold",children:"Variables"}),columns:f.vars.map((e,n)=>O.accessor(e=>e.vars[n],{id:"Variable ".concat(n+1),header:()=>(0,s.jsx)(e4,{text:e,maxLength:t,className:"font-bold"}),cell:e=>{let n=e.getValue();return(0,s.jsx)("div",{className:"cell",children:L?(0,s.jsx)(eO.U,{remarkPlugins:[eY.Z],children:n}):(0,s.jsx)(eH,{text:n,maxLength:t})})},size:50}))})]:[],[O,f.vars,t,L]),z=l.useCallback((e,t)=>k[e].outputs[t],[k]),V=l.useCallback(e=>k[e].outputs[0],[k]),J=l.useMemo(()=>{let e={};return null==x||x.body.forEach(t=>{var n;null===(n=t.test.assert)||void 0===n||n.forEach(t=>{t.metric&&(e[t.metric]=(e[t.metric]||0)+1),"assert"in t&&Array.isArray(t.assert)&&t.assert.forEach(t=>{"metric"in t&&t.metric&&(e[t.metric]=(e[t.metric]||0)+1)})})}),e},[x]),H=l.useMemo(()=>[O.group({id:"prompts",header:()=>(0,s.jsx)("span",{className:"font-bold",children:"Outputs"}),columns:f.prompts.map((e,n)=>O.accessor(e=>(function(e){if("string"==typeof e){let t=e.startsWith("[PASS]"),n=e;return e.startsWith("[PASS]")?n=n.slice(6):e.startsWith("[FAIL]")&&(n=n.slice(6)),{text:n,pass:t,score:t?1:0}}return e})(e.outputs[n]),{id:"Prompt ".concat(n+1),header:()=>{var l,a,o,c,p,m,x,g;let v=I[n]&&b.length?(I[n]/b.length*100).toFixed(2):"0.00",j=I[n]===M&&0!==M,f="Prompt ".concat(n+1),y=i[f]||!1,Z=d?(0,s.jsxs)("div",{className:"prompt-detail",children:[F[n]?(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Asserts:"})," ",T[n],"/",F[n]," passed"]}):null,(null===(l=e.metrics)||void 0===l?void 0:l.totalLatencyMs)?(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Avg Latency:"})," ",Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e.metrics.totalLatencyMs/b.length)," ","ms"]}):null,(null===(o=e.metrics)||void 0===o?void 0:null===(a=o.tokenUsage)||void 0===a?void 0:a.total)?(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Avg Tokens:"})," ",Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e.metrics.tokenUsage.total/b.length)]}):null,(null===(c=e.metrics)||void 0===c?void 0:c.totalLatencyMs)&&(null===(m=e.metrics)||void 0===m?void 0:null===(p=m.tokenUsage)||void 0===p?void 0:p.completion)?(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Tokens/Sec:"})," ",Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e.metrics.tokenUsage.completion/(e.metrics.totalLatencyMs/1e3))]}):null,(null===(x=e.metrics)||void 0===x?void 0:x.cost)?(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Cost:"})," $",e.metrics.cost.toPrecision(2)]}):null]}):null,w=e.provider?e.provider.split(":"):[],C=w.length>1?(0,s.jsxs)(s.Fragment,{children:[w[0],":",(0,s.jsx)("strong",{children:w.slice(1).join(":")})]}):(0,s.jsx)("strong",{children:e.provider});return(0,s.jsxs)("div",{className:"output-header",children:[(0,s.jsxs)("div",{className:"pills",children:[e.provider?(0,s.jsx)("div",{className:"provider",children:C}):null,(0,s.jsx)("div",{className:"summary",children:(0,s.jsxs)("div",{className:"highlight ".concat(j?"success":""),children:[(0,s.jsxs)("strong",{children:[v,"% passing"]})," (",I[n],"/",b.length," cases)"]})}),(null===(g=e.metrics)||void 0===g?void 0:g.namedScores)&&Object.keys(e.metrics.namedScores).length>0?(0,s.jsx)(eL,{lookup:e.metrics.namedScores,metricTotals:J,onSearchTextChange:h}):null]}),(0,s.jsx)(e4,{className:"prompt-container",text:e.label||e.display||e.raw,expandedText:e.raw,maxLength:t,resourceId:e.id}),Z,"failures"===r&&(0,s.jsx)(eG.Z,{sx:{"& .MuiFormControlLabel-label":{fontSize:"0.75rem"}},control:(0,s.jsx)(P.Z,{checked:y,onChange:e=>u(f,e.target.checked)}),label:"Show failures"})]})},cell:e=>{var l,a;let i=z(e.row.index,n);return(0,s.jsx)(e5,{output:i,maxTextLength:t,rowIndex:e.row.index,promptIndex:n,onRating:Z.bind(null,null!==(l=i.originalRowIndex)&&void 0!==l?l:e.row.index,null!==(a=i.originalPromptIndex)&&void 0!==a?a:n),firstOutput:V(e.row.index),showDiffs:"different"===r,searchText:c,showStats:d})}}))})],[b.length,O,i,r,V,z,Z,f.prompts,M,t,J,F,T,I,u,h,c,d]),K=l.useMemo(()=>{let e=b.some(e=>e.description);return e?{accessorFn:e=>e.description||"",id:"description",header:()=>(0,s.jsx)("span",{className:"font-bold",children:"Description"}),cell:e=>(0,s.jsx)("div",{className:"cell",children:(0,s.jsx)(eH,{text:String(e.getValue()),maxLength:t})}),size:50}:null},[b,t]),G=l.useMemo(()=>{let e=[];return K&&e.push(K),e.push(...U,...H),e},[K,U,H]),X=(0,eM.b7)({data:k,columns:G,columnResizeMode:"onChange",getCoreRowModel:(0,eD.sC)(),getPaginationRowModel:(0,eD.G_)(),state:{columnVisibility:n,pagination:S}});return(0,s.jsxs)("div",{children:[(0,s.jsxs)("table",{className:"results-table firefox-fix ".concat(t<=25?"compact":""),style:{wordBreak:a},children:[(0,s.jsx)("thead",{children:X.getHeaderGroups().map(e=>(0,s.jsx)("tr",{className:"header",children:e.headers.map(e=>(0,s.jsxs)("th",{colSpan:e.colSpan,style:{width:e.getSize()},children:[e.isPlaceholder?null:(0,eM.ie)(e.column.columnDef.header,e.getContext()),(0,s.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"resizer ".concat(e.column.getIsResizing()?"isResizing":"")})]},e.id))},e.id))}),(0,s.jsx)("tbody",{children:X.getRowModel().rows.map((e,t)=>{let n=!1;return(0,s.jsx)("tr",{children:e.getVisibleCells().map(e=>{let l=e.column.id.startsWith("Variable")||"description"===e.column.id,a=!l&&!n;return a&&(n=!0),(0,s.jsx)("td",{style:{width:e.column.getSize()},className:"".concat(l?"variable":""," ").concat(0!==t||l?"":"first-prompt-row"," ").concat(a?"first-prompt-col":""),children:(0,eM.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)})})]}),X.getPageCount()>1&&(0,s.jsxs)(N.Z,{className:"pagination",mx:1,sx:{display:"flex",alignItems:"center",gap:2},children:[(0,s.jsx)(E.Z,{onClick:()=>{R(e=>({...e,pageIndex:Math.max(e.pageIndex-1,0)})),window.scrollTo(0,0)},disabled:0===X.getState().pagination.pageIndex,variant:"contained",children:"Previous"}),(0,s.jsxs)(B.Z,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:["Page",(0,s.jsx)(_.Z,{size:"small",type:"number",value:X.getState().pagination.pageIndex+1,onChange:e=>{let t=e.target.value?Number(e.target.value)-1:0;R(e=>({...e,pageIndex:Math.min(Math.max(t,0),X.getPageCount()-1)}))},InputProps:{style:{width:"60px",textAlign:"center"}},variant:"outlined"}),(0,s.jsxs)("span",{children:["of ",X.getPageCount()]})]}),(0,s.jsx)(E.Z,{onClick:()=>{R(e=>({...e,pageIndex:Math.min(e.pageIndex+1,X.getPageCount()-1)})),window.scrollTo(0,0)},disabled:X.getState().pagination.pageIndex+1>=X.getPageCount(),variant:"contained",children:"Next"}),(0,s.jsxs)(B.Z,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:[(0,s.jsxs)(W.Z,{value:S.pageSize,onChange:e=>{R({pageIndex:0,pageSize:Number(e.target.value)}),window.scrollTo(0,0)},displayEmpty:!0,inputProps:{"aria-label":"Results per page"},size:"small",sx:{m:1,minWidth:80},children:[(0,s.jsx)(A.Z,{value:10,children:"10"}),(0,s.jsx)(A.Z,{value:50,children:"50"}),(0,s.jsx)(A.Z,{value:100,children:"100"}),(0,s.jsx)(A.Z,{value:500,children:"500"}),(0,s.jsx)(A.Z,{value:1e3,children:"1000"})]}),(0,s.jsx)("span",{children:"results per page"})]})]}),(0,s.jsx)(eB,{})]})}),e6=n(22695),e8=e=>{let{open:t,onClose:n}=e,{maxTextLength:l,setMaxTextLength:a,wordBreak:r,setWordBreak:i,showInferenceDetails:o,setShowInferenceDetails:c,renderMarkdown:d,setRenderMarkdown:u,prettifyJson:h,setPrettifyJson:p,showPrompts:m,setShowPrompts:x,showPassFail:g,setShowPassFail:v}=eh();return(0,s.jsxs)(G.Z,{open:t,onClose:n,fullWidth:!0,maxWidth:"sm",children:[(0,s.jsx)(Y.Z,{children:"Table View Settings"}),(0,s.jsxs)(q.Z,{children:[(0,s.jsx)(N.Z,{children:(0,s.jsx)(V.Z,{title:"Forcing line breaks makes it easier to adjust column widths to your liking",placement:"right",children:(0,s.jsx)(eG.Z,{control:(0,s.jsx)(P.Z,{checked:"break-all"===r,onChange:e=>i(e.target.checked?"break-all":"break-word")}),label:"Force line breaks"})})}),(0,s.jsx)(N.Z,{children:(0,s.jsx)(eG.Z,{control:(0,s.jsx)(P.Z,{checked:d,onChange:e=>u(e.target.checked)}),label:"Render model outputs as Markdown"})}),(0,s.jsx)(N.Z,{children:(0,s.jsx)(eG.Z,{control:(0,s.jsx)(P.Z,{checked:h,onChange:e=>p(e.target.checked)}),label:"Prettify JSON outputs"})}),(0,s.jsx)(N.Z,{children:(0,s.jsx)(V.Z,{title:"Show the final prompt that produced the output in each cell.",placement:"right",children:(0,s.jsx)(eG.Z,{control:(0,s.jsx)(P.Z,{checked:m,onChange:e=>x(e.target.checked)}),label:"Show full prompt in output cell"})})}),(0,s.jsx)(N.Z,{children:(0,s.jsx)(V.Z,{title:"Show pass/fail status for each output.",placement:"right",children:(0,s.jsx)(eG.Z,{control:(0,s.jsx)(P.Z,{checked:g,onChange:e=>v(e.target.checked)}),label:"Show pass/fail status"})})}),(0,s.jsx)(N.Z,{children:(0,s.jsx)(V.Z,{title:"Show detailed inference statistics such as latency, tokens used, cost, etc.",placement:"right",children:(0,s.jsx)(eG.Z,{control:(0,s.jsx)(P.Z,{checked:o,onChange:e=>c(e.target.checked)}),label:"Show inference details"})})}),(0,s.jsxs)(N.Z,{maxWidth:"sm",children:[(0,s.jsxs)(B.Z,{mt:2,children:["Max text length: ",l]}),(0,s.jsx)(e6.ZP,{min:25,max:1e3,value:l,onChange:(e,t)=>a(t)})]})]}),(0,s.jsx)(X.Z,{children:(0,s.jsx)(E.Z,{onClick:n,children:"Close"})})]})},e9=e=>{let{open:t,onClose:n,shareUrl:a}=e,r=(0,l.useRef)(null),[i,o]=(0,l.useState)(!1),c=()=>{n(),o(!1)};return(0,s.jsxs)(G.Z,{open:t,onClose:c,PaperProps:{style:{minWidth:"min(660px, 100%)"}},children:[(0,s.jsx)(Y.Z,{children:"Your eval is ready to share"}),(0,s.jsxs)(q.Z,{children:[(0,s.jsx)(_.Z,{inputRef:r,value:a,fullWidth:!0,InputProps:{readOnly:!0,endAdornment:(0,s.jsx)(ev.Z,{onClick:()=>{r.current&&(r.current.select(),document.execCommand("copy"),o(!0))},children:i?(0,s.jsx)(em.Z,{}):(0,s.jsx)(eg.Z,{})})}}),(0,s.jsx)(eV.Z,{sx:{fontSize:"0.75rem"},children:"Shared URLs are deleted after 2 weeks."})]}),(0,s.jsx)(X.Z,{children:(0,s.jsx)(E.Z,{onClick:c,color:"primary",children:"Close"})})]})};n(58022);let te=(0,J.Z)(z.Z)(e=>{let{theme:t}=e;return{maxWidth:"100%",flexWrap:"wrap",[t.breakpoints.down("sm")]:{flexDirection:"column"}}});function tt(e){var t;let{recentEvals:n,onRecentEvalSelected:a,defaultEvalId:c}=e,d=(0,f.useRouter)(),h=(0,f.useSearchParams)(),{author:p,table:m,setTable:x,config:g,setConfig:j,maxTextLength:b,wordBreak:z,showInferenceDetails:J,evalId:K,inComparisonMode:G,setInComparisonMode:X}=eh(),{setStateFromConfig:q}=(0,Z.o)(),[Y,$]=l.useState((null==h?void 0:h.get("search"))||""),[Q]=(0,H.Nr)(Y,1e3),ee=e=>{$(e)},[et,en]=l.useState({}),es=l.useCallback((e,t)=>{en(n=>({...n,[e]:t}))},[en]);(0,y.Z)(m,"Table data must be loaded before rendering ResultsView");let{head:el}=m,[ea,er]=l.useState("all"),[ei,eo]=l.useState(!1),[ec,ed]=l.useState(""),[eu,em]=l.useState(!1),[ex,eg]=l.useState(null),ev=async()=>{em(!0);try{let e=await fetch("".concat(r,"/api/eval"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:{version:2,createdAt:new Date().toISOString(),results:{table:m},config:g}})}),{id:t}=await e.json(),n="".concat(i,"/eval/").concat(t);ed(n),eo(!0)}catch(e){alert("Sorry, something went wrong.")}finally{em(!1)}},ef=async e=>{eg(null);try{var t;let s=await fetch("".concat(await (0,o.b)(),"/api/results/").concat(e),{cache:"no-store"}),l=await s.json(),a=l.data.results.table,r={head:{prompts:[...m.head.prompts.map(e=>{var t;return{...e,label:"[".concat(K||c||(null===(t=n[0])||void 0===t?void 0:t.evalId)||"Eval A","] ").concat(e.label||"")}}),...a.head.prompts.map(t=>({...t,label:"[".concat(e,"] ").concat(t.label||"")}))],vars:m.head.vars},body:m.body.map((e,t)=>{var n;return{...e,outputs:[...e.outputs,...(null===(n=a.body[t])||void 0===n?void 0:n.outputs)||[]]}})};x(r),j({...g,...l.data.config,description:'Combined: "'.concat((null==g?void 0:g.description)||"Eval A",'" and "').concat((null===(t=l.data.config)||void 0===t?void 0:t.description)||"Eval B",'"')}),X(!0)}catch(e){console.error("Error fetching comparison eval:",e),alert("Failed to load comparison eval. Please try again.")}},eb=l.useMemo(()=>m.body.some(e=>e.description),[m.body]),eZ=l.useMemo(()=>[...eb?[{value:"description",label:"Description"}]:[],...el.vars.map((e,t)=>({value:"Variable ".concat(t+1),label:"Var ".concat(t+1,": ").concat(el.vars[t].length>100?el.vars[t].slice(0,97)+"...":el.vars[t]),group:"Variables"})),...el.prompts.map((e,t)=>{let n=el.prompts[t],s=n.label||n.display||n.raw;return{value:"Prompt ".concat(t+1),label:"Prompt ".concat(t+1,": ").concat(s.length>100?s.slice(0,97)+"...":s),group:"Prompts"}})],[el.vars,el.prompts,eb]),[eC,ek]=l.useState(!1),[eS,eR]=l.useState(!1),[eI,eN]=l.useState({}),[eE,eP]=l.useState(eZ.map(e=>e.value)),eF=async()=>{(0,y.Z)(g,"Config must be loaded before clicking its description");let e=window.prompt("Enter new description:",g.description);if(null!==e&&e!==g.description){let t={...g,description:e};try{let e=await fetch("".concat(await (0,o.b)(),"/api/eval/").concat(K),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:t})});if(!e.ok)throw Error("Network response was not ok");j(t)}catch(e){console.error("Failed to update table:",e)}}},eD=async()=>{if(window.confirm("Are you sure you want to delete this evaluation?"))try{let e=await fetch("".concat(await (0,o.b)(),"/api/eval/").concat(K),{method:"DELETE"});if(!e.ok)throw Error("Network response was not ok");d.push("/")}catch(e){console.error("Failed to delete evaluation:",e),alert("Failed to delete evaluation")}},[eM,eO]=l.useState(!1),eL=async()=>{K&&(await navigator.clipboard.writeText(K),eO(!0),setTimeout(()=>{eO(!1)},1e3))};return(0,s.jsxs)("div",{style:{marginLeft:"1rem",marginRight:"1rem"},children:[(0,s.jsxs)(te,{direction:"row",mb:2,spacing:1,alignItems:"center",className:"eval-header",children:[n&&n.length>0&&(0,s.jsx)(ew,{recentEvals:n,onRecentEvalSelected:a,currentEval:n.find(e=>e.evalId===K)||null}),!G&&(0,s.jsx)(B.Z,{variant:"h5",sx:{display:"flex",alignItems:"center"},children:(0,s.jsx)(V.Z,{title:"Click to edit description",children:(0,s.jsx)("span",{className:"description",onClick:eF,children:(null==g?void 0:g.description)||K})})}),(null==g?void 0:g.description)&&K&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(V.Z,{title:"Click to copy",children:(0,s.jsx)(F.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"ID:"})," ",K]}),sx:{opacity:.7,cursor:"pointer"},onClick:eL})}),(0,s.jsx)(u.Z,{open:eM,autoHideDuration:1e3,onClose:()=>eO(!1),message:"Eval id copied to clipboard"})]}),(0,s.jsx)(V.Z,{title:p?"":"Set eval author with `promptfoo config set email`",children:(0,s.jsx)(F.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Author:"})," ",p||"Unknown"]}),sx:{opacity:.7}})})]}),(0,s.jsxs)(te,{direction:"row",spacing:4,alignItems:"center",children:[(0,s.jsx)(N.Z,{children:(0,s.jsxs)(T.Z,{sx:{m:1,minWidth:200,maxWidth:350},size:"small",children:[(0,s.jsx)(D.Z,{id:"visible-columns-label",children:"Columns"}),(0,s.jsx)(W.Z,{labelId:"visible-columns-label",id:"visible-columns",multiple:!0,value:eE,onChange:e=>{let{target:{value:t}}=e;eP("string"==typeof t?t.split(","):t);let n=[...eb?["description"]:[],...el.vars.map((e,t)=>"Variable ".concat(t+1)),...el.prompts.map((e,t)=>"Prompt ".concat(t+1))],s={};n.forEach(e=>{s[e]=("string"==typeof t?t.split(","):t).includes(e)}),eN(s)},input:(0,s.jsx)(U.Z,{label:"Visible columns"}),renderValue:e=>e.join(", "),children:eZ.map(e=>(0,s.jsxs)(A.Z,{dense:!0,value:e.value,children:[(0,s.jsx)(P.Z,{checked:eE.indexOf(e.value)>-1}),(0,s.jsx)(O.Z,{primary:e.label})]},e.value))})]})}),(0,s.jsx)(N.Z,{children:(0,s.jsxs)(T.Z,{sx:{minWidth:180},size:"small",children:[(0,s.jsx)(D.Z,{id:"failure-filter-mode-label",children:"Display"}),(0,s.jsxs)(W.Z,{labelId:"filter-mode-label",id:"filter-mode",value:ea,onChange:e=>{let t=e.target.value;er(t);let n={};el.prompts.forEach((e,s)=>{n["Prompt ".concat(s+1)]="failures"===t}),en(n)},label:"Filter",children:[(0,s.jsx)(A.Z,{value:"all",children:"Show all results"}),(0,s.jsx)(A.Z,{value:"failures",children:"Show failures only"}),(0,s.jsx)(A.Z,{value:"different",children:"Show different only"}),(0,s.jsx)(A.Z,{value:"highlights",children:"Show highlights only"})]})]})}),(0,s.jsx)(N.Z,{children:(0,s.jsx)(_.Z,{sx:{minWidth:180},size:"small",label:"Search",placeholder:"Text or regex",value:Y,onChange:e=>ee(e.target.value)})}),(0,s.jsx)(N.Z,{flexGrow:1}),(0,s.jsx)(N.Z,{display:"flex",justifyContent:"flex-end",children:(0,s.jsxs)(te,{direction:"row",spacing:2,children:[(0,s.jsx)(E.Z,{color:"primary",onClick:e=>{eg(e.currentTarget)},startIcon:(0,s.jsx)(w.Z,{}),children:"Eval actions"}),g&&(0,s.jsxs)(L.Z,{id:"eval-actions-menu",anchorEl:ex,keepMounted:!0,open:!!ex,onClose:()=>{eg(null)},children:[(0,s.jsx)(ep,{initialEvals:n,onComparisonEvalSelected:ef}),(0,s.jsx)(V.Z,{title:"View the configuration that defines this eval",placement:"left",children:(0,s.jsxs)(A.Z,{onClick:()=>ek(!0),children:[(0,s.jsx)(M.Z,{children:(0,s.jsx)(I.Z,{fontSize:"small"})}),"View YAML"]})}),(0,s.jsx)(V.Z,{title:"Edit this eval in the web UI",placement:"left",children:(0,s.jsxs)(A.Z,{onClick:()=>{q(g),d.push("/setup/")},children:[(0,s.jsx)(M.Z,{children:(0,s.jsx)(k.Z,{fontSize:"small"})}),"Edit Eval"]})}),(0,s.jsx)(ey,{}),(null==g?void 0:g.sharing)&&(0,s.jsx)(V.Z,{title:"Generate a unique URL that others can access",placement:"left",children:(0,s.jsxs)(A.Z,{onClick:ev,disabled:eu,children:[(0,s.jsx)(M.Z,{children:eu?(0,s.jsx)(v.Z,{size:16}):(0,s.jsx)(R.Z,{fontSize:"small"})}),"Share"]})}),(0,s.jsx)(V.Z,{title:"Delete this eval",placement:"left",children:(0,s.jsxs)(A.Z,{onClick:eD,children:[(0,s.jsx)(M.Z,{children:(0,s.jsx)(C.Z,{fontSize:"small"})}),"Delete"]})})]}),(0,s.jsx)(V.Z,{title:"Edit table view settings",placement:"bottom",children:(0,s.jsx)(E.Z,{color:"primary",onClick:()=>eR(!0),startIcon:(0,s.jsx)(S.Z,{}),children:"Table Settings"})}),(null==g?void 0:null===(t=g.metadata)||void 0===t?void 0:t.redteam)&&(0,s.jsx)(V.Z,{title:"View vulnerability scan report",placement:"bottom",children:(0,s.jsx)(E.Z,{color:"primary",startIcon:(0,s.jsx)(I.Z,{}),onClick:()=>{var e;return d.push("/report/?evalId=".concat(K||c||(null===(e=n[0])||void 0===e?void 0:e.evalId)))},children:"Vulnerability Report"})})]})})]}),(0,s.jsx)(eT,{columnVisibility:eI}),(0,s.jsx)(e7,{maxTextLength:b,columnVisibility:eI,wordBreak:z,showStats:J,filterMode:ea,failureFilter:et,searchText:Q,onFailureFilterToggle:es,onSearchTextChange:ee}),(0,s.jsx)(ej,{open:eC,onClose:()=>ek(!1)}),(0,s.jsx)(e9,{open:ei,onClose:()=>eo(!1),shareUrl:ec}),(0,s.jsx)(e8,{open:eS,onClose:()=>eR(!1)})]})}async function tn(){let e=(0,j.createClientComponentClient)(),{data:{user:t}}=await e.auth.getUser();(0,y.Z)(t,"User not logged in");let{data:n,error:s}=await e.from("EvaluationResult").select("id, createdAt").eq("user_id",t.id).order("createdAt",{ascending:!1}).limit(100);return n||[]}async function ts(e){let t=(0,j.createClientComponentClient)(),{data:n,error:s}=await t.from("EvaluationResult").select("*").eq("id",e).single();return n}function tl(e){var t;let{fetchId:n,preloadedData:a,recentEvals:i,defaultEvalId:c}=e,u=(0,f.useRouter)(),{table:h,setTable:p,setConfig:m,setEvalId:j,setAuthor:Z,setInComparisonMode:w}=eh(),[C,k]=l.useState(!1),[S,R]=l.useState(!1),[I,N]=l.useState(i||[]),E=async()=>{let e=await fetch("".concat(await (0,o.b)(),"/api/results"),{cache:"no-store"}),t=await e.json();return N(t.data),t.data},P=l.useCallback(async e=>{let t=await fetch("".concat(await (0,o.b)(),"/api/results/").concat(e),{cache:"no-store"}),n=await t.json();p(n.data.results.table),m(n.data.config),Z(n.data.author),j(e)},[p,m,j,Z]),F=async e=>{g.Ox?(k(!1),u.push("/eval/remote:".concat(encodeURIComponent(e)))):u.push("/eval/?evalId=".concat(encodeURIComponent(e)))},[T,D]=l.useState(c||(null===(t=I[0])||void 0===t?void 0:t.evalId)),M=(0,f.useSearchParams)(),O=M?M.get("evalId"):null;return(l.useEffect(()=>{if(O){let e=async()=>{await P(O),k(!0),D(O),E()};e()}else if(a){var e;p(null===(e=a.data.results)||void 0===e?void 0:e.table),m(a.data.config),Z(a.data.author||null),k(!0)}else if(n){let e=async()=>{var e;let t="".concat(r,"/api/eval/").concat(n);console.log("Fetching eval from remote server",t);let s=await fetch(t);if(!s.ok){R(!0);return}let l=await s.json();p(null===(e=l.data.results)||void 0===e?void 0:e.table),m(l.data.config),Z(l.data.author||null),k(!0)};e()}else if(g.T8)(0,o.b)().then(e=>{let t=(0,b.io)(e);return t.on("init",e=>{console.log("Initialized socket connection",e),k(!0),p(null==e?void 0:e.results.table),m(null==e?void 0:e.config),Z((null==e?void 0:e.author)||null),E().then(e=>{var t,n;D(null===(t=e[0])||void 0===t?void 0:t.id),j(null===(n=e[0])||void 0===n?void 0:n.id)})}),t.on("update",e=>{console.log("Received data update",e),p(e.results.table),m(e.config),Z(e.author||null),E().then(e=>{var t;let n=null===(t=e[0])||void 0===t?void 0:t.id;n&&(D(n),j(n))})}),()=>{t.disconnect()}});else if(g.Ox)tn().then(e=>{N(e.map(e=>({evalId:e.id,datasetId:null,label:e.createdAt,createdAt:new Date(e.createdAt).getTime(),description:"None",numTests:-1}))),e.length>0&&ts(e[0].id).then(t=>{(0,y.Z)(t,"Eval not found");let n=t.results,s=t.config;D(e[0].id),p(n.table),m(s),Z(null),k(!0)})});else{let e=async()=>{let e=await E();if(!(e.length>0))return(0,s.jsx)("div",{className:"notice",children:"No evals yet. Share some evals to this server and they will appear here."});{let t=await (0,o.b)(),n=e[0].id,s=await fetch("".concat(t,"/api/results/").concat(n)),l=await s.json();p(l.data.results.table),m(l.data.config),Z(l.data.author||null),k(!0),D(n),j(n)}};e()}w(!1)},[n,p,m,Z,j,P,a,D,O,w]),S)?(0,s.jsx)("div",{className:"notice",children:"404 Eval not found"}):C&&h?(0,s.jsx)(x,{children:(0,s.jsx)(d,{children:(0,s.jsx)(tt,{defaultEvalId:T,recentEvals:I,onRecentEvalSelected:F})})}):(0,s.jsxs)("div",{className:"notice",children:[(0,s.jsx)("div",{children:(0,s.jsx)(v.Z,{size:22})}),(0,s.jsx)("div",{children:"Waiting for eval data"})]})}n(94455)},52428:function(e,t,n){"use strict";n.d(t,{Ox:function(){return a},T8:function(){return l},eA:function(){return r}});var s=n(77580);let l=!s.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,a=!!s.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,r=""},47887:function(e,t,n){"use strict";n.d(t,{o:function(){return a}});var s=n(79685),l=n(74595);let a=(0,s.Ue)()((0,l.tJ)((e,t)=>({env:{},testCases:[],description:"",providers:[],prompts:[],defaultTest:{},evaluateOptions:{},scenarios:[],setEnv:t=>e({env:t}),setTestCases:t=>e({testCases:t}),setDescription:t=>e({description:t}),setProviders:t=>e({providers:t}),setPrompts:t=>e({prompts:t}),setDefaultTest:t=>e({defaultTest:t}),setEvaluateOptions:t=>e({evaluateOptions:t}),setScenarios:t=>e({scenarios:t}),setStateFromConfig:t=>{let n={};t.description&&(n.description=t.description||""),t.tests&&(n.testCases=t.tests),t.providers&&(n.providers=t.providers),t.prompts&&("string"==typeof t.prompts?n.prompts=[t.prompts]:Array.isArray(t.prompts)?n.prompts=t.prompts.filter(e=>"string"==typeof e&&!e.endsWith(".txt")&&!e.endsWith(".json")&&!e.endsWith(".yaml")):console.warn("Invalid prompts config",t.prompts)),t.defaultTest&&(n.defaultTest=t.defaultTest),t.evaluateOptions&&(n.evaluateOptions=t.evaluateOptions),t.scenarios&&(n.scenarios=t.scenarios),e(n)},getTestSuite:()=>{let{description:e,testCases:n,providers:s,prompts:l,env:a,scenarios:r}=t();return{env:a,description:e,providers:s,prompts:l,tests:n,scenarios:r}}}),{name:"promptfoo",skipHydration:!0}))},55974:function(){},94455:function(){},16658:function(){},93207:function(){},58022:function(){}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[716],{613:function(e,t,r){"use strict";r.d(t,{u:function(){return m}});var a=r(79042),n=r(94312),i=r(14978),o=r(76008),s=r(64469),l=r(82063),u=r(94751),d=r(24004);let h=["onChange","maxRows","minRows","style","value"];function p(e){return parseInt(e,10)||0}let c={shadow:{visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"}},m=i.forwardRef(function(e,t){let{onChange:r,maxRows:m,minRows:g=1,style:f,value:x}=e,v=(0,n.Z)(e,h),{current:b}=i.useRef(null!=x),y=i.useRef(null),Z=(0,o.Z)(t,y),w=i.useRef(null),S=i.useCallback(()=>{let t=y.current,r=(0,s.Z)(t),a=r.getComputedStyle(t);if("0px"===a.width)return{outerHeightStyle:0,overflowing:!1};let n=w.current;n.style.width=a.width,n.value=t.value||e.placeholder||"x","\n"===n.value.slice(-1)&&(n.value+=" ");let i=a.boxSizing,o=p(a.paddingBottom)+p(a.paddingTop),l=p(a.borderBottomWidth)+p(a.borderTopWidth),u=n.scrollHeight;n.value="x";let d=n.scrollHeight,h=u;g&&(h=Math.max(Number(g)*d,h)),m&&(h=Math.min(Number(m)*d,h)),h=Math.max(h,d);let c=h+("border-box"===i?o+l:0),f=1>=Math.abs(h-u);return{outerHeightStyle:c,overflowing:f}},[m,g,e.placeholder]),C=i.useCallback(()=>{let e=S();if(null==e||0===Object.keys(e).length||0===e.outerHeightStyle&&!e.overflowing)return;let t=y.current;t.style.height=`${e.outerHeightStyle}px`,t.style.overflow=e.overflowing?"hidden":""},[S]);return(0,l.Z)(()=>{let e,t;let r=()=>{C()},a=(0,u.Z)(r),n=y.current,i=(0,s.Z)(n);return i.addEventListener("resize",a),"undefined"!=typeof ResizeObserver&&(t=new ResizeObserver(r)).observe(n),()=>{a.clear(),cancelAnimationFrame(e),i.removeEventListener("resize",a),t&&t.disconnect()}},[S,C]),(0,l.Z)(()=>{C()}),(0,d.jsxs)(i.Fragment,{children:[(0,d.jsx)("textarea",(0,a.Z)({value:x,onChange:e=>{b||C(),r&&r(e)},ref:Z,rows:g,style:f},v)),(0,d.jsx)("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:w,tabIndex:-1,style:(0,a.Z)({},c.shadow,f,{paddingTop:0,paddingBottom:0})})]})})},11520:function(e,t,r){"use strict";r.d(t,{Z:function(){return S}});var a=r(94312),n=r(79042),i=r(14978),o=r(53468),s=r(46213),l=r(3982),u=r(225),d=r(48976),h=r(14059),p=r(23437),c=r(24004);let m=["className","component","disableGutters","fixed","maxWidth","classes"],g=(0,p.Z)(),f=(0,h.Z)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,t[`maxWidth${(0,u.Z)(String(r.maxWidth))}`],r.fixed&&t.fixed,r.disableGutters&&t.disableGutters]}}),x=e=>(0,d.Z)({props:e,name:"MuiContainer",defaultTheme:g}),v=(e,t)=>{let{classes:r,fixed:a,disableGutters:n,maxWidth:i}=e,o={root:["root",i&&`maxWidth${(0,u.Z)(String(i))}`,a&&"fixed",n&&"disableGutters"]};return(0,l.Z)(o,e=>(0,s.ZP)(t,e),r)};var b=r(81427),y=r(31608),Z=r(87286);let w=function(e={}){let{createStyledComponent:t=f,useThemeProps:r=x,componentName:s="MuiContainer"}=e,l=t(({theme:e,ownerState:t})=>(0,n.Z)({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!t.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,r)=>{let a=e.breakpoints.values[r];return 0!==a&&(t[e.breakpoints.up(r)]={maxWidth:`${a}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:t})=>(0,n.Z)({},"xs"===t.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},t.maxWidth&&"xs"!==t.maxWidth&&{[e.breakpoints.up(t.maxWidth)]:{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`}})),u=i.forwardRef(function(e,t){let i=r(e),{className:u,component:d="div",disableGutters:h=!1,fixed:p=!1,maxWidth:g="lg"}=i,f=(0,a.Z)(i,m),x=(0,n.Z)({},i,{component:d,disableGutters:h,fixed:p,maxWidth:g}),b=v(x,s);return(0,c.jsx)(l,(0,n.Z)({as:d,ownerState:x,className:(0,o.Z)(b.root,u),ref:t},f))});return u}({createStyledComponent:(0,y.ZP)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,t[`maxWidth${(0,b.Z)(String(r.maxWidth))}`],r.fixed&&t.fixed,r.disableGutters&&t.disableGutters]}}),useThemeProps:e=>(0,Z.i)({props:e,name:"MuiContainer"})});var S=w},63147:function(e,t,r){"use strict";r.d(t,{Z:function(){return S}});var a=r(94312),n=r(79042),i=r(14978),o=r(53468),s=r(86251),l=r(3982),u=r(31608),d=r(87286),h=r(81427),p=r(25800),c=r(46213);function m(e){return(0,c.ZP)("MuiTypography",e)}(0,p.Z)("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);var g=r(24004);let f=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],x=e=>{let{align:t,gutterBottom:r,noWrap:a,paragraph:n,variant:i,classes:o}=e,s={root:["root",i,"inherit"!==e.align&&`align${(0,h.Z)(t)}`,r&&"gutterBottom",a&&"noWrap",n&&"paragraph"]};return(0,l.Z)(s,m,o)},v=(0,u.ZP)("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,r.variant&&t[r.variant],"inherit"!==r.align&&t[`align${(0,h.Z)(r.align)}`],r.noWrap&&t.noWrap,r.gutterBottom&&t.gutterBottom,r.paragraph&&t.paragraph]}})(({theme:e,ownerState:t})=>(0,n.Z)({margin:0},"inherit"===t.variant&&{font:"inherit"},"inherit"!==t.variant&&e.typography[t.variant],"inherit"!==t.align&&{textAlign:t.align},t.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},t.gutterBottom&&{marginBottom:"0.35em"},t.paragraph&&{marginBottom:16})),b={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},y={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Z=e=>y[e]||e,w=i.forwardRef(function(e,t){let r=(0,d.i)({props:e,name:"MuiTypography"}),i=Z(r.color),l=(0,s.Z)((0,n.Z)({},r,{color:i})),{align:u="inherit",className:h,component:p,gutterBottom:c=!1,noWrap:m=!1,paragraph:y=!1,variant:w="body1",variantMapping:S=b}=l,C=(0,a.Z)(l,f),W=(0,n.Z)({},l,{align:u,color:i,className:h,component:p,gutterBottom:c,noWrap:m,paragraph:y,variant:w,variantMapping:S}),R=p||(y?"p":S[w]||b[w])||"span",k=x(W);return(0,g.jsx)(v,(0,n.Z)({as:R,ref:t,ownerState:W,className:(0,o.Z)(k.root,h)},C))});var S=w},
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[716],{613:function(e,t,r){"use strict";r.d(t,{u:function(){return m}});var a=r(79042),n=r(94312),i=r(14978),o=r(76008),s=r(64469),l=r(82063),u=r(94751),d=r(24004);let h=["onChange","maxRows","minRows","style","value"];function p(e){return parseInt(e,10)||0}let c={shadow:{visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"}},m=i.forwardRef(function(e,t){let{onChange:r,maxRows:m,minRows:g=1,style:f,value:x}=e,v=(0,n.Z)(e,h),{current:b}=i.useRef(null!=x),y=i.useRef(null),Z=(0,o.Z)(t,y),w=i.useRef(null),S=i.useCallback(()=>{let t=y.current,r=(0,s.Z)(t),a=r.getComputedStyle(t);if("0px"===a.width)return{outerHeightStyle:0,overflowing:!1};let n=w.current;n.style.width=a.width,n.value=t.value||e.placeholder||"x","\n"===n.value.slice(-1)&&(n.value+=" ");let i=a.boxSizing,o=p(a.paddingBottom)+p(a.paddingTop),l=p(a.borderBottomWidth)+p(a.borderTopWidth),u=n.scrollHeight;n.value="x";let d=n.scrollHeight,h=u;g&&(h=Math.max(Number(g)*d,h)),m&&(h=Math.min(Number(m)*d,h)),h=Math.max(h,d);let c=h+("border-box"===i?o+l:0),f=1>=Math.abs(h-u);return{outerHeightStyle:c,overflowing:f}},[m,g,e.placeholder]),C=i.useCallback(()=>{let e=S();if(null==e||0===Object.keys(e).length||0===e.outerHeightStyle&&!e.overflowing)return;let t=y.current;t.style.height=`${e.outerHeightStyle}px`,t.style.overflow=e.overflowing?"hidden":""},[S]);return(0,l.Z)(()=>{let e,t;let r=()=>{C()},a=(0,u.Z)(r),n=y.current,i=(0,s.Z)(n);return i.addEventListener("resize",a),"undefined"!=typeof ResizeObserver&&(t=new ResizeObserver(r)).observe(n),()=>{a.clear(),cancelAnimationFrame(e),i.removeEventListener("resize",a),t&&t.disconnect()}},[S,C]),(0,l.Z)(()=>{C()}),(0,d.jsxs)(i.Fragment,{children:[(0,d.jsx)("textarea",(0,a.Z)({value:x,onChange:e=>{b||C(),r&&r(e)},ref:Z,rows:g,style:f},v)),(0,d.jsx)("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:w,tabIndex:-1,style:(0,a.Z)({},c.shadow,f,{paddingTop:0,paddingBottom:0})})]})})},11520:function(e,t,r){"use strict";r.d(t,{Z:function(){return S}});var a=r(94312),n=r(79042),i=r(14978),o=r(53468),s=r(46213),l=r(3982),u=r(225),d=r(48976),h=r(14059),p=r(23437),c=r(24004);let m=["className","component","disableGutters","fixed","maxWidth","classes"],g=(0,p.Z)(),f=(0,h.Z)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,t[`maxWidth${(0,u.Z)(String(r.maxWidth))}`],r.fixed&&t.fixed,r.disableGutters&&t.disableGutters]}}),x=e=>(0,d.Z)({props:e,name:"MuiContainer",defaultTheme:g}),v=(e,t)=>{let{classes:r,fixed:a,disableGutters:n,maxWidth:i}=e,o={root:["root",i&&`maxWidth${(0,u.Z)(String(i))}`,a&&"fixed",n&&"disableGutters"]};return(0,l.Z)(o,e=>(0,s.ZP)(t,e),r)};var b=r(81427),y=r(31608),Z=r(87286);let w=function(e={}){let{createStyledComponent:t=f,useThemeProps:r=x,componentName:s="MuiContainer"}=e,l=t(({theme:e,ownerState:t})=>(0,n.Z)({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!t.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,r)=>{let a=e.breakpoints.values[r];return 0!==a&&(t[e.breakpoints.up(r)]={maxWidth:`${a}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:t})=>(0,n.Z)({},"xs"===t.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},t.maxWidth&&"xs"!==t.maxWidth&&{[e.breakpoints.up(t.maxWidth)]:{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`}})),u=i.forwardRef(function(e,t){let i=r(e),{className:u,component:d="div",disableGutters:h=!1,fixed:p=!1,maxWidth:g="lg"}=i,f=(0,a.Z)(i,m),x=(0,n.Z)({},i,{component:d,disableGutters:h,fixed:p,maxWidth:g}),b=v(x,s);return(0,c.jsx)(l,(0,n.Z)({as:d,ownerState:x,className:(0,o.Z)(b.root,u),ref:t},f))});return u}({createStyledComponent:(0,y.ZP)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,t[`maxWidth${(0,b.Z)(String(r.maxWidth))}`],r.fixed&&t.fixed,r.disableGutters&&t.disableGutters]}}),useThemeProps:e=>(0,Z.i)({props:e,name:"MuiContainer"})});var S=w},63147:function(e,t,r){"use strict";r.d(t,{Z:function(){return S}});var a=r(94312),n=r(79042),i=r(14978),o=r(53468),s=r(86251),l=r(3982),u=r(31608),d=r(87286),h=r(81427),p=r(25800),c=r(46213);function m(e){return(0,c.ZP)("MuiTypography",e)}(0,p.Z)("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);var g=r(24004);let f=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],x=e=>{let{align:t,gutterBottom:r,noWrap:a,paragraph:n,variant:i,classes:o}=e,s={root:["root",i,"inherit"!==e.align&&`align${(0,h.Z)(t)}`,r&&"gutterBottom",a&&"noWrap",n&&"paragraph"]};return(0,l.Z)(s,m,o)},v=(0,u.ZP)("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,r.variant&&t[r.variant],"inherit"!==r.align&&t[`align${(0,h.Z)(r.align)}`],r.noWrap&&t.noWrap,r.gutterBottom&&t.gutterBottom,r.paragraph&&t.paragraph]}})(({theme:e,ownerState:t})=>(0,n.Z)({margin:0},"inherit"===t.variant&&{font:"inherit"},"inherit"!==t.variant&&e.typography[t.variant],"inherit"!==t.align&&{textAlign:t.align},t.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},t.gutterBottom&&{marginBottom:"0.35em"},t.paragraph&&{marginBottom:16})),b={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},y={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Z=e=>y[e]||e,w=i.forwardRef(function(e,t){let r=(0,d.i)({props:e,name:"MuiTypography"}),i=Z(r.color),l=(0,s.Z)((0,n.Z)({},r,{color:i})),{align:u="inherit",className:h,component:p,gutterBottom:c=!1,noWrap:m=!1,paragraph:y=!1,variant:w="body1",variantMapping:S=b}=l,C=(0,a.Z)(l,f),W=(0,n.Z)({},l,{align:u,color:i,className:h,component:p,gutterBottom:c,noWrap:m,paragraph:y,variant:w,variantMapping:S}),R=p||(y?"p":S[w]||b[w])||"span",k=x(W);return(0,g.jsx)(v,(0,n.Z)({as:R,ref:t,ownerState:W,className:(0,o.Z)(k.root,h)},C))});var S=w},99152:function(e,t,r){Promise.resolve().then(r.bind(r,92030))},92030:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return c}});var a=r(24004),n=r(14978),i=r(1445),o=r(40982),s=r(11520),l=r(67339),u=r(63147),d=r(38640),h=r.n(d),p=r(28891);function c(){let e=(0,p.useRouter)(),[t,r]=n.useState(""),[d,c]=n.useState(""),[m,g]=n.useState(""),[f,x]=n.useState(!1),[v,b]=n.useState(null),y=n.useCallback(async()=>{let{data:e,error:t}=await i.OQ.auth.refreshSession();e&&b(e.user)},[]);n.useEffect(()=>{y()},[y]);let Z=async r=>{if(x(!0),g(""),r.stopPropagation(),r.preventDefault(),!v){let{data:r,error:a}=await i.OQ.auth.signInWithPassword({email:t,password:d});a?g(a.message):e.push("/")}x(!1)};return v?(0,a.jsxs)("div",{style:{textAlign:"center"},children:["You're already logged in as ",v.email,"."]}):(0,a.jsxs)(s.Z,{component:"main",maxWidth:"xs",children:[(0,a.jsx)(u.Z,{component:"h1",variant:"h5",children:"Sign in"}),(0,a.jsx)("form",{children:!v&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"email",label:"Email Address",name:"email",autoComplete:"email",autoFocus:!0,onChange:e=>r(e.target.value),value:t,error:!!m}),(0,a.jsx)(l.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",autoComplete:"current-password",onChange:e=>c(e.target.value),value:d,error:!!m,helperText:m}),(0,a.jsx)(o.Z,{type:"submit",disabled:f,sx:{marginTop:"1em"},fullWidth:!0,variant:"contained",color:"primary",onClick:Z,children:"Sign In"}),(0,a.jsxs)("p",{children:["Don't have an account yet? ",(0,a.jsx)(h(),{href:"/auth/signup",children:"Sign up"})]})]})})]})}},1445:function(e,t,r){"use strict";r.d(t,{Ho:function(){return h},OQ:function(){return o},aC:function(){return l}});var a=r(24004),n=r(14978),i=r(12594);let o=(0,i.createClientComponentClient)(),s=(0,n.createContext)({}),l=()=>(0,n.useContext)(s),u=(e,t)=>o.auth.signInWithPassword({email:e,password:t}),d=()=>o.auth.signOut(),h=e=>{let{children:t}=e,[r,i]=(0,n.useState)(null),[l,h]=(0,n.useState)(!1),p=(0,n.useCallback)(async()=>{let{data:e,error:t}=await o.auth.refreshSession();e&&i(e.user)},[]);return(0,n.useEffect)(()=>{p();let{data:e}=o.auth.onAuthStateChange(async(e,t)=>{"PASSWORD_RECOVERY"==e?h(!1):"SIGNED_IN"===e&&t?(i(t.user),h(!0)):"SIGNED_OUT"===e&&(h(!1),i(null))});return()=>{e.subscription.unsubscribe()}},[p]),(0,a.jsx)(s.Provider,{value:{loggedIn:l,user:r,login:u,logout:d},children:t})}},28891:function(e,t,r){e.exports=r(98556)}},function(e){e.O(0,[448,640,620,304,339,163,470,730,744],function(){return e(e.s=99152)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[271],{613:function(e,t,r){"use strict";r.d(t,{u:function(){return m}});var a=r(79042),n=r(94312),i=r(14978),o=r(76008),s=r(64469),l=r(82063),u=r(94751),d=r(24004);let h=["onChange","maxRows","minRows","style","value"];function p(e){return parseInt(e,10)||0}let c={shadow:{visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"}},m=i.forwardRef(function(e,t){let{onChange:r,maxRows:m,minRows:g=1,style:f,value:x}=e,v=(0,n.Z)(e,h),{current:b}=i.useRef(null!=x),y=i.useRef(null),Z=(0,o.Z)(t,y),w=i.useRef(null),S=i.useCallback(()=>{let t=y.current,r=(0,s.Z)(t),a=r.getComputedStyle(t);if("0px"===a.width)return{outerHeightStyle:0,overflowing:!1};let n=w.current;n.style.width=a.width,n.value=t.value||e.placeholder||"x","\n"===n.value.slice(-1)&&(n.value+=" ");let i=a.boxSizing,o=p(a.paddingBottom)+p(a.paddingTop),l=p(a.borderBottomWidth)+p(a.borderTopWidth),u=n.scrollHeight;n.value="x";let d=n.scrollHeight,h=u;g&&(h=Math.max(Number(g)*d,h)),m&&(h=Math.min(Number(m)*d,h)),h=Math.max(h,d);let c=h+("border-box"===i?o+l:0),f=1>=Math.abs(h-u);return{outerHeightStyle:c,overflowing:f}},[m,g,e.placeholder]),C=i.useCallback(()=>{let e=S();if(null==e||0===Object.keys(e).length||0===e.outerHeightStyle&&!e.overflowing)return;let t=y.current;t.style.height=`${e.outerHeightStyle}px`,t.style.overflow=e.overflowing?"hidden":""},[S]);return(0,l.Z)(()=>{let e,t;let r=()=>{C()},a=(0,u.Z)(r),n=y.current,i=(0,s.Z)(n);return i.addEventListener("resize",a),"undefined"!=typeof ResizeObserver&&(t=new ResizeObserver(r)).observe(n),()=>{a.clear(),cancelAnimationFrame(e),i.removeEventListener("resize",a),t&&t.disconnect()}},[S,C]),(0,l.Z)(()=>{C()}),(0,d.jsxs)(i.Fragment,{children:[(0,d.jsx)("textarea",(0,a.Z)({value:x,onChange:e=>{b||C(),r&&r(e)},ref:Z,rows:g,style:f},v)),(0,d.jsx)("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:w,tabIndex:-1,style:(0,a.Z)({},c.shadow,f,{paddingTop:0,paddingBottom:0})})]})})},11520:function(e,t,r){"use strict";r.d(t,{Z:function(){return S}});var a=r(94312),n=r(79042),i=r(14978),o=r(53468),s=r(46213),l=r(3982),u=r(225),d=r(48976),h=r(14059),p=r(23437),c=r(24004);let m=["className","component","disableGutters","fixed","maxWidth","classes"],g=(0,p.Z)(),f=(0,h.Z)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,t[`maxWidth${(0,u.Z)(String(r.maxWidth))}`],r.fixed&&t.fixed,r.disableGutters&&t.disableGutters]}}),x=e=>(0,d.Z)({props:e,name:"MuiContainer",defaultTheme:g}),v=(e,t)=>{let{classes:r,fixed:a,disableGutters:n,maxWidth:i}=e,o={root:["root",i&&`maxWidth${(0,u.Z)(String(i))}`,a&&"fixed",n&&"disableGutters"]};return(0,l.Z)(o,e=>(0,s.ZP)(t,e),r)};var b=r(81427),y=r(31608),Z=r(87286);let w=function(e={}){let{createStyledComponent:t=f,useThemeProps:r=x,componentName:s="MuiContainer"}=e,l=t(({theme:e,ownerState:t})=>(0,n.Z)({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!t.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,r)=>{let a=e.breakpoints.values[r];return 0!==a&&(t[e.breakpoints.up(r)]={maxWidth:`${a}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:t})=>(0,n.Z)({},"xs"===t.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},t.maxWidth&&"xs"!==t.maxWidth&&{[e.breakpoints.up(t.maxWidth)]:{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`}})),u=i.forwardRef(function(e,t){let i=r(e),{className:u,component:d="div",disableGutters:h=!1,fixed:p=!1,maxWidth:g="lg"}=i,f=(0,a.Z)(i,m),x=(0,n.Z)({},i,{component:d,disableGutters:h,fixed:p,maxWidth:g}),b=v(x,s);return(0,c.jsx)(l,(0,n.Z)({as:d,ownerState:x,className:(0,o.Z)(b.root,u),ref:t},f))});return u}({createStyledComponent:(0,y.ZP)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,t[`maxWidth${(0,b.Z)(String(r.maxWidth))}`],r.fixed&&t.fixed,r.disableGutters&&t.disableGutters]}}),useThemeProps:e=>(0,Z.i)({props:e,name:"MuiContainer"})});var S=w},63147:function(e,t,r){"use strict";r.d(t,{Z:function(){return S}});var a=r(94312),n=r(79042),i=r(14978),o=r(53468),s=r(86251),l=r(3982),u=r(31608),d=r(87286),h=r(81427),p=r(25800),c=r(46213);function m(e){return(0,c.ZP)("MuiTypography",e)}(0,p.Z)("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);var g=r(24004);let f=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],x=e=>{let{align:t,gutterBottom:r,noWrap:a,paragraph:n,variant:i,classes:o}=e,s={root:["root",i,"inherit"!==e.align&&`align${(0,h.Z)(t)}`,r&&"gutterBottom",a&&"noWrap",n&&"paragraph"]};return(0,l.Z)(s,m,o)},v=(0,u.ZP)("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,r.variant&&t[r.variant],"inherit"!==r.align&&t[`align${(0,h.Z)(r.align)}`],r.noWrap&&t.noWrap,r.gutterBottom&&t.gutterBottom,r.paragraph&&t.paragraph]}})(({theme:e,ownerState:t})=>(0,n.Z)({margin:0},"inherit"===t.variant&&{font:"inherit"},"inherit"!==t.variant&&e.typography[t.variant],"inherit"!==t.align&&{textAlign:t.align},t.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},t.gutterBottom&&{marginBottom:"0.35em"},t.paragraph&&{marginBottom:16})),b={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},y={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Z=e=>y[e]||e,w=i.forwardRef(function(e,t){let r=(0,d.i)({props:e,name:"MuiTypography"}),i=Z(r.color),l=(0,s.Z)((0,n.Z)({},r,{color:i})),{align:u="inherit",className:h,component:p,gutterBottom:c=!1,noWrap:m=!1,paragraph:y=!1,variant:w="body1",variantMapping:S=b}=l,C=(0,a.Z)(l,f),W=(0,n.Z)({},l,{align:u,color:i,className:h,component:p,gutterBottom:c,noWrap:m,paragraph:y,variant:w,variantMapping:S}),R=p||(y?"p":S[w]||b[w])||"span",k=x(W);return(0,g.jsx)(v,(0,n.Z)({as:R,ref:t,ownerState:W,className:(0,o.Z)(k.root,h)},C))});var S=w},
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[271],{613:function(e,t,r){"use strict";r.d(t,{u:function(){return m}});var a=r(79042),n=r(94312),i=r(14978),o=r(76008),s=r(64469),l=r(82063),u=r(94751),d=r(24004);let h=["onChange","maxRows","minRows","style","value"];function p(e){return parseInt(e,10)||0}let c={shadow:{visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"}},m=i.forwardRef(function(e,t){let{onChange:r,maxRows:m,minRows:g=1,style:f,value:x}=e,v=(0,n.Z)(e,h),{current:b}=i.useRef(null!=x),y=i.useRef(null),Z=(0,o.Z)(t,y),w=i.useRef(null),S=i.useCallback(()=>{let t=y.current,r=(0,s.Z)(t),a=r.getComputedStyle(t);if("0px"===a.width)return{outerHeightStyle:0,overflowing:!1};let n=w.current;n.style.width=a.width,n.value=t.value||e.placeholder||"x","\n"===n.value.slice(-1)&&(n.value+=" ");let i=a.boxSizing,o=p(a.paddingBottom)+p(a.paddingTop),l=p(a.borderBottomWidth)+p(a.borderTopWidth),u=n.scrollHeight;n.value="x";let d=n.scrollHeight,h=u;g&&(h=Math.max(Number(g)*d,h)),m&&(h=Math.min(Number(m)*d,h)),h=Math.max(h,d);let c=h+("border-box"===i?o+l:0),f=1>=Math.abs(h-u);return{outerHeightStyle:c,overflowing:f}},[m,g,e.placeholder]),C=i.useCallback(()=>{let e=S();if(null==e||0===Object.keys(e).length||0===e.outerHeightStyle&&!e.overflowing)return;let t=y.current;t.style.height=`${e.outerHeightStyle}px`,t.style.overflow=e.overflowing?"hidden":""},[S]);return(0,l.Z)(()=>{let e,t;let r=()=>{C()},a=(0,u.Z)(r),n=y.current,i=(0,s.Z)(n);return i.addEventListener("resize",a),"undefined"!=typeof ResizeObserver&&(t=new ResizeObserver(r)).observe(n),()=>{a.clear(),cancelAnimationFrame(e),i.removeEventListener("resize",a),t&&t.disconnect()}},[S,C]),(0,l.Z)(()=>{C()}),(0,d.jsxs)(i.Fragment,{children:[(0,d.jsx)("textarea",(0,a.Z)({value:x,onChange:e=>{b||C(),r&&r(e)},ref:Z,rows:g,style:f},v)),(0,d.jsx)("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:w,tabIndex:-1,style:(0,a.Z)({},c.shadow,f,{paddingTop:0,paddingBottom:0})})]})})},11520:function(e,t,r){"use strict";r.d(t,{Z:function(){return S}});var a=r(94312),n=r(79042),i=r(14978),o=r(53468),s=r(46213),l=r(3982),u=r(225),d=r(48976),h=r(14059),p=r(23437),c=r(24004);let m=["className","component","disableGutters","fixed","maxWidth","classes"],g=(0,p.Z)(),f=(0,h.Z)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,t[`maxWidth${(0,u.Z)(String(r.maxWidth))}`],r.fixed&&t.fixed,r.disableGutters&&t.disableGutters]}}),x=e=>(0,d.Z)({props:e,name:"MuiContainer",defaultTheme:g}),v=(e,t)=>{let{classes:r,fixed:a,disableGutters:n,maxWidth:i}=e,o={root:["root",i&&`maxWidth${(0,u.Z)(String(i))}`,a&&"fixed",n&&"disableGutters"]};return(0,l.Z)(o,e=>(0,s.ZP)(t,e),r)};var b=r(81427),y=r(31608),Z=r(87286);let w=function(e={}){let{createStyledComponent:t=f,useThemeProps:r=x,componentName:s="MuiContainer"}=e,l=t(({theme:e,ownerState:t})=>(0,n.Z)({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!t.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,r)=>{let a=e.breakpoints.values[r];return 0!==a&&(t[e.breakpoints.up(r)]={maxWidth:`${a}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:t})=>(0,n.Z)({},"xs"===t.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},t.maxWidth&&"xs"!==t.maxWidth&&{[e.breakpoints.up(t.maxWidth)]:{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`}})),u=i.forwardRef(function(e,t){let i=r(e),{className:u,component:d="div",disableGutters:h=!1,fixed:p=!1,maxWidth:g="lg"}=i,f=(0,a.Z)(i,m),x=(0,n.Z)({},i,{component:d,disableGutters:h,fixed:p,maxWidth:g}),b=v(x,s);return(0,c.jsx)(l,(0,n.Z)({as:d,ownerState:x,className:(0,o.Z)(b.root,u),ref:t},f))});return u}({createStyledComponent:(0,y.ZP)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,t[`maxWidth${(0,b.Z)(String(r.maxWidth))}`],r.fixed&&t.fixed,r.disableGutters&&t.disableGutters]}}),useThemeProps:e=>(0,Z.i)({props:e,name:"MuiContainer"})});var S=w},63147:function(e,t,r){"use strict";r.d(t,{Z:function(){return S}});var a=r(94312),n=r(79042),i=r(14978),o=r(53468),s=r(86251),l=r(3982),u=r(31608),d=r(87286),h=r(81427),p=r(25800),c=r(46213);function m(e){return(0,c.ZP)("MuiTypography",e)}(0,p.Z)("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);var g=r(24004);let f=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],x=e=>{let{align:t,gutterBottom:r,noWrap:a,paragraph:n,variant:i,classes:o}=e,s={root:["root",i,"inherit"!==e.align&&`align${(0,h.Z)(t)}`,r&&"gutterBottom",a&&"noWrap",n&&"paragraph"]};return(0,l.Z)(s,m,o)},v=(0,u.ZP)("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,r.variant&&t[r.variant],"inherit"!==r.align&&t[`align${(0,h.Z)(r.align)}`],r.noWrap&&t.noWrap,r.gutterBottom&&t.gutterBottom,r.paragraph&&t.paragraph]}})(({theme:e,ownerState:t})=>(0,n.Z)({margin:0},"inherit"===t.variant&&{font:"inherit"},"inherit"!==t.variant&&e.typography[t.variant],"inherit"!==t.align&&{textAlign:t.align},t.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},t.gutterBottom&&{marginBottom:"0.35em"},t.paragraph&&{marginBottom:16})),b={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},y={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Z=e=>y[e]||e,w=i.forwardRef(function(e,t){let r=(0,d.i)({props:e,name:"MuiTypography"}),i=Z(r.color),l=(0,s.Z)((0,n.Z)({},r,{color:i})),{align:u="inherit",className:h,component:p,gutterBottom:c=!1,noWrap:m=!1,paragraph:y=!1,variant:w="body1",variantMapping:S=b}=l,C=(0,a.Z)(l,f),W=(0,n.Z)({},l,{align:u,color:i,className:h,component:p,gutterBottom:c,noWrap:m,paragraph:y,variant:w,variantMapping:S}),R=p||(y?"p":S[w]||b[w])||"span",k=x(W);return(0,g.jsx)(v,(0,n.Z)({as:R,ref:t,ownerState:W,className:(0,o.Z)(k.root,h)},C))});var S=w},73591:function(e,t,r){Promise.resolve().then(r.bind(r,78567))},78567:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return c}});var a=r(24004),n=r(14978),i=r(1445),o=r(40982),s=r(11520),l=r(67339),u=r(63147),d=r(38640),h=r.n(d),p=r(28891);function c(){let e=(0,p.useRouter)(),[t,r]=n.useState(""),[d,c]=n.useState(""),[m,g]=n.useState(""),[f,x]=n.useState(!1),[v,b]=n.useState(null),y=n.useCallback(async()=>{let{data:e,error:t}=await i.OQ.auth.refreshSession();e&&b(e.user)},[]);n.useEffect(()=>{y()},[y]);let Z=async r=>{if(x(!0),g(""),r.stopPropagation(),r.preventDefault(),!v){let{data:r,error:a}=await i.OQ.auth.signUp({email:t,password:d,options:{emailRedirectTo:"".concat(location.origin,"/auth/callback")}});a?g(a.message):e.push("/")}x(!1)};return(0,a.jsxs)(s.Z,{component:"main",maxWidth:"xs",children:[(0,a.jsx)(u.Z,{component:"h1",variant:"h5",children:"Sign up"}),(0,a.jsx)("p",{children:(0,a.jsx)(u.Z,{variant:"body1",children:"An account helps you easily save, view, and share your evals."})}),(0,a.jsxs)("form",{children:[!v&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"email",label:"Email Address",name:"email",autoComplete:"email",autoFocus:!0,onChange:e=>r(e.target.value),value:t,error:!!m}),(0,a.jsx)(l.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",autoComplete:"current-password",onChange:e=>c(e.target.value),value:d,error:!!m,helperText:m}),(0,a.jsx)(o.Z,{type:"submit",disabled:f,sx:{marginTop:"1em"},fullWidth:!0,variant:"contained",color:"primary",onClick:Z,children:"Sign Up"})]}),(0,a.jsxs)("p",{children:["Already have an account? ",(0,a.jsx)(h(),{href:"/auth/login",children:"Sign in"})]})]})]})}},1445:function(e,t,r){"use strict";r.d(t,{Ho:function(){return h},OQ:function(){return o},aC:function(){return l}});var a=r(24004),n=r(14978),i=r(12594);let o=(0,i.createClientComponentClient)(),s=(0,n.createContext)({}),l=()=>(0,n.useContext)(s),u=(e,t)=>o.auth.signInWithPassword({email:e,password:t}),d=()=>o.auth.signOut(),h=e=>{let{children:t}=e,[r,i]=(0,n.useState)(null),[l,h]=(0,n.useState)(!1),p=(0,n.useCallback)(async()=>{let{data:e,error:t}=await o.auth.refreshSession();e&&i(e.user)},[]);return(0,n.useEffect)(()=>{p();let{data:e}=o.auth.onAuthStateChange(async(e,t)=>{"PASSWORD_RECOVERY"==e?h(!1):"SIGNED_IN"===e&&t?(i(t.user),h(!0)):"SIGNED_OUT"===e&&(h(!1),i(null))});return()=>{e.subscription.unsubscribe()}},[p]),(0,a.jsx)(s.Provider,{value:{loggedIn:l,user:r,login:u,logout:d},children:t})}},28891:function(e,t,r){e.exports=r(98556)}},function(e){e.O(0,[448,640,620,304,339,163,470,730,744],function(){return e(e.s=73591)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[958],{56:function(e,t,s){Promise.resolve().then(s.bind(s,41400))},49532:function(e,t,s){"use strict";let n,i;async function r(){if(n||(i||(i=fetch("/api/config").then(e=>e.json()).then(e=>n=e.apiBaseUrl)),await i),void 0===n)throw Error("API base URL is undefined");return n}s.d(t,{b:function(){return r}})},41400:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return S}});var n=s(24004),i=s(14978),r=s(49532),l=s(49567),c=s(30469),a=s(65068),d=s(70417),o=s(21303),h=s(26485),u=s(30021),p=s(19708),x=s(65969),j=s(38640),v=s.n(j),m=s(28891),Z=s(40982),f=s(29794),w=s(22701),C=s(51956),y=s(82669),g=s(613),I=s(63147),k=s(34235);function P(e){var t,s,r,l;let{openDialog:p,handleClose:x,testCase:j}=e,[m,P]=(0,i.useState)(1);return(0,n.jsxs)(f.Z,{open:p,onClose:x,fullWidth:!0,maxWidth:"lg",children:[(0,n.jsxs)(y.Z,{children:["Dataset ",j.id.slice(0,6)]}),(0,n.jsxs)(C.Z,{children:[(0,n.jsx)(I.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Test cases"}),(0,n.jsx)(g.u,{readOnly:!0,value:j&&k.default.dump(j.testCases),style:{width:"100%",padding:"0.75rem"},maxRows:15}),(0,n.jsx)(I.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Used in..."}),(0,n.jsxs)(a.Z,{children:[(0,n.jsx)(h.Z,{children:(0,n.jsxs)(u.Z,{children:[(0,n.jsx)(o.Z,{children:"Eval ID"}),(0,n.jsx)(o.Z,{children:"Prompt ID"}),(0,n.jsx)(o.Z,{children:"Raw score"}),(0,n.jsx)(o.Z,{children:"Pass rate"}),(0,n.jsx)(o.Z,{children:"Pass count"}),(0,n.jsx)(o.Z,{children:"Fail count"}),(0,n.jsx)(o.Z,{children:"Prompt"})]})}),(0,n.jsx)(d.Z,{children:null==j?void 0:null===(t=j.prompts)||void 0===t?void 0:t.slice((m-1)*10,10*m).sort((e,t)=>t.evalId.localeCompare(e.evalId)).map((e,t)=>{var s,i,c,a,d;return(0,n.jsxs)(u.Z,{hover:!0,children:[(0,n.jsx)(o.Z,{children:(0,n.jsx)(v(),{href:"/eval/?evalId=".concat(e.evalId),children:e.evalId})}),(0,n.jsx)(o.Z,{style:{minWidth:"8em"},children:(0,n.jsx)(v(),{href:"/prompts/?id=".concat(e.id),children:e.id.slice(0,6)})}),(0,n.jsx)(o.Z,{children:"number"==typeof(null===(s=e.prompt.metrics)||void 0===s?void 0:s.score)?e.prompt.metrics.score.toFixed(2):"-"}),(0,n.jsx)(o.Z,{children:"number"==typeof(null===(i=e.prompt.metrics)||void 0===i?void 0:i.testPassCount)&&"number"==typeof(null===(c=e.prompt.metrics)||void 0===c?void 0:c.testFailCount)&&e.prompt.metrics.testPassCount+e.prompt.metrics.testFailCount>0?(e.prompt.metrics.testPassCount/(e.prompt.metrics.testPassCount+e.prompt.metrics.testFailCount)*100).toFixed(2)+"%":"-"}),(0,n.jsx)(o.Z,{children:null!==(r=null===(a=e.prompt.metrics)||void 0===a?void 0:a.testPassCount)&&void 0!==r?r:"-"}),(0,n.jsx)(o.Z,{children:null!==(l=null===(d=e.prompt.metrics)||void 0===d?void 0:d.testFailCount)&&void 0!==l?l:"-"}),(0,n.jsx)(o.Z,{children:e.prompt.raw.length>250?e.prompt.raw.slice(0,250)+"...":e.prompt.raw})]},t)})})]}),Math.ceil(((null==j?void 0:null===(s=j.prompts)||void 0===s?void 0:s.length)||0)/10)>1&&(0,n.jsx)(c.Z,{count:Math.ceil(j.prompts.length/10),page:m,onChange:(e,t)=>{P(t)}})]}),(0,n.jsx)(w.Z,{children:(0,n.jsx)(Z.Z,{onClick:x,children:"Close"})})]})}function S(){let e=(0,m.useSearchParams)(),[t,s]=(0,i.useState)([]),[j,Z]=(0,i.useState)("date"),[f,w]=(0,i.useState)("desc"),[C,y]=(0,i.useState)(1),[g,I]=(0,i.useState)(10),[k,S]=(0,i.useState)(!1),[b,E]=(0,i.useState)(0),D=e=>{let t=j===e&&"asc"===f?"desc":"asc";Z(e),w(t)};(0,i.useEffect)(()=>{(async()=>{fetch("".concat(await (0,r.b)(),"/api/datasets")).then(e=>e.json()).then(e=>{let t=[...e.data].sort((e,t)=>null===j?0:"asc"===f?e[j]>t[j]?1:-1:e[j]<t[j]?1:-1);s(t)})})()},[j,f,C,g]);let F=e=>{E(e),S(!0)};return(0,i.useEffect)(()=>{let s=null==e?void 0:e.get("id");if(s){let e=t.findIndex(e=>e.id.startsWith(s));-1!==e&&F(e)}},[t,e]),(0,n.jsxs)(l.Z,{paddingX:2,children:[(0,n.jsxs)(a.Z,{children:[(0,n.jsx)(h.Z,{children:(0,n.jsxs)(u.Z,{children:[(0,n.jsx)(o.Z,{style:{width:"10%"},children:"ID"}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:(0,n.jsx)(p.Z,{active:"raw"===j,direction:"raw"===j?f:"asc",onClick:()=>D("raw"),children:"Info"})}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:"Variables"}),(0,n.jsx)(o.Z,{style:{width:"10%"},children:(0,n.jsx)(p.Z,{active:"count"===j,direction:"count"===j?f:"asc",onClick:()=>D("count"),children:"Total # evals"})}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:(0,n.jsx)(x.Z,{title:"The date of the most recent eval for this set of test cases",children:(0,n.jsx)(p.Z,{active:"date"===j,direction:"date"===j?f:"asc",onClick:()=>D("date"),children:"Most recent eval date"})})}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:(0,n.jsx)(x.Z,{title:"The ID of the most recent eval for this set of test cases",children:(0,n.jsx)(p.Z,{active:"evalId"===j,direction:"evalId"===j?f:"asc",onClick:()=>D("evalId"),children:"Most recent eval ID"})})})]})}),(0,n.jsx)(d.Z,{children:t.slice((C-1)*g,C*g).map((e,t)=>(0,n.jsxs)(u.Z,{hover:!0,onClick:()=>F(t),style:{cursor:"pointer"},children:[(0,n.jsx)(o.Z,{children:e.id.slice(0,6)}),(0,n.jsxs)(o.Z,{style:{width:"20%",whiteSpace:"pre-wrap"},children:[e.testCases.length," test cases"]}),(0,n.jsx)(o.Z,{style:{width:"20%",whiteSpace:"pre-wrap"},children:(()=>{if(!Array.isArray(e.testCases)||"string"==typeof e.testCases[0])return"";let t=(e.testCases||[]).flatMap(e=>Object.keys(e.vars||{})),s=Array.from(new Set(t));return s.length>0?s.join(", "):"None"})()}),(0,n.jsx)(o.Z,{style:{width:"10%"},children:e.count}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:e.recentEvalDate||"Unknown"}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:e.recentEvalId?(0,n.jsx)(v(),{href:"/eval?evalId=".concat(e.recentEvalId),children:e.recentEvalId}):"Unknown"})]},t))})]}),Math.ceil(t.length/g)>1&&(0,n.jsx)(c.Z,{count:Math.ceil(t.length/g),page:C,onChange:(e,t)=>y(t)}),t[b]&&(0,n.jsx)(P,{openDialog:k,handleClose:()=>{S(!1)},testCase:t[b]})]})}}},function(e){e.O(0,[448,640,973,995,374,235,322,470,730,744],function(){return e(e.s=56)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[466],{9550:function(n,e,u){Promise.resolve().then(u.t.bind(u,29820,23))},29820:function(){}},function(n){n.O(0,[470,730,744],function(){return n(n.s=9550)}),_N_E=n.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[421],{
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[421],{80550:function(e,n,t){Promise.resolve().then(t.t.bind(t,27924,23)),Promise.resolve().then(t.t.bind(t,16662,23)),Promise.resolve().then(t.t.bind(t,30910,23)),Promise.resolve().then(t.t.bind(t,81885,23)),Promise.resolve().then(t.bind(t,15737)),Promise.resolve().then(t.t.bind(t,29820,23))},81885:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e,n){for(var t in n)Object.defineProperty(e,t,{enumerable:!0,get:n[t]})}(n,{suspense:function(){return o},NoSSR:function(){return i}}),t(69278),t(14978);let r=t(66995);function o(){let e=Error(r.NEXT_DYNAMIC_NO_SSR_CODE);throw e.digest=r.NEXT_DYNAMIC_NO_SSR_CODE,e}function i(e){let{children:n}=e;return n}},29820:function(){}},function(e){e.O(0,[583,448,640,620,973,304,339,995,374,163,378,235,578,631,905,737,470,730,744],function(){return e(e.s=80550)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[11],{15669:function(e,n,s){Promise.resolve().then(s.t.bind(s,63512,23)),Promise.resolve().then(s.bind(s,15737))}},function(e){e.O(0,[583,448,640,620,973,304,339,995,374,163,378,235,578,631,905,737,470,730,744],function(){return e(e.s=15669)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{86611:function(e,t,n){Promise.resolve().then(n.bind(n,5071)),Promise.resolve().then(n.t.bind(n,5100,23)),Promise.resolve().then(n.t.bind(n,65246,23))},5071:function(e,t,n){"use strict";n.r(t),n.d(t,{PageShell:function(){return J}});var r=n(24004),o=n(14978),s=n(52428),i=n(86768),l=n(77656),a=n(32414),c=n(38640),u=n.n(c),h=n(28891),d=n(95707),f=n(80378);function m(e){let{darkMode:t,onToggleDarkMode:n}=e;return(0,r.jsx)("div",{className:"dark-mode-toggle",onClick:n,children:t?(0,r.jsx)(d.Z,{}):(0,r.jsx)(f.Z,{})})}n(32854);var p=n(56343),x=n(89335),g=n(9327),j=n(98629),b=n(16783),v=n(29794),Z=n(82669),S=n(63147),k=n(52062),C=n(51956),E=n(22701),P=n(40982);let _=[{icon:(0,r.jsx)(b.Z,{fontSize:"small"}),text:"Documentation",href:"https://www.promptfoo.dev/docs/intro"},{icon:(0,r.jsx)(j.Z,{fontSize:"small"}),text:"GitHub Repository",href:"https://github.com/promptfoo/promptfoo"},{icon:(0,r.jsx)(p.Z,{fontSize:"small"}),text:"File an Issue",href:"https://github.com/promptfoo/promptfoo/issues"},{icon:(0,r.jsx)(g.Z,{fontSize:"small"}),text:"Join Our Discord Community",href:"https://discord.gg/gHPS9jjfbs"},{icon:(0,r.jsx)(x.Z,{fontSize:"small"}),text:"Book a Meeting",href:"https://cal.com/team/promptfoo/intro"}];function O(e){let{open:t,onClose:n}=e;return(0,r.jsxs)(v.Z,{open:t,onClose:n,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"about-promptfoo-dialog-title",children:[(0,r.jsx)(Z.Z,{id:"about-promptfoo-dialog-title",children:(0,r.jsxs)(a.Z,{children:[(0,r.jsx)(S.Z,{variant:"h6",children:"About Promptfoo"}),(0,r.jsx)(k.Z,{href:"https://github.com/promptfoo/promptfoo/releases",underline:"none",sx:{color:"inherit"},children:(0,r.jsxs)(S.Z,{variant:"subtitle2",children:["Version ","0.72.1"]})})]})}),(0,r.jsxs)(C.Z,{children:[(0,r.jsx)(S.Z,{variant:"body2",gutterBottom:!0,children:"Promptfoo is a MIT licensed open-source tool for evaluating LLMs. We make it easy to track the performance of your models and prompts over time with automated support for dataset generation and grading."}),(0,r.jsx)(a.Z,{spacing:2,mt:2,children:_.map((e,t)=>(0,r.jsxs)(a.Z,{direction:"row",spacing:1,alignItems:"center",sx:{flexWrap:"wrap","& .MuiSvgIcon-root":{color:"text.primary"}},children:[e.icon,(0,r.jsx)(k.Z,{underline:"none",target:"_blank",href:e.href,sx:{color:"inherit"},children:(0,r.jsx)(S.Z,{variant:"body2",children:e.text})})]},t))})]}),(0,r.jsx)(E.Z,{children:(0,r.jsx)(P.Z,{onClick:n,children:"Close"})})]})}var N=n(1445),w=n(31657),I=n(36273),y=n(96976);function M(){let{user:e,logout:t}=(0,N.aC)(),[n,s]=o.useState(null),i=()=>{s(null)},a=async()=>{null==t||t(),i()};return e?(0,r.jsxs)("div",{children:[(0,r.jsx)(l.Z,{edge:"end","aria-label":"account of current user","aria-controls":"menu-appbar","aria-haspopup":"true",onClick:e=>{s(e.currentTarget)},color:"inherit",children:(0,r.jsx)(w.Z,{sx:{width:"1em",height:"1em",bgcolor:"#1976d2"}})}),(0,r.jsxs)(I.Z,{id:"menu-appbar",anchorEl:n,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:!!n,onClose:i,children:[(0,r.jsxs)(y.Z,{disabled:!0,children:["Logged in as ",e.email]}),(0,r.jsx)(y.Z,{onClick:a,children:"Logout"})]})]}):(0,r.jsx)(u(),{href:"/auth/signup/",children:(0,r.jsx)(l.Z,{edge:"end","aria-label":"User not logged in","aria-controls":"menu-appbar","aria-haspopup":"true",color:"inherit",children:(0,r.jsx)(w.Z,{sx:{width:"1em",height:"1em"}})})})}var T=n(49567),A=n(47051),D=n.n(A);function L(){return(0,r.jsxs)(T.Z,{className:"logo",children:[(0,r.jsx)(D(),{width:25,height:25,src:"/logo.svg",alt:"Promptfoo logo"})," ",(0,r.jsx)("span",{children:"promptfoo"})]})}n(17328),n(5008);var R=n(77580);function B(e){let{href:t,label:n}=e,o=(0,h.usePathname)()||"";return(0,r.jsx)(u(),{href:t,className:o.startsWith(t)?"active":"",children:n})}function U(e){let{darkMode:t,onToggleDarkMode:n}=e,[c,u]=(0,o.useState)(!1),h=()=>u(e=>!e),d=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L,{}),!R.env.NEXT_PUBLIC_NO_BROWSING&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(B,{href:"/setup",label:"New Eval"}),(0,r.jsx)(B,{href:"/eval",label:"Evals"}),(0,r.jsx)(B,{href:"/prompts",label:"Prompts"}),(0,r.jsx)(B,{href:"/datasets",label:"Datasets"}),(0,r.jsx)(B,{href:"/progress",label:"Progress"})]}),(0,r.jsxs)("div",{className:"right-aligned",children:[s.Ox?(0,r.jsx)(M,{}):null,(0,r.jsx)(l.Z,{onClick:h,color:"inherit",children:(0,r.jsx)(i.Z,{})}),(0,r.jsx)(m,{darkMode:t,onToggleDarkMode:n})]})]});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(O,{open:c,onClose:h}),(0,r.jsx)(a.Z,{direction:"row",spacing:2,className:"nav",children:d})]})}var W=n(51867),z=n(61191),F=n(38127);n(70894);let G=e=>(0,W.Z)({typography:{fontFamily:"inherit"},palette:{mode:e?"dark":"light"}}),H=G(!1),V=G(!0);function X(e){let{children:t}=e;return(0,r.jsx)("div",{children:t})}function J(e){let{children:t}=e,n=(0,F.Z)("(prefers-color-scheme: dark)"),[s,i]=(0,o.useState)(null);(0,o.useEffect)(()=>{let e=localStorage.getItem("darkMode");i(null!==e?"true"===e:n)},[n]);let l=(0,o.useCallback)(()=>{i(e=>{let t=!e;return localStorage.setItem("darkMode",String(t)),t})},[]);return((0,o.useEffect)(()=>{null!==s&&(s?document.documentElement.setAttribute("data-theme","dark"):document.documentElement.removeAttribute("data-theme"))},[s]),null===s)?null:(0,r.jsx)(z.Z,{theme:s?V:H,children:(0,r.jsx)(N.Ho,{children:(0,r.jsxs)(X,{children:[(0,r.jsx)(U,{darkMode:s,onToggleDarkMode:l}),(0,r.jsx)("div",{children:t})]})})})}},52428:function(e,t,n){"use strict";n.d(t,{Ox:function(){return s},T8:function(){return o},eA:function(){return i}});var r=n(77580);let o=!r.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,s=!!r.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,i=""},1445:function(e,t,n){"use strict";n.d(t,{Ho:function(){return h},OQ:function(){return i},aC:function(){return a}});var r=n(24004),o=n(14978),s=n(12594);let i=(0,s.createClientComponentClient)(),l=(0,o.createContext)({}),a=()=>(0,o.useContext)(l),c=(e,t)=>i.auth.signInWithPassword({email:e,password:t}),u=()=>i.auth.signOut(),h=e=>{let{children:t}=e,[n,s]=(0,o.useState)(null),[a,h]=(0,o.useState)(!1),d=(0,o.useCallback)(async()=>{let{data:e,error:t}=await i.auth.refreshSession();e&&s(e.user)},[]);return(0,o.useEffect)(()=>{d();let{data:e}=i.auth.onAuthStateChange(async(e,t)=>{"PASSWORD_RECOVERY"==e?h(!1):"SIGNED_IN"===e&&t?(s(t.user),h(!0)):"SIGNED_OUT"===e&&(h(!1),s(null))});return()=>{e.subscription.unsubscribe()}},[d]),(0,r.jsx)(l.Provider,{value:{loggedIn:a,user:n,login:c,logout:u},children:t})}},32854:function(){},17328:function(){},5008:function(){},70894:function(){},5100:function(){}},function(e){e.O(0,[448,640,620,374,163,53,470,730,744],function(){return e(e.s=86611)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{48536:function(e,n,t){Promise.resolve().then(t.t.bind(t,27924,23)),Promise.resolve().then(t.t.bind(t,16662,23)),Promise.resolve().then(t.t.bind(t,30910,23)),Promise.resolve().then(t.t.bind(t,81885,23)),Promise.resolve().then(t.t.bind(t,48607,23))},81885:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e,n){for(var t in n)Object.defineProperty(e,t,{enumerable:!0,get:n[t]})}(n,{suspense:function(){return o},NoSSR:function(){return i}}),t(69278),t(14978);let r=t(66995);function o(){let e=Error(r.NEXT_DYNAMIC_NO_SSR_CODE);throw e.digest=r.NEXT_DYNAMIC_NO_SSR_CODE,e}function i(e){let{children:n}=e;return n}},48607:function(){}},function(e){e.O(0,[470,730,744],function(){return e(e.s=48536)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[92],{48931:function(e,t,i){"use strict";var a=i(71851);t.Z=void 0;var r=a(i(99570)),n=i(24004);t.Z=(0,r.default)((0,n.jsx)("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"}),"Download")},96212:function(e,t,i){"use strict";i.d(t,{f:function(){return n}});var a=i(25800),r=i(46213);function n(e){return(0,r.ZP)("MuiListItemIcon",e)}let o=(0,a.Z)("MuiListItemIcon",["root","alignItemsFlexStart"]);t.Z=o},53975:function(e,t,i){"use strict";i.d(t,{L:function(){return n}});var a=i(25800),r=i(46213);function n(e){return(0,r.ZP)("MuiListItemText",e)}let o=(0,a.Z)("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]);t.Z=o},96976:function(e,t,i){"use strict";i.d(t,{Z:function(){return M}});var a=i(94312),r=i(79042),n=i(14978),o=i(53468),s=i(3982),l=i(13477),d=i(31608),c=i(11874),u=i(87286),p=i(11112),v=i(30151),m=i(16656),h=i(41776),x=i(25800);let Z=(0,x.Z)("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);var f=i(96212),g=i(53975),C=i(46213);function I(e){return(0,C.ZP)("MuiMenuItem",e)}let j=(0,x.Z)("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]);var b=i(24004);let y=["autoFocus","component","dense","divider","disableGutters","focusVisibleClassName","role","tabIndex","className"],P=e=>{let{disabled:t,dense:i,divider:a,disableGutters:n,selected:o,classes:l}=e,d=(0,s.Z)({root:["root",i&&"dense",t&&"disabled",!n&&"gutters",a&&"divider",o&&"selected"]},I,l);return(0,r.Z)({},l,d)},w=(0,d.ZP)(v.Z,{shouldForwardProp:e=>(0,c.Z)(e)||"classes"===e,name:"MuiMenuItem",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:i}=e;return[t.root,i.dense&&t.dense,i.divider&&t.divider,!i.disableGutters&&t.gutters]}})(({theme:e,ownerState:t})=>(0,r.Z)({},e.typography.body1,{display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap"},!t.disableGutters&&{paddingLeft:16,paddingRight:16},t.divider&&{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"},{"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${j.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity),[`&.${j.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`&.${j.selected}:hover`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity)}},[`&.${j.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${j.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${Z.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${Z.inset}`]:{marginLeft:52},[`& .${g.Z.root}`]:{marginTop:0,marginBottom:0},[`& .${g.Z.inset}`]:{paddingLeft:36},[`& .${f.Z.root}`]:{minWidth:36}},!t.dense&&{[e.breakpoints.up("sm")]:{minHeight:"auto"}},t.dense&&(0,r.Z)({minHeight:32,paddingTop:4,paddingBottom:4},e.typography.body2,{[`& .${f.Z.root} svg`]:{fontSize:"1.25rem"}}))),k=n.forwardRef(function(e,t){let i;let s=(0,u.i)({props:e,name:"MuiMenuItem"}),{autoFocus:l=!1,component:d="li",dense:c=!1,divider:v=!1,disableGutters:x=!1,focusVisibleClassName:Z,role:f="menuitem",tabIndex:g,className:C}=s,I=(0,a.Z)(s,y),j=n.useContext(p.Z),k=n.useMemo(()=>({dense:c||j.dense||!1,disableGutters:x}),[j.dense,c,x]),M=n.useRef(null);(0,m.Z)(()=>{l&&M.current&&M.current.focus()},[l]);let F=(0,r.Z)({},s,{dense:k.dense,divider:v,disableGutters:x}),S=P(s),$=(0,h.Z)(M,t);return s.disabled||(i=void 0!==g?g:-1),(0,b.jsx)(p.Z.Provider,{value:k,children:(0,b.jsx)(w,(0,r.Z)({ref:$,role:f,tabIndex:i,component:d,focusVisibleClassName:(0,o.Z)(S.focusVisible,Z),className:(0,o.Z)(S.root,C)},I,{ownerState:F,classes:S}))})});var M=k},71544:function(e,t,i){"use strict";i(14978);var a=i(97491),r=i(24004);t.Z=(0,a.Z)((0,r.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close")},11340:function(e,t,i){Promise.resolve().then(i.bind(i,19259))},19259:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return I}});var a=i(24004),r=i(14978),n=i(48931),o=i(91932),s=i(49567),l=i(40982),d=i(36273),c=i(96976),u=i(30469),p=i(65068),v=i(70417),m=i(21303),h=i(26485),x=i(30021),Z=i(19708),f=i(67339),g=i(38640),C=i.n(g);function I(){let[e,t]=(0,r.useState)([]),[i,g]=(0,r.useState)(null),[I,j]=(0,r.useState)("asc"),[b,y]=(0,r.useState)(null),[P,w]=r.useState(1),[k,M]=(0,r.useState)({evalId:"",datasetId:"",provider:"",promptId:""}),F=!!b;(0,r.useEffect)(()=>{(async()=>{let e=await fetch("/api/progress"),i=await e.json();i&&i.data&&t(i.data)})()},[]);let S=e=>{let t=i===e&&"asc"===I;g(e),j(t?"desc":"asc")},$=e=>(null==e?void 0:e.testPassCount)!=null&&(null==e?void 0:e.testFailCount)!=null?(e.testPassCount/(e.testPassCount+e.testFailCount)*100).toFixed(2):"-",O=e=>{var t,i,a,r,n;let o=e.map(e=>{var o,s,l,d,c,u;return[null!==(t=e.evalId)&&void 0!==t?t:"",null!==(i=null===(o=e.datasetId)||void 0===o?void 0:o.slice(0,6))&&void 0!==i?i:"",null!==(a=e.provider)&&void 0!==a?a:"",(null!==(r=null===(s=e.promptId)||void 0===s?void 0:s.slice(0,6))&&void 0!==r?r:"")+" "+(null!==(n=e.raw)&&void 0!==n?n:""),$(e.metrics),(null===(l=e.metrics)||void 0===l?void 0:l.testPassCount)==null?"-":"".concat(e.metrics.testPassCount),(null===(d=e.metrics)||void 0===d?void 0:d.testFailCount)==null?"-":"".concat(e.metrics.testFailCount),(null===(c=e.metrics)||void 0===c?void 0:c.score)==null?"-":null===(u=e.metrics.score)||void 0===u?void 0:u.toFixed(2)]});return[["Eval","Dataset","Provider","Prompt","Pass Rate %","Pass Count","Fail Count","Raw score"]].concat(o).map(e=>e.map(e=>null!=e?e:"").join(",")).join("\n")},R=t=>{let i="json"===t?JSON.stringify(e):O(e),a=new Blob([i],{type:"text/".concat(t,";charset=utf-8;")}),r=document.createElement("a");r.href=URL.createObjectURL(a),r.download="cols_export.".concat(t),r.click(),URL.revokeObjectURL(r.href),y(null)},L=r.useMemo(()=>e.filter(e=>{var t,i,a,r;return(!k.evalId||(null===(t=e.evalId)||void 0===t?void 0:t.includes(k.evalId)))&&(!k.datasetId||(null===(i=e.datasetId)||void 0===i?void 0:i.startsWith(k.datasetId)))&&(!k.provider||(null===(a=e.provider)||void 0===a?void 0:a.includes(k.provider)))&&(!k.promptId||(null===(r=e.promptId)||void 0===r?void 0:r.startsWith(k.promptId)))}),[e,k]),D=r.useMemo(()=>L.sort((e,t)=>{if(!i)return 0;if("passRate"===i){let i=parseFloat($(e.metrics)),a=parseFloat($(t.metrics));return"asc"===I?i-a:a-i}if(i in e&&i in t){let a=e[i]||"",r=t[i]||"";return"asc"===I?a.toString().localeCompare(r.toString()):r.toString().localeCompare(a.toString())}return 0}),[L,i,I]),E=r.useMemo(()=>Array.from(new Set(e.map(e=>e.evalId))),[e]),V=r.useMemo(()=>Array.from(new Set(e.map(e=>e.datasetId))),[e]),z=r.useMemo(()=>Array.from(new Set(e.map(e=>e.provider))),[e]),N=r.useMemo(()=>Array.from(new Set(e.map(e=>e.promptId))),[e]);return(0,a.jsxs)(s.Z,{paddingX:2,children:[(0,a.jsxs)(s.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,a.jsx)("h2",{children:"Progress summary"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(l.Z,{id:"export-button","aria-controls":F?"export-menu":void 0,"aria-haspopup":"true","aria-expanded":F?"true":void 0,onClick:e=>{y(e.currentTarget)},startIcon:(0,a.jsx)(n.Z,{}),children:"Export"}),(0,a.jsxs)(d.Z,{id:"export-menu",anchorEl:b,open:F,onClose:()=>{y(null)},MenuListProps:{"aria-labelledby":"export-button"},children:[(0,a.jsx)(c.Z,{onClick:()=>R("csv"),children:"CSV"}),(0,a.jsx)(c.Z,{onClick:()=>R("json"),children:"JSON"})]})]})]}),(0,a.jsx)(s.Z,{children:"This page shows performance metrics for recent evals."}),(0,a.jsxs)(s.Z,{display:"flex",flexDirection:"row",gap:2,mt:2,children:[(0,a.jsx)(o.Z,{options:E,value:k.evalId,onChange:(e,t)=>{M({...k,evalId:t||""})},renderInput:e=>(0,a.jsx)(f.Z,{...e,label:"Eval ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,a.jsx)(o.Z,{options:V,value:k.datasetId,onChange:(e,t)=>{M({...k,datasetId:t||""})},renderInput:e=>(0,a.jsx)(f.Z,{...e,label:"Dataset ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,a.jsx)(o.Z,{options:z,value:k.provider,onChange:(e,t)=>{M({...k,provider:t||""})},renderInput:e=>(0,a.jsx)(f.Z,{...e,label:"Provider",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,a.jsx)(o.Z,{options:N,value:k.promptId,onChange:(e,t)=>{M({...k,promptId:t||""})},renderInput:e=>(0,a.jsx)(f.Z,{...e,label:"Prompt ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}})]}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(h.Z,{children:(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"evalId"===i,direction:"evalId"===i?I:"asc",onClick:()=>S("evalId"),children:"Eval"})}),(0,a.jsx)(m.Z,{children:"Dataset"}),(0,a.jsx)(m.Z,{children:"Provider"}),(0,a.jsx)(m.Z,{children:"Prompt"}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"passRate"===i,direction:"passRate"===i?I:"asc",onClick:()=>S("passRate"),children:"Pass Rate %"})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"testPassCount"===i,direction:"testPassCount"===i?I:"asc",onClick:()=>S("testPassCount"),children:"Pass Count"})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"testFailCount"===i,direction:"testFailCount"===i?I:"asc",onClick:()=>S("testFailCount"),children:"Fail Count"})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"score"===i,direction:"score"===i?I:"asc",onClick:()=>S("score"),children:"Raw score"})})]})}),(0,a.jsx)(v.Z,{children:D.slice((P-1)*25,25*P).map((e,t)=>{var i,r,n,o,s,l;return(0,a.jsxs)(x.Z,{hover:!0,onClick:()=>M({...k,evalId:e.evalId,datasetId:e.datasetId||"",promptId:e.promptId||"",provider:e.provider}),children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)(C(),{href:"/eval?evalId=".concat(e.evalId),onClick:e=>e.stopPropagation(),children:e.evalId})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(C(),{href:"/datasets?id=".concat(e.datasetId),onClick:e=>e.stopPropagation(),children:null===(i=e.datasetId)||void 0===i?void 0:i.slice(0,6)})}),(0,a.jsx)(m.Z,{children:e.provider}),(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)(C(),{href:"/prompts?id=".concat(e.promptId),onClick:e=>e.stopPropagation(),children:["[",null===(r=e.promptId)||void 0===r?void 0:r.slice(0,6),"]"]})," ",e.raw]}),(0,a.jsx)(m.Z,{children:$(e.metrics)}),(0,a.jsx)(m.Z,{children:(null===(n=e.metrics)||void 0===n?void 0:n.testPassCount)==null?"-":"".concat(e.metrics.testPassCount)}),(0,a.jsx)(m.Z,{children:(null===(o=e.metrics)||void 0===o?void 0:o.testFailCount)==null?"-":"".concat(e.metrics.testFailCount)}),(0,a.jsx)(m.Z,{children:(null===(s=e.metrics)||void 0===s?void 0:s.score)==null?"-":null===(l=e.metrics.score)||void 0===l?void 0:l.toFixed(2)})]},t)})})]}),Math.ceil(L.length/25)>1&&(0,a.jsx)(u.Z,{count:Math.ceil(D.length/25),page:P,onChange:(e,t)=>w(t),sx:{pt:2,pb:4,display:"flex",justifyContent:"center"}})]})}}},function(e){e.O(0,[448,640,620,973,304,339,378,322,932,470,730,744],function(){return e(e.s=11340)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[92],{48931:function(e,t,i){"use strict";var a=i(71851);t.Z=void 0;var r=a(i(99570)),n=i(24004);t.Z=(0,r.default)((0,n.jsx)("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"}),"Download")},96212:function(e,t,i){"use strict";i.d(t,{f:function(){return n}});var a=i(25800),r=i(46213);function n(e){return(0,r.ZP)("MuiListItemIcon",e)}let o=(0,a.Z)("MuiListItemIcon",["root","alignItemsFlexStart"]);t.Z=o},53975:function(e,t,i){"use strict";i.d(t,{L:function(){return n}});var a=i(25800),r=i(46213);function n(e){return(0,r.ZP)("MuiListItemText",e)}let o=(0,a.Z)("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]);t.Z=o},96976:function(e,t,i){"use strict";i.d(t,{Z:function(){return M}});var a=i(94312),r=i(79042),n=i(14978),o=i(53468),s=i(3982),l=i(13477),d=i(31608),c=i(11874),u=i(87286),p=i(11112),v=i(30151),m=i(16656),h=i(41776),x=i(25800);let Z=(0,x.Z)("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);var f=i(96212),g=i(53975),C=i(46213);function I(e){return(0,C.ZP)("MuiMenuItem",e)}let j=(0,x.Z)("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]);var b=i(24004);let y=["autoFocus","component","dense","divider","disableGutters","focusVisibleClassName","role","tabIndex","className"],P=e=>{let{disabled:t,dense:i,divider:a,disableGutters:n,selected:o,classes:l}=e,d=(0,s.Z)({root:["root",i&&"dense",t&&"disabled",!n&&"gutters",a&&"divider",o&&"selected"]},I,l);return(0,r.Z)({},l,d)},w=(0,d.ZP)(v.Z,{shouldForwardProp:e=>(0,c.Z)(e)||"classes"===e,name:"MuiMenuItem",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:i}=e;return[t.root,i.dense&&t.dense,i.divider&&t.divider,!i.disableGutters&&t.gutters]}})(({theme:e,ownerState:t})=>(0,r.Z)({},e.typography.body1,{display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap"},!t.disableGutters&&{paddingLeft:16,paddingRight:16},t.divider&&{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"},{"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${j.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity),[`&.${j.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`&.${j.selected}:hover`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity)}},[`&.${j.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${j.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${Z.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${Z.inset}`]:{marginLeft:52},[`& .${g.Z.root}`]:{marginTop:0,marginBottom:0},[`& .${g.Z.inset}`]:{paddingLeft:36},[`& .${f.Z.root}`]:{minWidth:36}},!t.dense&&{[e.breakpoints.up("sm")]:{minHeight:"auto"}},t.dense&&(0,r.Z)({minHeight:32,paddingTop:4,paddingBottom:4},e.typography.body2,{[`& .${f.Z.root} svg`]:{fontSize:"1.25rem"}}))),k=n.forwardRef(function(e,t){let i;let s=(0,u.i)({props:e,name:"MuiMenuItem"}),{autoFocus:l=!1,component:d="li",dense:c=!1,divider:v=!1,disableGutters:x=!1,focusVisibleClassName:Z,role:f="menuitem",tabIndex:g,className:C}=s,I=(0,a.Z)(s,y),j=n.useContext(p.Z),k=n.useMemo(()=>({dense:c||j.dense||!1,disableGutters:x}),[j.dense,c,x]),M=n.useRef(null);(0,m.Z)(()=>{l&&M.current&&M.current.focus()},[l]);let F=(0,r.Z)({},s,{dense:k.dense,divider:v,disableGutters:x}),S=P(s),$=(0,h.Z)(M,t);return s.disabled||(i=void 0!==g?g:-1),(0,b.jsx)(p.Z.Provider,{value:k,children:(0,b.jsx)(w,(0,r.Z)({ref:$,role:f,tabIndex:i,component:d,focusVisibleClassName:(0,o.Z)(S.focusVisible,Z),className:(0,o.Z)(S.root,C)},I,{ownerState:F,classes:S}))})});var M=k},71544:function(e,t,i){"use strict";i(14978);var a=i(97491),r=i(24004);t.Z=(0,a.Z)((0,r.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close")},96199:function(e,t,i){Promise.resolve().then(i.bind(i,19259))},19259:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return I}});var a=i(24004),r=i(14978),n=i(48931),o=i(91932),s=i(49567),l=i(40982),d=i(36273),c=i(96976),u=i(30469),p=i(65068),v=i(70417),m=i(21303),h=i(26485),x=i(30021),Z=i(19708),f=i(67339),g=i(38640),C=i.n(g);function I(){let[e,t]=(0,r.useState)([]),[i,g]=(0,r.useState)(null),[I,j]=(0,r.useState)("asc"),[b,y]=(0,r.useState)(null),[P,w]=r.useState(1),[k,M]=(0,r.useState)({evalId:"",datasetId:"",provider:"",promptId:""}),F=!!b;(0,r.useEffect)(()=>{(async()=>{let e=await fetch("/api/progress"),i=await e.json();i&&i.data&&t(i.data)})()},[]);let S=e=>{let t=i===e&&"asc"===I;g(e),j(t?"desc":"asc")},$=e=>(null==e?void 0:e.testPassCount)!=null&&(null==e?void 0:e.testFailCount)!=null?(e.testPassCount/(e.testPassCount+e.testFailCount)*100).toFixed(2):"-",O=e=>{var t,i,a,r,n;let o=e.map(e=>{var o,s,l,d,c,u;return[null!==(t=e.evalId)&&void 0!==t?t:"",null!==(i=null===(o=e.datasetId)||void 0===o?void 0:o.slice(0,6))&&void 0!==i?i:"",null!==(a=e.provider)&&void 0!==a?a:"",(null!==(r=null===(s=e.promptId)||void 0===s?void 0:s.slice(0,6))&&void 0!==r?r:"")+" "+(null!==(n=e.raw)&&void 0!==n?n:""),$(e.metrics),(null===(l=e.metrics)||void 0===l?void 0:l.testPassCount)==null?"-":"".concat(e.metrics.testPassCount),(null===(d=e.metrics)||void 0===d?void 0:d.testFailCount)==null?"-":"".concat(e.metrics.testFailCount),(null===(c=e.metrics)||void 0===c?void 0:c.score)==null?"-":null===(u=e.metrics.score)||void 0===u?void 0:u.toFixed(2)]});return[["Eval","Dataset","Provider","Prompt","Pass Rate %","Pass Count","Fail Count","Raw score"]].concat(o).map(e=>e.map(e=>null!=e?e:"").join(",")).join("\n")},R=t=>{let i="json"===t?JSON.stringify(e):O(e),a=new Blob([i],{type:"text/".concat(t,";charset=utf-8;")}),r=document.createElement("a");r.href=URL.createObjectURL(a),r.download="cols_export.".concat(t),r.click(),URL.revokeObjectURL(r.href),y(null)},L=r.useMemo(()=>e.filter(e=>{var t,i,a,r;return(!k.evalId||(null===(t=e.evalId)||void 0===t?void 0:t.includes(k.evalId)))&&(!k.datasetId||(null===(i=e.datasetId)||void 0===i?void 0:i.startsWith(k.datasetId)))&&(!k.provider||(null===(a=e.provider)||void 0===a?void 0:a.includes(k.provider)))&&(!k.promptId||(null===(r=e.promptId)||void 0===r?void 0:r.startsWith(k.promptId)))}),[e,k]),D=r.useMemo(()=>L.sort((e,t)=>{if(!i)return 0;if("passRate"===i){let i=parseFloat($(e.metrics)),a=parseFloat($(t.metrics));return"asc"===I?i-a:a-i}if(i in e&&i in t){let a=e[i]||"",r=t[i]||"";return"asc"===I?a.toString().localeCompare(r.toString()):r.toString().localeCompare(a.toString())}return 0}),[L,i,I]),E=r.useMemo(()=>Array.from(new Set(e.map(e=>e.evalId))),[e]),V=r.useMemo(()=>Array.from(new Set(e.map(e=>e.datasetId))),[e]),z=r.useMemo(()=>Array.from(new Set(e.map(e=>e.provider))),[e]),N=r.useMemo(()=>Array.from(new Set(e.map(e=>e.promptId))),[e]);return(0,a.jsxs)(s.Z,{paddingX:2,children:[(0,a.jsxs)(s.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,a.jsx)("h2",{children:"Progress summary"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(l.Z,{id:"export-button","aria-controls":F?"export-menu":void 0,"aria-haspopup":"true","aria-expanded":F?"true":void 0,onClick:e=>{y(e.currentTarget)},startIcon:(0,a.jsx)(n.Z,{}),children:"Export"}),(0,a.jsxs)(d.Z,{id:"export-menu",anchorEl:b,open:F,onClose:()=>{y(null)},MenuListProps:{"aria-labelledby":"export-button"},children:[(0,a.jsx)(c.Z,{onClick:()=>R("csv"),children:"CSV"}),(0,a.jsx)(c.Z,{onClick:()=>R("json"),children:"JSON"})]})]})]}),(0,a.jsx)(s.Z,{children:"This page shows performance metrics for recent evals."}),(0,a.jsxs)(s.Z,{display:"flex",flexDirection:"row",gap:2,mt:2,children:[(0,a.jsx)(o.Z,{options:E,value:k.evalId,onChange:(e,t)=>{M({...k,evalId:t||""})},renderInput:e=>(0,a.jsx)(f.Z,{...e,label:"Eval ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,a.jsx)(o.Z,{options:V,value:k.datasetId,onChange:(e,t)=>{M({...k,datasetId:t||""})},renderInput:e=>(0,a.jsx)(f.Z,{...e,label:"Dataset ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,a.jsx)(o.Z,{options:z,value:k.provider,onChange:(e,t)=>{M({...k,provider:t||""})},renderInput:e=>(0,a.jsx)(f.Z,{...e,label:"Provider",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,a.jsx)(o.Z,{options:N,value:k.promptId,onChange:(e,t)=>{M({...k,promptId:t||""})},renderInput:e=>(0,a.jsx)(f.Z,{...e,label:"Prompt ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}})]}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(h.Z,{children:(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"evalId"===i,direction:"evalId"===i?I:"asc",onClick:()=>S("evalId"),children:"Eval"})}),(0,a.jsx)(m.Z,{children:"Dataset"}),(0,a.jsx)(m.Z,{children:"Provider"}),(0,a.jsx)(m.Z,{children:"Prompt"}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"passRate"===i,direction:"passRate"===i?I:"asc",onClick:()=>S("passRate"),children:"Pass Rate %"})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"testPassCount"===i,direction:"testPassCount"===i?I:"asc",onClick:()=>S("testPassCount"),children:"Pass Count"})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"testFailCount"===i,direction:"testFailCount"===i?I:"asc",onClick:()=>S("testFailCount"),children:"Fail Count"})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"score"===i,direction:"score"===i?I:"asc",onClick:()=>S("score"),children:"Raw score"})})]})}),(0,a.jsx)(v.Z,{children:D.slice((P-1)*25,25*P).map((e,t)=>{var i,r,n,o,s,l;return(0,a.jsxs)(x.Z,{hover:!0,onClick:()=>M({...k,evalId:e.evalId,datasetId:e.datasetId||"",promptId:e.promptId||"",provider:e.provider}),children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)(C(),{href:"/eval?evalId=".concat(e.evalId),onClick:e=>e.stopPropagation(),children:e.evalId})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(C(),{href:"/datasets?id=".concat(e.datasetId),onClick:e=>e.stopPropagation(),children:null===(i=e.datasetId)||void 0===i?void 0:i.slice(0,6)})}),(0,a.jsx)(m.Z,{children:e.provider}),(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)(C(),{href:"/prompts?id=".concat(e.promptId),onClick:e=>e.stopPropagation(),children:["[",null===(r=e.promptId)||void 0===r?void 0:r.slice(0,6),"]"]})," ",e.raw]}),(0,a.jsx)(m.Z,{children:$(e.metrics)}),(0,a.jsx)(m.Z,{children:(null===(n=e.metrics)||void 0===n?void 0:n.testPassCount)==null?"-":"".concat(e.metrics.testPassCount)}),(0,a.jsx)(m.Z,{children:(null===(o=e.metrics)||void 0===o?void 0:o.testFailCount)==null?"-":"".concat(e.metrics.testFailCount)}),(0,a.jsx)(m.Z,{children:(null===(s=e.metrics)||void 0===s?void 0:s.score)==null?"-":null===(l=e.metrics.score)||void 0===l?void 0:l.toFixed(2)})]},t)})})]}),Math.ceil(L.length/25)>1&&(0,a.jsx)(u.Z,{count:Math.ceil(D.length/25),page:P,onChange:(e,t)=>w(t),sx:{pt:2,pb:4,display:"flex",justifyContent:"center"}})]})}}},function(e){e.O(0,[448,640,620,973,304,339,378,322,932,470,730,744],function(){return e(e.s=96199)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[794],{
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[794],{34070:function(e,t,i){Promise.resolve().then(i.bind(i,73730))},49532:function(e,t,i){"use strict";let n,s;async function l(){if(n||(s||(s=fetch("/api/config").then(e=>e.json()).then(e=>n=e.apiBaseUrl)),await s),void 0===n)throw Error("API base URL is undefined");return n}i.d(t,{b:function(){return l}})},73730:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return I}});var n=i(24004),s=i(14978),l=i(49532),r=i(49567),c=i(30469),d=i(65068),a=i(70417),o=i(21303),h=i(26485),u=i(30021),x=i(19708),j=i(65969),Z=i(38640),v=i.n(Z),p=i(28891),f=i(40982),m=i(29794),w=i(22701),y=i(51956),C=i(82669),g=i(613),E=i(63147),k=e=>{var t;let{openDialog:i,handleClose:s,selectedPrompt:l}=e;return(0,n.jsxs)(m.Z,{open:i,onClose:s,fullWidth:!0,maxWidth:"lg",children:[(0,n.jsxs)(C.Z,{children:["Prompt ",l.id.slice(0,6)]}),(0,n.jsxs)(y.Z,{children:[(0,n.jsx)(E.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Prompt"}),(0,n.jsx)(g.u,{readOnly:!0,value:null==l?void 0:null===(t=l.prompt)||void 0===t?void 0:t.raw,style:{width:"100%",padding:"0.75rem"},maxRows:50}),(0,n.jsx)(E.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Used in..."}),(0,n.jsxs)(d.Z,{children:[(0,n.jsx)(h.Z,{children:(0,n.jsxs)(u.Z,{children:[(0,n.jsx)(o.Z,{children:"Eval ID"}),(0,n.jsx)(o.Z,{children:"Dataset ID"}),(0,n.jsx)(o.Z,{children:"Raw score"}),(0,n.jsx)(o.Z,{children:"Pass rate"}),(0,n.jsx)(o.Z,{children:"Pass count"}),(0,n.jsx)(o.Z,{children:"Fail count"})]})}),(0,n.jsx)(a.Z,{children:null==l?void 0:l.evals.sort((e,t)=>t.id.localeCompare(e.id)).map(e=>{var t,i,s,l,r,c,d;let a=null!==(r=null===(t=e.metrics)||void 0===t?void 0:t.testPassCount)&&void 0!==r?r:0,h=null!==(c=null===(i=e.metrics)||void 0===i?void 0:i.testFailCount)&&void 0!==c?c:0,x=a+h>0?(a/(a+h)*100).toFixed(2)+"%":"-";return(0,n.jsxs)(u.Z,{children:[(0,n.jsx)(o.Z,{children:(0,n.jsx)(v(),{href:"/eval/?evalId=".concat(e.id),children:e.id})}),(0,n.jsx)(o.Z,{children:(0,n.jsx)(v(),{href:"/datasets/?id=".concat(e.datasetId),children:e.datasetId.slice(0,6)})}),(0,n.jsx)(o.Z,{children:null!==(d=null===(l=e.metrics)||void 0===l?void 0:null===(s=l.score)||void 0===s?void 0:s.toFixed(2))&&void 0!==d?d:"-"}),(0,n.jsx)(o.Z,{children:x}),(0,n.jsx)(o.Z,{children:a}),(0,n.jsx)(o.Z,{children:h})]},"eval-".concat(e.id))})})]})]}),(0,n.jsx)(w.Z,{children:(0,n.jsx)(f.Z,{onClick:s,children:"Close"})})]})};function I(){let e=(0,p.useSearchParams)(),[t,i]=(0,s.useState)([]),[Z,f]=(0,s.useState)("date"),[m,w]=(0,s.useState)("desc"),[y,C]=(0,s.useState)(1),[g,E]=(0,s.useState)(10),[I,P]=(0,s.useState)(!1),[S,D]=(0,s.useState)(0),b=e=>{let t=Z===e&&"asc"===m?"desc":"asc";f(e),w(t)};(0,s.useEffect)(()=>{(async()=>{fetch("".concat(await (0,l.b)(),"/api/prompts")).then(e=>e.json()).then(e=>{let t=[...e.data].sort((e,t)=>null===Z?0:"asc"===m?e[Z]>t[Z]?1:-1:e[Z]<t[Z]?1:-1);i(t)})})()},[Z,m]);let _=e=>{P(!0),D(e)};return(0,s.useEffect)(()=>{let i=null==e?void 0:e.get("id");if(i){let e=t.findIndex(e=>e.id.startsWith(i));-1!==e&&_(e)}},[t,e]),(0,n.jsxs)(r.Z,{paddingX:2,children:[(0,n.jsxs)(d.Z,{children:[(0,n.jsx)(h.Z,{children:(0,n.jsxs)(u.Z,{children:[(0,n.jsx)(o.Z,{style:{width:"10%"},children:"ID"}),(0,n.jsx)(o.Z,{style:{width:"60%"},children:(0,n.jsx)(x.Z,{active:"raw"===Z,direction:"raw"===Z?m:"asc",onClick:()=>b("raw"),children:"Prompt"})}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:(0,n.jsx)(j.Z,{title:"The date of the most recent eval for this prompt",children:(0,n.jsx)(x.Z,{active:"date"===Z,direction:"date"===Z?m:"asc",onClick:()=>b("date"),children:"Most recent eval"})})}),(0,n.jsx)(o.Z,{style:{width:"10%"},children:(0,n.jsx)(x.Z,{active:"count"===Z,direction:"count"===Z?m:"asc",onClick:()=>b("count"),children:"# Evals"})})]})}),(0,n.jsx)(a.Z,{children:t.slice((y-1)*g,y*g).map((e,t)=>(0,n.jsxs)(u.Z,{hover:!0,children:[(0,n.jsx)(o.Z,{style:{width:"10%"},children:e.id.slice(0,6)}),(0,n.jsx)(o.Z,{style:{width:"60%",whiteSpace:"pre-wrap",cursor:"pointer"},onClick:()=>_(t),children:e.prompt.raw.length>500?e.prompt.raw.slice(0,500)+"...":e.prompt.raw}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:e.recentEvalDate?(0,n.jsx)(v(),{href:"/eval?evalId=".concat(e.recentEvalId),children:e.recentEvalDate}):"Unknown"}),(0,n.jsx)(o.Z,{style:{width:"10%"},children:e.count})]},t))})]}),Math.ceil(t.length/g)>1&&(0,n.jsx)(c.Z,{count:Math.ceil(t.length/g),page:y,onChange:(e,t)=>C(t)}),t[S]&&(0,n.jsx)(k,{openDialog:I,handleClose:()=>{P(!1)},selectedPrompt:t[S]})]})}}},function(e){e.O(0,[448,640,973,995,374,322,470,730,744],function(){return e(e.s=34070)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[420],{25902:function(e,i,t){Promise.resolve().then(t.bind(t,37493))},49532:function(e,i,t){"use strict";let a,r;async function s(){if(a||(r||(r=fetch("/api/config").then(e=>e.json()).then(e=>a=e.apiBaseUrl)),await r),void 0===a)throw Error("API base URL is undefined");return a}t.d(i,{b:function(){return s}})},37493:function(e,i,t){"use strict";t.r(i),t.d(i,{default:function(){return G}});var a,r,s=t(24004),n=t(14978),l=t(49532),o=t(885),c=t(11520),m=t(93650),u=t(63147),h=t(80661),d=t(49578);let p={"Brand Risk":["competitors","politics","excessive-agency","hallucination","overreliance","harmful:graphic-content","harmful:indiscriminate-weapons","harmful:misinformation-disinformation","harmful:non-violent-crime","harmful:radicalization","harmful:unsafe-practices"],"Legal Risk":["harmful:child-exploitation","harmful:copyright-violations","harmful:cybercrime","harmful:illegal-activities","harmful:illegal-drugs","harmful:intellectual-property","harmful:privacy","harmful:sex-crime","harmful:sexual-content","harmful:specialized-advice","harmful:violent-crime","harmful:self-harm","contracts"],"Malicious Attacks":["harmful:harassment-bullying","harmful:hate","harmful:insults","harmful:profanity","hijacking","jailbreak","pii","prompt-injection"]},f={"Brand Risk":"Risks that can affect the brand reputation and trustworthiness.","Legal Risk":"Risks that can lead to legal consequences or violations.","Malicious Attacks":"Risks involving malicious activities targeting the system or users."};(a=r||(r={})).Critical="Critical",a.High="High",a.Medium="Medium",a.Low="Low";let g={"excessive-agency":r.Medium,"harmful:child-exploitation":r.Critical,"harmful:copyright-violations":r.Medium,"harmful:cybercrime":r.High,"harmful:graphic-content":r.Medium,"harmful:harassment-bullying":r.High,"harmful:hate":r.Critical,"harmful:illegal-activities":r.High,"harmful:illegal-drugs":r.High,"harmful:indiscriminate-weapons":r.Medium,"harmful:insults":r.Low,"harmful:intellectual-property":r.Medium,"harmful:misinformation-disinformation":r.Medium,"harmful:non-violent-crime":r.Medium,"harmful:privacy":r.High,"harmful:profanity":r.Low,"harmful:radicalization":r.High,"harmful:self-harm":r.Critical,"harmful:sex-crime":r.Critical,"harmful:sexual-content":r.High,"harmful:specialized-advice":r.High,"harmful:unsafe-practices":r.Low,"harmful:violent-crime":r.Critical,"prompt-injection":r.Medium,competitors:r.Low,contracts:r.Medium,hallucination:r.Medium,hijacking:r.High,jailbreak:r.Medium,overreliance:r.Low,pii:r.High,politics:r.Low},v=Object.entries(p).reduce((e,i)=>{let[t,a]=i;return a.forEach(i=>{e[i]=t}),e},{});Object.keys(v);let x={"excessive-agency":"ExcessiveAgency","harmful:child-exploitation":"Child Exploitation","harmful:copyright-violations":"Copyright Violations","harmful:cybercrime":"Cybercrime","harmful:graphic-content":"Graphic Content","harmful:harassment-bullying":"Harassment & Bullying","harmful:hate":"Hate","harmful:illegal-activities":"Illegal Activities","harmful:illegal-drugs":"Illegal Drugs","harmful:indiscriminate-weapons":"Indiscriminate Weapons","harmful:insults":"Insults","harmful:intellectual-property":"Intellectual Property","harmful:misinformation-disinformation":"Misinformation & Disinformation","harmful:non-violent-crime":"Non-Violent Crime","harmful:privacy":"Privacy","harmful:profanity":"Profanity","harmful:radicalization":"Radicalization","harmful:self-harm":"Self-Harm","harmful:sex-crime":"Sex Crimes","harmful:sexual-content":"Sexual Content","harmful:specialized-advice":"Specialized Advice","harmful:unsafe-practices":"Other Unsafe Practices","harmful:violent-crime":"Violent Crimes","prompt-injection":"Harmful/Injection",competitors:"CompetitorEndorsement",contracts:"ContractualCommitment",hallucination:"Hallucination",hijacking:"Hijacking",jailbreak:"Harmful/Iterative",overreliance:"Overreliance",pii:"PIILeak",politics:"PoliticalStatement"},y=Object.entries(x).reduce((e,i)=>{let[t,a]=i;return e[a]=t,e},{}),j={"excessive-agency":"Excessive Agency","prompt-injection":"Prompt Injection",competitors:"Competitor Endorsements",contracts:"Unsupervised Contracts",jailbreak:"Jailbreak",pii:"PII Leaks",politics:"Political Opinions"},b={"excessive-agency":"Model taking excessive initiative or misunderstanding its capabilities.","harmful:child-exploitation":"Content exploiting or harming children.","harmful:copyright-violations":"Content violating copyright laws.","harmful:cybercrime":"Content related to cybercriminal activities.","harmful:graphic-content":"Displaying graphic or violent content.","harmful:harassment-bullying":"Content that harasses or bullies individuals.","harmful:hate":"Content that promotes hate or discrimination.","harmful:illegal-activities":"Content promoting illegal activities.","harmful:illegal-drugs":"Content related to illegal drug use or trade.","harmful:indiscriminate-weapons":"Content related to weapons without context.","harmful:insults":"Content that insults or demeans individuals.","harmful:intellectual-property":"Content violating intellectual property rights.","harmful:misinformation-disinformation":"Spreading false or misleading information.","harmful:non-violent-crime":"Content related to non-violent criminal activities.","harmful:privacy":"Content violating privacy rights.","harmful:profanity":"Content containing profane or inappropriate language.","harmful:radicalization":"Content that promotes radical or extremist views.","harmful:self-harm":"Content that encourages self-harm or suicide.","harmful:sex-crime":"Content related to sexual crimes.","harmful:sexual-content":"Explicit or inappropriate sexual content.","harmful:specialized-advice":"Providing advice in specialized fields without expertise.","harmful:unsafe-practices":"Content promoting unsafe or harmful practices.","harmful:violent-crime":"Content related to violent criminal activities.","prompt-injection":"Malicious inputs designed to manipulate the model's behavior.",competitors:"Competitor mentions and endorsements",contracts:"Enters business or legal commitments without supervision.",hallucination:"Model generating false or misleading information.",hijacking:"Unauthorized or off-topic resource use.",jailbreak:"Bypassing security measures or restrictions.",overreliance:"Model susceptible to relying on an incorrect user assumption or input.",pii:"Exposure or misuse of personally identifiable information.",politics:"Makes political statements.","experimental-jailbreak":"Apply jailbreaks to all attack types"};t(4309);var w=e=>{let{categoryStats:i}=e,t=[r.Critical,r.High,r.Medium,r.Low],a=t.reduce((e,t)=>(e[t]=Object.keys(i).reduce((e,i)=>g[i]===t?e+1:e,0),e),{});return(0,s.jsx)(m.ZP,{container:!0,spacing:2,mb:4,children:t.map(e=>(0,s.jsx)(m.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,s.jsx)(h.Z,{className:"card-".concat(e.toLowerCase()),children:(0,s.jsxs)(d.Z,{onClick:()=>window.location.hash="#table",children:[(0,s.jsx)(u.Z,{variant:"body2",component:"div",children:e}),(0,s.jsxs)(u.Z,{variant:"h6",color:"text.primary",children:[a[e]," issues"]})]})})},e))})},Z=t(32414),C=t(63362),k=t(18845),R=t(49567),P=t(47908),A=t(85912),M=t(94941),N=t(65969),L=t(96761);t(46553);var I=e=>{let{title:i,subtitle:t,progressValue:a,numTestsPassed:r,numTestsFailed:n,testTypes:l}=e;return(0,s.jsx)(h.Z,{children:(0,s.jsx)(d.Z,{className:"risk-card-container",children:(0,s.jsxs)(m.ZP,{container:!0,spacing:3,children:[(0,s.jsxs)(m.ZP,{item:!0,xs:12,md:6,style:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center"},children:[(0,s.jsx)(u.Z,{variant:"h5",className:"risk-card-title",children:i}),(0,s.jsx)(u.Z,{variant:"subtitle1",color:"textSecondary",mb:2,children:t}),(0,s.jsx)(R.Z,{sx:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:100,height:100},children:(0,s.jsx)(L.a,{value:a,max:100,thickness:10,arc:{startAngle:-90,endAngle:90,color:"primary.main"},text:"".concat(Math.round(a),"%"),sx:{width:"100%",height:"100%"}})}),(0,s.jsxs)(u.Z,{variant:"h6",className:"risk-card-issues",children:[n," failed probes"]}),(0,s.jsxs)(u.Z,{variant:"subtitle1",color:"textSecondary",className:"risk-card-tests-passed",children:[r,"/",r+n," passed"]})]}),(0,s.jsx)(m.ZP,{item:!0,xs:6,md:4,children:(0,s.jsx)(P.Z,{dense:!0,children:l.map((e,i)=>(0,s.jsx)(N.Z,{title:b[e.name],placement:"left",arrow:!0,children:(0,s.jsxs)(A.ZP,{className:"risk-card-list-item",onClick:()=>{let i=new URLSearchParams(window.location.search),t=i.get("evalId"),a=x[e.name];window.location.href="/eval/?evalId=".concat(t,"&search=").concat(encodeURIComponent("(var=".concat(a,"|metric=").concat(a,")")))},style:{cursor:"pointer"},children:[(0,s.jsx)(M.Z,{primary:j[e.name]||x[e.name],primaryTypographyProps:{variant:"body2"}}),e.passed?(0,s.jsx)(k.Z,{className:"risk-card-icon-passed"}):(0,s.jsx)(C.Z,{className:"risk-card-icon-failed"})]})},i))})})]})})})};t(32991);var F=e=>{let{categoryStats:i}=e,t=Object.keys(p).map(e=>({name:e,passed:p[e].every(e=>{var t,a;return(null===(t=i[e])||void 0===t?void 0:t.pass)===(null===(a=i[e])||void 0===a?void 0:a.total)})}));return(0,s.jsx)(Z.Z,{spacing:4,children:t.map((e,t)=>{let a=e.name,r=p[a],n=r.reduce((e,t)=>{var a;return e+((null===(a=i[t])||void 0===a?void 0:a.pass)||0)},0),l=r.reduce((e,t)=>{var a;return e+((null===(a=i[t])||void 0===a?void 0:a.total)||0)},0);return(0,s.jsx)(I,{title:e.name,subtitle:f[a],progressValue:n/l*100,numTestsPassed:n,numTestsFailed:l-n,testTypes:r.map(e=>{var t,a;return{name:e,passed:(null===(t=i[e])||void 0===t?void 0:t.pass)===(null===(a=i[e])||void 0===a?void 0:a.total)}})},t)})})},H=t(40982),S=t(37803),z=t(65068),E=t(70417),U=t(21303),D=t(61451),O=t(26485),W=t(38592),B=t(30021),T=t(19708),V=t(28891);t(93091);let _=e=>{let i=[];for(let[t,a]of Object.entries(p))for(let t of a)i.push({pluginName:t,type:x[t]||t,description:b[t]||"",passRate:e[t]?(e[t].pass/e[t].total*100).toFixed(1)+"%":"N/A",passRateWithFilter:e[t]?(e[t].passWithFilter/e[t].total*100).toFixed(1)+"%":"N/A",severity:g[t]||"Unknown"});return i.sort((e,i)=>"N/A"===e.passRate?1:"N/A"===i.passRate?-1:parseFloat(e.passRate)-parseFloat(i.passRate))};var q=e=>{let{evalId:i,categoryStats:t}=e;(0,V.useRouter)();let a=_(t).filter(e=>"N/A"!==e.passRate),[r,l]=n.useState(0),[o,c]=n.useState(10),[m,h]=n.useState("asc"),[d,p]=n.useState("default"),f=e=>{let i=d===e&&"asc"===m;h(i?"desc":"asc"),p(e)};return(0,s.jsxs)(R.Z,{children:[(0,s.jsx)(u.Z,{variant:"h6",gutterBottom:!0,id:"table",children:"Vulnerabilities and Mitigations"}),(0,s.jsxs)(D.Z,{component:S.Z,children:[(0,s.jsxs)(z.Z,{children:[(0,s.jsx)(O.Z,{children:(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(U.Z,{children:"Type"}),(0,s.jsx)(U.Z,{children:"Description"}),(0,s.jsx)(U.Z,{children:(0,s.jsx)(T.Z,{active:"passRate"===d,direction:"passRate"===d?m:"asc",onClick:()=>f("passRate"),children:"Pass rate"})}),(0,s.jsx)(U.Z,{children:(0,s.jsx)(T.Z,{active:"severity"===d,direction:"severity"===d?m:"asc",onClick:()=>f("severity"),children:"Severity"})}),(0,s.jsx)(U.Z,{style:{minWidth:"275px"},children:"Actions"})]})}),(0,s.jsx)(E.Z,{children:a.sort((e,i)=>{if("passRate"===d)return"N/A"===e.passRate?1:"N/A"===i.passRate?-1:"asc"===m?parseFloat(e.passRate)-parseFloat(i.passRate):parseFloat(i.passRate)-parseFloat(e.passRate);if("severity"===d){if("N/A"===e.passRate)return 1;if("N/A"===i.passRate)return -1;let t={Critical:4,High:3,Medium:2,Low:1};return"asc"===m?t[e.severity]-t[i.severity]:t[i.severity]-t[e.severity]}{let t={Critical:4,High:3,Medium:2,Low:1};return e.severity===i.severity?parseFloat(e.passRate)-parseFloat(i.passRate):t[i.severity]-t[e.severity]}}).slice(r*o,r*o+o).map((e,i)=>{let t="";if("N/A"!==e.passRate){let i=parseFloat(e.passRate);t=i>=75?"pass-high":i>=50?"pass-medium":"pass-low"}return(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(U.Z,{children:(0,s.jsx)("span",{style:{fontWeight:500},children:j[e.pluginName]||e.type})}),(0,s.jsx)(U.Z,{children:e.description}),(0,s.jsxs)(U.Z,{className:t,children:[(0,s.jsx)("strong",{children:e.passRate}),e.passRateWithFilter!==e.passRate?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("br",{}),"(",e.passRateWithFilter," with mitigation)"]}):null]}),(0,s.jsx)(U.Z,{className:"vuln-".concat(e.severity.toLowerCase()),children:e.severity}),(0,s.jsxs)(U.Z,{style:{minWidth:270},children:[(0,s.jsx)(H.Z,{variant:"contained",size:"small",onClick:()=>{let i=new URLSearchParams(window.location.search),t=i.get("evalId");window.location.href="/eval/?evalId=".concat(t,"&search=").concat(encodeURIComponent("(var=".concat(e.type,"|metric=").concat(e.type,")")))},children:"View logs"}),(0,s.jsx)(N.Z,{title:"Temporarily disabled while in beta, click to contact us to enable",children:(0,s.jsx)(H.Z,{variant:"contained",size:"small",color:"inherit",style:{marginLeft:8},onClick:()=>{window.location.href="mailto:inquiries@promptfoo.dev?subject=Promptfoo%20automatic%20vulnerability%20mitigation&body=Hello%20Promptfoo%20Team,%0D%0A%0D%0AI%20am%20interested%20in%20learning%20more%20about%20the%20automatic%20vulnerability%20mitigation%20beta.%20Please%20provide%20me%20with%20more%20details.%0D%0A%0D%0A"},children:"Apply mitigation"})})]})]},i)})})]}),a.length>o&&(0,s.jsx)(W.Z,{rowsPerPageOptions:[10,25,50],component:"div",count:a.length,rowsPerPage:o,page:r,onPageChange:(e,i)=>{l(i)},onRowsPerPageChange:e=>{c(parseInt(e.target.value,10)),l(0)}})]})]})};t(67667);var G=()=>{let[e,i]=n.useState(null),[t,a]=n.useState(null);if(n.useEffect(()=>{let e=async e=>{let i=await fetch("".concat(await (0,l.b)(),"/api/results/").concat(e),{cache:"no-store"}),t=await i.json();a(t.data)},t=new URLSearchParams(window.location.search);if(!t)return;let r=t.get("evalId");r&&(i(r),e(r))},[]),!t||!e)return(0,s.jsx)("div",{children:"Loading..."});let r=t.results.table.head.prompts[0],h=t.results.table.body,d=t.results.results.reduce((e,i)=>{var t,a,r,s;let n=i.vars.harmCategory,l=(null===(a=i.gradingResult)||void 0===a?void 0:null===(t=a.componentResults)||void 0===t?void 0:t.map(e=>{var i;return null===(i=e.assertion)||void 0===i?void 0:i.metric}))||[],o=[n,...l].filter(e=>e);for(let t of o){let a=y[t];if(!a){console.log("Unknown harm category:",t);break}let n=i.success;e[a]=e[a]||{pass:0,total:0,passWithFilter:0},e[a].total++,n?(e[a].pass++,e[a].passWithFilter++):(null===(s=i.gradingResult)||void 0===s?void 0:null===(r=s.componentResults)||void 0===r?void 0:r.some(e=>{var i;let t=(null===(i=e.assertion)||void 0===i?void 0:i.type)==="moderation",a=!e.pass;return t&&a}))&&e[a].passWithFilter++}return e},{});return(0,s.jsx)(c.Z,{children:(0,s.jsxs)(m.ZP,{container:!0,direction:"column",spacing:1,pt:6,pb:8,children:[(0,s.jsxs)(m.ZP,{item:!0,className:"report-header",children:[(0,s.jsxs)(u.Z,{variant:"h4",children:[(0,s.jsx)("strong",{children:"LLM Risk Assessment"}),t.config.description&&": ".concat(t.config.description)]}),(0,s.jsx)(u.Z,{variant:"subtitle1",mb:2,children:new Date(t.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),(0,s.jsxs)(u.Z,{variant:"body1",gutterBottom:!0,className:"report-details",children:[(0,s.jsx)(o.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Model:"})," ",r.provider]})}),(0,s.jsx)(o.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Dataset:"})," ",h.length," probes"]})}),(0,s.jsx)(o.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Prompt:"}),' "',r.raw.length>20?"".concat(r.raw.substring(0,20),"..."):r.raw,'"']})})]})]}),(0,s.jsx)(m.ZP,{item:!0,children:(0,s.jsx)(w,{categoryStats:d})}),(0,s.jsx)(m.ZP,{item:!0,children:(0,s.jsx)(F,{categoryStats:d})}),(0,s.jsx)(m.ZP,{item:!0,children:(0,s.jsx)(q,{evalId:e,categoryStats:d})})]})})}},4309:function(){},67667:function(){},46553:function(){},32991:function(){},93091:function(){}},function(e){e.O(0,[448,620,973,304,995,378,180,470,730,744],function(){return e(e.s=25902)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[420],{92892:function(e,i,t){Promise.resolve().then(t.bind(t,37493))},49532:function(e,i,t){"use strict";let a,r;async function s(){if(a||(r||(r=fetch("/api/config").then(e=>e.json()).then(e=>a=e.apiBaseUrl)),await r),void 0===a)throw Error("API base URL is undefined");return a}t.d(i,{b:function(){return s}})},37493:function(e,i,t){"use strict";t.r(i),t.d(i,{default:function(){return G}});var a,r,s=t(24004),n=t(14978),l=t(49532),o=t(885),c=t(11520),m=t(93650),u=t(63147),h=t(80661),d=t(49578);let p={"Brand Risk":["competitors","politics","excessive-agency","hallucination","overreliance","harmful:graphic-content","harmful:indiscriminate-weapons","harmful:misinformation-disinformation","harmful:non-violent-crime","harmful:radicalization","harmful:unsafe-practices"],"Legal Risk":["harmful:child-exploitation","harmful:copyright-violations","harmful:cybercrime","harmful:illegal-activities","harmful:illegal-drugs","harmful:intellectual-property","harmful:privacy","harmful:sex-crime","harmful:sexual-content","harmful:specialized-advice","harmful:violent-crime","harmful:self-harm","contracts"],"Malicious Attacks":["harmful:harassment-bullying","harmful:hate","harmful:insults","harmful:profanity","hijacking","jailbreak","pii","prompt-injection"]},f={"Brand Risk":"Risks that can affect the brand reputation and trustworthiness.","Legal Risk":"Risks that can lead to legal consequences or violations.","Malicious Attacks":"Risks involving malicious activities targeting the system or users."};(a=r||(r={})).Critical="Critical",a.High="High",a.Medium="Medium",a.Low="Low";let g={"excessive-agency":r.Medium,"harmful:child-exploitation":r.Critical,"harmful:copyright-violations":r.Medium,"harmful:cybercrime":r.High,"harmful:graphic-content":r.Medium,"harmful:harassment-bullying":r.High,"harmful:hate":r.Critical,"harmful:illegal-activities":r.High,"harmful:illegal-drugs":r.High,"harmful:indiscriminate-weapons":r.Medium,"harmful:insults":r.Low,"harmful:intellectual-property":r.Medium,"harmful:misinformation-disinformation":r.Medium,"harmful:non-violent-crime":r.Medium,"harmful:privacy":r.High,"harmful:profanity":r.Low,"harmful:radicalization":r.High,"harmful:self-harm":r.Critical,"harmful:sex-crime":r.Critical,"harmful:sexual-content":r.High,"harmful:specialized-advice":r.High,"harmful:unsafe-practices":r.Low,"harmful:violent-crime":r.Critical,"prompt-injection":r.Medium,competitors:r.Low,contracts:r.Medium,hallucination:r.Medium,hijacking:r.High,jailbreak:r.Medium,overreliance:r.Low,pii:r.High,politics:r.Low},v=Object.entries(p).reduce((e,i)=>{let[t,a]=i;return a.forEach(i=>{e[i]=t}),e},{});Object.keys(v);let x={"excessive-agency":"ExcessiveAgency","harmful:child-exploitation":"Child Exploitation","harmful:copyright-violations":"Copyright Violations","harmful:cybercrime":"Cybercrime","harmful:graphic-content":"Graphic Content","harmful:harassment-bullying":"Harassment & Bullying","harmful:hate":"Hate","harmful:illegal-activities":"Illegal Activities","harmful:illegal-drugs":"Illegal Drugs","harmful:indiscriminate-weapons":"Indiscriminate Weapons","harmful:insults":"Insults","harmful:intellectual-property":"Intellectual Property","harmful:misinformation-disinformation":"Misinformation & Disinformation","harmful:non-violent-crime":"Non-Violent Crime","harmful:privacy":"Privacy","harmful:profanity":"Profanity","harmful:radicalization":"Radicalization","harmful:self-harm":"Self-Harm","harmful:sex-crime":"Sex Crimes","harmful:sexual-content":"Sexual Content","harmful:specialized-advice":"Specialized Advice","harmful:unsafe-practices":"Other Unsafe Practices","harmful:violent-crime":"Violent Crimes","prompt-injection":"Harmful/Injection",competitors:"CompetitorEndorsement",contracts:"ContractualCommitment",hallucination:"Hallucination",hijacking:"Hijacking",jailbreak:"Harmful/Iterative",overreliance:"Overreliance",pii:"PIILeak",politics:"PoliticalStatement"},y=Object.entries(x).reduce((e,i)=>{let[t,a]=i;return e[a]=t,e},{}),j={"excessive-agency":"Excessive Agency","prompt-injection":"Prompt Injection",competitors:"Competitor Endorsements",contracts:"Unsupervised Contracts",jailbreak:"Jailbreak",pii:"PII Leaks",politics:"Political Opinions"},b={"excessive-agency":"Model taking excessive initiative or misunderstanding its capabilities.","harmful:child-exploitation":"Content exploiting or harming children.","harmful:copyright-violations":"Content violating copyright laws.","harmful:cybercrime":"Content related to cybercriminal activities.","harmful:graphic-content":"Displaying graphic or violent content.","harmful:harassment-bullying":"Content that harasses or bullies individuals.","harmful:hate":"Content that promotes hate or discrimination.","harmful:illegal-activities":"Content promoting illegal activities.","harmful:illegal-drugs":"Content related to illegal drug use or trade.","harmful:indiscriminate-weapons":"Content related to weapons without context.","harmful:insults":"Content that insults or demeans individuals.","harmful:intellectual-property":"Content violating intellectual property rights.","harmful:misinformation-disinformation":"Spreading false or misleading information.","harmful:non-violent-crime":"Content related to non-violent criminal activities.","harmful:privacy":"Content violating privacy rights.","harmful:profanity":"Content containing profane or inappropriate language.","harmful:radicalization":"Content that promotes radical or extremist views.","harmful:self-harm":"Content that encourages self-harm or suicide.","harmful:sex-crime":"Content related to sexual crimes.","harmful:sexual-content":"Explicit or inappropriate sexual content.","harmful:specialized-advice":"Providing advice in specialized fields without expertise.","harmful:unsafe-practices":"Content promoting unsafe or harmful practices.","harmful:violent-crime":"Content related to violent criminal activities.","prompt-injection":"Malicious inputs designed to manipulate the model's behavior.",competitors:"Competitor mentions and endorsements",contracts:"Enters business or legal commitments without supervision.",hallucination:"Model generating false or misleading information.",hijacking:"Unauthorized or off-topic resource use.",jailbreak:"Bypassing security measures or restrictions.",overreliance:"Model susceptible to relying on an incorrect user assumption or input.",pii:"Exposure or misuse of personally identifiable information.",politics:"Makes political statements.","experimental-jailbreak":"Apply jailbreaks to all attack types"};t(4309);var w=e=>{let{categoryStats:i}=e,t=[r.Critical,r.High,r.Medium,r.Low],a=t.reduce((e,t)=>(e[t]=Object.keys(i).reduce((e,i)=>g[i]===t?e+1:e,0),e),{});return(0,s.jsx)(m.ZP,{container:!0,spacing:2,mb:4,children:t.map(e=>(0,s.jsx)(m.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,s.jsx)(h.Z,{className:"card-".concat(e.toLowerCase()),children:(0,s.jsxs)(d.Z,{onClick:()=>window.location.hash="#table",children:[(0,s.jsx)(u.Z,{variant:"body2",component:"div",children:e}),(0,s.jsxs)(u.Z,{variant:"h6",color:"text.primary",children:[a[e]," issues"]})]})})},e))})},Z=t(32414),C=t(63362),k=t(18845),R=t(49567),P=t(47908),A=t(85912),M=t(94941),N=t(65969),L=t(96761);t(46553);var I=e=>{let{title:i,subtitle:t,progressValue:a,numTestsPassed:r,numTestsFailed:n,testTypes:l}=e;return(0,s.jsx)(h.Z,{children:(0,s.jsx)(d.Z,{className:"risk-card-container",children:(0,s.jsxs)(m.ZP,{container:!0,spacing:3,children:[(0,s.jsxs)(m.ZP,{item:!0,xs:12,md:6,style:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center"},children:[(0,s.jsx)(u.Z,{variant:"h5",className:"risk-card-title",children:i}),(0,s.jsx)(u.Z,{variant:"subtitle1",color:"textSecondary",mb:2,children:t}),(0,s.jsx)(R.Z,{sx:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:100,height:100},children:(0,s.jsx)(L.a,{value:a,max:100,thickness:10,arc:{startAngle:-90,endAngle:90,color:"primary.main"},text:"".concat(Math.round(a),"%"),sx:{width:"100%",height:"100%"}})}),(0,s.jsxs)(u.Z,{variant:"h6",className:"risk-card-issues",children:[n," failed probes"]}),(0,s.jsxs)(u.Z,{variant:"subtitle1",color:"textSecondary",className:"risk-card-tests-passed",children:[r,"/",r+n," passed"]})]}),(0,s.jsx)(m.ZP,{item:!0,xs:6,md:4,children:(0,s.jsx)(P.Z,{dense:!0,children:l.map((e,i)=>(0,s.jsx)(N.Z,{title:b[e.name],placement:"left",arrow:!0,children:(0,s.jsxs)(A.ZP,{className:"risk-card-list-item",onClick:()=>{let i=new URLSearchParams(window.location.search),t=i.get("evalId"),a=x[e.name];window.location.href="/eval/?evalId=".concat(t,"&search=").concat(encodeURIComponent("(var=".concat(a,"|metric=").concat(a,")")))},style:{cursor:"pointer"},children:[(0,s.jsx)(M.Z,{primary:j[e.name]||x[e.name],primaryTypographyProps:{variant:"body2"}}),e.passed?(0,s.jsx)(k.Z,{className:"risk-card-icon-passed"}):(0,s.jsx)(C.Z,{className:"risk-card-icon-failed"})]})},i))})})]})})})};t(32991);var F=e=>{let{categoryStats:i}=e,t=Object.keys(p).map(e=>({name:e,passed:p[e].every(e=>{var t,a;return(null===(t=i[e])||void 0===t?void 0:t.pass)===(null===(a=i[e])||void 0===a?void 0:a.total)})}));return(0,s.jsx)(Z.Z,{spacing:4,children:t.map((e,t)=>{let a=e.name,r=p[a],n=r.reduce((e,t)=>{var a;return e+((null===(a=i[t])||void 0===a?void 0:a.pass)||0)},0),l=r.reduce((e,t)=>{var a;return e+((null===(a=i[t])||void 0===a?void 0:a.total)||0)},0);return(0,s.jsx)(I,{title:e.name,subtitle:f[a],progressValue:n/l*100,numTestsPassed:n,numTestsFailed:l-n,testTypes:r.map(e=>{var t,a;return{name:e,passed:(null===(t=i[e])||void 0===t?void 0:t.pass)===(null===(a=i[e])||void 0===a?void 0:a.total)}})},t)})})},H=t(40982),S=t(37803),z=t(65068),E=t(70417),U=t(21303),D=t(61451),O=t(26485),W=t(38592),B=t(30021),T=t(19708),V=t(28891);t(93091);let _=e=>{let i=[];for(let[t,a]of Object.entries(p))for(let t of a)i.push({pluginName:t,type:x[t]||t,description:b[t]||"",passRate:e[t]?(e[t].pass/e[t].total*100).toFixed(1)+"%":"N/A",passRateWithFilter:e[t]?(e[t].passWithFilter/e[t].total*100).toFixed(1)+"%":"N/A",severity:g[t]||"Unknown"});return i.sort((e,i)=>"N/A"===e.passRate?1:"N/A"===i.passRate?-1:parseFloat(e.passRate)-parseFloat(i.passRate))};var q=e=>{let{evalId:i,categoryStats:t}=e;(0,V.useRouter)();let a=_(t).filter(e=>"N/A"!==e.passRate),[r,l]=n.useState(0),[o,c]=n.useState(10),[m,h]=n.useState("asc"),[d,p]=n.useState("default"),f=e=>{let i=d===e&&"asc"===m;h(i?"desc":"asc"),p(e)};return(0,s.jsxs)(R.Z,{children:[(0,s.jsx)(u.Z,{variant:"h6",gutterBottom:!0,id:"table",children:"Vulnerabilities and Mitigations"}),(0,s.jsxs)(D.Z,{component:S.Z,children:[(0,s.jsxs)(z.Z,{children:[(0,s.jsx)(O.Z,{children:(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(U.Z,{children:"Type"}),(0,s.jsx)(U.Z,{children:"Description"}),(0,s.jsx)(U.Z,{children:(0,s.jsx)(T.Z,{active:"passRate"===d,direction:"passRate"===d?m:"asc",onClick:()=>f("passRate"),children:"Pass rate"})}),(0,s.jsx)(U.Z,{children:(0,s.jsx)(T.Z,{active:"severity"===d,direction:"severity"===d?m:"asc",onClick:()=>f("severity"),children:"Severity"})}),(0,s.jsx)(U.Z,{style:{minWidth:"275px"},children:"Actions"})]})}),(0,s.jsx)(E.Z,{children:a.sort((e,i)=>{if("passRate"===d)return"N/A"===e.passRate?1:"N/A"===i.passRate?-1:"asc"===m?parseFloat(e.passRate)-parseFloat(i.passRate):parseFloat(i.passRate)-parseFloat(e.passRate);if("severity"===d){if("N/A"===e.passRate)return 1;if("N/A"===i.passRate)return -1;let t={Critical:4,High:3,Medium:2,Low:1};return"asc"===m?t[e.severity]-t[i.severity]:t[i.severity]-t[e.severity]}{let t={Critical:4,High:3,Medium:2,Low:1};return e.severity===i.severity?parseFloat(e.passRate)-parseFloat(i.passRate):t[i.severity]-t[e.severity]}}).slice(r*o,r*o+o).map((e,i)=>{let t="";if("N/A"!==e.passRate){let i=parseFloat(e.passRate);t=i>=75?"pass-high":i>=50?"pass-medium":"pass-low"}return(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(U.Z,{children:(0,s.jsx)("span",{style:{fontWeight:500},children:j[e.pluginName]||e.type})}),(0,s.jsx)(U.Z,{children:e.description}),(0,s.jsxs)(U.Z,{className:t,children:[(0,s.jsx)("strong",{children:e.passRate}),e.passRateWithFilter!==e.passRate?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("br",{}),"(",e.passRateWithFilter," with mitigation)"]}):null]}),(0,s.jsx)(U.Z,{className:"vuln-".concat(e.severity.toLowerCase()),children:e.severity}),(0,s.jsxs)(U.Z,{style:{minWidth:270},children:[(0,s.jsx)(H.Z,{variant:"contained",size:"small",onClick:()=>{let i=new URLSearchParams(window.location.search),t=i.get("evalId");window.location.href="/eval/?evalId=".concat(t,"&search=").concat(encodeURIComponent("(var=".concat(e.type,"|metric=").concat(e.type,")")))},children:"View logs"}),(0,s.jsx)(N.Z,{title:"Temporarily disabled while in beta, click to contact us to enable",children:(0,s.jsx)(H.Z,{variant:"contained",size:"small",color:"inherit",style:{marginLeft:8},onClick:()=>{window.location.href="mailto:inquiries@promptfoo.dev?subject=Promptfoo%20automatic%20vulnerability%20mitigation&body=Hello%20Promptfoo%20Team,%0D%0A%0D%0AI%20am%20interested%20in%20learning%20more%20about%20the%20automatic%20vulnerability%20mitigation%20beta.%20Please%20provide%20me%20with%20more%20details.%0D%0A%0D%0A"},children:"Apply mitigation"})})]})]},i)})})]}),a.length>o&&(0,s.jsx)(W.Z,{rowsPerPageOptions:[10,25,50],component:"div",count:a.length,rowsPerPage:o,page:r,onPageChange:(e,i)=>{l(i)},onRowsPerPageChange:e=>{c(parseInt(e.target.value,10)),l(0)}})]})]})};t(67667);var G=()=>{let[e,i]=n.useState(null),[t,a]=n.useState(null);if(n.useEffect(()=>{let e=async e=>{let i=await fetch("".concat(await (0,l.b)(),"/api/results/").concat(e),{cache:"no-store"}),t=await i.json();a(t.data)},t=new URLSearchParams(window.location.search);if(!t)return;let r=t.get("evalId");r&&(i(r),e(r))},[]),!t||!e)return(0,s.jsx)("div",{children:"Loading..."});let r=t.results.table.head.prompts[0],h=t.results.table.body,d=t.results.results.reduce((e,i)=>{var t,a,r,s;let n=i.vars.harmCategory,l=(null===(a=i.gradingResult)||void 0===a?void 0:null===(t=a.componentResults)||void 0===t?void 0:t.map(e=>{var i;return null===(i=e.assertion)||void 0===i?void 0:i.metric}))||[],o=[n,...l].filter(e=>e);for(let t of o){let a=y[t];if(!a){console.log("Unknown harm category:",t);break}let n=i.success;e[a]=e[a]||{pass:0,total:0,passWithFilter:0},e[a].total++,n?(e[a].pass++,e[a].passWithFilter++):(null===(s=i.gradingResult)||void 0===s?void 0:null===(r=s.componentResults)||void 0===r?void 0:r.some(e=>{var i;let t=(null===(i=e.assertion)||void 0===i?void 0:i.type)==="moderation",a=!e.pass;return t&&a}))&&e[a].passWithFilter++}return e},{});return(0,s.jsx)(c.Z,{children:(0,s.jsxs)(m.ZP,{container:!0,direction:"column",spacing:1,pt:6,pb:8,children:[(0,s.jsxs)(m.ZP,{item:!0,className:"report-header",children:[(0,s.jsxs)(u.Z,{variant:"h4",children:[(0,s.jsx)("strong",{children:"LLM Risk Assessment"}),t.config.description&&": ".concat(t.config.description)]}),(0,s.jsx)(u.Z,{variant:"subtitle1",mb:2,children:new Date(t.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),(0,s.jsxs)(u.Z,{variant:"body1",gutterBottom:!0,className:"report-details",children:[(0,s.jsx)(o.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Model:"})," ",r.provider]})}),(0,s.jsx)(o.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Dataset:"})," ",h.length," probes"]})}),(0,s.jsx)(o.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Prompt:"}),' "',r.raw.length>20?"".concat(r.raw.substring(0,20),"..."):r.raw,'"']})})]})]}),(0,s.jsx)(m.ZP,{item:!0,children:(0,s.jsx)(w,{categoryStats:d})}),(0,s.jsx)(m.ZP,{item:!0,children:(0,s.jsx)(F,{categoryStats:d})}),(0,s.jsx)(m.ZP,{item:!0,children:(0,s.jsx)(q,{evalId:e,categoryStats:d})})]})})}},4309:function(){},67667:function(){},46553:function(){},32991:function(){},93091:function(){}},function(e){e.O(0,[448,620,973,304,995,378,180,470,730,744],function(){return e(e.s=92892)}),_N_E=e.O()}]);
|