feat(stats): show model unique users

This commit is contained in:
Adam 2026-06-21 18:40:22 -05:00
parent 49593c1ec4
commit 7d204b5b57
No known key found for this signature in database
GPG Key ID: 9CB48779AF150E75
2 changed files with 8 additions and 1 deletions

View File

@ -330,7 +330,7 @@ function CatalogDatum(props: { label: string; value: string }) {
function ModelOverview(props: { data: StatsModelData | null }) {
return (
<section data-section="model-panel">
<SectionTitle title="Overview" description="Recent OpenCode Go tokens, sessions, and market position." />
<SectionTitle title="Overview" description="Recent OpenCode Go tokens, unique users, and market position." />
<Show
when={props.data}
fallback={
@ -340,6 +340,11 @@ function ModelOverview(props: { data: StatsModelData | null }) {
{(data) => (
<div data-component="model-metric-grid">
<MetricCard label="Tokens" value={formatTokens(data().totals.tokens)} detail="last two months" />
<MetricCard
label="Unique Users"
value={formatUsers(data().totals.uniqueUsers)}
detail="last two months"
/>
<MetricCard label="Sessions" value={formatInteger(data().totals.sessions)} detail="completed sessions" />
<MetricCard
label="Token Share"

View File

@ -54,6 +54,7 @@ export type StatsModelData = {
tokenChange: number
totals: {
sessions: number
uniqueUsers: number
tokens: number
cost: number
tokensPerSession: number
@ -381,6 +382,7 @@ function buildStatsModelData(
tokenChange: percentChange(current.totalTokens, previous.totalTokens),
totals: {
sessions: current.sessions,
uniqueUsers: current.uniqueUsers,
tokens: current.totalTokens,
cost: round(microcentsToDollars(current.totalCostMicrocents), 2),
tokensPerSession: current.sessions > 0 ? Math.round(current.totalTokens / current.sessions) : 0,