mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Bugfix/Update file loader (#4420)
* update file loader * delete temp for o1 * fix tavily
This commit is contained in:
@@ -46,6 +46,28 @@ export const createFileAttachment = async (req: Request) => {
|
||||
throw new InternalFlowiseError(StatusCodes.NOT_FOUND, `Chatflow ${chatflowid} not found`)
|
||||
}
|
||||
|
||||
// Parse chatbot configuration to get file upload settings
|
||||
let pdfConfig = {
|
||||
usage: 'perPage',
|
||||
legacyBuild: false
|
||||
}
|
||||
|
||||
if (chatflow.chatbotConfig) {
|
||||
try {
|
||||
const chatbotConfig = JSON.parse(chatflow.chatbotConfig)
|
||||
if (chatbotConfig?.fullFileUpload?.pdfFile) {
|
||||
if (chatbotConfig.fullFileUpload.pdfFile.usage) {
|
||||
pdfConfig.usage = chatbotConfig.fullFileUpload.pdfFile.usage
|
||||
}
|
||||
if (chatbotConfig.fullFileUpload.pdfFile.legacyBuild !== undefined) {
|
||||
pdfConfig.legacyBuild = chatbotConfig.fullFileUpload.pdfFile.legacyBuild
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// Use default PDF config if parsing fails
|
||||
}
|
||||
}
|
||||
|
||||
// Find FileLoader node
|
||||
const fileLoaderComponent = appServer.nodesPool.componentNodes['fileLoader']
|
||||
const fileLoaderNodeInstanceFilePath = fileLoaderComponent.filePath as string
|
||||
@@ -93,6 +115,12 @@ export const createFileAttachment = async (req: Request) => {
|
||||
outputs: { output: 'document' }
|
||||
}
|
||||
|
||||
// Apply PDF specific configuration if this is a PDF file
|
||||
if (fileInputField === 'pdfFile') {
|
||||
nodeData.inputs.usage = pdfConfig.usage
|
||||
nodeData.inputs.legacyBuild = pdfConfig.legacyBuild as unknown as string
|
||||
}
|
||||
|
||||
let content = ''
|
||||
|
||||
if (isBase64) {
|
||||
|
||||
Reference in New Issue
Block a user