mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
fix(components/weaviate): fix metadata special chars upsertion failure (#4436)
* Enhancement: Add recursive key normalization for metadata in Weaviate vector store - Introduced `normalizeKeysRecursively` utility to standardize metadata keys. - Updated Weaviate vector store to apply normalization on document metadata before processing. * format(compnonents/utils): format for ci * Update utils.ts --------- Co-authored-by: Henry Heng <henryheng@flowiseai.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import { WeaviateLibArgs, WeaviateStore } from '@langchain/weaviate'
|
||||
import { Document } from '@langchain/core/documents'
|
||||
import { Embeddings } from '@langchain/core/embeddings'
|
||||
import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams, IndexingResult } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam, normalizeKeysRecursively } from '../../../src/utils'
|
||||
import { addMMRInputParams, resolveVectorStoreOrRetriever } from '../VectorStoreUtils'
|
||||
import { index } from '../../../src/indexing'
|
||||
import { VectorStore } from '@langchain/core/vectorstores'
|
||||
@@ -175,7 +175,11 @@ class Weaviate_VectorStores implements INode {
|
||||
const finalDocs = []
|
||||
for (let i = 0; i < flattenDocs.length; i += 1) {
|
||||
if (flattenDocs[i] && flattenDocs[i].pageContent) {
|
||||
finalDocs.push(new Document(flattenDocs[i]))
|
||||
const doc = { ...flattenDocs[i] }
|
||||
if (doc.metadata) {
|
||||
doc.metadata = normalizeKeysRecursively(doc.metadata)
|
||||
}
|
||||
finalDocs.push(new Document(doc))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user