Files
ai-portal/app/api/agents/[slug]/route.ts
T
2026-05-06 17:22:50 +08:00

20 lines
462 B
TypeScript

import { prisma } from "@/app/lib/prisma"
import { NextResponse } from "next/server"
export async function GET(
request: Request,
{ params }: { params: Promise<{ slug: string }> }
) {
const { slug } = await params
const agent = await prisma.agent.findUnique({
where: { slug },
include: { category: true },
})
if (!agent) {
return NextResponse.json({ error: "Agent not found" }, { status: 404 })
}
return NextResponse.json(agent)
}