Skip to content

Commit d1dfb41

Browse files
committed
fix(app): use empty string for unreleased model release_date to satisfy typecheck
1 parent 9185309 commit d1dfb41

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎packages/app/src/context/global-sync/utils.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, expect, test } from "bun:test"
1+
import { describe, expect, test } from "bun:test"
22
import type {
33
AgentListOutput,
44
ModelDefaultOutput,
@@ -124,7 +124,7 @@ describe("normalizeProviderList", () => {
124124
// uses 0 as a sentinel for "unreleased" or "config-only" models. Mapping 0
125125
// to "1970-01-01" produces a valid DateTime in the visibility filter, which
126126
// then hides the model because 1970-01-01 is outside the recent 6-month
127-
// window. Setting release_date to undefined instead triggers the
127+
// window. Setting release_date to "" instead triggers the
128128
// unknown-date escape hatch in models.tsx and keeps the model visible.
129129
const result = normalizeProviderList(
130130
[{ id: "custom", name: "Custom", package: "@custom/provider" }] as ProviderListOutput["data"],
@@ -146,7 +146,7 @@ describe("normalizeProviderList", () => {
146146
undefined,
147147
)
148148

149-
expect(result.all.get("custom")?.models["my-model"]?.release_date).toBeUndefined()
149+
expect(result.all.get("custom")?.models["my-model"]?.release_date).toBe("")
150150
})
151151
})
152152

@@ -165,4 +165,4 @@ describe("directoryKey", () => {
165165
expect(String(directoryKey("C:/"))).toBe("C:/")
166166
expect(String(directoryKey("/"))).toBe("/")
167167
})
168-
})
168+
})

‎packages/app/src/context/global-sync/utils.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {
1+
import type {
22
AgentListOutput,
33
ModelDefaultOutput,
44
ModelListOutput,
@@ -131,7 +131,7 @@ export function normalizeProviderList(
131131
status: model.status,
132132
options: model.settings ?? {},
133133
headers: model.headers ?? {},
134-
release_date: model.time.released === 0 ? undefined : new Date(model.time.released).toISOString().slice(0, 10),
134+
release_date: model.time.released === 0 ? "" : new Date(model.time.released).toISOString().slice(0, 10),
135135
variants: Object.fromEntries(model.variants.map((variant) => [variant.id, variant.settings ?? {}])),
136136
}
137137
}

0 commit comments

Comments
 (0)