diff --git a/packages/astudio/README.md b/packages/astudio/README.md index a84c152..acf67b8 100644 --- a/packages/astudio/README.md +++ b/packages/astudio/README.md @@ -49,9 +49,12 @@ same daily points balance. | `xopglm52` | GLM-5.2 | 1M | | | `xopdeepseekv4pro0813` | DeepSeek-V4-Pro | 1M | | | `xopdsv4flash0731in` | DeepSeek-V4-Flash | 1M | | +| `xdeepseek-flash-in` | DeepSeek-V4.1-Flash | 1M | 目录接口未返回,插件内补位 | 思考档位(none / high / max,随模型)映射为 magpie 的推理档位;上游字段变化以实时目录为准。 +目录接口会滞后于桌面端自己的目录:网关已经能调、目录还没列出来的模型,由插件内置的补位表(`EXTRA_CATALOG`)补上,当前即 `xdeepseek-flash-in`(2026-11-13 直调 `/model-gateway/v1/responses` 返 200,同刻目录仍只给 7 个)。目录一旦列出同名 slug 就改用目录那一行;目录把它标成 `hidden` 或 `supported_in_api: false` 视为下架,补位表不复活它。 + ## 每日签到(每日登录积分) AStudio 有「每日登录积分」:账号面 `client-popups/pending` 里的 `DAILY_REWARD_DIALOG` 是**待领取的每日奖励**,桌面端点「知道了」时发 `POST client-popups/complete`,服务端随后记一笔「每日登录赠送」GRANT 流水(体验版 100 分/天,标准版 200,高级/畅享 400;活动期 31 天有效)。 diff --git a/packages/astudio/index.mjs b/packages/astudio/index.mjs index bdd44a4..728d638 100644 --- a/packages/astudio/index.mjs +++ b/packages/astudio/index.mjs @@ -79,6 +79,28 @@ const BOOTSTRAP = [ { id: "xopglm52", name: "GLM-5.2", context: 1048576, output: 32768 }, { id: "xopdeepseekv4pro0813", name: "DeepSeek-V4-Pro", context: 1048576, output: 32768 }, { id: "xopdsv4flash0731in", name: "DeepSeek-V4-Flash", context: 1048576, output: 32768 }, + // 与 EXTRA_CATALOG 同步:目录接口没上这个模型时,网络故障分支也要能列出来。 + { id: "xdeepseek-flash-in", name: "DeepSeek-V4.1-Flash", context: 1048576, output: 100000 }, +] + +// 目录接口(model-manager/models)滞后于桌面端目录时,网关已接受、目录里还没露面的模型在 +// 此补位。2026-11-13 实测:xdeepseek-flash-in 直调 /model-gateway/v1/responses 返 200, +// 同一时刻目录只给 7 个(桌面端自己的 catalog 已有 8 个)。上游补齐后删掉对应条目即可。 +const EXTRA_CATALOG = [ + { + slug: "xdeepseek-flash-in", + display_name: "DeepSeek-V4.1-Flash", + context_window: 1048576, + max_output_tokens: 100000, + input_modalities: ["text"], + supported_in_api: true, + visibility: "list", + supported_reasoning_levels: [ + { effort: "none", description: "关闭思考" }, + { effort: "high", description: "高强度思考" }, + { effort: "max", description: "最大强度思考" }, + ], + }, ] // 星火系列模型:目录 id 以 spark- 打头(启动表 Spark-X2.6 / Spark-X2.6-Lite / @@ -921,12 +943,16 @@ function createPlugin({ fetchImpl = globalThis.fetch, env = process.env, homedir if (!Array.isArray(list) || list.some((m) => typeof m?.slug !== "string" || !m.slug)) { throw new Error("AStudio 模型目录格式异常") } + const catalogSlugs = new Set(list.map((m) => m.slug)) const rows = Object.fromEntries( list .filter((m) => m.visibility !== "hidden" && m.supported_in_api !== false) .map((m) => [m.slug, rowFromCatalogEntry(m)]), ) if (!Object.keys(rows).length) throw new Error("AStudio 模型目录为空") + // 目录里出现过这个名字(哪怕被 visibility/supported_in_api 过滤掉)就不再补位: + // 下架或禁用是上游的明确表态,不能用补位表把它复活。 + for (const m of EXTRA_CATALOG) if (!catalogSlugs.has(m.slug)) rows[m.slug] = rowFromCatalogEntry(m) return rows }, }, diff --git a/packages/astudio/index.test.mjs b/packages/astudio/index.test.mjs index f3e2055..98be131 100644 --- a/packages/astudio/index.test.mjs +++ b/packages/astudio/index.test.mjs @@ -89,12 +89,14 @@ test("rowFromCatalogEntry degrades safely on sparse entries", () => { test("bootstrap table covers the observed catalog", () => { const rows = bootstrapRows() - assert.equal(Object.keys(rows).length, 7) + assert.equal(Object.keys(rows).length, 8) for (const id of ["astronclaw-auto", "spark-x2.6", "spark-x2.6-4b", "xopglm52", "xopdeepseekv4pro0813"]) { assert.ok(rows[id], `missing ${id}`) } assert.equal(rows["spark-x2.6-4b"].free, true) assert.equal(rows["xopglm52"].limit.context, 1048576) + // 目录接口尚未上、网关已接受的模型:目录读不到时也要能选到。 + assert.equal(rows["xdeepseek-flash-in"].name, "DeepSeek-V4.1-Flash") }) test("readAcodeConfigToken parses the astron-spark section", () => { @@ -225,8 +227,12 @@ test("models hook maps the live catalog and keeps the old list on network failur }, }) const rows = await plugin.provider.models({ models: {} }, { auth: { type: "api", key: "k" } }) - assert.deepEqual(Object.keys(rows), ["spark-x2.6-4b", "xopglm52"]) + assert.deepEqual(Object.keys(rows), ["spark-x2.6-4b", "xopglm52", "xdeepseek-flash-in"]) assert.equal(rows["spark-x2.6-4b"].free, true) + // 目录没上的模型由 EXTRA_CATALOG 补位,形状与目录行一致(context/推理档位都在)。 + assert.equal(rows["xdeepseek-flash-in"].name, "DeepSeek-V4.1-Flash") + assert.equal(rows["xdeepseek-flash-in"].limit.context, 1048576) + assert.equal(rows["xdeepseek-flash-in"].reasoning, true) const keep = createPlugin({ fetchImpl: async () => { throw new Error("down") } }) const previousProvider = { models: { kept: true } } @@ -245,6 +251,41 @@ test("models hook maps the live catalog and keeps the old list on network failur await assert.rejects(malformed.provider.models({ models: {} }, { auth: { type: "api", key: "k" } })) }) +test("catalog rows win over EXTRA_CATALOG for the same slug", async () => { + const plugin = createPlugin({ + fetchImpl: async () => okRes({ + code: 0, + data: { models: [{ slug: "xdeepseek-flash-in", display_name: "DeepSeek-V4.1-Flash(目录)", context_window: 4096, max_output_tokens: 512, visibility: "list", supported_in_api: true, supported_reasoning_levels: [{ effort: "none" }] }] }, + }), + }) + const rows = await plugin.provider.models({ models: {} }, { auth: { type: "api", key: "k" } }) + assert.equal(rows["xdeepseek-flash-in"].name, "DeepSeek-V4.1-Flash(目录)") + assert.equal(rows["xdeepseek-flash-in"].limit.context, 4096) +}) + +test("EXTRA_CATALOG does not revive a slug the catalog delisted", async () => { + // 目录给了这个名字但标成 hidden:那是上游下架的表态,补位表不能把它复活。 + const plugin = createPlugin({ + fetchImpl: async () => okRes({ + code: 0, + data: { models: [ + { slug: "xopglm52", display_name: "GLM-5.2", visibility: "list", supported_in_api: true, supported_reasoning_levels: [{ effort: "none" }] }, + { slug: "xdeepseek-flash-in", display_name: "DeepSeek-V4.1-Flash", visibility: "hidden", supported_in_api: true, supported_reasoning_levels: [{ effort: "none" }] }, + ] }, + }), + }) + const rows = await plugin.provider.models({ models: {} }, { auth: { type: "api", key: "k" } }) + assert.deepEqual(Object.keys(rows), ["xopglm52"]) +}) + +test("an empty catalog is still an error, EXTRA_CATALOG does not mask it", async () => { + const plugin = createPlugin({ fetchImpl: async () => okRes({ code: 0, data: { models: [] } }) }) + await assert.rejects( + plugin.provider.models({ models: {} }, { auth: { type: "api", key: "k" } }), + /AStudio 模型目录为空/, + ) +}) + test("catalog reads refuse redirects and carry a timeout", async () => { let init const plugin = createPlugin({