Fix deploy
This commit is contained in:
parent
d1b8f16261
commit
8b47fbd9e4
1 changed files with 5 additions and 4 deletions
|
|
@ -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
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue