From 3b0cc31f27cba55b5ce0ad1199315e8ee4b24cc9 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Thu, 28 Aug 2025 11:45:14 +0800 Subject: [PATCH] fix model get req in new simulator --- src/app/api/simulator/models/route.ts | 29 ++++++++------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/src/app/api/simulator/models/route.ts b/src/app/api/simulator/models/route.ts index 198d8b4..7daf4c7 100644 --- a/src/app/api/simulator/models/route.ts +++ b/src/app/api/simulator/models/route.ts @@ -11,29 +11,16 @@ export async function GET() { return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); } - // 获取用户信息和订阅套餐 - const userWithPlan = await prisma.user.findUnique({ - where: { id: user.id }, - include: { - subscriptionPlan: { - include: { - models: { - where: { isActive: true }, - orderBy: [ - { provider: "asc" }, - { name: "asc" } - ] - } - } - } - } + // 获取所有激活的模型(不再与套餐绑定) + const allModels = await prisma.model.findMany({ + where: { isActive: true }, + orderBy: [ + { provider: "asc" }, + { name: "asc" } + ] }); - if (!userWithPlan) { - return NextResponse.json({ error: "User not found" }, { status: 404 }); - } - - const models = userWithPlan.subscriptionPlan.models.map(model => ({ + const models = allModels.map(model => ({ id: model.id, modelId: model.modelId, name: model.name,