2
0
Files
bot/packages/scripts/inspectChatSession.ts
2024-01-29 09:37:19 +01:00

36 lines
735 B
TypeScript

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()