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": [