fix: expose full Qoder model catalog
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "pi-provider-qoder",
|
"name": "pi-provider-qoder",
|
||||||
"version": "0.2.8",
|
"version": "0.2.9",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "pi-provider-qoder",
|
"name": "pi-provider-qoder",
|
||||||
"version": "0.2.8",
|
"version": "0.2.9",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "2.4.2",
|
"@biomejs/biome": "2.4.2",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pi-provider-qoder",
|
"name": "pi-provider-qoder",
|
||||||
"version": "0.2.8",
|
"version": "0.2.9",
|
||||||
"description": "Pi extension for Qoder AI — with OAuth authentication, COSY signatures and WAF bypass",
|
"description": "Pi extension for Qoder AI — with OAuth authentication, COSY signatures and WAF bypass",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -91,11 +91,11 @@ describe("getQoderCenterUrl", () => {
|
|||||||
|
|
||||||
describe("getQoderModelListURL", () => {
|
describe("getQoderModelListURL", () => {
|
||||||
it("constructs correct CN URL", () => {
|
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", () => {
|
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");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,21 @@ describe("Qoder model cache", () => {
|
|||||||
expect(cache.models.some((model: { id: string }) => model.id === "auto")).toBe(false);
|
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", () => {
|
it("filters auto from a legacy fallback cache when the service did not enable it", () => {
|
||||||
writeFileSync(
|
writeFileSync(
|
||||||
CACHE_PATH,
|
CACHE_PATH,
|
||||||
|
|||||||
+14
-3
@@ -10,11 +10,20 @@ MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDA8iMH5c02LilrsERw9t6Pv5Nc
|
|||||||
XcW+ML9FoCI6AOvOzwIDAQAB
|
XcW+ML9FoCI6AOvOzwIDAQAB
|
||||||
-----END PUBLIC KEY-----`;
|
-----END PUBLIC KEY-----`;
|
||||||
|
|
||||||
const QoderIDEVersion = "1.0.0";
|
// Keep the COSY client identity aligned with the current Qoder CLI catalog
|
||||||
|
// protocol. Older values cause the model endpoint to return a reduced list.
|
||||||
|
const QoderIDEVersion = "1.1.3";
|
||||||
const QoderClientType = "5";
|
const QoderClientType = "5";
|
||||||
const QoderDataPolicy = "disagree";
|
const QoderDataPolicy = "disagree";
|
||||||
const QoderLoginVersion = "v2";
|
const QoderLoginVersion = "v2";
|
||||||
const QoderMachineOS = "x86_64_windows";
|
const QoderMachineOS =
|
||||||
|
process.platform === "win32"
|
||||||
|
? process.arch === "arm64"
|
||||||
|
? "aarch64_windows"
|
||||||
|
: "x86_64_windows"
|
||||||
|
: process.arch === "arm64"
|
||||||
|
? "aarch64_linux"
|
||||||
|
: "x86_64_linux";
|
||||||
const QoderMachineTypeMagic = "5";
|
const QoderMachineTypeMagic = "5";
|
||||||
|
|
||||||
const QoderModeEnv = process.env.QODER_REGION || process.env.QODER_BACKEND || process.env.QODER_MODE || "";
|
const QoderModeEnv = process.env.QODER_REGION || process.env.QODER_BACKEND || process.env.QODER_MODE || "";
|
||||||
@@ -79,7 +88,9 @@ export function getQoderCenterUrl(mode?: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getQoderModelListURL(mode?: string): string {
|
export function getQoderModelListURL(mode?: string): string {
|
||||||
return `${getQoderBaseUrl(mode)}algo/api/v2/model/list`;
|
// The CLI uses Encode=1 for the model catalog. Without it, the service
|
||||||
|
// returns a reduced catalog and omits models such as Cantus/cmodel.
|
||||||
|
return `${getQoderBaseUrl(mode)}algo/api/v2/model/list?Encode=1`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getQoderChatURL(mode?: string): string {
|
export function getQoderChatURL(mode?: string): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user