fix(core): loading models.dev in dev
This commit is contained in:
@@ -81,9 +81,13 @@ 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>
|
||||||
|
if (typeof data === "function") {
|
||||||
const json = await data()
|
const json = await data()
|
||||||
return JSON.parse(json) as Record<string, Provider>
|
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>
|
||||||
|
}
|
||||||
|
|
||||||
export async function refresh() {
|
export async function refresh() {
|
||||||
if (Flag.OPENCODE_DISABLE_MODELS_FETCH) return
|
if (Flag.OPENCODE_DISABLE_MODELS_FETCH) return
|
||||||
|
|||||||
Reference in New Issue
Block a user