vision-agent / lib /db /prisma.ts
MingruiZhang's picture
feat: Directly us DBMessage as UIMessage + Code viewer (#74)
4af6326 unverified
raw
history blame
839 Bytes
import { PrismaClient } from '@prisma/client';
declare global {
var prisma: PrismaClient | undefined;
namespace PrismaJson {
// you can use classes, interfaces, types, etc.
type FinalChatResult = {
type: 'final_code';
status: 'completed' | 'failed';
payload: {
code: string;
test: string;
result: string; // TODO To be fixed to JSON below
// result: {
// logs: {
// stderr: string[];
// stdout: string[];
// };
// results: Array<{
// png?: string;
// text: string;
// is_main_result: boolean;
// }>;
// };
};
};
}
}
const db = globalThis.prisma || new PrismaClient();
if (process.env.NODE_ENV != 'production') globalThis.prisma = db;
export default db;