refactor(tui): simplify mini footer status line (#38112)
This commit is contained in:
parent
592ef7433a
commit
dd50d457b0
15 changed files with 111 additions and 102 deletions
|
|
@ -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}%)`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue