Skip to content

Commit fd8a05d

Browse files
amanthegreatoneaman-syook
authored andcommitted
[fix 4206]: fix the empty array return for getBaseClasses when using typeorm driver and not the PGVectorStore (FlowiseAI#4225)
fix the empty array return for getBaseClasses when using typeorm driver and not the PGVectorStore Co-authored-by: Aman Agarwal <[email protected]>
1 parent a249521 commit fd8a05d

File tree

1 file changed

+25
-1
lines changed
  • packages/components/nodes/vectorstores/Postgres

1 file changed

+25
-1
lines changed

packages/components/nodes/vectorstores/Postgres/Postgres.ts

+25-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ import { PGVectorDriver } from './driver/PGVector'
1313

1414
const serverCredentialsExists = !!process.env.POSTGRES_VECTORSTORE_USER && !!process.env.POSTGRES_VECTORSTORE_PASSWORD
1515

16+
// added temporarily to fix the base class return for VectorStore when postgres node is using TypeORM
17+
function getVectorStoreBaseClasses() {
18+
// Try getting base classes through the utility function
19+
const baseClasses = getBaseClasses(VectorStore)
20+
21+
// If we got results, return them
22+
if (baseClasses && baseClasses.length > 0) {
23+
return baseClasses
24+
}
25+
26+
// If VectorStore is recognized as a class but getBaseClasses returned nothing,
27+
// return the known inheritance chain
28+
if (VectorStore instanceof Function) {
29+
return ['VectorStore']
30+
}
31+
32+
// Fallback to minimum required class
33+
return ['VectorStore']
34+
}
35+
1636
class Postgres_VectorStores implements INode {
1737
label: string
1838
name: string
@@ -188,7 +208,11 @@ class Postgres_VectorStores implements INode {
188208
{
189209
label: 'Postgres Vector Store',
190210
name: 'vectorStore',
191-
baseClasses: [this.type, ...getBaseClasses(VectorStore)]
211+
baseClasses: [
212+
this.type,
213+
// ...getBaseClasses(VectorStore), // disabled temporarily for using TypeORM
214+
...getVectorStoreBaseClasses() // added temporarily for using TypeORM
215+
]
192216
}
193217
]
194218
}

0 commit comments

Comments
 (0)