From 8b47fbd9e4cbc3e91aa553f690e8a09c00980651 Mon Sep 17 00:00:00 2001 From: Jared Palmer Date: Fri, 16 Jun 2023 16:33:47 -0400 Subject: [PATCH] Fix deploy --- app/api/chat/route.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index ec1ce73..5500723 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -4,20 +4,21 @@ import { Configuration, OpenAIApi } from 'openai-edge' import { auth } from '@/auth' import { nanoid } from '@/lib/utils' +import { Session } from 'inspector' export const runtime = 'edge' export async function POST(req: Request) { + const json = await req.json() + const { messages, previewToken } = json + let session: Session if (process.env.VERCEL_ENV !== 'preview') { - const session = await auth() + session = await auth() if (session == null) { return new Response('Unauthorized', { status: 401 }) } } - const json = await req.json() - const { messages, previewToken } = json - const configuration = new Configuration({ apiKey: previewToken || process.env.OPENAI_API_KEY })