2
0

🧐 Add deleteChatSession script

This commit is contained in:
Baptiste Arnaud
2024-03-02 09:07:55 +01:00
parent 60f3b1311b
commit fee6b2d151
2 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,28 @@
import { PrismaClient } from '@typebot.io/prisma'
import { promptAndSetEnvironment } from './utils'
import * as p from '@clack/prompts'
const deleteChatSession = async () => {
await promptAndSetEnvironment('production')
const id = await p.text({
message: 'Session ID?',
})
if (!id || typeof id !== 'string') {
console.log('No ID provided')
return
}
const prisma = new PrismaClient()
const chatSession = await prisma.chatSession.delete({
where: {
id,
},
})
console.log(JSON.stringify(chatSession, null, 2))
}
deleteChatSession()