@@ -11,6 +11,7 @@ import { Separator } from "@/components/ui/separator";
1111import { ChartContainer , ChartTooltip , ChartTooltipContent } from "@/components/ui/chart" ;
1212import { Table , TableBody , TableCell , TableHead , TableHeader , TableRow } from "@/components/ui/table" ;
1313import { Sheet , SheetContent , SheetHeader , SheetTitle , SheetTrigger } from "@/components/ui/sheet" ;
14+ import { Select , SelectContent , SelectItem , SelectTrigger , SelectValue } from "@/components/ui/select" ;
1415import { Tooltip as UITooltip , TooltipContent , TooltipTrigger } from "@/components/ui/tooltip" ;
1516import { DeploymentFooter } from "@/components/DeploymentFooter" ;
1617import {
@@ -26,6 +27,7 @@ import {
2627 getDailyModelData ,
2728 getPowerUsers ,
2829 getPowerUserDailyData ,
30+ COPILOT_PLANS ,
2931 getPowerUserDailyBreakdown ,
3032 getLastDateFromData
3133} from "@/lib/utils" ;
@@ -41,6 +43,7 @@ function App() {
4143 const [ selectedPowerUser , setSelectedPowerUser ] = useState < string | null > ( null ) ;
4244 const [ lastDateAvailable , setLastDateAvailable ] = useState < string | null > ( null ) ;
4345 const [ isDragging , setIsDragging ] = useState ( false ) ;
46+ const [ selectedPlan , setSelectedPlan ] = useState < string > ( COPILOT_PLANS . BUSINESS ) ; // Default to Business
4447 const [ isProcessing , setIsProcessing ] = useState ( false ) ;
4548 const fileInputRef = useRef < HTMLInputElement > ( null ) ;
4649
@@ -316,6 +319,27 @@ function App() {
316319 } , { } as Record < string , string > ) ;
317320 } , [ uniqueModels ] ) ;
318321
322+ // Helper function to get plan limit based on selected plan
323+ const getPlanLimit = useCallback ( ( item : ModelUsageSummary ) => {
324+ let limit : number ;
325+ switch ( selectedPlan ) {
326+ case COPILOT_PLANS . INDIVIDUAL :
327+ limit = item . individualPlanLimit ;
328+ break ;
329+ case COPILOT_PLANS . BUSINESS :
330+ limit = item . businessPlanLimit ;
331+ break ;
332+ case COPILOT_PLANS . ENTERPRISE :
333+ limit = item . enterprisePlanLimit ;
334+ break ;
335+ default :
336+ limit = item . businessPlanLimit ;
337+ }
338+
339+ // For 0x multiplier models, show "Unlimited" despite having constant plan limits
340+ return item . multiplier === 0 ? "Unlimited" : limit . toLocaleString ( ) ;
341+ } , [ selectedPlan ] ) ;
342+
319343 return (
320344 < div className = "container max-w-7xl mx-auto py-8 px-4 min-h-screen" >
321345 < header className = "mb-8" >
@@ -672,7 +696,22 @@ function App() {
672696 { /* Model Usage Table */ }
673697 < div className = "mb-6" >
674698 < Card className = "p-5" >
675- < h3 className = "text-md font-medium mb-3" > Requests per Model</ h3 >
699+ < div className = "flex items-center justify-between mb-3" >
700+ < h3 className = "text-md font-medium" > Requests per Model</ h3 >
701+ < div className = "flex items-center gap-2" >
702+ < span className = "text-sm text-muted-foreground" > Plan Type:</ span >
703+ < Select value = { selectedPlan } onValueChange = { setSelectedPlan } >
704+ < SelectTrigger className = "w-32" >
705+ < SelectValue placeholder = "Select plan" />
706+ </ SelectTrigger >
707+ < SelectContent >
708+ < SelectItem value = { COPILOT_PLANS . INDIVIDUAL } > Individual</ SelectItem >
709+ < SelectItem value = { COPILOT_PLANS . BUSINESS } > Business</ SelectItem >
710+ < SelectItem value = { COPILOT_PLANS . ENTERPRISE } > Enterprise</ SelectItem >
711+ </ SelectContent >
712+ </ Select >
713+ </ div >
714+ </ div >
676715 < div className = "overflow-auto max-h-60" >
677716 < Table >
678717 < TableHeader >
@@ -681,6 +720,9 @@ function App() {
681720 < TableHead className = "text-right" > Total Requests</ TableHead >
682721 < TableHead className = "text-right" > Compliant</ TableHead >
683722 < TableHead className = "text-right" > Exceeding</ TableHead >
723+ < TableHead className = "text-right" > Multiplier</ TableHead >
724+ < TableHead className = "text-right" > Plan Limit</ TableHead >
725+ < TableHead className = "text-right" > Excess Cost</ TableHead >
684726 </ TableRow >
685727 </ TableHeader >
686728 < TableBody >
@@ -690,6 +732,32 @@ function App() {
690732 < TableCell className = "text-right" > { item . totalRequests . toLocaleString ( undefined , { maximumFractionDigits : 2 , minimumFractionDigits : 0 } ) } </ TableCell >
691733 < TableCell className = "text-right" > { item . compliantRequests . toLocaleString ( undefined , { maximumFractionDigits : 2 , minimumFractionDigits : 0 } ) } </ TableCell >
692734 < TableCell className = "text-right" > { item . exceedingRequests . toLocaleString ( undefined , { maximumFractionDigits : 2 , minimumFractionDigits : 0 } ) } </ TableCell >
735+ < TableCell className = "text-right" > { item . multiplier } x</ TableCell >
736+ < TableCell className = "text-right" > { getPlanLimit ( item ) } </ TableCell >
737+ < TableCell className = "text-right" > ${ item . excessCost . toFixed ( 2 ) } </ TableCell >
738+ </ TableRow >
739+ ) ) }
740+ </ TableBody >
741+ </ Table >
742+ </ div >
743+ </ Card >
744+ </ div >
745+
746+ { /* Models List Card */ }
747+ < div className = "grid grid-cols-1 lg:grid-cols-2 gap-4 mb-6" >
748+ < Card className = "p-5" >
749+ < h3 className = "text-md font-medium mb-3" > Models List</ h3 >
750+ < div className = "overflow-auto max-h-60" >
751+ < Table >
752+ < TableHeader >
753+ < TableRow >
754+ < TableHead > Model Name</ TableHead >
755+ </ TableRow >
756+ </ TableHeader >
757+ < TableBody >
758+ { uniqueModels . map ( ( model ) => (
759+ < TableRow key = { model } >
760+ < TableCell > { model } </ TableCell >
693761 </ TableRow >
694762 ) ) }
695763 </ TableBody >
@@ -772,7 +840,6 @@ function App() {
772840 stroke = "#10b981"
773841 strokeWidth = { 2 }
774842 activeDot = { { r : 6 } }
775- stackId = "1"
776843 />
777844 < Line
778845 key = "exceeding"
@@ -782,7 +849,6 @@ function App() {
782849 stroke = "#ef4444"
783850 strokeWidth = { 2 }
784851 activeDot = { { r : 6 } }
785- stackId = "1"
786852 />
787853 </ LineChart >
788854 </ ChartContainer >
@@ -800,7 +866,10 @@ function App() {
800866 < Separator className = "mb-6" />
801867 < div className = "bg-card p-4 rounded-lg border" >
802868 < ChartContainer
803- config = { getModelColors ( ) }
869+ config = { Object . entries ( getModelColors ( ) ) . reduce ( ( acc , [ model , color ] ) => {
870+ acc [ model ] = { color } ;
871+ return acc ;
872+ } , { } as Record < string , { color : string } > ) }
804873 className = "h-[500px] w-full"
805874 >
806875 < BarChart data = { barChartData ( ) } >
0 commit comments