Skip to content

fix(ui): stop the English admin models header from asserting a currency - #169

Merged
argszero merged 1 commit into
mainfrom
fix/admin-models-currency-header
Sep 11, 2026
Merged

argszero merged 1 commit into
mainfrom
fix/admin-models-currency-header

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

The English column headers in the admin model management table read Input $ / Output $. The values rendered underneath are each model's price in its own currencyrenderAdminModels() prints m.input_per_m / m.output_per_m raw, unconverted, in raw units — and the table marks the currency nowhere. config/config.toml ships a mixed catalog (10 CNY + 4 USD models), so the $ was simply wrong for the CNY rows: deepseek-v4-flash rendered as 1.5 under an Input $ header is not 1.5 dollars.

It was wrong from the day it was added: git log -S'"Input $"'98a7a9b (PR #97, the commit that introduced this table), whose data/models.example.json already carried 3 CNY vs 7 USD models.

The Chinese source text — admin.models.col.in/out = 输入价 / 输出价, and the prototype header — asserts no currency. The $ exists only in the English translation of the header (it is the only currency symbol in the whole 775-key pack), so this is a translation-introduced defect rather than a currency-modelling one: the fix is to stop asserting a currency, not to change how currencies are stored.

Scope: English values only, 2 keys, wording aligned with the sibling form labels (admin.models.form.in/out = Input price (/M tokens)). No key added or removed, no code changed, and the zh pack is byte-identical (md5 ef2d416b550a47dd97f5f1dbb319bb32 before and after).

Related Issue

Changes

  • admin.models.col.in: Input $Input price
  • admin.models.col.out: Output $Output price
  • cache-bust ?v=20260911-13?v=20260911-14 in ui/index.html (5 refs)
  • 涉及配置/数据结构的改动已同步示例文件 — N/A, this is a copy-only change

Tests

  • cargo test 全部通过 — 148 passed / 0 failed
  • cargo fmt --check 通过
  • cargo clippy --all-targets 无新增 warning
  • 新增/更新了单元测试(如适用)— N/A (no Rust code touched)

i18n gates (values read from the real module's pack objects, not parsed by regex):

gate result
key parity PASS — 775 == 775, zero keys only-in-zh / only-in-en
the 2 fixed values, EN PASS — Input price / Output price, no $
ZH values untouched PASS — 输入价 / 输出价
currency symbols anywhere in the EN pack PASS — 0
placeholder mismatches PASS — 0

Runtime A/B (both trees built by one generator; baseline = git show HEAD:ui/..., fixed = work tree; cache-bust neutralized so it is not a variable). Rendered the admin models table in a headless browser against a stub /api/admin/models carrying one CNY and one USD model:

EN baseline EN fixed
headers Provider, Model, **Input $, Output $**, Context, … Provider, Model, **Input price, Output price**, Context, …
rows deepseek-v4-flash 1.5 4.5 / gpt-5.6-sol 5 30 identical
  • negative control: $ is asserted present in the EN baseline, so "gone after" is not vacuous
  • ZH regression control: ZH headers (输入价 / 输出价) and both ZH data rows are byte-identical across trees — only the EN pack moved
  • row control: all data rows byte-identical across trees — only the two header cells changed

Checklist

  • 分支命名符合约定(fix/admin-models-currency-header
  • Commit message 使用 Conventional Commits 格式
  • 单一职责,改动最小化(2 个 EN 值 + 1 处 cache-bust)

The English column headers admin.models.col.in/out read "Input $" / "Output $",
but the values rendered underneath are each model's price in its OWN currency
(raw input_per_m/output_per_m, unconverted) and the table marks the currency
nowhere. config.toml ships a mixed catalog (10 CNY + 4 USD models), so the $
was simply wrong for the CNY rows — and it was wrong from the day it was added:
the commit that introduced it already had 3 CNY vs 7 USD models.

The Chinese source text (输入价/输出价) asserts no currency, as does the
prototype, so this is a translation-introduced defect: drop the symbol and align
the wording with the sibling form labels ("Input price" / "Output price").
English values only — the zh pack is byte-identical, and no key changed.
@argszero
argszero merged commit edd21a7 into main Sep 11, 2026
1 check passed
@argszero
argszero deleted the fix/admin-models-currency-header branch September 11, 2026 20:05
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