From aec58aec3305aae95391111e1bed8f54420b817d Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 1 Nov 2026 13:15:09 +0800 Subject: [PATCH] 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. --- packages/workbuddy/README.md | 6 ++++++ packages/workbuddy/freeonly.test.mjs | 17 +++++++++++++++++ packages/workbuddy/index.mjs | 11 +++++++++++ packages/workbuddy/package.json | 2 +- 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/packages/workbuddy/README.md b/packages/workbuddy/README.md index 4d6767a..8151822 100644 --- a/packages/workbuddy/README.md +++ b/packages/workbuddy/README.md @@ -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. diff --git a/packages/workbuddy/freeonly.test.mjs b/packages/workbuddy/freeonly.test.mjs index 7f80ee5..8664f63 100644 --- a/packages/workbuddy/freeonly.test.mjs +++ b/packages/workbuddy/freeonly.test.mjs @@ -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 } diff --git a/packages/workbuddy/index.mjs b/packages/workbuddy/index.mjs index 8338351..6e0a459 100644 --- a/packages/workbuddy/index.mjs +++ b/packages/workbuddy/index.mjs @@ -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) { diff --git a/packages/workbuddy/package.json b/packages/workbuddy/package.json index 882a47c..c4149c2 100644 --- a/packages/workbuddy/package.json +++ b/packages/workbuddy/package.json @@ -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",