fix(core): loading models.dev in dev
This commit is contained in:
@@ -81,7 +81,11 @@ export namespace ModelsDev {
|
|||||||
const file = Bun.file(filepath)
|
const file = Bun.file(filepath)
|
||||||
const result = await file.json().catch(() => {})
|
const result = await file.json().catch(() => {})
|
||||||
if (result) return result as Record<string, Provider>
|
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>
|
return JSON.parse(json) as Record<string, Provider>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user