Spaces:
Running
Running
import { error, json } from '@sveltejs/kit'; | |
// import { env } from '$env/dynamic/private' | |
import type { CommunityCard } from '$lib/type'; | |
import { REACTION_EMOJIS } from "$lib/utils"; | |
/** @type {import('./$types').RequestHandler} */ | |
export async function GET() { | |
const hasError = false | |
const cards: CommunityCard[] = Array.from({ length: 50 }, (_, i) => ({ | |
reactions: REACTION_EMOJIS.sort(() => Math.random() - Math.random()).slice(0, | |
Math.floor(Math.random() * REACTION_EMOJIS.length) | |
).map((emoji) => ({ | |
emoji, | |
users: Array.from({ length: Math.floor(Math.random() * 10) }, (_, i) => i.toString()), | |
})), | |
id: i.toString(), | |
model_name: "CommunityCard", | |
prompt: "What is your favorite color?", | |
image: "https://picsum.photos/seed/" + i + "/500/500", | |
})) | |
if (hasError) { | |
return error(500, 'Internal Server Error') | |
} | |
return json(cards) | |
} | |