Skip to content

Commit 1d24f49

Browse files
committed
Check botId result
1 parent d7cec6d commit 1d24f49

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎app/(chat)/api/chat/route.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,15 @@ export async function POST(request: Request) {
8181
const { id, message, messages, selectedChatModel, selectedVisibilityType } =
8282
requestBody;
8383

84-
const [, session] = await Promise.all([
84+
const [botIdResult, session] = await Promise.all([
8585
checkBotId().catch(() => null),
8686
auth(),
8787
]);
8888

89+
if (botIdResult?.isBot) {
90+
return new ChatbotError("forbidden:api").toResponse();
91+
}
92+
8993
if (!session?.user) {
9094
return new ChatbotError("unauthorized:chat").toResponse();
9195
}

0 commit comments

Comments
 (0)