refactor(tui): simplify mini footer status line (#38112)

This commit is contained in:
Simon Klee 2026-07-21 16:08:19 +02:00 committed by GitHub
commit dd50d457b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 111 additions and 102 deletions

View file

@ -1,4 +1,5 @@
import type { ModelInfo, SessionMessageAssistant, SessionMessageInfo } from "@opencode-ai/client"
import { Locale } from "./locale"
export function isDefaultTitle(title: string) {
return /^(New session - |Child session - )\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(title)
@ -33,3 +34,8 @@ export function contextUsage(
percent: model?.limit.context ? Math.round((tokens / model.limit.context) * 100) : undefined,
}
}
export function formatContextUsage(tokens: number, percent?: number) {
const value = Locale.number(tokens)
return percent === undefined ? value : `${value} (${percent}%)`
}