Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
import { modelStore } from "$lib/stores/use-model"; | |
export async function load({ fetch, url }) { | |
const model_param = url.searchParams.get("model") | |
if (model_param) { | |
const model_request = await fetch(`/api/models/${model_param?.replace("/", "@")}?full=true`, { | |
method: "GET", | |
headers: { | |
"Content-Type": "application/json" | |
} | |
}) | |
const data = await model_request?.clone().json().catch(() => null); | |
modelStore.set({ | |
model: data?.model ?? null, | |
open: true | |
}); | |
} | |
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 | |
} | |
} |