From e918aa6c4b7c469e24fed7ed7416c88822212160 Mon Sep 17 00:00:00 2001 From: yetone Date: Mon, 9 Nov 2026 06:42:10 +0800 Subject: [PATCH] doubao-work 0.1.1: plain model names, text-only input MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit magpie shows a model as " · ", so "豆包工作 · 自动" read "豆包工作 · 自动 · 豆包工作" in pi. The names are now Doubao's menu names. The models gave no modalities, so magpie asked models.dev about "auto", another vendor's model, and told pi it takes images and a thinking level map. Each model now says text in, text out. Run: bun test packages/doubao-work on mote (with check.mjs), Linux (WSL) and Windows: 25 pass, 0 fail. The new assertions fail on 0.1.0's names. --- packages/doubao-work/doubao-work.test.mjs | 4 ++++ packages/doubao-work/doubao.mjs | 6 +++--- packages/doubao-work/index.mjs | 12 +++++++++++- packages/doubao-work/package.json | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/doubao-work/doubao-work.test.mjs b/packages/doubao-work/doubao-work.test.mjs index 75eb01a..343c262 100644 --- a/packages/doubao-work/doubao-work.test.mjs +++ b/packages/doubao-work/doubao-work.test.mjs @@ -326,6 +326,10 @@ test("the plugin serves chat completions through Doubao, whole and streamed", as const cfg = {} await p.config(cfg) expect(Object.keys(cfg.provider["doubao-work"].models)).toEqual(["auto", "doubao-2.1-lite", "doubao-2.1-pro"]) + for (const m of Object.values(cfg.provider["doubao-work"].models)) { + expect(m.name).not.toContain("豆包工作") + expect(m.modalities.input).toEqual(["text"]) + } const loader = await p.auth.loader(async () => ({})) const whole = await (await loader.fetch(req({ model: "doubao-2.1-lite", messages: [{ role: "user", content: "hello" }] }))).json() expect(whole.choices[0].message.content).toBe("Hi there") diff --git a/packages/doubao-work/doubao.mjs b/packages/doubao-work/doubao.mjs index 4b9252a..184cb14 100644 --- a/packages/doubao-work/doubao.mjs +++ b/packages/doubao-work/doubao.mjs @@ -13,9 +13,9 @@ import { App, Page, sleep } from "./cdp.mjs" export const CHAT = "doubao-chat/chat" export const MODELS = { - auto: { label: "自动", name: "豆包工作 · 自动" }, - "doubao-2.1-lite": { label: "豆包 2.1 Lite", name: "豆包工作 · 豆包 2.1 Lite" }, - "doubao-2.1-pro": { label: "豆包 2.1 Pro", name: "豆包工作 · 豆包 2.1 Pro" }, + auto: { label: "自动", name: "自动" }, + "doubao-2.1-lite": { label: "豆包 2.1 Lite", name: "豆包 2.1 Lite" }, + "doubao-2.1-pro": { label: "豆包 2.1 Pro", name: "豆包 2.1 Pro" }, } export function binary(platform = process.platform) { diff --git a/packages/doubao-work/index.mjs b/packages/doubao-work/index.mjs index 0161926..72b4de0 100644 --- a/packages/doubao-work/index.mjs +++ b/packages/doubao-work/index.mjs @@ -15,10 +15,20 @@ const BASE = "https://doubao-work.invalid/v1" const json = (status, message, type) => new Response(JSON.stringify({ error: { message, type } }), { status, headers: { "Content-Type": "application/json" } }) +// models are named as Doubao's menu names them: magpie adds the +// provider's name. Each says it takes text only, or magpie would ask +// models.dev about another vendor's model of the same id ("auto"). function models() { const out = {} for (const [id, m] of Object.entries(MODELS)) - out[id] = { name: m.name, limit: { context: 256000, output: 32768 }, tool_call: true, reasoning: true, attachment: false } + out[id] = { + name: m.name, + limit: { context: 256000, output: 32768 }, + tool_call: true, + reasoning: true, + attachment: false, + modalities: { input: ["text"], output: ["text"] }, + } return out } diff --git a/packages/doubao-work/package.json b/packages/doubao-work/package.json index 2c20caf..98753e1 100644 --- a/packages/doubao-work/package.json +++ b/packages/doubao-work/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-doubao-work-auth", - "version": "0.1.0", + "version": "0.1.1", "type": "module", "main": "./opencode.mjs", "files": [