From f96891787552f3c68c850c68057ad21d274626c2 Mon Sep 17 00:00:00 2001 From: MYCF711 <1451895195@qq.com> Date: Thu, 29 Oct 2026 02:43:18 +0800 Subject: [PATCH] qoder 0.2.47: every model a site ships says whether it takes images (#470) Every model a site ships now sets attachment and modalities.input either way, so a text-only model (QwenWork's three, Qoder CN's Lite) no longer falls back to models.dev's vote by bare model id. Run at 20043420a48079429896d861b33f2140261cf1df, on mote: HOME=$(mktemp -d) bun test in packages/qoder, 311 pass, 0 fail. Broken by hand (attachment: true for every model): config-capabilities.test.mjs goes 0 pass / 2 fail. Checked: QWORK_FALLBACK_LISTING marks all three QwenWork models is_vl: false, so text-only matches the vendor's listing. A signed-in account's own listing (is_vl) still takes over from the shipped list. Not tried: a real Qoder CN account's Lite with an image. --- packages/qoder/README.md | 8 +++ packages/qoder/config-capabilities.test.mjs | 78 +++++++++++++++++++++ packages/qoder/index.mjs | 12 +++- packages/qoder/package.json | 2 +- 4 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 packages/qoder/config-capabilities.test.mjs diff --git a/packages/qoder/README.md b/packages/qoder/README.md index 0a0ae43..d94c739 100644 --- a/packages/qoder/README.md +++ b/packages/qoder/README.md @@ -208,6 +208,14 @@ app's Fast from 2026-10-12: Every model speaks chat completions (`@ai-sdk/openai-compatible`). +Every model a site ships also says, either way, whether it takes images: +`attachment` and `modalities.input` are set on every `config` entry, image +or no image. A kind left out is not "text only" to magpie but "the vendor +didn't say", and magpie then falls back to models.dev's vote by bare model +ID — where a same-named model of another vendor may take images, so this +one gets sent them. QwenWork's three models and Qoder CN's Lite shipped no +image key; since 0.2.47 they say text alone. + ## Qoder CN `qoder-cn` is for accounts on [qoder.cn](https://qoder.cn), the China site. diff --git a/packages/qoder/config-capabilities.test.mjs b/packages/qoder/config-capabilities.test.mjs new file mode 100644 index 0000000..4df61cb --- /dev/null +++ b/packages/qoder/config-capabilities.test.mjs @@ -0,0 +1,78 @@ +// Every model a site ships says whether it takes images — either way. +// +// A kind left out is not "text only" to magpie: it is "the vendor didn't +// say", and magpie then falls back to models.dev's vote by bare model id, +// where a same-named model of another vendor that takes images licenses +// sending them to this one. The shipped list is what magpie has before +// anyone signs in, and what `provider.models` falls back to when a listing +// can't be fetched, so those entries are the ones most likely to be asked +// for an image — and the ones with nothing to answer with. +// +// Measured before the fix (magpie 0.1.1932): all three QwenWork models and +// all three of its enterprise sibling's were `imageSaid: false` in +// ~/.cache/magpie/plugin-providers.json, i.e. magpie had to guess. The same +// omission in codearts 0.2.3 sent 161 screenshots to a model that answers +// `InferHub.001001020.406` "The request model is not multimodal". +import { test, expect } from "bun:test" + +import { + QoderAuthPlugin, + QoderCNAuthPlugin, + QwenWorkAuthPlugin, + QwenWorkEnterpriseAuthPlugin, +} from "./index.mjs" + +const client = { + app: { log: async () => {} }, + auth: { set: async () => {} }, + tui: { showToast: async () => {} }, + config: { get: async () => ({ data: {} }) }, +} +const load = (fn) => fn({ client, directory: process.cwd(), worktree: process.cwd(), $: undefined, project: {} }) + +const SITES = [ + ["qoder", QoderAuthPlugin], + ["qoder-cn", QoderCNAuthPlugin], + ["qwenwork", QwenWorkAuthPlugin], + ["qwenwork-enterprise", QwenWorkEnterpriseAuthPlugin], +] + +test("every model a site ships says, either way, whether it takes images", async () => { + for (const [id, fn] of SITES) { + const plugin = await load(fn) + const cfg = {} + await plugin.config(cfg) + const models = Object.entries(cfg.provider[id]?.models ?? {}) + expect(models.length, `${id}: the config hook lists models`).toBeGreaterThan(0) + for (const [key, m] of models) { + const where = `${id}/${key}` + expect(Array.isArray(m.modalities?.input), `${where}: modalities.input is a list`).toBe(true) + expect(m.modalities.input.includes("text"), `${where}: takes text`).toBe(true) + expect( + m.attachment, + `${where}: attachment matches modalities.input (${JSON.stringify(m.modalities.input)})`, + ).toBe(m.modalities.input.includes("image")) + } + } +}) + +test("a model that takes images says so, one that doesn't says text alone", async () => { + // qoder's list is all vision (MODELS maps images: true onto every entry) + const qoder = await load(QoderAuthPlugin) + const qoderCfg = {} + await qoder.config(qoderCfg) + for (const m of Object.values(qoderCfg.provider.qoder.models)) { + expect(m.attachment).toBe(true) + expect(m.modalities.input).toEqual(["text", "image"]) + } + + // QwenWork ships no image key, so every one of its models is text only + const qwenwork = await load(QwenWorkAuthPlugin) + const qwCfg = {} + await qwenwork.config(qwCfg) + for (const m of Object.values(qwCfg.provider.qwenwork.models)) { + expect(m.attachment).toBe(false) + expect(m.modalities.input).toEqual(["text"]) + expect(m.modalities.output).toEqual(["text"]) + } +}) diff --git a/packages/qoder/index.mjs b/packages/qoder/index.mjs index 02c66ba..8fb9bf4 100644 --- a/packages/qoder/index.mjs +++ b/packages/qoder/index.mjs @@ -674,10 +674,20 @@ async function fetchListing(site, cred) { } function configModel(m) { + const images = !!m.images return { name: m.name, limit: { context: m.context ?? 0, output: 0 }, - ...(m.images ? { attachment: true, modalities: { input: ["text", "image"], output: ["text"] } } : {}), + // Said either way, image or no image. A kind left out is not "text only" + // to magpie: it is "the vendor didn't say", and magpie then falls back to + // models.dev's vote by bare model id — where a same-named model of + // another vendor may take images, so a text-only one here is sent them + // (the same mistake codearts 0.2.3 made, fixed there in 0.2.4). The list + // a site ships is what magpie has before anyone signs in, and what it + // keeps when a listing can't be fetched (provider.models falls back to + // it), so those models are the ones most likely to be asked for an image. + attachment: images, + modalities: { input: images ? ["text", "image"] : ["text"], output: ["text"] }, ...(m.efforts?.length ? { reasoning: true, variants: Object.fromEntries(m.efforts.map((e) => [e, { reasoningEffort: e }])) } : {}), tool_call: true, } diff --git a/packages/qoder/package.json b/packages/qoder/package.json index 0fe67d4..41d7e69 100644 --- a/packages/qoder/package.json +++ b/packages/qoder/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-qoder-auth", - "version": "0.2.46", + "version": "0.2.47", "description": "Qoder and QwenWork (千问办公) subscriptions in OpenCode and magpie: qoder.com, qoder.cn, gateway.qwenwork.cn and the enterprise flagship (VPC)", "type": "module", "main": "./index.mjs",