PageSourceSearch

https://daply.ai/assets/TracesDetails-8pbQqfpC.js

js daply.ai collected 2026-10-05 14:57:25 UTC 7,116 bytes, 1 lines download raw bytes

1import{j as e}from"./ui-components-CrH3hhmI.js";import{r as d,f as b,d as p}from"./react-core-Df-1f7lZ.js";import{a as u}from"./aiPrompthubServices-D8j6ouu6.js";import{C as f,as as j,ae as N,n as k,d as g,V as v,bq as w}from"./index-baCrhAE7.js";import{G as C}from"./GeneralLoading-DjFzzdXY.js";import"./utils-BZSOOpUI.js";import"./editor-wwdhYSyT.js";import"./charts-DACaTPEh.js";const y=({content:t,label:s})=>{const[c,n]=d.useState(!1),r=a=>{if(!a)return"";try{return typeof a=="object"?JSON.stringify(a,null,2):typeof a=="string"&&(a.startsWith("{")||a.startsWith("["))?JSON.stringify(JSON.parse(a),null,2):a}catch{return a}},o=async()=>{const a=r(t);try{await navigator.clipboard.writeText(a),n(!0),setTimeout(()=>n(!1),2e3)}catch(l){console.error("Failed to copy text:",l)}};return e.jsxs(f,{className:"bg-gray-900 dark:bg-gray-800 p-4 mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[s&&e.jsx("div",{className:"text-sm font-medium text-gray-400",children:s}),e.jsx("button",{onClick:o,className:"flex items-center px-2 py-1 text-xs font-medium text-gray-400 hover:text-gray-200 bg-gray-800 dark:bg-gray-700 rounded-md transition-colors duration-200 ease-in-out hover:bg-gray-700 dark:hover:bg-gray-600","aria-label":"Copy to clipboard",children:c?e.jsxs(e.Fragment,{children:[e.jsx(j,{className:"w-4 h-4 mr-1"}),e.jsx("span",{children:"Copied!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"w-4 h-4 mr-1"}),e.jsx("span",{children:"Copy"})]})})]}),e.jsx("div",{className:"relative",children:e.jsxs("div",{className:"overflow-hidden rounded-lg bg-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsx("pre",{className:"max-h-96 p-4",children:e.jsx("code",{className:"text-sm font-mono text-gray-200 whitespace-pre-wrap break-words",children:r(t)})})}),e.jsx("div",{className:"absolute bottom-0 right-0 p-2 bg-gradient-to-l from-gray-800 dark:from-gray-900 to-transparent w-16 pointer-events-none"})]})})]})},M=()=>{const{id:t}=b(),[s,c]=d.useState(null),[n,r]=d.useState(!0),[o,a]=d.useState(null),{selected:l}=k(),m=p();return d.useEffect(()=>{if(!t){a("Invalid trace ID"),r(!1);return}const i=new AbortController;return(async()=>{r(!0),a(null);try{const x=await u(t,l?.database?.encrypted||"",{signal:i.signal});c(x)}catch(x){if(i.signal.aborted)return;a(x.message||"Failed to fetch trace details")}finally{r(!1)}})(),()=>i.abort()},[t,l?.database?.encrypted]),n?e.jsx(C,{type:"spinner",size:"sm",message:"Fetching Trace"}):o?e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[70vh] gap-3",children:[e.jsx("div",{className:"bg-red-50 dark:bg-red-900/30 text-red-600 dark:text-red-400 p-4 rounded-lg",children:o}),e.jsxs("button",{onClick:()=>m("/prompthub?tab=traces"),className:"inline-flex items-center p-4 text-sm font-medium border text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(g,{className:"w-4 h-4 mr-2"}),"Back to Traces"]})]}):s?e.jsx("div",{className:"min-h-screen py-6 px-4 lg:px-20 mb-10",children:e.jsxs("div",{className:" mx-auto space-y-6",children:[e.jsx("header",{className:"flex items-center justify-between",children:e.jsxs("button",{onClick:()=>m("/prompthub?tab=traces"),className:"inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(g,{className:"w-4 h-4 mr-2"}),"Back to Traces"]})}),e.jsxs("main",{className:"bg-white dark:bg-primeColor  rounded-xl shadow-sm border",children:[e.jsxs("div",{className:"bg-gradient-to-r from-primeColor to-gray-800 p-6 rounded-t-xl",children:[e.jsx("h1",{className:"text-2xl font-bold text-white mb-2 break-words",children:s?.trace_name}),e.jsxs("div",{className:"flex items-center text-white/80",children:[e.jsx(v,{className:"w-4 h-4 mr-2"}),new Date(s?.createdAt).toLocaleString()]})]}),e.jsxs("div",{className:"p-6 grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("section",{className:"space-y-6",children:[e.jsxs("div",{className:"dark:bg-gray-900/50 bg-gray-50 rounded-lg p-6",children:[e.jsxs("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[e.jsx(w,{className:"w-5 h-5 mr-2 text-blue-500"}),"Model: ",s?.model]}),e.jsx("div",{className:"space-y-4",children:e.jsx(y,{content:s?.completion,label:"Response"})})]}),e.jsxs("div",{className:"dark:bg-gray-900/50 bg-gray-50 rounded-lg p-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:"Token Statistics"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Total Tokens"}),e.jsx("h5",{className:"mt-1 text-2xl font-semibold text-gray-900 dark:text-gray-100",children:s?.total_tokens})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Completion Tokens"}),e.jsx("h5",{className:"mt-1 text-2xl font-semibold text-gray-900 dark:text-gray-100",children:s?.completion_tokens})]})]})]})]}),e.jsxs("section",{className:"space-y-6",children:[e.jsxs("div",{className:"dark:bg-gray-900/50 bg-gray-50 rounded-lg p-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:"Messages"}),e.jsx(y,{content:s?.messages,label:"Conversation"})]}),e.jsxs("div",{className:"dark:bg-gray-900/50 bg-gray-50 rounded-lg p-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:"Additional Details"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Tags"}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:s?.tags?.length>0?s.tags.map((i,h)=>e.jsx("span",{className:"px-3 py-1 rounded-full text-sm font-medium bg-blue-100 dar
1k:bg-blue-900 text-blue-800 dark:text-blue-200",children:i},h)):e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"No tags"})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Total Cost"}),e.jsxs("h5",{className:"mt-1 text-gray-900 dark:text-gray-100",children:["$",s?.total_cost?.toFixed(5)]})]})]})]})]})]})]})]})}):e.jsxs("div",{className:"flex items-center justify-center min-h-[70vh] ",children:[e.jsxs("button",{onClick:()=>m("/prompthub?tab=traces"),className:"inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(g,{className:"w-4 h-4 mr-2"}),"Back to Traces"]}),e.jsx("div",{className:"text-gray-600 dark:text-gray-400 p-4",children:"No trace data found."})]})};export{M as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.