fix(tui): distinguish variant switch notices (#35315)
This commit is contained in:
parent
5b44e5bf41
commit
62af66a74f
14 changed files with 98 additions and 21 deletions
|
|
@ -34,11 +34,12 @@ export function formatRef(model: { providerID: string; id: string; variant?: str
|
|||
export function switchLabel(
|
||||
model: { providerID: string; id: string; variant?: string },
|
||||
models?: readonly { providerID: string; id: string; name: string }[],
|
||||
previous?: { providerID: string; id: string; variant?: string },
|
||||
) {
|
||||
if (previous?.providerID === model.providerID && previous.id === model.id)
|
||||
return `Switched variant to ${model.variant ?? "default"}`
|
||||
const display = models?.find((item) => item.providerID === model.providerID && item.id === model.id)?.name
|
||||
if (display === undefined) return `Switched model to ${formatRef(model)}`
|
||||
// Variant-only switches publish the same model id; without the variant the
|
||||
// notice would look like a redundant model switch.
|
||||
const variant = model.variant && model.variant !== "default" ? ` (${model.variant})` : ""
|
||||
return `Switched model to ${display}${variant}`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue