Skip to content

Commit 3a9609e

Browse files
committed
fix
1 parent 632605b commit 3a9609e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/server/routes/openai.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,14 @@ openaiRouter.post('/stream', upload.single('file'), async (r, res) => {
162162
courseId,
163163
})
164164

165-
const course = await ChatInstance.findOne({
166-
where: { courseId },
167-
})
168-
169-
const consentToSave = course.saveDiscussions && options.saveConsent
165+
const course =
166+
courseId &&
167+
(await ChatInstance.findOne({
168+
where: { courseId },
169+
}))
170+
171+
const consentToSave =
172+
courseId && course.saveDiscussions && options.saveConsent
170173

171174
// eslint-disable-next-line no-console
172175
console.log(

0 commit comments

Comments
 (0)