Skip to content

feat(llm): set profile prices in the settings dialog - #541

Open
Phantom-IN wants to merge 1 commit into
BaaRai:mainfrom
Phantom-IN:feat/llm-profile-prices
Open

Phantom-IN wants to merge 1 commit into
BaaRai:mainfrom
Phantom-IN:feat/llm-profile-prices

Conversation

@Phantom-IN

Copy link
Copy Markdown
Contributor

This is the UI follow-up #70 mentions ("the dashboard card line and the profile-dialog price inputs"), the dialog half of it.

The four price columns and cost_eur on the usage API already exist, but there was no way to set prices from the UI, and the profile list didn't return them. There was also a bug: SaveProfile always rewrites the price columns, and the dialog's save payload had no price fields. So if you set prices through the API and then edited the profile in the UI (say, changed the rate limit), the prices went back to 0.

Changes:

  • LLMProfileDTO returns the four prices.
  • The profile dialog has four inputs (EUR per 1M tokens) under the rate limits. They're filled from the profile and sent on save.
  • pgSaveProfile treats a negative price as unset, like max_tokens.
  • The new strings are added to tr and zh-CN.

The dashboard cost line can come in a separate PR.

TestProfilePricesThroughAPI saves a profile through the handler and checks the list returns the prices, with a negative one stored as 0. go test ./server/ passes against Postgres 16, apart from the two tests that fail on my Mac on main too. tsc --noEmit and npm run test:i18n pass, and biome reports nothing new.

The cost ledger (BaaRai#70) stores four prices per profile and the usage API
turns them into cost_eur, but the UI never got the follow-up: the profile
list did not return the prices and the dialog had no inputs for them.

That also made prices fragile. SaveProfile always rewrites the price
columns, and the dialog's save payload had no price fields, so editing a
profile in the UI reset prices set through the API to zero.

Return the prices in LLMProfileDTO, add the four inputs to the dialog and
send them on save. A negative price is stored as unset.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant