magpie icon indicating copy to clipboard operation
magpie copied to clipboard

免费座位被读成「已用 100% · 几乎用尽」:页面从不读 Weighed.Free

Open MYCF711 opened this issue 1 month ago • 2 comments

现象

Routing 页上,一个模型免费、且一直能答的座位,被画成最接近用完的那个。

我这边稳定复现:opencode-zen-free 的免费 DeepSeek。它的窗口是厂商自己的记账(credits 已用满),页面照着念,于是那一行写「已用 100% · 几乎用尽」,还带上 low(留到最后)。而它其实是池子里唯一永远能答的座位。

同一行还用过 --fg-2 的灰,那是「快要不行了」的语气:

改前(上游原样)  mycf711  [low]  "已用 100% · 几乎用尽"   rgb(75,75,83)
改后              mycf711  [free] "免费 · 不花额度"        rgb(28,28,33)

原因

网关知道这件事:Weighed.Free 就是为「按免费称重」的路由(Free first)填的,weighRouted 在 st.ByFree 时读 provider.FreeModel 得到每个候选是否免费。

但页面只在选择器的说明文字里读过它(MODES.free 的那段话),座位那一行从来没读。所以渲染时 w.free 有值却被忽略,只能按 w.known / w.used 去念厂商的窗口。

修复

分支:MYCF711/magpie 的 pr/free-seat(基于 de54b4ff,与其它分支互相独立)

  • 状态行:w.free 时说它不花额度,不说已用多少
  • low:免费座位不标「留到最后」—— 它没有会被用尽的额度,份额说明不了它能不能答
  • 配色:加 li.free,用正文色(--fg)。红色在这页上代表「用不了」,而免费座位从来不是

正在限流的免费座位仍然说它的限流、仍然是红的 —— 红色代表用不了,限流正是,与模型是否免费无关。所以 CSS 里 li.free.rest 仍然走红。

四种语言都补了词条(en / zh / zh-TW / ja / de)。

验证

Chromium、这份资产、同一个夹具跑两遍(改前 / 改后):

班级 状态行 颜色
改前 [low] 已用 100% · 几乎用尽 rgb(75,75,83)
改后 [free] 免费 · 不花额度 rgb(28,28,33)

同一批实测里:付费座位 95% 仍然照旧说「留到最后」;限流的免费座位仍然红。

附了 Playwright 测试 routing-free-seat.test.cjs(两种引擎 × 五种语言 × 两种宽度)。没跑 —— 这台机器没装 Playwright,所以上面那些是浏览器里读真实 DOM 得到的,不是 make test-ui 过的。

gofmt -l / 三平台 go vet / go build / GUI 脚本预算都过。

为什么不是一条评论

原来这条是跟在 #3749 的第 2 条评论里的。它和那个「成员被 roomy 落下」是两个不同的缺陷(一个漏记录、一个读错字段),修在不同的函数上,所以单独开一条,免得埋在评论里。

MYCF711 avatar Oct 26 '26 15:10 MYCF711

Fixed in b9ab17231, released as v0.1.1622 (building now). A seat serving a model its vendor gives away now says "free · costs nothing" on the Routing page and draws no bar. A resting free seat still shows its rest, and a paid seat next to it still shows its share.

Thanks for the patch @MYCF711. Your fixture used free seats with no routing, which the gateway never sends: .free is set only under a routing that weighs by it, so a real free seat read "100% used" with a full bar, not "几乎用尽". The test is built on that real shape. I left out the green colour and the low change (no real free seat reaches it). Your German string would also have failed your own test's /verbraucht/ check. You're credited as co-author.

I'm leaving this open until you confirm it reads right on your setup.

yetone avatar Oct 26 '26 17:10 yetone

Confirmed on my setup — it reads right. Closed.

Built origin/main at 8f023b51 (v0.1.1623, which carries b9ab1723) and ran it against a copy of my config with XDG_CONFIG_HOME/XDG_CACHE_HOME pointed at the copy, so the instance I use daily was untouched. Then sent one real request through that gateway to a group that routes free first, which is what makes the gateway fill .free at all (routing.go:1597, only under st.ByFree), and opened the Routing page in a browser.

What the page does now, in zh:

  • the four seats the trace carries as free: true show 「免费 · 不花额度」 and their row is class="nobar" — no bar, no percentage.
  • a paid seat beside them still shows its share (「已用 75%」 and its bar), and the one that is resting still says its rest first (「额度用尽 · 58 分钟后恢复」).

Both points in your message are right, and they were the ones I had wrong: .free does arrive only with a routing that weighs by it, so my fixture described a shape the gateway never sends, and my German string did fail /verbraucht/. Building the case on the real shape was the fix.

One thing worth knowing for whoever reads this next, not a defect: FreeModel (models.go:1697) also answers free when a model's four prices are all 0, not only when the plugin lists it free. So a seat serving a model whose plugin declares input: 0, output: 0 reads 「不花额度」 even under a paid subscription tier — that's two of my four free seats here (qoder/dfmodel, under a personal_standard account). The word is accurate for what the vendor charges; the account's own windows are what the other models on it draw from, which is exactly the confusion this issue was about.

Thanks for taking it, and for the co-author credit.

MYCF711 avatar Oct 26 '26 17:10 MYCF711