Merge pull request #1611 from FlowiseAI/feature/LlamaIndex

Feature/llama index
This commit is contained in:
Henry Heng
2024-02-02 20:00:21 +00:00
committed by GitHub
44 changed files with 4048 additions and 75 deletions
+1
View File
@@ -98,6 +98,7 @@ export interface INodeProperties {
version: number
category: string // TODO: use enum instead of string
baseClasses: string[]
tags?: string[]
description?: string
filePath?: string
badge?: string
+22
View File
@@ -662,6 +662,28 @@ export const convertSchemaToZod = (schema: string | object): ICommonObject => {
}
}
/**
* Flatten nested object
* @param {ICommonObject} obj
* @param {string} parentKey
* @returns {ICommonObject}
*/
export const flattenObject = (obj: ICommonObject, parentKey?: string) => {
let result: any = {}
Object.keys(obj).forEach((key) => {
const value = obj[key]
const _key = parentKey ? parentKey + '.' + key : key
if (typeof value === 'object') {
result = { ...result, ...flattenObject(value, _key) }
} else {
result[_key] = value
}
})
return result
}
/**
* Convert BaseMessage to IMessage
* @param {BaseMessage[]} messages