|
import { ICommonObject } from 'flowise-components' |
|
import { IActiveChatflows, INodeData, IReactFlowNode } from './Interface' |
|
|
|
|
|
|
|
|
|
|
|
export class ChatflowPool { |
|
activeChatflows: IActiveChatflows = {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add(chatflowid: string, endingNodeData: INodeData, startingNodes: IReactFlowNode[], overrideConfig?: ICommonObject) { |
|
this.activeChatflows[chatflowid] = { |
|
startingNodes, |
|
endingNodeData, |
|
inSync: true |
|
} |
|
if (overrideConfig) this.activeChatflows[chatflowid].overrideConfig = overrideConfig |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
updateInSync(chatflowid: string, inSync: boolean) { |
|
if (Object.prototype.hasOwnProperty.call(this.activeChatflows, chatflowid)) { |
|
this.activeChatflows[chatflowid].inSync = inSync |
|
} |
|
} |
|
|
|
|
|
|
|
|
|
|
|
async remove(chatflowid: string) { |
|
if (Object.prototype.hasOwnProperty.call(this.activeChatflows, chatflowid)) { |
|
delete this.activeChatflows[chatflowid] |
|
} |
|
} |
|
} |
|
|