fix: childprocess chatId.
This commit is contained in:
parent
fd9d6fcb03
commit
fe6737a6cb
|
|
@ -39,7 +39,7 @@ class ZepMemory_Memory implements INode {
|
|||
label: 'Session Id',
|
||||
name: 'sessionId',
|
||||
type: 'string',
|
||||
placeholder: 'if empty, chatId will be used automatically',
|
||||
description: 'if empty, chatId will be used automatically',
|
||||
default: '',
|
||||
additionalParams: true
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { IChildProcessMessage, IReactFlowNode, IReactFlowObject, IRunChatflowMessageValue, INodeData } from './Interface'
|
||||
import { buildLangchain, constructGraphs, getEndingNode, getStartingNodes, resolveVariables } from './utils'
|
||||
import { getChatId } from './index'
|
||||
|
||||
export class ChildProcess {
|
||||
/**
|
||||
|
|
@ -24,7 +23,7 @@ export class ChildProcess {
|
|||
await sendToParentProcess('start', '_')
|
||||
|
||||
// Create a Queue and add our initial node in it
|
||||
const { endingNodeData, chatflow, incomingInput, componentNodes } = messageValue
|
||||
const { endingNodeData, chatflow, chatId, incomingInput, componentNodes } = messageValue
|
||||
|
||||
let nodeToExecuteData: INodeData
|
||||
let addToChatFlowPool: any = {}
|
||||
|
|
@ -77,7 +76,6 @@ export class ChildProcess {
|
|||
const { startingNodeIds, depthQueue } = getStartingNodes(nonDirectedGraph, endingNodeId)
|
||||
|
||||
/*** BFS to traverse from Starting Nodes to Ending Node ***/
|
||||
const chatId = await getChatId(chatflow.id)
|
||||
const reactFlowNodes = await buildLangchain(
|
||||
startingNodeIds,
|
||||
nodes,
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ export interface IDatabaseExport {
|
|||
|
||||
export interface IRunChatflowMessageValue {
|
||||
chatflow: IChatFlow
|
||||
chatId: string
|
||||
incomingInput: IncomingInput
|
||||
componentNodes: IComponentNodes
|
||||
endingNodeData?: INodeData
|
||||
|
|
|
|||
|
|
@ -441,9 +441,11 @@ export class App {
|
|||
if (!fs.existsSync(childpath)) childpath = 'ChildProcess.ts'
|
||||
|
||||
const childProcess = fork(childpath, [], { signal })
|
||||
const chatId = await getChatId(chatflow.id)
|
||||
|
||||
const value = {
|
||||
chatflow,
|
||||
chatId,
|
||||
incomingInput,
|
||||
componentNodes: cloneDeep(this.nodesPool.componentNodes),
|
||||
endingNodeData
|
||||
|
|
@ -665,6 +667,11 @@ export class App {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get first chat message id
|
||||
* @param {string} chatflowid
|
||||
* @returns {string}
|
||||
*/
|
||||
export async function getChatId(chatflowid: string) {
|
||||
// first chatmessage id as the unique chat id
|
||||
const firstChatMessage = await getDataSource()
|
||||
|
|
|
|||
Loading…
Reference in New Issue