MCPcopy Create free account
hub / github.com/anus-dev/ANUS / ModelStatsDisplay

Function ModelStatsDisplay

packages/cli/src/ui/components/ModelStatsDisplay.tsx:49–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47);
48
49export const ModelStatsDisplay: React.FC = () => {
50 const { stats } = useSessionStats();
51 const { models } = stats.metrics;
52 const activeModels = Object.entries(models).filter(
53 ([, metrics]) => metrics.api.totalRequests > 0,
54 );
55
56 if (activeModels.length === 0) {
57 return (
58 <Box
59 borderStyle="round"
60 borderColor={Colors.Gray}
61 paddingY={1}
62 paddingX={2}
63 >
64 <Text>No API calls have been made in this session.</Text>
65 </Box>
66 );
67 }
68
69 const modelNames = activeModels.map(([name]) => name);
70
71 const getModelValues = (
72 getter: (metrics: ModelMetrics) => string | React.ReactElement,
73 ) => activeModels.map(([, metrics]) => getter(metrics));
74
75 const hasThoughts = activeModels.some(
76 ([, metrics]) => metrics.tokens.thoughts > 0,
77 );
78 const hasTool = activeModels.some(([, metrics]) => metrics.tokens.tool > 0);
79 const hasCached = activeModels.some(
80 ([, metrics]) => metrics.tokens.cached > 0,
81 );
82
83 return (
84 <Box
85 borderStyle="round"
86 borderColor={Colors.Gray}
87 flexDirection="column"
88 paddingY={1}
89 paddingX={2}
90 >
91 <Text bold color={Colors.AccentPurple}>
92 Model Stats For Nerds
93 </Text>
94 <Box height={1} />
95
96 {/* Header */}
97 <Box>
98 <Box width={METRIC_COL_WIDTH}>
99 <Text bold>Metric</Text>
100 </Box>
101 {modelNames.map((name) => (
102 <Box width={MODEL_COL_WIDTH} key={name}>
103 <Text bold>{name}</Text>
104 </Box>
105 ))}
106 </Box>

Callers

nothing calls this directly

Calls 6

useSessionStatsFunction · 0.85
getModelValuesFunction · 0.85
calculateErrorRateFunction · 0.85
calculateAverageLatencyFunction · 0.85
formatDurationFunction · 0.85
calculateCacheHitRateFunction · 0.85

Tested by

no test coverage detected