mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
update
This commit is contained in:
@@ -5,12 +5,15 @@ import { mapStoredMessageToChatMessage, AIMessage, HumanMessage, BaseMessage } f
|
|||||||
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams, MemoryMethods, MessageType } from '../../../src/Interface'
|
import { FlowiseMemory, ICommonObject, IMessage, INode, INodeData, INodeParams, MemoryMethods, MessageType } from '../../../src/Interface'
|
||||||
|
|
||||||
let mongoClientSingleton = null
|
let mongoClientSingleton: MongoClient
|
||||||
|
let mongoUrl: string
|
||||||
|
|
||||||
const getMongoClient = async (mongoDBConnectUrl) => {
|
const getMongoClient = async (newMongoUrl: string) => {
|
||||||
if (!mongoClientSingleton) {
|
if (!mongoClientSingleton || newMongoUrl !== mongoUrl) {
|
||||||
mongoClientSingleton = new MongoClient(mongoDBConnectUrl, { useNewUrlParser: true, useUnifiedTopology: true })
|
mongoClientSingleton = new MongoClient(newMongoUrl)
|
||||||
|
mongoUrl = newMongoUrl
|
||||||
await mongoClientSingleton.connect()
|
await mongoClientSingleton.connect()
|
||||||
|
return mongoClientSingleton
|
||||||
}
|
}
|
||||||
return mongoClientSingleton
|
return mongoClientSingleton
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user