fix(app): keep models with unknown release dates visible (#60496)

This commit is contained in:
frank
2026-10-30 14:33:40 +08:00
committed by GitHub
Unverified
parent a6212cb1b5
commit 986221af34
2 changed files with 7 additions and 3 deletions
@@ -41,7 +41,10 @@ describe("normalizeAgentList", () => {
})
describe("normalizeProviderList", () => {
test("groups current models into the app provider catalog", () => {
test.each([
[0, ""],
[Date.UTC(2026, 8, 1), "2026-09-01"],
])("groups models with release time %p into the app catalog", (released, release_date) => {
const providers: ProviderListOutput["data"] = [
{ id: "openai", name: "OpenAI", activation: "auto", package: "@ai-sdk/openai" },
]
@@ -54,7 +57,7 @@ describe("normalizeProviderList", () => {
name: "GPT-5",
capabilities: { tools: true, input: ["text", "image"], output: ["text"] },
variants: [{ id: "high" }],
time: { released: 1 },
time: { released },
cost: [{ input: 1, output: 2, cache: { read: 0.1, write: 0.2 } }],
status: "active",
enabled: true,
@@ -83,6 +86,7 @@ describe("normalizeProviderList", () => {
expect(result.all.get("openai")?.models["gpt-5"]).toMatchObject({
id: "gpt-5",
providerID: "openai",
release_date,
capabilities: { toolcall: true, attachment: true, reasoning: true },
cost: { input: 1, output: 2 },
variants: { high: {} },
@@ -119,7 +119,7 @@ export function normalizeProviderList(
status: model.status,
options: model.settings ?? {},
headers: model.headers ?? {},
release_date: new Date(model.time.released).toISOString().slice(0, 10),
release_date: model.time.released === 0 ? "" : new Date(model.time.released).toISOString().slice(0, 10),
variants: Object.fromEntries(model.variants.map((variant) => [variant.id, variant.settings ?? {}])),
}
}