better-chatbot / src /app /api /thread /route.ts
Bot
Initial commit for HF Spaces
05c5ed5
Raw
History Blame Contribute Delete
369 Bytes
import { getSession } from "auth/server";
import { chatRepository } from "lib/db/repository";
export async function GET() {
const session = await getSession();
if (!session?.user?.id) {
return new Response("Unauthorized", { status: 401 });
}
const threads = await chatRepository.selectThreadsByUserId(session.user.id);
return Response.json(threads);
}