2
0
Files
bot/packages/bot-engine/queries/setIsReplyingInChatSession.ts
2024-05-15 17:47:38 +02:00

21 lines
492 B
TypeScript

import prisma from '@typebot.io/lib/prisma'
type Props = {
existingSessionId: string | undefined
newSessionId: string
}
export const setIsReplyingInChatSession = async ({
existingSessionId,
newSessionId,
}: Props) => {
if (existingSessionId) {
return prisma.chatSession.updateMany({
where: { id: existingSessionId },
data: { isReplying: true },
})
}
return prisma.chatSession.createMany({
data: { id: newSessionId, isReplying: true, state: {} },
})
}