Fix types

This commit is contained in:
Jared Palmer 2023-06-16 14:18:49 -04:00
parent f3e846955f
commit 5de9ae612d
2 changed files with 2 additions and 2 deletions

View file

@ -40,7 +40,7 @@ export async function POST(req: Request) {
const stream = OpenAIStream(res, { const stream = OpenAIStream(res, {
async onCompletion(completion) { async onCompletion(completion) {
const title = json.messages[0].content.substring(0, 100) 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 id = json.id ?? nanoid()
const createdAt = Date.now() const createdAt = Date.now()
const path = `/chat/${id}` const path = `/chat/${id}`

View file

@ -7,7 +7,7 @@ declare module 'next-auth' {
interface Session { interface Session {
user: { user: {
/** The user's postal address. */ /** The user's postal address. */
address: string id: string
} & DefaultSession['user'] } & DefaultSession['user']
} }
} }