import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; import type { CostHistogramResponse, LatencyHistogramResponse, LogsHistogramResponse, ModelHistogramResponse, TokenHistogramResponse, } from "@/lib/types/logs"; import { CHART_COLORS, CHART_HEADER_ACTIONS_CLASS, CHART_HEADER_CONTROLS_CLASS, CHART_HEADER_LEGEND_CLASS, LATENCY_COLORS, getModelColor, } from "../utils/chartUtils"; import CacheTokenMeterChart from "./charts/cacheTokenMeterChart"; import { ChartCard } from "./charts/chartCard"; import { type ChartType, ChartTypeToggle } from "./charts/chartTypeToggle"; import { CostChart } from "./charts/costChart"; import { LatencyChart } from "./charts/latencyChart"; import { LogVolumeChart } from "./charts/logVolumeChart"; import { ModelFilterSelect } from "./charts/modelFilterSelect"; import { ModelUsageChart } from "./charts/modelUsageChart"; import { TokenUsageChart } from "./charts/tokenUsageChart"; export interface OverviewTabProps { // Data histogramData: LogsHistogramResponse | null; tokenData: TokenHistogramResponse | null; costData: CostHistogramResponse | null; modelData: ModelHistogramResponse | null; latencyData: LatencyHistogramResponse | null; // Loading states loadingHistogram: boolean; loadingTokens: boolean; loadingCost: boolean; loadingModels: boolean; loadingLatency: boolean; // Time range startTime: number; endTime: number; // Chart types volumeChartType: ChartType; tokenChartType: ChartType; costChartType: ChartType; modelChartType: ChartType; latencyChartType: ChartType; // Model selections costModel: string; usageModel: string; // Derived model lists costModels: string[]; usageModels: string[]; availableModels: string[]; // Chart type toggle callbacks onVolumeChartToggle: (type: ChartType) => void; onTokenChartToggle: (type: ChartType) => void; onCostChartToggle: (type: ChartType) => void; onModelChartToggle: (type: ChartType) => void; onLatencyChartToggle: (type: ChartType) => void; // Filter callbacks onCostModelChange: (model: string) => void; onUsageModelChange: (model: string) => void; } export function OverviewTab({ histogramData, tokenData, costData, modelData, latencyData, loadingHistogram, loadingTokens, loadingCost, loadingModels, loadingLatency, startTime, endTime, volumeChartType, tokenChartType, costChartType, modelChartType, latencyChartType, costModel, usageModel, costModels, usageModels, availableModels, onVolumeChartToggle, onTokenChartToggle, onCostChartToggle, onModelChartToggle, onLatencyChartToggle, onCostModelChange, onUsageModelChange, }: OverviewTabProps) { return ( <> {/* Charts Grid */}
{/* Log Volume Chart */}
Success Error
} > {/* Token Usage Chart */}
Input Output Cached
} >
{/* Cache Hit Rate Meter */} {/* Cost Chart */}
{costModel === "all" ? ( costModels.length > 0 && ( <> {costModels[0]} {costModels[0]} {costModels.length > 1 && ( +{costModels.length - 1} more
{costModels.slice(1).map((model, idx) => ( {model} ))}
)} ) ) : ( {costModel} {costModel} )}
} >
{/* Model Usage Chart */}
{usageModel === "all" ? ( usageModels.length > 0 && ( <> {usageModels[0]} {usageModels[0]} {usageModels.length > 1 && ( +{usageModels.length - 1} more
{usageModels.slice(1).map((model, idx) => ( {model} ))}
)} ) ) : ( <> Success Error )}
} >
{/* Latency Chart */}
Avg P90 P95 P99
} >
); }