doubao-work 0.1.1: plain model names, text-only input

magpie shows a model as "<name> · <provider>", 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.
This commit is contained in:
yetone
2026-11-09 06:42:10 +08:00
parent 29ceed20c9
commit e918aa6c4b
4 changed files with 19 additions and 5 deletions
@@ -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")
+3 -3
View File
@@ -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) {
+11 -1
View File
@@ -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
}
+1 -1
View File
@@ -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": [