workbuddy 0.2.10: "Free models only" in magpie's languages, and says it filters the list (#590)

anewuser6937 (Discord, #590) saw one model in WorkBuddy's editor and took
the plugin for broken: they had turned on "Free models only" themselves,
but its label and description read in English inside magpie's Chinese
window, and nothing by the models said the list was filtered.

The switch now gives its label and description in Chinese, Traditional
Chinese, Japanese and German (labels, descriptions, by magpie's window
language) and says filtersModels: true, so a magpie that knows these
fields says under the models that the list is filtered while it is on.
Both are magpie's own fields inside auth.options, which OpenCode
(AuthHook: provider, loader, methods) never reads; an older magpie's host
copies only key/label/description/default/confirm, so it shows the English
words as before. Nothing else changes: what the switch does is the same.

Run on mote: HOME=$(mktemp -d) bun test packages/workbuddy: 303 pass,
0 fail; bun scripts/check.mjs ok. The new freeonly test ("says its words
in magpie's languages, and that it filters the list", both sites) fails
2 of 2 with index.mjs put back. Loaded into magpie's real plugin host
(the magpie change beside it), plugin.Providers lists both sites' free_only
with all four languages and filtersModels true.
This commit is contained in:
yetone
2026-11-01 13:15:09 +08:00
parent 7a79949ccb
commit aec58aec33
4 changed files with 35 additions and 1 deletions
+6
View File
@@ -329,6 +329,12 @@ provider settings in magpie, off by default (#430). When it is on:
The price list is read again at most once a minute for requests.
The switch gives its label and description in magpie's other languages
(`labels`, `descriptions`: Chinese, Traditional Chinese, Japanese, German),
and says `filtersModels`, so while it is on magpie says under the models
that the list is filtered (#590). Both are magpie's own fields; an older
magpie shows the English words and no note.
## Credits in magpie
magpie's usage card shows the account's credits from the resource summary.
+17
View File
@@ -59,6 +59,23 @@ for (const [plugin, site, url] of [
expect(o.default).toBeUndefined()
})
// plugins#590 (anewuser6937): the switch read in English in magpie's
// Chinese window, and a one-model list looked broken. Its words come in
// each of magpie's languages, within magpie's caps (60 and 300), and it
// says the list leaves models out while it is on.
test(`${site}: says its words in magpie's languages, and that it filters the list`, async () => {
const h = await plugin({ client: {} })
const o = h.auth.options.find((x) => x.key === _internal.FREE_ONLY)
expect(o.filtersModels).toBe(true)
for (const lang of ["zh", "zh-TW", "ja", "de"]) {
expect(o.labels[lang].length).toBeGreaterThan(0)
expect(o.labels[lang].length).toBeLessThanOrEqual(60)
expect(o.descriptions[lang]).toContain(site === "workbuddy" ? "WorkBuddy" : "WorkBuddy AI")
expect(o.descriptions[lang].length).toBeLessThanOrEqual(300)
}
expect(o.labels.zh).toBe("仅免费模型")
})
test(`${site}: on, the list holds only the free models; off, all of them`, async () => {
serve()
const auth = { type: "api", key: KEY }
+11
View File
@@ -3387,6 +3387,17 @@ function makePlugin(site) {
key: FREE_ONLY,
label: "Free models only",
description: `Lists only the models ${site.name} serves at no cost, and turns away a request for any other here instead of sending it, so no credits are spent. A model free only at night counts as paid.`,
// the same words in magpie's other languages, and that the list
// leaves models out while it is on (plugins#590); magpie's own
// fields, which an older magpie and OpenCode leave alone
labels: { zh: "仅免费模型", "zh-TW": "僅免費模型", ja: "無料モデルのみ", de: "Nur kostenlose Modelle" },
descriptions: {
zh: `只列出 ${site.name} 免费提供的模型;其他模型的请求在这里就被拒绝、不会发出,因此不消耗积分。只在夜间免费的模型按付费算。`,
"zh-TW": `只列出 ${site.name} 免費提供的模型;其他模型的請求在這裡就被拒絕、不會送出,因此不消耗積分。只在夜間免費的模型以付費計。`,
ja: `${site.name} が無料で提供するモデルだけを表示し、ほかのモデルへのリクエストは送信せずここで断るので、クレジットを消費しません。夜間だけ無料のモデルは有料として扱います。`,
de: `Listet nur die Modelle, die ${site.name} kostenlos anbietet, und weist eine Anfrage an jedes andere hier ab, statt sie zu senden, sodass keine Credits verbraucht werden. Ein Modell, das nur nachts kostenlos ist, gilt als kostenpflichtig.`,
},
filtersModels: true,
},
],
async loader(getAuth) {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-workbuddy-auth",
"version": "0.2.9",
"version": "0.2.10",
"description": "OpenCode provider plugins for WorkBuddy's plans: WorkBuddy (CodeBuddy, copilot.tencent.com) and WorkBuddy AI (www.workbuddy.ai)",
"type": "module",
"main": "./index.mjs",