feat(analytics): add Requests mode and provider/model breakdown charts
This commit is contained in:
1 parent
3279d31024
commit
0d50fe3610
5 files changed
+279
-42
No files matched your search
@@ -18,6 +18,8 @@ import dynamic from "next/dynamic";
|
||||
// Lazy-load: keeps @xyflow/react out of the shared bundle until topology renders
|
||||
const ProviderTopology = dynamic(() => import("@/app/(dashboard)/dashboard/usage/components/ProviderTopology"), { ssr: false });
|
||||
import UsageChart from "@/app/(dashboard)/dashboard/usage/components/UsageChart";
|
||||
import ProviderBarChart from "@/app/(dashboard)/dashboard/usage/components/ProviderBarChart";
|
||||
import TopModelsChart from "@/app/(dashboard)/dashboard/usage/components/TopModelsChart";
|
||||
|
||||
function timeAgo(timestamp) {
|
||||
const diff = Math.floor((Date.now() - new Date(timestamp)) / 1000);
|
||||
@@ -483,6 +485,14 @@ export default function UsageStats({ period: periodProp, setPeriod: setPeriodPro
|
||||
{/* Token / Cost chart - sync period */}
|
||||
{loading ? spinner : <UsageChart period={period} />}
|
||||
|
||||
{/* Provider and model breakdown charts */}
|
||||
{!loading && (stats.byProvider || stats.byModel) && (
|
||||
<div className="grid min-w-0 grid-cols-1 gap-2 lg:grid-cols-2">
|
||||
<ProviderBarChart byProvider={stats.byProvider} />
|
||||
<TopModelsChart byModel={stats.byModel} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Table with dropdown selector */}
|
||||
<div className="flex flex-col gap-3">
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
|
||||
|
||||
Reference in new issue
Block a user