File size: 750 Bytes
83deba1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb29a95
c479a59
 
 
 
 
83deba1
 
 
 
 
 
97ec6f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
export async function load({ fetch, url }) {
  const model_param = url.searchParams.get("model")

  let model;

  if (model_param) {
    const model_request = await fetch(`/api/models/${model_param?.replace("/", "@")}`, {
      method: "GET",
      headers: {
        "Content-Type": "application/json"
      }
    })
    const model_response = await model_request?.clone().json().catch(() => null);
    model = model_response
  }

  const response = await fetch("/api/models?page=0&filter=hotest", {
    method: "GET",
    headers: {
      "Content-Type": "application/json"
    }
  })
  const models = await response.json()
  return {
    models: models?.cards ?? [],
    total_items: models?.total_items ?? 0,
    model: model?.model ?? null
  }
}