Skip to content

Commit ca2999b

Browse files
committed
npm audit fix & formatting
1 parent 08327fa commit ca2999b

File tree

4 files changed

+58
-45
lines changed

4 files changed

+58
-45
lines changed

package-lock.json

Lines changed: 52 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"@types/lodash": "^4.17.0",
4444
"@types/morgan": "^1.9.9",
4545
"@types/multer": "^1.4.11",
46+
"@types/multer-s3": "^3.0.3",
4647
"@types/node": "^22.0.0",
4748
"@types/node-cron": "^3.0.11",
4849
"@types/react": "^18.2.52",

src/server/routes/rag/rag.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { User } from '../../../shared/user'
77
import { ApplicationError } from '../../util/ApplicationError'
88
import { TEST_COURSES } from '../../../shared/testData'
99
import ragIndexRouter, { ragIndexMiddleware } from './ragIndex'
10-
import { randomUUID } from 'node:crypto'
1110

1211
const router = Router()
1312

@@ -56,14 +55,6 @@ router.post('/indices', async (req, res) => {
5655
throw ApplicationError.Forbidden(`Cannot create index, index already exists on the course ${chatInstance.courseId}`)
5756
}
5857

59-
// @todo langchain impl
60-
/*
61-
const client = getAzureOpenAIClient()
62-
const vectorStore = await client.vectorStores.create({
63-
name: `${name}-${user.id}-${chatInstance.id}`,
64-
})
65-
*/
66-
6758
const ragIndex = await RagIndex.create({
6859
userId: user.id,
6960
metadata: {
@@ -136,9 +127,6 @@ router.get('/indices', async (req, res) => {
136127
})
137128

138129
if (includeExtras) {
139-
// @todo langchain impl
140-
//
141-
// Add ragFileCount to each index
142130
const indicesWithCount = await Promise.all(
143131
indices.map(async (index: any) => {
144132
const count = await RagFile.count({ where: { ragIndexId: index.id } })

src/server/routes/rag/ragIndex.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ import { SearchSchema } from '../../../shared/rag'
1515
import { S3_ACCESS_KEY, S3_BUCKET, S3_HOST, S3_SECRET_ACCESS_KEY } from '../../util/config'
1616

1717
export const s3Client = new S3Client({
18-
region: "eu-north-1",
18+
region: 'eu-north-1',
1919
endpoint: S3_HOST,
2020
forcePathStyle: true,
2121
credentials: {
2222
accessKeyId: S3_ACCESS_KEY,
2323
secretAccessKey: S3_SECRET_ACCESS_KEY,
24-
}
24+
},
2525
})
2626

2727
const ragIndexRouter = Router()
@@ -179,18 +179,16 @@ const upload = multer({
179179
storage: multerS3({
180180
s3: s3Client,
181181
bucket: S3_BUCKET,
182-
endpoint: "https://s3.datacloud.helsinki.fi",
183-
acl: "private",
182+
acl: 'private',
184183
metadata: (req, file, cb) => {
185184
cb(null, { fieldName: file.fieldName })
186-
187185
},
188186
key: (req, file, cb) => {
189187
const { ragIndex } = req as RagIndexRequest
190188
const uniqueFilename = file.originalname
191-
const s3key = `uploads/rag/${ragIndex.id}/${uniqueFilename}`
189+
const s3key = `uploads/rag/${ragIndex.id}/${uniqueFilename}` // @todo Implement unique key generation logic. ragIndex.id is not unique accross multiple different instances of currechat
192190
cb(null, s3key)
193-
}
191+
},
194192
}),
195193
limits: {
196194
fileSize: 50 * 1024 * 1024, // 50 MB

0 commit comments

Comments
 (0)