mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 11:00:55 +03:00
change flat to flatten from lodash
This commit is contained in:
@@ -3,6 +3,7 @@ import { Chroma } from 'langchain/vectorstores/chroma'
|
||||
import { Embeddings } from 'langchain/embeddings/base'
|
||||
import { Document } from 'langchain/document'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { flatten } from 'lodash'
|
||||
|
||||
class ChromaUpsert_VectorStores implements INode {
|
||||
label: string
|
||||
@@ -68,7 +69,7 @@ class ChromaUpsert_VectorStores implements INode {
|
||||
const chromaURL = nodeData.inputs?.chromaURL as string
|
||||
const output = nodeData.outputs?.output as string
|
||||
|
||||
const flattenDocs = docs && docs.length ? docs.flat() : []
|
||||
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
||||
const finalDocs = []
|
||||
for (let i = 0; i < flattenDocs.length; i += 1) {
|
||||
finalDocs.push(new Document(flattenDocs[i]))
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Embeddings } from 'langchain/embeddings/base'
|
||||
import { Document } from 'langchain/document'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { FaissStore } from 'langchain/vectorstores/faiss'
|
||||
import { flatten } from 'lodash'
|
||||
|
||||
class FaissUpsert_VectorStores implements INode {
|
||||
label: string
|
||||
@@ -63,7 +64,7 @@ class FaissUpsert_VectorStores implements INode {
|
||||
const output = nodeData.outputs?.output as string
|
||||
const basePath = nodeData.inputs?.basePath as string
|
||||
|
||||
const flattenDocs = docs && docs.length ? docs.flat() : []
|
||||
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
||||
const finalDocs = []
|
||||
for (let i = 0; i < flattenDocs.length; i += 1) {
|
||||
finalDocs.push(new Document(flattenDocs[i]))
|
||||
|
||||
@@ -3,6 +3,7 @@ import { MemoryVectorStore } from 'langchain/vectorstores/memory'
|
||||
import { Embeddings } from 'langchain/embeddings/base'
|
||||
import { Document } from 'langchain/document'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { flatten } from 'lodash'
|
||||
|
||||
class InMemoryVectorStore_VectorStores implements INode {
|
||||
label: string
|
||||
@@ -55,7 +56,7 @@ class InMemoryVectorStore_VectorStores implements INode {
|
||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||
const output = nodeData.outputs?.output as string
|
||||
|
||||
const flattenDocs = docs && docs.length ? docs.flat() : []
|
||||
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
||||
const finalDocs = []
|
||||
for (let i = 0; i < flattenDocs.length; i += 1) {
|
||||
finalDocs.push(new Document(flattenDocs[i]))
|
||||
|
||||
@@ -4,6 +4,7 @@ import { PineconeLibArgs, PineconeStore } from 'langchain/vectorstores/pinecone'
|
||||
import { Embeddings } from 'langchain/embeddings/base'
|
||||
import { Document } from 'langchain/document'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { flatten } from 'lodash'
|
||||
|
||||
class PineconeUpsert_VectorStores implements INode {
|
||||
label: string
|
||||
@@ -90,7 +91,7 @@ class PineconeUpsert_VectorStores implements INode {
|
||||
|
||||
const pineconeIndex = client.Index(index)
|
||||
|
||||
const flattenDocs = docs && docs.length ? docs.flat() : []
|
||||
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
||||
const finalDocs = []
|
||||
for (let i = 0; i < flattenDocs.length; i += 1) {
|
||||
finalDocs.push(new Document(flattenDocs[i]))
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Document } from 'langchain/document'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { SupabaseVectorStore } from 'langchain/vectorstores/supabase'
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
import { flatten } from 'lodash'
|
||||
|
||||
class SupabaseUpsert_VectorStores implements INode {
|
||||
label: string
|
||||
@@ -82,7 +83,7 @@ class SupabaseUpsert_VectorStores implements INode {
|
||||
|
||||
const client = createClient(supabaseProjUrl, supabaseApiKey)
|
||||
|
||||
const flattenDocs = docs && docs.length ? docs.flat() : []
|
||||
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
||||
const finalDocs = []
|
||||
for (let i = 0; i < flattenDocs.length; i += 1) {
|
||||
finalDocs.push(new Document(flattenDocs[i]))
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Document } from 'langchain/document'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { WeaviateLibArgs, WeaviateStore } from 'langchain/vectorstores/weaviate'
|
||||
import weaviate, { WeaviateClient, ApiKey } from 'weaviate-ts-client'
|
||||
import { flatten } from 'lodash'
|
||||
|
||||
class WeaviateUpsert_VectorStores implements INode {
|
||||
label: string
|
||||
@@ -122,7 +123,7 @@ class WeaviateUpsert_VectorStores implements INode {
|
||||
|
||||
const client: WeaviateClient = weaviate.client(clientConfig)
|
||||
|
||||
const flattenDocs = docs && docs.length ? docs.flat() : []
|
||||
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
||||
const finalDocs = []
|
||||
for (let i = 0; i < flattenDocs.length; i += 1) {
|
||||
finalDocs.push(new Document(flattenDocs[i]))
|
||||
|
||||
Reference in New Issue
Block a user