mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(coding-agent): serve catalogs without version redirect (#11690)
Update the model catalog protocol to pi.dev after a change to stop pi.dev redirecting released clients to `?pi-version=` URLs and serve their catalog directly. The released CLI is unaffected.
This commit is contained in:
parent
9823079ad9
commit
62752fd4c3
3 changed files with 13 additions and 18 deletions
|
|
@ -55,25 +55,23 @@ test("selects the newest catalog a Pi version supports", () => {
|
|||
assert.equal(selectModelCatalog(index, undefined)?.revision, mixedApiRevision);
|
||||
});
|
||||
|
||||
test("redirects Pi user agents to an explicit catalog version", () => {
|
||||
test("serves Pi user agents the catalog for their version", () => {
|
||||
// Regression test for #9099: released clients identify themselves only by User-Agent.
|
||||
assert.deepEqual(
|
||||
parseModelCatalogRequest(
|
||||
"https://pi.dev/api/models/providers/openrouter?types=chat%2Cimage",
|
||||
"pi/0.84.4 (linux; node/v22.0.0; x64)",
|
||||
),
|
||||
{
|
||||
kind: "redirect",
|
||||
location: "https://pi.dev/api/models/providers/openrouter?types=chat%2Cimage&pi-version=0.84.4",
|
||||
},
|
||||
{ kind: "catalog", piVersion: "0.84.4", representation: "typed" },
|
||||
);
|
||||
assert.deepEqual(parseModelCatalogRequest("https://pi.dev/api/models", "pi/0.84.4"), {
|
||||
kind: "redirect",
|
||||
location: "https://pi.dev/api/models?pi-version=0.84.4",
|
||||
kind: "catalog",
|
||||
piVersion: "0.84.4",
|
||||
representation: "legacy",
|
||||
});
|
||||
});
|
||||
|
||||
test("serves explicit and unversioned catalog requests without redirecting", () => {
|
||||
test("serves explicit and unversioned catalog requests", () => {
|
||||
assert.deepEqual(
|
||||
parseModelCatalogRequest("https://pi.dev/api/models?pi-version=0.83.0", "pi/0.85.1 (linux; node/v22.0.0; x64)"),
|
||||
{ kind: "catalog", piVersion: "0.83.0", representation: "legacy" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue