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.
This commit is contained in:
MYCF711
2026-10-29 02:43:18 +08:00
committed by GitHub
parent 744e1e26f3
commit f968917875
4 changed files with 98 additions and 2 deletions
+8
View File
@@ -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.
@@ -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"])
}
})
+11 -1
View File
@@ -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,
}
+1 -1
View File
@@ -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",