mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
[fix 4206]: fix the empty array return for getBaseClasses when using typeorm driver and not the PGVectorStore (#4225)
fix the empty array return for getBaseClasses when using typeorm driver and not the PGVectorStore Co-authored-by: Aman Agarwal <aman@syook.com>
This commit is contained in:
@@ -12,6 +12,26 @@ import { getContentColumnName, getDatabase, getHost, getPort, getTableName } fro
|
|||||||
|
|
||||||
const serverCredentialsExists = !!process.env.POSTGRES_VECTORSTORE_USER && !!process.env.POSTGRES_VECTORSTORE_PASSWORD
|
const serverCredentialsExists = !!process.env.POSTGRES_VECTORSTORE_USER && !!process.env.POSTGRES_VECTORSTORE_PASSWORD
|
||||||
|
|
||||||
|
// added temporarily to fix the base class return for VectorStore when postgres node is using TypeORM
|
||||||
|
function getVectorStoreBaseClasses() {
|
||||||
|
// Try getting base classes through the utility function
|
||||||
|
const baseClasses = getBaseClasses(VectorStore)
|
||||||
|
|
||||||
|
// If we got results, return them
|
||||||
|
if (baseClasses && baseClasses.length > 0) {
|
||||||
|
return baseClasses
|
||||||
|
}
|
||||||
|
|
||||||
|
// If VectorStore is recognized as a class but getBaseClasses returned nothing,
|
||||||
|
// return the known inheritance chain
|
||||||
|
if (VectorStore instanceof Function) {
|
||||||
|
return ['VectorStore']
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback to minimum required class
|
||||||
|
return ['VectorStore']
|
||||||
|
}
|
||||||
|
|
||||||
class Postgres_VectorStores implements INode {
|
class Postgres_VectorStores implements INode {
|
||||||
label: string
|
label: string
|
||||||
name: string
|
name: string
|
||||||
@@ -195,7 +215,11 @@ class Postgres_VectorStores implements INode {
|
|||||||
{
|
{
|
||||||
label: 'Postgres Vector Store',
|
label: 'Postgres Vector Store',
|
||||||
name: 'vectorStore',
|
name: 'vectorStore',
|
||||||
baseClasses: [this.type, ...getBaseClasses(VectorStore)]
|
baseClasses: [
|
||||||
|
this.type,
|
||||||
|
// ...getBaseClasses(VectorStore), // disabled temporarily for using TypeORM
|
||||||
|
...getVectorStoreBaseClasses() // added temporarily for using TypeORM
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user