Repository navigation
feat(market): show and fix the default quant - one family only, never the lowest tier - #246
Merged
Merged
Conversation
…o the lowest tier The market row downloads exactly ONE quant family (all its shards, never every variant), but the collapsed row gave no hint which one, and the fallback rule was wrong: with no whitelist match it took the alphabetically first complete family - in a repo shipping Q2_K/Q3_K_M/Q4_0/Q6_K/Q8_0 that is Q2_K, the worst-quality tier, silently. Changes: - features/settings/utils/quantPick.ts (new, pure + unit tested): preference order over quant families - nearest level to 4 first, then the in-level variant (K_M > K_XL > K_L > K_S > K > K_XS > _0), then the higher level on a tie; pickDefaultQuant() only considers complete families (shards present) - LocalModelMarket: the collapsed row now shows the family the button will fetch and its size (e.g. "Q4_K_M . 5.4 GB", tooltip lists the files). The repo file list is prefetched when the row enters the viewport (IntersectionObserver, 400px margin, concurrency 2) so this needs no click - the "recommended" badge now marks the family that is actually downloaded (before, every whitelist match got a badge, disagreeing with the button), the expanded list sorts by the same order, and the row gained an expand chevron (reuses the existing chevron-down icon) - both docs: a "quant variants" bullet in zh/en usage/providers-and-models.md - CHANGELOG: Unreleased entry Behaviour change: the default family can differ from older builds - those could land on Q2_K-class tiers, this always prefers the Q4 sweet spot. Verification: npm run verify green (i18n 1195 keys, docs 37 files, gates rgba=173/any=77 held, prettier/eslint/tsc, 103 FE tests (+10), vite build; cargo fmt + clippy -D warnings + 473 Rust tests). Row layout measured in headless Edge against the real compiled CSS: chip and download button share a vertical center, no horizontal overflow.
…ial-redos) The PR's CodeQL run failed on src/features/settings/utils/quantPick.ts with "Inefficient regular expression": the continuation class [a-z0-9_] also accepted the '-' / '_' separators, so the separator and the repetition could each consume the same character - a name like q0_0_0_0_... has exponentially many ways to split, and family ids come from a remote repo listing (untrusted). Excluding '-' and '_' from the continuation class makes the repetition unambiguous; a 4 kB pathological id now resolves in 0 ms and the documented naming forms (Q4_K_M, IQ4_XS, UD-Q4_K_XL, ggml-model-q4_k_m, Model.Q4_K_M, bf16/fp16/int8) still extract correctly (10 unit tests unchanged). Verification: npm run check:frontend green (gates rgba=173/any=77 held, prettier/eslint/tsc, 103 FE tests, vite build).
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.
问题(用户反馈)
「本地模型需要点一下才知道具体量化版本,不点开直接下载,默认下载的是哪个版本?还是所有版本都下了?」
旧行为的事实:
q4_k_m/q4_k_s/q5_k_m/iq4_xs/ud-q4_k_xl)且分片完整的家族里按名字取第一个」,一个都没命中时退化为「按名字第一个完整家族」。顺带查出的真实缺陷
退化路径是错的:只出
Q2_K / Q3_K_M / Q4_0 / Q6_K / Q8_0的仓库,字母序最靠前的是Q2_K—— 质量最差的那一档,用户下载完才发现。另外命中多个白名单时,展开列表会同时挂好几个「推荐量化」徽标,和一键下载的实际选择不一致。改动
① 规则(
features/settings/utils/quantPick.ts,新增纯函数 + 10 项单测)在分片完整的家族中选「最接近 Q4_K_M」的一档:
K_M>K_XL/XXL>K_L>K_S>K>XS/NL>_0UD-Q4_K_XL、ggml-model-q4_k_m、Model.Q4_K_M、bf16/fp16/int8等命名② 可见性(折叠行直接告诉你会下哪个)
Q4_K_M · 5.4 GB(悬停显示将下载的文件名列表)IntersectionObserver,rootMargin400px,并发 2 + 内存缓存),不展开就能看到,也不会一次打满几十个请求(点击下载本来就要打同样的接口)③ 一致性与可发现性
推荐量化徽标只标在真正会被下载的那一档(此前可同时出现多个)chevron-down图标,展开旋转 180°),点行体即展开量化列表文档:
docs/zh|en/usage/providers-and-models.md增补「量化版本」条目(双语同步)。行为变化
同一模型的一键下载结果可能与旧版本不同:旧版在白名单缺失时会落到 Q2_K 这类最低档,现在固定为 Q4 档优先。
验证
npm run verify全绿:i18n 1195 键、docs 37 文件、gatesrgba=173/any=77持平、prettier/eslint/tsc 干净、103 前端测试(+10)、vite build;cargo fmt + clippy-D warnings+ 473 Rust 测试通过Fixes 用户反馈(本地模型默认量化版本不透明)