mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 09:00:52 +03:00
Chore/Update multer path if blob storage path is set (#3609)
update multer path if blob storage path is set
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import express from 'express'
|
||||
import multer from 'multer'
|
||||
import path from 'path'
|
||||
import attachmentsController from '../../controllers/attachments'
|
||||
import { getUploadPath } from '../../utils'
|
||||
|
||||
const router = express.Router()
|
||||
|
||||
const upload = multer({ dest: `${path.join(__dirname, '..', '..', '..', 'uploads')}/` })
|
||||
const upload = multer({ dest: getUploadPath() })
|
||||
|
||||
// CREATE
|
||||
router.post('/:chatflowId/:chatId', upload.array('files'), attachmentsController.createAttachment)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import express from 'express'
|
||||
import documentStoreController from '../../controllers/documentstore'
|
||||
import multer from 'multer'
|
||||
import path from 'path'
|
||||
import { getUploadPath } from '../../utils'
|
||||
import documentStoreController from '../../controllers/documentstore'
|
||||
|
||||
const router = express.Router()
|
||||
const upload = multer({ dest: `${path.join(__dirname, '..', '..', '..', 'uploads')}/` })
|
||||
const upload = multer({ dest: getUploadPath() })
|
||||
|
||||
router.post(['/upsert/', '/upsert/:id'], upload.array('files'), documentStoreController.upsertDocStoreMiddleware)
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import express from 'express'
|
||||
import multer from 'multer'
|
||||
import path from 'path'
|
||||
import openaiAssistantsController from '../../controllers/openai-assistants'
|
||||
import { getUploadPath } from '../../utils'
|
||||
|
||||
const router = express.Router()
|
||||
const upload = multer({ dest: `${path.join(__dirname, '..', '..', '..', 'uploads')}/` })
|
||||
const upload = multer({ dest: getUploadPath() })
|
||||
|
||||
router.post('/download/', openaiAssistantsController.getFileFromAssistant)
|
||||
router.post('/upload/', upload.array('files'), openaiAssistantsController.uploadAssistantFiles)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import express from 'express'
|
||||
import multer from 'multer'
|
||||
import path from 'path'
|
||||
import openaiAssistantsVectorStoreController from '../../controllers/openai-assistants-vector-store'
|
||||
import { getUploadPath } from '../../utils'
|
||||
|
||||
const router = express.Router()
|
||||
const upload = multer({ dest: `${path.join(__dirname, '..', '..', '..', 'uploads')}/` })
|
||||
const upload = multer({ dest: getUploadPath() })
|
||||
|
||||
// CREATE
|
||||
router.post('/', openaiAssistantsVectorStoreController.createAssistantVectorStore)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import express from 'express'
|
||||
import multer from 'multer'
|
||||
import path from 'path'
|
||||
import predictionsController from '../../controllers/predictions'
|
||||
import { getUploadPath } from '../../utils'
|
||||
|
||||
const router = express.Router()
|
||||
|
||||
const upload = multer({ dest: `${path.join(__dirname, '..', '..', '..', 'uploads')}/` })
|
||||
const upload = multer({ dest: getUploadPath() })
|
||||
|
||||
// CREATE
|
||||
router.post(['/', '/:id'], upload.array('files'), predictionsController.getRateLimiterMiddleware, predictionsController.createPrediction)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import express from 'express'
|
||||
import multer from 'multer'
|
||||
import path from 'path'
|
||||
import vectorsController from '../../controllers/vectors'
|
||||
import { getUploadPath } from '../../utils'
|
||||
|
||||
const router = express.Router()
|
||||
|
||||
const upload = multer({ dest: `${path.join(__dirname, '..', '..', '..', 'uploads')}/` })
|
||||
const upload = multer({ dest: getUploadPath() })
|
||||
|
||||
// CREATE
|
||||
router.post(
|
||||
|
||||
@@ -1680,3 +1680,9 @@ export const getAPIOverrideConfig = (chatflow: IChatFlow) => {
|
||||
return { nodeOverrides: {}, variableOverrides: [], apiOverrideStatus: false }
|
||||
}
|
||||
}
|
||||
|
||||
export const getUploadPath = (): string => {
|
||||
return process.env.BLOB_STORAGE_PATH
|
||||
? path.join(process.env.BLOB_STORAGE_PATH, 'uploads')
|
||||
: path.join(getUserHome(), '.flowise', 'uploads')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user