pass sessionId to custom tool

This commit is contained in:
Henry
2023-12-20 23:59:04 +00:00
parent be31a4f669
commit 48b17fc785
5 changed files with 464 additions and 51 deletions
+5 -6
View File
@@ -44,8 +44,7 @@ import {
checkMemorySessionId,
clearSessionMemoryFromViewMessageDialog,
getUserHome,
replaceChatHistory,
replaceEnvVariables
replaceChatHistory
} from './utils'
import { cloneDeep, omit, uniqWith, isEqual } from 'lodash'
import { getDataSource } from './DataSource'
@@ -1617,10 +1616,6 @@ export class App {
this.chatflowPool.add(chatflowid, nodeToExecuteData, startingNodes, incomingInput?.overrideConfig)
}
const nodeInstanceFilePath = this.nodesPool.componentNodes[nodeToExecuteData.name].filePath as string
const nodeModule = await import(nodeInstanceFilePath)
const nodeInstance = new nodeModule.nodeClass()
logger.debug(`[server]: Running ${nodeToExecuteData.label} (${nodeToExecuteData.id})`)
let sessionId = undefined
@@ -1634,6 +1629,10 @@ export class App {
chatHistory = await replaceChatHistory(memoryNode, incomingInput, this.AppDataSource, databaseEntities, logger)
}
const nodeInstanceFilePath = this.nodesPool.componentNodes[nodeToExecuteData.name].filePath as string
const nodeModule = await import(nodeInstanceFilePath)
const nodeInstance = new nodeModule.nodeClass({ sessionId })
let result = isStreamValid
? await nodeInstance.run(nodeToExecuteData, incomingInput.question, {
chatflowid,