commandcode 0.1.8: a model of the plan takes pictures as its maker's models do, not none of them (ARNO on magpie 0.1.810, Discord: command code provider 的所有模型都没有自动勾上支持图片输入) — Command Code's /provider/v1/models gives no modalities (all 86 entries, testdata/models.json and the live list read from a moved account's plugin-providers.json alike), and runtimeModel always set capabilities.input.image to !!m.images, false for every model, which magpie's plugin host reads as the plugin's answer (host.js: imageSaid when the value is a boolean) and takes over models.dev's. So every model of a moved plan, Claude, GPT-6, Kimi K3 and Qwen 3.8 included, showed no image input, where the built-in (whose list said nothing either) answered from models.dev (catalog.SeesImages). runtimeModel now says image only when m.images is a boolean; liveModels takes the list's modalities when it gives them, else the default list's answer (which now marks Claude Sonnet 5, Opus 5.5, GPT-6 Sol, Kimi K3 and MiniMax M3, as models.dev has them; DeepSeek V4 and GLM-5.3 read text alone and say nothing), else the CLI's table's (GO_MODELS, Pixel Canary among them), else true for a Claude model, and of any other says nothing, so magpie answers from models.dev as the built-in did (DeepSeek V4, GLM-5.x, MiniMax M2.x, Hy4 and the rest models.dev calls text-only stay without). A list that gives modalities is taken at its word, an explicit text-only included (the old || undefined dropped it). Go's goModels is unchanged but no longer says false for a model the table doesn't mark. models.test.mjs gains a test (a Pro account's 86 models: known image models say true, the rest leave image unsaid, a list's own modalities win, Go keeps the table's); it fails on 0.1.7 and passes. HOME=$(mktemp -d) bun test (459 pass) and bun scripts/check.mjs commandcode pass. Not tried in a real OpenCode/magpie session with the new version; magpie needs the mover's min raised to 0.1.8 for moved users to get it.

This commit is contained in:
yetone
2026-10-04 12:04:57 +08:00
parent b5fc67f0f4
commit b2ddbc5017
4 changed files with 75 additions and 10 deletions
+21 -9
View File
@@ -34,16 +34,17 @@ const RESPONSES = "@ai-sdk/openai" // the Responses API, which magpie speaks to
// ---- models -------------------------------------------------------------------
// The plan's models when its list can't be asked: Claude on Messages, the
// rest on chat completions.
// rest on chat completions. Pictures as models.dev has them (DeepSeek V4
// and GLM-5.3 read text alone, so say nothing).
const MODELS = [
{ id: "claude-sonnet-5", name: "Claude Sonnet 5", context: 1_000_000 },
{ id: "claude-opus-5-5", name: "Claude Opus 5.5", context: 1_000_000 },
{ id: "gpt-6-sol", name: "GPT-6 Sol", context: 1_050_000 },
{ id: "claude-sonnet-5", name: "Claude Sonnet 5", context: 1_000_000, images: true },
{ id: "claude-opus-5-5", name: "Claude Opus 5.5", context: 1_000_000, images: true },
{ id: "gpt-6-sol", name: "GPT-6 Sol", context: 1_050_000, images: true },
{ id: "deepseek/deepseek-v4-pro", name: "DeepSeek V4 Pro", context: 1_000_000 },
{ id: "deepseek/deepseek-v4-flash", name: "DeepSeek V4 Flash", context: 1_000_000 },
{ id: "moonshotai/Kimi-K3", name: "Kimi K3", context: 1_000_000 },
{ id: "moonshotai/Kimi-K3", name: "Kimi K3", context: 1_000_000, images: true },
{ id: "zai-org/GLM-5.3", name: "GLM-5.3", context: 1_000_000 },
{ id: "MiniMaxAI/MiniMax-M3", name: "MiniMax M3", context: 1_000_000 },
{ id: "MiniMaxAI/MiniMax-M3", name: "MiniMax M3", context: 1_000_000, images: true },
]
// The models the Go plan is let use, as the CLI's own table has it
@@ -155,9 +156,14 @@ function configModel(m) {
}
// runtimeModel is a model as OpenCode's provider.models hook returns it.
// Whether it takes pictures is said only when known (m.images a boolean):
// Command Code's list doesn't say, and a false said for every model
// unknown is taken by magpie as the plan's answer, over models.dev's,
// which the built-in asks for a model its list says nothing of
// (yetone/magpie: every model of the plan without image input).
function runtimeModel(m) {
const npm = m.npm ?? (isClaude(m.id) ? MESSAGES : CHAT)
const input = { text: true, image: !!m.images, audio: false, video: false, pdf: false }
const input = { text: true, ...(typeof m.images === "boolean" ? { image: m.images } : {}), audio: false, video: false, pdf: false }
return {
id: m.id,
providerID: ID,
@@ -185,16 +191,22 @@ function runtimeModel(m) {
// liveModels is the Provider API's list, with the APIs each model is
// served on (its Claude models on /messages alone, the open ones on
// /chat/completions and /responses, some on /responses alone); the default list's names and
// windows fill in what it leaves out.
// windows fill in what it leaves out. The list says nothing of pictures:
// a model takes them as the default list or the CLI's table (GO_MODELS)
// says, and every Claude model does; of any other nothing is said, and
// magpie answers from models.dev.
async function liveModels(key) {
const res = await fetch(BASE + "/models", { headers: { Authorization: `Bearer ${key}`, "x-api-key": key } })
if (!res.ok) throw new Error(`models: ${res.status}`)
const body = await res.json()
const known = Object.fromEntries(MODELS.map((m) => [m.id, m]))
const table = Object.fromEntries(GO_MODELS.map((m) => [m.id, m]))
const out = []
for (const m of body?.data ?? []) {
if (!m?.id) continue
const k = known[m.id]
let images = Array.isArray(m.modalities?.input) ? m.modalities.input.includes("image") : undefined
if (images === undefined) images = k?.images ?? table[m.id]?.images ?? (isClaude(m.id) || undefined)
const eps = (m.supported_endpoints ?? []).map((e) => String(e).replace(/\/$/, "").replace(/^\/v1/, ""))
let npm = isClaude(m.id) ? MESSAGES : CHAT
// the first of the APIs it is served on, in magpie's order (chat
@@ -205,7 +217,7 @@ async function liveModels(key) {
id: m.id,
name: m.name && m.name !== m.id ? m.name : m.display_name || k?.name || m.id,
context: Number.isFinite(ctx) && ctx > 0 ? ctx : k?.context ?? 0,
images: (m.modalities?.input ?? []).includes("image") || undefined,
images,
npm,
})
}