Skip to content

Commit 76b288f

Browse files
committed
allow up to 5 indices per course
1 parent adfb67f commit 76b288f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/server/routes/rag/rag.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ router.post('/indices', async (req, res) => {
3838
throw ApplicationError.Forbidden('Cannot create index, user is not responsible for the course')
3939
}
4040

41-
// Only TEST_COURSES allow multiple rag indices
41+
// Only TEST_COURSES allow > 5 rag indices
4242
const isTestCourse = Object.values(TEST_COURSES).some((course) => course.id === chatInstance.courseId)
43-
const hasRagIndex = (chatInstance.ragIndices?.length ?? 0) > 0
44-
if (!isTestCourse && hasRagIndex) {
45-
throw ApplicationError.Forbidden(`Cannot create index, index already exists on the course ${chatInstance.courseId}`)
43+
const hasMaxRagIndices = (chatInstance.ragIndices?.length ?? 0) > 5
44+
if (!isTestCourse && hasMaxRagIndices) {
45+
throw ApplicationError.Forbidden(`Cannot create index, 5 already exists on the course ${chatInstance.courseId}`)
4646
}
4747

4848
const ragIndex = await RagIndex.create({

0 commit comments

Comments
 (0)