( body: any, bodySchema: z.ZodType<T>, )
| 16 | import { createMiddlewareSupabaseClient } from "@supabase/auth-helpers-nextjs"; |
| 17 | |
| 18 | export function isValidBody<T extends Record<string, unknown>>( |
| 19 | body: any, |
| 20 | bodySchema: z.ZodType<T>, |
| 21 | ): body is T { |
| 22 | const safeParseOut = bodySchema.safeParse(body); |
| 23 | if ("error" in safeParseOut) { |
| 24 | console.error( |
| 25 | "Error parsing request body: " + safeParseOut.error.toString(), |
| 26 | ); |
| 27 | } |
| 28 | return safeParseOut.success; |
| 29 | } |
| 30 | |
| 31 | export function DBChatMessageToGPT( |
| 32 | message: DBChatMessage, |
nothing calls this directly
no outgoing calls
no test coverage detected