[Prostgres Vector Store] Add PGVector Driver option + Fix null character issue w/ TypeORM Driver (#3367)

* Add PGVector Driver option + Fix null character issue w/ TypeORM Driver

* Handle file upload case with PGVector

* Cleanup

* Fix data filtering for chatflow uploaded files

* Add distanceStrategy parameter

* Fix query to improve chatflow uploaded files filtering

* Ensure PGVector release connections

* Await client connected

* Make Postgres credentials optionnal when set on env variables

* Document env variables in nodes directories

* Prevent reuse client

* Fix empty metadataFilter

* Update CONTRIBUTING.md

* Update Postgres.ts

---------

Co-authored-by: Henry Heng <henryheng@flowiseai.com>
This commit is contained in:
Jérémy JOURDIN
2024-11-01 19:13:45 +01:00
committed by GitHub
parent 39380a4bc7
commit 15d59a9052
10 changed files with 535 additions and 204 deletions
+13 -2
View File
@@ -542,8 +542,19 @@ export const getCredentialData = async (selectedCredentialId: string, options: I
}
}
export const getCredentialParam = (paramName: string, credentialData: ICommonObject, nodeData: INodeData): any => {
return (nodeData.inputs as ICommonObject)[paramName] ?? credentialData[paramName] ?? undefined
/**
* Get first non falsy value
*
* @param {...any} values
*
* @returns {any|undefined}
*/
export const defaultChain = (...values: any[]): any | undefined => {
return values.filter(Boolean)[0]
}
export const getCredentialParam = (paramName: string, credentialData: ICommonObject, nodeData: INodeData, defaultValue?: any): any => {
return (nodeData.inputs as ICommonObject)[paramName] ?? credentialData[paramName] ?? defaultValue ?? undefined
}
// reference https://www.freeformatter.com/json-escape.html