fix(deepseek,model-catalog): vision for V4.1-Flash ids, scope synced catalog to gateways

- Declare deepseek-v4.1-flash and deepseek-flash as vision-capable in MODEL_CAPABILITIES
- Share installed catalogSource across route chunks via globalThis.__9rCatalogSource
- Scope catalog modality keys by provider:model to prevent cross-gateway collisions
- Upgrade catalog format to v2 with automatic rebuild of older schemas
This commit is contained in:
izzzzzi
2026-09-17 17:52:47 +07:00
parent 13b468b889
commit 912ed295db
5 changed files with 299 additions and 52 deletions

View File

@@ -2,6 +2,24 @@ import { describe, expect, it } from "vitest";
import { getCapabilitiesForModel } from "../../open-sse/providers/capabilities.js";
describe("getCapabilitiesForModel", () => {
it("reports DeepSeek V4.1-Flash ids as vision-capable without dropping their thinking/context", () => {
const v41 = { vision: true, reasoning: true, thinkingFormat: "deepseek", contextWindow: 1000000, maxOutput: 384000 };
expect(getCapabilitiesForModel(undefined, "deepseek-v4.1-flash")).toMatchObject(v41);
expect(getCapabilitiesForModel("opencode-go", "deepseek-v4.1-flash")).toMatchObject(v41);
expect(getCapabilitiesForModel("openrouter", "deepseek/deepseek-v4.1-flash")).toMatchObject(v41);
// "deepseek-flash" is the GA id for V4.1-Flash on the DeepSeek API; the pattern it
// used to fall through to gives it 128K/64K, which the exact entry keeps.
expect(getCapabilitiesForModel("opencode-go", "deepseek-flash")).toMatchObject({
vision: true,
reasoning: true,
thinkingFormat: "deepseek",
contextWindow: 128000,
maxOutput: 64000,
});
// the superseded text-only Flash id stays text-only
expect(getCapabilitiesForModel("opencode-go", "deepseek-v4-flash").vision).toBe(false);
});
const claudeSonnet5Expected = {
contextWindow: 1000000,
maxOutput: 128000,