fix(tui): drop usage and the model detail line from the model picker (#62927)

This commit is contained in:
James Long
2026-11-09 13:07:24 -06:00
committed by GitHub
Unverified
parent 7524e5f495
commit a3352f7be0
2 changed files with 8 additions and 32 deletions
+2 -26
View File
@@ -1,5 +1,5 @@
import type { ModelInfo } from "@opencode/client"
import { createMemo, createSignal, onMount, Show } from "solid-js"
import { createMemo, createSignal, Show } from "solid-js"
import { useLocal } from "../context/local"
import { DialogSelect } from "../ui/dialog-select"
import { useDialog } from "../ui/dialog"
@@ -12,9 +12,7 @@ import { modelPreferenceKey } from "../model-preference"
import { useLocation } from "../context/location"
import { useNewDesigns } from "../config"
import { DialogFreeModels } from "./dialog-model-free"
import { FavoriteMarker, ModelDetail, isFreeModel, prioritizeFavorites, sortModelOptions } from "./model-options"
import { DialogUsage, useUsageLimits } from "./usage"
import { formatDollars, usageLevel } from "../util/usage-limits"
import { FavoriteMarker, isFreeModel, prioritizeFavorites, sortModelOptions } from "./model-options"
export function DialogModel(props: { providerID?: string }) {
const local = useLocal()
@@ -62,19 +60,6 @@ function DialogConnectedModels(props: {
const newDesigns = useNewDesigns()
const data = useData()
const location = useLocation()
const dialog = useDialog()
const limits = useUsageLimits()
// Spend moves with every request, so the picker shows fresh limits.
onMount(() => limits.load(true))
const usage = (model: ModelInfo) => {
const value = limits.usage(model)
if (value) {
const level = usageLevel(value, model)
return { text: `${formatDollars(value.left)} left`, danger: level === "out" || level === "reached" }
}
if (limits.unlimited(model)) return { text: "No limit" }
return undefined
}
const [query, setQuery] = createSignal("")
// Under new designs, favoriting does not reorder the list until the dialog is reopened.
const favoritesAtOpen = [...local.model.favorite()]
@@ -120,7 +105,6 @@ function DialogConnectedModels(props: {
description: provider?.name ?? model.providerID,
category,
footer: trailing(model, isFavorite(item)),
detail: newDesigns() ? () => <ModelDetail model={model} usage={usage(model)} /> : undefined,
onSelect: () => {
props.onSelect(model.providerID, model.id)
},
@@ -155,7 +139,6 @@ function DialogConnectedModels(props: {
category: connected() ? (freeGroup(model) ? "Free" : (provider?.name ?? model.providerID)) : undefined,
footer: trailing(model, favorite),
free: isFreeModel(model),
detail: newDesigns() ? () => <ModelDetail model={model} usage={usage(model)} /> : undefined,
onSelect() {
props.onSelect(model.providerID, model.id)
},
@@ -228,13 +211,6 @@ function DialogConnectedModels(props: {
selection: "none",
onTrigger: props.onConnect,
},
{
command: "model.dialog.usage",
title: newDesigns() ? "usage" : "Usage",
selection: "none",
hidden: !limits.info(),
onTrigger: () => dialog.replace(() => <DialogUsage />),
},
{
command: "model.dialog.favorite",
title: newDesigns() ? (option) => (isFavorite(option?.value) ? "unfavorite" : "favorite") : "Favorite",
+6 -6
View File
@@ -1,4 +1,4 @@
import { test } from "bun:test"
import { expect, test } from "bun:test"
import { createAppFixture } from "./fixture/app"
import { tmpdir } from "./fixture/fixture"
import { directory, json } from "./fixture/tui-client"
@@ -150,13 +150,13 @@ test("shows what the workspace's limits leave and why a refused turn stopped", a
frame.includes("Only you · GPT 5.6 Sol, Claude Opus 5"),
)
// The model picker says what's left on the model it highlights, and opens the same usage list.
// The model picker has no usage action and no per-model detail line; /usage is the way to the full list.
setup.mockInput.pressEscape()
await setup.waitForFrame((frame) => !frame.includes("Usage › Claude Opus 5"))
await setup.mockInput.typeText("/models")
setup.mockInput.pressEnter()
await setup.waitForFrame(
(frame) =>
frame.includes("Search models") && /\$6 left +\$4\/\$20 per 1M/.test(frame) && frame.includes("usage ctrl+u"),
)
await setup.waitForFrame((frame) => frame.includes("Search models") && frame.includes("favorite ctrl+f"))
const picker = setup.captureCharFrame()
expect(picker).not.toContain("usage ctrl+u")
expect(picker).not.toContain("per 1M")
})