fix model get req in new simulator

This commit is contained in:
songtianlun 2025-08-28 11:45:14 +08:00
parent ff67d48bcc
commit 3b0cc31f27

View File

@ -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: {
// 获取所有激活的模型(不再与套餐绑定)
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,