소스 검색

core: ensure models configuration is not empty before loading

Dax Raad 10 달 전
부모
커밋
d005e70f50
1개의 변경된 파일과 1개의 추가작업 그리고 1개의 파일을 삭제
  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 () => {
   export const Data = lazy(async () => {
     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
+    if (result && typeof result === "object" && Object.keys(result).length > 0) return result
     // @ts-ignore
     // @ts-ignore
     const snapshot = await import("./models-snapshot")
     const snapshot = await import("./models-snapshot")
       .then((m) => m.snapshot as Record<string, unknown>)
       .then((m) => m.snapshot as Record<string, unknown>)