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
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ import { auth } from '@/auth'
|
|||
import { getChat } from '@/app/actions'
|
||||
import { Chat } from '@/components/chat'
|
||||
|
||||
export const runtime = 'edge'
|
||||
export const preferredRegion = 'home'
|
||||
|
||||
export interface ChatPageProps {
|
||||
params: {
|
||||
id: string
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { Providers } from '@/components/providers'
|
|||
import { Header } from '@/components/header'
|
||||
|
||||
export const metadata = {
|
||||
metadataBase: new URL('https://chat.vercel.ai/'),
|
||||
metadataBase: new URL(`https://${process.env.VERCEL_URL}`),
|
||||
title: {
|
||||
default: 'Next.js AI Chatbot',
|
||||
template: `%s - Next.js AI Chatbot`
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import { nanoid } from '@/lib/utils'
|
||||
import { Chat } from '@/components/chat'
|
||||
|
||||
export const runtime = 'edge'
|
||||
|
||||
export default function IndexPage() {
|
||||
const id = nanoid()
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,6 @@ import { getSharedChat } from '@/app/actions'
|
|||
import { ChatList } from '@/components/chat-list'
|
||||
import { FooterText } from '@/components/footer'
|
||||
|
||||
export const runtime = 'edge'
|
||||
export const preferredRegion = 'home'
|
||||
|
||||
interface SharePageProps {
|
||||
params: {
|
||||
id: string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue