






















@@ -7,15 +7,23 @@ import {
77QWEN_DEFAULT_MODEL_ID,
88} from "./api.js";
9910+type QwenProvider = ReturnType<typeof buildQwenProvider>;
11+12+function getQwenModelIds(provider: QwenProvider): string[] {
13+expect(provider.models).toBeDefined();
14+return provider.models.map((model) => model.id);
15+}
16+1017describe("qwen provider catalog", () => {
1118it("builds the bundled Qwen provider defaults", () => {
1219const provider = buildQwenProvider();
13201421expect(provider.baseUrl).toBe(QWEN_BASE_URL);
1522expect(provider.api).toBe("openai-completions");
16-expect(provider.models?.length).toBeGreaterThan(0);
17-expect(provider.models?.map((model) => model.id)).toContain(QWEN_DEFAULT_MODEL_ID);
18-expect(provider.models?.map((model) => model.id)).not.toContain("qwen3.6-plus");
23+const modelIds = getQwenModelIds(provider);
24+expect(modelIds.length).toBeGreaterThan(0);
25+expect(modelIds).toContain(QWEN_DEFAULT_MODEL_ID);
26+expect(modelIds).not.toContain("qwen3.6-plus");
1927});
20282129it("only advertises qwen3.6-plus on Standard endpoints", () => {
@@ -25,23 +33,32 @@ describe("qwen provider catalog", () => {
2533});
2634const standard = buildQwenProvider({ baseUrl: QWEN_STANDARD_GLOBAL_BASE_URL });
273528-expect(coding.models?.map((model) => model.id)).not.toContain("qwen3.6-plus");
29-expect(codingTrailingDot.models?.map((model) => model.id)).not.toContain("qwen3.6-plus");
30-expect(standard.models?.map((model) => model.id)).toContain("qwen3.6-plus");
36+expect(getQwenModelIds(coding)).not.toContain("qwen3.6-plus");
37+expect(getQwenModelIds(codingTrailingDot)).not.toContain("qwen3.6-plus");
38+expect(getQwenModelIds(standard)).toContain("qwen3.6-plus");
3139});
32403341it("opts native Qwen baseUrls into streaming usage only inside the extension", () => {
3442const nativeProvider = applyQwenNativeStreamingUsageCompat(buildQwenProvider());
43+expect(nativeProvider.models.length).toBeGreaterThan(0);
3544expect(
36-nativeProvider.models?.every((model) => model.compat?.supportsUsageInStreaming === true),
45+nativeProvider.models.every((model) => {
46+expect(model.compat).toBeDefined();
47+if (!model.compat) {
48+throw new Error(`expected Qwen model ${model.id} compat`);
49+}
50+return model.compat.supportsUsageInStreaming === true;
51+}),
3752).toBe(true);
38533954const customProvider = applyQwenNativeStreamingUsageCompat({
4055 ...buildQwenProvider(),
4156baseUrl: "https://proxy.example.com/v1",
4257});
4358expect(
44-customProvider.models?.some((model) => model.compat?.supportsUsageInStreaming === true),
59+customProvider.models.some(
60+(model) => model.compat && model.compat.supportsUsageInStreaming === true,
61+),
4562).toBe(false);
4663});
4764});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。