mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-09 23:48:36 +01:00
fix chat remaining endpoint
This commit is contained in:
@@ -2,9 +2,10 @@ import { ProjectLimitModel } from "@schema/ProjectsLimits";
|
||||
import { getUserProjectFromId } from "~/server/LIVE_DEMO_DATA";
|
||||
|
||||
export async function getAiChatRemainings(project_id: string) {
|
||||
const limits = await ProjectLimitModel.findOne({ _id: project_id })
|
||||
const limits = await ProjectLimitModel.findOne({ project_id })
|
||||
if (!limits) return 0;
|
||||
const chatsRemaining = limits.ai_limit - limits.ai_messages;
|
||||
|
||||
if (isNaN(chatsRemaining)) return 0;
|
||||
return chatsRemaining;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user