mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-08 23:02:41 +02:00
add rate-limiting
This commit is contained in:
parent
024f6c75cc
commit
200e8d2e38
9 changed files with 188 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import { ObjectId } from "mongodb";
|
|||
import { authCheck } from "@/app/api/v1/utils";
|
||||
import { convertFromApiToAgenticApiMessages, convertFromAgenticApiToApiMessages, AgenticAPIChatRequest, ApiRequest, ApiResponse, convertWorkflowToAgenticAPI } from "@/app/lib/types";
|
||||
import { getAgenticApiResponse } from "@/app/lib/utils";
|
||||
import { check_query_limit } from "@/app/lib/rate_limiting";
|
||||
|
||||
// get next turn / agent response
|
||||
export async function POST(
|
||||
|
|
@ -13,6 +14,11 @@ export async function POST(
|
|||
): Promise<Response> {
|
||||
const { projectId } = await params;
|
||||
|
||||
// check query limit
|
||||
if (!await check_query_limit(projectId)) {
|
||||
return Response.json({ error: "Query limit exceeded" }, { status: 429 });
|
||||
}
|
||||
|
||||
return await authCheck(projectId, req, async () => {
|
||||
// parse and validate the request body
|
||||
let body;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue