🧐 Add inspectChatSession script
This commit is contained in:
35
packages/scripts/inspectChatSession.ts
Normal file
35
packages/scripts/inspectChatSession.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import { PrismaClient } from '@typebot.io/prisma'
|
||||
import { promptAndSetEnvironment } from './utils'
|
||||
import * as p from '@clack/prompts'
|
||||
|
||||
const inspectChatSession = 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({
|
||||
log: [{ emit: 'event', level: 'query' }, 'info', 'warn', 'error'],
|
||||
})
|
||||
|
||||
const chatSession = await prisma.chatSession.findFirst({
|
||||
where: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
|
||||
if (!chatSession) {
|
||||
console.log('Session not found')
|
||||
return
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(chatSession, null, 2))
|
||||
}
|
||||
|
||||
inspectChatSession()
|
@ -27,7 +27,8 @@
|
||||
"inspectWorkspace": "tsx inspectWorkspace.ts",
|
||||
"getCoupon": "tsx getCoupon.ts",
|
||||
"exportResults": "tsx exportResults.ts",
|
||||
"updateUserEmail": "tsx updateUserEmail.ts"
|
||||
"updateUserEmail": "tsx updateUserEmail.ts",
|
||||
"inspectChatSession": "tsx inspectChatSession.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typebot.io/emails": "workspace:*",
|
||||
|
Reference in New Issue
Block a user