Explorar o código

core: ensure models configuration is not empty before loading

Dax Raad hai 7 meses
pai
achega
d005e70f50
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      packages/opencode/src/provider/models.ts

+ 1 - 1
packages/opencode/src/provider/models.ts

@@ -87,7 +87,7 @@ export namespace ModelsDev {
   export const Data = lazy(async () => {
     const file = Bun.file(filepath)
     const result = await file.json().catch(() => {})
-    if (result) return result
+    if (result && typeof result === "object" && Object.keys(result).length > 0) return result
     // @ts-ignore
     const snapshot = await import("./models-snapshot")
       .then((m) => m.snapshot as Record<string, unknown>)