Merge pull request #1419 from vinodkiran/FEATURE/Vision

FEATURE: Add Multi Modal Capabilities to Flowise
This commit is contained in:
Henry Heng
2024-02-27 11:58:47 +08:00
committed by GitHub
91 changed files with 4345 additions and 353 deletions
+36 -5
View File
@@ -27,7 +27,8 @@ import {
ICommonObject,
IDatabaseEntity,
IMessage,
FlowiseMemory
FlowiseMemory,
IFileUpload
} from 'flowise-components'
import { randomBytes } from 'crypto'
import { AES, enc } from 'crypto-js'
@@ -279,7 +280,8 @@ export const buildFlow = async (
overrideConfig?: ICommonObject,
cachePool?: CachePool,
isUpsert?: boolean,
stopNodeId?: string
stopNodeId?: string,
uploads?: IFileUpload[]
) => {
const flowNodes = cloneDeep(reactFlowNodes)
@@ -325,7 +327,8 @@ export const buildFlow = async (
appDataSource,
databaseEntities,
cachePool,
dynamicVariables
dynamicVariables,
uploads
})
logger.debug(`[server]: Finished upserting ${reactFlowNode.data.label} (${reactFlowNode.data.id})`)
break
@@ -340,7 +343,8 @@ export const buildFlow = async (
appDataSource,
databaseEntities,
cachePool,
dynamicVariables
dynamicVariables,
uploads
})
// Save dynamic variables
@@ -596,7 +600,6 @@ export const resolveVariables = (
}
const paramsObj = flowNodeData[types] ?? {}
getParamValues(paramsObj)
return flowNodeData
@@ -1128,6 +1131,34 @@ export const getAllValuesFromJson = (obj: any): any[] => {
return values
}
/**
* Delete file & folder recursively
* @param {string} directory
*/
export const deleteFolderRecursive = (directory: string) => {
if (fs.existsSync(directory)) {
fs.readdir(directory, (error, files) => {
if (error) throw new Error('Could not read directory')
files.forEach((file) => {
const file_path = path.join(directory, file)
fs.stat(file_path, (error, stat) => {
if (error) throw new Error('File do not exist')
if (!stat.isDirectory()) {
fs.unlink(file_path, (error) => {
if (error) throw new Error('Could not delete file')
})
} else {
deleteFolderRecursive(file_path)
}
})
})
})
}
}
/**
* Get only essential flow data items for telemetry
* @param {IReactFlowNode[]} nodes