Skip to content

Commit 1e63e76

Browse files
committed
fix(stats): scope model pages to go
1 parent 213ff3f commit 1e63e76

2 files changed

Lines changed: 11 additions & 34 deletions

File tree

packages/stats/app/src/routes/[lab]/[model].tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ export default function StatsModel() {
123123
const modelTitle = createMemo(() => `${modelName()} Data`)
124124
const modelDescription = createMemo(() =>
125125
stats()
126-
? `${modelName()} usage, rank, token mix, cost, geo breakdown, and peer data across OpenCode.`
127-
: `${modelName()} model facts, limits, and OpenCode usage availability.`,
126+
? `${modelName()} usage, rank, token mix, cost, geo breakdown, and peer data across OpenCode Go.`
127+
: `${modelName()} model facts, limits, and OpenCode Go usage availability.`,
128128
)
129129
const modelUrl = createMemo(() =>
130130
new URL(
@@ -257,7 +257,7 @@ function ModelHero(props: { data: StatsModelData | null; catalog: ModelCatalogEn
257257
<Show
258258
when={props.data}
259259
fallback={
260-
<p>Model facts from the shared model index. OpenCode usage appears once this model has activity.</p>
260+
<p>Model facts from the shared model index. OpenCode Go usage appears once this model has activity.</p>
261261
}
262262
>
263263
{(data) => (
@@ -298,7 +298,7 @@ function ModelCatalogCallout(props: { catalog: ModelCatalogEntry | null }) {
298298
<div data-component="model-rank-panel">
299299
<span>Model Profile</span>
300300
<strong>{props.catalog?.releaseDate ? formatCatalogDate(props.catalog.releaseDate) : "Listed"}</strong>
301-
<p>No OpenCode usage in the current data window.</p>
301+
<p>No OpenCode Go usage in the current data window.</p>
302302
</div>
303303
)
304304
}
@@ -329,10 +329,10 @@ function CatalogDatum(props: { label: string; value: string }) {
329329
function ModelOverview(props: { data: StatsModelData | null }) {
330330
return (
331331
<section data-section="model-panel">
332-
<SectionTitle title="Overview" description="Recent tokens, sessions, and market position." />
332+
<SectionTitle title="Overview" description="Recent OpenCode Go tokens, sessions, and market position." />
333333
<Show
334334
when={props.data}
335-
fallback={<ModelEmptyState title="No usage summary" description="This model has no OpenCode usage rows yet." />}
335+
fallback={<ModelEmptyState title="No usage summary" description="This model has no OpenCode Go usage rows yet." />}
336336
>
337337
{(data) => (
338338
<div data-component="model-metric-grid">
@@ -367,7 +367,7 @@ function ModelUsageSection(props: { data: ModelUsagePoint[] }) {
367367

368368
return (
369369
<section id="usage" data-section="model-panel">
370-
<SectionTitle title="Usage" description="Daily token volume over the recent two-month window." />
370+
<SectionTitle title="Usage" description="Daily OpenCode Go token volume over the recent two-month window." />
371371
<Show
372372
when={props.data.some((item) => item.tokens > 0)}
373373
fallback={<ModelEmptyState title="No usage" description="No usage landed in the current window." />}
@@ -461,7 +461,7 @@ function ModelUsageSection(props: { data: ModelUsagePoint[] }) {
461461
function ModelEfficiencySection(props: { data: StatsModelData | null; catalog: ModelCatalogEntry | null }) {
462462
return (
463463
<section id="efficiency" data-section="model-panel">
464-
<SectionTitle title="Efficiency" description="Cost, cache behavior, and average session shape." />
464+
<SectionTitle title="Efficiency" description="Cost, cache behavior, and average OpenCode Go session shape." />
465465
<Show
466466
when={props.data}
467467
fallback={
@@ -521,10 +521,10 @@ function ModelGeoBreakdownSection(props: { data: Record<UsageRange, CountryEntry
521521
setActiveCountry(undefined)
522522
}}
523523
>
524-
<SectionTitle title="Geo Breakdown" description="Model tokens used by country." />
524+
<SectionTitle title="Geo Breakdown" description="OpenCode Go model tokens used by country." />
525525
<Show
526526
when={data().length > 0}
527-
fallback={<ModelEmptyState title="No geo data" description="No geo_stat rows matched this model." />}
527+
fallback={<ModelEmptyState title="No geo data" description="No OpenCode Go geo_stat rows matched this model." />}
528528
>
529529
<div data-component="geo-breakdown">
530530
<div data-slot="geo-map-panel">
@@ -684,7 +684,7 @@ function GeoCountryList(props: {
684684
function ModelPeersSection(props: { data: StatsModelData | null }) {
685685
return (
686686
<section id="peers" data-section="model-panel">
687-
<SectionTitle title="Peers" description="Nearby models by recent token volume." />
687+
<SectionTitle title="Peers" description="Nearby models by recent OpenCode Go token volume." />
688688
<Show
689689
when={props.data?.peers.length}
690690
fallback={<ModelEmptyState title="No peers" description="Peer rankings appear after usage lands." />}

packages/stats/core/src/domain/home.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export type SessionCostEntry = { model: string; cost: number; tokens: number }
2323
export type CountryEntry = { country: string; continent: string; tokens: number; share: number; rank: number }
2424
export type ModelUsagePoint = { date: string; tokens: number; sessions: number; cost: number }
2525
export type ModelMixEntry = { label: string; tokens: number; share: number }
26-
export type ModelProductEntry = { product: string; tokens: number; sessions: number; share: number }
2726
export type ModelPeerEntry = {
2827
model: string
2928
provider: string
@@ -63,7 +62,6 @@ export type StatsModelData = {
6362
}
6463
usage: ModelUsagePoint[]
6564
tokenMix: ModelMixEntry[]
66-
productMix: ModelProductEntry[]
6765
country: Record<UsageRange, CountryEntry[]>
6866
peers: ModelPeerEntry[]
6967
}
@@ -286,7 +284,6 @@ function buildStatsModelData(
286284
},
287285
usage: buildModelUsage(currentRows, window, "2M"),
288286
tokenMix: buildModelTokenMix(current),
289-
productMix: buildModelProductMix(modelScopedRows, window, current),
290287
country: createRangeRecord((range) => buildCountryStats(geo, getWindow(range, earliest, latest))),
291288
peers: buildModelPeers(peers, peerRank, totalTokens),
292289
}
@@ -523,26 +520,6 @@ function buildModelTokenMix(aggregate: ModelAggregate): ModelMixEntry[] {
523520
return items.map((item) => ({ ...item, share: round((item.tokens / total) * 100, 1) }))
524521
}
525522

526-
function buildModelProductMix(
527-
rows: StatMetricRow[],
528-
window: DateWindow,
529-
fallback: ModelAggregate,
530-
): ModelProductEntry[] {
531-
const products = ["Go", "Zen", "Enterprise"] as const
532-
const items = products.flatMap((product) => {
533-
const aggregate = combineRowsForModel(
534-
fallback.model,
535-
rows.filter((row) => row.tier === product && row.periodStart >= window.start && row.periodStart < window.end),
536-
)
537-
if (aggregate.totalTokens === 0) return []
538-
return [{ product, tokens: aggregate.totalTokens, sessions: aggregate.sessions }]
539-
})
540-
const total = items.reduce((sum, item) => sum + item.tokens, 0)
541-
if (total > 0) return items.map((item) => ({ ...item, share: round((item.tokens / total) * 100, 1) }))
542-
if (fallback.totalTokens === 0) return []
543-
return [{ product: "All Users", tokens: fallback.totalTokens, sessions: fallback.sessions, share: 100 }]
544-
}
545-
546523
function buildModelPeers(peers: ModelAggregate[], rank: number, totalTokens: number): ModelPeerEntry[] {
547524
const start = Math.max(0, Math.min(rank - 4, Math.max(peers.length - 7, 0)))
548525
return peers.slice(start, start + 7).map((item, index) => ({

0 commit comments

Comments
 (0)