import { createDb } from "../packages/db/src/index.js"; async function run() { const { prisma } = createDb("postgres://ingowagner@127.0.0.1:5432/evoo"); const thread = await prisma.thread.findFirst({ where: { botId: "cmu6ydgm70000ywyyik8bghz7" }, include: { messages: { orderBy: { seq: "desc" }, take: 3, }, }, }); console.log("Thread ID:", thread?.id); console.log("Last 3 messages:"); for (const m of thread?.messages || []) { console.log( `Seq ${m.seq} | Role ${m.role} | Created: ${m.createdAt.toISOString()} | Blocks: ${JSON.stringify(m.blocks).slice(0, 100)}`, ); } } run() .catch(console.error) .finally(() => process.exit(0));