mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-30 13:39:52 +00:00
feat: Make the models.dev domain configurable for offline environments (#9258)
This commit is contained in:
parent
95b17bcf5e
commit
8df09abb1b
5 changed files with 18 additions and 6 deletions
|
|
@ -45,12 +45,13 @@ function providerIconsPlugin() {
|
|||
}
|
||||
|
||||
async function fetchProviderIcons() {
|
||||
const providers = await fetch("https://models.dev/api.json")
|
||||
const url = process.env.OPENCODE_MODELS_URL || "https://models.dev"
|
||||
const providers = await fetch(`${url}/api.json`)
|
||||
.then((res) => res.json())
|
||||
.then((json) => Object.keys(json))
|
||||
await Promise.all(
|
||||
providers.map((provider) =>
|
||||
fetch(`https://models.dev/logos/${provider}.svg`)
|
||||
fetch(`${url}/logos/${provider}.svg`)
|
||||
.then((res) => res.text())
|
||||
.then((svg) => fs.writeFileSync(`./src/assets/icons/provider/${provider}.svg`, svg)),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue