( error: unknown, )
| 53 | }; |
| 54 | |
| 55 | const validationErrorBody = ( |
| 56 | error: unknown, |
| 57 | ): { error: string; detail?: string } => |
| 58 | process.env.VERCEL_ENV === "production" || !(error instanceof Error) |
| 59 | ? { error: "Invalid chat messages" } |
| 60 | : { error: "Invalid chat messages", detail: error.message }; |
| 61 | |
| 62 | /** |
| 63 | * Resolve the public client IP for rate-limiting. |