feat(web): rework the cost-overrides panel and modal
Merged
RA
2d ago+600+600+012345678901234567890123456789-435-435-012345678901234567890123456789
Description
Reworks the Cost Overrides panel on the admin Language Models page.
- Modal: adding and editing happen in a "New / Edit Cost Override" modal instead of an inline form. It runs on Formik with a Yup schema, like the language-model provider modals: Save / Add stay disabled until the form is valid and changed, and Enter submits.
- Fields:
InputHorizontalrows with short titles and descriptions. The three rates useInputCurrency(2 decimals). The edit path shows the override's model in the model selector, disabled. - Cards: each override is a
SelectCardlike the provider cards: model icon, model name, provider and update date, the rates on a line below, and trash / settings buttons beside the title. Delete now asks for confirmation. - Search focus:
InputSingleSelectandSimpleModelSelectortake acontainer, passed to theDropdown. The modal passes its content element so the model search field keeps focus inside the dialog's focus trap. - Copy updated in all nine locales; unused placeholder keys removed.
UI only: it works with the current cost-override API. The data-model change (overrides referencing model_configuration) comes in a separate PR.
Changes
No overrides
>1 overrides
Creating new override
Editing existing override
Summary by cubic
Reworks the Cost Overrides panel on the admin Language Models page: adding and editing now happen in a New/Edit Cost Override modal, and each override renders as a card matching the provider cards above it. UI only — the overrides API is unchanged.
New Features
- Add/edit moved from an inline form to a Formik + Yup modal; Add/Save stays disabled until the form is valid and changed, and Enter submits. Fields use
InputHorizontalwith short titles and unit descriptions. - Rates use
InputCurrencywith unlimited precision, so sub-cent negotiated rates ($0.075, $0.01875) save and display exactly; each card lists In, Out, and (when set) Cache as separate items on a line under the description. The edit path shows the override's model in a disabled selector, or a read-only field when no configured model matches. - Delete now asks for confirmation, disables itself while the request runs, and shows success/error toasts; copy is updated in all nine locales, unused placeholder keys were removed, and the API error path now reuses
parseErrorDetail. - Tests that drove a mocked model picker were dropped: they didn't exercise the real modal.
Bug Fixes
InputSingleSelectandSimpleModelSelectoraccept acontainerpassed to theDropdown, so the model search field keeps focus inside the modal's focus trap.
Summary by CodeRabbit
-
New Features
- Added modal-based forms for creating and editing cost overrides with validation and model selection.
- Cost rates now support unlimited precision and display separate input, output, and cache values alongside provider and update time.
- Added edit and confirmation-based delete actions with success and error notifications.
- Improved dropdown placement within dialogs and constrained layouts.
-
Localization
- Updated cost-override labels, descriptions, units, titles, rate details, and confirmation messages across supported languages.