import { getServerSession } from "next-auth/next" import { redirect } from "next/navigation" import { prisma } from "@//app/lib/prisma" import Link from "next/link" import DeleteButton from "./DeleteButton" export default async function AdminAgentsPage() { const session = await getServerSession() if (!session) { redirect("/admin/login") } const agents = await prisma.agent.findMany({ include: { category: true }, orderBy: { createdAt: "desc" }, }) return (
{agents.map((agent) => ( ))}
名称 分类 状态 使用次数 操作
{agent.icon || "🤖"}
{agent.name}
{agent.slug}
{agent.category?.name || "-"} {agent.status === "active" ? "运行中" : agent.status} {agent.usageCount}
编辑
{agents.length === 0 && (
暂无智能体,点击添加
)}
) }