fix: expose full Qoder model catalog

This commit is contained in:
Simon Shi
2026-07-22 20:06:05 +09:00
parent ef672a5461
commit 077e651fc7
5 changed files with 34 additions and 8 deletions
+2 -2
View File
@@ -91,11 +91,11 @@ describe("getQoderCenterUrl", () => {
describe("getQoderModelListURL", () => {
it("constructs correct CN URL", () => {
expect(getQoderModelListURL("cn")).toBe("https://gateway.qoder.com.cn/algo/api/v2/model/list");
expect(getQoderModelListURL("cn")).toBe("https://gateway.qoder.com.cn/algo/api/v2/model/list?Encode=1");
});
it("constructs correct global URL", () => {
expect(getQoderModelListURL("global")).toBe("https://api3.qoder.sh/algo/api/v2/model/list");
expect(getQoderModelListURL("global")).toBe("https://api3.qoder.sh/algo/api/v2/model/list?Encode=1");
});
});
+15
View File
@@ -43,6 +43,21 @@ describe("Qoder model cache", () => {
expect(cache.models.some((model: { id: string }) => model.id === "auto")).toBe(false);
});
it("keeps the Cantus model returned by the current catalog", async () => {
vi.stubGlobal(
"fetch",
vi.fn().mockResolvedValue({
ok: true,
json: () => Promise.resolve({ chat: [{ key: "cmodel", enable: true, display_name: "Cantus" }] }),
}),
);
await updateQoderModelsCache("access-token", "user-id", "Test User", "test@example.com", "global");
const cache = JSON.parse(readFileSync(CACHE_PATH, "utf8"));
expect(cache.models.map((model: { id: string }) => model.id)).toEqual(["cmodel"]);
});
it("filters auto from a legacy fallback cache when the service did not enable it", () => {
writeFileSync(
CACHE_PATH,