import prisma from "indite-js/lib/prisma"; import { SessionState } from "indite-js/schemas"; type Props = { id?: string; state: SessionState; }; export const restartSession = async ({ id, state }: Props) => { if (id) { await prisma.chatSession.deleteMany({ where: { id, }, }); } return prisma.chatSession.create({ data: { id, state, }, }); };