MCPcopy
hub / github.com/FlowiseAI/Flowise / getInstance

Method getInstance

packages/components/src/handler.ts:710–724  ·  view source on GitHub ↗
(nodeData: INodeData, options: ICommonObject)

Source from the content-addressed store, hash-verified

708 }
709
710 static getInstance(nodeData: INodeData, options: ICommonObject): AnalyticHandler {
711 const chatId = options.chatId
712 if (!chatId) throw new Error('ChatId is required for analytics')
713
714 // Reset instance if analytics config changed for this chat
715 const instance = AnalyticHandler.instances.get(chatId)
716 if (instance?.analyticsConfig !== options.analytic) {
717 AnalyticHandler.resetInstance(chatId)
718 }
719
720 if (!AnalyticHandler.instances.get(chatId)) {
721 AnalyticHandler.instances.set(chatId, new AnalyticHandler(nodeData, options))
722 }
723 return AnalyticHandler.instances.get(chatId)!
724 }
725
726 static resetInstance(chatId: string): void {
727 AnalyticHandler.instances.delete(chatId)

Callers 2

runMethod · 0.45
handler.test.tsFile · 0.45

Calls 3

resetInstanceMethod · 0.80
setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected