loomy 0.1.7: deepseek-v4-flash-1017 keeps its image_url parts; only the old DeepSeek line gets the base64 marker (#1139)
prefersTagFormat exempted only ids spelling v4.1 / v4-1, so deepseek-v4-flash-1017, which reads OpenAI image_url parts, had its images turned into <image_base64> text and never saw them (7,368 prompt tokens against 232, per the reporter's side-by-side). The marker is now for deepseek-v4-flash and deepseek-v4-flash-0731 only, the ids it was made for; any other DeepSeek id keeps OpenAI's shape, since Loomy renames them freely and the newer ones take image_url. Run (mica, sandbox HOME): bun test packages/loomy 32 pass; scripts/check.mjs loomy ok. Broken by hand: main's index.mjs fails "which models get the base64 marker" on the 1017 ids. Not tried: a real Loomy request (the reporter's table is the evidence).
This commit is contained in:
@@ -15,7 +15,7 @@ magpie plugin login loomy # 选「短信验证码登录」或「手动粘贴
|
||||
|
||||
- **登录**:`短信验证码登录`(发码 → 输入 6 位码完成,session **14 天**)或 `手动粘贴 session`。
|
||||
- **无续期接口**:session 过期(业务码 `020002`/`100002`)需重新登录(短信或粘贴)。
|
||||
- **聊天**:`POST {modelBase}/chat/completions`,OpenAI 形态基本透传,两处适配(参照实现 `reasoning_patch` / `images.rs`):思考档折进 low/medium/high(超档删除)、旧版 DeepSeek(deepseek-v4-flash-0731)的 data-URI 图片转 `<image_base64>` 标记(DeepSeek-V4.1-Flash 收 OpenAI `image_url`,不转,#811);SSE;请求头必须带 `charset=utf-8`(上游对无 charset 的 body 按 GBK 解码)。
|
||||
- **聊天**:`POST {modelBase}/chat/completions`,OpenAI 形态基本透传,两处适配(参照实现 `reasoning_patch` / `images.rs`):思考档折进 low/medium/high(超档删除)、旧版 DeepSeek(deepseek-v4-flash-0731)的 data-URI 图片转 `<image_base64>` 标记(只有 deepseek-v4-flash / -0731;DeepSeek-V4.1-Flash 和 deepseek-v4-flash-1017 收 OpenAI `image_url`,不转,#811、#1139);SSE;请求头必须带 `charset=utf-8`(上游对无 charset 的 body 按 GBK 解码)。
|
||||
- **画图**:`POST {modelBase}/images/generations`(doubao-seedream-5-lite / qwen-image-3.0-pro / Hy-Image-3.5-preview),body 按 magpie 写的原样透传,`Accept: application/json`(不是 SSE),回答是普通 JSON(`data[].url`、`points_consumed`)。401/403 报登录失效。`/images/edits`(改图)暂不转发:magpie 发给插件的改图是 multipart,Loomy 网关收不收这种改图没有实测过(#609)。
|
||||
- **模型**:登录前给静态表(2026-10-16 实抓 `/api/v1/models` 的 chat 模型:DeepSeek-V4.1-Flash / deepseek-v4-flash-0731 / MiniMax-M3 / Kimi-k2.6 / qwen-3.8-max / GLM-5.3-Flash / qwen3.8-flash / spark-x / mimo-v2.5 / auto),登录后以 `GET /api/v1/models` 的实时目录为准(能力位读 `capabilities`;展示名尾部倍率 `(x3.0)` 拆为 rate 字段)。
|
||||
- **余额(usage)**:`GET /api/v2/points/records?...` → 永久积分 + 每日赠送积分两个窗口;每日窗口用厂商自己的 `dailyLimitPoints`/`dailyRemainingPoints` 报「已用/剩余/上限」,厂商未带这一对时按无上限的余额展示(不编造上限)。响应缺余额字段时报 error("未知"不冒充 0)。路由读的是两者合计的「积分合计」窗口(已用 = 每日已用,上限 = 已用 + 每日剩余 + 永久积分),两个钱包作为 aside 并列展示:每日积分用完、永久积分还有时账号仍可路由;每日剩余积分在北京时间零点失效,用 `runsOutAt`/`runsOut` 报出,让路由先花掉它们。
|
||||
|
||||
@@ -270,11 +270,12 @@ function foldReasoning(body) {
|
||||
// data-URI images are turned into the marker and merged into the text before
|
||||
// them (agent2api images.rs). DeepSeek-V4.1-Flash takes image_url parts and
|
||||
// reads the marker as plain text (10k prompt tokens, an empty reply), so it
|
||||
// keeps the parts as sent (plugins#811)
|
||||
// keeps the parts as sent (plugins#811), and so does deepseek-v4-flash-1017
|
||||
// (plugins#1139). Loomy renames these freely, so only the old line the marker
|
||||
// was made for gets it; any other DeepSeek id keeps OpenAI's shape.
|
||||
function prefersTagFormat(model) {
|
||||
const m = String(model ?? "").toLowerCase()
|
||||
if (!m.includes("deepseek")) return false
|
||||
return !/v4[.-]1(?![0-9])/.test(m)
|
||||
const m = String(model ?? "").toLowerCase().replace(/^.*\//, "")
|
||||
return /^deepseek-v4-flash(?:-0731)?$/.test(m)
|
||||
}
|
||||
function toTagText(part) {
|
||||
const kind = String(part?.type ?? "").trim().toLowerCase()
|
||||
|
||||
@@ -157,6 +157,10 @@ describe("chat", () => {
|
||||
expect(_internal.prefersTagFormat("deepseek-v4.1-flash")).toBe(false)
|
||||
expect(_internal.prefersTagFormat("deepseek-v4-flash-0731")).toBe(true)
|
||||
expect(_internal.prefersTagFormat("deepseek-v4-flash")).toBe(true)
|
||||
expect(_internal.prefersTagFormat("loomy/deepseek-v4-flash-0731")).toBe(true)
|
||||
// plugins#1139: 1017 reads image_url parts (232 vs 7,368 prompt tokens)
|
||||
expect(_internal.prefersTagFormat("deepseek-v4-flash-1017")).toBe(false)
|
||||
expect(_internal.prefersTagFormat("DeepSeek-V4-Flash-1017")).toBe(false)
|
||||
expect(_internal.prefersTagFormat("GLM-5.3-Flash")).toBe(false)
|
||||
expect(_internal.prefersTagFormat(undefined)).toBe(false)
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/opencode-loomy-auth",
|
||||
"version": "0.1.6",
|
||||
"version": "0.1.7",
|
||||
"description": "OpenCode & Magpie provider plugin for Loomy (讯飞, loomyad.xunfei.cn): SMS sign-in, chat, models, the two point wallets and the daily first-login grant",
|
||||
"type": "module",
|
||||
"main": "./opencode.mjs",
|
||||
|
||||
Reference in New Issue
Block a user