diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index beec80f..36087fd 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -40,7 +40,7 @@ export async function POST(req: Request) { const stream = OpenAIStream(res, { async onCompletion(completion) { const title = json.messages[0].content.substring(0, 100) - const userId = session.user.id + const userId = session.user?.id const id = json.id ?? nanoid() const createdAt = Date.now() const path = `/chat/${id}` diff --git a/index.d.ts b/next-auth.d.ts similarity index 93% rename from index.d.ts rename to next-auth.d.ts index 5b3f52b..918e14d 100644 --- a/index.d.ts +++ b/next-auth.d.ts @@ -7,7 +7,7 @@ declare module 'next-auth' { interface Session { user: { /** The user's postal address. */ - address: string + id: string } & DefaultSession['user'] } }