mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-17 12:56:41 +02:00
15 lines
513 B
TypeScript
15 lines
513 B
TypeScript
import path from "path"
|
|
import { fileURLToPath } from "url"
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const __dirname = path.dirname(__filename)
|
|
const dir = path.resolve(__dirname, "..")
|
|
|
|
process.chdir(dir)
|
|
|
|
const modelsUrl = process.env.OPENCODE_MODELS_URL || "https://models.dev"
|
|
export const modelsData = process.env.MODELS_DEV_API_JSON
|
|
? await Bun.file(process.env.MODELS_DEV_API_JSON).text()
|
|
: await fetch(`${modelsUrl}/api.json`).then((x) => x.text())
|
|
console.log("Loaded models.dev snapshot")
|