Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: don't allow filtereddocumentids if not a dataroom chat

Marc Seitz55e48b05bffc
diff --git a/app/(ee)/api/ai/chat/[chatId]/messages/route.ts b/app/(ee)/api/ai/chat/[chatId]/messages/route.ts
index db2cdcb5..c833d36b 100644
--- a/app/(ee)/api/ai/chat/[chatId]/messages/route.ts
+++ b/app/(ee)/api/ai/chat/[chatId]/messages/route.ts
@@ -99,6 +99,20 @@ export async function POST(
);
}
+ if (
+ filterDataroomDocumentIds &&
+ filterDataroomDocumentIds.length > 0 &&
+ !chat.dataroomId
+ ) {
+ return new Response(
+ JSON.stringify({
+ error:
+ "Dataroom document filters are only allowed for dataroom chats",
+ }),
+ { status: 400, headers: { "Content-Type": "application/json" } },
+ );
+ }
+
// Generate title from first message if not set
if (!chat.title && chat.messages.length === 0) {
const title = await generateChatTitle(content);