@roastcodes/ttdash 6.1.7 → 6.1.8
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/README.md +10 -0
- package/dist/assets/{CustomTooltip-C5T965-0.js → CustomTooltip-BxopDd3O.js} +1 -1
- package/dist/assets/{DrillDownModal-Bpfm-16D.js → DrillDownModal-B7ZU15xQ.js} +1 -1
- package/dist/assets/{index-CPGYeLc_.js → index-DDw3UUhU.js} +3 -3
- package/dist/index.html +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{_ as t,b as n,g as r,i,v as a,w as o}from"./charts-vendor-CiBqdKXh.js";import{r as s}from"./motion-vendor-BXI2L__C.js";import{a as c,i as l,l as u,n as d,r as f,t as p}from"./dialog-Cn1m7WhC.js";import{T as m,b as h,f as g,i as _,n as v,o as y,p as b,t as x,x as S,y as C}from"./CustomTooltip-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{_ as t,b as n,g as r,i,v as a,w as o}from"./charts-vendor-CiBqdKXh.js";import{r as s}from"./motion-vendor-BXI2L__C.js";import{a as c,i as l,l as u,n as d,r as f,t as p}from"./dialog-Cn1m7WhC.js";import{T as m,b as h,f as g,i as _,n as v,o as y,p as b,t as x,x as S,y as C}from"./CustomTooltip-BxopDd3O.js";var w=e(o()),T=s();function E({day:e,contextData:o=[],open:s,onClose:E}){let D=(0,w.useMemo)(()=>{if(!e)return[];let t=new Map;for(let n of e.modelBreakdowns){let e=m(n.modelName),r=t.get(e)??{cost:0,tokens:0,input:0,output:0,cacheRead:0,cacheCreate:0,thinking:0,requests:0};r.cost+=n.cost,r.tokens+=n.inputTokens+n.outputTokens+n.cacheCreationTokens+n.cacheReadTokens+n.thinkingTokens,r.input+=n.inputTokens,r.output+=n.outputTokens,r.cacheRead+=n.cacheReadTokens,r.cacheCreate+=n.cacheCreationTokens,r.thinking+=n.thinkingTokens,r.requests+=n.requestCount,t.set(e,r)}return Array.from(t.entries()).map(([e,t])=>({name:e,...t})).sort((e,t)=>t.cost-e.cost)},[e]);if(!e)return null;let O=e.cacheReadTokens+e.cacheCreationTokens+e.inputTokens+e.outputTokens+e.thinkingTokens,k=O>0,A=k?e.cacheReadTokens/O*100:0,j=D.map(e=>({name:e.name,value:e.cost})),M=e.requestCount>0?O/e.requestCount:0,N=e.requestCount>0?e.totalCost/e.requestCount:0,P=k?e.totalCost/(O/1e6):null,F=[...o].sort((e,t)=>t.totalCost-e.totalCost).findIndex(t=>t.date===e.date)+1,I=[...o].sort((e,t)=>t.requestCount-e.requestCount).findIndex(t=>t.date===e.date)+1,L=[...o].filter(t=>t.date<e.date).sort((e,t)=>e.date.localeCompare(t.date)).slice(-7),R=L.length>0?L.reduce((e,t)=>e+t.totalCost,0)/L.length:null,z=L.length>0?L.reduce((e,t)=>e+t.requestCount,0)/L.length:null,B=D.reduce((e,t)=>!e||t.requests>e.requests?t:e,null),V=e=>k?g(e/O*100):`–`;return(0,T.jsx)(p,{open:s,onOpenChange:e=>!e&&E(),children:(0,T.jsxs)(d,{className:`max-w-2xl`,children:[(0,T.jsxs)(l,{children:[(0,T.jsxs)(c,{children:[y(e.date,`long`),` — `,_(e.totalCost)]}),(0,T.jsx)(f,{children:`Detaillierte Tagesansicht mit Token-Verteilung, Modellanteilen, Requests und Thinking Tokens.`})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 text-center`,children:[(0,T.jsxs)(`div`,{className:`p-2 rounded-lg bg-muted/30`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Tokens`}),(0,T.jsx)(`div`,{className:`font-mono font-medium`,children:(0,T.jsx)(v,{value:O,type:`tokens`})})]}),(0,T.jsxs)(`div`,{className:`p-2 rounded-lg bg-muted/30`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`$/1M`}),(0,T.jsx)(`div`,{className:`font-mono font-medium`,children:P===null?`–`:(0,T.jsx)(v,{value:P,type:`currency`})})]}),(0,T.jsxs)(`div`,{className:`p-2 rounded-lg bg-muted/30`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Cache-Rate`}),(0,T.jsx)(`div`,{className:`font-mono font-medium`,children:(0,T.jsx)(v,{value:A,type:`percent`})})]}),(0,T.jsxs)(`div`,{className:`p-2 rounded-lg bg-muted/30`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Modelle`}),(0,T.jsx)(`div`,{className:`font-mono font-medium`,children:D.length})]}),(0,T.jsxs)(`div`,{className:`p-2 rounded-lg bg-muted/30`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Requests`}),(0,T.jsx)(`div`,{className:`font-mono font-medium`,children:(0,T.jsx)(v,{value:e.requestCount,type:`number`})})]}),(0,T.jsxs)(`div`,{className:`p-2 rounded-lg bg-muted/30`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Thinking`}),(0,T.jsx)(`div`,{className:`font-mono font-medium`,children:(0,T.jsx)(v,{value:e.thinkingTokens,type:`tokens`})})]}),(0,T.jsxs)(`div`,{className:`p-2 rounded-lg bg-muted/30`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Tokens / Req`}),(0,T.jsx)(`div`,{className:`font-mono font-medium`,children:(0,T.jsx)(v,{value:M,type:`tokens`})})]}),(0,T.jsxs)(`div`,{className:`p-2 rounded-lg bg-muted/30`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Kosten / Req`}),(0,T.jsx)(`div`,{className:`font-mono font-medium`,children:(0,T.jsx)(v,{value:N,type:`currency`})})]}),(0,T.jsxs)(`div`,{className:`p-2 rounded-lg bg-muted/30`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Kosten-Rang`}),(0,T.jsx)(`div`,{className:`font-mono font-medium`,children:F>0?`#${F}`:`–`})]}),(0,T.jsxs)(`div`,{className:`p-2 rounded-lg bg-muted/30`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Request-Rang`}),(0,T.jsx)(`div`,{className:`font-mono font-medium`,children:I>0?`#${I}`:`–`})]})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-3 text-xs`,children:[(0,T.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/20 px-3 py-2`,children:[(0,T.jsx)(`div`,{className:`text-muted-foreground`,children:`Dominant nach Requests`}),(0,T.jsx)(`div`,{className:`mt-1 font-medium`,children:B?.name??`–`})]}),(0,T.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/20 px-3 py-2`,children:[(0,T.jsx)(`div`,{className:`text-muted-foreground`,children:`Kosten vs. 7T-Ø`}),(0,T.jsx)(`div`,{className:`mt-1 font-medium`,children:R===null?`–`:`${e.totalCost>=R?`↑`:`↓`} ${_(Math.abs(e.totalCost-R))}`})]}),(0,T.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/20 px-3 py-2`,children:[(0,T.jsx)(`div`,{className:`text-muted-foreground`,children:`Requests vs. 7T-Ø`}),(0,T.jsx)(`div`,{className:`mt-1 font-medium`,children:z===null?`–`:`${e.requestCount>=z?`↑`:`↓`} ${Math.abs(e.requestCount-z).toFixed(0)}`})]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1.5`,children:`Token-Verteilung`}),(0,T.jsx)(`div`,{className:`flex h-3 rounded-full overflow-hidden`,children:k&&[{value:e.cacheReadTokens,color:`hsl(160, 50%, 42%)`,label:`Cache Read`},{value:e.cacheCreationTokens,color:`hsl(262, 60%, 55%)`,label:`Cache Write`},{value:e.inputTokens,color:`hsl(340, 55%, 52%)`,label:`Input`},{value:e.outputTokens,color:`hsl(35, 80%, 52%)`,label:`Output`},{value:e.thinkingTokens,color:`hsl(12, 78%, 56%)`,label:`Thinking`}].map(e=>(0,T.jsx)(`div`,{className:`h-full transition-all duration-500`,style:{width:`${e.value/O*100}%`,backgroundColor:e.color},title:`${e.label}: ${b(e.value)} (${(e.value/O*100).toFixed(1)}%)`},e.label))}),(0,T.jsxs)(`div`,{className:`flex gap-3 mt-1.5 text-[10px] text-muted-foreground`,children:[(0,T.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,T.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{backgroundColor:`hsl(160, 50%, 42%)`}}),`Cache Read `,V(e.cacheReadTokens)]}),(0,T.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,T.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{backgroundColor:`hsl(262, 60%, 55%)`}}),`Cache Write `,V(e.cacheCreationTokens)]}),(0,T.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,T.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{backgroundColor:`hsl(340, 55%, 52%)`}}),`Input `,V(e.inputTokens)]}),(0,T.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,T.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{backgroundColor:`hsl(35, 80%, 52%)`}}),`Output `,V(e.outputTokens)]}),(0,T.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,T.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{backgroundColor:`hsl(12, 78%, 56%)`}}),`Thinking `,V(e.thinkingTokens)]})]})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,T.jsx)(`div`,{children:(0,T.jsx)(n,{width:`100%`,height:180,children:(0,T.jsxs)(i,{children:[(0,T.jsx)(r,{data:j,cx:`50%`,cy:`50%`,innerRadius:40,outerRadius:70,paddingAngle:2,dataKey:`value`,children:j.map(e=>(0,T.jsx)(t,{fill:C(e.name)},e.name))}),(0,T.jsx)(a,{content:(0,T.jsx)(x,{formatter:e=>_(e)})})]})})}),(0,T.jsx)(`div`,{className:`space-y-2`,children:D.map(t=>{let n=e.totalCost>0?t.cost/e.totalCost*100:0;return(0,T.jsxs)(`div`,{className:`flex items-center justify-between text-sm p-1.5 rounded hover:bg-muted/30`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,T.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full`,style:{backgroundColor:C(t.name)}}),(0,T.jsx)(`span`,{children:t.name}),(0,T.jsx)(`span`,{className:u(`inline-flex items-center rounded-full border px-1.5 py-0.5 text-[10px] font-medium leading-none`,S(h(t.name))),children:h(t.name)}),(0,T.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:g(n)})]}),(0,T.jsxs)(`div`,{className:`text-right font-mono`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`font-medium`,children:(0,T.jsx)(v,{value:t.cost,type:`currency`})}),(0,T.jsx)(`span`,{className:`text-muted-foreground ml-2 text-xs`,children:(0,T.jsx)(v,{value:t.tokens,type:`tokens`})}),(0,T.jsxs)(`span`,{className:`text-muted-foreground ml-2 text-xs`,children:[t.requests,` Req`]})]}),(0,T.jsx)(`div`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:t.requests>0?`${_(t.cost/t.requests)}/Req · ${b(t.tokens/t.requests)}/Req`:`Keine Requests`})]})]},t.name)})})]})]})})}export{E as DrillDownModal};
|