Skip to content

Commit f04dd33

Browse files
add apiHandler to chat/blocking
1 parent e689590 commit f04dd33

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • packages/web/src/app/api/(server)/chat/blocking

packages/web/src/app/api/(server)/chat/blocking/route.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import { createLogger } from "@sourcebot/shared";
1212
import { randomUUID } from "crypto";
1313
import { StatusCodes } from "http-status-codes";
1414
import { headers } from "next/headers";
15-
import { NextResponse } from "next/server";
15+
import { NextRequest, NextResponse } from "next/server";
1616
import { z } from "zod";
1717
import { createMessageStream } from "../route";
1818
import { InferUIMessageChunk, UITools, UIDataTypes, UIMessage } from "ai";
19+
import { apiHandler } from "@/lib/apiHandler";
1920

2021
const logger = createLogger('chat-blocking-api');
2122

@@ -51,7 +52,7 @@ interface BlockingChatResponse {
5152
* The chat session is persisted to the database, allowing users to view the full
5253
* conversation (including tool calls and reasoning) in the web UI.
5354
*/
54-
export async function POST(request: Request) {
55+
export const POST = apiHandler(async (request: NextRequest) => {
5556
const requestBody = await request.json();
5657
const parsed = await blockingChatRequestSchema.safeParseAsync(requestBody);
5758

@@ -193,7 +194,7 @@ export async function POST(request: Request) {
193194
}
194195

195196
return NextResponse.json(response);
196-
}
197+
});
197198

198199
const blockStreamUntilFinish = async <T extends UIMessage<unknown, UIDataTypes, UITools>>(stream: ReadableStream<InferUIMessageChunk<T>>) => {
199200
const reader = stream.getReader();

0 commit comments

Comments
 (0)