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",