fix(core): loading models.dev in dev

This commit is contained in:
Adam
2026-01-15 10:38:09 -06:00
parent e60ded01df
commit d71153eae6

View File

@@ -81,7 +81,11 @@ export namespace ModelsDev {
const file = Bun.file(filepath)
const result = await file.json().catch(() => {})
if (result) return result as Record<string, Provider>
const json = await data()
if (typeof data === "function") {
const json = await data()
return JSON.parse(json) as Record<string, Provider>
}
const json = await fetch("https://models.dev/api.json").then((x) => x.text())
return JSON.parse(json) as Record<string, Provider>
}