(body: unknown, init: ResponseInit = {})
| 39 | const rateLimitBuckets = new Map<string, { count: number; resetAt: number }>(); |
| 40 | |
| 41 | const jsonResponse = (body: unknown, init: ResponseInit = {}) => { |
| 42 | const headers = new Headers(init.headers); |
| 43 | headers.set("content-type", "application/json"); |
| 44 | return new Response(JSON.stringify(body), { ...init, headers }); |
| 45 | }; |
| 46 | |
| 47 | const logChatFailure = ( |
| 48 | reason: string, |