mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Merge branch 'main' into chore/Upgrade-LC-version
# Conflicts: # packages/components/package.json
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user