Skip to content

Commit 5a507d0

Browse files
committed
More error handling
1 parent a2e6e1f commit 5a507d0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/client/components/ChatV2/ChatV2.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { SettingsModal } from './SettingsModal'
2828
import { getCompletionStream } from './util'
2929
import { OutlineButtonBlack } from './generics/Buttons'
3030
import useCurrentUser from '../../hooks/useCurrentUser'
31+
import { enqueueSnackbar } from 'notistack'
3132

3233
export const ChatV2 = () => {
3334
const { courseId } = useParams()
@@ -243,6 +244,7 @@ export const ChatV2 = () => {
243244

244245
if (!stream) {
245246
console.error('Stream is undefined')
247+
handleCancel()
246248
return
247249
}
248250

@@ -261,6 +263,7 @@ export const ChatV2 = () => {
261263
}
262264
} catch (err: any) {
263265
console.error(err)
266+
handleCancel()
264267
}
265268
}
266269

src/server/routes/openai.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const PostStreamSchemaV2 = z.object({
5757
saveConsent: z.boolean().optional(),
5858
prevResponseId: z.string().optional(),
5959
courseId: z.string().optional(),
60-
ragIndexId: z.number().optional(),
60+
ragIndexId: z.number().optional().nullable(),
6161
}),
6262
courseId: z.string().optional(),
6363
})

0 commit comments

Comments
 (0)