diff --git a/src/server/routers/chat.ts b/src/server/routers/chat.ts index c628fbc..88bf03b 100644 --- a/src/server/routers/chat.ts +++ b/src/server/routers/chat.ts @@ -26,11 +26,8 @@ export const chatRouter = router({ throw new TRPCError({ message: "failed to create session", code: "INTERNAL_SERVER_ERROR" }); } session = await db.query.chatSession.findFirst({ - with: { - messages: true - }, where(fields, operators) { - return operators.eq(fields.id, newSession.id) + return operators.eq(fields.userId, userId) }, }) if (session == undefined) {