Repository navigation
fix(ui): resync the fallback catalog in data.js with config.example.toml - #172
Merged
Merged
Conversation
`ui/js/data.js` documents its tables as "对齐 config.toml [[models]] 官方价", but they had drifted, and the drift broke a cross-reference the code itself relies on. - Delete `gemini-3.5-flash-lite` from MODELS: it exists only in this file. It is not in any config, nothing in src/, and not in the models table of a live DB. The commit that announced adding it (ce6d0db) only ever wrote it here. - Add `deepseek-v4-flash-vision-exp` (present in config and seeded into the DB, but missing from this fallback) with its config pricing and max_output. - Resync the guest MARKET table: `glm-5.2`/`gpt-5.5-pro`/`claude-opus-4.7` were renamed to `glm-5.3`/`gpt-5.6-sol`/`claude-opus-5`, and `deepseek-v4-flash` still carried a 7.2x-scaled USD price (1.008/2.016) instead of the CNY official price. - Drive the peak columns from the config peak prices (3.0/9.0, not the derived 2.016/4.032) and drop the stale `peak: true` flag from `glm-5.3`, which has no peak price in config. Why it matters: `app.js:737-739` resolves a guest row's max-token cell by model NAME (`D.MODELS.find((x) => x.model === m.model)`), so the three renamed rows were rendering "not published" instead of their max output. All values are derived from config/config.example.toml (USD prices x CNY_PER_USD = 7.2, src/billing.rs:22). Cache-bust bumped so the changed file is refetched. Verified: 155 tests pass, fmt/clippy clean; the MARKET -> MODELS cross-reference resolves for all 7 guest rows (was 4/7); a runtime check that reads the real module reports 5 failures before this change and 0 after.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ui/js/data.jsdocuments its two fallback tables as "对齐 config.toml [[models]] 官方价" (aligned with the official prices inconfig.toml), but they had drifted from the single source of truth (config/config.example.toml), and the drift broke a cross-reference that the code itself relies on.This PR resyncs the guest/fallback catalog so
ui/js/data.jsmatchesconfig.example.tomlagain.What was wrong
(A) A phantom model.
gemini-3.5-flash-liteexisted only inui/js/data.js. It is not in any tracked config, not in any untracked config, nothing insrc/, and not in themodelstable of a live database. Its provenance confirms it was a mistake: commitce6d0db(the 2026-08-20 price refresh) announced adding it in its commit message, butgit log -S flash-lite -- config/is empty at every revision — it was only ever written into this JS fallback.(B) The guest
MARKETtable named models that no longer exist.ce6d0dbrenamedglm-5.2→glm-5.3,gpt-5.5-pro→gpt-5.6-solandclaude-opus-4.7→claude-opus-5inMODELS, but leftMARKETuntouched.deepseek-v4-flashalso still carried a 7.2x-scaled USD price (1.008 / 2.016) instead of the official CNY price, andglm-5.3kept a stalepeak: trueflag even though it has no peak price in config.Why (B) is a real defect and not a matter of taste:
ui/js/app.js:737-739resolves a guest row's max-token cell by model name:The two tables are designed to agree on names. With the names renamed away, that lookup missed for three of the seven guest rows and the cell fell back to "not published" instead of the max output. Guest mode is reachable from the login page ("先逛逛市场" → guest browse →
#view-marketplace, which is rendered fromD.MARKETbecause/api/modelsis only fetched insideloadSession()).Changes
gemini-3.5-flash-literow fromMODELS— it exists nowhere else.deepseek-v4-flash-vision-exprow (present in config and seeded into the database, absent from this fallback) with its config pricing andmax_output.MARKETrows: 3 renamed models and thedeepseek-v4-flashprice.3.0/9.0) rather than the derived2.016/4.032, and drop the stalepeakflag fromglm-5.3.ui/index.html(?v=20260911-14→?v=20260911-15, 5 refs) so the changed file is refetched.All values are derived from
config/config.example.toml, converting USD prices withCNY_PER_USD(src/billing.rs:22). The 13 otherMODELSrows were already exact and are untouched;PLANSis unchanged (its 12 ids already match config).Related Issue
None — no issue is open for this. It was found by comparing the two tables directly.
Tests
cargo test— 155 passed, 0 failedcargo fmt --check— cleancargo clippy --all-targets -- -D warnings— cleannode --check ui/js/data.js— the edited file still parsesui/package.jsondoes not exist), so a guard for this table-to-config correspondence would have to be hand-written in Rust, assrc/i18n_pack.rsdoes for the language packs. I deliberately kept this PR to the data fix; adding such a gate is a separate, larger change (and a gate must not land while the data it checks is still wrong).Verification (beyond the suite)
Two independent checks, both run against the real files:
config.example.tomlas sets and as fields:MODELSset difference empty, 0 field drifts, all 7MARKETrows matching on name and price, peak values matching config, and nopeakflag on a model without peak pricing.ui/js/data.jsin avmand executes the exact lookupapp.js:737-739uses. Result: 5 failures before this change → 0 after.The probes are proven able to fail, not merely green: re-injecting the phantom model, restoring the stale
MARKETprice, and restoring a renamed-away model each turned the check red, and the file was then restored withcpand verified by md5.Checklist
fix/)fix(ui): …)