fix(core): loading models.dev in dev
This commit is contained in:
parent
e60ded01df
commit
d71153eae6
1 changed files with 5 additions and 1 deletions
|
|
@ -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>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue