File size: 660 Bytes
b0f34ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"use server"

import { SDXLModel } from "@/types"

const SDXL_MODEL_DATABASE_URL = "https://huggingface.co/spaces/multimodalart/LoraTheExplorer/raw/main/sdxl_loras.json"

export async function getSDXLModels(): Promise<SDXLModel[]> {
  const res = await fetch(SDXL_MODEL_DATABASE_URL, {
    method: "GET",
    headers: {
      "Content-Type": "application/json"
    },
    cache: "no-store",
    // we can also use this (see https://vercel.com/blog/vercel-cache-api-nextjs-cache)
    // next: { revalidate: 1 }
  })

  const content = await res.json() as SDXLModel[]

  // we only return compatible models
  return content.filter(model => model.is_compatible)
}