Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
import { json, type RequestEvent } from '@sveltejs/kit'; | |
import prisma from '$lib/prisma'; | |
/** @type {import('./$types').RequestHandler} */ | |
export async function GET(request : RequestEvent) { | |
const repo = request.params.repo?.replace("@", "/") | |
const model = await prisma.model.findFirst({ | |
where: { | |
repo | |
} | |
}) | |
if (!model) { | |
return json({ | |
error: { | |
token: "Model params is required" | |
} | |
}, { status: 401 }) | |
} | |
return json({ | |
model | |
}) | |
} | |