Some fixes
This commit is contained in:
parent
cc1c24718e
commit
67359e19b3
8 changed files with 51 additions and 44 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { kv } from '@vercel/kv'
|
||||
import { OpenAIStream, StreamingTextResponse } from 'ai'
|
||||
import OpenAI from 'openai';
|
||||
import OpenAI from 'openai'
|
||||
|
||||
import { auth } from '@/auth'
|
||||
import { nanoid } from '@/lib/utils'
|
||||
|
|
@ -8,16 +8,14 @@ import { nanoid } from '@/lib/utils'
|
|||
export const runtime = 'edge'
|
||||
|
||||
const openai = new OpenAI({
|
||||
apiKey: process.env.OPENAI_API_KEY,
|
||||
});
|
||||
apiKey: process.env.OPENAI_API_KEY
|
||||
})
|
||||
|
||||
export async function POST(req: Request) {
|
||||
const json = await req.json()
|
||||
const { messages, previewToken } = json
|
||||
const userId = (await auth())?.user.id // this doesn't seem to work getting the id
|
||||
|
||||
console.log('auth', await auth())
|
||||
|
||||
if (!userId) {
|
||||
return new Response('Unauthorized', {
|
||||
status: 401
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue