(req: NextRequest)
| 41 | }); |
| 42 | |
| 43 | export const POST = async (req: NextRequest) => { |
| 44 | const ip = req.headers.get("x-forwarded-for")?.split(",")[0]?.trim() ?? "unknown"; |
| 45 | if (isRateLimited(ip)) { |
| 46 | return new Response("Too many requests", { status: 429 }); |
| 47 | } |
| 48 | |
| 49 | const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({ |
| 50 | endpoint: "/api/copilotkit", |
| 51 | serviceAdapter: new ExperimentalEmptyAdapter(), |
| 52 | runtime: new CopilotRuntime(runtimeOptions), |
| 53 | }); |
| 54 | |
| 55 | return handleRequest(req); |
| 56 | }; |
nothing calls this directly
no test coverage detected