Skip to content

Commit 9b4b057

Browse files
committed
feat(tui): show model limits in the default /models footer
ModelDetail only renders under experimental.new-designs, so the default picker showed nothing new. Append the context and output limits to the footer (next to Free) so anomalyco#40792 is fulfilled for the default experience too.
1 parent 206cf78 commit 9b4b057

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎packages/tui/src/component/dialog-model.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { modelPreferenceKey } from "../model-preference"
1212
import { useLocation } from "../context/location"
1313
import { useNewDesigns } from "../config"
1414
import { DialogFreeModels } from "./dialog-model-free"
15-
import { FavoriteMarker, ModelDetail, isFreeModel, prioritizeFavorites, sortModelOptions } from "./model-options"
15+
import { FavoriteMarker, ModelDetail, isFreeModel, modelLimits, prioritizeFavorites, sortModelOptions } from "./model-options"
1616
import { DialogUsage, useUsageLimits } from "./usage"
1717
import { formatDollars, usageLevel } from "../util/usage-limits"
1818

@@ -85,7 +85,11 @@ function DialogConnectedModels(props: {
8585
// Under new designs the detail row shows the price, so the trailing slot only marks favorites.
8686
const trailing = (model: ModelInfo, favorite: boolean) => {
8787
if (newDesigns()) return favorite ? <FavoriteMarker /> : undefined
88-
return isFreeModel(model) ? "Free" : undefined
88+
const parts: string[] = []
89+
if (isFreeModel(model)) parts.push("Free")
90+
const limits = modelLimits(model)
91+
if (limits) parts.push(limits)
92+
return parts.length ? parts.join(" ") : undefined
8993
}
9094
// OpenCode's own free models get their own group at the end of the list instead of joining "OpenCode".
9195
const freeGroup = (model: ModelInfo) =>

‎packages/tui/src/component/model-options.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ type FactSource = {
128128
}
129129

130130
/** Context window and max output tokens, e.g. `200K/8K`, or `""` when the model declares neither. */
131-
function limits(model: FactSource) {
131+
export function modelLimits(model: FactSource) {
132132
const context = model.limit?.context ?? 0
133133
const output = model.limit?.output ?? 0
134134
if (context && output) return `${tokens(context)}/${tokens(output)}`
@@ -144,7 +144,7 @@ function limits(model: FactSource) {
144144
export function modelFacts(model: FactSource) {
145145
return [
146146
(model.capabilities?.input ?? []).map(modality).join(", "),
147-
limits(model),
147+
modelLimits(model),
148148
...(model.variants?.length ? ["Reasoning"] : []),
149149
...(model.capabilities?.tools ? ["Tools"] : []),
150150
].filter(Boolean)

0 commit comments

Comments
 (0)