21 lines
492 B
TypeScript
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: {} },
|
|
})
|
|
}
|